21 ** If you have questions regarding the use of this file, please contact |
21 ** If you have questions regarding the use of this file, please contact |
22 ** Nokia at developer.feedback@nokia.com. |
22 ** Nokia at developer.feedback@nokia.com. |
23 ** |
23 ** |
24 ****************************************************************************/ |
24 ****************************************************************************/ |
25 |
25 |
26 #include "hbstyleoptionslider.h" |
26 #include "hbstyleoptionslider_p.h" |
27 #include "hbstyleoptionsliderelement_p.h" |
27 #include "hbstyleoptionsliderelement_p.h" |
28 #include "hbstyleoptionpushbutton.h" |
28 #include "hbstyleoptionpushbutton_p.h" |
29 #include "hbstyleoptiontoolbutton.h" |
29 #include "hbstyleoptiontoolbutton_p.h" |
30 #include "hbstyleoptiontooltip.h" |
30 #include "hbstyleoptiontooltip_p.h" |
31 #include "hbstyleoptionprogressbar.h" |
31 #include "hbstyleoptionprogressbar_p.h" |
32 #include "hbstyleoptionabstractviewitem.h" |
32 #include "hbstyleoptionabstractviewitem_p.h" |
33 #include "hbstyleoptionlistviewitem.h" |
33 #include "hbstyleoptionlistviewitem_p.h" |
34 #include "hbstyleoptionmenuitem.h" |
34 #include "hbstyleoptionmenuitem_p.h" |
35 #include "hbstyleoptionlabel.h" |
35 #include "hbstyleoptionlabel_p.h" |
36 #include "hbstyleoptionscrollbar.h" |
36 #include "hbstyleoptionscrollbar_p.h" |
37 #include "hbstyleoptiontoolbarextension.h" |
37 #include "hbstyleoptiongridviewitem_p.h" |
38 #include "hbstyleoptiongridviewitem.h" |
38 #include "hbstyleoptioncheckbox_p.h" |
39 #include "hbstyleoptioncheckbox.h" |
|
40 #include "hbiconloader_p.h" |
39 #include "hbiconloader_p.h" |
41 #include "hbstyleoptiontitlepane.h" |
40 #include "hbstyleoptiontitlepane_p.h" |
42 #include "hbstyleoptionstatusbar_p.h" |
41 #include "hbstyleoptionstatusbar_p.h" |
43 #include "hbstyleoptionindicatorgroup.h" |
42 #include "hbstyleoptionindicatorgroup_p.h" |
44 #include "hbstyleoptionprogressdialog.h" |
43 #include "hbstyleoptionprogressdialog_p.h" |
45 #include "hbstyleoptionnotificationdialog.h" |
44 #include "hbstyleoptionnotificationdialog_p.h" |
46 #include "hbstyleoptiontreeviewitem.h" |
45 #include "hbstyleoptiontreeviewitem_p.h" |
47 #include "hbstyleoptioncolorgridviewitem.h" |
46 #include "hbstyleoptioncolorgridviewitem_p.h" |
48 #include "hbstyleoptionmessagebox.h" |
47 #include "hbstyleoptionmessagebox_p.h" |
49 #include "hbstyleoptionsoftkey.h" // deprecated |
48 #include "hbstyleoptionnavigationbutton_p.h" |
50 #include "hbstyleoptionnavigationbutton.h" |
49 #include "hbstyleoptionindicatorbutton_p.h" |
51 #include "hbstyleoptionindicatorbutton.h" |
|
52 #include "hbstyleoptionsignalindicator_p.h" |
50 #include "hbstyleoptionsignalindicator_p.h" |
53 #include "hbstyleoptionbatteryindicator_p.h" |
51 #include "hbstyleoptionbatteryindicator_p.h" |
54 #include "hbstyle_p.h" |
52 #include "hbstyle_p.h" |
55 #include "hbstyleloader.h" |
53 #include "hbstyleloader.h" |
56 #include "hbwidgetloader_p.h" |
54 #include "hbwidgetloader_p.h" |
57 #include "hbstyleoptionratingslider.h" |
55 #include "hbwidget_p.h" |
58 #include "hbstyleoptiondataformviewitem.h" |
56 #include "hbstyleoptionratingslider_p.h" |
|
57 #include "hbstyleoptiondataformviewitem_p.h" |
59 #include "hbstyleoptiondatagroup_p.h" |
58 #include "hbstyleoptiondatagroup_p.h" |
60 #include "hbstyleoptiondatagroupheadingwidget_p.h" |
59 #include "hbstyleoptiondatagroupheadingwidget_p.h" |
61 #include "hbstyleoptiondataform.h" |
60 #include "hbstyleoptiondataform_p.h" |
62 #include "hbstyleoptiongroupbox.h" |
61 #include "hbstyleoptiongroupbox_p.h" |
63 #include "hbstyleoptionindexfeedback.h" |
62 #include "hbstyleoptionindexfeedback_p.h" |
64 #include "hbstyleoptioncombobox.h" |
63 #include "hbstyleoptioncombobox_p.h" |
65 #include "hbstyleoptioninputdialog.h" |
64 #include "hbstyleoptioninputdialog_p.h" |
66 #include "hbstyleoptionprogresssliderhandle_p.h" |
65 #include "hbstyleoptionprogresssliderhandle_p.h" |
67 #include "hbstyleoptionprogressslider.h" |
66 #include "hbstyleoptionprogressslider_p.h" |
68 |
67 |
69 #include <hbicon.h> |
68 #include <hbicon.h> |
70 #include <hbstyle.h> |
69 #include <hbstyle.h> |
71 #include <hbframedrawer.h> |
70 #include <hbframedrawer.h> |
72 #include <hbiconitem.h> |
71 #include <hbiconitem.h> |
845 // return the base ID of the primitives enumeration |
844 // return the base ID of the primitives enumeration |
846 return d->registeredPlugins.value(pluginName)->primitiveBaseId; |
845 return d->registeredPlugins.value(pluginName)->primitiveBaseId; |
847 } |
846 } |
848 |
847 |
849 // load the plugin |
848 // load the plugin |
850 QPluginLoader* loader = new QPluginLoader(pluginName); |
849 HbPluginLoader* loader = new HbPluginLoader(pluginName); |
851 if (loader == 0) |
850 if (!loader) |
852 return -1; |
851 return -1; |
853 |
852 |
854 // get the instance pointer |
853 // get the instance pointer |
855 QObject* pluginInstance = loader->instance(); |
854 QObject* pluginInstance = loader->instance(); |
856 if (pluginInstance == 0) { |
855 if (!pluginInstance) { |
857 delete loader; |
|
858 |
856 |
859 // try the additional paths |
857 // try the additional paths |
860 QFileInfo fileInfo( pluginName ); |
858 QFileInfo fileInfo(pluginName); |
861 foreach( QString additionalPath, hbInstance->libraryPaths() ) { |
859 foreach (QString additionalPath, hbInstance->libraryPaths()) { |
862 const QDir pluginDir(additionalPath); |
860 const QDir pluginDir(additionalPath); |
863 loader = new QPluginLoader(pluginDir.absoluteFilePath(fileInfo.fileName())); |
861 loader->setPluginName(pluginDir.absoluteFilePath(fileInfo.fileName())); |
864 if ( loader ) { |
862 pluginInstance = loader->instance(); |
865 pluginInstance = loader->instance(); |
863 if (pluginInstance) { |
866 if ( !pluginInstance ) { |
864 break; |
867 delete loader; |
|
868 } else { |
|
869 break; |
|
870 } |
|
871 } |
865 } |
872 } |
866 } |
873 |
867 |
874 if ( !pluginInstance ) { |
868 if (!pluginInstance) { |
|
869 delete loader; |
875 return -1; |
870 return -1; |
876 } |
871 } |
877 } |
872 } |
878 |
873 |
879 HbStyleInterface *stylePlugin = qobject_cast<HbStyleInterface *>(pluginInstance); |
874 HbStyleInterface *stylePlugin = qobject_cast<HbStyleInterface *>(pluginInstance); |
1382 HbIconItem *n = new HbIconItem(parent); |
1376 HbIconItem *n = new HbIconItem(parent); |
1383 n->setFlags(HbIcon::Colorized); |
1377 n->setFlags(HbIcon::Colorized); |
1384 setItemName(n, QLatin1String("icon4")); |
1378 setItemName(n, QLatin1String("icon4")); |
1385 return n; |
1379 return n; |
1386 } |
1380 } |
1387 case P_IndicatorGroup_signalicon: // deprecated |
|
1388 case P_SignalIndicator_icon: |
1381 case P_SignalIndicator_icon: |
1389 { |
1382 { |
1390 HbIconItem *n = new HbIconItem(parent); |
1383 HbIconItem *n = new HbIconItem(parent); |
1391 n->setFlags(HbIcon::Colorized); |
1384 n->setFlags(HbIcon::Colorized); |
1392 setItemName(n, QLatin1String("icon")); |
1385 setItemName(n, QLatin1String("icon")); |
1393 return n; |
1386 return n; |
1394 } |
1387 } |
1395 case P_SignalLevel_background: |
1388 case P_SignalLevel_background: |
1396 { |
1389 { |
1397 HbIconItem *n = new HbIconItem(parent); |
1390 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
1398 n->setZValue(-1); |
1391 n->setZValue(-1); |
1399 setItemName(n, QLatin1String("background")); |
1392 setItemName(n, QLatin1String("background")); |
1400 return n; |
1393 return n; |
1401 } |
1394 } |
1402 case P_SignalLevel_icon: |
1395 case P_SignalLevel_icon: |
1403 { |
1396 { |
1404 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
1397 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
1405 setItemName(n, QLatin1String("levelicon")); |
1398 setItemName(n, QLatin1String("levelicon")); |
1406 return n; |
1399 return n; |
1407 } |
1400 } |
1408 case P_IndicatorGroup_batteryicon: // deprecated |
|
1409 case P_BatteryIndicator_icon: |
1401 case P_BatteryIndicator_icon: |
1410 { |
1402 { |
1411 HbIconItem *n = new HbIconItem(parent); |
1403 HbIconItem *n = new HbIconItem(parent); |
1412 n->setFlags(HbIcon::Colorized); |
1404 n->setFlags(HbIcon::Colorized); |
1413 setItemName(n, QLatin1String("icon")); |
1405 setItemName(n, QLatin1String("icon")); |
1414 return n; |
1406 return n; |
1415 } |
1407 } |
1416 case P_BatteryLevel_background: |
1408 case P_BatteryLevel_background: |
1417 { |
1409 { |
1418 HbIconItem *n = new HbIconItem(parent); |
1410 HbIndicatorLevelIconItem *n = new HbIndicatorLevelIconItem(parent); |
1419 n->setZValue(-1); |
1411 n->setZValue(-1); |
1420 setItemName(n, QLatin1String("background")); |
1412 setItemName(n, QLatin1String("background")); |
1421 return n; |
1413 return n; |
1422 } |
1414 } |
1423 case P_BatteryLevel_icon: |
1415 case P_BatteryLevel_icon: |
1554 HbIconItem *n = new HbIconItem(QString(), parent); |
1549 HbIconItem *n = new HbIconItem(QString(), parent); |
1555 return n; |
1550 return n; |
1556 } |
1551 } |
1557 |
1552 |
1558 case P_ItemViewItem_background: { |
1553 case P_ItemViewItem_background: { |
1559 HbIconItem *iconItem = new HbIconItem(parent); |
1554 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent)); |
1560 setItemName(iconItem, QLatin1String("background")); |
1555 setItemName(iconItem, QLatin1String("background")); |
1561 return iconItem; |
1556 return iconItem; |
1562 } |
1557 } |
1563 |
1558 |
1564 case P_ListViewItem_text: { |
1559 case P_ListViewItem_text: { |
1565 HbTextItem *textItem = new HbTextItem(parent); |
1560 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent)); |
1566 textItem->setMinimumLines(1); |
1561 |
1567 textItem->setMaximumLines(1); |
|
1568 textItem->setTextWrapping(Hb::TextNoWrap); |
|
1569 return textItem; |
1562 return textItem; |
1570 } |
1563 } |
1571 |
1564 |
1572 case P_ListViewItem_richtext: { |
1565 case P_ListViewItem_richtext: { |
1573 HbRichTextItem *textItem = new HbRichTextItem(parent); |
1566 HbRichTextItem *textItem = q_check_ptr(new HbRichTextItem(parent)); |
1574 return textItem; |
1567 return textItem; |
1575 } |
1568 } |
1576 |
1569 |
1577 case P_GridViewItem_text: { |
1570 case P_GridViewItem_text: { |
1578 HbTextItem *textItem = new HbTextItem(parent); |
1571 HbTextItem *textItem = q_check_ptr(new HbTextItem(parent)); |
1579 // caching do not work properly - text is not refreshed immediatelly |
1572 // caching do not work properly - text is not refreshed immediatelly |
1580 //textItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache); |
1573 //textItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache); |
1581 setItemName(textItem, QLatin1String("text")); |
1574 setItemName(textItem, QLatin1String("text")); |
1582 textItem->setMinimumLines(1); |
|
1583 textItem->setMaximumLines(1); |
|
1584 textItem->setTextWrapping(Hb::TextNoWrap); |
|
1585 textItem->setSizePolicy( QSizePolicy::Ignored, QSizePolicy::Preferred ); |
|
1586 return textItem; |
1575 return textItem; |
1587 } |
1576 } |
1588 |
1577 |
1589 case P_ListViewItem_icon: |
1578 case P_ListViewItem_icon: |
1590 return new HbIconItem(parent); |
1579 return q_check_ptr(new HbIconItem(parent)); |
1591 |
1580 |
1592 case P_ColorGridViewItem_colorIcon: |
1581 case P_ColorGridViewItem_colorIcon: |
1593 return new HbIconItem("qtg_graf_colorpicker_mask", parent); |
1582 return new HbIconItem("qtg_graf_colorpicker_mask", parent); |
1594 case P_ColorGridViewItem_borderIcon: |
1583 case P_ColorGridViewItem_borderIcon: |
1595 return new HbIconItem("qtg_graf_colorpicker_filled", parent); |
1584 return new HbIconItem("qtg_graf_colorpicker_filled", parent); |
1596 case P_ColorGridViewItem_checkIcon: |
1585 case P_ColorGridViewItem_checkIcon: |
1597 return new HbIconItem("qtg_small_tick", parent); |
1586 return new HbIconItem("qtg_small_tick", parent); |
1598 |
1587 |
1599 case P_TreeViewItem_expandicon: { |
1588 case P_TreeViewItem_expandicon: { |
1600 HbIconItem *iconItem = new HbIconItem(parent); |
1589 HbIconItem *iconItem = q_check_ptr(new HbIconItem(parent)); |
1601 setItemName(iconItem, QLatin1String("subitem-indicator")); |
1590 setItemName(iconItem, QLatin1String("subitem-indicator")); |
1602 return iconItem; |
1591 return iconItem; |
1603 } |
1592 } |
1604 |
1593 |
1605 case P_SelectionControl_selectionstart://fallthrough |
1594 case P_SelectionControl_selectionstart://fallthrough |
1623 case P_ComboBox_button: { |
1612 case P_ComboBox_button: { |
1624 HbIconItem *n = new HbIconItem(QString(), parent); |
1613 HbIconItem *n = new HbIconItem(QString(), parent); |
1625 return n; |
1614 return n; |
1626 } |
1615 } |
1627 case P_ItemViewItem_focus: { |
1616 case P_ItemViewItem_focus: { |
1628 HbFrameItem *item = new HbFrameItem(parent); |
1617 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent)); |
1629 setItemName(item, QLatin1String("focus-indicator")); |
1618 //setItemName(item, QLatin1String("focus-indicator")); |
1630 return item; |
1619 return item; |
1631 } |
1620 } |
1632 case P_ItemHighlight_background: |
1621 case P_ItemHighlight_background: |
1633 return new HbFrameItem(parent); |
1622 return new HbFrameItem(parent); |
1634 |
1623 |
1635 case P_ItemViewItem_frame: { |
1624 case P_ItemViewItem_frame: { |
1636 HbFrameItem *item = new HbFrameItem(parent); |
1625 HbFrameItem *item = q_check_ptr(new HbFrameItem(parent)); |
1637 setItemName(item,"frame"); |
1626 setItemName(item,"frame"); |
1638 return item; |
1627 return item; |
1639 } |
1628 } |
1640 case P_ScrollArea_continuationbottom: |
1629 case P_ScrollArea_continuationbottom: |
1641 { |
1630 { |
1757 { |
1746 { |
1758 if (const HbStyleOptionGroupBox *opt = |
1747 if (const HbStyleOptionGroupBox *opt = |
1759 qstyleoption_cast<const HbStyleOptionGroupBox*>(option)) { |
1748 qstyleoption_cast<const HbStyleOptionGroupBox*>(option)) { |
1760 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1749 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1761 if (opt->collapsed) { |
1750 if (opt->collapsed) { |
|
1751 iconItem->setIconName(QLatin1String("qtg_small_expand")); |
|
1752 } else { |
1762 iconItem->setIconName(QLatin1String("qtg_small_collapse")); |
1753 iconItem->setIconName(QLatin1String("qtg_small_collapse")); |
1763 } else { |
|
1764 iconItem->setIconName(QLatin1String("qtg_small_expand")); |
|
1765 } |
1754 } |
1766 } |
1755 } |
1767 break; |
1756 break; |
1768 } |
1757 } |
1769 case P_DataGroup_icon: |
1758 case P_DataGroup_icon: |
1770 { |
1759 { |
1771 if (const HbStyleOptionDataGroupHeadingWidget *opt = |
1760 if (const HbStyleOptionDataGroupHeadingWidget *opt = |
1772 qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget*>(option)) { |
1761 qstyleoption_cast<const HbStyleOptionDataGroupHeadingWidget*>(option)) { |
1773 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1762 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
1774 if (opt->expanded) { |
1763 if (opt->expanded) { |
|
1764 iconItem->setIconName(QLatin1String("qtg_small_collapse")); |
|
1765 } else { |
1775 iconItem->setIconName(QLatin1String("qtg_small_expand")); |
1766 iconItem->setIconName(QLatin1String("qtg_small_expand")); |
1776 } else { |
|
1777 iconItem->setIconName(QLatin1String("qtg_small_collapse")); |
|
1778 } |
1767 } |
1779 } |
1768 } |
1780 break; |
1769 break; |
1781 } |
1770 } |
1782 case P_DataItem_icon: |
1771 case P_DataItem_icon: |
2127 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
2116 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
2128 textItem->setText(opt->timeText); |
2117 textItem->setText(opt->timeText); |
2129 } |
2118 } |
2130 break; |
2119 break; |
2131 } |
2120 } |
2132 case P_IndicatorGroup_background: { // deprecated |
2121 |
2133 const HbStyleOptionIndicatorGroup *opt = qstyleoption_cast<const HbStyleOptionIndicatorGroup *>(option); |
|
2134 |
|
2135 if (opt) { |
|
2136 HbIconItem *iconItem = static_cast<HbIconItem*>( item ); |
|
2137 iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio); |
|
2138 if (opt->direction == Qt::LeftToRight) { |
|
2139 if (opt->mode == QIcon::Active) { |
|
2140 if (opt->transparent) { |
|
2141 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_l")); |
|
2142 } else { |
|
2143 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_l")); |
|
2144 } |
|
2145 } else if (opt->mode == QIcon::Selected) { |
|
2146 if (opt->transparent) { |
|
2147 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_latched_l")); |
|
2148 } else { |
|
2149 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_latched_l")); |
|
2150 } |
|
2151 } else { |
|
2152 if (opt->transparent) { |
|
2153 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l")); |
|
2154 } else { |
|
2155 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l")); |
|
2156 } |
|
2157 } |
|
2158 } else { |
|
2159 if (opt->mode == QIcon::Active) { |
|
2160 if (opt->transparent) { |
|
2161 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_r")); |
|
2162 } else { |
|
2163 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_r")); |
|
2164 } |
|
2165 } else if (opt->mode == QIcon::Selected) { |
|
2166 if (opt->transparent) { |
|
2167 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_latched_r")); |
|
2168 } else { |
|
2169 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_latched_r")); |
|
2170 } |
|
2171 } else { |
|
2172 if (opt->transparent) { |
|
2173 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_r")); |
|
2174 } else { |
|
2175 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_r")); |
|
2176 } |
|
2177 } |
|
2178 } |
|
2179 } |
|
2180 break; |
|
2181 } |
|
2182 |
|
2183 case P_IndicatorGroup_icon1: |
2122 case P_IndicatorGroup_icon1: |
2184 case P_IndicatorGroup_icon2: |
2123 case P_IndicatorGroup_icon2: |
2185 case P_IndicatorGroup_icon3: |
2124 case P_IndicatorGroup_icon3: |
2186 case P_IndicatorGroup_icon4: |
2125 case P_IndicatorGroup_icon4: |
2187 { |
2126 { |
2258 iconItem->setIconName("qtg_graf_signal_bg"); |
2200 iconItem->setIconName("qtg_graf_signal_bg"); |
2259 break; |
2201 break; |
2260 } |
2202 } |
2261 iconItem->setValue(opt->signalValue); |
2203 iconItem->setValue(opt->signalValue); |
2262 iconItem->setDirection(HbIndicatorLevelIconItem::LeftToRight); |
2204 iconItem->setDirection(HbIndicatorLevelIconItem::LeftToRight); |
2263 } |
2205 iconItem->update(); |
2264 break; |
2206 } |
2265 } |
2207 break; |
2266 case P_BatteryIndicator_icon: |
2208 } |
2267 case P_IndicatorGroup_batteryicon: { // deprecated |
2209 case P_BatteryIndicator_icon: { |
2268 if (option) { |
2210 if (option) { |
2269 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2211 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2270 iconItem->setIconName("qtg_status_battery"); |
2212 iconItem->setIconName("qtg_status_battery"); |
2271 } |
2213 } |
2272 break; |
2214 break; |
2273 } |
2215 } |
2274 case P_BatteryLevel_background: { |
2216 case P_BatteryLevel_background: { |
2275 if (option) { |
2217 const HbStyleOptionBatteryIndicator *opt = qstyleoption_cast<const HbStyleOptionBatteryIndicator *>(option); |
2276 HbIconItem *iconItem = static_cast<HbIconItem*>(item); |
2218 if (opt) { |
|
2219 HbIndicatorLevelIconItem *iconItem = static_cast<HbIndicatorLevelIconItem*>(item); |
2277 iconItem->setIconName("qtg_graf_battery_bg"); |
2220 iconItem->setIconName("qtg_graf_battery_bg"); |
|
2221 iconItem->setValue(100 - opt->batteryValue); |
|
2222 iconItem->setDirection(HbIndicatorLevelIconItem::LeftToRight); |
|
2223 iconItem->update(); |
2278 } |
2224 } |
2279 break; |
2225 break; |
2280 } |
2226 } |
2281 case P_BatteryLevel_icon: { |
2227 case P_BatteryLevel_icon: { |
2282 const HbStyleOptionBatteryIndicator *opt = qstyleoption_cast<const HbStyleOptionBatteryIndicator *>(option); |
2228 const HbStyleOptionBatteryIndicator *opt = qstyleoption_cast<const HbStyleOptionBatteryIndicator *>(option); |
2299 iconItem->setIconName("qtg_graf_battery_bg"); |
2245 iconItem->setIconName("qtg_graf_battery_bg"); |
2300 break; |
2246 break; |
2301 } |
2247 } |
2302 iconItem->setValue(opt->batteryValue); |
2248 iconItem->setValue(opt->batteryValue); |
2303 iconItem->setDirection(HbIndicatorLevelIconItem::RightToLeft); |
2249 iconItem->setDirection(HbIndicatorLevelIconItem::RightToLeft); |
2304 } |
2250 iconItem->update(); |
2305 break; |
|
2306 } |
|
2307 case P_Softkey_background:{ // deprecated |
|
2308 const HbStyleOptionSoftKey *opt = qstyleoption_cast<const HbStyleOptionSoftKey *>(option); |
|
2309 |
|
2310 if (opt) { |
|
2311 |
|
2312 switch (opt->mKey) |
|
2313 { |
|
2314 case Hb::PrimarySoftKey: |
|
2315 // does not exist... |
|
2316 break; |
|
2317 case Hb::SecondarySoftKey: |
|
2318 { |
|
2319 if (opt) { |
|
2320 HbIconItem *iconItem = static_cast<HbIconItem*>( item ); |
|
2321 if (opt->direction == Qt::LeftToRight) { |
|
2322 if (opt->transparent) { |
|
2323 if (opt->mode == QIcon::Active) { |
|
2324 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_r")); |
|
2325 } else { |
|
2326 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_r")); |
|
2327 } |
|
2328 } else { |
|
2329 if (opt->mode == QIcon::Active) { |
|
2330 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_r")); |
|
2331 } else { |
|
2332 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_r")); |
|
2333 } |
|
2334 } |
|
2335 } else { |
|
2336 if (opt->transparent) { |
|
2337 if (opt->mode == QIcon::Active) { |
|
2338 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_l")); |
|
2339 } else { |
|
2340 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l")); |
|
2341 } |
|
2342 } else { |
|
2343 if (opt->mode == QIcon::Active) { |
|
2344 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_l")); |
|
2345 } else { |
|
2346 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l")); |
|
2347 } |
|
2348 } |
|
2349 } |
|
2350 } |
|
2351 } |
|
2352 break; |
|
2353 case Hb::MiddleSoftKey: |
|
2354 // does not exist... |
|
2355 break; |
|
2356 default: |
|
2357 break; |
|
2358 } |
|
2359 } |
2251 } |
2360 break; |
2252 break; |
2361 } |
2253 } |
2362 |
2254 |
2363 case P_NavigationButton_background: { |
2255 case P_NavigationButton_background: { |
2364 const HbStyleOptionNavigationButton *opt = qstyleoption_cast<const HbStyleOptionNavigationButton *>(option); |
2256 const HbStyleOptionNavigationButton *opt = qstyleoption_cast<const HbStyleOptionNavigationButton *>(option); |
2365 if (opt) { |
2257 if (opt) { |
2366 HbIconItem *iconItem = static_cast<HbIconItem*>( item ); |
2258 HbIconItem *iconItem = static_cast<HbIconItem*>( item ); |
2367 iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio); |
2259 iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio); |
2368 if (opt->direction == Qt::LeftToRight) { |
2260 if (opt->transparent) { |
2369 if (opt->transparent) { |
2261 if (opt->mode == QIcon::Active) { |
2370 if (opt->mode == QIcon::Active) { |
2262 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_r")); |
2371 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_r")); |
|
2372 } else { |
|
2373 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_r")); |
|
2374 } |
|
2375 } else { |
2263 } else { |
2376 if (opt->mode == QIcon::Active) { |
2264 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_r")); |
2377 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_r")); |
2265 } |
2378 } else { |
|
2379 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_r")); |
|
2380 } |
|
2381 } |
|
2382 } else { |
2266 } else { |
2383 if (opt->transparent) { |
2267 if (opt->mode == QIcon::Active) { |
2384 if (opt->mode == QIcon::Active) { |
2268 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_r")); |
2385 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_l")); |
|
2386 } else { |
|
2387 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l")); |
|
2388 } |
|
2389 } else { |
2269 } else { |
2390 if (opt->mode == QIcon::Active) { |
2270 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_r")); |
2391 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_l")); |
2271 } |
2392 } else { |
|
2393 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l")); |
|
2394 } |
|
2395 } |
|
2396 } |
2272 } |
2397 } |
2273 } |
2398 break; |
2274 break; |
2399 } |
2275 } |
2400 |
2276 |
2401 case P_IndicatorButton_background: { |
2277 case P_IndicatorButton_background: { |
2402 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option); |
2278 const HbStyleOptionIndicatorButton *opt = qstyleoption_cast<const HbStyleOptionIndicatorButton *>(option); |
2403 if (opt) { |
2279 if (opt) { |
2404 HbIconItem *iconItem = static_cast<HbIconItem*>( item ); |
2280 HbIconItem *iconItem = static_cast<HbIconItem*>( item ); |
2405 iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio); |
2281 iconItem->setAspectRatioMode(Qt::IgnoreAspectRatio); |
2406 if (opt->direction == Qt::LeftToRight) { |
2282 if (opt->mode == QIcon::Active) { |
2407 if (opt->mode == QIcon::Active) { |
2283 if (opt->transparent) { |
2408 if (opt->transparent) { |
2284 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_l")); |
2409 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_l")); |
|
2410 } else { |
|
2411 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_l")); |
|
2412 } |
|
2413 } else if (opt->mode == QIcon::Selected) { |
|
2414 if (opt->transparent) { |
|
2415 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_latched_l")); |
|
2416 } else { |
|
2417 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_latched_l")); |
|
2418 } |
|
2419 } else { |
2285 } else { |
2420 if (opt->transparent) { |
2286 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_l")); |
2421 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l")); |
2287 } |
2422 } else { |
2288 } else if (opt->mode == QIcon::Selected) { |
2423 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l")); |
2289 if (opt->transparent) { |
2424 } |
2290 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_latched_l")); |
|
2291 } else { |
|
2292 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_latched_l")); |
2425 } |
2293 } |
2426 } else { |
2294 } else { |
2427 if (opt->mode == QIcon::Active) { |
2295 if (opt->transparent) { |
2428 if (opt->transparent) { |
2296 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_l")); |
2429 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_pressed_r")); |
|
2430 } else { |
|
2431 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_pressed_r")); |
|
2432 } |
|
2433 } else if (opt->mode == QIcon::Selected) { |
|
2434 if (opt->transparent) { |
|
2435 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_latched_r")); |
|
2436 } else { |
|
2437 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_latched_r")); |
|
2438 } |
|
2439 } else { |
2297 } else { |
2440 if (opt->transparent) { |
2298 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_l")); |
2441 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_trans_normal_r")); |
|
2442 } else { |
|
2443 iconItem->setIconName(QLatin1String("qtg_fr_titlebar_normal_r")); |
|
2444 } |
|
2445 } |
2299 } |
2446 } |
2300 } |
2447 } |
2301 } |
2448 break; |
2302 break; |
2449 } |
2303 } |
3264 break; |
3118 break; |
3265 case P_ListViewItem_text: |
3119 case P_ListViewItem_text: |
3266 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) { |
3120 if (const HbStyleOptionListViewItem *opt = qstyleoption_cast<const HbStyleOptionListViewItem *>(option)) { |
3267 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3121 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3268 |
3122 |
3269 // needs set word wrapping explicitly, if multiple lines supported |
|
3270 if (opt->index == 1) { |
3123 if (opt->index == 1) { |
3271 Hb::TextWrapping wrapping = Hb::TextNoWrap; |
3124 if (opt->multilineSecondaryTextSupported) { |
3272 if ( opt->minimumLines != 1 |
3125 if (opt->minimumLines != -1) { |
3273 || opt->maximumLines != 1) { |
3126 // min & max secondary text row counts set by app |
3274 wrapping = Hb::TextWordWrap; |
3127 Hb::TextWrapping wrapping = Hb::TextNoWrap; |
|
3128 if ( opt->minimumLines != 1 |
|
3129 || opt->maximumLines != 1) { |
|
3130 wrapping = Hb::TextWordWrap; |
|
3131 } |
|
3132 textItem->setTextWrapping(wrapping); |
|
3133 textItem->setMinimumLines(opt->minimumLines); |
|
3134 textItem->setMaximumLines(opt->maximumLines); |
|
3135 } else { |
|
3136 // min & max secondary text row counts not set by app. Allow setting those from .css |
|
3137 // Needed when multilineSecondaryTextSupported changed from FALSE to TRUE and |
|
3138 // min & max secondary text row counts has not bee set by app |
|
3139 HbWidgetBasePrivate *widgetBasePrivate = d->widgetBasePrivate(textItem); |
|
3140 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextWrapMode, false); |
|
3141 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMin, false); |
|
3142 widgetBasePrivate->setApiProtectionFlag(HbWidgetBasePrivate::AC_TextLinesMax, false); |
|
3143 } |
|
3144 } else { |
|
3145 // min & max secondary text row counts must always be 1. They cannot be overridden by .css |
|
3146 textItem->setTextWrapping(Hb::TextNoWrap); |
|
3147 textItem->setMinimumLines(1); |
|
3148 textItem->setMaximumLines(1); |
3275 } |
3149 } |
3276 textItem->setTextWrapping(wrapping); |
3150 } // else - default values from .css still in use |
3277 textItem->setMinimumLines(opt->minimumLines); |
|
3278 textItem->setMaximumLines(opt->maximumLines); |
|
3279 } |
|
3280 setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1)); |
3151 setItemName(textItem, QLatin1String("text-") + QString::number(opt->index + 1)); |
3281 textItem->setText(opt->content.value<QString>()); |
3152 textItem->setText(opt->content.value<QString>()); |
3282 } |
3153 } |
3283 break; |
3154 break; |
3284 case P_ListViewItem_richtext: |
3155 case P_ListViewItem_richtext: |
3438 |
3308 |
3439 case P_ProgressSlider_frame: |
3309 case P_ProgressSlider_frame: |
3440 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
3310 if (const HbStyleOptionProgressSlider *opt = qstyleoption_cast<const HbStyleOptionProgressSlider *>(option)) { |
3441 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
3311 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
3442 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3312 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3443 if(opt->pressedState) { |
3313 if (opt->disableState ) { |
3444 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed")); |
3314 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_disabled")); |
3445 } |
3315 } |
3446 else { |
3316 else { |
3447 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal")); |
3317 if(opt->pressedState) { |
3448 } |
3318 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_pressed")); |
|
3319 } |
|
3320 else { |
|
3321 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_progslider_frame_normal")); |
|
3322 } |
|
3323 } |
3449 frameItem->frameDrawer().setFillWholeRect(true); |
3324 frameItem->frameDrawer().setFillWholeRect(true); |
3450 frameItem->update(); |
3325 frameItem->update(); |
3451 } |
3326 } |
3452 break; |
3327 break; |
3453 case P_ProgressSlider_track: // The ProgressValue Mask |
3328 case P_ProgressSlider_track: // The ProgressValue Mask |
3940 } |
3815 } |
3941 } |
3816 } |
3942 |
3817 |
3943 HbWidgetBase *hbWidget = qobject_cast<HbWidgetBase*>(gWidget); |
3818 HbWidgetBase *hbWidget = qobject_cast<HbWidgetBase*>(gWidget); |
3944 if ( hbWidget ) { |
3819 if ( hbWidget ) { |
3945 #ifdef HBSTYLE_DEBUG_FONT |
|
3946 QString debugName; |
|
3947 bool isHbGroupBoxHeadingWidget(false); |
|
3948 if (!name.isEmpty()) { |
|
3949 QGraphicsItem* debugParent = hbWidget->parentItem(); |
|
3950 if (debugParent->isWidget()) { |
|
3951 debugName = static_cast<QGraphicsWidget*>(debugParent)->metaObject()->className(); |
|
3952 if (debugName == "HbGroupBoxHeadingWidget") { |
|
3953 isHbGroupBoxHeadingWidget = true; |
|
3954 } |
|
3955 } |
|
3956 debugName.append("::"); |
|
3957 debugName.append(name); |
|
3958 } else { |
|
3959 debugName = widget->metaObject()->className(); |
|
3960 } |
|
3961 if ( isHbGroupBoxHeadingWidget ) { |
|
3962 qDebug() << "HbStyle::polishItem :" << debugName; |
|
3963 qDebug() << "HbStyle::polishItem : -- Number of maching CSS declarations: " << decl.count(); |
|
3964 } |
|
3965 |
|
3966 #endif |
|
3967 HbWidgetBasePrivate* hbWidget_p = HbWidgetBasePrivate::d_ptr(hbWidget); |
3820 HbWidgetBasePrivate* hbWidget_p = HbWidgetBasePrivate::d_ptr(hbWidget); |
3968 QFont font; |
3821 QFont font; |
3969 HbFontSpec fontSpec; |
3822 HbFontSpec fontSpec; |
3970 int dummy; |
3823 int dummy; |
3971 if (extractor.extractFont(&font, &fontSpec, &dummy)) { |
3824 if (extractor.extractFont(&font, &fontSpec, &dummy)) { |
3972 if ( !fontSpec.isNull() ) { |
3825 if ( !fontSpec.isNull() ) { |
3973 if ( font == QFont() ) { |
3826 if ( font == QFont() ) { |
3974 #ifdef HBSTYLE_DEBUG_FONT |
3827 #ifdef HBSTYLE_DEBUG |
3975 if ( isHbGroupBoxHeadingWidget ) |
|
3976 qDebug() << "HbStyle::polishItem : -- Setting fontspec: " << fontSpec.role(); |
3828 qDebug() << "HbStyle::polishItem : -- Setting fontspec: " << fontSpec.role(); |
3977 #endif |
3829 #endif |
3978 hbWidget->setFontSpec(fontSpec); |
3830 hbWidget->setFontSpec(fontSpec); |
3979 } else { |
3831 } else { |
3980 #ifdef HBSTYLE_DEBUG_FONT |
3832 #ifdef HBSTYLE_DEBUG |
3981 if ( isHbGroupBoxHeadingWidget ) |
|
3982 qDebug() << "HbStyle::polishItem : -- Setting fontspec with overrides: " |
3833 qDebug() << "HbStyle::polishItem : -- Setting fontspec with overrides: " |
3983 << fontSpec.role() << font; |
3834 << fontSpec.role() << font; |
3984 #endif |
3835 #endif |
3985 hbWidget->setFont(fontSpec.font().resolve(font)); |
3836 hbWidget->setFont(fontSpec.font().resolve(font)); |
3986 } |
3837 } |
3987 } else { |
3838 } else { |
3988 #ifdef HBSTYLE_DEBUG_FONT |
3839 #ifdef HBSTYLE_DEBUG |
3989 if ( isHbGroupBoxHeadingWidget ) |
|
3990 qDebug() << "HbStyle::polishItem : -- Setting explicit font: " << font; |
3840 qDebug() << "HbStyle::polishItem : -- Setting explicit font: " << font; |
3991 #endif |
3841 #endif |
3992 hbWidget->setFont(font); |
3842 hbWidget->setFont(font); |
3993 } |
3843 } |
3994 } |
3844 } |
4304 } |
4141 } |
4305 } else { |
4142 } else { |
4306 styleRules = styleLoader->styleRulesForNode(n, profile.orientation()); |
4143 styleRules = styleLoader->styleRulesForNode(n, profile.orientation()); |
4307 } |
4144 } |
4308 |
4145 |
4309 #ifdef HBSTYLE_DEBUG_FONT |
4146 #ifdef HBSTYLE_DEBUG |
4310 if (isHbGroupBoxHeadingWidget) { |
4147 qDebug() << "HbStyle::polish : Number of style rules:" << styleRules.count(); |
4311 qDebug() << "HbStyle::polish : Number of style rules:" << styleRules.count(); |
|
4312 } |
|
4313 #endif |
4148 #endif |
4314 if (!styleRules.count()) { |
4149 if (!styleRules.count()) { |
4315 #ifdef HBSTYLE_DEBUG |
|
4316 qDebug() << "HbStyle::polish : No style rules found."; |
|
4317 #endif |
|
4318 return; |
4150 return; |
4319 } |
4151 } |
4320 const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile); |
4152 const HbVector<HbCss::Declaration> decl = declarations(styleRules, "", widget, profile); |
4321 #ifdef HBSTYLE_DEBUG_FONT |
|
4322 if (isHbGroupBoxHeadingWidget) { |
|
4323 qDebug() << "HbStyle::polish : Number of maching CSS declarations: " << decl.count(); |
|
4324 } |
|
4325 #endif |
|
4326 #ifdef HBSTYLE_DEBUG |
4153 #ifdef HBSTYLE_DEBUG |
4327 qDebug() << "HbStyle::polish : Number of maching CSS declarations: " << decl.count(); |
4154 qDebug() << "HbStyle::polish : Number of maching CSS declarations: " << decl.count(); |
4328 #endif |
4155 #endif |
4329 d->ensureLayoutParameters(profile); |
4156 d->ensureLayoutParameters(profile); |
4330 |
4157 |