camerauis/cameraxui/cxui/src/cxuisettingradiobuttonlist.cpp
changeset 46 c826656d6714
parent 42 feebad15db8c
child 52 7e18d488ac5f
equal deleted inserted replaced
42:feebad15db8c 46:c826656d6714
    69 
    69 
    70         setSettingId(data->mSettingId);
    70         setSettingId(data->mSettingId);
    71         setListBoxType(data->mListboxType);
    71         setListBoxType(data->mListboxType);
    72 
    72 
    73         // Store the original setting value and focus matching item.
    73         // Store the original setting value and focus matching item.
    74         QString value;
    74         QString value = mEngine->settings().get<QString>(mSettingId, "");
    75         mEngine->settings().get(mSettingId, value);
       
    76         CX_DEBUG(("CxuiSettingRadioButtonList - original value: [%s]", qPrintable(value)));
    75         CX_DEBUG(("CxuiSettingRadioButtonList - original value: [%s]", qPrintable(value)));
    77         setOriginalSelectedItemByValue(QVariant(value));
    76         setOriginalSelectedItemByValue(QVariant(value));
    78     }
    77     }
    79 }
    78 }
    80 
    79 
   203         if (value.type() == QVariant::Int) {
   202         if (value.type() == QVariant::Int) {
   204             CX_DEBUG(("CxuiSettingRadioButtonList - index:%d value:%d", index, value.toInt()));
   203             CX_DEBUG(("CxuiSettingRadioButtonList - index:%d value:%d", index, value.toInt()));
   205 
   204 
   206             // Don't set the value again, if it is the current value.
   205             // Don't set the value again, if it is the current value.
   207             // For e.g. video quality it would result in re-preparation etc.
   206             // For e.g. video quality it would result in re-preparation etc.
   208             int current(0);
   207             try {
   209             CxeError::Id status(mEngine->settings().get(mSettingId, current));
   208                 int current = mEngine->settings().get<int>(mSettingId);
   210 
   209                 if (current != value.toInt()) {
   211             if (status != CxeError::None || current != value.toInt()) {
   210                     mEngine->settings().set(mSettingId, value.toInt());
   212                 mEngine->settings().set(mSettingId, value.toInt());
   211                 }
       
   212             } catch (CxeException &e) {
       
   213                 // ignore error
   213             }
   214             }
   214             // inform interested clients about value changed event
   215             // inform interested clients about value changed event
   215             emit valueSelected(value.toInt());
   216             emit valueSelected(value.toInt());
   216 
   217 
   217         } else if (value.type() == QVariant::String) {
   218         } else if (value.type() == QVariant::String) {
   218             CX_DEBUG(("CxuiSettingRadioButtonList - index:%d value:[%s]", index, qPrintable(value.toString())));
   219             CX_DEBUG(("CxuiSettingRadioButtonList - index:%d value:[%s]", index, qPrintable(value.toString())));
   219 
   220 
   220             QString current;
   221             try {
   221             CxeError::Id status(mEngine->settings().get(mSettingId, current));
   222                 QString current = mEngine->settings().get<QString>(mSettingId);
   222             CX_DEBUG(("CxuiSettingRadioButtonList - settings model value:[%s]", qPrintable(current)));
   223                 CX_DEBUG(("CxuiSettingRadioButtonList - settings model value:[%s]", qPrintable(current)));
   223 
   224                 if (current != value.toString()) {
   224             if (status != CxeError::None || current != value.toString()) {
   225                     mEngine->settings().set(mSettingId, value.toString());
   225                 mEngine->settings().set(mSettingId, value.toString());
   226                 }
       
   227             } catch (CxeException &e) {
       
   228                 // ignore error
   226             }
   229             }
   227         }
   230         }
   228     }
   231     }
   229 
   232 
   230     CX_DEBUG_EXIT_FUNCTION();
   233     CX_DEBUG_EXIT_FUNCTION();