|
1 /* |
|
2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 #ifndef CXESETTINGSIMP_H |
|
18 #define CXESETTINGSIMP_H |
|
19 |
|
20 #include <QMetaMethod> |
|
21 #include "cxesettings.h" |
|
22 #include "cxeerror.h" |
|
23 #include "cxescenemodestore.h" |
|
24 |
|
25 // forward declaration |
|
26 class CxeSettingsStore; |
|
27 |
|
28 |
|
29 typedef QPair<QObject*, QMetaMethod> CxeSettingListener; |
|
30 typedef QList<CxeSettingListener> CxeSettingListenerList; |
|
31 |
|
32 /* |
|
33 * Class to access all kind of Settings |
|
34 */ |
|
35 class CxeSettingsImp : public CxeSettings |
|
36 { |
|
37 Q_OBJECT |
|
38 |
|
39 public: |
|
40 |
|
41 CxeSettingsImp(CxeSettingsStore *settingStore); |
|
42 virtual ~CxeSettingsImp(); |
|
43 |
|
44 void get(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value) const; |
|
45 void reset(); |
|
46 CxeError::Id getVariationValue(const QString &key, QVariant &value); |
|
47 bool listenForSetting(const QString &settingKey, QObject *target, const char *slot); |
|
48 |
|
49 public slots: |
|
50 void loadSettings(Cxe::CameraMode mode); |
|
51 |
|
52 protected: |
|
53 void getValue(const QString &key, QVariant &value) const; |
|
54 void setValue(const QString &key, const QVariant &newValue); |
|
55 |
|
56 private: // helper methods |
|
57 |
|
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); |
|
70 |
|
71 private: |
|
72 |
|
73 CxeSettingsStore *mSettingStore; |
|
74 QHash<QString, QVariantList> mVariationSettings; |
|
75 |
|
76 CxeSceneModeStore mSceneModeStore; |
|
77 Cxe::CameraMode mCameraMode; |
|
78 |
|
79 QMap<QString, CxeSettingListenerList> mSettingListeners; |
|
80 }; |
|
81 |
|
82 #endif // CXESETTINGSIMP_H |
|
83 |
|
84 // end of file |