src/hbcore/style/hbstyle.cpp
changeset 28 b7da29130b0e
parent 23 e6ad4ef83b23
child 30 80e4d18b72f5
--- a/src/hbcore/style/hbstyle.cpp	Thu Sep 02 20:44:51 2010 +0300
+++ b/src/hbcore/style/hbstyle.cpp	Fri Sep 17 08:32:10 2010 +0300
@@ -315,10 +315,12 @@
             textItem->setTextClip(td->isTextClip);
         if (td->geometry.isSet())
             textItem->setGeometry(td->geometry);
-        if (td->fadeLength.isSet())
-            textItem->setFadeLength(td->fadeLength);
         if (td->fadeLengths.isSet())
             textItem->setFadeLengths(td->fadeLengths);
+        if (td->minimumLines.isSet())
+            textItem->setMinimumLines(td->minimumLines);
+        if (td->maximumLines.isSet())
+            textItem->setMaximumLines(td->maximumLines);
         return true;
 
     } else if (HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(primitive)) {
@@ -1605,6 +1607,7 @@
                 if (opt) {
                     HbFrameItem *frameItem = static_cast<HbFrameItem*>(item);
                     frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
+                    frameItem->frameDrawer().setFillWholeRect(true);
                     if (opt->transparent) {
                         frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_statusbar_trans"));
                     } else {
@@ -1875,9 +1878,9 @@
                         qstyleoption_cast<const HbStyleOptionPushButton *>(option)) {
                      HbFrameItem *iconItem  = static_cast<HbFrameItem*>(item);
                      iconItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_btn_highlight"));
-                     int margin = 4;
-                     QRectF focusRect  = opt->rect.adjusted(-margin , -margin , margin , margin);
-                     iconItem->setGeometry(focusRect);
+                     //int margin = 4;
+                     //QRectF focusRect  = opt->rect.adjusted(-margin , -margin , margin , margin);
+                     iconItem->setGeometry(opt->boundingRect);
                      iconItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
                  }
                 break;
@@ -2085,6 +2088,7 @@
                     frameItem->setValue(opt->sliderValue);
                     frameItem->setOrientation(opt->orientation);
                     frameItem->setSpan( opt->span );
+                    frameItem->setHandleRect(opt->handleRect);
                     frameItem->update();
                 }
                 break;
@@ -2142,8 +2146,8 @@
                     else
                     {
                         thumbPath=opt->thumbPath;
-                        iconItem->setAlignment(Qt::AlignCenter);
                     }
+                    iconItem->setAlignment(Qt::AlignCenter);
                     iconItem->setIconName(thumbPath);
                     iconItem->setAspectRatioMode(Qt::KeepAspectRatio);
                  }
@@ -2431,7 +2435,7 @@
                 if (const HbStyleOptionMenuItem *opt = qstyleoption_cast<const HbStyleOptionMenuItem *>(option)) {
                     HbIconItem *iconItem = static_cast<HbIconItem*>(item);
                     Q_UNUSED(opt)
-                    iconItem->setIconName(QLatin1String("qtg_mono_options_menu"));
+                    iconItem->setIconName(QLatin1String("qtg_mono_arrow_right"));
                 }
                 break;
 
@@ -3220,7 +3224,7 @@
                 break;
 
             case P_TumbleView_highlight:
-                if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
+               /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri");
                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal);
@@ -3231,7 +3235,7 @@
                         Q_UNUSED(opt);
                     }
 
-                }
+                }*/
                 break;
 
             case P_IndexFeedback_popup_text:
@@ -3250,7 +3254,7 @@
                 }
                 break;
             case P_DateTimePicker_background:
-                if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
+               /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg");
                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
@@ -3259,10 +3263,10 @@
                         //frameItem->setGeometry(opt->boundingRect);
                         Q_UNUSED(opt);
                     }
-                }
+                }*/
                 break;
             case P_DateTimePicker_frame:
-                if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
+               /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
                         frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay");
                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces);
@@ -3271,10 +3275,10 @@
                         //frameItem->setGeometry(opt->boundingRect);
                         Q_UNUSED(opt);
                     }
-                }
+                }*/
                 break;
             case P_DateTimePicker_separator:
-                if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
+               /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) {
                     if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) {
                         frameItem->frameDrawer().setFrameGraphicsName("qtg_graf_tumbler_divider");
                         frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece);
@@ -3285,7 +3289,7 @@
                         Q_UNUSED(opt);
                     }
 
-                }
+                }*/
                 break;
             case P_InputDialog_text:
                 if (const HbStyleOptionInputDialog *opt =
@@ -3393,7 +3397,8 @@
 #ifdef HBSTYLE_DEBUG
     qDebug() << "HbStyle::polishItem : -- Number of matching CSS declarations: " << decl.count();
 #endif
-    HbCss::ValueExtractor extractor(decl, layoutParameters, profile);
+    HbCss::ValueExtractor extractor(decl, profile);
+    extractor.setLayoutParameters(layoutParameters);
     HbCss::KnownProperties prop;
 
     if ( !extractor.extractKnownProperties(prop) ) {
@@ -3681,7 +3686,8 @@
 #ifdef HBSTYLE_DEBUG
     qDebug() << "HbStyle::polishAnchor : -- Number of matching CSS declarations: " << decl.count();
 #endif
-    HbCss::ValueExtractor extractor(decl, layoutParameters, profile);
+    HbCss::ValueExtractor extractor(decl, profile);
+    extractor.setLayoutParameters(layoutParameters);
     HbCss::KnownProperties prop;
 
     if ( !extractor.extractKnownProperties(prop) ) {
@@ -3799,7 +3805,8 @@
 #endif
     d->layoutParameters.init(profile);
 
-    HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile);
+    HbCss::ValueExtractor extractor(decl, profile);
+    extractor.setLayoutParameters(d->layoutParameters);
     QString layoutName;
     QString sectionName;
 
@@ -4128,7 +4135,8 @@
     }
     Q_D( const HbStyle );
     d->layoutParameters.init(effectiveProfile);
-    HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile);
+    HbCss::ValueExtractor valueExtractor(effectiveProfile);
+    valueExtractor.setLayoutParameters(d->layoutParameters);
     // todo: parsing variable/expression is done here so that there is no need to change API
     // also parameters method not changed (this change is done for docml/widgetml parsing)
     if (param.startsWith(QLatin1String("var(")) && param.endsWith(QLatin1String(")"))) {
@@ -4150,6 +4158,19 @@
     return valueExtractor.extractVariableValue(param, value);
 }
 
+bool HbStylePrivate::parameterFromHashValue(quint32 hashValue, qreal &value, const HbDeviceProfile &profile) const
+{
+    HbDeviceProfile effectiveProfile = profile;
+    if ( effectiveProfile.isNull() ) {
+        effectiveProfile = HbDeviceProfile::current();
+    }
+    layoutParameters.init(effectiveProfile);
+    HbCss::ValueExtractor valueExtractor(effectiveProfile);
+    valueExtractor.setLayoutParameters(layoutParameters);
+    return valueExtractor.extractVariableValue(hashValue, value);
+}
+
+
 /*!
     Returns copy of all global style parameters. Both names and values
     of the parameters are returned. The values are returned in pixels.
@@ -4172,7 +4193,8 @@
 
     Q_D( const HbStyle );
     d->layoutParameters.init(effectiveProfile);
-    HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile);
+    HbCss::ValueExtractor valueExtractor(effectiveProfile);
+    valueExtractor.setLayoutParameters(d->layoutParameters);
     qreal value = 0;
     HbLayoutParameters::const_iterator i = d->layoutParameters.constBegin();
     while (i != d->layoutParameters.constEnd()) {
@@ -4230,7 +4252,8 @@
 #endif
     d->layoutParameters.init(profile);
 
-    HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile);
+    HbCss::ValueExtractor extractor(decl, profile);
+    extractor.setLayoutParameters(d->layoutParameters);
     extractor.extractCustomProperties( params.keys(), params.values() );
 }