110 |
108 |
111 CX_DEBUG_EXIT_FUNCTION(); |
109 CX_DEBUG_EXIT_FUNCTION(); |
112 } |
110 } |
113 |
111 |
114 |
112 |
115 /* |
113 /*! |
116 * Get setting value associated with the key. |
114 * Get setting value associated with the key. |
117 * @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h ) |
115 * @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h ) |
118 * @Param value - contains the value associated with the key. |
116 * @Param value - contains the value associated with the key. |
119 * @returns CxeError::None if successful or any CxeError specific error code. |
117 * @returns CxeError::None if successful or any CxeError specific error code. |
120 */ |
118 */ |
121 CxeError::Id CxeSettingsModelImp::getSettingValue(const QString &key, QVariant &value) |
119 CxeError::Id CxeSettingsModelImp::getSettingValue(const QString &key, QVariant &value) |
122 { |
120 { |
123 CX_DEBUG_ENTER_FUNCTION(); |
121 CX_DEBUG_ENTER_FUNCTION(); |
124 CX_DEBUG_ASSERT(mSettingStore); |
122 CX_DEBUG_ASSERT(mSettingStore); |
125 |
123 |
126 // Try first to find the item from scene settings. |
124 // Try first to find the item from cenrep store. |
127 // These need to override the common setting values. |
125 |
128 CxeError::Id err = sceneSettingValue(key, value); |
126 CxeError::Id err = mSettingStore->get(key, value); |
129 CX_DEBUG(( "status reading from scene data: %d", err)); |
127 |
130 |
128 // If setting is not in cenrep store, try fetching it from scene settings. |
131 // If scene does not control this setting, read it from settings store. |
129 if (err) { |
132 if (err == CxeError::NotFound) { |
|
133 // setting not found in setting store, try finding if its scene specific setting. |
130 // setting not found in setting store, try finding if its scene specific setting. |
134 CX_DEBUG(( "fetching value from settings store" )); |
131 CX_DEBUG(( "fetching value from scene settings" )); |
135 err = mSettingStore->get(key, value); |
132 err = sceneSettingValue(key, value); |
136 } |
133 } |
137 CX_DEBUG_EXIT_FUNCTION(); |
134 |
138 |
135 CX_DEBUG_EXIT_FUNCTION(); |
139 return err; |
136 |
140 } |
137 return err; |
141 |
138 } |
142 |
139 |
143 |
140 |
144 |
141 |
145 /* |
142 |
|
143 /*! |
146 * Get setting value associated with the key. |
144 * Get setting value associated with the key. |
147 * @param uid - UID of component that owns the setting key |
145 * @param uid - UID of component that owns the setting key |
148 * @Param key - key id of the setting |
146 * @Param key - key id of the setting |
149 * @param type - the type of key |
147 * @param type - the type of key |
150 * @Param value - contains the value associated with the key. |
148 * @Param value - contains the value associated with the key. |
155 QVariant &value) |
153 QVariant &value) |
156 { |
154 { |
157 CX_DEBUG_ENTER_FUNCTION(); |
155 CX_DEBUG_ENTER_FUNCTION(); |
158 CX_DEBUG_ASSERT(mSettingStore); |
156 CX_DEBUG_ASSERT(mSettingStore); |
159 |
157 |
160 mSettingStore->get(uid, key, type, value); |
158 mSettingStore->startMonitoring(uid, key, type, value); |
161 |
159 |
162 CX_DEBUG_EXIT_FUNCTION(); |
160 CX_DEBUG_EXIT_FUNCTION(); |
163 } |
161 } |
164 |
162 |
165 |
163 |
166 |
164 |
167 |
165 |
168 /* |
166 /*! |
169 * Set a value to the key. |
167 * Set a value to the key. |
170 * @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h ) |
168 * @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h ) |
171 * @Param value - contains the value associated with the key. |
169 * @Param value - contains the value associated with the key. |
172 * @returns CxeError::None if successful or any CxeError specific error code. |
170 * @returns CxeError::None if successful or any CxeError specific error code. |
173 */ |
171 */ |
174 CxeError::Id CxeSettingsModelImp::set(const QString &key, const QVariant newValue) |
172 CxeError::Id CxeSettingsModelImp::set(const QString &key, const QVariant newValue) |
175 { |
173 { |
176 CX_DEBUG_ENTER_FUNCTION(); |
174 CX_DEBUG_ENTER_FUNCTION(); |
177 CX_DEBUG_ASSERT(mSettingStore); |
175 CX_DEBUG_ASSERT(mSettingStore); |
178 |
176 |
179 // If this is one of scene settings, |
177 // Try storing new value to cenrep |
180 // store it as modification of current scene. |
178 CxeError::Id err = mSettingStore->set(key, newValue); |
181 CxeError::Id err = setSceneSettingValue(key, newValue); |
179 |
182 CX_DEBUG(( "status storing to scene data: %d", err)); |
180 if (err) { |
183 |
181 CX_DEBUG(( "Key not found in cenrepstore, writing value to scene settings" )); |
184 // If not scene specific, store the setting value. |
182 err = setSceneSettingValue(key, newValue); |
185 if (err == CxeError::NotFound) { |
183 } |
186 CX_DEBUG(( "writing value to settings store" )); |
184 |
187 err = mSettingStore->set(key, newValue); |
185 CX_DEBUG_EXIT_FUNCTION(); |
188 } |
186 |
189 |
187 return err; |
190 CX_DEBUG_EXIT_FUNCTION(); |
188 } |
191 |
189 |
192 return err; |
190 |
193 } |
191 /*! |
194 |
|
195 |
|
196 /* |
|
197 * Reset all settings |
192 * Reset all settings |
198 */ |
193 */ |
199 void CxeSettingsModelImp::reset() |
194 void CxeSettingsModelImp::reset() |
200 { |
195 { |
201 CX_DEBUG_ENTER_FUNCTION(); |
196 CX_DEBUG_ENTER_FUNCTION(); |
228 |
223 |
229 return err; |
224 return err; |
230 } |
225 } |
231 |
226 |
232 |
227 |
233 /* |
228 /*! |
234 * Set new Image scene mode. |
229 * Set new Image scene mode. |
235 * @returns CxeError::None if successful or any CxeError specific error code. |
230 * @returns CxeError::None if successful or any CxeError specific error code. |
236 */ |
231 */ |
237 CxeError::Id CxeSettingsModelImp::setImageScene(const QString &newScene) |
232 CxeError::Id CxeSettingsModelImp::setImageScene(const QString &newScene) |
238 { |
233 { |
239 CX_DEBUG_ENTER_FUNCTION(); |
234 CX_DEBUG_ENTER_FUNCTION(); |
240 |
235 |
241 CxeError::Id err = CxeError::None; |
236 // load scene specific settings |
242 |
237 CxeError::Id err = loadSceneData(newScene, mCurrentImgScene); |
243 // load the scene setting default values for the new scene id = "newScene" |
238 |
244 CxeScene sceneSettings; |
239 if (!err) { |
245 err = imageScene(newScene, sceneSettings); |
240 // saving current image scene to cenrep |
246 |
241 err = set(CxeSettingIds::IMAGE_SCENE, newScene); |
247 // create of copy of the new scene as we use it for accessing the scene settings later. |
242 |
248 if (CxeError::None == err) { |
243 // saving flash value from scene to cenrep |
249 mCurrentImgScene.clear(); |
244 QString key(CxeSettingIds::FLASH_MODE); |
250 loadSceneData(mCurrentImgScene, sceneSettings); |
245 err = set(key, mCurrentImgScene[key].toInt()); |
251 } |
246 |
252 |
247 // saving face tracking value from scene to cenrep |
253 CX_DEBUG_EXIT_FUNCTION(); |
248 key = CxeSettingIds::FACE_TRACKING; |
254 |
249 err = set(key, mCurrentImgScene[key].toInt()); |
255 return err; |
250 } |
256 } |
251 |
257 |
252 CX_DEBUG_EXIT_FUNCTION(); |
258 |
253 |
259 /* |
254 return err; |
|
255 } |
|
256 |
|
257 |
|
258 /*! |
260 * Set new video scene mode. |
259 * Set new video scene mode. |
261 * @returns CxeError::None if successful or any CxeError specific error code. |
260 * @returns CxeError::None if successful or any CxeError specific error code. |
262 */ |
261 */ |
263 CxeError::Id CxeSettingsModelImp::setVideoScene(const QString &newScene) |
262 CxeError::Id CxeSettingsModelImp::setVideoScene(const QString &newScene) |
264 { |
263 { |
265 CX_DEBUG_ENTER_FUNCTION(); |
264 CX_DEBUG_ENTER_FUNCTION(); |
266 |
265 |
267 CxeError::Id err = CxeError::None; |
266 CxeError::Id err = loadSceneData(newScene, mCurrentVidScene); |
268 |
267 |
269 // load the scene setting default values for the new scene id = "newScene" |
268 if (!err) { |
270 CxeScene sceneSettings; |
269 // video scene loaded successfully, store the scene value to cenrep |
271 err = videoScene(newScene, sceneSettings); |
270 err = set(CxeSettingIds::VIDEO_SCENE, newScene); |
272 |
271 } |
273 // create of copy of the new scene as we use it for accessing the scene settings later. |
272 |
274 if (CxeError::None == err) { |
273 CX_DEBUG_EXIT_FUNCTION(); |
275 mCurrentVidScene.clear(); |
274 |
276 loadSceneData(mCurrentVidScene, sceneSettings); |
275 return err; |
277 } |
276 } |
278 |
277 |
279 CX_DEBUG_EXIT_FUNCTION(); |
278 |
280 |
279 |
281 return err; |
280 /*! |
282 } |
|
283 |
|
284 |
|
285 |
|
286 /* |
|
287 * Loads Image scene settings for the given Scene ID |
281 * Loads Image scene settings for the given Scene ID |
288 */ |
282 */ |
289 CxeError::Id CxeSettingsModelImp::imageScene(const QString &sceneId, CxeScene &sceneSettings) |
283 CxeError::Id CxeSettingsModelImp::imageScene(const QString &sceneId, CxeScene &sceneSettings) |
290 { |
284 { |
291 CX_DEBUG_ENTER_FUNCTION(); |
285 CX_DEBUG_ENTER_FUNCTION(); |
323 |
319 |
324 return err; |
320 return err; |
325 } |
321 } |
326 |
322 |
327 |
323 |
328 /* |
324 /*! |
329 * Creates a copy of the selected scene that we use for accessing specific scene settings. |
325 * Creates a copy of the selected scene that we use for accessing specific scene settings. |
330 */ |
326 * \param newScene |
331 void CxeSettingsModelImp::loadSceneData(CxeScene ¤tScene, CxeScene &sceneDefaultSettings) |
327 * \param currentSceneSettings |
332 { |
328 */ |
333 CX_DEBUG_ENTER_FUNCTION(); |
329 CxeError::Id CxeSettingsModelImp::loadSceneData(const QString &newScene, CxeScene ¤tSceneSettings) |
334 |
330 { |
335 // creating a deep copy of the scene mode selected. |
331 CX_DEBUG_ENTER_FUNCTION(); |
336 |
332 |
337 CxeScene::const_iterator scene = sceneDefaultSettings.constBegin(); |
333 CxeScene sceneDefaultSettings; |
338 while (scene != sceneDefaultSettings.constEnd()) { |
334 CxeError::Id err = imageScene(newScene, sceneDefaultSettings); |
339 currentScene.insert(scene.key(), scene.value()); |
335 |
340 ++scene; |
336 if (err == CxeError::NotFound) { |
341 } |
337 // not still scene, try in video scene. |
342 |
338 err = videoScene(newScene, sceneDefaultSettings); |
343 CX_DEBUG_EXIT_FUNCTION(); |
339 } |
344 } |
340 |
345 |
341 if (!err) { |
346 |
342 // We have a new scene available, so we can clear the old values. |
347 /* |
343 currentSceneSettings.clear(); |
348 * returns value associated with the key |
344 |
|
345 // creating a deep copy of the scene mode selected. |
|
346 CxeScene::const_iterator scene = sceneDefaultSettings.constBegin(); |
|
347 while (scene != sceneDefaultSettings.constEnd()) { |
|
348 currentSceneSettings.insert(scene.key(), scene.value()); |
|
349 ++scene; |
|
350 } |
|
351 } |
|
352 |
|
353 CX_DEBUG_EXIT_FUNCTION(); |
|
354 |
|
355 return err; |
|
356 } |
|
357 |
|
358 |
|
359 /*! |
|
360 * Returns scene setting value |
|
361 * \param key Settings key |
|
362 * \param[out] value Value associated with the key |
|
363 * \return Error id. CxeError::None if no errors. |
349 */ |
364 */ |
350 CxeError::Id CxeSettingsModelImp::sceneSettingValue(const QString &key, QVariant &value) |
365 CxeError::Id CxeSettingsModelImp::sceneSettingValue(const QString &key, QVariant &value) |
351 { |
366 { |
352 CX_DEBUG_ENTER_FUNCTION(); |
367 CX_DEBUG_ENTER_FUNCTION(); |
353 |
368 |
373 |
388 |
374 return err; |
389 return err; |
375 } |
390 } |
376 |
391 |
377 |
392 |
378 /* |
393 /*! |
379 * set scene setting value associated with the key |
394 * Sets new value to settings specific to the scene. |
|
395 * @param key - setting id. |
|
396 * @param newValue - new setting value |
|
397 * @param error Error code. CxeError::None if operation has been successful. |
|
398 * @return Error id. CxeError::None if no errors. |
380 */ |
399 */ |
381 CxeError::Id CxeSettingsModelImp::setSceneSettingValue(const QString &key, QVariant newValue) |
400 CxeError::Id CxeSettingsModelImp::setSceneSettingValue(const QString &key, QVariant newValue) |
382 { |
401 { |
383 CX_DEBUG_ENTER_FUNCTION(); |
402 CX_DEBUG_ENTER_FUNCTION(); |
384 |
403 |
385 CxeError::Id err = CxeError::None; |
404 CxeError::Id err = CxeError::None; |
386 |
405 CxeScene *scene(0); |
387 if(mCameraMode == Cxe::ImageMode) { |
406 |
|
407 if (mCameraMode == Cxe::ImageMode) { |
388 CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Image mode Setting")); |
408 CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Image mode Setting")); |
389 if(mCurrentImgScene.contains(key)) { |
409 scene = &mCurrentImgScene; |
390 mCurrentImgScene[key] = newValue; |
|
391 } else { |
|
392 err = CxeError::NotFound; |
|
393 } |
|
394 } else { |
410 } else { |
395 CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Video mode Setting")); |
411 CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Video mode Setting")); |
396 if(mCurrentVidScene.contains(key)) { |
412 scene = &mCurrentVidScene; |
397 mCurrentVidScene[key] = newValue; |
413 } |
398 } else { |
414 |
399 err = CxeError::NotFound; |
415 if (scene && scene->contains(key)) { |
400 } |
416 CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue KEY found, writing value")); |
401 } |
417 scene->insert(key, newValue); |
402 |
418 } else { |
403 CX_DEBUG_EXIT_FUNCTION(); |
419 err = CxeError::NotFound; |
404 |
420 } |
405 return err; |
421 |
406 } |
422 CX_DEBUG_EXIT_FUNCTION(); |
407 |
423 |
408 |
424 return err; |
409 // appending the run-time keys to an array |
425 } |
|
426 |
|
427 |
|
428 /*! |
|
429 * Appending the run-time keys to an array |
|
430 * \param[in,out] runtimeKeys QList where the supported runtimekeys will be added to |
|
431 */ |
410 void CxeSettingsModelImp::supportedKeys(QList<QString>& runtimeKeys) |
432 void CxeSettingsModelImp::supportedKeys(QList<QString>& runtimeKeys) |
411 { |
433 { |
412 CX_DEBUG_ENTER_FUNCTION(); |
434 CX_DEBUG_ENTER_FUNCTION(); |
413 |
435 |
414 runtimeKeys.append(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS); |
436 runtimeKeys.append(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS); |
420 |
442 |
421 CX_DEBUG_EXIT_FUNCTION(); |
443 CX_DEBUG_EXIT_FUNCTION(); |
422 } |
444 } |
423 |
445 |
424 |
446 |
425 /* |
447 /*! |
426 * Loads all video scene modes |
448 * Loads all video scene modes |
427 */ |
449 */ |
428 void CxeSettingsModelImp::loadVideoScenes() |
450 void CxeSettingsModelImp::loadVideoScenes() |
429 { |
451 { |
430 CX_DEBUG_ENTER_FUNCTION(); |
452 CX_DEBUG_ENTER_FUNCTION(); |
431 |
453 |
432 mVideoSceneModes.clear(); |
454 mVideoSceneModes.clear(); |
433 |
455 |
434 CxeScene vidSceneAuto; |
456 CxeScene vidSceneAuto; |
435 |
457 |
436 vidSceneAuto.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_AUTO); |
458 vidSceneAuto.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_AUTO); |
437 vidSceneAuto.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
459 vidSceneAuto.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
438 vidSceneAuto.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
460 vidSceneAuto.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
439 vidSceneAuto.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
461 vidSceneAuto.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
440 vidSceneAuto.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
462 vidSceneAuto.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
441 vidSceneAuto.insert(CxeSettingIds::CONTRAST, 0); |
463 vidSceneAuto.insert(CxeSettingIds::CONTRAST, 0); |
442 vidSceneAuto.insert(CxeSettingIds::FRAME_RATE, 0); |
464 vidSceneAuto.insert(CxeSettingIds::FRAME_RATE, 0); |
443 vidSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
465 vidSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
444 |
466 |
445 mVideoSceneModes.insert(CxeSettingIds::VIDEO_SCENE_AUTO,vidSceneAuto); |
467 mVideoSceneModes.insert(Cxe::VIDEO_SCENE_AUTO,vidSceneAuto); |
446 |
468 |
447 |
469 |
448 CxeScene vidSceneNight; |
470 CxeScene vidSceneNight; |
449 |
471 |
450 vidSceneNight.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_NIGHT); |
472 vidSceneNight.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_NIGHT); |
451 vidSceneNight.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
473 vidSceneNight.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
452 vidSceneNight.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
474 vidSceneNight.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
453 vidSceneNight.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight); |
475 vidSceneNight.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight); |
454 vidSceneNight.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
476 vidSceneNight.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
455 vidSceneNight.insert(CxeSettingIds::CONTRAST, 0); |
477 vidSceneNight.insert(CxeSettingIds::CONTRAST, 0); |
456 vidSceneNight.insert(CxeSettingIds::FRAME_RATE, 0); |
478 vidSceneNight.insert(CxeSettingIds::FRAME_RATE, 0); |
457 vidSceneNight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
479 vidSceneNight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
458 |
480 |
459 mVideoSceneModes.insert(CxeSettingIds::VIDEO_SCENE_NIGHT, vidSceneNight); |
481 mVideoSceneModes.insert(Cxe::VIDEO_SCENE_NIGHT, vidSceneNight); |
460 |
482 |
461 |
483 |
462 CxeScene vidSceneLowLight; |
484 CxeScene vidSceneLowLight; |
463 |
485 |
464 vidSceneLowLight.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::VIDEO_SCENE_LOWLIGHT); |
486 vidSceneLowLight.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_LOWLIGHT); |
465 vidSceneLowLight.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
487 vidSceneLowLight.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
466 vidSceneLowLight.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
488 vidSceneLowLight.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
467 vidSceneLowLight.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
489 vidSceneLowLight.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
468 vidSceneLowLight.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
490 vidSceneLowLight.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
469 vidSceneLowLight.insert(CxeSettingIds::CONTRAST, 0); |
491 vidSceneLowLight.insert(CxeSettingIds::CONTRAST, 0); |
470 vidSceneLowLight.insert(CxeSettingIds::FRAME_RATE, 15); //fps |
492 vidSceneLowLight.insert(CxeSettingIds::FRAME_RATE, 15); //fps |
471 vidSceneLowLight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
493 vidSceneLowLight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
472 |
494 |
473 mVideoSceneModes.insert(CxeSettingIds::VIDEO_SCENE_LOWLIGHT, vidSceneLowLight); |
495 mVideoSceneModes.insert(Cxe::VIDEO_SCENE_LOWLIGHT, vidSceneLowLight); |
474 |
496 |
475 |
497 |
476 CX_DEBUG_EXIT_FUNCTION(); |
498 CX_DEBUG_EXIT_FUNCTION(); |
477 } |
499 } |
478 |
500 |
479 |
501 |
480 /* |
502 /*! |
481 * Loads all Image Scene Modes |
503 * Loads all Image Scene Modes |
482 */ |
504 */ |
483 void CxeSettingsModelImp::loadImageScenes() |
505 void CxeSettingsModelImp::loadImageScenes() |
484 { |
506 { |
485 CX_DEBUG_ENTER_FUNCTION(); |
507 CX_DEBUG_ENTER_FUNCTION(); |
486 |
508 |
487 mImageSceneModes.clear(); |
509 mImageSceneModes.clear(); |
488 |
510 |
489 CxeScene imgSceneAuto; |
511 CxeScene imgSceneAuto; |
490 |
512 |
491 imgSceneAuto.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_AUTO); |
513 imgSceneAuto.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_AUTO); |
492 imgSceneAuto.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto); |
514 imgSceneAuto.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto); |
493 imgSceneAuto.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
515 imgSceneAuto.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
494 imgSceneAuto.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
516 imgSceneAuto.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
495 imgSceneAuto.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
517 imgSceneAuto.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
496 imgSceneAuto.insert(CxeSettingIds::CONTRAST, 0); |
518 imgSceneAuto.insert(CxeSettingIds::CONTRAST, 0); |
499 imgSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
521 imgSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
500 imgSceneAuto.insert(CxeSettingIds::BRIGHTNESS, 0); |
522 imgSceneAuto.insert(CxeSettingIds::BRIGHTNESS, 0); |
501 imgSceneAuto.insert(CxeSettingIds::FLASH_MODE, FlashAuto); |
523 imgSceneAuto.insert(CxeSettingIds::FLASH_MODE, FlashAuto); |
502 imgSceneAuto.insert(CxeSettingIds::FACE_TRACKING, 1); |
524 imgSceneAuto.insert(CxeSettingIds::FACE_TRACKING, 1); |
503 |
525 |
504 mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_AUTO, imgSceneAuto); |
526 mImageSceneModes.insert(Cxe::IMAGE_SCENE_AUTO, imgSceneAuto); |
505 |
527 |
506 |
528 |
507 CxeScene imgSceneSports; |
529 CxeScene imgSceneSports; |
508 |
530 |
509 imgSceneSports.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_SPORTS); |
531 imgSceneSports.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SPORTS); |
510 imgSceneSports.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
532 imgSceneSports.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
511 imgSceneSports.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
533 imgSceneSports.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
512 imgSceneSports.insert(CxeSettingIds::EXPOSURE_MODE, ExposureSport); |
534 imgSceneSports.insert(CxeSettingIds::EXPOSURE_MODE, ExposureSport); |
513 imgSceneSports.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
535 imgSceneSports.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
514 imgSceneSports.insert(CxeSettingIds::CONTRAST, 0); |
536 imgSceneSports.insert(CxeSettingIds::CONTRAST, 0); |
517 imgSceneSports.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
539 imgSceneSports.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
518 imgSceneSports.insert(CxeSettingIds::BRIGHTNESS, 0); |
540 imgSceneSports.insert(CxeSettingIds::BRIGHTNESS, 0); |
519 imgSceneSports.insert(CxeSettingIds::FLASH_MODE, FlashOff); |
541 imgSceneSports.insert(CxeSettingIds::FLASH_MODE, FlashOff); |
520 imgSceneSports.insert(CxeSettingIds::FACE_TRACKING, 0); |
542 imgSceneSports.insert(CxeSettingIds::FACE_TRACKING, 0); |
521 |
543 |
522 mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_SPORTS, imgSceneSports); |
544 mImageSceneModes.insert(Cxe::IMAGE_SCENE_SPORTS, imgSceneSports); |
523 |
545 |
524 |
546 |
525 CxeScene imgSceneCloseUp; |
547 CxeScene imgSceneCloseUp; |
526 |
548 |
527 imgSceneCloseUp.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_MACRO); |
549 imgSceneCloseUp.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_MACRO); |
528 imgSceneCloseUp.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Macro); |
550 imgSceneCloseUp.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Macro); |
529 imgSceneCloseUp.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
551 imgSceneCloseUp.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
530 imgSceneCloseUp.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
552 imgSceneCloseUp.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
531 imgSceneCloseUp.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
553 imgSceneCloseUp.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
532 imgSceneCloseUp.insert(CxeSettingIds::CONTRAST, 0); |
554 imgSceneCloseUp.insert(CxeSettingIds::CONTRAST, 0); |
535 imgSceneCloseUp.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
557 imgSceneCloseUp.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
536 imgSceneCloseUp.insert(CxeSettingIds::BRIGHTNESS, 0); |
558 imgSceneCloseUp.insert(CxeSettingIds::BRIGHTNESS, 0); |
537 imgSceneCloseUp.insert(CxeSettingIds::FLASH_MODE, FlashAuto); |
559 imgSceneCloseUp.insert(CxeSettingIds::FLASH_MODE, FlashAuto); |
538 imgSceneCloseUp.insert(CxeSettingIds::FACE_TRACKING, 0); |
560 imgSceneCloseUp.insert(CxeSettingIds::FACE_TRACKING, 0); |
539 |
561 |
540 mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_MACRO, imgSceneCloseUp); |
562 mImageSceneModes.insert(Cxe::IMAGE_SCENE_MACRO, imgSceneCloseUp); |
541 |
563 |
542 CxeScene imgPortraitscene; |
564 CxeScene imgPortraitscene; |
543 |
565 |
544 imgPortraitscene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_PORTRAIT); |
566 imgPortraitscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_PORTRAIT); |
545 imgPortraitscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Portrait); |
567 imgPortraitscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Portrait); |
546 imgPortraitscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
568 imgPortraitscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
547 imgPortraitscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureBacklight); |
569 imgPortraitscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureBacklight); |
548 imgPortraitscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
570 imgPortraitscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
549 imgPortraitscene.insert(CxeSettingIds::CONTRAST, 0); |
571 imgPortraitscene.insert(CxeSettingIds::CONTRAST, 0); |
552 imgPortraitscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
574 imgPortraitscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
553 imgPortraitscene.insert(CxeSettingIds::BRIGHTNESS, 0); |
575 imgPortraitscene.insert(CxeSettingIds::BRIGHTNESS, 0); |
554 imgPortraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye); |
576 imgPortraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye); |
555 imgPortraitscene.insert(CxeSettingIds::FACE_TRACKING, 1); |
577 imgPortraitscene.insert(CxeSettingIds::FACE_TRACKING, 1); |
556 |
578 |
557 mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_PORTRAIT, imgPortraitscene); |
579 mImageSceneModes.insert(Cxe::IMAGE_SCENE_PORTRAIT, imgPortraitscene); |
558 |
580 |
559 CxeScene imglandscapescene; |
581 CxeScene imglandscapescene; |
560 |
582 |
561 imglandscapescene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_SCENERY); |
583 imglandscapescene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SCENERY); |
562 imglandscapescene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Infinity); |
584 imglandscapescene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Infinity); |
563 imglandscapescene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceSunny); |
585 imglandscapescene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceSunny); |
564 imglandscapescene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
586 imglandscapescene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
565 imglandscapescene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
587 imglandscapescene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
566 imglandscapescene.insert(CxeSettingIds::CONTRAST, 0); |
588 imglandscapescene.insert(CxeSettingIds::CONTRAST, 0); |
569 imglandscapescene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
591 imglandscapescene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
570 imglandscapescene.insert(CxeSettingIds::BRIGHTNESS, 0); |
592 imglandscapescene.insert(CxeSettingIds::BRIGHTNESS, 0); |
571 imglandscapescene.insert(CxeSettingIds::FLASH_MODE, FlashOff); |
593 imglandscapescene.insert(CxeSettingIds::FLASH_MODE, FlashOff); |
572 imglandscapescene.insert(CxeSettingIds::FACE_TRACKING, 0); |
594 imglandscapescene.insert(CxeSettingIds::FACE_TRACKING, 0); |
573 |
595 |
574 mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_SCENERY, imglandscapescene); |
596 mImageSceneModes.insert(Cxe::IMAGE_SCENE_SCENERY, imglandscapescene); |
575 |
597 |
576 |
598 |
577 CxeScene imgNightscene; |
599 CxeScene imgNightscene; |
578 |
600 |
579 imgNightscene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_NIGHT); |
601 imgNightscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHT); |
580 imgNightscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto); |
602 imgNightscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto); |
581 imgNightscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
603 imgNightscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
582 imgNightscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight); |
604 imgNightscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight); |
583 imgNightscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
605 imgNightscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
584 imgNightscene.insert(CxeSettingIds::CONTRAST, 0); |
606 imgNightscene.insert(CxeSettingIds::CONTRAST, 0); |
587 imgNightscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
609 imgNightscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
588 imgNightscene.insert(CxeSettingIds::BRIGHTNESS, 0); |
610 imgNightscene.insert(CxeSettingIds::BRIGHTNESS, 0); |
589 imgNightscene.insert(CxeSettingIds::FLASH_MODE, FlashOff); |
611 imgNightscene.insert(CxeSettingIds::FLASH_MODE, FlashOff); |
590 imgNightscene.insert(CxeSettingIds::FACE_TRACKING, 1); |
612 imgNightscene.insert(CxeSettingIds::FACE_TRACKING, 1); |
591 |
613 |
592 mImageSceneModes.insert(CxeSettingIds::IMAGE_SCENE_NIGHT, imgNightscene); |
614 mImageSceneModes.insert(Cxe::IMAGE_SCENE_NIGHT, imgNightscene); |
593 |
615 |
594 CxeScene imgNightpotraitscene; |
616 CxeScene imgNightpotraitscene; |
595 |
617 |
596 imgNightpotraitscene.insert(CxeSettingIds::SCENE_ID, CxeSettingIds::IMAGE_SCENE_NIGHTPORTRAIT); |
618 imgNightpotraitscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHTPORTRAIT); |
597 imgNightpotraitscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Portrait); |
619 imgNightpotraitscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Portrait); |
598 imgNightpotraitscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
620 imgNightpotraitscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
599 imgNightpotraitscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight); |
621 imgNightpotraitscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight); |
600 imgNightpotraitscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
622 imgNightpotraitscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
601 imgNightpotraitscene.insert(CxeSettingIds::CONTRAST, 0); |
623 imgNightpotraitscene.insert(CxeSettingIds::CONTRAST, 0); |
633 |
655 |
634 return mCurrentVidScene; |
656 return mCurrentVidScene; |
635 } |
657 } |
636 |
658 |
637 |
659 |
638 /* |
660 /*! |
639 * Updating settings model whenever mode is changed from image to video and vice-versa. |
661 * Restores settings whenever we switch between Image/Video modes or |
|
662 * during startup. |
640 */ |
663 */ |
641 void CxeSettingsModelImp::cameraModeChanged(Cxe::CameraMode newMode) |
664 void CxeSettingsModelImp::cameraModeChanged(Cxe::CameraMode newMode) |
642 { |
665 { |
643 CX_DEBUG_ENTER_FUNCTION(); |
666 CX_DEBUG_ENTER_FUNCTION(); |
|
667 |
|
668 if (newMode == Cxe::ImageMode) { |
|
669 restoreImageSettings(); |
|
670 } else { |
|
671 restoreVideoSettings(); |
|
672 } |
|
673 |
644 mCameraMode = newMode; |
674 mCameraMode = newMode; |
|
675 |
|
676 CX_DEBUG_EXIT_FUNCTION(); |
|
677 } |
|
678 |
|
679 |
|
680 |
|
681 /*! |
|
682 * Restores image settings, during mode change or during startup. |
|
683 */ |
|
684 void CxeSettingsModelImp::restoreImageSettings() |
|
685 { |
|
686 CX_DEBUG_ENTER_FUNCTION(); |
|
687 |
|
688 CxeError::Id err = CxeError::None; |
|
689 QVariant currentSceneInUse = mCurrentImgScene[CxeSettingIds::SCENE_ID]; |
|
690 |
|
691 // get the image scene value from cenrep and load the scene settings |
|
692 QVariant cenrepSceneValue; |
|
693 QString key(CxeSettingIds::IMAGE_SCENE); |
|
694 err = getSettingValue(key, cenrepSceneValue); |
|
695 |
|
696 bool ok2LoadSceneSettings = (cenrepSceneValue != currentSceneInUse); |
|
697 |
|
698 if (!err && ok2LoadSceneSettings) { |
|
699 // loading scene settings |
|
700 err = loadSceneData(cenrepSceneValue.toString(), mCurrentImgScene); |
|
701 } |
|
702 |
|
703 // Updating Flash setting from cenrep |
|
704 QVariant value; |
|
705 key = CxeSettingIds::FLASH_MODE; |
|
706 err = getSettingValue(key, value); |
|
707 |
|
708 if (!err && mCurrentImgScene.contains(key)) { |
|
709 // update local datastructure with flash setting value from cenrep. |
|
710 CX_DEBUG(( "flash setting value %d", value.toInt())); |
|
711 mCurrentImgScene[key] = value; |
|
712 } |
|
713 |
|
714 // Updating Face Tracking setting from cenrep |
|
715 key = CxeSettingIds::FACE_TRACKING; |
|
716 err = getSettingValue(key, value); |
|
717 |
|
718 if (!err && mCurrentImgScene.contains(key)) { |
|
719 // update local datastructure with flash setting value from cenrep. |
|
720 CX_DEBUG(( "Face Tracking setting value %d", value.toInt())); |
|
721 mCurrentImgScene[key] = value; |
|
722 } |
|
723 |
|
724 CX_DEBUG_EXIT_FUNCTION(); |
|
725 } |
|
726 |
|
727 |
|
728 |
|
729 /*! |
|
730 * Restores video settings, during mode change or during startup. |
|
731 */ |
|
732 void CxeSettingsModelImp::restoreVideoSettings() |
|
733 { |
|
734 CX_DEBUG_ENTER_FUNCTION(); |
|
735 |
|
736 CxeError::Id err = CxeError::None; |
|
737 QVariant currentSceneInUse = mCurrentVidScene[CxeSettingIds::SCENE_ID]; |
|
738 |
|
739 // get the video scene value from cenrep and load the scene settings |
|
740 QVariant cenrepSceneValue; |
|
741 err = getSettingValue(CxeSettingIds::VIDEO_SCENE, cenrepSceneValue); |
|
742 |
|
743 bool ok2LoadSceneSettings = (cenrepSceneValue != currentSceneInUse); |
|
744 |
|
745 if (!err && ok2LoadSceneSettings) { |
|
746 // loading video scene settings |
|
747 loadSceneData(cenrepSceneValue.toString(), mCurrentVidScene); |
|
748 } |
|
749 |
645 CX_DEBUG_EXIT_FUNCTION(); |
750 CX_DEBUG_EXIT_FUNCTION(); |
646 } |
751 } |
647 |
752 |
648 // end of file |
753 // end of file |