|
1 /* |
|
2 * Copyright (c) 2009 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 |
|
18 #ifndef CXESETTINGSMODELIMP_H |
|
19 #define CXESETTINGSMODELIMP_H |
|
20 |
|
21 // Include Files |
|
22 #include <QHash> |
|
23 #include <QVariant> |
|
24 #include <QMetaType> |
|
25 #include "cxesettingsmodel.h" |
|
26 #include "cxenamespace.h" |
|
27 #include "cxeerror.h" |
|
28 |
|
29 // forward declarations |
|
30 class QVariant; |
|
31 class CxeSettingsStore; |
|
32 |
|
33 /* |
|
34 * Settings model class handles all settings data i.e. loading, saving, getting settings data based on the settings key. |
|
35 */ |
|
36 class CxeSettingsModelImp : public CxeSettingsModel |
|
37 { |
|
38 |
|
39 public: |
|
40 |
|
41 CxeSettingsModelImp(CxeSettingsStore *settingsStore); |
|
42 ~CxeSettingsModelImp(); |
|
43 |
|
44 public: |
|
45 |
|
46 void reset(); |
|
47 CxeError::Id getSettingValue(const QString &key, QVariant &value); |
|
48 void getSettingValue(long int uid, unsigned long int key, Cxe::SettingKeyType type, QVariant &value); |
|
49 CxeError::Id getRuntimeValue(const QString &key, QVariant &value); |
|
50 CxeError::Id set(const QString &key, const QVariant newValue); |
|
51 CxeScene& currentImageScene(); |
|
52 CxeScene& currentVideoScene(); |
|
53 void cameraModeChanged(Cxe::CameraMode newMode); |
|
54 CxeError::Id setImageScene(const QString& newScene); |
|
55 CxeError::Id setVideoScene(const QString& newScene); |
|
56 |
|
57 private: |
|
58 |
|
59 void init(); |
|
60 void loadRuntimeSettings(); |
|
61 |
|
62 void loadImageScenes(); |
|
63 void loadVideoScenes(); |
|
64 |
|
65 void loadSceneData(CxeScene ¤tScene, CxeScene &sceneDefaultSettings); |
|
66 CxeError::Id sceneSettingValue(const QString &key, QVariant &value); |
|
67 CxeError::Id setSceneSettingValue(const QString &key, int newValue); |
|
68 |
|
69 void supportedKeys(QList<QString> &runtimeKeys); |
|
70 |
|
71 CxeError::Id videoScene(const QString &sceneId, CxeScene &sceneSettings); |
|
72 CxeError::Id imageScene(const QString &sceneId, CxeScene &sceneSettings); |
|
73 |
|
74 private: |
|
75 |
|
76 CxeSettingsStore *mSettingStore; |
|
77 QHash<QString, QVariantList> mRuntimeSettings; |
|
78 |
|
79 QHash<QString, CxeScene> mImageSceneModes; |
|
80 QHash<QString, CxeScene> mVideoSceneModes; |
|
81 |
|
82 CxeScene mCurrentImgScene; |
|
83 CxeScene mCurrentVidScene; |
|
84 |
|
85 Cxe::CameraMode mCameraMode; |
|
86 }; |
|
87 |
|
88 Q_DECLARE_METATYPE(QVariantList) |
|
89 Q_DECLARE_METATYPE(CxeScene) |
|
90 |
|
91 #endif /* CXESETTINGSMODELIMP_H */ |