File indexing completed on 2024-05-12 17:10:47

0001 /***************************************************************************
0002  *   Copyright (C) 2008-2011 by Dario Freddi <drf@kde.org>                 *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  *                                                                         *
0009  *   This program is distributed in the hope that it will be useful,       *
0010  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
0011  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
0012  *   GNU General Public License for more details.                          *
0013  *                                                                         *
0014  *   You should have received a copy of the GNU General Public License     *
0015  *   along with this program; if not, write to the                         *
0016  *   Free Software Foundation, Inc.,                                       *
0017  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA .        *
0018  ***************************************************************************/
0019 
0020 
0021 #ifndef ACTIONEDITWIDGET_H
0022 #define ACTIONEDITWIDGET_H
0023 
0024 #include <QWidget>
0025 
0026 #include <KSharedConfig>
0027 
0028 namespace PowerDevil
0029 {
0030 class ActionConfig;
0031 }
0032 
0033 class QCheckBox;
0034 class KConfigGroup;
0035 
0036 class Q_DECL_EXPORT ActionEditWidget : public QWidget
0037 {
0038     Q_OBJECT
0039 public:
0040     explicit ActionEditWidget(const QString &configName, QWidget *parent = nullptr);
0041     ~ActionEditWidget() override;
0042 
0043     QString configName() const;
0044 
0045 public Q_SLOTS:
0046     void load();
0047     void save();
0048 
0049 private Q_SLOTS:
0050     void onChanged();
0051 
0052 Q_SIGNALS:
0053     void changed(bool changed);
0054 
0055 private:
0056     KConfigGroup configGroup();
0057 
0058 private:
0059     QString m_configName;
0060     KSharedConfig::Ptr m_profilesConfig;
0061     QHash< QString, QCheckBox* > m_actionsHash;
0062     QHash< QString, PowerDevil::ActionConfig* > m_actionsConfigHash;
0063 };
0064 
0065 #endif // ACTIONEDITWIDGET_H