File indexing completed on 2024-05-12 13:38:22

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 
0024 //* shadow configuration widget
0025 class OXYGEN_CONFIG_EXPORT ShadowConfigWidget : public QGroupBox
0026 {
0027     Q_OBJECT
0028 
0029 public:
0030     //* constructor
0031     explicit ShadowConfigWidget(QWidget *);
0032 
0033     //* destructor
0034     ~ShadowConfigWidget(void) override;
0035 
0036     //* group
0037     void setGroup(QPalette::ColorGroup group)
0038     {
0039         _group = group;
0040     }
0041 
0042     //* read defaults
0043     void setDefaults(void)
0044     {
0045         load(true);
0046     }
0047 
0048     //* read config
0049     void load(void)
0050     {
0051         load(false);
0052     }
0053 
0054     //* write config
0055     void save(void) const;
0056 
0057     //* true if modified
0058     bool isChanged(void) const
0059     {
0060         return _changed;
0061     }
0062 
0063 Q_SIGNALS:
0064 
0065     //* emmitted when configuration is changed
0066     void changed(bool);
0067 
0068 private Q_SLOTS:
0069 
0070     //* update changed state
0071     void updateChanged();
0072 
0073 private:
0074     //* read config
0075     void load(bool);
0076 
0077     //* set changed state
0078     void setChanged(bool value)
0079     {
0080         _changed = value;
0081         emit changed(value);
0082     }
0083 
0084     //* ui
0085     Ui_ShadowConfiguraionUI *ui = nullptr;
0086 
0087     //* color group
0088     QPalette::ColorGroup _group = QPalette::Inactive;
0089 
0090     //* changed state
0091     bool _changed = false;
0092 };
0093 }
0094 
0095 #endif