File indexing completed on 2024-05-05 04:47:31

0001 /****************************************************************************************
0002  * Copyright (c) 2004-2008 Mark Kretschmann <kretschmann@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 AMAROK2CONFIGDIALOG_H
0018 #define AMAROK2CONFIGDIALOG_H
0019 
0020 #include <KConfigDialog>
0021 #include <KCoreConfigSkeleton>
0022 #include <KWindowConfig>
0023 
0024 
0025 class ConfigDialogBase;
0026 
0027 
0028 class ConfigDialogBase;
0029 
0030 class Amarok2ConfigDialog : public KConfigDialog
0031 {
0032     Q_OBJECT
0033 
0034     public:
0035         Amarok2ConfigDialog( QWidget *parent, const char* name, KCoreConfigSkeleton *config );
0036         ~Amarok2ConfigDialog() override;
0037 
0038         void addPage( ConfigDialogBase *page, const QString &itemName, const QString &pixmapName,
0039                       const QString &header = QString(), bool manage = true );
0040 
0041     public Q_SLOTS:
0042         /**
0043          * Shows the config dialog and sets the current page to "page"
0044          *
0045          * @param page (class name of the dialog).
0046          */
0047         void show( QString page );
0048 
0049         /**
0050          * Updates the state of the Apply button. Useful for widgets that are not managed by KConfigXT.
0051          */
0052         void updateButtons();
0053 
0054     protected Q_SLOTS:
0055         void updateSettings() override;
0056         void updateWidgets() override;
0057         void updateWidgetsDefault() override;
0058 
0059     protected:
0060         bool hasChanged() override;
0061         bool isDefault() override;
0062 
0063     private:
0064         QList<ConfigDialogBase*> m_pageList;
0065         QMap<ConfigDialogBase*, KPageWidgetItem*> m_pageMap;
0066 
0067         static QString s_currentPage;
0068 };
0069 
0070 
0071 #endif // AMAROK2CONFIGDIALOG_H