libqutim  0.3.1.0
settingswidget.h
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** qutIM - instant messenger
4 **
5 ** Copyright © 2011 Ruslan Nigmatullin <euroelessar@yandex.ru>
6 **
7 *****************************************************************************
8 **
9 ** $QUTIM_BEGIN_LICENSE$
10 ** This program is free software: you can redistribute it and/or modify
11 ** it under the terms of the GNU General Public License as published by
12 ** the Free Software Foundation, either version 3 of the License, or
13 ** (at your option) any later version.
14 **
15 ** This program is distributed in the hope that it will be useful,
16 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
17 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 ** See the GNU General Public License for more details.
19 **
20 ** You should have received a copy of the GNU General Public License
21 ** along with this program. If not, see http://www.gnu.org/licenses/.
22 ** $QUTIM_END_LICENSE$
23 **
24 ****************************************************************************/
25 
26 #ifndef SETTINGSWIDGET_H
27 #define SETTINGSWIDGET_H
28 
29 #include "libqutim_global.h"
30 #include <QWidget>
31 #include <QScopedPointer>
32 
33 namespace qutim_sdk_0_3
34 {
35  struct SettingsWidgetPrivate;
36  class AutoSettingsGenerator;
37 
38 // class LIBQUTIM_EXPORT Settings
39 // {
40 // public:
41 // virtual ~Settings();
42 // virtual void doLoad() = 0;
43 // virtual void doSave() = 0;
44 // virtual void doCancel() = 0;
45 // };
46 
47  class LIBQUTIM_EXPORT SettingsWidget : public QWidget
48  {
49  Q_OBJECT
50  Q_PROPERTY(bool modified READ isModified NOTIFY modifiedChanged)
51  public:
52  SettingsWidget(QWidget *parent = 0);
53  virtual ~SettingsWidget();
54  bool isModified() const;
55  virtual void setController(QObject *controller);
56  public slots:
57  void load();
58  void save();
59  void cancel();
60  signals:
61  void modifiedChanged(bool have_changes);
62  void saved();
63  protected:
64  virtual void loadImpl() = 0;
65  virtual void saveImpl() = 0;
66  virtual void cancelImpl() = 0;
67  void listenChildrenStates(const QWidgetList &exceptions = QWidgetList());
68  const char *lookForWidgetState(QWidget *widget, const char *property = 0, const char *signal = 0);
69  virtual void virtual_hook(int id, void *data);
70  private slots:
71  void onStateChanged(int index);
72  private:
73  friend class AutoSettingsGenerator;
74  QScopedPointer<SettingsWidgetPrivate> p;
75  };
76 }
77 
78 #endif // SETTINGSWIDGET_H
79 

Generated by Doxygen