OpenMW
apps/opencs/view/settings/abstractblock.hpp
Go to the documentation of this file.
00001 #ifndef ABSTRACTBLOCK_HPP
00002 #define ABSTRACTBLOCK_HPP
00003 
00004 #include <QObject>
00005 #include <QList>
00006 
00007 #include "settingwidget.hpp"
00008 #include "../../model/settings/settingsitem.hpp"
00009 #include "groupbox.hpp"
00010 
00011 namespace CSVSettings
00012 {
00013 
00015     class AbstractBlock : public QObject
00016     {
00017         Q_OBJECT
00018 
00019     protected:
00020 
00021         typedef QMap<QString, CSMSettings::SettingsItem*> SettingsItemMap;
00022         GroupBox *mBox;
00023         QWidget *mWidgetParent;
00024 
00025     public:
00026 
00027         explicit AbstractBlock (QWidget *parent = 0);
00028         explicit AbstractBlock (bool isVisible, QWidget *parent = 0);
00029 
00030         QGroupBox *getGroupBox();
00031         void setVisible (bool isVisible);
00032         bool isVisible() const;
00033 
00034         virtual CSMSettings::SettingList *getSettings() = 0;
00035 
00037         virtual bool updateSettings (const CSMSettings::SettingMap &settings) = 0;
00038 
00041         virtual bool updateBySignal (const QString &name, const QString &value, bool &doEmit)
00042         { return false; }
00043 
00044     protected:
00045 
00047         QLayout *createLayout (Orientation direction, bool isZeroMargin, QWidget* parent = 0);
00048 
00050         AbstractWidget *buildWidget (const QString &widgetName, WidgetDef &wDef,
00051                                      QLayout *layout = 0, bool isConnected = true) const;
00052 
00053         QWidget *getParent() const;
00054 
00055     public slots:
00056 
00059         void slotSetEnabled (bool value);
00060 
00062         void slotUpdateSetting (const QString &settingName, const QString &settingValue);
00063 
00064     private slots:
00065 
00067         void slotUpdate (const QString &value);
00068 
00069     signals:
00070 
00072         void signalUpdateSetting (const QString &propertyName, const QString &propertyValue);
00073 
00075         void signalUpdateWidget (const QString & value);
00076 
00079         void signalUpdateProxySetting (const QString &propertyName, const QString &propertyValue);
00080     };
00081 }
00082 #endif // ABSTRACTBLOCK_HPP