camerauis/cameraxui/cxengine/inc/cxesettingsimp.h
changeset 46 c826656d6714
parent 19 d9aefe59d544
equal deleted inserted replaced
42:feebad15db8c 46:c826656d6714
     1 /*
     1 /*
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
     2 * Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
     3 * All rights reserved.
     3 * All rights reserved.
     4 * This component and the accompanying materials are made available
     4 * This component and the accompanying materials are made available
     5 * under the terms of "Eclipse Public License v1.0"
     5 * under the terms of "Eclipse Public License v1.0"
     6 * which accompanies this distribution, and is available
     6 * which accompanies this distribution, and is available
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
    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