libqutim
0.3.1.0
|
00001 /**************************************************************************** 00002 ** 00003 ** qutIM - instant messenger 00004 ** 00005 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru> 00006 ** 00007 ***************************************************************************** 00008 ** 00009 ** $QUTIM_BEGIN_LICENSE$ 00010 ** This program is free software: you can redistribute it and/or modify 00011 ** it under the terms of the GNU General Public License as published by 00012 ** the Free Software Foundation, either version 3 of the License, or 00013 ** (at your option) any later version. 00014 ** 00015 ** This program is distributed in the hope that it will be useful, 00016 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 00018 ** See the GNU General Public License for more details. 00019 ** 00020 ** You should have received a copy of the GNU General Public License 00021 ** along with this program. If not, see http://www.gnu.org/licenses/. 00022 ** $QUTIM_END_LICENSE$ 00023 ** 00024 ****************************************************************************/ 00025 00026 #ifndef SETTINGSWIDGET_H 00027 #define SETTINGSWIDGET_H 00028 00029 #include "libqutim_global.h" 00030 #include <QWidget> 00031 #include <QScopedPointer> 00032 00033 namespace qutim_sdk_0_3 00034 { 00035 struct SettingsWidgetPrivate; 00036 class AutoSettingsGenerator; 00037 00038 // class LIBQUTIM_EXPORT Settings 00039 // { 00040 // public: 00041 // virtual ~Settings(); 00042 // virtual void doLoad() = 0; 00043 // virtual void doSave() = 0; 00044 // virtual void doCancel() = 0; 00045 // }; 00046 00047 class LIBQUTIM_EXPORT SettingsWidget : public QWidget 00048 { 00049 Q_OBJECT 00050 Q_PROPERTY(bool modified READ isModified NOTIFY modifiedChanged) 00051 public: 00052 SettingsWidget(QWidget *parent = 0); 00053 virtual ~SettingsWidget(); 00054 bool isModified() const; 00055 virtual void setController(QObject *controller); 00056 public slots: 00057 void load(); 00058 void save(); 00059 void cancel(); 00060 signals: 00061 void modifiedChanged(bool have_changes); 00062 void saved(); 00063 protected: 00064 virtual void loadImpl() = 0; 00065 virtual void saveImpl() = 0; 00066 virtual void cancelImpl() = 0; 00067 void listenChildrenStates(const QWidgetList &exceptions = QWidgetList()); 00068 const char *lookForWidgetState(QWidget *widget, const char *property = 0, const char *signal = 0); 00069 virtual void virtual_hook(int id, void *data); 00070 private slots: 00071 void onStateChanged(int index); 00072 private: 00073 friend class AutoSettingsGenerator; 00074 QScopedPointer<SettingsWidgetPrivate> p; 00075 }; 00076 } 00077 00078 #endif // SETTINGSWIDGET_H 00079