changeset 6 | c3690ec91ef8 |
parent 5 | 627c4a0fd0e7 |
child 7 | 923ff622b8b9 |
5:627c4a0fd0e7 | 6:c3690ec91ef8 |
---|---|
97 #include "hbcssparser_p.h" |
97 #include "hbcssparser_p.h" |
98 #include "hbrepeaticonitem_p.h" |
98 #include "hbrepeaticonitem_p.h" |
99 #include "hbnamespace_p.h" |
99 #include "hbnamespace_p.h" |
100 |
100 |
101 |
101 |
102 #include "hbmeshlayout_p.h" |
102 #include "hbanchorlayout.h" |
103 #include "hbanchorlayoutdebug_p.h" |
|
104 #include "hbanchor_p.h" |
|
103 |
105 |
104 #include <QGraphicsWidget> |
106 #include <QGraphicsWidget> |
105 #include <hbwidget.h> |
107 #include <hbwidget.h> |
106 #include <hbwidgetbase.h> |
108 #include <hbwidgetbase.h> |
107 #include "hbdeviceprofile.h" |
109 #include "hbdeviceprofile.h" |
136 Painting for the primitives occurs from the graphics scene. |
138 Painting for the primitives occurs from the graphics scene. |
137 |
139 |
138 */ |
140 */ |
139 |
141 |
140 /*! |
142 /*! |
141 |
143 |
142 \deprecated P_PushButton_icon |
144 \deprecated P_PushButton_icon |
143 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
145 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
144 |
146 |
145 |
147 |
146 \deprecated P_PushButton_text |
148 \deprecated P_PushButton_text |
147 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
149 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
148 |
150 |
149 |
151 |
150 \deprecated P_PushButton_additionaltext |
152 \deprecated P_PushButton_additionaltext |
151 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
153 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
152 |
154 |
153 |
155 |
154 \deprecated P_PushButton_background |
156 \deprecated P_PushButton_background |
344 |
346 |
345 |
347 |
346 \deprecated P_ListViewItem_icon |
348 \deprecated P_ListViewItem_icon |
347 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
349 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
348 |
350 |
349 |
351 |
350 \deprecated P_ItemHighlight_background |
352 \deprecated P_ItemHighlight_background |
351 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
353 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
352 |
354 |
353 |
355 |
354 \deprecated P_ToolBarExtension_background |
356 \deprecated P_ToolBarExtension_background |
400 |
402 |
401 |
403 |
402 \deprecated P_IndicatorGrou\deprecated P_signalicon |
404 \deprecated P_IndicatorGrou\deprecated P_signalicon |
403 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
405 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
404 |
406 |
405 |
407 |
406 \deprecated P_IndicatorGrou\deprecated P_batteryicon |
408 \deprecated P_IndicatorGrou\deprecated P_batteryicon |
407 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
409 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
408 |
410 |
409 |
411 |
410 \deprecated P_SignalIndicator_icon |
412 \deprecated P_SignalIndicator_icon |
411 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
413 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
412 |
414 |
413 |
415 |
414 \deprecated P_SignalLevel_background |
416 \deprecated P_SignalLevel_background |
456 |
458 |
457 |
459 |
458 \deprecated P_ProgressBar_waittrack |
460 \deprecated P_ProgressBar_waittrack |
459 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
461 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
460 |
462 |
461 |
463 |
462 \deprecated P_ProgressBar_mintext |
464 \deprecated P_ProgressBar_mintext |
463 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
465 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
464 |
466 |
465 |
467 |
466 \deprecated P_ProgressBar_maxtext |
468 \deprecated P_ProgressBar_maxtext |
468 |
470 |
469 |
471 |
470 \deprecated P_Softkey_background |
472 \deprecated P_Softkey_background |
471 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
473 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
472 |
474 |
473 |
475 |
474 \deprecated P_NavigationButton_background |
476 \deprecated P_NavigationButton_background |
475 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
477 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
476 |
478 |
477 |
479 |
478 \deprecated P_IndicatorButton_background |
480 \deprecated P_IndicatorButton_background |
484 |
486 |
485 |
487 |
486 \deprecated P_ItemViewItem_frame |
488 \deprecated P_ItemViewItem_frame |
487 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
489 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
488 |
490 |
489 |
491 |
490 \deprecated P_SelectionControl_selectionstart |
492 \deprecated P_SelectionControl_selectionstart |
491 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
493 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
492 |
494 |
493 |
495 |
494 \deprecated P_SelectionControl_selectionend |
496 \deprecated P_SelectionControl_selectionend |
532 |
534 |
533 |
535 |
534 \deprecated P_ProgressSliderHandle_background |
536 \deprecated P_ProgressSliderHandle_background |
535 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
537 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
536 |
538 |
537 |
539 |
538 \deprecated P_ProgressSliderHandle_icon |
540 \deprecated P_ProgressSliderHandle_icon |
539 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
541 is deprecated. HbStyle::Primitive enums are deprecated. Primitives can be accessed by item names using HbWidget::primitive(const QString). |
540 |
542 |
541 |
543 |
542 \deprecated P_ProgressSliderHandle_toucharea |
544 \deprecated P_ProgressSliderHandle_toucharea |
789 static const QString COLOR_STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w_color"); |
791 static const QString COLOR_STYLE_LOCATION = QLatin1String(":/themes/style/hbdefault/rules/widgets/%w/%w_color"); |
790 static const int TOUCHAREA_ZVALUE = 1000; |
792 static const int TOUCHAREA_ZVALUE = 1000; |
791 |
793 |
792 static const QString GLOBAL_PARAMETERS_LOCATION = QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css"); |
794 static const QString GLOBAL_PARAMETERS_LOCATION = QLatin1String(":/themes/style/hbdefault/variables/layout/zoom/0/hbglobalparameters.css"); |
793 |
795 |
796 inline void overrideSpacing( HbAnchorLayout *layout, const QString &name, Hb::Edge edge, qreal val ) |
|
797 { |
|
798 if( name.isNull() ) { |
|
799 return; |
|
800 } |
|
801 QList<HbAnchor*> list = HbAnchorLayoutDebug::getOriginalAnchors( layout ); |
|
802 for( int i = 0; i < list.size(); i++ ) { |
|
803 HbAnchor *anchor = list.at(i); |
|
804 if( ( anchor->mStartId == name ) && ( anchor->mStartEdge == edge ) ) { |
|
805 layout->setAnchor( anchor->mStartId, anchor->mStartEdge, anchor->mEndId, anchor->mEndEdge, val ); |
|
806 } |
|
807 } |
|
808 } |
|
794 |
809 |
795 /*! |
810 /*! |
796 Constructor |
811 Constructor |
797 */ |
812 */ |
798 HbStyle::HbStyle() : |
813 HbStyle::HbStyle() : |
799 d_ptr(new HbStylePrivate) |
814 d_ptr(new HbStylePrivate) |
800 { |
815 { |
801 Q_D( HbStyle ); |
816 Q_D( HbStyle ); |
802 d->q_ptr = this; |
817 d->q_ptr = this; |
803 QObject::connect(hbInstance->theme(), SIGNAL(changed()), this, SLOT(_q_onThemeChanged())); |
|
804 } |
818 } |
805 |
819 |
806 /*! |
820 /*! |
807 Destructor |
821 Destructor |
808 */ |
822 */ |
900 d->nextAvailableId += primitiveCount; |
914 d->nextAvailableId += primitiveCount; |
901 |
915 |
902 // register associated style files |
916 // register associated style files |
903 HbWidgetStyleLoader::instance()->addFilePath( |
917 HbWidgetStyleLoader::instance()->addFilePath( |
904 stylePlugin->layoutPath(), |
918 stylePlugin->layoutPath(), |
905 HbLayeredStyleLoader::Concern_Layouts, |
919 HbLayeredStyleLoader::Concern_Layouts, |
906 HbLayeredStyleLoader::Priority_Core); |
920 HbLayeredStyleLoader::Priority_Core); |
907 d->pluginStylePaths.insert(pluginName, stylePlugin->layoutPath()); |
921 d->pluginStylePaths.insert(pluginName, stylePlugin->layoutPath()); |
908 |
922 |
909 return pluginInfo->primitiveBaseId; |
923 return pluginInfo->primitiveBaseId; |
910 } |
924 } |
939 d->registeredPlugins.remove(pluginName); |
953 d->registeredPlugins.remove(pluginName); |
940 |
954 |
941 // unregister associated style files |
955 // unregister associated style files |
942 HbWidgetStyleLoader::instance()->removeFilePath( |
956 HbWidgetStyleLoader::instance()->removeFilePath( |
943 d->pluginStylePaths.value(pluginName), |
957 d->pluginStylePaths.value(pluginName), |
944 HbLayeredStyleLoader::Concern_Layouts, |
958 HbLayeredStyleLoader::Concern_Layouts, |
945 HbLayeredStyleLoader::Priority_Core); |
959 HbLayeredStyleLoader::Priority_Core); |
946 d->pluginStylePaths.remove(pluginName); |
960 d->pluginStylePaths.remove(pluginName); |
947 |
961 |
948 if( d->registeredPlugins.count() == 0 ){ |
962 if( d->registeredPlugins.count() == 0 ){ |
949 // no plugins loaded, can reset the id counter |
963 // no plugins loaded, can reset the id counter |
955 } |
969 } |
956 |
970 |
957 |
971 |
958 /*! |
972 /*! |
959 |
973 |
960 \deprecated HbStyle::createPrimitive(HbStyle::Primitive, QGraphicsItem*) |
974 \deprecated HbStyle::createPrimitive(HbStyle::Primitive, QGraphicsItem*) |
961 is deprecated. This method will be replaced with an altered version which will use new base primitive enumerations. |
975 is deprecated. This method will be replaced with an altered version which will use new base primitive enumerations. |
962 |
976 |
963 Creates instances of primitive graphics items. This method should be used by all widgets that support styling. |
977 Creates instances of primitive graphics items. This method should be used by all widgets that support styling. |
964 When changing the style the returned primitives can be replaced with an altered version of the primitives, or with a completely |
978 When changing the style the returned primitives can be replaced with an altered version of the primitives, or with a completely |
965 different primitive, to create a custom appearance. This shouldn't cause changes to the widget if the functional design |
979 different primitive, to create a custom appearance. This shouldn't cause changes to the widget if the functional design |
966 remains the same. |
980 remains the same. |
967 |
981 |
1012 case P_ToolButton_icon: |
1026 case P_ToolButton_icon: |
1013 case P_PushButton_icon: |
1027 case P_PushButton_icon: |
1014 case P_ProgressDialog_icon: { |
1028 case P_ProgressDialog_icon: { |
1015 HbIconItem *iconItem = new HbIconItem(HbIcon(),parent); |
1029 HbIconItem *iconItem = new HbIconItem(HbIcon(),parent); |
1016 setItemName(iconItem, QLatin1String("icon")); |
1030 setItemName(iconItem, QLatin1String("icon")); |
1017 return iconItem; |
1031 return iconItem; |
1018 } |
1032 } |
1019 |
1033 |
1020 case P_CheckBox_icon: |
1034 case P_CheckBox_icon: |
1021 case P_GroupBoxHeading_icon: |
1035 case P_GroupBoxHeading_icon: |
1022 case P_Label_icon: |
1036 case P_Label_icon: |
1023 case P_GridViewItem_icon: { |
1037 case P_GridViewItem_icon: { |
1024 HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent)); |
1038 HbIconItem *item = q_check_ptr(new HbIconItem(HbIcon(),parent)); |
1025 setItemName(item, QLatin1String("icon")); |
1039 setItemName(item, QLatin1String("icon")); |
1026 return item; |
1040 return item; |
1027 } |
1041 } |
1028 case P_DataGroup_icon: |
1042 case P_DataGroup_icon: |
1029 { |
1043 { |
1030 HbIconItem *item = new HbIconItem(HbIcon(), parent); |
1044 HbIconItem *item = new HbIconItem(HbIcon(), parent); |
1031 setItemName(item, QLatin1String("dataGroup_Icon")); |
1045 setItemName(item, QLatin1String("dataGroup_Icon")); |
1032 return item; |
1046 return item; |
1033 } |
1047 } |
1034 case P_DataItem_icon: |
1048 case P_DataItem_icon: |
1035 { |
1049 { |
1036 HbIconItem *item = new HbIconItem(HbIcon(), parent); |
1050 HbIconItem *item = new HbIconItem(HbIcon(), parent); |
1037 setItemName(item, QLatin1String("dataItem_Icon")); |
1051 setItemName(item, QLatin1String("dataItem_Icon")); |
1038 return item; |
1052 return item; |
1039 } |
1053 } |
1040 case P_ComboBox_text: |
1054 case P_ComboBox_text: |
1041 { |
1055 { |
1042 HbTextItem *textItem = new HbTextItem(parent); |
1056 HbTextItem *textItem = new HbTextItem(parent); |
1043 setItemName(textItem, QLatin1String("combobox_labelfield")); |
1057 setItemName(textItem, QLatin1String("combobox_labelfield")); |
1094 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
1108 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
1095 setItemName(ta, QLatin1String("toucharea")); |
1109 setItemName(ta, QLatin1String("toucharea")); |
1096 ta->setZValue(TOUCHAREA_ZVALUE); |
1110 ta->setZValue(TOUCHAREA_ZVALUE); |
1097 return ta; |
1111 return ta; |
1098 } |
1112 } |
1099 case P_ProgressSliderHandle_toucharea: |
1113 case P_ProgressSliderHandle_toucharea: |
1100 { |
1114 { |
1101 HbTouchArea *ta = new HbTouchArea(parent); |
1115 HbTouchArea *ta = new HbTouchArea(parent); |
1102 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
1116 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
1103 setItemName(ta, QLatin1String("toucharea")); |
1117 setItemName(ta, QLatin1String("toucharea")); |
1104 ta->setZValue(TOUCHAREA_ZVALUE); |
1118 ta->setZValue(TOUCHAREA_ZVALUE); |
1105 if(parent){ |
1119 if(parent){ |
1106 parent->setHandlesChildEvents(true); |
1120 parent->setHandlesChildEvents(true); |
1107 } |
1121 } |
1108 return ta; |
1122 return ta; |
1109 } |
1123 } |
1110 |
1124 |
1111 case P_ProgressSliderHandle_icon: |
1125 case P_ProgressSliderHandle_icon: |
1115 return item; |
1129 return item; |
1116 } |
1130 } |
1117 case P_PushButton_toucharea: // Generic implementation, can add other cases here |
1131 case P_PushButton_toucharea: // Generic implementation, can add other cases here |
1118 case P_CheckBox_toucharea: |
1132 case P_CheckBox_toucharea: |
1119 case P_RatingSlider_toucharea: |
1133 case P_RatingSlider_toucharea: |
1120 case P_SliderElement_touchhandle: |
1134 case P_SliderElement_touchhandle: |
1121 { |
1135 { |
1122 HbTouchArea *ta = new HbTouchArea(parent); |
1136 HbTouchArea *ta = new HbTouchArea(parent); |
1123 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
1137 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
1124 setItemName(ta, QLatin1String("toucharea")); |
1138 setItemName(ta, QLatin1String("toucharea")); |
1125 if(parent){ |
1139 if(parent){ |
1126 parent->setHandlesChildEvents(true); |
1140 parent->setHandlesChildEvents(true); |
1127 } |
1141 } |
1128 return ta; |
1142 return ta; |
1129 } |
1143 } |
1130 case P_ScrollBar_toucharea: |
1144 case P_ScrollBar_toucharea: |
1131 { |
1145 { |
1132 HbTouchArea *ta = new HbTouchArea(parent); |
1146 HbTouchArea *ta = new HbTouchArea(parent); |
1133 ta->setFlags(QGraphicsItem::ItemIsFocusable); |
1147 ta->setFlags(QGraphicsItem::ItemIsFocusable); |
1134 setItemName(ta, QLatin1String("toucharea")); |
1148 setItemName(ta, QLatin1String("toucharea")); |
1135 // NOTE:: This is a temporary fix |
1149 // NOTE:: This is a temporary fix |
1136 //if(parent){ |
1150 //if(parent){ |
1137 // parent->setHandlesChildEvents(true); |
1151 // parent->setHandlesChildEvents(true); |
1138 //} |
1152 //} |
1139 return ta; |
1153 return ta; |
1140 } |
1154 } |
1141 case P_ComboBoxButton_toucharea: |
1155 case P_ComboBoxButton_toucharea: |
1142 { |
1156 { |
1143 HbTouchArea *ta = new HbTouchArea(parent); |
1157 HbTouchArea *ta = new HbTouchArea(parent); |
1144 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
1158 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
1145 setItemName(ta, QLatin1String("combobox_button_toucharea")); |
1159 setItemName(ta, QLatin1String("combobox_button_toucharea")); |
1146 /*if(parent){ |
1160 /*if(parent){ |
1147 parent->setHandlesChildEvents(true); |
1161 parent->setHandlesChildEvents(true); |
1148 }*/ |
1162 }*/ |
1149 return ta; |
1163 return ta; |
1150 } |
1164 } |
1151 case P_TitleBar_toucharea: { |
1165 case P_TitleBar_toucharea: { |
1152 HbTouchArea *ta = new HbTouchArea(parent); |
1166 HbTouchArea *ta = new HbTouchArea(parent); |
1159 case P_SliderElement_touchgroove: |
1173 case P_SliderElement_touchgroove: |
1160 { |
1174 { |
1161 HbTouchArea *ta = new HbTouchArea(parent); |
1175 HbTouchArea *ta = new HbTouchArea(parent); |
1162 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
1176 ta->setFlag(QGraphicsItem::ItemIsFocusable); |
1163 if(parent){ |
1177 if(parent){ |
1164 //parent->setHandlesChildEvents(true); |
1178 //parent->setHandlesChildEvents(true); |
1165 } |
1179 } |
1166 return ta; |
1180 return ta; |
1167 } |
1181 } |
1168 case P_SliderElement_text: |
1182 case P_SliderElement_text: |
1169 case P_ProgressBar_text: |
1183 case P_ProgressBar_text: |
1199 HbTextItem *ti = new HbTextItem(parent); |
1213 HbTextItem *ti = new HbTextItem(parent); |
1200 setItemName(ti, QLatin1String("text")); |
1214 setItemName(ti, QLatin1String("text")); |
1201 ti->setAlignment(Qt::AlignCenter); |
1215 ti->setAlignment(Qt::AlignCenter); |
1202 return ti; |
1216 return ti; |
1203 } |
1217 } |
1204 |
1218 |
1205 case P_Label_richtext: |
1219 case P_Label_richtext: |
1206 { |
1220 { |
1207 HbRichTextItem *rti = new HbRichTextItem(parent); |
1221 HbRichTextItem *rti = new HbRichTextItem(parent); |
1208 setItemName(rti, QLatin1String("text")); |
1222 setItemName(rti, QLatin1String("text")); |
1209 return rti; |
1223 return rti; |
1210 } |
1224 } |
1242 |
1256 |
1243 case P_ProgressBar_frame: |
1257 case P_ProgressBar_frame: |
1244 { |
1258 { |
1245 HbFrameItem *n = new HbFrameItem(parent); |
1259 HbFrameItem *n = new HbFrameItem(parent); |
1246 n->setZValue(-1); |
1260 n->setZValue(-1); |
1261 n->frameDrawer().setFillWholeRect(true); |
|
1247 setItemName(n, "frame"); |
1262 setItemName(n, "frame"); |
1248 return n; |
1263 return n; |
1249 } |
1264 } |
1250 |
1265 |
1251 case P_ComboBoxPopup_background: |
1266 case P_ComboBoxPopup_background: |
1271 } |
1286 } |
1272 |
1287 |
1273 case P_DateTimePicker_separator:{ |
1288 case P_DateTimePicker_separator:{ |
1274 HbFrameItem *frameItem= new HbFrameItem(parent);//TODO:make it icon once iconitem setGeomoetry works for tumbleview |
1289 HbFrameItem *frameItem= new HbFrameItem(parent);//TODO:make it icon once iconitem setGeomoetry works for tumbleview |
1275 return frameItem; |
1290 return frameItem; |
1276 } |
1291 } |
1277 case P_DataGroup_background : |
1292 case P_DataGroup_background : |
1278 { |
1293 { |
1279 HbFrameItem *n = new HbFrameItem(parent); |
1294 HbFrameItem *n = new HbFrameItem(parent); |
1280 n->setZValue(-1); |
1295 n->setZValue(-1); |
1281 setItemName(n, QLatin1String("dataGroup_Background")); |
1296 setItemName(n, QLatin1String("dataGroup_Background")); |
1312 return n; |
1327 return n; |
1313 } |
1328 } |
1314 case P_ProgressBar_track: |
1329 case P_ProgressBar_track: |
1315 { |
1330 { |
1316 HbProgressTrackItem *n = new HbProgressTrackItem(parent); |
1331 HbProgressTrackItem *n = new HbProgressTrackItem(parent); |
1332 n->frameDrawer().setFillWholeRect(true); |
|
1317 n->setZValue(-2); |
1333 n->setZValue(-2); |
1318 return n; |
1334 return n; |
1319 } |
1335 } |
1320 case P_ProgressSlider_slidertrack: |
1336 case P_ProgressSlider_slidertrack: |
1321 { |
1337 { |
1346 } |
1362 } |
1347 case P_IndicatorButton_handleindication: |
1363 case P_IndicatorButton_handleindication: |
1348 { |
1364 { |
1349 HbIconItem *n = new HbIconItem(parent); |
1365 HbIconItem *n = new HbIconItem(parent); |
1350 setItemName(n, QLatin1String("handleindication")); |
1366 setItemName(n, QLatin1String("handleindication")); |
1367 return n; |
|
1368 } |
|
1369 case P_IndicatorButton_eventindication: |
|
1370 { |
|
1371 HbIconItem *n = new HbIconItem(parent); |
|
1372 n->setFlags(HbIcon::Colorized); |
|
1373 setItemName(n, QLatin1String("eventindication")); |
|
1351 return n; |
1374 return n; |
1352 } |
1375 } |
1353 case P_IndicatorGroup_icon1: |
1376 case P_IndicatorGroup_icon1: |
1354 { |
1377 { |
1355 HbIconItem *n = new HbIconItem(parent); |
1378 HbIconItem *n = new HbIconItem(parent); |
1431 case P_TextEdit_frame_highlight: |
1454 case P_TextEdit_frame_highlight: |
1432 { |
1455 { |
1433 HbFrameItem *n = new HbFrameItem(parent); |
1456 HbFrameItem *n = new HbFrameItem(parent); |
1434 n->setZValue(-1); |
1457 n->setZValue(-1); |
1435 return n; |
1458 return n; |
1436 } |
1459 } |
1437 case P_GroupBoxMarquee_text: |
1460 case P_GroupBoxMarquee_text: |
1438 case P_TitlePane_text: |
1461 case P_TitlePane_text: |
1439 { |
1462 { |
1440 HbMarqueeItem *n = new HbMarqueeItem(parent); |
1463 HbMarqueeItem *n = new HbMarqueeItem(parent); |
1441 setItemName(n, QLatin1String("text")); |
1464 setItemName(n, QLatin1String("text")); |
1496 case P_RatingSlider_frame: |
1519 case P_RatingSlider_frame: |
1497 return new HbRepeatItem(parent); |
1520 return new HbRepeatItem(parent); |
1498 |
1521 |
1499 case P_RatingSlider_track: |
1522 case P_RatingSlider_track: |
1500 return new HbRepeatMaskItem(parent); |
1523 return new HbRepeatMaskItem(parent); |
1501 |
1524 |
1502 case P_RatingSlider_layout: { |
1525 case P_RatingSlider_layout: { |
1503 HbWidgetBase *layout = new HbWidgetBase(parent); |
1526 HbWidgetBase *layout = new HbWidgetBase(parent); |
1504 setItemName(layout, "frame"); |
1527 setItemName(layout, "frame"); |
1505 return layout; |
1528 return layout; |
1506 } |
1529 } |
1616 case P_ItemViewItem_focus: { |
1639 case P_ItemViewItem_focus: { |
1617 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent)); |
1640 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent)); |
1618 //setItemName(item, QLatin1String("focus-indicator")); |
1641 //setItemName(item, QLatin1String("focus-indicator")); |
1619 return item; |
1642 return item; |
1620 } |
1643 } |
1621 case P_ItemHighlight_background: |
1644 case P_ItemHighlight_background: |
1622 return new HbFrameItem(parent); |
1645 return new HbFrameItem(parent); |
1623 |
1646 |
1624 case P_ItemViewItem_frame: { |
1647 case P_ItemViewItem_frame: { |
1625 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent)); |
1648 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent)); |
1626 setItemName(item,"frame"); |
1649 setItemName(item,"frame"); |
1704 |
1727 |
1705 \deprecated HbStyle::updatePrimitive(QGraphicsItem*, HbStyle::Primitive, const QStyleOption*) |
1728 \deprecated HbStyle::updatePrimitive(QGraphicsItem*, HbStyle::Primitive, const QStyleOption*) |
1706 is deprecated. This method will be made private and finally removed since primitive updating will be done in the widgets. |
1729 is deprecated. This method will be made private and finally removed since primitive updating will be done in the widgets. |
1707 |
1730 |
1708 Updates the state and content of widget's child primitives. Update for a styled primitive should happen always when |
1731 Updates the state and content of widget's child primitives. Update for a styled primitive should happen always when |
1709 a state change that affects drawing occurs. Such a situation can be for example pressing of a button (change background image), or |
1732 a state change that affects drawing occurs. Such a situation can be for example pressing of a button (change background image), or |
1710 changing a text for a widget having text content. The updatePrimitive() implementation for each primitive element can be considered |
1733 changing a text for a widget having text content. The updatePrimitive() implementation for each primitive element can be considered |
1711 as a part of widget's implementation. Note that it's up to the widget to decide what the styleoption contains and what the updatePrimitive() method |
1734 as a part of widget's implementation. Note that it's up to the widget to decide what the styleoption contains and what the updatePrimitive() method |
1712 uses the styleoption data for. |
1735 uses the styleoption data for. |
1713 |
1736 |
1714 \sa HbStyle::createPrimitive |
1737 \sa HbStyle::createPrimitive |
1715 \param item Primitive graphicsitem. |
1738 \param item Primitive graphicsitem. |
1716 \param primitive To identify the primitive to create. |
1739 \param primitive To identify the primitive to create. |
1717 \param option Style option, contains all the information needed to update the primitive, this |
1740 \param option Style option, contains all the information needed to update the primitive, this |
1718 information is widget specific and each widget usually has a styleoption. Styleoption may include |
1741 information is widget specific and each widget usually has a styleoption. Styleoption may include |
1730 } |
1753 } |
1731 |
1754 |
1732 switch(primitive){ |
1755 switch(primitive){ |
1733 case P_PushButton_icon: |
1756 case P_PushButton_icon: |
1734 { |
1757 { |
1735 if (const HbStyleOptionPushButton *opt = |
1758 if (const HbStyleOptionPushButton *opt = |
1736 qstyleoption_cast<const HbStyleOptionPushButton*>(option)) { |
1759 qstyleoption_cast<const HbStyleOptionPushButton*>(option)) { |
1737 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1760 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1738 //iconItem->setIconName(opt->icon.iconName()); |
1761 //iconItem->setIconName(opt->icon.iconName()); |
1739 iconItem->setIcon(opt->icon); // with this call iconitem refresh issue is there |
1762 iconItem->setIcon(opt->icon); // with this call iconitem refresh issue is there |
1740 iconItem->setMode(d->iconMode(opt->state)); |
1763 iconItem->setMode(d->iconMode(opt->state)); |
1741 iconItem->setState(d->iconState(opt->state)); |
1764 iconItem->setState(d->iconState(opt->state)); |
1765 iconItem->setAlignment(Qt::AlignCenter); |
|
1742 } |
1766 } |
1743 break; |
1767 break; |
1744 } |
1768 } |
1745 case P_GroupBoxHeading_icon: |
1769 case P_GroupBoxHeading_icon: |
1746 { |
1770 { |
1747 if (const HbStyleOptionGroupBox *opt = |
1771 if (const HbStyleOptionGroupBox *opt = |
1748 qstyleoption_cast<const HbStyleOptionGroupBox*>(option)) { |
1772 qstyleoption_cast<const HbStyleOptionGroupBox*>(option)) { |
1749 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1773 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1750 if (opt->collapsed) { |
1774 if (opt->collapsed) { |
1751 iconItem->setIconName(QLatin1String("qtg_small_expand")); |
1775 iconItem->setIconName(QLatin1String("qtg_small_expand")); |
1752 } else { |
1776 } else { |
1755 } |
1779 } |
1756 break; |
1780 break; |
1757 } |
1781 } |
1758 case P_DataGroup_icon: |
1782 case P_DataGroup_icon: |
1759 { |
1783 { |
1760 if (const HbStyleOptionDataGroupHeadingWidget *opt = |
1784 if (const HbStyleOptionDataGroupHeadingWidget *opt = |
1761 qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget*>(option)) { |
1785 qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget*>(option)) { |
1762 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1786 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1763 if (opt->expanded) { |
1787 if (opt->expanded) { |
1764 iconItem->setIconName(QLatin1String("qtg_small_collapse")); |
1788 iconItem->setIconName(QLatin1String("qtg_small_collapse")); |
1765 } else { |
1789 } else { |
1797 break; |
1821 break; |
1798 case P_ComboBox_text: |
1822 case P_ComboBox_text: |
1799 if (const HbStyleOptionComboBox *opt = qstyleoption_cast<const HbStyleOptionComboBox*>(option)) { |
1823 if (const HbStyleOptionComboBox *opt = qstyleoption_cast<const HbStyleOptionComboBox*>(option)) { |
1800 HbTextItem *comboTextItem = static_cast<HbTextItem*>(item); |
1824 HbTextItem *comboTextItem = static_cast<HbTextItem*>(item); |
1801 comboTextItem->setText(opt->text); |
1825 comboTextItem->setText(opt->text); |
1802 } |
1826 comboTextItem->setTextWrapping(Hb::TextNoWrap); |
1803 break; |
1827 } |
1828 break; |
|
1804 case P_PushButton_text: |
1829 case P_PushButton_text: |
1805 { |
1830 { |
1806 if (const HbStyleOptionPushButton *opt = |
1831 if (const HbStyleOptionPushButton *opt = |
1807 qstyleoption_cast<const HbStyleOptionPushButton*>(option)) { |
1832 qstyleoption_cast<const HbStyleOptionPushButton*>(option)) { |
1808 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1833 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1809 textItem->setText(opt->text); |
1834 textItem->setText(opt->text); |
1810 //default alignment will come from css, |
1835 //default alignment will come from css, |
1811 //if api flag is set ,then alignment from style is taken. |
1836 //if api flag is set ,then alignment from style is taken. |
1812 if (opt->hasTextAlignment) { |
1837 if (opt->hasTextAlignment) { |
1813 textItem->setAlignment( opt->textAlignment ); |
1838 textItem->setAlignment( opt->textAlignment ); |
1814 } |
1839 } |
1815 textItem->setTextWrapping(Hb::TextWordWrap); |
1840 textItem->setTextWrapping(Hb::TextWordWrap); |
1816 } |
1841 } |
1817 } |
1842 } |
1818 break; |
1843 break; |
1819 case P_ProgressDialog_text: |
1844 case P_ProgressDialog_text: |
1820 { |
1845 { |
1821 if (const HbStyleOptionProgressDialog *opt = |
1846 if (const HbStyleOptionProgressDialog *opt = |
1822 qstyleoption_cast<const HbStyleOptionProgressDialog*>(option)) { |
1847 qstyleoption_cast<const HbStyleOptionProgressDialog*>(option)) { |
1823 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1848 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1824 textItem->setText(opt->text); |
1849 textItem->setText(opt->text); |
1825 } |
1850 } |
1826 break; |
1851 break; |
1827 } |
1852 } |
1828 case P_PushButton_additionaltext: |
1853 case P_PushButton_additionaltext: |
1829 { |
1854 { |
1830 if (const HbStyleOptionPushButton *opt = |
1855 if (const HbStyleOptionPushButton *opt = |
1831 qstyleoption_cast<const HbStyleOptionPushButton*>(option)) { |
1856 qstyleoption_cast<const HbStyleOptionPushButton*>(option)) { |
1832 HbTextItem *additionalTextItem = static_cast<HbTextItem*>(item); |
1857 HbTextItem *additionalTextItem = static_cast<HbTextItem*>(item); |
1833 additionalTextItem->setText(opt->additionalText); |
1858 additionalTextItem->setText(opt->additionalText); |
1834 //default alignment will come from css, |
1859 //default alignment will come from css, |
1835 //if api flag is set ,then alignment from style is taken. |
1860 //if api flag is set ,then alignment from style is taken. |
1836 if (opt->hasAdditionalTextAlignment) { |
1861 if (opt->hasAdditionalTextAlignment) { |
1837 additionalTextItem->setAlignment( opt->additionalTextAlignment ); |
1862 additionalTextItem->setAlignment( opt->additionalTextAlignment ); |
1838 } |
1863 } |
1839 additionalTextItem->setTextWrapping(Hb::TextWordWrap); |
1864 additionalTextItem->setTextWrapping(Hb::TextWordWrap); |
1840 } |
1865 } |
1841 } |
1866 } |
1842 break; |
1867 break; |
1843 case P_PushButton_toucharea: // Generic implementation, can add other cases here |
1868 case P_PushButton_toucharea: // Generic implementation, can add other cases here |
1844 case P_ComboBoxButton_toucharea: |
1869 case P_ComboBoxButton_toucharea: |
1845 case P_CheckBox_toucharea: |
1870 case P_CheckBox_toucharea: |
1854 touchArea->setZValue(TOUCHAREA_ZVALUE); |
1879 touchArea->setZValue(TOUCHAREA_ZVALUE); |
1855 } |
1880 } |
1856 break; |
1881 break; |
1857 case P_DataGroup_heading: |
1882 case P_DataGroup_heading: |
1858 { |
1883 { |
1859 if (const HbStyleOptionDataGroupHeadingWidget *opt = |
1884 if (const HbStyleOptionDataGroupHeadingWidget *opt = |
1860 qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget*>(option)) { |
1885 qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget*>(option)) { |
1861 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1886 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1862 textItem->setText(opt->heading); |
1887 textItem->setText(opt->heading); |
1888 textItem->setTextWrapping(Hb::TextNoWrap); |
|
1863 } |
1889 } |
1864 break; |
1890 break; |
1865 } |
1891 } |
1866 case P_DataGroup_description: |
1892 case P_DataGroup_description: |
1867 { |
1893 { |
1868 if (const HbStyleOptionDataGroupHeadingWidget *opt = |
1894 if (const HbStyleOptionDataGroupHeadingWidget *opt = |
1869 qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget*>(option)) { |
1895 qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget*>(option)) { |
1870 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1896 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1871 textItem->setText(opt->description); |
1897 textItem->setText(opt->description); |
1872 } |
1898 } |
1873 break; |
1899 break; |
1874 } |
1900 } |
1875 case P_DataForm_heading: |
1901 case P_DataForm_heading: |
1876 { |
1902 { |
1877 if (const HbStyleOptionDataForm *opt = |
1903 if (const HbStyleOptionDataForm *opt = |
1878 qstyleoption_cast<const HbStyleOptionDataForm*>(option)) { |
1904 qstyleoption_cast<const HbStyleOptionDataForm*>(option)) { |
1879 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1905 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1880 textItem->setText(opt->heading); |
1906 textItem->setText(opt->heading); |
1881 } |
1907 } |
1882 break; |
1908 break; |
1883 } |
1909 } |
1884 case P_DataForm_description: |
1910 case P_DataForm_description: |
1885 { |
1911 { |
1886 if (const HbStyleOptionDataForm *opt = |
1912 if (const HbStyleOptionDataForm *opt = |
1887 qstyleoption_cast<const HbStyleOptionDataForm*>(option)) { |
1913 qstyleoption_cast<const HbStyleOptionDataForm*>(option)) { |
1888 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1914 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1889 HbFontSpec spec(HbFontSpec::Secondary); |
1915 HbFontSpec spec(HbFontSpec::Secondary); |
1890 QFont descriptionFont = spec.font(); |
1916 QFont descriptionFont = spec.font(); |
1891 descriptionFont.setItalic(true); |
1917 descriptionFont.setItalic(true); |
1909 if (const HbStyleOptionToolButton *opt = qstyleoption_cast<const HbStyleOptionToolButton*>(option)) { |
1935 if (const HbStyleOptionToolButton *opt = qstyleoption_cast<const HbStyleOptionToolButton*>(option)) { |
1910 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1936 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1911 textItem->setText(opt->text); |
1937 textItem->setText(opt->text); |
1912 } |
1938 } |
1913 break; |
1939 break; |
1914 case P_ProgressBar_text: { |
1940 case P_ProgressBar_text: { |
1915 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) { |
1941 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) { |
1916 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1942 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
1917 textItem->setAlignment(Qt::AlignCenter); |
1943 textItem->setAlignment(Qt::AlignCenter); |
1918 textItem->setZValue(100); |
1944 textItem->setZValue(100); |
1919 textItem->setText(opt->text); |
1945 textItem->setText(opt->text); |
1920 } |
1946 } |
1921 break; |
1947 break; |
1922 } |
1948 } |
1923 case P_DataGroup_background: { |
1949 case P_DataGroup_background: { |
1924 if (const HbStyleOptionDataGroupHeadingWidget *opt = |
1950 if (const HbStyleOptionDataGroupHeadingWidget *opt = |
1925 qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget *>(option)) { |
1951 qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget *>(option)) { |
1926 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
1952 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
1927 if(!frameItem){ |
1953 if(!frameItem){ |
1928 return; |
1954 return; |
1929 } |
1955 } |
1956 QString frameGraphicsName; |
|
1957 QIcon::Mode mode = QIcon::Disabled; |
|
1958 if (opt->state & QStyle::State_Enabled) { |
|
1959 mode = QIcon::Normal; |
|
1960 } |
|
1961 if (opt->state & QStyle::State_Active) { |
|
1962 mode = QIcon::Active; |
|
1963 } |
|
1964 if (opt->state & QStyle::State_Selected) { |
|
1965 mode = QIcon::Selected; |
|
1966 } |
|
1930 frameItem->setZValue(-1.0); |
1967 frameItem->setZValue(-1.0); |
1931 if(opt->pressed) { |
1968 if(mode == QIcon::Disabled) { |
1969 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_disabled")); |
|
1970 } |
|
1971 else if(opt->pressed ) { |
|
1932 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_pressed")); |
1972 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_pressed")); |
1933 } else { |
1973 } else { |
1934 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_parent_normal")); |
1974 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_parent_normal")); |
1935 } |
1975 } |
1936 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
1976 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
1937 frameItem->setGeometry(opt->rect); |
1977 frameItem->setGeometry(opt->rect); |
1938 } |
1978 } |
1939 break; |
1979 break; |
1940 } |
1980 } |
1941 case P_DataGroupComboBackground: { |
1981 case P_DataGroupComboBackground: { |
1942 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
1982 if (const HbStyleOptionDataGroup *opt = qstyleoption_cast<const HbStyleOptionDataGroup *>(option)) { |
1943 if(!frameItem){ |
1983 QString frameGraphicsName; |
1944 return; |
1984 QIcon::Mode mode = QIcon::Disabled; |
1945 } |
1985 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
1946 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_parent_normal")); |
1986 if(!frameItem){ |
1947 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
1987 return; |
1988 } |
|
1989 if (opt->state & QStyle::State_Enabled) { |
|
1990 mode = QIcon::Normal; |
|
1991 } |
|
1992 if (opt->state & QStyle::State_Active) { |
|
1993 mode = QIcon::Active; |
|
1994 } |
|
1995 if (opt->state & QStyle::State_Selected) { |
|
1996 mode = QIcon::Selected; |
|
1997 } |
|
1998 if (mode == QIcon::Disabled ) { |
|
1999 frameGraphicsName = QLatin1String("qtg_fr_list_disabled"); |
|
2000 } else { |
|
2001 frameGraphicsName = QLatin1String("qtg_fr_list_parent_normal"); |
|
2002 } |
|
2003 frameItem->frameDrawer().setFrameGraphicsName(frameGraphicsName); |
|
2004 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
2005 } |
|
1948 break; |
2006 break; |
1949 } |
2007 } |
1950 |
2008 |
1951 case P_GroupBoxHeading_background: { |
2009 case P_GroupBoxHeading_background: { |
1952 if (const HbStyleOptionGroupBox *opt = qstyleoption_cast<const HbStyleOptionGroupBox *>(option)) { |
2010 if (const HbStyleOptionGroupBox *opt = qstyleoption_cast<const HbStyleOptionGroupBox *>(option)) { |
1953 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
2011 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
1954 |
2012 |
1955 if(!frameItem){ |
2013 if(!frameItem){ |
1956 return; |
2014 return; |
1957 } |
2015 } |
1958 QString frameGraphicsName; |
2016 QString frameGraphicsName; |
1959 if(opt->groupBoxType == HbStyleOptionGroupBox::GroupBoxSimpleLabel) |
2017 if(opt->groupBoxType == HbStyleOptionGroupBox::GroupBoxSimpleLabel) |
1965 frameGraphicsName = QLatin1String("qtg_fr_list_parent_normal"); |
2023 frameGraphicsName = QLatin1String("qtg_fr_list_parent_normal"); |
1966 } else { |
2024 } else { |
1967 frameGraphicsName = QLatin1String("qtg_fr_list_highlight"); |
2025 frameGraphicsName = QLatin1String("qtg_fr_list_highlight"); |
1968 } |
2026 } |
1969 } |
2027 } |
1970 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
2028 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
1971 frameItem->frameDrawer().setFrameGraphicsName(frameGraphicsName); |
2029 frameItem->frameDrawer().setFrameGraphicsName(frameGraphicsName); |
1972 } |
2030 } |
1973 break; |
2031 break; |
1974 } |
2032 } |
1975 |
2033 |
1976 case P_GroupBoxContent_background: { |
2034 case P_GroupBoxContent_background: { |
1977 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) { |
2035 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption *>(option)) { |
1978 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
2036 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
1979 |
2037 |
1980 if(!frameItem){ |
2038 if(!frameItem){ |
1981 return; |
2039 return; |
1982 } |
2040 } |
1983 |
2041 |
1984 QString frameGraphicsName; |
2042 QString frameGraphicsName; |
1987 } else if (opt->state == QStyle::State_Off) { |
2045 } else if (opt->state == QStyle::State_Off) { |
1988 frameGraphicsName = QLatin1String("qtg_fr_groupbox_normal"); |
2046 frameGraphicsName = QLatin1String("qtg_fr_groupbox_normal"); |
1989 } else { |
2047 } else { |
1990 frameGraphicsName = QLatin1String("qtg_fr_groupbox_highlight"); |
2048 frameGraphicsName = QLatin1String("qtg_fr_groupbox_highlight"); |
1991 } |
2049 } |
1992 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
2050 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
1993 frameItem->frameDrawer().setFrameGraphicsName(frameGraphicsName); |
2051 frameItem->frameDrawer().setFrameGraphicsName(frameGraphicsName); |
1994 } |
2052 } |
1995 break; |
2053 break; |
1996 } |
2054 } |
1997 |
2055 |
1998 case P_DataItem_background: { |
2056 case P_DataItem_background: { |
1999 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
2057 if (const HbStyleOptionDataFormViewItem *opt = qstyleoption_cast<const HbStyleOptionDataFormViewItem *>(option)) { |
2000 if(!frameItem){ |
2058 QString frameGraphicsName; |
2001 return; |
2059 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
2002 } |
2060 if(!frameItem){ |
2003 |
2061 return; |
2004 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_normal")); |
2062 } |
2005 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
2063 QIcon::Mode mode = QIcon::Disabled; |
2064 if (opt->state & QStyle::State_Enabled) { |
|
2065 mode = QIcon::Normal; |
|
2066 } |
|
2067 if (opt->state & QStyle::State_Active) { |
|
2068 mode = QIcon::Active; |
|
2069 } |
|
2070 if (opt->state & QStyle::State_Selected) { |
|
2071 mode = QIcon::Selected; |
|
2072 } |
|
2073 if (mode == QIcon::Disabled ) { |
|
2074 frameGraphicsName = QLatin1String("qtg_fr_list_disabled"); |
|
2075 } else { |
|
2076 frameGraphicsName = QLatin1String("qtg_fr_list_parent_normal"); |
|
2077 } |
|
2078 frameItem->frameDrawer().setFrameGraphicsName(frameGraphicsName); |
|
2079 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
|
2080 } |
|
2006 break; |
2081 break; |
2007 } |
2082 } |
2008 case P_DataItem_label: { |
2083 case P_DataItem_label: { |
2009 if (const HbStyleOptionDataFormViewItem *opt = qstyleoption_cast<const HbStyleOptionDataFormViewItem *>(option)) { |
2084 if (const HbStyleOptionDataFormViewItem *opt = qstyleoption_cast<const HbStyleOptionDataFormViewItem *>(option)) { |
2010 HbTextItem *textitem = static_cast<HbTextItem*>( item ); |
2085 HbTextItem *textitem = static_cast<HbTextItem*>( item ); |
2011 textitem->setText(opt->label); |
2086 textitem->setText(opt->label); |
2087 textitem->setTextWrapping(Hb::TextNoWrap); |
|
2012 } |
2088 } |
2013 break; |
2089 break; |
2014 } |
2090 } |
2015 case P_DataItem_description: { |
2091 case P_DataItem_description: { |
2016 if (const HbStyleOptionDataFormViewItem *opt = qstyleoption_cast<const HbStyleOptionDataFormViewItem *>(option)) { |
2092 if (const HbStyleOptionDataFormViewItem *opt = qstyleoption_cast<const HbStyleOptionDataFormViewItem *>(option)) { |
2018 textitem->setText(opt->description); |
2094 textitem->setText(opt->description); |
2019 } |
2095 } |
2020 break; |
2096 break; |
2021 } |
2097 } |
2022 case P_PushButton_background: { |
2098 case P_PushButton_background: { |
2023 if (const HbStyleOptionPushButton *opt = |
2099 if (const HbStyleOptionPushButton *opt = |
2024 qstyleoption_cast<const HbStyleOptionPushButton *>(option)) { |
2100 qstyleoption_cast<const HbStyleOptionPushButton *>(option)) { |
2025 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
2101 HbFrameItem *frameItem = static_cast<HbFrameItem*>( item ); |
2026 QString frameGraphicsName; |
2102 QString frameGraphicsName; |
2027 QIcon::Mode mode = QIcon::Disabled; |
2103 QIcon::Mode mode = QIcon::Disabled; |
2028 QIcon::State state = QIcon::Off; |
2104 QIcon::State state = QIcon::Off; |
2109 } |
2185 } |
2110 } |
2186 } |
2111 break; |
2187 break; |
2112 } |
2188 } |
2113 case P_StatusBar_timetext: { |
2189 case P_StatusBar_timetext: { |
2114 if (const HbStyleOptionStatusBar *opt = |
2190 if (const HbStyleOptionStatusBar *opt = |
2115 qstyleoption_cast<const HbStyleOptionStatusBar*>(option)) { |
2191 qstyleoption_cast<const HbStyleOptionStatusBar*>(option)) { |
2116 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
2192 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
2117 textItem->setText(opt->timeText); |
2193 textItem->setText(opt->timeText); |
2118 } |
2194 } |
2119 break; |
2195 break; |
2120 } |
2196 } |
2121 |
2197 |
2122 case P_IndicatorGroup_icon1: |
2198 case P_IndicatorGroup_icon1: |
2123 case P_IndicatorGroup_icon2: |
2199 case P_IndicatorGroup_icon2: |
2124 case P_IndicatorGroup_icon3: |
2200 case P_IndicatorGroup_icon3: |
2125 case P_IndicatorGroup_icon4: |
2201 case P_IndicatorGroup_icon4: |
2126 { |
2202 { |
2127 const HbStyleOptionIndicatorGroup *opt = qstyleoption_cast<const HbStyleOptionIndicatorGroup *>(option); |
2203 const HbStyleOptionIndicatorGroup *opt = qstyleoption_cast<const HbStyleOptionIndicatorGroup *>(option); |
2128 if (opt) { |
2204 if (opt) { |
2129 HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item); |
2205 HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item); |
2130 iconItem->setIconName(opt->iconName); |
2206 iconItem->setIconName(opt->iconName); |
2131 } |
2207 } |
2132 break; |
2208 break; |
2133 } |
2209 } |
2134 |
2210 |
2135 case P_IndicatorButton_handleindication: { |
2211 case P_IndicatorButton_handleindication: { |
2136 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option); |
2212 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option); |
2137 if (opt) { |
2213 if (opt) { |
2138 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2214 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2139 iconItem->setIconName("qtg_graf_titlebar_minimize"); |
2215 iconItem->setIconName("qtg_graf_titlebar_minimize"); |
2216 } |
|
2217 break; |
|
2218 } |
|
2219 |
|
2220 case P_IndicatorButton_eventindication: { |
|
2221 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option); |
|
2222 if (opt) { |
|
2223 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
|
2224 if (opt->twoIcons) { |
|
2225 iconItem->setIconName("qtg_mono_new_event"); |
|
2226 iconItem->setVisible(true); |
|
2227 } else { |
|
2228 iconItem->setVisible(false); |
|
2229 } |
|
2140 } |
2230 } |
2141 break; |
2231 break; |
2142 } |
2232 } |
2143 |
2233 |
2144 case P_SignalIndicator_icon: { |
2234 case P_SignalIndicator_icon: { |
2349 } |
2439 } |
2350 } |
2440 } |
2351 break; |
2441 break; |
2352 } |
2442 } |
2353 case P_PushButton_focus: { |
2443 case P_PushButton_focus: { |
2354 if (const HbStyleOptionPushButton *opt = |
2444 if (const HbStyleOptionPushButton *opt = |
2355 qstyleoption_cast<const HbStyleOptionPushButton *>(option)) { |
2445 qstyleoption_cast<const HbStyleOptionPushButton *>(option)) { |
2356 HbFrameItem *iconItem = static_cast<HbFrameItem*>(item); |
2446 HbFrameItem *iconItem = static_cast<HbFrameItem*>(item); |
2357 iconItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_btn_highlight")); |
2447 iconItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_btn_highlight")); |
2358 int margin = 4; |
2448 int margin = 4; |
2359 QRectF focusRect = opt->rect.adjusted(-margin , -margin , margin , margin); |
2449 QRectF focusRect = opt->rect.adjusted(-margin , -margin , margin , margin); |
2433 } |
2523 } |
2434 |
2524 |
2435 switch (opt->toolBarPosition) { |
2525 switch (opt->toolBarPosition) { |
2436 case HbStyleOptionToolButton::TB_OnlyOne: |
2526 case HbStyleOptionToolButton::TB_OnlyOne: |
2437 if (opt->orientation == Qt::Vertical) { |
2527 if (opt->orientation == Qt::Vertical) { |
2438 list << QLatin1String("_l") << QLatin1String("_c") << QLatin1String("_r"); |
2528 list << QLatin1String("_l") << QLatin1String("_c") << QLatin1String("_r"); |
2439 } else { |
2529 } else { |
2440 list << QLatin1String("_t") << QLatin1String("_c") << QLatin1String("_b"); |
2530 list << QLatin1String("_t") << QLatin1String("_c") << QLatin1String("_b"); |
2441 } |
2531 } |
2442 break; |
2532 break; |
2443 case HbStyleOptionToolButton::TB_Beginning: |
2533 case HbStyleOptionToolButton::TB_Beginning: |
2444 if (opt->orientation == Qt::Vertical) { |
2534 if (opt->orientation == Qt::Vertical) { |
2445 list << QLatin1String("_l") << QLatin1String("_c") << QLatin1String("_cr"); |
2535 list << QLatin1String("_l") << QLatin1String("_c") << QLatin1String("_cr"); |
2461 list << QLatin1String("_ct") << QLatin1String("_c") << QLatin1String("_b"); |
2551 list << QLatin1String("_ct") << QLatin1String("_c") << QLatin1String("_b"); |
2462 } |
2552 } |
2463 break; |
2553 break; |
2464 default: |
2554 default: |
2465 |
2555 |
2466 break; |
2556 break; |
2467 } |
2557 } |
2468 frameItem->frameDrawer().setFileNameSuffixList(list); |
2558 frameItem->frameDrawer().setFileNameSuffixList(list); |
2469 if (mode == QIcon::Disabled && state == QIcon::Off) { |
2559 if (mode == QIcon::Disabled && state == QIcon::Off) { |
2470 frameGraphicsFooter = QLatin1String("disabled"); |
2560 frameGraphicsFooter = QLatin1String("disabled"); |
2471 } else if (mode == QIcon::Normal && state == QIcon::On) { |
2561 } else if (mode == QIcon::Normal && state == QIcon::On) { |
2479 } else { |
2569 } else { |
2480 frameGraphicsFooter = QLatin1String("normal"); |
2570 frameGraphicsFooter = QLatin1String("normal"); |
2481 } |
2571 } |
2482 |
2572 |
2483 frameItem->frameDrawer().setFrameGraphicsName(QString ("%0%1").arg(frameGraphicsHeader).arg(frameGraphicsFooter)); |
2573 frameItem->frameDrawer().setFrameGraphicsName(QString ("%0%1").arg(frameGraphicsHeader).arg(frameGraphicsFooter)); |
2574 frameItem->frameDrawer().setMirroringMode(HbIcon::LayoutDirection); |
|
2484 |
2575 |
2485 break; |
2576 break; |
2486 } |
2577 } |
2487 |
2578 |
2488 |
2579 |
2489 |
2580 |
2490 case P_SliderTickMark_majoricon: { |
2581 case P_SliderTickMark_majoricon: { |
2491 if (const HbStyleOptionSlider *opt = |
2582 if (const HbStyleOptionSlider *opt = |
2492 qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2583 qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2493 HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item); |
2584 HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item); |
2494 iconItem->setMode(d->iconMode(opt->state)); |
2585 iconItem->setMode(d->iconMode(opt->state)); |
2495 if ( opt->orientation ==Qt::Horizontal ){ |
2586 if ( opt->orientation ==Qt::Horizontal ){ |
2496 iconItem->setIconName( "qtg_graf_slider_h_tick_major" ); |
2587 iconItem->setIconName( "qtg_graf_slider_h_tick_major" ); |
2498 iconItem->setIconName ( "qtg_graf_slider_v_tick_major" ); |
2589 iconItem->setIconName ( "qtg_graf_slider_v_tick_major" ); |
2499 } |
2590 } |
2500 iconItem->setState(d->iconState(opt->state)); |
2591 iconItem->setState(d->iconState(opt->state)); |
2501 } |
2592 } |
2502 break; |
2593 break; |
2503 |
2594 |
2504 } |
2595 } |
2505 |
2596 |
2506 case P_SliderTickMark_minoricon: { |
2597 case P_SliderTickMark_minoricon: { |
2507 if (const HbStyleOptionSlider *opt = |
2598 if (const HbStyleOptionSlider *opt = |
2508 qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2599 qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2509 HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item); |
2600 HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(item); |
2510 iconItem->setMode(d->iconMode(opt->state)); |
2601 iconItem->setMode(d->iconMode(opt->state)); |
2511 if ( opt->orientation ==Qt::Horizontal ){ |
2602 if ( opt->orientation ==Qt::Horizontal ){ |
2512 iconItem->setIconName( "qtg_graf_slider_h_tick_minor" ); |
2603 iconItem->setIconName( "qtg_graf_slider_h_tick_minor" ); |
2514 iconItem->setIconName ( "qtg_graf_slider_v_tick_minor" ); |
2605 iconItem->setIconName ( "qtg_graf_slider_v_tick_minor" ); |
2515 } |
2606 } |
2516 iconItem->setState(d->iconState(opt->state)); |
2607 iconItem->setState(d->iconState(opt->state)); |
2517 } |
2608 } |
2518 break; |
2609 break; |
2519 |
2610 |
2520 } |
2611 } |
2521 |
2612 |
2522 case P_SliderTickMark_majorlabel: { |
2613 case P_SliderTickMark_majorlabel: { |
2523 if (const HbStyleOptionSlider *opt = |
2614 if (const HbStyleOptionSlider *opt = |
2524 qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2615 qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2525 HbTextItem *textItem = qgraphicsitem_cast<HbTextItem*>(item); |
2616 HbTextItem *textItem = qgraphicsitem_cast<HbTextItem*>(item); |
2526 |
2617 |
2527 textItem->setText( opt->text ); |
2618 textItem->setText( opt->text ); |
2528 |
2619 |
2529 } |
2620 } |
2530 break; |
2621 break; |
2531 |
2622 |
2532 } |
2623 } |
2533 |
2624 |
2534 case P_SliderTickMark_minorlabel: { |
2625 case P_SliderTickMark_minorlabel: { |
2535 if (const HbStyleOptionSlider *opt = |
2626 if (const HbStyleOptionSlider *opt = |
2536 qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2627 qstyleoption_cast<const HbStyleOptionSlider*>(option)) { |
2537 HbTextItem *textItem = qgraphicsitem_cast<HbTextItem*>(item); |
2628 HbTextItem *textItem = qgraphicsitem_cast<HbTextItem*>(item); |
2538 textItem->setText( opt->text ); |
2629 textItem->setText( opt->text ); |
2539 } |
2630 } |
2540 break; |
2631 break; |
2541 |
2632 |
2542 } |
2633 } |
2543 |
2634 |
2544 case P_Slider_progressgroove: { |
2635 case P_Slider_progressgroove: { |
2545 if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider *>(option)) { |
2636 if (const HbStyleOptionSlider *opt = qstyleoption_cast<const HbStyleOptionSlider *>(option)) { |
2546 HbSliderTrackItem* frameItem = static_cast<HbSliderTrackItem*>(item); |
2637 HbSliderTrackItem* frameItem = static_cast<HbSliderTrackItem*>(item); |
2547 if(!frameItem->isVisible()) { |
2638 if(!frameItem->isVisible()) { |
2554 } |
2645 } |
2555 else{ |
2646 else{ |
2556 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
2647 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
2557 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_slider_v_filled")); |
2648 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_slider_v_filled")); |
2558 frameItem->setInverted(!opt->upsideDown); |
2649 frameItem->setInverted(!opt->upsideDown); |
2559 frameItem->frameDrawer().setMirroringMode(HbIcon::Prevented); |
2650 frameItem->frameDrawer().setMirroringMode(HbIcon::Prevented); |
2560 } |
2651 } |
2561 frameItem->frameDrawer().setFillWholeRect(true); |
2652 frameItem->frameDrawer().setFillWholeRect(true); |
2562 frameItem->setMaximum(opt->maximum); |
2653 frameItem->setMaximum(opt->maximum); |
2563 frameItem->setMinimum(opt->minimum); |
2654 frameItem->setMinimum(opt->minimum); |
2564 frameItem->setValue(opt->sliderValue); |
2655 frameItem->setValue(opt->sliderValue); |
2575 HbFrameDrawer::FrameType type(HbFrameDrawer::Undefined); |
2666 HbFrameDrawer::FrameType type(HbFrameDrawer::Undefined); |
2576 QString name; |
2667 QString name; |
2577 |
2668 |
2578 if (opt->orientation == Qt::Horizontal) { |
2669 if (opt->orientation == Qt::Horizontal) { |
2579 type = HbFrameDrawer::ThreePiecesHorizontal; |
2670 type = HbFrameDrawer::ThreePiecesHorizontal; |
2580 if(!opt->groovePressed){ |
2671 if (opt->state & QStyle::State_Enabled) { |
2581 name = QLatin1String("qtg_fr_slider_h_frame_normal"); |
2672 if(!opt->groovePressed){ |
2582 } |
2673 name = QLatin1String("qtg_fr_slider_h_frame_normal"); |
2583 else { |
2674 } |
2584 name = QLatin1String("qtg_fr_slider_h_frame_pressed"); |
2675 else { |
2676 name = QLatin1String("qtg_fr_slider_h_frame_pressed"); |
|
2677 } |
|
2678 } else { |
|
2679 name = QLatin1String("qtg_fr_slider_h_frame_disabled"); |
|
2585 } |
2680 } |
2586 } else if (opt->orientation == Qt::Vertical) { |
2681 } else if (opt->orientation == Qt::Vertical) { |
2587 if(!opt->groovePressed){ |
2682 if (opt->state & QStyle::State_Enabled) { |
2588 name = QLatin1String("qtg_fr_slider_v_frame_normal"); |
2683 if(!opt->groovePressed){ |
2589 } |
2684 name = QLatin1String("qtg_fr_slider_v_frame_normal"); |
2590 else { |
2685 } |
2591 name = QLatin1String("qtg_fr_slider_v_frame_pressed"); |
2686 else { |
2687 name = QLatin1String("qtg_fr_slider_v_frame_pressed"); |
|
2688 } |
|
2689 } else { |
|
2690 name = QLatin1String("qtg_fr_slider_v_frame_disabled"); |
|
2691 |
|
2592 } |
2692 } |
2593 type = HbFrameDrawer::ThreePiecesVertical; |
2693 type = HbFrameDrawer::ThreePiecesVertical; |
2594 } |
2694 } |
2595 |
2695 |
2596 frameItem->frameDrawer().setFrameGraphicsName(name); |
2696 frameItem->frameDrawer().setFrameGraphicsName(name); |
2610 thumbPath=d->logicalName(HbStyle::P_Slider_thumb, option); |
2710 thumbPath=d->logicalName(HbStyle::P_Slider_thumb, option); |
2611 } |
2711 } |
2612 else |
2712 else |
2613 { |
2713 { |
2614 thumbPath=opt->thumbPath; |
2714 thumbPath=opt->thumbPath; |
2715 iconItem->setAlignment(Qt::AlignCenter); |
|
2615 } |
2716 } |
2616 iconItem->setIconName(thumbPath); |
2717 iconItem->setIconName(thumbPath); |
2617 iconItem->setAspectRatioMode(Qt::KeepAspectRatio); |
2718 iconItem->setAspectRatioMode(Qt::KeepAspectRatio); |
2618 } |
2719 } |
2619 break; |
2720 break; |
2665 if( opt->state & QStyle::State_Sunken) { |
2766 if( opt->state & QStyle::State_Sunken) { |
2666 iconItem->setIconName(QLatin1String("qtg_mono_speaker_off")); |
2767 iconItem->setIconName(QLatin1String("qtg_mono_speaker_off")); |
2667 } else { |
2768 } else { |
2668 iconItem->setIconName(QLatin1String("qtg_mono_speaker")); |
2769 iconItem->setIconName(QLatin1String("qtg_mono_speaker")); |
2669 } |
2770 } |
2670 } |
2771 } |
2671 } |
2772 } |
2672 break; |
2773 break; |
2673 } |
2774 } |
2674 case P_SliderElement_text: |
2775 case P_SliderElement_text: |
2675 { |
2776 { |
2691 break; |
2792 break; |
2692 |
2793 |
2693 case P_CheckBox_icon: { |
2794 case P_CheckBox_icon: { |
2694 if (const HbStyleOptionCheckBox *opt = qstyleoption_cast<const HbStyleOptionCheckBox *>(option)){ |
2795 if (const HbStyleOptionCheckBox *opt = qstyleoption_cast<const HbStyleOptionCheckBox *>(option)){ |
2695 HbIconItem *iconItem = static_cast<HbIconItem *>(item); |
2796 HbIconItem *iconItem = static_cast<HbIconItem *>(item); |
2696 if (opt->state.testFlag(QStyle::State_On)) { |
2797 if (opt->state.testFlag(QStyle::State_Selected) ) { |
2697 iconItem->setState(QIcon::On); |
2798 if (opt->state.testFlag(QStyle::State_On)) { |
2698 iconItem->setIconName(QLatin1String("qtg_small_selected")); |
2799 iconItem->setState(QIcon::On); |
2699 } else if (opt->state.testFlag(QStyle::State_Off)) { |
2800 iconItem->setIconName(QLatin1String("qtg_small_selected_highlight")); |
2700 iconItem->setState(QIcon::Off); |
2801 } else if (opt->state.testFlag(QStyle::State_Off)) { |
2701 iconItem->setIconName(QLatin1String("qtg_small_unselected")); |
2802 iconItem->setState(QIcon::Off); |
2702 } else if (opt->state.testFlag(QStyle::State_NoChange)) { |
2803 iconItem->setIconName(QLatin1String("qtg_small_unselected_highlight")); |
2703 iconItem->setState(QIcon::On); |
2804 } else if (opt->state.testFlag(QStyle::State_NoChange)) { |
2704 iconItem->setIconName(QLatin1String("qtg_small_selected_partial")); |
2805 iconItem->setState(QIcon::On); |
2806 iconItem->setIconName(QLatin1String("qtg_small_selected_partial")); |
|
2807 } |
|
2808 } else { |
|
2809 if (opt->state.testFlag(QStyle::State_On)) { |
|
2810 iconItem->setState(QIcon::On); |
|
2811 iconItem->setIconName(QLatin1String("qtg_small_selected")); |
|
2812 } else if (opt->state.testFlag(QStyle::State_Off)) { |
|
2813 iconItem->setState(QIcon::Off); |
|
2814 iconItem->setIconName(QLatin1String("qtg_small_unselected")); |
|
2815 } else if (opt->state.testFlag(QStyle::State_NoChange)) { |
|
2816 iconItem->setState(QIcon::On); |
|
2817 iconItem->setIconName(QLatin1String("qtg_small_selected_partial")); |
|
2818 } |
|
2705 } |
2819 } |
2706 } |
2820 } |
2707 break; |
2821 break; |
2708 } |
2822 } |
2709 case P_ItemViewItem_radiobutton: |
2823 case P_ItemViewItem_radiobutton: |
2793 if (opt->state & QStyle::State_Sunken) { |
2907 if (opt->state & QStyle::State_Sunken) { |
2794 frameGraphicsName = QLatin1String("qtg_fr_combobox_pressed"); |
2908 frameGraphicsName = QLatin1String("qtg_fr_combobox_pressed"); |
2795 } else { |
2909 } else { |
2796 frameGraphicsName = QLatin1String("qtg_fr_combobox_normal"); |
2910 frameGraphicsName = QLatin1String("qtg_fr_combobox_normal"); |
2797 } |
2911 } |
2798 } else { |
2912 } else { |
2799 frameGraphicsName = QLatin1String("qtg_fr_combobox_disabled"); |
2913 frameGraphicsName = QLatin1String("qtg_fr_combobox_disabled"); |
2800 } |
2914 } |
2801 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
2915 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
2802 frameItem->frameDrawer().setFillWholeRect(true); |
2916 frameItem->frameDrawer().setFillWholeRect(true); |
2803 frameItem->frameDrawer().setFrameGraphicsName(frameGraphicsName); |
2917 frameItem->frameDrawer().setFrameGraphicsName(frameGraphicsName); |
2814 if (opt->state & QStyle::State_Sunken) { |
2928 if (opt->state & QStyle::State_Sunken) { |
2815 iconGraphicsName = QLatin1String("qtg_graf_combobox_button_pressed"); |
2929 iconGraphicsName = QLatin1String("qtg_graf_combobox_button_pressed"); |
2816 } else { |
2930 } else { |
2817 iconGraphicsName = QLatin1String("qtg_graf_combobox_button_normal"); |
2931 iconGraphicsName = QLatin1String("qtg_graf_combobox_button_normal"); |
2818 } |
2932 } |
2819 } else { |
2933 } else { |
2820 iconGraphicsName = QLatin1String("qtg_graf_combobox_button_disabled"); |
2934 iconGraphicsName = QLatin1String("qtg_graf_combobox_button_disabled"); |
2821 } |
2935 } |
2822 iconItem->setIconName(iconGraphicsName); |
2936 iconItem->setIconName(iconGraphicsName); |
2823 iconItem->setMirroringMode ( HbIcon::LayoutDirection ); |
2937 iconItem->setMirroringMode ( HbIcon::LayoutDirection ); |
2824 iconItem->setAspectRatioMode( Qt::IgnoreAspectRatio); |
2938 iconItem->setAspectRatioMode( Qt::IgnoreAspectRatio); |
2859 } |
2973 } |
2860 break; |
2974 break; |
2861 case P_Label_richtext: |
2975 case P_Label_richtext: |
2862 if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) { |
2976 if (const HbStyleOptionLabel *opt = qstyleoption_cast<const HbStyleOptionLabel*>(option)) { |
2863 HbRichTextItem *textItem = static_cast<HbRichTextItem*>(item); |
2977 HbRichTextItem *textItem = static_cast<HbRichTextItem*>(item); |
2864 textItem->setAlignment(opt->alignment); |
2978 textItem->setAlignment(opt->alignment); |
2865 textItem->setTextWrapping(opt->textWrapMode); |
2979 textItem->setTextWrapping(opt->textWrapMode); |
2866 if(!opt->fontSpec.isNull()) { |
2980 if(!opt->fontSpec.isNull()) { |
2867 textItem->setFontSpec(opt->fontSpec); |
2981 textItem->setFontSpec(opt->fontSpec); |
2868 } |
2982 } |
2869 if (opt->color.isValid()) { |
2983 if (opt->color.isValid()) { |
2883 |
2997 |
2884 case P_MenuItem_checkindicator: |
2998 case P_MenuItem_checkindicator: |
2885 if (const HbStyleOptionMenuItem *opt = qstyleoption_cast<const HbStyleOptionMenuItem *>(option)) { |
2999 if (const HbStyleOptionMenuItem *opt = qstyleoption_cast<const HbStyleOptionMenuItem *>(option)) { |
2886 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
3000 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2887 if (opt->checked) { |
3001 if (opt->checked) { |
2888 iconItem->setIconName(QLatin1String("qtg_small_selected")); |
3002 iconItem->setIconName(QLatin1String("qtg_small_tick")); |
2889 } else { |
3003 } else { |
2890 iconItem->setIcon(HbIcon()); |
3004 iconItem->setIcon(HbIcon()); |
2891 } |
3005 } |
2892 } |
3006 } |
2893 break; |
3007 break; |
3109 icon->setIcon(HbIcon(QLatin1String("qtg_large_warning"))); |
3223 icon->setIcon(HbIcon(QLatin1String("qtg_large_warning"))); |
3110 break; |
3224 break; |
3111 default: |
3225 default: |
3112 break; |
3226 break; |
3113 } |
3227 } |
3114 } else { |
3228 } else { |
3115 icon->setIcon(opt->icon); |
3229 icon->setIcon(opt->icon); |
3116 } |
3230 } |
3117 } |
3231 } |
3118 break; |
3232 break; |
3119 case P_ListViewItem_text: |
3233 case P_ListViewItem_text: |
3120 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) { |
3234 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) { |
3121 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3235 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3122 |
3236 |
3123 if (opt->index == 1) { |
3237 if (opt->index == 1) { |
3124 if (opt->multilineSecondaryTextSupported) { |
3238 if (opt->multilineSecondaryTextSupported) { |
3125 if (opt->minimumLines != -1) { |
3239 if (opt->minimumLines != -1) { |
3126 // min & max secondary text row counts set by app |
3240 // min & max secondary text row counts set by app |
3127 Hb::TextWrapping wrapping = Hb::TextNoWrap; |
3241 Hb::TextWrapping wrapping = Hb::TextNoWrap; |
3161 } |
3275 } |
3162 break; |
3276 break; |
3163 case P_ListViewItem_icon: |
3277 case P_ListViewItem_icon: |
3164 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) { |
3278 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) { |
3165 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
3279 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
3166 |
3280 |
3167 setItemName(iconItem, QLatin1String("icon-") + QString::number(opt->index + 1)); |
3281 setItemName(iconItem, QLatin1String("icon-") + QString::number(opt->index + 1)); |
3168 iconItem->setZValue(opt->index + 1); |
3282 iconItem->setZValue(opt->index + 1); |
3169 |
3283 |
3170 if (opt->content.canConvert<HbIcon>()){ |
3284 if (opt->content.canConvert<HbIcon>()){ |
3171 iconItem->setIcon(opt->content.value<HbIcon>()); |
3285 iconItem->setIcon(opt->content.value<HbIcon>()); |
3257 |
3371 |
3258 else{ |
3372 else{ |
3259 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
3373 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
3260 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_frame")); |
3374 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_frame")); |
3261 } |
3375 } |
3262 frameItem->frameDrawer().setFillWholeRect(true); |
3376 // frameItem->frameDrawer().setFillWholeRect(true); |
3263 } |
3377 } |
3264 break; |
3378 break; |
3265 case P_ProgressBar_track: |
3379 case P_ProgressBar_track: |
3266 |
3380 |
3267 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) { |
3381 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) { |
3268 HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item); |
3382 HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item); |
3269 if(!frameItem->isVisible()) { |
3383 if(!frameItem->isVisible()) { |
3270 break; |
3384 break; |
3271 } |
3385 } |
3272 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3386 |
3273 if(opt->orientation == Qt::Horizontal){ |
3387 if(opt->orientation == Qt::Horizontal){ |
3274 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_filled")); |
3388 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3389 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_h_filled")); |
|
3275 } |
3390 } |
3276 else{ |
3391 else{ |
3277 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
3392 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesVertical); |
3278 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_filled")); |
3393 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progbar_v_filled")); |
3279 } |
3394 } |
3280 frameItem->frameDrawer().setFillWholeRect(true); |
3395 |
3281 frameItem->setMaximum(opt->maximum); |
3396 frameItem->setMaximum(opt->maximum); |
3282 frameItem->setMinimum(opt->minimum); |
3397 frameItem->setMinimum(opt->minimum); |
3283 frameItem->setValue(opt->progressValue); |
3398 frameItem->setValue(opt->progressValue); |
3284 frameItem->setInverted(opt->inverted); |
3399 frameItem->setInverted(opt->inverted); |
3285 //frameItem->setGeometry(opt->rect); |
3400 //frameItem->setGeometry(opt->rect); |
3286 frameItem->setOrientation(opt->orientation); |
3401 frameItem->setOrientation(opt->orientation); |
3287 frameItem->update(); |
3402 frameItem->update(); |
3288 } |
3403 } |
3289 break; |
3404 break; |
3290 case P_ProgressBar_waittrack: |
3405 case P_ProgressBar_waittrack: |
3291 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) { |
3406 if (const HbStyleOptionProgressBar *opt = qstyleoption_cast<const HbStyleOptionProgressBar *>(option)) { |
3292 HbRepeatIconItem *iconItem = static_cast<HbRepeatIconItem*>(item); |
3407 HbRepeatIconItem *iconItem = static_cast<HbRepeatIconItem*>(item); |
3293 iconItem->setOrientation(opt->orientation); |
3408 iconItem->setOrientation(opt->orientation); |
3294 if( !iconItem->isVisible() ) { |
3409 if( !iconItem->isVisible() ) { |
3295 break; |
3410 break; |
3296 } |
3411 } |
3303 if(opt->stopWaitAnimation){ |
3418 if(opt->stopWaitAnimation){ |
3304 iconItem->stopAnimation(); |
3419 iconItem->stopAnimation(); |
3305 } |
3420 } |
3306 } |
3421 } |
3307 break; |
3422 break; |
3308 |
3423 |
3309 case P_ProgressSlider_frame: |
3424 case P_ProgressSlider_frame: |
3310 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
3425 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
3311 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
3426 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
3312 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3427 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3313 if (opt->disableState ) { |
3428 if (opt->disableState ) { |
3314 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_disabled")); |
3429 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_disabled")); |
3315 } |
3430 } |
3316 else { |
3431 else { |
3317 if(opt->pressedState) { |
3432 if(opt->pressedState) { |
3318 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed")); |
3433 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed")); |
3319 } |
3434 } |
3320 else { |
3435 else { |
3321 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal")); |
3436 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal")); |
3322 } |
3437 } |
3323 } |
3438 } |
3324 frameItem->frameDrawer().setFillWholeRect(true); |
3439 frameItem->frameDrawer().setFillWholeRect(true); |
3325 //frameItem->update(); |
3440 //frameItem->update(); |
3326 } |
3441 } |
3327 break; |
3442 break; |
3328 case P_ProgressSlider_track: // The ProgressValue Mask |
3443 case P_ProgressSlider_track: // The ProgressValue Mask |
3329 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
3444 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
3330 HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item); |
3445 HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item); |
3331 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3446 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3332 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded")); |
3447 |
3448 if (opt->disableState ) { |
|
3449 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded_disabled")); |
|
3450 } |
|
3451 else { |
|
3452 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_loaded")); |
|
3453 } |
|
3333 frameItem->frameDrawer().setFillWholeRect(true); |
3454 frameItem->frameDrawer().setFillWholeRect(true); |
3334 frameItem->setMaximum(opt->maximum); |
3455 frameItem->setMaximum(opt->maximum); |
3335 frameItem->setMinimum(opt->minimum); |
3456 frameItem->setMinimum(opt->minimum); |
3336 frameItem->setValue(opt->progressValue); |
3457 frameItem->setValue(opt->progressValue); |
3337 frameItem->setInverted(opt->inverted); |
3458 frameItem->setInverted(opt->inverted); |
3338 frameItem->setOrientation(opt->orientation); |
3459 frameItem->setOrientation(opt->orientation); |
3339 frameItem->update(); |
3460 frameItem->update(); |
3340 } |
3461 } |
3341 break; |
3462 break; |
3342 |
3463 |
3343 case P_ProgressSlider_slidertrack: // The Slider Position Mask |
3464 case P_ProgressSlider_slidertrack: // The Slider Position Mask |
3344 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
3465 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
3345 HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item); |
3466 HbProgressTrackItem* frameItem = static_cast<HbProgressTrackItem*>(item); |
3346 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3467 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3347 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played")); |
3468 if (opt->disableState ) { |
3469 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played_disabled")); |
|
3470 } |
|
3471 else { |
|
3472 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_played")); |
|
3473 } |
|
3348 frameItem->frameDrawer().setFillWholeRect(true); |
3474 frameItem->frameDrawer().setFillWholeRect(true); |
3349 frameItem->setMaximum(opt->maximum); |
3475 frameItem->setMaximum(opt->maximum); |
3350 frameItem->setMinimum(opt->minimum); |
3476 frameItem->setMinimum(opt->minimum); |
3351 frameItem->setValue(opt->progressSliderValue); |
3477 frameItem->setValue(opt->progressSliderValue); |
3352 frameItem->setInverted(opt->inverted); |
3478 frameItem->setInverted(opt->inverted); |
3353 frameItem->setOrientation(opt->orientation); |
3479 frameItem->setOrientation(opt->orientation); |
3354 //frameItem->update(); |
3480 frameItem->update(); |
3355 } |
3481 } |
3356 break; |
3482 break; |
3357 case P_ProgressBar_mintext: { |
3483 case P_ProgressBar_mintext: { |
3358 if (const HbStyleOptionProgressBar *opt = |
3484 if (const HbStyleOptionProgressBar *opt = |
3359 qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) { |
3485 qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) { |
3360 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3486 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3361 if(!item) { |
3487 if(!item) { |
3362 return; |
3488 return; |
3363 } |
3489 } |
3364 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
3490 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
3365 textItem->setText(opt->minText); |
3491 textItem->setText(opt->minText); |
3366 } |
3492 } |
3367 break; |
3493 break; |
3368 } |
3494 } |
3369 |
3495 |
3370 case P_ProgressBar_maxtext: { |
3496 case P_ProgressBar_maxtext: { |
3371 if (const HbStyleOptionProgressBar *opt = |
3497 if (const HbStyleOptionProgressBar *opt = |
3372 qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) { |
3498 qstyleoption_cast<const HbStyleOptionProgressBar*>(option)) { |
3373 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3499 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3374 if(!item) { |
3500 if(!item) { |
3375 return; |
3501 return; |
3376 } |
3502 } |
3377 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
3503 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
3378 textItem->setText(opt->maxText); |
3504 textItem->setText(opt->maxText); |
3379 } |
3505 } |
3380 break; |
3506 break; |
3381 } |
3507 } |
3382 |
3508 |
3383 case P_RatingSlider_frame:{ |
3509 case P_RatingSlider_frame:{ |
3384 if (const HbStyleOptionRatingSlider *opt = qstyleoption_cast<const HbStyleOptionRatingSlider *>(option)) { |
3510 if (const HbStyleOptionRatingSlider *opt = qstyleoption_cast<const HbStyleOptionRatingSlider *>(option)) { |
3385 HbRepeatItem *repeatItem = static_cast<HbRepeatItem*>(item); |
3511 HbRepeatItem *repeatItem = static_cast<HbRepeatItem*>(item); |
3386 repeatItem->setRepeatingNumber(opt->noOfStars); |
3512 repeatItem->setRepeatingNumber(opt->noOfStars); |
3387 if (!opt->unRatedGraphicsName.isEmpty()) { |
3513 if (!opt->unRatedGraphicsName.isEmpty()) { |
3388 repeatItem->setName(opt->unRatedGraphicsName); |
3514 repeatItem->setName(opt->unRatedGraphicsName); |
3389 } |
3515 } |
3390 else { |
3516 else { |
3391 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated")); |
3517 if(opt->disableState) { |
3518 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_disabled")); |
|
3519 |
|
3520 } |
|
3521 else { |
|
3522 if(opt->pressedState) { |
|
3523 |
|
3524 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated_pressed")); |
|
3525 } |
|
3526 else { |
|
3527 |
|
3528 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_unrated")); |
|
3529 } |
|
3530 } |
|
3392 } |
3531 } |
3393 repeatItem->setGeometry(opt->boundingRect); |
3532 repeatItem->setGeometry(opt->boundingRect); |
3394 repeatItem->update(); |
3533 repeatItem->update(); |
3395 } |
3534 } |
3396 break; |
3535 break; |
3397 } |
3536 } |
3398 |
3537 |
3399 case P_RatingSlider_track:{ |
3538 case P_RatingSlider_track:{ |
3400 if (const HbStyleOptionRatingSlider *opt = qstyleoption_cast<const HbStyleOptionRatingSlider *>(option)) { |
3539 if (const HbStyleOptionRatingSlider *opt = qstyleoption_cast<const HbStyleOptionRatingSlider *>(option)) { |
3401 HbRepeatMaskItem *repeatItem = static_cast<HbRepeatMaskItem*>(item); |
3540 HbRepeatMaskItem *repeatItem = static_cast<HbRepeatMaskItem*>(item); |
3402 repeatItem->setMaskValue(opt->progressValue); |
3541 repeatItem->setMaskValue(opt->progressValue); |
3403 repeatItem->setMaximum(opt->noOfIntervals); |
3542 repeatItem->setMaximum(opt->noOfIntervals); |
3404 repeatItem->setInverted(opt->inverted); |
3543 repeatItem->setInverted(opt->inverted); |
3405 repeatItem->setRepeatingNumber(opt->noOfStars); |
3544 repeatItem->setRepeatingNumber(opt->noOfStars); |
3406 if (!opt->ratedGraphicsName.isEmpty()) { |
3545 if (!opt->ratedGraphicsName.isEmpty()) { |
3407 repeatItem->setName(opt->ratedGraphicsName); |
3546 repeatItem->setName(opt->ratedGraphicsName); |
3408 } |
3547 } |
3409 else { |
3548 else { |
3410 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated")); |
3549 if(opt->disableState) { |
3550 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated_disabled")); |
|
3551 |
|
3552 |
|
3553 } |
|
3554 else { |
|
3555 |
|
3556 if(opt->pressedState) { |
|
3557 |
|
3558 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated_pressed")); |
|
3559 } |
|
3560 else { |
|
3561 repeatItem->setName(QLatin1String("qtg_graf_ratingslider_rated")); |
|
3562 } |
|
3563 } |
|
3411 } |
3564 } |
3412 repeatItem->setGeometry(opt->boundingRect); |
3565 repeatItem->setGeometry(opt->boundingRect); |
3413 repeatItem->update(); |
3566 repeatItem->update(); |
3414 } |
3567 } |
3415 break; |
3568 break; |
3451 iconItem->setBrush(opt->background.value<QBrush>()); |
3604 iconItem->setBrush(opt->background.value<QBrush>()); |
3452 } |
3605 } |
3453 } |
3606 } |
3454 |
3607 |
3455 break; |
3608 break; |
3456 case P_ItemViewItem_frame: |
3609 case P_ItemViewItem_frame: |
3457 if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) { |
3610 if (const HbStyleOptionAbstractViewItem *opt = qstyleoption_cast<const HbStyleOptionAbstractViewItem *>(option)) { |
3458 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
3611 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
3459 frameItem->setZValue(-4.0); |
3612 frameItem->setZValue(-4.0); |
3460 frameItem->setGeometry(opt->boundingRect); |
3613 frameItem->setGeometry(opt->boundingRect); |
3461 |
3614 |
3464 frameItem->frameDrawer().setFrameType(frame.frameType()); |
3617 frameItem->frameDrawer().setFrameType(frame.frameType()); |
3465 frameItem->frameDrawer().setFrameGraphicsName(frame.frameGraphicsName()); |
3618 frameItem->frameDrawer().setFrameGraphicsName(frame.frameGraphicsName()); |
3466 } else if (opt->viewItemType == Hb::ItemType_TreeViewItem) { |
3619 } else if (opt->viewItemType == Hb::ItemType_TreeViewItem) { |
3467 if (opt->modelItemType == Hb::ParentItem) { |
3620 if (opt->modelItemType == Hb::ParentItem) { |
3468 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3621 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3469 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
3622 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
3470 QLatin1String("qtg_fr_popup_list_parent_normal") : QLatin1String("qtg_fr_list_parent_normal")); |
3623 QLatin1String("qtg_fr_popup_list_parent_normal") : QLatin1String("qtg_fr_list_parent_normal")); |
3471 } else if (opt->modelItemType == Hb::SeparatorItem) { |
3624 } else if (opt->modelItemType == Hb::SeparatorItem) { |
3472 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3625 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3473 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_separator")); |
3626 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_separator")); |
3474 } else { |
3627 } else { |
3475 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3628 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3476 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
3629 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
3477 QLatin1String("qtg_fr_popup_list_normal") : QLatin1String("qtg_fr_list_normal")); |
3630 QLatin1String("qtg_fr_popup_list_normal") : QLatin1String("qtg_fr_list_normal")); |
3478 } |
3631 } |
3479 } else if ( opt->viewItemType == Hb::ItemType_ListViewItem |
3632 } else if ( opt->viewItemType == Hb::ItemType_ListViewItem |
3480 || opt->viewItemType == Hb::ItemType_RadioButtonListViewItem) { |
3633 || opt->viewItemType == Hb::ItemType_RadioButtonListViewItem) { |
3481 if (opt->modelItemType == Hb::SeparatorItem) { |
3634 if (opt->modelItemType == Hb::SeparatorItem) { |
3482 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3635 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3483 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_separator")); |
3636 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_list_separator")); |
3484 } else { |
3637 } else { |
3485 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3638 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3486 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
3639 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
3487 QLatin1String("qtg_fr_popup_list_normal") : QLatin1String("qtg_fr_list_normal")); |
3640 QLatin1String("qtg_fr_popup_list_normal") : QLatin1String("qtg_fr_list_normal")); |
3488 } |
3641 } |
3489 } else if (opt->viewItemType == Hb::ItemType_GridViewItem |
3642 } else if (opt->viewItemType == Hb::ItemType_GridViewItem |
3490 || opt->viewItemType == HbPrivate::ItemType_ColorGridViewItem) { |
3643 || opt->viewItemType == HbPrivate::ItemType_ColorGridViewItem) { |
3491 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3644 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3492 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
3645 frameItem->frameDrawer().setFrameGraphicsName( opt->insidePopup ? |
3493 QLatin1String("qtg_fr_popup_grid_normal") : QLatin1String("qtg_fr_grid_normal")); |
3646 QLatin1String("qtg_fr_popup_grid_normal") : QLatin1String("qtg_fr_grid_normal")); |
3494 } |
3647 } |
3495 else{ |
3648 else{ |
3496 frameItem->frameDrawer().setFrameGraphicsName(QString()); |
3649 frameItem->frameDrawer().setFrameGraphicsName(QString()); |
3497 } |
3650 } |
3577 //frameItem->setGeometry(opt->boundingRect); |
3730 //frameItem->setGeometry(opt->boundingRect); |
3578 Q_UNUSED(opt); |
3731 Q_UNUSED(opt); |
3579 } |
3732 } |
3580 } |
3733 } |
3581 break; |
3734 break; |
3582 case P_TumbleView_frame: |
3735 case P_TumbleView_frame: |
3583 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3736 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3584 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3737 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3585 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay"); |
3738 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay"); |
3586 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3739 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3587 frameItem->setZValue(-4); |
3740 frameItem->setZValue(-4); |
3597 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3750 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3598 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri"); |
3751 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri"); |
3599 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3752 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3600 frameItem->setZValue(3); |
3753 frameItem->setZValue(3); |
3601 //TODO:temp fix, issue with css rule picking in derived class |
3754 //TODO:temp fix, issue with css rule picking in derived class |
3602 |
3755 |
3603 //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); |
3756 //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); |
3604 Q_UNUSED(opt); |
3757 Q_UNUSED(opt); |
3605 } |
3758 } |
3606 |
3759 |
3607 } |
3760 } |
3608 break; |
3761 break; |
3609 |
3762 |
3610 case P_IndexFeedback_popup_text: |
3763 case P_IndexFeedback_popup_text: |
3611 if (const HbStyleOptionIndexFeedback *opt = qstyleoption_cast<const HbStyleOptionIndexFeedback *>(option)) { |
3764 if (const HbStyleOptionIndexFeedback *opt = qstyleoption_cast<const HbStyleOptionIndexFeedback *>(option)) { |
3632 //frameItem->setGeometry(opt->boundingRect); |
3785 //frameItem->setGeometry(opt->boundingRect); |
3633 Q_UNUSED(opt); |
3786 Q_UNUSED(opt); |
3634 } |
3787 } |
3635 } |
3788 } |
3636 break; |
3789 break; |
3637 case P_DateTimePicker_frame: |
3790 case P_DateTimePicker_frame: |
3638 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3791 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3639 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3792 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3640 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay"); |
3793 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay"); |
3641 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3794 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3642 frameItem->setZValue(1); |
3795 frameItem->setZValue(1); |
3659 } |
3812 } |
3660 |
3813 |
3661 } |
3814 } |
3662 break; |
3815 break; |
3663 case P_InputDialog_text: |
3816 case P_InputDialog_text: |
3664 if (const HbStyleOptionInputDialog *opt = |
3817 if (const HbStyleOptionInputDialog *opt = |
3665 qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) { |
3818 qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) { |
3666 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3819 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3667 if(!item) { |
3820 if(!item) { |
3668 return; |
3821 return; |
3669 } |
3822 } |
3670 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
3823 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
3671 textItem->setText(opt->text); |
3824 textItem->setText(opt->text); |
3672 } |
3825 } |
3673 break; |
3826 break; |
3674 case P_InputDialog_additionaltext: |
3827 case P_InputDialog_additionaltext: |
3675 if (const HbStyleOptionInputDialog *opt = |
3828 if (const HbStyleOptionInputDialog *opt = |
3676 qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) { |
3829 qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) { |
3677 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3830 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3678 if(!item) { |
3831 if(!item) { |
3679 return; |
3832 return; |
3680 } |
3833 } |
3681 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
3834 textItem->setTextWrapping(Hb::TextWrapAnywhere); |
3682 textItem->setText(opt->additionalText); |
3835 textItem->setText(opt->additionalText); |
3683 } |
3836 } |
3684 break; |
3837 break; |
3685 default: |
3838 default: |
3686 return; |
3839 return; |
3687 }; |
3840 }; |
3688 } |
3841 } |
3765 QGraphicsLayoutItem* lItem = (item && item->isWidget()) ? (QGraphicsLayoutItem*)static_cast<QGraphicsWidget*>(item) : 0; |
3918 QGraphicsLayoutItem* lItem = (item && item->isWidget()) ? (QGraphicsLayoutItem*)static_cast<QGraphicsWidget*>(item) : 0; |
3766 if ( !lItem ) { |
3919 if ( !lItem ) { |
3767 lItem = widget->layoutPrimitive(name); |
3920 lItem = widget->layoutPrimitive(name); |
3768 if ( lItem && !lItem->graphicsItem() ) { |
3921 if ( lItem && !lItem->graphicsItem() ) { |
3769 // assume it is spacer |
3922 // assume it is spacer |
3770 static_cast<HbMeshLayout*>(widget->layout())->setItemId( lItem, name ); |
3923 static_cast<HbAnchorLayout*>(widget->layout())->setMapping( lItem, name ); |
3771 } |
3924 } |
3772 } |
3925 } |
3773 |
3926 |
3774 HbDeviceProfile profile(HbDeviceProfile::profile(widget)); |
3927 HbDeviceProfile profile(HbDeviceProfile::profile(widget)); |
3775 |
3928 |
3845 qDebug() << "HbStyle::polishItem : -- Setting aspect ratio mode: " << prop.mAspectRatioMode; |
3998 qDebug() << "HbStyle::polishItem : -- Setting aspect ratio mode: " << prop.mAspectRatioMode; |
3846 #endif |
3999 #endif |
3847 icon->setAspectRatioMode(prop.mAspectRatioMode); |
4000 icon->setAspectRatioMode(prop.mAspectRatioMode); |
3848 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_IconAspectRatioMode, false); |
4001 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_IconAspectRatioMode, false); |
3849 } |
4002 } |
4003 if ( prop.mFlags & HbCss::ExtractedAlignment |
|
4004 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_IconAlign)) { |
|
4005 #ifdef HBSTYLE_DEBUG |
|
4006 qDebug() << "HbStyle::polishItem : -- Setting icon alignment: " << prop.mAlignment; |
|
4007 #endif |
|
4008 icon->setAlignment( prop.mAlignment ); |
|
4009 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_IconAlign, false); |
|
4010 } |
|
3850 } |
4011 } |
3851 |
4012 |
3852 HbTextItem* text = qobject_cast<HbTextItem*>(hbWidget); |
4013 HbTextItem* text = qobject_cast<HbTextItem*>(hbWidget); |
3853 if (text) { |
4014 if (text) { |
3854 if ( prop.mFlags & HbCss::ExtractedMinLines |
4015 if ( prop.mFlags & HbCss::ExtractedMinLines |
3865 qDebug() << "HbStyle::polishItem : -- Setting text max lines: " << prop.mMaxLines; |
4026 qDebug() << "HbStyle::polishItem : -- Setting text max lines: " << prop.mMaxLines; |
3866 #endif |
4027 #endif |
3867 text->setMaximumLines( prop.mMaxLines ); |
4028 text->setMaximumLines( prop.mMaxLines ); |
3868 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false); |
4029 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false); |
3869 } |
4030 } |
3870 if ( prop.mFlags & HbCss::ExtractedTextAlign |
4031 if ( prop.mFlags & HbCss::ExtractedAlignment |
3871 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign)) { |
4032 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign)) { |
3872 #ifdef HBSTYLE_DEBUG |
4033 #ifdef HBSTYLE_DEBUG |
3873 qDebug() << "HbStyle::polishItem : -- Setting text alignment: " << prop.mTextAlignment; |
4034 qDebug() << "HbStyle::polishItem : -- Setting text alignment: " << prop.mAlignment; |
3874 #endif |
4035 #endif |
3875 text->setAlignment( prop.mTextAlignment ); |
4036 text->setAlignment( prop.mAlignment ); |
3876 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign, false); |
4037 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign, false); |
3877 } |
4038 } |
3878 if ( prop.mFlags & HbCss::ExtractedWrapMode |
4039 if ( prop.mFlags & HbCss::ExtractedWrapMode |
3879 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode)) { |
4040 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode)) { |
3880 #ifdef HBSTYLE_DEBUG |
4041 #ifdef HBSTYLE_DEBUG |
3881 qDebug() << "HbStyle::polishItem : -- Setting wrap mode : " << prop.mTextWrapMode; |
4042 qDebug() << "HbStyle::polishItem : -- Setting wrap mode : " << prop.mTextWrapMode; |
3882 #endif |
4043 #endif |
3883 text->setTextWrapping( prop.mTextWrapMode ); |
4044 text->setTextWrapping( prop.mTextWrapMode ); |
3885 } |
4046 } |
3886 } |
4047 } |
3887 |
4048 |
3888 HbRichTextItem* richtext = qobject_cast<HbRichTextItem*>(hbWidget); |
4049 HbRichTextItem* richtext = qobject_cast<HbRichTextItem*>(hbWidget); |
3889 if (richtext) { |
4050 if (richtext) { |
3890 if ( prop.mFlags & HbCss::ExtractedTextAlign |
4051 if ( prop.mFlags & HbCss::ExtractedAlignment |
3891 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign)) { |
4052 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign)) { |
3892 #ifdef HBSTYLE_DEBUG |
4053 #ifdef HBSTYLE_DEBUG |
3893 qDebug() << "HbStyle::polishItem : -- Setting text alignment: " << prop.mTextAlignment; |
4054 qDebug() << "HbStyle::polishItem : -- Setting text alignment: " << prop.mAlignment; |
3894 #endif |
4055 #endif |
3895 richtext->setAlignment( prop.mTextAlignment ); |
4056 richtext->setAlignment( prop.mAlignment ); |
3896 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign, false); |
4057 hbWidget_p->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextAlign, false); |
3897 } |
4058 } |
3898 if ( prop.mFlags & HbCss::ExtractedWrapMode |
4059 if ( prop.mFlags & HbCss::ExtractedWrapMode |
3899 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode)) { |
4060 && !hbWidget_p->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode)) { |
3900 #ifdef HBSTYLE_DEBUG |
4061 #ifdef HBSTYLE_DEBUG |
3901 qDebug() << "HbStyle::polishItem : -- Setting wrap mode : " << prop.mTextWrapMode; |
4062 qDebug() << "HbStyle::polishItem : -- Setting wrap mode : " << prop.mTextWrapMode; |
3902 #endif |
4063 #endif |
3903 richtext->setTextWrapping( prop.mTextWrapMode ); |
4064 richtext->setTextWrapping( prop.mTextWrapMode ); |
3995 } |
4156 } |
3996 lItem->setSizePolicy(itemPol); |
4157 lItem->setSizePolicy(itemPol); |
3997 } |
4158 } |
3998 |
4159 |
3999 if (layoutDefined) { |
4160 if (layoutDefined) { |
4000 HbMeshLayout *layout = static_cast<HbMeshLayout*>(widget->layout()); |
4161 HbAnchorLayout *layout = static_cast<HbAnchorLayout*>(widget->layout()); |
4001 if ( layout ) { |
4162 if ( layout ) { |
4002 if (prop.mFlags & HbCss::ExtractedLeft) { |
4163 if (prop.mFlags & HbCss::ExtractedLeft) { |
4003 #ifdef HBSTYLE_DEBUG |
4164 #ifdef HBSTYLE_DEBUG |
4004 qDebug() << "HbStyle::polishItem : -- Setting left override: " << prop.mLeft; |
4165 qDebug() << "HbStyle::polishItem : -- Setting left override: " << prop.mLeft; |
4005 #endif |
4166 #endif |
4006 layout->overrideSpacing(name, Hb::LeftEdge, prop.mLeft); |
4167 overrideSpacing(layout, name, Hb::LeftEdge, prop.mLeft); |
4007 } |
4168 } |
4008 if (prop.mFlags & HbCss::ExtractedRight) { |
4169 if (prop.mFlags & HbCss::ExtractedRight) { |
4009 #ifdef HBSTYLE_DEBUG |
4170 #ifdef HBSTYLE_DEBUG |
4010 qDebug() << "HbStyle::polishItem : -- Setting right override: " << prop.mRight; |
4171 qDebug() << "HbStyle::polishItem : -- Setting right override: " << prop.mRight; |
4011 #endif |
4172 #endif |
4012 layout->overrideSpacing(name, Hb::RightEdge, prop.mRight); |
4173 overrideSpacing(layout, name, Hb::RightEdge, prop.mRight); |
4013 } |
4174 } |
4014 if (prop.mFlags & HbCss::ExtractedTop) { |
4175 if (prop.mFlags & HbCss::ExtractedTop) { |
4015 #ifdef HBSTYLE_DEBUG |
4176 #ifdef HBSTYLE_DEBUG |
4016 qDebug() << "HbStyle::polishItem : -- Setting top override: " << prop.mTop; |
4177 qDebug() << "HbStyle::polishItem : -- Setting top override: " << prop.mTop; |
4017 #endif |
4178 #endif |
4018 layout->overrideSpacing(name, Hb::TopEdge, prop.mTop); |
4179 overrideSpacing(layout, name, Hb::TopEdge, prop.mTop); |
4019 } |
4180 } |
4020 if (prop.mFlags & HbCss::ExtractedBottom) { |
4181 if (prop.mFlags & HbCss::ExtractedBottom) { |
4021 #ifdef HBSTYLE_DEBUG |
4182 #ifdef HBSTYLE_DEBUG |
4022 qDebug() << "HbStyle::polishItem : -- Setting bottom override: " << prop.mBottom; |
4183 qDebug() << "HbStyle::polishItem : -- Setting bottom override: " << prop.mBottom; |
4023 #endif |
4184 #endif |
4024 layout->overrideSpacing(name, Hb::BottomEdge, prop.mBottom); |
4185 overrideSpacing(layout, name, Hb::BottomEdge, prop.mBottom); |
4025 } |
4186 } |
4026 if (prop.mFlags & HbCss::ExtractedCenterH) { |
4187 if (prop.mFlags & HbCss::ExtractedCenterH) { |
4027 #ifdef HBSTYLE_DEBUG |
4188 #ifdef HBSTYLE_DEBUG |
4028 qDebug() << "HbStyle::polishItem : -- Setting centerh override: " << prop.mCenterH; |
4189 qDebug() << "HbStyle::polishItem : -- Setting centerh override: " << prop.mCenterH; |
4029 #endif |
4190 #endif |
4030 layout->overrideSpacing(name, Hb::CenterHEdge, prop.mCenterH); |
4191 overrideSpacing(layout, name, Hb::CenterHEdge, prop.mCenterH); |
4031 } |
4192 } |
4032 if (prop.mFlags & HbCss::ExtractedCenterV) { |
4193 if (prop.mFlags & HbCss::ExtractedCenterV) { |
4033 #ifdef HBSTYLE_DEBUG |
4194 #ifdef HBSTYLE_DEBUG |
4034 qDebug() << "HbStyle::polishItem : -- Setting centerv override: " << prop.mCenterV; |
4195 qDebug() << "HbStyle::polishItem : -- Setting centerv override: " << prop.mCenterV; |
4035 #endif |
4196 #endif |
4036 layout->overrideSpacing(name, Hb::CenterVEdge, prop.mCenterV); |
4197 overrideSpacing(layout, name, Hb::CenterVEdge, prop.mCenterV); |
4037 } |
4198 } |
4038 } |
4199 } |
4039 } |
4200 } |
4040 } |
4201 } |
4041 |
4202 |
4045 Polishes the appearance of the given \a widget. |
4206 Polishes the appearance of the given \a widget. |
4046 |
4207 |
4047 This method should be called only by HbWidget (base class). The inherited |
4208 This method should be called only by HbWidget (base class). The inherited |
4048 classes should not call this method directly, but use the HbWidget's |
4209 classes should not call this method directly, but use the HbWidget's |
4049 polish loop instead. |
4210 polish loop instead. |
4050 |
4211 |
4051 This method reads the CSS and WidgetML definition for a given widget and positions |
4212 This method reads the CSS and WidgetML definition for a given widget and positions |
4052 the sub-elements inside it. Note you need to set the names for the sub-elements |
4213 the sub-elements inside it. Note you need to set the names for the sub-elements |
4053 with HbStyle::setItemName method before this method is called. |
4214 with HbStyle::setItemName method before this method is called. |
4054 |
4215 |
4055 Note that this method is heavy on the system resources and should be called |
4216 Note that this method is heavy on the system resources and should be called |
4056 absolutely when necessary by the widget. |
4217 absolutely when necessary by the widget. |
4057 |
4218 |
4058 \param widget, HbWidget to be polished |
4219 \param widget, HbWidget to be polished |
4059 \param params, style parameters to be returned to the caller |
4220 \param params, style parameters to be returned to the caller |
4060 */ |
4221 */ |
4061 void HbStyle::polish(HbWidget *widget, HbStyleParameters ¶ms) |
4222 void HbStyle::polish(HbWidget *widget, HbStyleParameters ¶ms) |
4062 { |
4223 { |
4127 qDebug() << "HbStyle::polish : Layout name: " << layoutName; |
4288 qDebug() << "HbStyle::polish : Layout name: " << layoutName; |
4128 } |
4289 } |
4129 #endif |
4290 #endif |
4130 |
4291 |
4131 QStringList meshIds; |
4292 QStringList meshIds; |
4132 HbMeshLayout *meshLayout(0); |
4293 HbAnchorLayout *meshLayout(0); |
4133 if (layoutDefined) { |
4294 if (layoutDefined) { |
4134 |
4295 |
4135 QString cachedLayoutName = widgetLayoutNames[widget]; |
4296 QString cachedLayoutName = widgetLayoutNames[widget]; |
4136 bool cached = (cachedLayoutName == layoutName ); |
4297 bool cached = (cachedLayoutName == layoutName ); |
4137 if ( !cached ) { |
4298 if ( !cached ) { |
4141 HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance(); |
4302 HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance(); |
4142 if ( !loader->loadWidgetML(widget, layoutName, sectionName)) { |
4303 if ( !loader->loadWidgetML(widget, layoutName, sectionName)) { |
4143 #ifdef HBSTYLE_DEBUG |
4304 #ifdef HBSTYLE_DEBUG |
4144 qDebug() << "HbStyle::polish : Failed to load WidgetML"; |
4305 qDebug() << "HbStyle::polish : Failed to load WidgetML"; |
4145 #endif |
4306 #endif |
4146 return; |
4307 return; |
4147 } |
4308 } |
4148 widgetLayoutNames[widget] = layoutName; |
4309 widgetLayoutNames[widget] = layoutName; |
4149 if (cachedLayoutName.isNull()) { |
4310 if (cachedLayoutName.isNull()) { |
4150 // Cached for the first time. Connect to destroyed signal. |
4311 // Cached for the first time. Connect to destroyed signal. |
4151 QObject::connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(widgetDestroyed(QObject*))); |
4312 QObject::connect(widget, SIGNAL(destroyed(QObject*)), this, SLOT(widgetDestroyed(QObject*))); |
4154 } else { |
4315 } else { |
4155 qDebug() << "Cached nth time."; |
4316 qDebug() << "Cached nth time."; |
4156 #endif |
4317 #endif |
4157 } |
4318 } |
4158 } |
4319 } |
4159 meshLayout = static_cast<HbMeshLayout*>(widget->layout()); |
4320 meshLayout = static_cast<HbAnchorLayout*>(widget->layout()); |
4160 if (cached) { |
4321 if (cached) { |
4161 #ifdef HBSTYLE_DEBUG |
4322 #ifdef HBSTYLE_DEBUG |
4162 qDebug() << "LayoutName cache hit."; |
4323 qDebug() << "LayoutName cache hit."; |
4163 #endif |
4324 #endif |
4164 meshLayout->clearItemIds(); |
4325 meshLayout->removeMappings(); |
4165 } |
4326 } |
4166 |
4327 |
4167 meshLayout->setItemId(meshLayout, ""); |
4328 meshLayout->setMapping(meshLayout, ""); |
4168 meshIds = meshLayout->nodeIds(); |
4329 meshIds = meshLayout->nodeIds(); |
4169 |
4330 |
4170 } |
4331 } |
4171 |
4332 |
4172 // polish widget and subitems |
4333 // polish widget and subitems |
4174 QList<QGraphicsItem*> list = widget->childItems(); |
4335 QList<QGraphicsItem*> list = widget->childItems(); |
4175 foreach (QGraphicsItem* item, list) { |
4336 foreach (QGraphicsItem* item, list) { |
4176 QString name = HbStyle::itemName(item); |
4337 QString name = HbStyle::itemName(item); |
4177 if ( meshLayout && !name.isEmpty() ) { |
4338 if ( meshLayout && !name.isEmpty() ) { |
4178 // Assuming that all items with "itemName" are widgets. |
4339 // Assuming that all items with "itemName" are widgets. |
4179 meshLayout->setItemId(static_cast<QGraphicsWidget*>(item), name); |
4340 meshLayout->setMapping(static_cast<QGraphicsWidget*>(item), name); |
4180 // Remove from "meshIds" so that we don't call polishItem |
4341 // Remove from "meshIds" so that we don't call polishItem |
4181 // twice for this item. |
4342 // twice for this item. |
4182 meshIds.removeAll(name); |
4343 meshIds.removeAll(name); |
4183 } |
4344 } |
4184 d->polishItem(styleRules, widget, item, name, layoutDefined); |
4345 d->polishItem(styleRules, widget, item, name, layoutDefined); |
4202 \param item, graphics item whose themed parameters are supposed to be updated |
4363 \param item, graphics item whose themed parameters are supposed to be updated |
4203 */ |
4364 */ |
4204 void HbStylePrivate::updateThemedItems( const HbVector<HbCss::StyleRule> &styleRules, |
4365 void HbStylePrivate::updateThemedItems( const HbVector<HbCss::StyleRule> &styleRules, |
4205 QGraphicsItem *item ) const |
4366 QGraphicsItem *item ) const |
4206 { |
4367 { |
4207 |
4368 |
4208 QString name = HbStyle::itemName(item); |
4369 QString name = HbStyle::itemName(item); |
4209 if (name.isEmpty() ) { |
4370 if (name.isEmpty() ) { |
4210 return; |
4371 return; |
4211 } |
4372 } |
4212 |
4373 |
4213 HbTextItem* text = qgraphicsitem_cast<HbTextItem*>( item ); |
4374 HbTextItem* text = qgraphicsitem_cast<HbTextItem*>( item ); |
4214 HbIconItem* iconItem = qgraphicsitem_cast<HbIconItem*>( item ); |
4375 HbIconItem* iconItem = qgraphicsitem_cast<HbIconItem*>( item ); |
4215 HbMarqueeItem* marqueeItem = qgraphicsitem_cast<HbMarqueeItem*>( item ); |
4376 HbMarqueeItem* marqueeItem = qgraphicsitem_cast<HbMarqueeItem*>( item ); |
4216 if(! (text || iconItem || marqueeItem ) ){ |
4377 if(! (text || iconItem || marqueeItem ) ){ |
4217 return; |
4378 return; |
4218 } |
4379 } |
4219 |
4380 |
4220 HbDeviceProfile profile; |
4381 HbDeviceProfile profile; |
4221 const HbVector<HbCss::Declaration> decl = declarations(styleRules, name, 0, profile); |
4382 const HbVector<HbCss::Declaration> decl = declarations(styleRules, name, 0, profile); |
4222 |
4383 |
4223 #ifdef HBSTYLE_DEBUG |
4384 #ifdef HBSTYLE_DEBUG |
4224 qDebug() << "HbStyle::updateThemedItems : -- Number of matching CSS declarations: " << decl.count(); |
4385 qDebug() << "HbStyle::updateThemedItems : -- Number of matching CSS declarations: " << decl.count(); |
4225 #endif |
4386 #endif |
4226 ensureColorParameters(); |
4387 |
4227 HbCss::ValueExtractor extractor(decl, colorParameters, profile); |
4388 HbCss::ValueExtractor extractor(decl, profile); |
4228 |
4389 |
4229 QColor col; |
4390 QColor col; |
4230 bool extracted = extractor.extractColor( col ); |
4391 bool extracted = extractor.extractColor( col ); |
4231 if (!extracted || !col.isValid()) { |
4392 if (!extracted || !col.isValid()) { |
4232 // Setting non black or white default color to make it visisble in black or white theme |
4393 // Setting non black or white default color to make it visisble in black or white theme |
4233 col.setRgb(255,0,255); |
4394 col.setRgb(255,0,255); |
4234 } |
4395 } |
4235 //apply the themed color to text-item |
4396 //apply the themed color to text-item |
4236 if(text) { |
4397 if(text) { |
4237 #ifdef HBSTYLE_DEBUG |
4398 #ifdef HBSTYLE_DEBUG |
4238 if ( !extracted ) { |
4399 if ( !extracted ) { |
4239 qDebug() << "HbStyle::getColor : -- No color information found"; |
4400 qDebug() << "HbStyle::getColor : -- No color information found"; |
4240 } |
4401 } |
4241 #endif |
4402 #endif |
4242 if ( !HbWidgetBasePrivate::d_ptr(text)->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextColor ) ){ |
4403 if ( !HbWidgetBasePrivate::d_ptr(text)->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextColor ) ){ |
4243 text->setTextColor(col); |
4404 text->setTextColor(col); |
4244 HbWidgetBasePrivate::d_ptr(text)->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextColor, false); |
4405 HbWidgetBasePrivate::d_ptr(text)->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextColor, false); |
4245 } |
4406 } |
4246 } |
4407 } |
4247 if (iconItem) { |
4408 if (iconItem) { |
4248 // Applying color to mono-colorised icons from theme. Using setColor() |
4409 // Applying color to mono-colorised icons from theme. Using setColor() |
4249 // here would be wrong. It would lead to loosing the user-supplied color |
4410 // here would be wrong. It would lead to loosing the user-supplied color |
4250 // in some cases so use the special setThemedColor() instead. |
4411 // in some cases so use the special setThemedColor() instead. |
4251 HbIconItemPrivate::d_ptr(iconItem)->setThemedColor( col ); |
4412 HbIconItemPrivate::d_ptr(iconItem)->setThemedColor( col ); |
4252 } |
4413 } |
4253 if(marqueeItem){ |
4414 if(marqueeItem){ |
4254 //applying color to the marquee-item from theme |
4415 //applying color to the marquee-item from theme |
4255 if(!HbWidgetBasePrivate::d_ptr(marqueeItem)->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextColor)) { |
4416 if(!HbWidgetBasePrivate::d_ptr(marqueeItem)->testApiProtectionFlag(HbWidgetBasePrivate::AC_TextColor)) { |
4256 marqueeItem->setTextColor( col ); |
4417 marqueeItem->setTextColor( col ); |
4257 HbWidgetBasePrivate::d_ptr(marqueeItem)->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextColor, false); |
4418 HbWidgetBasePrivate::d_ptr(marqueeItem)->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextColor, false); |
4258 } |
4419 } |
4259 } |
4420 } |
4260 } |
4421 } |
4261 |
4422 |
4262 /*! |
4423 /*! |
4263 HbStyle::updateThemedParams() |
4424 HbStyle::updateThemedParams() |
4264 |
4425 |
4265 Updates the themable parameters of widget (specially those which are specified in css files) |
4426 Updates the themable parameters of widget (specially those which are specified in css files) |
4266 |
4427 |
4296 #ifdef HBSTYLE_DEBUG |
4457 #ifdef HBSTYLE_DEBUG |
4297 qDebug() << "HbStyle::updateThemedParams : No style rules found."; |
4458 qDebug() << "HbStyle::updateThemedParams : No style rules found."; |
4298 #endif |
4459 #endif |
4299 return; |
4460 return; |
4300 } |
4461 } |
4301 |
4462 |
4302 // update themed items |
4463 // update themed items |
4303 QList<QGraphicsItem*> list = widget->childItems(); |
4464 QList<QGraphicsItem*> list = widget->childItems(); |
4304 foreach (QGraphicsItem* item, list) { |
4465 foreach (QGraphicsItem* item, list) { |
4305 d->updateThemedItems(styleRules, item); |
4466 d->updateThemedItems(styleRules, item); |
4306 } |
4467 } |
4307 } |
4468 } |
4308 |
4469 |
4309 /*! |
4470 /*! |
4310 Checkes whether given widget has orienation specific style |
4471 Checkes whether given widget has orienation specific style |
4311 rules. This can be used for optimizing orientation switch. |
4472 rules. This can be used for optimizing orientation switch. |
4312 */ |
4473 */ |
4313 bool HbStyle::hasOrientationSpecificStyleRules(HbWidget *widget) |
4474 bool HbStyle::hasOrientationSpecificStyleRules(HbWidget *widget) |
4314 { |
4475 { |
4315 HbLayeredStyleLoader *styleLoader = |
4476 HbLayeredStyleLoader *styleLoader = |
4316 HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Layouts); |
4477 HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Layouts); |
4317 NODEPTR_N(widget); |
4478 NODEPTR_N(widget); |
4318 return styleLoader->hasOrientationSpecificStyleRules(n); |
4479 return styleLoader->hasOrientationSpecificStyleRules(n); |
4319 } |
4480 } |
4320 |
4481 |
4341 \param item, graphics item |
4502 \param item, graphics item |
4342 \param name, name to be set |
4503 \param name, name to be set |
4343 */ |
4504 */ |
4344 void HbStyle::setItemName( QGraphicsItem *item, const QString &name ) |
4505 void HbStyle::setItemName( QGraphicsItem *item, const QString &name ) |
4345 { |
4506 { |
4346 if (item && itemName(item) != name) { |
4507 QString originalName = itemName(item); |
4508 if (item && originalName != name) { |
|
4347 item->setData( ItemName, name ); |
4509 item->setData( ItemName, name ); |
4348 QGraphicsItem* parent = item->parentItem(); |
4510 QGraphicsItem* parent = item->parentItem(); |
4349 QGraphicsLayoutItem* lItem = (item->isWidget()) ? (QGraphicsLayoutItem*)static_cast<QGraphicsWidget*>(item) : 0; |
4511 QGraphicsLayoutItem* lItem = (item->isWidget()) ? (QGraphicsLayoutItem*)static_cast<QGraphicsWidget*>(item) : 0; |
4350 if (lItem && parent && parent->isWidget()) { |
4512 if (lItem && parent && parent->isWidget()) { |
4351 QGraphicsWidget* parentW = static_cast<QGraphicsWidget*>(parent); |
4513 QGraphicsWidget* parentW = static_cast<QGraphicsWidget*>(parent); |
4352 if ( parentW->layout() && widgetLayoutNames.contains(parentW) ) { |
4514 if ( parentW->layout() && widgetLayoutNames.contains(parentW) ) { |
4353 HbMeshLayout* layout = static_cast<HbMeshLayout*>(parentW->layout()); |
4515 HbAnchorLayout* layout = static_cast<HbAnchorLayout*>(parentW->layout()); |
4354 if ( layout->indexOf(lItem) != -1 ) { |
4516 if ( layout->indexOf(lItem) != -1 ) { |
4355 layout->setItemId(lItem, name.isEmpty() ? QString() : name); |
4517 if( name.isEmpty() ) { |
4518 layout->removeMapping(originalName); |
|
4519 } else { |
|
4520 if ( !originalName.isEmpty() ) { |
|
4521 layout->removeMapping(originalName); |
|
4522 } |
|
4523 layout->setMapping(lItem, name); |
|
4524 } |
|
4356 } |
4525 } |
4357 } |
4526 } |
4358 } |
4527 } |
4359 } |
4528 } |
4360 } |
4529 } |
4373 ? item->data( ItemName ).toString() |
4542 ? item->data( ItemName ).toString() |
4374 : QString(); |
4543 : QString(); |
4375 } |
4544 } |
4376 |
4545 |
4377 /*! |
4546 /*! |
4378 Returns a value of a global style parameter. The value is returned in pixels. |
4547 Returns a value of a global style parameter. The value is returned in pixels. |
4379 |
4548 |
4380 Available parameters can be found from hbglobalparameters.css. By using these |
4549 Available parameters can be found from hbglobalparameters.css. By using these |
4381 parameters applications get consistent look. |
4550 parameters applications get consistent look. |
4382 |
4551 |
4383 \param param Name of the global parameter. |
4552 \param param Name of the global parameter. |
4411 bool retVal = valueExtractor.extractExpressionValue(expressionString, value); |
4580 bool retVal = valueExtractor.extractExpressionValue(expressionString, value); |
4412 value = -value; |
4581 value = -value; |
4413 return retVal; |
4582 return retVal; |
4414 } |
4583 } |
4415 |
4584 |
4416 return valueExtractor.extractVariableValue(param, value); |
4585 return valueExtractor.extractVariableValue(param, value); |
4417 } |
4586 } |
4418 |
4587 |
4419 /*! |
4588 /*! |
4420 Returns copy of all global style parameters. Both names and values |
4589 Returns copy of all global style parameters. Both names and values |
4421 of the parameters are returned. The values are returned in pixels. |
4590 of the parameters are returned. The values are returned in pixels. |
4422 |
4591 |
4423 Available parameters can be found from hbglobalparameters.css. By using these |
4592 Available parameters can be found from hbglobalparameters.css. By using these |
4424 parameters applications get consistent look. Usage of this API (instead of parameter) |
4593 parameters applications get consistent look. Usage of this API (instead of parameter) |
4425 is recommended if an application needs to fetch several parameters in one place. |
4594 is recommended if an application needs to fetch several parameters in one place. |
4449 } |
4618 } |
4450 } |
4619 } |
4451 |
4620 |
4452 /*! |
4621 /*! |
4453 Returns values for widget specific style parameters. The names of the parameters |
4622 Returns values for widget specific style parameters. The names of the parameters |
4454 are passed in with \a params. |
4623 are passed in with \a params. |
4455 |
4624 |
4456 This method should be used only if you need to access widget specific parameters out |
4625 This method should be used only if you need to access widget specific parameters out |
4457 of the polish loop. It is more efficient to use HbWidget::polish(HbStyleParameters ¶ms) |
4626 of the polish loop. It is more efficient to use HbWidget::polish(HbStyleParameters ¶ms) |
4458 if you don't need to access the parameters before the (first) polish event. |
4627 if you don't need to access the parameters before the (first) polish event. |
4459 |
4628 |
4506 HbStylePrivate::HbStylePrivate() |
4675 HbStylePrivate::HbStylePrivate() |
4507 { |
4676 { |
4508 nextAvailableId = HbStyle::P_CustomBase; |
4677 nextAvailableId = HbStyle::P_CustomBase; |
4509 HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance(); |
4678 HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance(); |
4510 if(loader){ |
4679 if(loader){ |
4511 loader->addFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts, |
4680 loader->addFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts, |
4512 HbLayeredStyleLoader::Priority_Core); |
4681 HbLayeredStyleLoader::Priority_Core); |
4513 loader->addFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors, |
4682 loader->addFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors, |
4514 HbLayeredStyleLoader::Priority_Core); |
4683 HbLayeredStyleLoader::Priority_Core); |
4515 } |
4684 } |
4516 } |
4685 } |
4517 |
4686 |
4518 /*! |
4687 /*! |
4519 \internal |
4688 \internal |
4520 */ |
4689 */ |
4521 HbStylePrivate::~HbStylePrivate() |
4690 HbStylePrivate::~HbStylePrivate() |
4522 { |
4691 { |
4523 layoutParameters.clear(); |
4692 layoutParameters.clear(); |
4524 colorParameters.clear(); |
|
4525 |
4693 |
4526 HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance(); |
4694 HbWidgetStyleLoader *loader = HbWidgetStyleLoader::instance(); |
4527 if(loader){ |
4695 if(loader){ |
4528 loader->removeFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts, |
4696 loader->removeFilePath(STYLE_LOCATION, HbLayeredStyleLoader::Concern_Layouts, |
4529 HbLayeredStyleLoader::Priority_Core); |
4697 HbLayeredStyleLoader::Priority_Core); |
4530 loader->removeFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors, |
4698 loader->removeFilePath(COLOR_STYLE_LOCATION, HbLayeredStyleLoader::Concern_Colors, |
4531 HbLayeredStyleLoader::Priority_Core); |
4699 HbLayeredStyleLoader::Priority_Core); |
4532 } |
4700 } |
4533 } |
|
4534 |
|
4535 void HbStylePrivate::_q_onThemeChanged() |
|
4536 { |
|
4537 colorParameters.clear(); |
|
4538 } |
4701 } |
4539 |
4702 |
4540 /*! |
4703 /*! |
4541 \internal |
4704 \internal |
4542 */ |
4705 */ |
4571 } |
4734 } |
4572 } |
4735 } |
4573 |
4736 |
4574 default: |
4737 default: |
4575 break; |
4738 break; |
4576 |
4739 |
4577 } |
4740 } |
4578 |
4741 |
4579 return QString(); |
4742 return QString(); |
4580 } |
4743 } |
4581 |
4744 |
4608 /*! |
4771 /*! |
4609 \internal |
4772 \internal |
4610 */ |
4773 */ |
4611 HbStyleInterface *HbStylePrivate::stylePluginInterface( HbStyle::Primitive primitive ) const |
4774 HbStyleInterface *HbStylePrivate::stylePluginInterface( HbStyle::Primitive primitive ) const |
4612 { |
4775 { |
4613 |
4776 |
4614 if (customPrimitives.contains(primitive)) { |
4777 if (customPrimitives.contains(primitive)) { |
4615 HbStyleInterfaceInfo* info = customPrimitives.value(primitive); |
4778 HbStyleInterfaceInfo* info = customPrimitives.value(primitive); |
4616 QObject* pluginInstance = info->loader->instance(); |
4779 QObject* pluginInstance = info->loader->instance(); |
4617 HbStyleInterface *stylePlugin = qobject_cast<HbStyleInterface *>(pluginInstance); |
4780 HbStyleInterface *stylePlugin = qobject_cast<HbStyleInterface *>(pluginInstance); |
4618 return stylePlugin; |
4781 return stylePlugin; |
4685 layoutParameters.insert(decl.property, decl); |
4848 layoutParameters.insert(decl.property, decl); |
4686 } |
4849 } |
4687 } |
4850 } |
4688 } |
4851 } |
4689 |
4852 |
4690 void HbStylePrivate::ensureColorParameters() const |
|
4691 { |
|
4692 if (colorParameters.isEmpty()) { |
|
4693 HbLayeredStyleLoader *styleLoader = HbLayeredStyleLoader::getStack(HbLayeredStyleLoader::Concern_Colors); |
|
4694 styleLoader->variableRuleSets(&colorParameters); |
|
4695 } |
|
4696 } |
|
4697 |
|
4698 /*! |
4853 /*! |
4699 \internal |
4854 \internal |
4700 */ |
4855 */ |
4701 void HbStylePrivate::clearStyleSheetCaches() |
4856 void HbStylePrivate::clearStyleSheetCaches() |
4702 { |
4857 { |
4703 widgetLayoutNames.clear(); |
4858 widgetLayoutNames.clear(); |
4704 styleRulesCache.clear(); |
4859 styleRulesCache.clear(); |
4705 colorParameters.clear(); |
|
4706 } |
4860 } |
4707 |
4861 |
4708 HbWidgetBasePrivate *HbStylePrivate::widgetBasePrivate(HbWidgetBase *widgetBase) const |
4862 HbWidgetBasePrivate *HbStylePrivate::widgetBasePrivate(HbWidgetBase *widgetBase) const |
4709 { |
4863 { |
4710 return HbWidgetBasePrivate::d_ptr(widgetBase); |
4864 return HbWidgetBasePrivate::d_ptr(widgetBase); |