File indexing completed on 2024-05-05 04:49:24

0001 /****************************************************************************************
0002  * Copyright (c) 2010 Rick W. Chen <stuffcorpse@archlinux.us>                           *
0003  *                                                                                      *
0004  * This program is free software; you can redistribute it and/or modify it under        *
0005  * the terms of the GNU General Public License as published by the Free Software        *
0006  * Foundation; either version 2 of the License, or (at your option) any later           *
0007  * version.                                                                             *
0008  *                                                                                      *
0009  * This program is distributed in the hope that it will be useful, but WITHOUT ANY      *
0010  * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A      *
0011  * PARTICULAR PURPOSE. See the GNU General Public License for more details.             *
0012  *                                                                                      *
0013  * You should have received a copy of the GNU General Public License along with         *
0014  * this program.  If not, see <http://www.gnu.org/licenses/>.                           *
0015  ****************************************************************************************/
0016 
0017 #ifndef AMAROK_ALBUMBREADCRUMBWIDGET_H
0018 #define AMAROK_ALBUMBREADCRUMBWIDGET_H
0019 
0020 #include "core/meta/forward_declarations.h"
0021 #include "widgets/BoxWidget.h"
0022 
0023 class BreadcrumbItemButton;
0024 
0025 /**
0026  * This simple widget shows a breadcrumb-like display of one artist and one
0027  * album. Clicking on the artist or album emits signals containing their meta
0028  * objects and names.
0029  *
0030  * It looks like this:
0031  * \code
0032  *    +-------------------------------+
0033  *    | > X artist  > Y album         |
0034  *    +-------------------------------+
0035  *    where X and Y are generic artist and album icons respectively.
0036  * \endcode
0037  *
0038  * TODO: list artists/albums when clicking on the '>' to be more useful
0039  */
0040 class AlbumBreadcrumbWidget : public BoxWidget
0041 {
0042     Q_OBJECT
0043 
0044 public:
0045     explicit AlbumBreadcrumbWidget( const Meta::AlbumPtr &album, QWidget *parent = nullptr );
0046     ~AlbumBreadcrumbWidget() override;
0047 
0048     void setAlbum( const Meta::AlbumPtr &album );
0049 
0050 Q_SIGNALS:
0051     void artistClicked( const QString& );
0052     void albumClicked( const QString& );
0053 
0054 private Q_SLOTS:
0055     void slotArtistClicked();
0056     void slotAlbumClicked();
0057 
0058 private:
0059     Meta::AlbumPtr m_album;
0060     BreadcrumbItemButton *m_artistButton;
0061     BreadcrumbItemButton *m_albumButton;
0062 
0063     void updateBreadcrumbs();
0064 };
0065 
0066 #endif /* AMAROK_ALBUMBREADCRUMBWIDGET_H */