23 #include <QMetaType> |
23 #include <QMetaType> |
24 |
24 |
25 #include "cxeerror.h" |
25 #include "cxeerror.h" |
26 #include "cxenamespace.h" |
26 #include "cxenamespace.h" |
27 #include "xqsettingsmanager.h" |
27 #include "xqsettingsmanager.h" |
|
28 #include "cxesettingsstore.h" |
28 |
29 |
29 // forward declarations |
30 // forward declarations |
30 class XQSettingsManager; |
31 class XQSettingsManager; |
31 class XQSettingsKey; |
32 class XQSettingsKey; |
32 |
33 |
|
34 /*! |
|
35 * CxeSettingsCenRepStore class implements CxeSettingsStore. |
33 |
36 |
34 /*! |
|
35 * \class CxeSettingsStore |
|
36 * \brief Settings store intrerface. |
|
37 */ |
|
38 class CxeSettingsStore |
|
39 { |
|
40 public: |
|
41 |
|
42 /*! |
|
43 * This needs to be here to be able to delete an object |
|
44 * of inherited class through mixin pointer. |
|
45 * If this is not defined, deleting through the mixin pointer |
|
46 * results in User-42 panic! |
|
47 */ |
|
48 virtual ~CxeSettingsStore() {}; |
|
49 |
|
50 /*! |
|
51 * resets the cenrep store |
|
52 */ |
|
53 virtual void reset() = 0; |
|
54 |
|
55 /*! |
|
56 * Reads a value from cenrep |
|
57 * @param "key" - setting key |
|
58 * @param "value" - setting value read from cenrep |
|
59 */ |
|
60 virtual CxeError::Id get(const QString& key, QVariant &value) = 0; |
|
61 |
|
62 /*! |
|
63 * Reads a value from cenrep and starts monitoring changes |
|
64 * @param "uid" - UID of the component that own setting key |
|
65 * @param "key" - setting key id |
|
66 * @param "type" - type of setting key |
|
67 * @param "value" - setting value read from cenrep |
|
68 */ |
|
69 virtual void startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) = 0; |
|
70 |
|
71 /*! |
|
72 * Sets a new value to cenrep |
|
73 * @param "key" - setting key |
|
74 * @param "newValue" - new value set to the key in cenrep |
|
75 */ |
|
76 virtual CxeError::Id set(const QString& key,const QVariant newValue) = 0; |
|
77 |
|
78 /*! |
|
79 * Reads/loads all run-time settings values from cenrep |
|
80 * @param QList<QString> contains list of all runtime key ids which we use to load values from cenrep. |
|
81 * returns: QHash container, "contains" values associated with each key that are read from cenrep |
|
82 * NOTE: loading runtime settings should be done only ONCE at start-up. Its an overhead to read runtime keys |
|
83 * unnecessarily multiple times as the values of the runtime keys are not changed. |
|
84 * Runtime keys are only used to configure camerax application. |
|
85 */ |
|
86 virtual QHash<QString, QVariantList> loadRuntimeSettings(QList<QString>& settingKeys) = 0; |
|
87 }; |
|
88 |
|
89 |
|
90 |
|
91 /*! |
|
92 * \class CxeSettingsCenRepStore |
|
93 * \brief Class implements CxeSettingsStore. |
|
94 * This class uses CenRep key mechanism for storing and retrieving settings information. |
37 * This class uses CenRep key mechanism for storing and retrieving settings information. |
95 */ |
38 */ |
96 class CxeSettingsCenRepStore : public QObject, |
39 class CxeSettingsCenRepStore : public QObject, |
97 public CxeSettingsStore |
40 public CxeSettingsStore |
98 { |
41 { |
105 ~CxeSettingsCenRepStore(); |
48 ~CxeSettingsCenRepStore(); |
106 |
49 |
107 public: // from base class |
50 public: // from base class |
108 |
51 |
109 void reset(); |
52 void reset(); |
110 CxeError::Id get(const QString& key, QVariant &value); |
53 CxeError::Id get(const QString &key, QVariant &value); |
111 void startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value); |
54 void startMonitoring(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value); |
112 CxeError::Id set(const QString& key,const QVariant newValue); |
55 CxeError::Id set(const QString &key, const QVariant newValue); |
113 QHash<QString, QVariantList> loadRuntimeSettings(QList<QString>& settingKeys); |
56 QHash<QString, QVariantList> loadVariationSettings(QList<QString> &settingKeys); |
114 |
57 |
115 |
58 |
116 signals: |
59 signals: |
117 void settingValueChanged(long int uid, unsigned long int key, QVariant value); |
60 void settingValueChanged(long int uid, unsigned long int key, QVariant value); |
118 |
61 |