23 #include <QMultiMap> |
23 #include <QMultiMap> |
24 #include <QMetaType> |
24 #include <QMetaType> |
25 #include <QString> |
25 #include <QString> |
26 #include <QStringList> |
26 #include <QStringList> |
27 #include <QVariant> |
27 #include <QVariant> |
|
28 #ifdef Q_OS_SYMBIAN |
|
29 #include <ProfileEngineSDKCRKeys.h> |
|
30 #endif |
28 |
31 |
29 #include "xqsettingsmanager.h" // Settings Manager API |
32 #include "xqsettingsmanager.h" // Settings Manager API |
30 #include "xqsettingskey.h" |
33 #include "xqsettingskey.h" |
31 #include "cxesettingscenrepstore.h" |
34 #include "cxesettingscenrepstore.h" |
32 #include "cxenamespace.h" |
35 #include "cxenamespace.h" |
33 #include "cxutils.h" |
36 #include "cxutils.h" |
34 #include "cxenamespace.h" |
37 #include "cxenamespace.h" |
35 #include "cxeerror.h" |
38 #include "cxeerror.h" |
36 #include "cxecenrepkeys.h" |
39 #include "cxecenrepkeys.h" |
37 |
40 |
38 |
41 #include "OstTraceDefinitions.h" |
39 #ifdef Q_OS_SYMBIAN |
42 #ifdef OST_TRACE_COMPILER_IN_USE |
40 #include <ProfileEngineSDKCRKeys.h> |
43 #include "cxesettingscenrepstoreTraces.h" |
41 #endif |
44 #endif |
42 |
45 |
|
46 |
43 using namespace CxeSettingIds; |
47 using namespace CxeSettingIds; |
44 |
48 |
45 |
49 |
46 /*! |
50 /*! |
47 * CxeSettingsCenRepStore::CxeSettingsCenRepStore |
51 * CxeSettingsCenRepStore::CxeSettingsCenRepStore |
48 */ |
52 */ |
49 CxeSettingsCenRepStore::CxeSettingsCenRepStore() |
53 CxeSettingsCenRepStore::CxeSettingsCenRepStore() |
50 { |
54 { |
51 CX_DEBUG_ENTER_FUNCTION(); |
55 CX_DEBUG_ENTER_FUNCTION(); |
|
56 OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_1, "msg: e_CX_SETTINGSSTORE_CREATE 1"); |
52 |
57 |
53 // map keys of type "string" to cenrep ids |
58 // map keys of type "string" to cenrep ids |
54 mapKeys(); |
59 mapKeys(); |
55 |
60 |
56 // we create settings handle, scope user::scope |
61 // we create settings handle, scope user::scope |
57 mSettingsManager = new XQSettingsManager(this); |
62 mSettingsManager = new XQSettingsManager(this); |
58 |
63 |
59 bool ok = false; |
64 bool ok = connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), |
60 ok = connect(mSettingsManager, SIGNAL(valueChanged(XQSettingsKey, QVariant)), |
65 this, SLOT(handleValueChanged(XQSettingsKey, QVariant))); |
61 this, SLOT(handleValueChanged(XQSettingsKey, QVariant))); |
66 CX_ASSERT_ALWAYS(ok); |
62 CX_DEBUG_ASSERT(ok); |
|
63 |
67 |
64 CX_DEBUG(("CxeSettingsCenRepStore - mSettingsManager ptr = %d", mSettingsManager)); |
68 CX_DEBUG(("CxeSettingsCenRepStore - mSettingsManager ptr = %d", mSettingsManager)); |
65 |
69 |
|
70 OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_2, "msg: e_CX_SETTINGSSTORE_CREATE 0"); |
66 CX_DEBUG_EXIT_FUNCTION(); |
71 CX_DEBUG_EXIT_FUNCTION(); |
67 } |
72 } |
68 |
73 |
69 |
74 |
70 |
75 |
117 * NOTE: loading runtime settings should be done only ONCE at start-up. |
122 * NOTE: loading runtime settings should be done only ONCE at start-up. |
118 */ |
123 */ |
119 QHash<QString, QVariantList> CxeSettingsCenRepStore::loadRuntimeSettings(QList<QString>& runtimeKeys) |
124 QHash<QString, QVariantList> CxeSettingsCenRepStore::loadRuntimeSettings(QList<QString>& runtimeKeys) |
120 { |
125 { |
121 CX_DEBUG_ENTER_FUNCTION(); |
126 CX_DEBUG_ENTER_FUNCTION(); |
|
127 OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_LOADRUNTIME_1, "msg: e_CX_SETTINGSSTORE_LOAD_RUNTIME 1"); |
122 |
128 |
123 QHash<QString, QVariantList> settings; |
129 QHash<QString, QVariantList> settings; |
124 CxeError::Id err = CxeError::None; |
130 CxeError::Id err = CxeError::None; |
125 QVariantList list; |
131 QVariantList list; |
126 QVariant data; |
132 QVariant data; |
214 } else { |
221 } else { |
215 keyType = XQSettingsKey::TargetCentralRepository; |
222 keyType = XQSettingsKey::TargetCentralRepository; |
216 } |
223 } |
217 |
224 |
218 XQSettingsKey settingsKey(keyType, uid, key); |
225 XQSettingsKey settingsKey(keyType, uid, key); |
219 CX_DEBUG(("reading values from XQSettingsManager..")); |
226 CX_DEBUG(("reading value from XQSettingsManager..")); |
220 value = mSettingsManager->readItemValue(settingsKey); |
227 value = mSettingsManager->readItemValue(settingsKey); |
221 |
228 |
222 // start monitoring changes for the key |
229 // start monitoring changes for the key |
223 // both P&S and Repository keys are monitored |
230 // both P&S and Repository keys are monitored |
224 bool ok = false; |
231 bool ok = mSettingsManager->startMonitoring(settingsKey); |
225 ok = mSettingsManager->startMonitoring(settingsKey); |
232 if (!ok) { |
226 CX_DEBUG_ASSERT(ok); |
233 XQSettingsManager::Error error = mSettingsManager->error(); |
|
234 CX_DEBUG(("CxeSettingsCenRepStore - got error %d trying to start listening", error)); |
|
235 // If we try to start listening one key more than once, |
|
236 // we get this error. We can safely ignore it. |
|
237 ok = (XQSettingsManager::AlreadyExistsError == error); |
|
238 } |
|
239 CX_ASSERT_ALWAYS(ok); |
227 |
240 |
228 CX_DEBUG_EXIT_FUNCTION(); |
241 CX_DEBUG_EXIT_FUNCTION(); |
229 } |
242 } |
230 |
243 |
231 |
244 |
282 * Maps CxeSettingIds to cenrep key ids that XQSettingsManager understands |
295 * Maps CxeSettingIds to cenrep key ids that XQSettingsManager understands |
283 */ |
296 */ |
284 void CxeSettingsCenRepStore::mapKeys() |
297 void CxeSettingsCenRepStore::mapKeys() |
285 { |
298 { |
286 CX_DEBUG_ENTER_FUNCTION(); |
299 CX_DEBUG_ENTER_FUNCTION(); |
|
300 OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_MAPKEYS_1, "msg: e_CX_SETTINGSSTORE_INIT_MAPPING 1"); |
|
301 |
287 mKeyMapping.clear(); |
302 mKeyMapping.clear(); |
288 |
303 |
289 // mapping setting keys |
304 // mapping setting keys |
290 addKeyMapping(CxeSettingIds::FNAME_FOLDER_SUFFIX, |
305 addKeyMapping(CxeSettingIds::FNAME_FOLDER_SUFFIX, |
291 FileNameSuffixCr, |
306 FileNameSuffixCr, |
320 XQSettingsManager::TypeInt); |
335 XQSettingsManager::TypeInt); |
321 |
336 |
322 addKeyMapping(CxeSettingIds::VIDEO_MUTE_SETTING, |
337 addKeyMapping(CxeSettingIds::VIDEO_MUTE_SETTING, |
323 AudioMuteCr, |
338 AudioMuteCr, |
324 XQSettingsManager::TypeInt); |
339 XQSettingsManager::TypeInt); |
325 |
340 |
326 addKeyMapping(CxeSettingIds::GEOTAGGING, |
341 addKeyMapping(CxeSettingIds::GEOTAGGING, |
327 GeoTaggingCr, |
342 GeoTaggingCr, |
328 XQSettingsManager::TypeInt); |
343 XQSettingsManager::TypeInt); |
329 |
344 |
330 addKeyMapping(CxeSettingIds::FACE_TRACKING, |
345 addKeyMapping(CxeSettingIds::FACE_TRACKING, |
344 XQSettingsManager::TypeInt); |
359 XQSettingsManager::TypeInt); |
345 |
360 |
346 addKeyMapping(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON, |
361 addKeyMapping(CxeSettingIds::CAPTURE_SOUND_ALWAYS_ON, |
347 CaptureSoundAlwaysOnCr, |
362 CaptureSoundAlwaysOnCr, |
348 XQSettingsManager::TypeInt); |
363 XQSettingsManager::TypeInt); |
349 |
364 |
350 addKeyMapping(CxeSettingIds::CAMERA_MODE, |
365 addKeyMapping(CxeSettingIds::CAMERA_MODE, |
351 CameraModeCr, |
366 CameraModeCr, |
352 XQSettingsManager::TypeInt); |
367 XQSettingsManager::TypeInt); |
353 |
368 |
354 addKeyMapping(CxeSettingIds::GEOTAGGING_DISCLAIMER, |
369 addKeyMapping(CxeSettingIds::GEOTAGGING_DISCLAIMER, |
384 addKeyMapping(CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS, |
399 addKeyMapping(CxeRuntimeKeys::VIDEO_MAX_ZOOM_LIMITS, |
385 VideoMaxZoomLimitsCr, |
400 VideoMaxZoomLimitsCr, |
386 XQSettingsManager::TypeString, |
401 XQSettingsManager::TypeString, |
387 true); |
402 true); |
388 |
403 |
|
404 OstTrace0(camerax_performance, CXESETTINGSCENREPSTORE_MAPKEYS_2, "msg: e_CX_SETTINGSSTORE_INIT_MAPPING 0"); |
389 CX_DEBUG_EXIT_FUNCTION(); |
405 CX_DEBUG_EXIT_FUNCTION(); |
390 } |
406 } |
391 |
407 |
392 /*! |
408 /*! |
393 * helper method to construct key mappings for each setting key |
409 * helper method to construct key mappings for each setting key |