QtMvvm  1.1.0
A mvvm oriented library for Qt, to create Projects for Widgets and Quick in parallel
datasyncsettingsaccessor.h
1 #ifndef QTMVVM_DATASYNCSETTINGSACCESSOR_H
2 #define QTMVVM_DATASYNCSETTINGSACCESSOR_H
3 
4 #include <QtCore/qscopedpointer.h>
5 #include <QtMvvmCore/isettingsaccessor.h>
6 #include <QtDataSync/datatypestore.h>
7 
8 #include "QtMvvmDataSyncCore/qtmvvmdatasynccore_global.h"
9 #include "QtMvvmDataSyncCore/datasyncsettingsentry.h"
10 
11 namespace QtMvvm {
12 
13 class DataSyncSettingsAccessorPrivate;
15 class Q_MVVMDATASYNCCORE_EXPORT DataSyncSettingsAccessor : public ISettingsAccessor
16 {
17  Q_OBJECT
18  Q_INTERFACES(QtMvvm::ISettingsAccessor)
19 
20 public:
22  Q_INVOKABLE explicit DataSyncSettingsAccessor(QObject *parent = nullptr);
24  explicit DataSyncSettingsAccessor(const QString &setupName, QObject *parent = nullptr);
26  explicit DataSyncSettingsAccessor(QtDataSync::DataStore *store, QObject *parent = nullptr);
29  ~DataSyncSettingsAccessor() override;
30 
31  bool contains(const QString &key) const override;
32  QVariant load(const QString &key, const QVariant &defaultValue) const override;
33  void save(const QString &key, const QVariant &value) override;
34  void remove(const QString &key) override;
35 
36 public Q_SLOTS:
38  void sync() override;
39 
40 private Q_SLOTS:
41  void dataChanged(const QString &key, const QVariant &value);
42 
43 private:
45 };
46 
47 }
48 
49 Q_DECLARE_METATYPE(QtMvvm::DataSyncSettingsAccessor*)
50 
51 #endif // QTMVVM_DATASYNCSETTINGSACCESSOR_H
An interface to provide a generic way to access settings of any origin.
The primary namespace of the QtMvvm library.
A settings accessor implementation that allows to store and sync settings via datasync.