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 #if !defined(Q_MOC_RUN) && !defined(DOXYGEN_SHOULD_SKIP_THIS) && !defined(IN_IDE_PARSER)
62 private: // don't tell moc, doxygen or kdevelop, but those signals are in fact private
63 #endif
64  void modifiedChanged(bool have_changes);
65  void saved();
66  protected:
67  virtual void loadImpl() = 0;
68  virtual void saveImpl() = 0;
69  virtual void cancelImpl() = 0;
70  void setModified(bool modified);
71  void listenChildrenStates(const QWidgetList &exceptions = QWidgetList());
72  const char *lookForWidgetState(QWidget *widget, const char *property = 0, const char *signal = 0);
73  virtual void virtual_hook(int id, void *data);
74  private slots:
75  void onStateChanged(int index);
76  private:
77  friend class AutoSettingsGenerator;
78  QScopedPointer<SettingsWidgetPrivate> p;
79  };
80 }
81 
82 #endif // SETTINGSWIDGET_H
83 

Generated by Doxygen