QSettingsDialog  1.0.0
A Qt library to easily create a settings dialog for user configurable settings
qsettingsloader.h
1 #ifndef QSETTINGSLOADER_H
2 #define QSETTINGSLOADER_H
3 
4 #include "qsettingsdialog_global.h"
5 #include <QObject>
6 #include <QVariant>
7 
15 class QSETTINGSDIALOGSHARED_EXPORT QSettingsLoader
17 {
18  friend class QSimpleSettingsLoader;
19  friend class QAsyncSettingsLoader;
20  Q_DISABLE_COPY(QSettingsLoader)
21 
22 public:
24  virtual inline ~QSettingsLoader() {}
26  virtual bool isAsync() const = 0;
27 
32 
33 private:
36 };
37 
39 class QSETTINGSDIALOGSHARED_EXPORT QSimpleSettingsLoader : public QSettingsLoader
40 {
41 public:
42  bool isAsync() const final;
43 
45  virtual bool load(QVariant outParam data, bool outParam userEdited) = 0;
47  virtual bool save(const QVariant &data) = 0;
49  virtual bool reset() = 0;
50 };
51 
53 class QSETTINGSDIALOGSHARED_EXPORT QAsyncSettingsLoader : public QObject, public QSettingsLoader
54 {
55  Q_OBJECT
56 
57 public:
60 
61  bool isAsync() const final;
62 
63 public slots:
65  virtual void loadData() = 0;
67  virtual void saveData(const QVariant &data) = 0;
69  virtual void resetData() = 0;
70 
71 signals:
73  void loadDone(bool successful, const QVariant &data, bool isUserEdited = true);
75  void saveDone(bool successful);
77  void resetDone(bool successful);
78 };
80 
81 #endif // QSETTINGSLOADER_H
QSimpleSettingsLoader * simple()
Casts this instance to a QSimpleSettingsLoader. Will assert if the conversion fails.
Defines a simple, synchronous loader.
Definition: qsettingsloader.h:39
virtual bool isAsync() const =0
Specifies, whether this loader is async or not.
Defines an asynchronous loader, that can load settings from any thread with any delay.
Definition: qsettingsloader.h:53
QAsyncSettingsLoader * async()
Casts this instance to a QAsyncSettingsLoader. Will assert if the conversion fails.
The basic settings loader class. Serves as utility class.
Definition: qsettingsloader.h:16
bool isAsync() const final
Specifies, whether this loader is async or not.
#define outParam
Simple define for "&" to mark parameters as out-parameter.
Definition: qsettingsdialog_global.h:17