15 * |
15 * |
16 */ |
16 */ |
17 #ifndef CXESETTINGSIMP_H |
17 #ifndef CXESETTINGSIMP_H |
18 #define CXESETTINGSIMP_H |
18 #define CXESETTINGSIMP_H |
19 |
19 |
|
20 #include <QMetaMethod> |
20 #include "cxesettings.h" |
21 #include "cxesettings.h" |
21 #include "cxeerror.h" |
22 #include "cxeerror.h" |
|
23 #include "cxescenemodestore.h" |
|
24 |
|
25 // forward declaration |
|
26 class CxeSettingsStore; |
22 |
27 |
23 |
28 |
24 // forward declaration |
29 typedef QPair<QObject*, QMetaMethod> CxeSettingListener; |
25 class CxeSettingsModel; |
30 typedef QList<CxeSettingListener> CxeSettingListenerList; |
26 |
|
27 |
31 |
28 /* |
32 /* |
29 * Class to access all kind of Settings |
33 * Class to access all kind of Settings |
30 */ |
34 */ |
31 class CxeSettingsImp : public CxeSettings |
35 class CxeSettingsImp : public CxeSettings |
32 { |
36 { |
33 Q_OBJECT |
37 Q_OBJECT |
34 |
38 |
35 public: |
39 public: |
36 |
40 |
37 CxeSettingsImp(CxeSettingsModel &settingsModel); |
41 CxeSettingsImp(CxeSettingsStore *settingStore); |
38 virtual ~CxeSettingsImp(); |
42 virtual ~CxeSettingsImp(); |
39 |
43 |
40 CxeError::Id get(const QString &key, int &value) const; |
|
41 CxeError::Id get(const QString &key, QString &stringValue) const; |
|
42 CxeError::Id get(const QString &key, qreal &value) const; |
|
43 void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) const; |
44 void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) const; |
44 CxeError::Id set(const QString &key, int newValue); |
|
45 CxeError::Id set(const QString &key,const QString &newValue); |
|
46 CxeError::Id set(const QString &key, qreal newValue); |
|
47 void reset(); |
45 void reset(); |
|
46 CxeError::Id getVariationValue(const QString &key, QVariant &value); |
|
47 bool listenForSetting(const QString &settingKey, QObject *target, const char *slot); |
48 |
48 |
49 public slots: |
49 public slots: |
50 void loadSettings(Cxe::CameraMode mode); |
50 void loadSettings(Cxe::CameraMode mode); |
51 |
51 |
|
52 protected: |
|
53 void getValue(const QString &key, QVariant &value) const; |
|
54 void setValue(const QString &key, const QVariant &newValue); |
|
55 |
52 private: // helper methods |
56 private: // helper methods |
53 CxeError::Id getSceneMode(const QString &key, QString &stringValue) const; |
57 |
54 CxeError::Id setSceneMode(const QString &key, const QString &stringValue); |
58 void restoreImageSettings(); |
|
59 void restoreVideoSettings(); |
|
60 |
|
61 void setImageScene(const QString &newScene); |
|
62 void setVideoScene(const QString &newScene); |
|
63 |
|
64 void loadVariationSettings(); |
|
65 |
|
66 void notifyListeners(const QString &settingKey, const QVariant &newValue); |
|
67 |
|
68 private slots: |
|
69 void handleListenerDestroyed(QObject *object); |
55 |
70 |
56 private: |
71 private: |
57 CxeSettingsModel &mSettingsModel; // not owned |
|
58 |
72 |
|
73 CxeSettingsStore *mSettingStore; |
|
74 QHash<QString, QVariantList> mVariationSettings; |
|
75 |
|
76 CxeSceneModeStore mSceneModeStore; |
|
77 Cxe::CameraMode mCameraMode; |
|
78 |
|
79 QMap<QString, CxeSettingListenerList> mSettingListeners; |
59 }; |
80 }; |
60 |
81 |
61 #endif // CXESETTINGSIMP_H |
82 #endif // CXESETTINGSIMP_H |
62 |
83 |
63 // end of file |
84 // end of file |