30 static const QString INTERACTIVE_SCROLLBAR = "Interactive scrollbar"; |
30 static const QString INTERACTIVE_SCROLLBAR = "Interactive scrollbar"; |
31 static const QString MODEL_IMAGE_TYPE = "Datamodel image type"; |
31 static const QString MODEL_IMAGE_TYPE = "Datamodel image type"; |
32 static const QString WIDGET_HEIGHT = "Widget height"; |
32 static const QString WIDGET_HEIGHT = "Widget height"; |
33 static const QString WIDGET_WIDTH = "Widget width"; |
33 static const QString WIDGET_WIDTH = "Widget width"; |
34 static const QString LOW_RES_IMAGES = "Use low res images"; |
34 static const QString LOW_RES_IMAGES = "Use low res images"; |
35 static const QString TITLE_POSITION = "Title position"; |
|
36 static const QString TITLE_FONT = "Title font"; |
35 static const QString TITLE_FONT = "Title font"; |
37 static const QString DESCRIPTION_POSITION = "Description position"; |
|
38 static const QString DESCRIPTION_FONT = "Description font"; |
36 static const QString DESCRIPTION_FONT = "Description font"; |
39 static const QString REFLECTIONS_ENABLED = "Reflections enabled"; |
37 static const QString REFLECTIONS_ENABLED = "Reflections enabled"; |
|
38 static const QString EFFECT3D_ENABLED = "Grid 3d effects enabled"; |
40 static const QString ITEM_SIZE_POLICY = "Item size policy"; |
39 static const QString ITEM_SIZE_POLICY = "Item size policy"; |
41 |
40 |
42 enum DataFormItems { |
41 enum DataFormItems { |
43 ItemWidgetType = 0, |
42 ItemWidgetType = 0, |
44 ItemScrollBarVisibility, |
43 ItemScrollBarVisibility, |
45 ItemScrollBarInteractivity, |
44 ItemScrollBarInteractivity, |
46 ItemModelImageType, |
45 ItemModelImageType, |
47 ItemWidgetHeight, |
46 ItemWidgetHeight, |
48 ItemWidgetWidth, |
47 ItemWidgetWidth, |
49 ItemLowResImages, |
48 ItemLowResImages, |
50 ItemTitlePosition, |
|
51 ItemTitleFont, |
49 ItemTitleFont, |
52 ItemDescriptionPosition, |
|
53 ItemDescriptionFont, |
50 ItemDescriptionFont, |
54 ItemReflectionEnabled, |
51 ItemReflectionEnabled, |
|
52 ItemEffect3dEnabled, |
55 ItemItemSizePolicy |
53 ItemItemSizePolicy |
56 }; |
54 }; |
57 |
55 |
58 HgWidgetOptionsView::HgWidgetOptionsView(QGraphicsItem *parent) : |
56 HgWidgetOptionsView::HgWidgetOptionsView(QGraphicsItem *parent) : |
59 HbView(parent), |
57 HbView(parent), |
97 HbDataFormModelItem::ToggleValueItem, LOW_RES_IMAGES); |
95 HbDataFormModelItem::ToggleValueItem, LOW_RES_IMAGES); |
98 item->setContentWidgetData(QString("text"), QString("no")); |
96 item->setContentWidgetData(QString("text"), QString("no")); |
99 item->setContentWidgetData(QString("additionalText"), QString("yes")); |
97 item->setContentWidgetData(QString("additionalText"), QString("yes")); |
100 |
98 |
101 item = mModel->appendDataFormItem( |
99 item = mModel->appendDataFormItem( |
102 HbDataFormModelItem::ComboBoxItem, TITLE_POSITION); |
|
103 item->setContentWidgetData(QString("items"), QStringList("Hidden") << "Above" << "Below"); |
|
104 |
|
105 item = mModel->appendDataFormItem( |
|
106 HbDataFormModelItem::ComboBoxItem, TITLE_FONT); |
100 HbDataFormModelItem::ComboBoxItem, TITLE_FONT); |
107 item->setContentWidgetData(QString("items"), QStringList("Primary") << "Secondary" << "Title" << "Primary small" << "Digital"); |
101 item->setContentWidgetData(QString("items"), QStringList("Primary") << "Secondary" << "Title" << "Primary small" << "Digital"); |
108 |
|
109 item = mModel->appendDataFormItem( |
|
110 HbDataFormModelItem::ComboBoxItem, DESCRIPTION_POSITION); |
|
111 item->setContentWidgetData(QString("items"), QStringList("Hidden") << "Above" << "Below"); |
|
112 |
102 |
113 item = mModel->appendDataFormItem( |
103 item = mModel->appendDataFormItem( |
114 HbDataFormModelItem::ComboBoxItem, DESCRIPTION_FONT); |
104 HbDataFormModelItem::ComboBoxItem, DESCRIPTION_FONT); |
115 item->setContentWidgetData(QString("items"), QStringList("Primary") << "Secondary" << "Title" << "Primary small" << "Digital"); |
105 item->setContentWidgetData(QString("items"), QStringList("Primary") << "Secondary" << "Title" << "Primary small" << "Digital"); |
116 |
106 |
117 item = mModel->appendDataFormItem( |
107 item = mModel->appendDataFormItem( |
118 HbDataFormModelItem::ToggleValueItem, REFLECTIONS_ENABLED); |
108 HbDataFormModelItem::ToggleValueItem, REFLECTIONS_ENABLED); |
119 item->setContentWidgetData(QString("text"), QString("no")); |
109 item->setContentWidgetData(QString("text"), QString("no")); |
120 item->setContentWidgetData(QString("additionalText"), QString("yes")); |
110 item->setContentWidgetData(QString("additionalText"), QString("yes")); |
121 |
111 |
|
112 item = mModel->appendDataFormItem( |
|
113 HbDataFormModelItem::ToggleValueItem, EFFECT3D_ENABLED); |
|
114 item->setContentWidgetData(QString("text"), QString("no")); |
|
115 item->setContentWidgetData(QString("additionalText"), QString("yes")); |
|
116 |
122 item = mModel->appendDataFormItem( |
117 item = mModel->appendDataFormItem( |
123 HbDataFormModelItem::ToggleValueItem, ITEM_SIZE_POLICY); |
118 HbDataFormModelItem::ToggleValueItem, ITEM_SIZE_POLICY); |
124 item->setContentWidgetData(QString("text"), QString("User defined")); |
119 item->setContentWidgetData(QString("text"), QString("User defined")); |
125 item->setContentWidgetData(QString("additionalText"), QString("Automatic")); |
120 item->setContentWidgetData(QString("additionalText"), QString("Automatic")); |
126 |
121 |
234 QVariant data = item->contentWidgetData(QString("text")); |
229 QVariant data = item->contentWidgetData(QString("text")); |
235 bool value = data.toString() == "yes"; |
230 bool value = data.toString() == "yes"; |
236 settings.setValue(SETT_LOW_RES_IMAGES, value); |
231 settings.setValue(SETT_LOW_RES_IMAGES, value); |
237 emit lowResImageUseChanged(value); |
232 emit lowResImageUseChanged(value); |
238 } |
233 } |
239 else if (item->data(HbDataFormModelItem::LabelRole).toString() == TITLE_POSITION) { |
|
240 int index = item->contentWidgetData(QString("currentIndex")).toInt(); |
|
241 HgMediawall::LabelPosition position = HgMediawall::PositionNone; |
|
242 switch (index) { |
|
243 case 0: |
|
244 position = HgMediawall::PositionNone; |
|
245 break; |
|
246 case 1: |
|
247 position = HgMediawall::PositionAboveImage; |
|
248 break; |
|
249 case 2: |
|
250 position = HgMediawall::PositionBelowImage; |
|
251 break; |
|
252 default: break; |
|
253 } |
|
254 |
|
255 settings.setValue(SETT_TITLE_POSITION, position); |
|
256 emit titlePositionChanged(position); |
|
257 } |
|
258 else if (item->data(HbDataFormModelItem::LabelRole).toString() == TITLE_FONT) { |
234 else if (item->data(HbDataFormModelItem::LabelRole).toString() == TITLE_FONT) { |
259 int index = item->contentWidgetData(QString("currentIndex")).toInt(); |
235 int index = item->contentWidgetData(QString("currentIndex")).toInt(); |
260 HbFontSpec::Role role = HbFontSpec::Undefined; |
236 HbFontSpec::Role role = HbFontSpec::Undefined; |
261 switch (index) { |
237 switch (index) { |
262 case 0: |
238 case 0: |
277 default: break; |
253 default: break; |
278 } |
254 } |
279 settings.setValue(SETT_TITLE_FONT, role); |
255 settings.setValue(SETT_TITLE_FONT, role); |
280 emit titleFontChanged(HbFontSpec(role)); |
256 emit titleFontChanged(HbFontSpec(role)); |
281 } |
257 } |
282 else if (item->data(HbDataFormModelItem::LabelRole).toString() == DESCRIPTION_POSITION) { |
|
283 int index = item->contentWidgetData(QString("currentIndex")).toInt(); |
|
284 HgMediawall::LabelPosition position = HgMediawall::PositionNone; |
|
285 switch (index) { |
|
286 case 0: |
|
287 position = HgMediawall::PositionNone; |
|
288 break; |
|
289 case 1: |
|
290 position = HgMediawall::PositionAboveImage; |
|
291 break; |
|
292 case 2: |
|
293 position = HgMediawall::PositionBelowImage; |
|
294 break; |
|
295 default: break; |
|
296 } |
|
297 |
|
298 settings.setValue(SETT_DESCRIPTION_POSITION, position); |
|
299 emit descriptionPositionChanged(position); |
|
300 } |
|
301 else if (item->data(HbDataFormModelItem::LabelRole).toString() == DESCRIPTION_FONT) { |
258 else if (item->data(HbDataFormModelItem::LabelRole).toString() == DESCRIPTION_FONT) { |
302 int index = item->contentWidgetData(QString("currentIndex")).toInt(); |
259 int index = item->contentWidgetData(QString("currentIndex")).toInt(); |
303 HbFontSpec::Role role = HbFontSpec::Undefined; |
260 HbFontSpec::Role role = HbFontSpec::Undefined; |
304 switch (index) { |
261 switch (index) { |
305 case 0: |
262 case 0: |
326 QVariant data = item->contentWidgetData(QString("text")); |
283 QVariant data = item->contentWidgetData(QString("text")); |
327 bool value = data.toString() == "yes"; |
284 bool value = data.toString() == "yes"; |
328 settings.setValue(SETT_REFLECTIONS_ENABLED, value); |
285 settings.setValue(SETT_REFLECTIONS_ENABLED, value); |
329 emit reflectionsEnabledChanged(value); |
286 emit reflectionsEnabledChanged(value); |
330 } |
287 } |
|
288 else if (item->data(HbDataFormModelItem::LabelRole).toString() == EFFECT3D_ENABLED) { |
|
289 QVariant data = item->contentWidgetData(QString("text")); |
|
290 bool value = data.toString() == "yes"; |
|
291 settings.setValue(SETT_EFFECT3D_ENABLED, value); |
|
292 emit effect3dEnabledChanged(value); |
|
293 } |
331 else if (item->data(HbDataFormModelItem::LabelRole).toString() == ITEM_SIZE_POLICY) { |
294 else if (item->data(HbDataFormModelItem::LabelRole).toString() == ITEM_SIZE_POLICY) { |
332 QVariant data = item->contentWidgetData(QString("text")); |
295 QVariant data = item->contentWidgetData(QString("text")); |
333 HgWidget::ItemSizePolicy value = (data.toString() == "Automatic" ? HgWidget::ItemSizeAutomatic : HgWidget::ItemSizeUserDefined); |
296 HgWidget::ItemSizePolicy value = (data.toString() == "Automatic" ? HgWidget::ItemSizeAutomatic : HgWidget::ItemSizeUserDefined); |
334 settings.setValue(SETT_ITEM_SIZE_POLICY, value); |
297 settings.setValue(SETT_ITEM_SIZE_POLICY, value); |
335 emit itemSizePolicyChanged(value); |
298 emit itemSizePolicyChanged(value); |
338 |
301 |
339 void HgWidgetOptionsView::setCoverflowEnabled(bool value) |
302 void HgWidgetOptionsView::setCoverflowEnabled(bool value) |
340 { |
303 { |
341 HbAbstractViewItem *item = mForm->itemByIndex(mModel->index(ItemLowResImages, 0)); |
304 HbAbstractViewItem *item = mForm->itemByIndex(mModel->index(ItemLowResImages, 0)); |
342 if (item) item->setEnabled(value); |
305 if (item) item->setEnabled(value); |
343 item = mForm->itemByIndex(mModel->index(ItemTitlePosition, 0)); |
|
344 if (item) item->setEnabled(value); |
|
345 item = mForm->itemByIndex(mModel->index(ItemTitleFont, 0)); |
306 item = mForm->itemByIndex(mModel->index(ItemTitleFont, 0)); |
346 if (item) item->setEnabled(value); |
|
347 item = mForm->itemByIndex(mModel->index(ItemDescriptionPosition, 0)); |
|
348 if (item) item->setEnabled(value); |
307 if (item) item->setEnabled(value); |
349 item = mForm->itemByIndex(mModel->index(ItemDescriptionFont, 0)); |
308 item = mForm->itemByIndex(mModel->index(ItemDescriptionFont, 0)); |
350 if (item) item->setEnabled(value); |
309 if (item) item->setEnabled(value); |
351 item = mForm->itemByIndex(mModel->index(ItemReflectionEnabled, 0)); |
310 item = mForm->itemByIndex(mModel->index(ItemReflectionEnabled, 0)); |
352 if (item) item->setEnabled(value); |
311 if (item) item->setEnabled(value); |
465 if (item && value.isValid()) { |
424 if (item && value.isValid()) { |
466 item->setContentWidgetData(QString("text"), value.toBool() ? "yes" : "no"); |
425 item->setContentWidgetData(QString("text"), value.toBool() ? "yes" : "no"); |
467 item->setContentWidgetData(QString("additionalText"), value.toBool() ? "no" : "yes"); |
426 item->setContentWidgetData(QString("additionalText"), value.toBool() ? "no" : "yes"); |
468 } |
427 } |
469 |
428 |
470 item = mModel->itemFromIndex(mModel->index(ItemTitlePosition, 0)); |
|
471 value = settings.value(SETT_TITLE_POSITION); |
|
472 if (item && value.isValid()) { |
|
473 int index(0); |
|
474 switch (value.toInt()) { |
|
475 case HgMediawall::PositionNone: |
|
476 index = 0; |
|
477 break; |
|
478 case HgMediawall::PositionAboveImage: |
|
479 index = 1; |
|
480 break; |
|
481 case HgMediawall::PositionBelowImage: |
|
482 index = 2; |
|
483 break; |
|
484 default: break; |
|
485 } |
|
486 item->setContentWidgetData(QString("currentIndex"), index); |
|
487 } |
|
488 else if (item) { |
|
489 item->setContentWidgetData(QString("currentIndex"), 1); |
|
490 } |
|
491 |
|
492 item = mModel->itemFromIndex(mModel->index(ItemTitleFont, 0)); |
429 item = mModel->itemFromIndex(mModel->index(ItemTitleFont, 0)); |
493 value = settings.value(SETT_TITLE_FONT); |
430 value = settings.value(SETT_TITLE_FONT); |
494 if (item && value.isValid()) { |
431 if (item && value.isValid()) { |
495 int index(0); |
432 int index(0); |
496 switch (value.toInt()) { |
433 switch (value.toInt()) { |
512 default: break; |
449 default: break; |
513 } |
450 } |
514 item->setContentWidgetData(QString("currentIndex"), index); |
451 item->setContentWidgetData(QString("currentIndex"), index); |
515 } |
452 } |
516 |
453 |
517 item = mModel->itemFromIndex(mModel->index(ItemDescriptionPosition, 0)); |
|
518 value = settings.value(SETT_DESCRIPTION_POSITION); |
|
519 if (item && value.isValid()) { |
|
520 int index(0); |
|
521 switch (value.toInt()) { |
|
522 case HgMediawall::PositionNone: |
|
523 index = 0; |
|
524 break; |
|
525 case HgMediawall::PositionAboveImage: |
|
526 index = 1; |
|
527 break; |
|
528 case HgMediawall::PositionBelowImage: |
|
529 index = 2; |
|
530 break; |
|
531 default: break; |
|
532 } |
|
533 item->setContentWidgetData(QString("currentIndex"), index); |
|
534 } |
|
535 |
|
536 item = mModel->itemFromIndex(mModel->index(ItemDescriptionFont, 0)); |
454 item = mModel->itemFromIndex(mModel->index(ItemDescriptionFont, 0)); |
537 value = settings.value(SETT_DESCRIPTION_FONT); |
455 value = settings.value(SETT_DESCRIPTION_FONT); |
538 if (item && value.isValid()) { |
456 if (item && value.isValid()) { |
539 int index(0); |
457 int index(0); |
540 switch (value.toInt()) { |
458 switch (value.toInt()) { |
563 if (item && value.isValid()) { |
481 if (item && value.isValid()) { |
564 item->setContentWidgetData(QString("text"), value.toBool() ? "yes" : "no"); |
482 item->setContentWidgetData(QString("text"), value.toBool() ? "yes" : "no"); |
565 item->setContentWidgetData(QString("additionalText"), value.toBool() ? "no" : "yes"); |
483 item->setContentWidgetData(QString("additionalText"), value.toBool() ? "no" : "yes"); |
566 } |
484 } |
567 |
485 |
|
486 item = mModel->itemFromIndex(mModel->index(ItemEffect3dEnabled, 0)); |
|
487 value = settings.value(SETT_EFFECT3D_ENABLED); |
|
488 if (item && value.isValid()) { |
|
489 item->setContentWidgetData(QString("text"), value.toBool() ? "yes" : "no"); |
|
490 item->setContentWidgetData(QString("additionalText"), value.toBool() ? "no" : "yes"); |
|
491 } |
|
492 |
568 item = mModel->itemFromIndex(mModel->index(ItemItemSizePolicy, 0)); |
493 item = mModel->itemFromIndex(mModel->index(ItemItemSizePolicy, 0)); |
569 value = settings.value(SETT_ITEM_SIZE_POLICY); |
494 value = settings.value(SETT_ITEM_SIZE_POLICY); |
570 if (item && value.isValid()) { |
495 if (item && value.isValid()) { |
571 if (value.toInt() == HgWidget::ItemSizeAutomatic) { |
496 if (value.toInt() == HgWidget::ItemSizeAutomatic) { |
572 item->setContentWidgetData(QString("text"), "Automatic"); |
497 item->setContentWidgetData(QString("text"), "Automatic"); |