return true;
}
- bool setIntValue(int val) {
+ bool setIntValue(int val, bool force) {
if (!src) {
return false;
}
- g_object_set(src, prop.toAscii().data(), val, NULL);
+ if (force) {
+ g_object_set(src, prop.toAscii().data(), val, NULL);
+ return true;
+ }
+
+ int old = 0;
+ g_object_get(src, prop.toAscii().data(), &old, NULL);
+
+ if (old != val) {
+ g_object_set(src, prop.toAscii().data(), val, NULL);
+ }
return true;
}
}
bool QtCamColorTone::setValue(const QtCamColorTone::ColorToneMode& mode) {
- return d_ptr->setIntValue(mode);
+ return d_ptr->setIntValue(mode, false);
}
}
bool QtCamFlash::setValue(const QtCamFlash::FlashMode& mode) {
- return d_ptr->setIntValue(mode);
+ return d_ptr->setIntValue(mode, false);
}
}
bool QtCamScene::setValue(const QtCamScene::SceneMode& mode) {
- return d_ptr->setIntValue(mode);
+ // Scene mode is always forced in order to reset the other capabilities.
+ return d_ptr->setIntValue(mode, true);
}
}
bool QtCamWhiteBalance::setValue(const QtCamWhiteBalance::WhiteBalanceMode& mode) {
- return d_ptr->setIntValue(mode);
+ return d_ptr->setIntValue(mode, false);
}