camerauis/cameraxui/cxengine/inc/cxesettingsmodelimp.h
changeset 46 c826656d6714
parent 42 feebad15db8c
child 52 7e18d488ac5f
equal deleted inserted replaced
42:feebad15db8c 46:c826656d6714
     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     CxeError::Id loadSceneData(const QString &newScene, CxeScene &currentSceneSettings);
       
    66     CxeError::Id sceneSettingValue(const QString &key, QVariant &value);
       
    67     CxeError::Id setSceneSettingValue(const QString &key, QVariant 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     void restoreImageSettings();
       
    75     void restoreVideoSettings();
       
    76     
       
    77 
       
    78 private:
       
    79 
       
    80     CxeSettingsStore *mSettingStore;
       
    81     QHash<QString, QVariantList> mRuntimeSettings;
       
    82 
       
    83     QHash<QString, CxeScene> mImageSceneModes;
       
    84     QHash<QString, CxeScene> mVideoSceneModes;
       
    85 
       
    86     CxeScene mCurrentImgScene;
       
    87     CxeScene mCurrentVidScene;
       
    88 
       
    89     Cxe::CameraMode mCameraMode;
       
    90 };
       
    91 
       
    92 Q_DECLARE_METATYPE(QVariantList)
       
    93 Q_DECLARE_METATYPE(CxeScene)
       
    94 
       
    95 #endif /* CXESETTINGSMODELIMP_H */