File indexing completed on 2024-05-05 04:48:37

0001 /****************************************************************************************
0002  * Copyright (c) 2008 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 LAYOUTCONFIGACTION_H
0019 #define LAYOUTCONFIGACTION_H
0020 
0021 #include <QAction>
0022 #include <QPushButton>
0023 #include <QMenu>
0024 
0025 
0026 namespace Playlist {
0027 
0028 class PlaylistLayoutEditDialog;
0029 
0030 /**
0031  * Action used to show a menu for selecting active playlist layout. Also contains an entry for showing the
0032  * playlist layout editor.
0033  * @author Nikolaj Hald Nielsen <nhn@kde.org>
0034  */
0035 class LayoutConfigAction : public QAction
0036 {
0037     Q_OBJECT
0038 
0039     public:
0040         /**
0041          * Constructor.
0042          * @param parent Parent widget.
0043          */
0044         explicit LayoutConfigAction( QWidget * parent );
0045 
0046         /**
0047          * Destructor.
0048          */
0049         ~LayoutConfigAction() override;
0050 
0051     protected Q_SLOTS:
0052 
0053         /**
0054          * Set the currently active layout based on the selected action.
0055          * @param layoutAction The layoutAction triggered.
0056          */
0057         void setActiveLayout( QAction *layoutAction );
0058 
0059         /**
0060          * Notify the action that the list of selectable layouts have changed. Clears the list of layouts
0061          * and refetches it from the LayoutManager.
0062          */
0063         void layoutListChanged();
0064 
0065         /**
0066          * Launch the playlist layout editor.
0067          */
0068         void configureLayouts();
0069 
0070         /**
0071          * The active layout has changed. Update the selected item to represent this.
0072          */
0073         void onActiveLayoutChanged();
0074 
0075     private:
0076         QAction *m_configAction;
0077         QActionGroup *m_layoutActions;
0078         QMenu *m_layoutMenu;
0079         PlaylistLayoutEditDialog * m_layoutDialog;
0080 };
0081 
0082 }
0083 
0084 #endif