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

0001 #ifndef oxygenbaseanimationconfigwidget_h
0002 #define oxygenbaseanimationconfigwidget_h
0003 
0004 //////////////////////////////////////////////////////////////////////////////
0005 // oxygenbaseanimationconfigwidget.h
0006 // animation configuration item
0007 // -------------------
0008 //
0009 // SPDX-FileCopyrightText: 2010 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0010 //
0011 // SPDX-License-Identifier: MIT
0012 //////////////////////////////////////////////////////////////////////////////
0013 
0014 #include "oxygen_config_export.h"
0015 
0016 #include <QCheckBox>
0017 #include <QLayout>
0018 #include <QWidget>
0019 
0020 class Ui_AnimationConfigWidget;
0021 
0022 namespace Oxygen
0023 {
0024 class AnimationConfigItem;
0025 
0026 class OXYGEN_CONFIG_EXPORT BaseAnimationConfigWidget : public QWidget
0027 {
0028     Q_OBJECT
0029 
0030 public:
0031     //* constructor
0032     explicit BaseAnimationConfigWidget(QWidget * = nullptr);
0033 
0034     //* destructor
0035     virtual ~BaseAnimationConfigWidget(void);
0036 
0037     //* true if changed
0038     virtual bool isChanged(void) const
0039     {
0040         return _changed;
0041     }
0042 
0043 Q_SIGNALS:
0044 
0045     //* emmited when layout is changed
0046     void layoutChanged(void);
0047 
0048     //* emmited when changed
0049     void changed(bool);
0050 
0051 public Q_SLOTS:
0052 
0053     //* read current configuration
0054     virtual void load(void) = 0;
0055 
0056     //* save current configuration
0057     virtual void save(void) = 0;
0058 
0059 protected Q_SLOTS:
0060 
0061     //* update visible ites
0062     virtual void updateItems(bool);
0063 
0064     //* check whether configuration is changed and emit appropriate signal if yes
0065     virtual void updateChanged() = 0;
0066 
0067 protected:
0068     //* get global animations enabled checkbox
0069     QCheckBox *animationsEnabled(void) const;
0070 
0071     //* add item to ui
0072     virtual void setupItem(QGridLayout *, AnimationConfigItem *);
0073 
0074     //* set changed state
0075     virtual void setChanged(bool value)
0076     {
0077         _changed = value;
0078         emit changed(value);
0079     }
0080 
0081     //* user interface
0082     Ui_AnimationConfigWidget *ui = nullptr;
0083 
0084     //* row index
0085     int _row = 0;
0086 
0087 private:
0088     //* changed state
0089     bool _changed = false;
0090 };
0091 }
0092 
0093 #endif