Warning, file /multimedia/amarok/src/playlist/PlaylistBreadcrumbItem.h was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 /**************************************************************************************** 0002 * Copyright (c) 2009 Nikolaj Hald Nielsen <nhn@kde.org> * 0003 * Copyright (c) 2009 Téo Mrnjavac <teo@kde.org> * 0004 * * 0005 * This program is free software; you can redistribute it and/or modify it under * 0006 * the terms of the GNU General Public License as published by the Free Software * 0007 * Foundation; either version 2 of the License, or (at your option) any later * 0008 * version. * 0009 * * 0010 * This program is distributed in the hope that it will be useful, but WITHOUT ANY * 0011 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * 0012 * PARTICULAR PURPOSE. See the GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License along with * 0015 * this program. If not, see <http://www.gnu.org/licenses/>. * 0016 ****************************************************************************************/ 0017 0018 #ifndef PLAYLISTBREADCRUMBITEM_H 0019 #define PLAYLISTBREADCRUMBITEM_H 0020 0021 #include "PlaylistBreadcrumbItemSortButton.h" 0022 #include "PlaylistBreadcrumbLevel.h" 0023 #include "PlaylistDefines.h" 0024 #include "widgets/BoxWidget.h" 0025 0026 #include <QMenu> 0027 #include <QStringList> 0028 0029 namespace Playlist 0030 { 0031 0032 /** 0033 * A menu that is filled with elements consisting of sortable columns 0034 * and shuffle action. 0035 */ 0036 class BreadcrumbItemMenu : public QMenu 0037 { 0038 Q_OBJECT 0039 0040 public: 0041 /** 0042 * Constructor. 0043 * @param currentColumn The column corresponding to the current sort level 0044 * @param parent The parent QWidget 0045 */ 0046 explicit BreadcrumbItemMenu( Column currentColumn, QWidget *parent = nullptr ); 0047 0048 /** 0049 * Destructor. 0050 */ 0051 ~BreadcrumbItemMenu() override; 0052 0053 Q_SIGNALS: 0054 /** 0055 * Emitted when a non-Shuffle item is triggered from the menu. 0056 * @param internalColName the internal name of the column in which the menu has been triggered. 0057 */ 0058 void actionClicked( QString internalColName ); 0059 0060 /** 0061 * Emitted when the Shuffle item is triggered from the menu. 0062 */ 0063 void shuffleActionClicked(); 0064 0065 private Q_SLOTS: 0066 /** 0067 * Handles the selection of an item from the menu. 0068 * @param action the action in the menu that has been triggered. 0069 */ 0070 void actionTriggered( QAction *action ); 0071 }; 0072 0073 /** 0074 * A single item that represents a level of a general-purpose breadcrumb ribbon. 0075 * @author Téo Mrnjavac <teo@kde.org> 0076 */ 0077 class BreadcrumbItem : public BoxWidget 0078 { 0079 Q_OBJECT 0080 0081 public: 0082 /** 0083 * Constructor. 0084 * @param level The BreadcrumbLevel assigned to this item. 0085 * @param parent The parent QWidget. 0086 */ 0087 explicit BreadcrumbItem( BreadcrumbLevel *level, QWidget *parent = nullptr ); 0088 0089 /** 0090 * Destructor. 0091 */ 0092 ~BreadcrumbItem() override; 0093 0094 /** 0095 * Returns the internal name of this item. 0096 * @return the name; 0097 */ 0098 QString name() const; 0099 0100 /** 0101 * Returns the user visible name of this item. 0102 * @return the name; 0103 */ 0104 QString prettyName() const { return m_prettyName; } 0105 0106 /** 0107 * Returns the state of the sort order. 0108 * @return the sort order. 0109 */ 0110 Qt::SortOrder sortOrder() const; 0111 0112 /** 0113 * Flips the Qt::SortOrder state of the main button. 0114 */ 0115 void invertOrder(); 0116 0117 /** 0118 * Menu accessor for the purpose of connecting to menu's signals. 0119 * @return a pointer to the constant menu object. 0120 */ 0121 const BreadcrumbItemMenu *menu(); 0122 0123 Q_SIGNALS: 0124 /** 0125 * Emitted when the item has been clicked. 0126 */ 0127 void clicked(); 0128 0129 /** 0130 * Emitted when the sort order of this item has been inverted. 0131 */ 0132 void orderInverted(); 0133 0134 protected Q_SLOTS: 0135 void updateSizePolicy(); 0136 0137 private: 0138 BreadcrumbItemMenu *m_menu; 0139 BreadcrumbItemMenuButton *m_menuButton; 0140 BreadcrumbItemSortButton *m_mainButton; 0141 QString m_name; 0142 QString m_prettyName; 0143 }; 0144 0145 /** 0146 * A button with a tiny "+" icon in it which spawns a menu to add a sort level. 0147 * @author Téo Mrnjavac <teo@kde.org> 0148 */ 0149 class BreadcrumbAddMenuButton : public BreadcrumbItemMenuButton 0150 { 0151 Q_OBJECT 0152 0153 public: 0154 /** 0155 * Constructor. 0156 */ 0157 explicit BreadcrumbAddMenuButton( QWidget *parent ); 0158 0159 /** 0160 * Destructor. 0161 */ 0162 ~BreadcrumbAddMenuButton() override; 0163 0164 /** 0165 * Menu accessor for the purpose of connecting to menu's signals. 0166 * @return a pointer to the constant menu object. 0167 */ 0168 const BreadcrumbItemMenu *menu(); 0169 0170 /** 0171 * Updates the menu when the breadcrumb path changes. 0172 * @param usedBreadcrumbLevels the levels used in the path. 0173 */ 0174 void updateMenu( const QStringList &usedBreadcrumbLevels ); 0175 0176 private: 0177 BreadcrumbItemMenu *m_menu; 0178 }; 0179 0180 } //namespace Playlist 0181 0182 #endif //PLAYLISTBREADCRUMBITEM_H