camerauis/cameraxui/cxengine/src/cxefeaturemanagerimp.cpp
branchRCL_3
changeset 53 61bc0f252b2b
equal deleted inserted replaced
50:f54ad444594d 53:61bc0f252b2b
       
     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 /*
       
    18 * Symbian specific settings handling
       
    19 */
       
    20 
       
    21 #include <QCoreApplication>
       
    22 #include <QVariant>
       
    23 #include <QList>
       
    24 #include <QMetaType>
       
    25 
       
    26 #include "cxesettings.h"
       
    27 #include "cxefeaturemanagerimp.h"
       
    28 #include "cxutils.h"
       
    29 #include "cxeerror.h"
       
    30 
       
    31 
       
    32 /*!
       
    33 * Returns if a feature is supported or not
       
    34 * @param key Feature key
       
    35 * @param supported Returned boolean to indicate whether feature is supported or not
       
    36 * @return Error code
       
    37 */
       
    38 CxeError::Id CxeFeatureManagerImp::isFeatureSupported(const QString& key, bool& supported) const
       
    39 {
       
    40     CX_DEBUG_ENTER_FUNCTION();
       
    41 
       
    42     QVariant value;
       
    43     CxeError::Id err = mSettings.getVariationValue(key, value);
       
    44     if (err == CxeError::None) {
       
    45         QList<QVariant> values = qVariantValue<QList<QVariant> >(value);
       
    46         supported = values[0].toInt();
       
    47     } else {
       
    48         supported = false;
       
    49     }
       
    50 
       
    51     CX_DEBUG_EXIT_FUNCTION();
       
    52 
       
    53     return err;
       
    54 }
       
    55 
       
    56 
       
    57 
       
    58 /*!
       
    59 * Retrieves all the configured values for the given key
       
    60 * @param key Feature key
       
    61 * @param values Returned values
       
    62 * @return Error code
       
    63 */
       
    64 CxeError::Id CxeFeatureManagerImp::configuredValues(const QString& key,QList<int>& values)
       
    65 {
       
    66     CX_DEBUG_ENTER_FUNCTION();
       
    67 
       
    68     values.clear();
       
    69 
       
    70     QVariant variant;
       
    71     CxeError::Id err = mSettings.getVariationValue(key, variant);
       
    72 
       
    73     if(CxeError::None == err) {
       
    74         QVariantList list;
       
    75         list = qVariantValue<QVariantList>(variant);
       
    76 
       
    77         CX_DEBUG( ("CxeFeatureManagerImp::configuredValues <> count: %d",list.count() ) );
       
    78 
       
    79         foreach (QVariant value, list ) {
       
    80             // go through the settings list.
       
    81             QString dataString = value.toString();
       
    82             bool isInt;
       
    83             int intValue = dataString.toInt(&isInt,0); // 0 denotes base, check the API
       
    84 
       
    85             if (isInt) {
       
    86                 CX_DEBUG( ("CxeFeatureManagerImp::configuredValues <> value = %d",intValue) );
       
    87                 values.append(intValue);
       
    88             } else {
       
    89                 err = CxeError::NotSupported;
       
    90             }
       
    91         }
       
    92         list.clear();
       
    93     }
       
    94 
       
    95     CX_DEBUG_EXIT_FUNCTION();
       
    96     return err;
       
    97 }
       
    98 
       
    99 
       
   100 /*
       
   101 *CxeFeatureManagerImp::CxeFeatureManagerImp
       
   102 */
       
   103 CxeFeatureManagerImp::CxeFeatureManagerImp(CxeSettings &settings)
       
   104 : mSettings(settings)
       
   105 {
       
   106     CX_DEBUG_ENTER_FUNCTION();
       
   107     CX_DEBUG_EXIT_FUNCTION();
       
   108 }
       
   109 
       
   110 
       
   111 /*
       
   112 *CxeFeatureManagerImp::~CxeFeatureManagerImp
       
   113 */
       
   114 CxeFeatureManagerImp::~CxeFeatureManagerImp()
       
   115 {
       
   116     CX_DEBUG_ENTER_FUNCTION();
       
   117     CX_DEBUG_EXIT_FUNCTION();
       
   118 }
       
   119 
       
   120 
       
   121 // end of file