Warning, file /multimedia/amarok/src/browsers/BrowserBreadcrumbWidget.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 * * 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 BROWSERBREADCRUMBWIDGET_H 0018 #define BROWSERBREADCRUMBWIDGET_H 0019 0020 #include "widgets/BoxWidget.h" 0021 0022 #include <QList> 0023 #include <QPushButton> 0024 #include <QStackedWidget> 0025 #include <QStringList> 0026 0027 class BreadcrumbItemMenuButton; 0028 class BrowserBreadcrumbItem; 0029 class BrowserCategoryList; 0030 0031 /** 0032 * A widget for displaying the current state of and navigating the category dig down interface. 0033 * 0034 * @author Nikolaj Hald Nielsen <nhn@kde.org> 0035 */ 0036 class BrowserBreadcrumbWidget : public BoxWidget 0037 { 0038 Q_OBJECT 0039 public: 0040 0041 /** 0042 * Constructor 0043 * @param parent the parent widget 0044 */ 0045 explicit BrowserBreadcrumbWidget( QWidget * parent ); 0046 0047 /** 0048 * Destructor 0049 */ 0050 ~BrowserBreadcrumbWidget() override; 0051 0052 /** 0053 * Set the BrowserCategoryList which acts as the "root" of the breadcrumb widget. 0054 * A root breadcrumb item is created that represents the lowest level, and the categories 0055 * in the list are added to the items drop-down menu. 0056 * @param rootList the BrowserCategoryList representing the lowest level in the navigation hirachy 0057 */ 0058 void setRootList( BrowserCategoryList *rootList ); 0059 0060 Q_SIGNALS: 0061 /** 0062 * Signal emitted when the root breadcrumb item is clicked. 0063 */ 0064 void toHome(); 0065 0066 public Q_SLOTS: 0067 /** 0068 * Rebuild the list of breadcrumb items corresponding to the current location in the hierarchy. 0069 * This also allows for categories that add additional breadcrumb items (such as the file browser) to update the 0070 * breadcrumbs when their internal state changes. 0071 */ 0072 void updateBreadcrumbs(); 0073 0074 protected: 0075 void resizeEvent( QResizeEvent * event ) override; 0076 0077 private Q_SLOTS: 0078 /** 0079 * Goes through all breadcrumb items and shows the most relevant ones based on 0080 * available size. (always shows home icon and the last item) 0081 */ 0082 void showAsNeeded(); 0083 0084 private: 0085 /** 0086 * Remove all breadcrumb items 0087 */ 0088 void clearCrumbs(); 0089 0090 /** 0091 * Recursive function that traverses the tree of BrowserCategoryList's 0092 * and adds each one as a level in the breadcrumb. 0093 * @param list the root level BrowserCategoryList. 0094 */ 0095 void addLevel( BrowserCategoryList *list ); 0096 0097 /** 0098 * Helper function for addLevel() that first hides BrowserBreadcrumbItem, adds it to 0099 * to breadcrumb area. 0100 */ 0101 void addBreadCrumbItem( BrowserBreadcrumbItem *item ); 0102 0103 //QStringList m_currentPath; 0104 BrowserCategoryList * m_rootList; 0105 0106 BoxWidget *m_breadcrumbArea; 0107 0108 }; 0109 0110 #endif