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 <QVariant> |
|
22 #include <QFile> |
|
23 #include <QList> |
|
24 #include <QMultiMap> |
|
25 #include <QMetaType> |
|
26 |
|
27 #include "cxesettingsmodelimp.h" |
|
28 #include "cxesettingscenrepstore.h" |
|
29 #include "cxesettings.h" |
|
30 #include "cxutils.h" |
|
31 #include "cxenamespace.h" |
|
32 #include "cxeerror.h" |
|
33 #include "cxeautofocuscontrol.h" |
|
34 |
|
35 |
|
36 using namespace Cxe; |
|
37 |
|
38 |
|
39 /*! |
|
40 * CxeSettingsModel::CxeSettingsModel |
|
41 */ |
|
42 CxeSettingsModelImp::CxeSettingsModelImp(CxeSettingsStore *settingsStore) |
|
43 { |
|
44 CX_DEBUG_ENTER_FUNCTION(); |
|
45 CX_ASSERT_ALWAYS(settingsStore); |
|
46 // we take ownership of the settings store. |
|
47 mSettingStore = settingsStore; |
|
48 init(); |
|
49 |
|
50 CX_DEBUG_EXIT_FUNCTION(); |
|
51 } |
|
52 |
|
53 |
|
54 /*! |
|
55 * CxeSettingsModelImp::init |
|
56 */ |
|
57 void CxeSettingsModelImp::init() |
|
58 { |
|
59 CX_DEBUG_ENTER_FUNCTION(); |
|
60 |
|
61 mCurrentImgScene.clear(); |
|
62 mCurrentVidScene.clear(); |
|
63 |
|
64 loadRuntimeSettings(); |
|
65 loadImageScenes(); |
|
66 loadVideoScenes(); |
|
67 |
|
68 CX_DEBUG_EXIT_FUNCTION(); |
|
69 } |
|
70 |
|
71 |
|
72 |
|
73 /*! |
|
74 * CxeSettingsModelImp::~CxeSettingsModelImp() |
|
75 */ |
|
76 CxeSettingsModelImp::~CxeSettingsModelImp() |
|
77 { |
|
78 CX_DEBUG_ENTER_FUNCTION(); |
|
79 |
|
80 delete mSettingStore; |
|
81 |
|
82 mCurrentImgScene.clear(); |
|
83 mCurrentVidScene.clear(); |
|
84 |
|
85 mImageSceneModes.clear(); |
|
86 mVideoSceneModes.clear(); |
|
87 |
|
88 mRuntimeSettings.clear(); |
|
89 |
|
90 CX_DEBUG_EXIT_FUNCTION(); |
|
91 } |
|
92 |
|
93 |
|
94 |
|
95 /*! |
|
96 * Loads all run-time settings |
|
97 */ |
|
98 void CxeSettingsModelImp::loadRuntimeSettings() |
|
99 { |
|
100 CX_DEBUG_ENTER_FUNCTION(); |
|
101 CX_DEBUG_ASSERT( mSettingStore ); |
|
102 |
|
103 QList<QString> runtimeKeys; |
|
104 // all supported runtime keys are fetched from here. |
|
105 supportedKeys(runtimeKeys); |
|
106 // load all run-time setting values from cenrep. |
|
107 mRuntimeSettings = mSettingStore->loadRuntimeSettings(runtimeKeys); |
|
108 |
|
109 CX_DEBUG_EXIT_FUNCTION(); |
|
110 } |
|
111 |
|
112 |
|
113 /*! |
|
114 * Get setting value associated with the key. |
|
115 * @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h ) |
|
116 * @Param value - contains the value associated with the key. |
|
117 * @returns CxeError::None if successful or any CxeError specific error code. |
|
118 */ |
|
119 CxeError::Id CxeSettingsModelImp::getSettingValue(const QString &key, QVariant &value) |
|
120 { |
|
121 CX_DEBUG_ENTER_FUNCTION(); |
|
122 CX_DEBUG_ASSERT(mSettingStore); |
|
123 |
|
124 // Try first to find the item from cenrep store. |
|
125 |
|
126 CxeError::Id err = mSettingStore->get(key, value); |
|
127 |
|
128 // If setting is not in cenrep store, try fetching it from scene settings. |
|
129 if (err) { |
|
130 // setting not found in setting store, try finding if its scene specific setting. |
|
131 CX_DEBUG(( "fetching value from scene settings" )); |
|
132 err = sceneSettingValue(key, value); |
|
133 } |
|
134 |
|
135 CX_DEBUG_EXIT_FUNCTION(); |
|
136 |
|
137 return err; |
|
138 } |
|
139 |
|
140 |
|
141 |
|
142 |
|
143 /*! |
|
144 * Get setting value associated with the key. |
|
145 * @param uid - UID of component that owns the setting key |
|
146 * @Param key - key id of the setting |
|
147 * @param type - the type of key |
|
148 * @Param value - contains the value associated with the key. |
|
149 */ |
|
150 void CxeSettingsModelImp::getSettingValue(long int uid, |
|
151 unsigned long int key, |
|
152 Cxe::SettingKeyType type, |
|
153 QVariant &value) |
|
154 { |
|
155 CX_DEBUG_ENTER_FUNCTION(); |
|
156 CX_DEBUG_ASSERT(mSettingStore); |
|
157 |
|
158 mSettingStore->startMonitoring(uid, key, type, value); |
|
159 |
|
160 CX_DEBUG_EXIT_FUNCTION(); |
|
161 } |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 /*! |
|
167 * Set a value to the key. |
|
168 * @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h ) |
|
169 * @Param value - contains the value associated with the key. |
|
170 * @returns CxeError::None if successful or any CxeError specific error code. |
|
171 */ |
|
172 CxeError::Id CxeSettingsModelImp::set(const QString &key, const QVariant newValue) |
|
173 { |
|
174 CX_DEBUG_ENTER_FUNCTION(); |
|
175 CX_DEBUG_ASSERT(mSettingStore); |
|
176 |
|
177 // Try storing new value to cenrep |
|
178 CxeError::Id err = mSettingStore->set(key, newValue); |
|
179 |
|
180 if (err) { |
|
181 CX_DEBUG(( "Key not found in cenrepstore, writing value to scene settings" )); |
|
182 err = setSceneSettingValue(key, newValue); |
|
183 } |
|
184 |
|
185 CX_DEBUG_EXIT_FUNCTION(); |
|
186 |
|
187 return err; |
|
188 } |
|
189 |
|
190 |
|
191 /*! |
|
192 * Reset all settings |
|
193 */ |
|
194 void CxeSettingsModelImp::reset() |
|
195 { |
|
196 CX_DEBUG_ENTER_FUNCTION(); |
|
197 CX_DEBUG_ASSERT(mSettingStore); |
|
198 mSettingStore->reset(); |
|
199 CX_DEBUG_EXIT_FUNCTION(); |
|
200 } |
|
201 |
|
202 |
|
203 /*! |
|
204 * Get the configured run-time value associated with the key. |
|
205 * @Param key - Setting key Id ( refer to CxeSettingIds in cxenums.h ) |
|
206 * @Param value - contains the value associated with the key. |
|
207 * @returns CxeError::None if successful or any CxeError specific error code. |
|
208 */ |
|
209 CxeError::Id CxeSettingsModelImp::getRuntimeValue(const QString &key, QVariant &value) |
|
210 { |
|
211 CX_DEBUG_ENTER_FUNCTION(); |
|
212 |
|
213 CxeError::Id err = CxeError::None; |
|
214 |
|
215 // read run-time configuration value |
|
216 if ( mRuntimeSettings.contains(key) ) { |
|
217 value = qVariantFromValue<QVariantList > (mRuntimeSettings.value(key)); |
|
218 } else { |
|
219 err = CxeError::NotFound; |
|
220 } |
|
221 |
|
222 CX_DEBUG_EXIT_FUNCTION(); |
|
223 |
|
224 return err; |
|
225 } |
|
226 |
|
227 |
|
228 /*! |
|
229 * Set new Image scene mode. |
|
230 * @returns CxeError::None if successful or any CxeError specific error code. |
|
231 */ |
|
232 CxeError::Id CxeSettingsModelImp::setImageScene(const QString &newScene) |
|
233 { |
|
234 CX_DEBUG_ENTER_FUNCTION(); |
|
235 |
|
236 // load scene specific settings |
|
237 CxeError::Id err = loadSceneData(newScene, mCurrentImgScene); |
|
238 |
|
239 if (!err) { |
|
240 // saving current image scene to cenrep |
|
241 err = set(CxeSettingIds::IMAGE_SCENE, newScene); |
|
242 |
|
243 // saving flash value from scene to cenrep |
|
244 QString key(CxeSettingIds::FLASH_MODE); |
|
245 err = set(key, mCurrentImgScene[key].toInt()); |
|
246 |
|
247 // saving face tracking value from scene to cenrep |
|
248 key = CxeSettingIds::FACE_TRACKING; |
|
249 err = set(key, mCurrentImgScene[key].toInt()); |
|
250 } |
|
251 |
|
252 CX_DEBUG_EXIT_FUNCTION(); |
|
253 |
|
254 return err; |
|
255 } |
|
256 |
|
257 |
|
258 /*! |
|
259 * Set new video scene mode. |
|
260 * @returns CxeError::None if successful or any CxeError specific error code. |
|
261 */ |
|
262 CxeError::Id CxeSettingsModelImp::setVideoScene(const QString &newScene) |
|
263 { |
|
264 CX_DEBUG_ENTER_FUNCTION(); |
|
265 |
|
266 CxeError::Id err = loadSceneData(newScene, mCurrentVidScene); |
|
267 |
|
268 if (!err) { |
|
269 // video scene loaded successfully, store the scene value to cenrep |
|
270 err = set(CxeSettingIds::VIDEO_SCENE, newScene); |
|
271 } |
|
272 |
|
273 CX_DEBUG_EXIT_FUNCTION(); |
|
274 |
|
275 return err; |
|
276 } |
|
277 |
|
278 |
|
279 |
|
280 /*! |
|
281 * Loads Image scene settings for the given Scene ID |
|
282 */ |
|
283 CxeError::Id CxeSettingsModelImp::imageScene(const QString &sceneId, CxeScene &sceneSettings) |
|
284 { |
|
285 CX_DEBUG_ENTER_FUNCTION(); |
|
286 |
|
287 CxeError::Id err = CxeError::None; |
|
288 |
|
289 if(mImageSceneModes.contains(sceneId)) { |
|
290 sceneSettings = mImageSceneModes[sceneId]; |
|
291 } else { |
|
292 err = CxeError::NotFound; |
|
293 } |
|
294 |
|
295 CX_DEBUG_EXIT_FUNCTION(); |
|
296 |
|
297 return err; |
|
298 } |
|
299 |
|
300 |
|
301 /*! |
|
302 * Loads Video scene settings for the given Scene ID |
|
303 * \param sceneId |
|
304 * \param sceneSettings |
|
305 */ |
|
306 CxeError::Id CxeSettingsModelImp::videoScene(const QString &sceneId, CxeScene &sceneSettings) |
|
307 { |
|
308 CX_DEBUG_ENTER_FUNCTION(); |
|
309 |
|
310 CxeError::Id err = CxeError::None; |
|
311 |
|
312 if(mVideoSceneModes.contains(sceneId)) { |
|
313 sceneSettings = mVideoSceneModes[sceneId]; |
|
314 } else { |
|
315 err = CxeError::NotFound; |
|
316 } |
|
317 |
|
318 CX_DEBUG_EXIT_FUNCTION(); |
|
319 |
|
320 return err; |
|
321 } |
|
322 |
|
323 |
|
324 /*! |
|
325 * Creates a copy of the selected scene that we use for accessing specific scene settings. |
|
326 * \param newScene |
|
327 * \param currentSceneSettings |
|
328 */ |
|
329 CxeError::Id CxeSettingsModelImp::loadSceneData(const QString &newScene, CxeScene ¤tSceneSettings) |
|
330 { |
|
331 CX_DEBUG_ENTER_FUNCTION(); |
|
332 |
|
333 CxeScene sceneDefaultSettings; |
|
334 CxeError::Id err = imageScene(newScene, sceneDefaultSettings); |
|
335 |
|
336 if (err == CxeError::NotFound) { |
|
337 // not still scene, try in video scene. |
|
338 err = videoScene(newScene, sceneDefaultSettings); |
|
339 } |
|
340 |
|
341 if (!err) { |
|
342 // We have a new scene available, so we can clear the old values. |
|
343 currentSceneSettings.clear(); |
|
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. |
|
364 */ |
|
365 CxeError::Id CxeSettingsModelImp::sceneSettingValue(const QString &key, QVariant &value) |
|
366 { |
|
367 CX_DEBUG_ENTER_FUNCTION(); |
|
368 |
|
369 CxeScene scene; |
|
370 CxeError::Id err = CxeError::None; |
|
371 |
|
372 if(mCameraMode == Cxe::ImageMode) { |
|
373 CX_DEBUG(( "CxeSettingsModelImp::sceneSettingValue - Image mode Setting")); |
|
374 scene = mCurrentImgScene; |
|
375 } else { |
|
376 CX_DEBUG(( "CxeSettingsModelImp::sceneSettingValue - Video mode Setting")); |
|
377 scene = mCurrentVidScene; |
|
378 } |
|
379 |
|
380 if (scene.contains(key)) { |
|
381 value = scene[key]; |
|
382 } else { |
|
383 err = CxeError::NotFound; |
|
384 } |
|
385 |
|
386 |
|
387 CX_DEBUG_EXIT_FUNCTION(); |
|
388 |
|
389 return err; |
|
390 } |
|
391 |
|
392 |
|
393 /*! |
|
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. |
|
399 */ |
|
400 CxeError::Id CxeSettingsModelImp::setSceneSettingValue(const QString &key, QVariant newValue) |
|
401 { |
|
402 CX_DEBUG_ENTER_FUNCTION(); |
|
403 |
|
404 CxeError::Id err = CxeError::None; |
|
405 CxeScene *scene(0); |
|
406 |
|
407 if (mCameraMode == Cxe::ImageMode) { |
|
408 CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Image mode Setting")); |
|
409 scene = &mCurrentImgScene; |
|
410 } else { |
|
411 CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue - Video mode Setting")); |
|
412 scene = &mCurrentVidScene; |
|
413 } |
|
414 |
|
415 if (scene && scene->contains(key)) { |
|
416 CX_DEBUG(( "CxeSettingsModelImp::setSceneSettingValue KEY found, writing value")); |
|
417 scene->insert(key, newValue); |
|
418 } else { |
|
419 err = CxeError::NotFound; |
|
420 } |
|
421 |
|
422 CX_DEBUG_EXIT_FUNCTION(); |
|
423 |
|
424 return err; |
|
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 */ |
|
432 void CxeSettingsModelImp::supportedKeys(QList<QString>& runtimeKeys) |
|
433 { |
|
434 CX_DEBUG_ENTER_FUNCTION(); |
|
435 |
|
436 runtimeKeys.append(CxeRuntimeKeys::PRIMARY_CAMERA_CAPTURE_KEYS); |
|
437 runtimeKeys.append(CxeRuntimeKeys::PRIMARY_CAMERA_AUTOFOCUS_KEYS); |
|
438 runtimeKeys.append(CxeRuntimeKeys::SECONDARY_CAMERA_CAPTURE_KEYS); |
|
439 runtimeKeys.append(CxeRuntimeKeys::FREE_MEMORY_LEVELS); |
|
440 runtimeKeys.append(CxeRuntimeKeys::STILL_MAX_ZOOM_LIMITS); |
|
441 runtimeKeys.append(CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS); |
|
442 |
|
443 CX_DEBUG_EXIT_FUNCTION(); |
|
444 } |
|
445 |
|
446 |
|
447 /*! |
|
448 * Loads all video scene modes |
|
449 */ |
|
450 void CxeSettingsModelImp::loadVideoScenes() |
|
451 { |
|
452 CX_DEBUG_ENTER_FUNCTION(); |
|
453 |
|
454 mVideoSceneModes.clear(); |
|
455 |
|
456 CxeScene vidSceneAuto; |
|
457 |
|
458 vidSceneAuto.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_AUTO); |
|
459 vidSceneAuto.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
|
460 vidSceneAuto.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
461 vidSceneAuto.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
|
462 vidSceneAuto.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
463 vidSceneAuto.insert(CxeSettingIds::CONTRAST, 0); |
|
464 vidSceneAuto.insert(CxeSettingIds::FRAME_RATE, 0); |
|
465 vidSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
466 |
|
467 mVideoSceneModes.insert(Cxe::VIDEO_SCENE_AUTO,vidSceneAuto); |
|
468 |
|
469 |
|
470 CxeScene vidSceneNight; |
|
471 |
|
472 vidSceneNight.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_NIGHT); |
|
473 vidSceneNight.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
|
474 vidSceneNight.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
475 vidSceneNight.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight); |
|
476 vidSceneNight.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
477 vidSceneNight.insert(CxeSettingIds::CONTRAST, 0); |
|
478 vidSceneNight.insert(CxeSettingIds::FRAME_RATE, 0); |
|
479 vidSceneNight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
480 |
|
481 mVideoSceneModes.insert(Cxe::VIDEO_SCENE_NIGHT, vidSceneNight); |
|
482 |
|
483 |
|
484 CxeScene vidSceneLowLight; |
|
485 |
|
486 vidSceneLowLight.insert(CxeSettingIds::SCENE_ID, Cxe::VIDEO_SCENE_LOWLIGHT); |
|
487 vidSceneLowLight.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
|
488 vidSceneLowLight.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
489 vidSceneLowLight.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
|
490 vidSceneLowLight.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
491 vidSceneLowLight.insert(CxeSettingIds::CONTRAST, 0); |
|
492 vidSceneLowLight.insert(CxeSettingIds::FRAME_RATE, 15); //fps |
|
493 vidSceneLowLight.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
494 |
|
495 mVideoSceneModes.insert(Cxe::VIDEO_SCENE_LOWLIGHT, vidSceneLowLight); |
|
496 |
|
497 |
|
498 CX_DEBUG_EXIT_FUNCTION(); |
|
499 } |
|
500 |
|
501 |
|
502 /*! |
|
503 * Loads all Image Scene Modes |
|
504 */ |
|
505 void CxeSettingsModelImp::loadImageScenes() |
|
506 { |
|
507 CX_DEBUG_ENTER_FUNCTION(); |
|
508 |
|
509 mImageSceneModes.clear(); |
|
510 |
|
511 CxeScene imgSceneAuto; |
|
512 |
|
513 imgSceneAuto.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_AUTO); |
|
514 imgSceneAuto.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto); |
|
515 imgSceneAuto.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
516 imgSceneAuto.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
|
517 imgSceneAuto.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
518 imgSceneAuto.insert(CxeSettingIds::CONTRAST, 0); |
|
519 imgSceneAuto.insert(CxeSettingIds::SHARPNESS, SharpnessNormal); |
|
520 imgSceneAuto.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic); |
|
521 imgSceneAuto.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
522 imgSceneAuto.insert(CxeSettingIds::BRIGHTNESS, 0); |
|
523 imgSceneAuto.insert(CxeSettingIds::FLASH_MODE, FlashAuto); |
|
524 imgSceneAuto.insert(CxeSettingIds::FACE_TRACKING, 1); |
|
525 |
|
526 mImageSceneModes.insert(Cxe::IMAGE_SCENE_AUTO, imgSceneAuto); |
|
527 |
|
528 |
|
529 CxeScene imgSceneSports; |
|
530 |
|
531 imgSceneSports.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SPORTS); |
|
532 imgSceneSports.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Hyperfocal); |
|
533 imgSceneSports.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
534 imgSceneSports.insert(CxeSettingIds::EXPOSURE_MODE, ExposureSport); |
|
535 imgSceneSports.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
536 imgSceneSports.insert(CxeSettingIds::CONTRAST, 0); |
|
537 imgSceneSports.insert(CxeSettingIds::SHARPNESS, SharpnessNormal); |
|
538 imgSceneSports.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic); |
|
539 imgSceneSports.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
540 imgSceneSports.insert(CxeSettingIds::BRIGHTNESS, 0); |
|
541 imgSceneSports.insert(CxeSettingIds::FLASH_MODE, FlashOff); |
|
542 imgSceneSports.insert(CxeSettingIds::FACE_TRACKING, 0); |
|
543 |
|
544 mImageSceneModes.insert(Cxe::IMAGE_SCENE_SPORTS, imgSceneSports); |
|
545 |
|
546 |
|
547 CxeScene imgSceneCloseUp; |
|
548 |
|
549 imgSceneCloseUp.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_MACRO); |
|
550 imgSceneCloseUp.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Macro); |
|
551 imgSceneCloseUp.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
552 imgSceneCloseUp.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
|
553 imgSceneCloseUp.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
554 imgSceneCloseUp.insert(CxeSettingIds::CONTRAST, 0); |
|
555 imgSceneCloseUp.insert(CxeSettingIds::SHARPNESS, SharpnessNormal); |
|
556 imgSceneCloseUp.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic); |
|
557 imgSceneCloseUp.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
558 imgSceneCloseUp.insert(CxeSettingIds::BRIGHTNESS, 0); |
|
559 imgSceneCloseUp.insert(CxeSettingIds::FLASH_MODE, FlashAuto); |
|
560 imgSceneCloseUp.insert(CxeSettingIds::FACE_TRACKING, 0); |
|
561 |
|
562 mImageSceneModes.insert(Cxe::IMAGE_SCENE_MACRO, imgSceneCloseUp); |
|
563 |
|
564 CxeScene imgPortraitscene; |
|
565 |
|
566 imgPortraitscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_PORTRAIT); |
|
567 imgPortraitscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Portrait); |
|
568 imgPortraitscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
569 imgPortraitscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureBacklight); |
|
570 imgPortraitscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
571 imgPortraitscene.insert(CxeSettingIds::CONTRAST, 0); |
|
572 imgPortraitscene.insert(CxeSettingIds::SHARPNESS, SharpnessSoft); |
|
573 imgPortraitscene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic); |
|
574 imgPortraitscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
575 imgPortraitscene.insert(CxeSettingIds::BRIGHTNESS, 0); |
|
576 imgPortraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye); |
|
577 imgPortraitscene.insert(CxeSettingIds::FACE_TRACKING, 1); |
|
578 |
|
579 mImageSceneModes.insert(Cxe::IMAGE_SCENE_PORTRAIT, imgPortraitscene); |
|
580 |
|
581 CxeScene imglandscapescene; |
|
582 |
|
583 imglandscapescene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_SCENERY); |
|
584 imglandscapescene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Infinity); |
|
585 imglandscapescene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceSunny); |
|
586 imglandscapescene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureAuto); |
|
587 imglandscapescene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
588 imglandscapescene.insert(CxeSettingIds::CONTRAST, 0); |
|
589 imglandscapescene.insert(CxeSettingIds::SHARPNESS, SharpnessHard); |
|
590 imglandscapescene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic); |
|
591 imglandscapescene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
592 imglandscapescene.insert(CxeSettingIds::BRIGHTNESS, 0); |
|
593 imglandscapescene.insert(CxeSettingIds::FLASH_MODE, FlashOff); |
|
594 imglandscapescene.insert(CxeSettingIds::FACE_TRACKING, 0); |
|
595 |
|
596 mImageSceneModes.insert(Cxe::IMAGE_SCENE_SCENERY, imglandscapescene); |
|
597 |
|
598 |
|
599 CxeScene imgNightscene; |
|
600 |
|
601 imgNightscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHT); |
|
602 imgNightscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Auto); |
|
603 imgNightscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
604 imgNightscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight); |
|
605 imgNightscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
606 imgNightscene.insert(CxeSettingIds::CONTRAST, 0); |
|
607 imgNightscene.insert(CxeSettingIds::SHARPNESS, SharpnessNormal); |
|
608 imgNightscene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic); |
|
609 imgNightscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
610 imgNightscene.insert(CxeSettingIds::BRIGHTNESS, 0); |
|
611 imgNightscene.insert(CxeSettingIds::FLASH_MODE, FlashOff); |
|
612 imgNightscene.insert(CxeSettingIds::FACE_TRACKING, 1); |
|
613 |
|
614 mImageSceneModes.insert(Cxe::IMAGE_SCENE_NIGHT, imgNightscene); |
|
615 |
|
616 CxeScene imgNightpotraitscene; |
|
617 |
|
618 imgNightpotraitscene.insert(CxeSettingIds::SCENE_ID, Cxe::IMAGE_SCENE_NIGHTPORTRAIT); |
|
619 imgNightpotraitscene.insert(CxeSettingIds::FOCAL_RANGE, CxeAutoFocusControl::Portrait); |
|
620 imgNightpotraitscene.insert(CxeSettingIds::WHITE_BALANCE, WhitebalanceAutomatic); |
|
621 imgNightpotraitscene.insert(CxeSettingIds::EXPOSURE_MODE, ExposureNight); |
|
622 imgNightpotraitscene.insert(CxeSettingIds::COLOR_TONE, ColortoneNormal); |
|
623 imgNightpotraitscene.insert(CxeSettingIds::CONTRAST, 0); |
|
624 imgNightpotraitscene.insert(CxeSettingIds::SHARPNESS, SharpnessNormal); |
|
625 imgNightpotraitscene.insert(CxeSettingIds::LIGHT_SENSITIVITY, LightSensitivityAutomatic); |
|
626 imgNightpotraitscene.insert(CxeSettingIds::EV_COMPENSATION_VALUE, 0); |
|
627 imgNightpotraitscene.insert(CxeSettingIds::BRIGHTNESS, 0); |
|
628 imgNightpotraitscene.insert(CxeSettingIds::FLASH_MODE, FlashAntiRedEye); |
|
629 imgNightpotraitscene.insert(CxeSettingIds::FACE_TRACKING, 1); |
|
630 |
|
631 mImageSceneModes.insert(Cxe::IMAGE_SCENE_NIGHTPORTRAIT, imgNightpotraitscene); |
|
632 |
|
633 CX_DEBUG_EXIT_FUNCTION(); |
|
634 } |
|
635 |
|
636 /*! |
|
637 * Returns the current image scene mode. |
|
638 */ |
|
639 CxeScene& CxeSettingsModelImp::currentImageScene() |
|
640 { |
|
641 CX_DEBUG_ENTER_FUNCTION(); |
|
642 CX_DEBUG_EXIT_FUNCTION(); |
|
643 |
|
644 return mCurrentImgScene; |
|
645 } |
|
646 |
|
647 |
|
648 /*! |
|
649 * Returns the current video scene mode. |
|
650 */ |
|
651 CxeScene& CxeSettingsModelImp::currentVideoScene() |
|
652 { |
|
653 CX_DEBUG_ENTER_FUNCTION(); |
|
654 CX_DEBUG_EXIT_FUNCTION(); |
|
655 |
|
656 return mCurrentVidScene; |
|
657 } |
|
658 |
|
659 |
|
660 /*! |
|
661 * Restores settings whenever we switch between Image/Video modes or |
|
662 * during startup. |
|
663 */ |
|
664 void CxeSettingsModelImp::cameraModeChanged(Cxe::CameraMode newMode) |
|
665 { |
|
666 CX_DEBUG_ENTER_FUNCTION(); |
|
667 |
|
668 if (newMode == Cxe::ImageMode) { |
|
669 restoreImageSettings(); |
|
670 } else { |
|
671 restoreVideoSettings(); |
|
672 } |
|
673 |
|
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 |
|
750 CX_DEBUG_EXIT_FUNCTION(); |
|
751 } |
|
752 |
|
753 // end of file |
|