File indexing completed on 2024-05-05 05:35:34

0001 #ifndef ShadowConfigWidget_h
0002 #define ShadowConfigWidget_h
0003 //////////////////////////////////////////////////////////////////////////////
0004 // ShadowConfigWidget.h
0005 // -------------------
0006 //
0007 // SPDX-FileCopyrightText: 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0008 //
0009 // SPDX-License-Identifier: MIT
0010 //////////////////////////////////////////////////////////////////////////////
0011 
0012 #include <KConfig>
0013 #include <QCheckBox>
0014 #include <QGroupBox>
0015 
0016 #include "oxygen_config_export.h"
0017 
0018 // forward declaration
0019 class Ui_ShadowConfiguraionUI;
0020 
0021 namespace Oxygen
0022 {
0023 //* shadow configuration widget
0024 class OXYGEN_CONFIG_EXPORT ShadowConfigWidget : public QGroupBox
0025 {
0026     Q_OBJECT
0027 
0028 public:
0029     //* constructor
0030     explicit ShadowConfigWidget(QWidget *);
0031 
0032     //* destructor
0033     ~ShadowConfigWidget(void) override;
0034 
0035     //* group
0036     void setGroup(QPalette::ColorGroup group)
0037     {
0038         _group = group;
0039     }
0040 
0041     //* read defaults
0042     void setDefaults(void)
0043     {
0044         load(true);
0045     }
0046 
0047     //* read config
0048     void load(void)
0049     {
0050         load(false);
0051     }
0052 
0053     //* write config
0054     void save(void) const;
0055 
0056     //* true if modified
0057     bool isChanged(void) const
0058     {
0059         return _changed;
0060     }
0061 
0062 Q_SIGNALS:
0063 
0064     //* emmitted when configuration is changed
0065     void changed(bool);
0066 
0067 private Q_SLOTS:
0068 
0069     //* update changed state
0070     void updateChanged();
0071 
0072 private:
0073     //* read config
0074     void load(bool);
0075 
0076     //* set changed state
0077     void setChanged(bool value)
0078     {
0079         _changed = value;
0080         emit changed(value);
0081     }
0082 
0083     //* ui
0084     Ui_ShadowConfiguraionUI *ui = nullptr;
0085 
0086     //* color group
0087     QPalette::ColorGroup _group = QPalette::Inactive;
0088 
0089     //* changed state
0090     bool _changed = false;
0091 };
0092 }
0093 
0094 #endif