313 textItem->setTextVisible(td->isTextVisible); |
313 textItem->setTextVisible(td->isTextVisible); |
314 if (td->isTextClip.isSet()) |
314 if (td->isTextClip.isSet()) |
315 textItem->setTextClip(td->isTextClip); |
315 textItem->setTextClip(td->isTextClip); |
316 if (td->geometry.isSet()) |
316 if (td->geometry.isSet()) |
317 textItem->setGeometry(td->geometry); |
317 textItem->setGeometry(td->geometry); |
318 if (td->fadeLength.isSet()) |
|
319 textItem->setFadeLength(td->fadeLength); |
|
320 if (td->fadeLengths.isSet()) |
318 if (td->fadeLengths.isSet()) |
321 textItem->setFadeLengths(td->fadeLengths); |
319 textItem->setFadeLengths(td->fadeLengths); |
|
320 if (td->minimumLines.isSet()) |
|
321 textItem->setMinimumLines(td->minimumLines); |
|
322 if (td->maximumLines.isSet()) |
|
323 textItem->setMaximumLines(td->maximumLines); |
322 return true; |
324 return true; |
323 |
325 |
324 } else if (HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(primitive)) { |
326 } else if (HbIconItem *iconItem = qgraphicsitem_cast<HbIconItem*>(primitive)) { |
325 const HbStyleIconPrimitiveData *id = hbstyleprimitivedata_cast<const HbStyleIconPrimitiveData*>(data); |
327 const HbStyleIconPrimitiveData *id = hbstyleprimitivedata_cast<const HbStyleIconPrimitiveData*>(data); |
326 if (id->icon.isSet()) |
328 if (id->icon.isSet()) |
1603 case P_StatusBar_background: { |
1605 case P_StatusBar_background: { |
1604 const HbStyleOptionStatusBar *opt = qstyleoption_cast<const HbStyleOptionStatusBar *>(option); |
1606 const HbStyleOptionStatusBar *opt = qstyleoption_cast<const HbStyleOptionStatusBar *>(option); |
1605 if (opt) { |
1607 if (opt) { |
1606 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
1608 HbFrameItem *frameItem = static_cast<HbFrameItem*>(item); |
1607 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
1609 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
|
1610 frameItem->frameDrawer().setFillWholeRect(true); |
1608 if (opt->transparent) { |
1611 if (opt->transparent) { |
1609 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_statusbar_trans")); |
1612 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_statusbar_trans")); |
1610 } else { |
1613 } else { |
1611 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_statusbar")); |
1614 frameItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_statusbar")); |
1612 } |
1615 } |
1873 case P_PushButton_focus: { |
1876 case P_PushButton_focus: { |
1874 if (const HbStyleOptionPushButton *opt = |
1877 if (const HbStyleOptionPushButton *opt = |
1875 qstyleoption_cast<const HbStyleOptionPushButton *>(option)) { |
1878 qstyleoption_cast<const HbStyleOptionPushButton *>(option)) { |
1876 HbFrameItem *iconItem = static_cast<HbFrameItem*>(item); |
1879 HbFrameItem *iconItem = static_cast<HbFrameItem*>(item); |
1877 iconItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_btn_highlight")); |
1880 iconItem->frameDrawer().setFrameGraphicsName(QLatin1String("qtg_fr_btn_highlight")); |
1878 int margin = 4; |
1881 //int margin = 4; |
1879 QRectF focusRect = opt->rect.adjusted(-margin , -margin , margin , margin); |
1882 //QRectF focusRect = opt->rect.adjusted(-margin , -margin , margin , margin); |
1880 iconItem->setGeometry(focusRect); |
1883 iconItem->setGeometry(opt->boundingRect); |
1881 iconItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
1884 iconItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
1882 } |
1885 } |
1883 break; |
1886 break; |
1884 } |
1887 } |
1885 case P_ToolButton_frame:{ |
1888 case P_ToolButton_frame:{ |
2083 frameItem->setMaximum(opt->maximum); |
2086 frameItem->setMaximum(opt->maximum); |
2084 frameItem->setMinimum(opt->minimum); |
2087 frameItem->setMinimum(opt->minimum); |
2085 frameItem->setValue(opt->sliderValue); |
2088 frameItem->setValue(opt->sliderValue); |
2086 frameItem->setOrientation(opt->orientation); |
2089 frameItem->setOrientation(opt->orientation); |
2087 frameItem->setSpan( opt->span ); |
2090 frameItem->setSpan( opt->span ); |
|
2091 frameItem->setHandleRect(opt->handleRect); |
2088 frameItem->update(); |
2092 frameItem->update(); |
2089 } |
2093 } |
2090 break; |
2094 break; |
2091 } |
2095 } |
2092 case P_Slider_groove:{ |
2096 case P_Slider_groove:{ |
3218 } |
3222 } |
3219 } |
3223 } |
3220 break; |
3224 break; |
3221 |
3225 |
3222 case P_TumbleView_highlight: |
3226 case P_TumbleView_highlight: |
3223 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3227 /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3224 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3228 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3225 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri"); |
3229 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_highlight_pri"); |
3226 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3230 frameItem->frameDrawer().setFrameType(HbFrameDrawer::ThreePiecesHorizontal); |
3227 frameItem->setZValue(-1); |
3231 frameItem->setZValue(-1); |
3228 //TODO:temp fix, issue with css rule picking in derived class |
3232 //TODO:temp fix, issue with css rule picking in derived class |
3229 |
3233 |
3230 //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); |
3234 //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); |
3231 Q_UNUSED(opt); |
3235 Q_UNUSED(opt); |
3232 } |
3236 } |
3233 |
3237 |
3234 } |
3238 }*/ |
3235 break; |
3239 break; |
3236 |
3240 |
3237 case P_IndexFeedback_popup_text: |
3241 case P_IndexFeedback_popup_text: |
3238 if (const HbStyleOptionIndexFeedback *opt = qstyleoption_cast<const HbStyleOptionIndexFeedback *>(option)) { |
3242 if (const HbStyleOptionIndexFeedback *opt = qstyleoption_cast<const HbStyleOptionIndexFeedback *>(option)) { |
3239 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3243 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3248 frameItem->setGeometry(opt->popupRect); |
3252 frameItem->setGeometry(opt->popupRect); |
3249 } |
3253 } |
3250 } |
3254 } |
3251 break; |
3255 break; |
3252 case P_DateTimePicker_background: |
3256 case P_DateTimePicker_background: |
3253 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3257 /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3254 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3258 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3255 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg"); |
3259 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_bg"); |
3256 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3260 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3257 frameItem->setZValue(-5); |
3261 frameItem->setZValue(-5); |
3258 //TODO:temp fix, issue with css rule picking in derived class |
3262 //TODO:temp fix, issue with css rule picking in derived class |
3259 //frameItem->setGeometry(opt->boundingRect); |
3263 //frameItem->setGeometry(opt->boundingRect); |
3260 Q_UNUSED(opt); |
3264 Q_UNUSED(opt); |
3261 } |
3265 } |
3262 } |
3266 }*/ |
3263 break; |
3267 break; |
3264 case P_DateTimePicker_frame: |
3268 case P_DateTimePicker_frame: |
3265 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3269 /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3266 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3270 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3267 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay"); |
3271 frameItem->frameDrawer().setFrameGraphicsName("qtg_fr_tumbler_overlay"); |
3268 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3272 frameItem->frameDrawer().setFrameType(HbFrameDrawer::NinePieces); |
3269 frameItem->setZValue(1); |
3273 frameItem->setZValue(1); |
3270 //TODO:temp fix, issue with css rule picking in derived class |
3274 //TODO:temp fix, issue with css rule picking in derived class |
3271 //frameItem->setGeometry(opt->boundingRect); |
3275 //frameItem->setGeometry(opt->boundingRect); |
3272 Q_UNUSED(opt); |
3276 Q_UNUSED(opt); |
3273 } |
3277 } |
3274 } |
3278 }*/ |
3275 break; |
3279 break; |
3276 case P_DateTimePicker_separator: |
3280 case P_DateTimePicker_separator: |
3277 if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3281 /* if (const HbStyleOption *opt = qstyleoption_cast<const HbStyleOption*>(option)) { |
3278 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3282 if(HbFrameItem *frameItem = qgraphicsitem_cast<HbFrameItem*>(item)) { |
3279 frameItem->frameDrawer().setFrameGraphicsName("qtg_graf_tumbler_divider"); |
3283 frameItem->frameDrawer().setFrameGraphicsName("qtg_graf_tumbler_divider"); |
3280 frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece); |
3284 frameItem->frameDrawer().setFrameType(HbFrameDrawer::OnePiece); |
3281 frameItem->setZValue(2); |
3285 frameItem->setZValue(2); |
3282 //TODO:temp fix, issue with css rule picking in derived class |
3286 //TODO:temp fix, issue with css rule picking in derived class |
3283 |
3287 |
3284 //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); |
3288 //frameItem->setGeometry(0,(opt->boundingRect.height()-frameItem->boundingRect().height())/2,opt->boundingRect.width(),opt->boundingRect.height()); |
3285 Q_UNUSED(opt); |
3289 Q_UNUSED(opt); |
3286 } |
3290 } |
3287 |
3291 |
3288 } |
3292 }*/ |
3289 break; |
3293 break; |
3290 case P_InputDialog_text: |
3294 case P_InputDialog_text: |
3291 if (const HbStyleOptionInputDialog *opt = |
3295 if (const HbStyleOptionInputDialog *opt = |
3292 qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) { |
3296 qstyleoption_cast<const HbStyleOptionInputDialog*>(option)) { |
3293 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3297 HbTextItem *textItem = static_cast<HbTextItem*>(item); |
3391 |
3395 |
3392 const HbVector<HbCss::Declaration> decl = declarations(styleRules, name, widget, profile); |
3396 const HbVector<HbCss::Declaration> decl = declarations(styleRules, name, widget, profile); |
3393 #ifdef HBSTYLE_DEBUG |
3397 #ifdef HBSTYLE_DEBUG |
3394 qDebug() << "HbStyle::polishItem : -- Number of matching CSS declarations: " << decl.count(); |
3398 qDebug() << "HbStyle::polishItem : -- Number of matching CSS declarations: " << decl.count(); |
3395 #endif |
3399 #endif |
3396 HbCss::ValueExtractor extractor(decl, layoutParameters, profile); |
3400 HbCss::ValueExtractor extractor(decl, profile); |
|
3401 extractor.setLayoutParameters(layoutParameters); |
3397 HbCss::KnownProperties prop; |
3402 HbCss::KnownProperties prop; |
3398 |
3403 |
3399 if ( !extractor.extractKnownProperties(prop) ) { |
3404 if ( !extractor.extractKnownProperties(prop) ) { |
3400 #ifdef HBSTYLE_DEBUG |
3405 #ifdef HBSTYLE_DEBUG |
3401 qDebug() << "HbStyle::polishItem : -- No polish overrides found"; |
3406 qDebug() << "HbStyle::polishItem : -- No polish overrides found"; |
3679 |
3684 |
3680 const HbVector<HbCss::Declaration> decl = declarations(styleRules, anchor->anchorId(), widget, profile); |
3685 const HbVector<HbCss::Declaration> decl = declarations(styleRules, anchor->anchorId(), widget, profile); |
3681 #ifdef HBSTYLE_DEBUG |
3686 #ifdef HBSTYLE_DEBUG |
3682 qDebug() << "HbStyle::polishAnchor : -- Number of matching CSS declarations: " << decl.count(); |
3687 qDebug() << "HbStyle::polishAnchor : -- Number of matching CSS declarations: " << decl.count(); |
3683 #endif |
3688 #endif |
3684 HbCss::ValueExtractor extractor(decl, layoutParameters, profile); |
3689 HbCss::ValueExtractor extractor(decl, profile); |
|
3690 extractor.setLayoutParameters(layoutParameters); |
3685 HbCss::KnownProperties prop; |
3691 HbCss::KnownProperties prop; |
3686 |
3692 |
3687 if ( !extractor.extractKnownProperties(prop) ) { |
3693 if ( !extractor.extractKnownProperties(prop) ) { |
3688 #ifdef HBSTYLE_DEBUG |
3694 #ifdef HBSTYLE_DEBUG |
3689 qDebug() << "HbStyle::polishAnchor : -- No polish overrides found"; |
3695 qDebug() << "HbStyle::polishAnchor : -- No polish overrides found"; |
3797 #ifdef HBSTYLE_DEBUG |
3803 #ifdef HBSTYLE_DEBUG |
3798 qDebug() << "HbStyle::polish : Number of matching CSS declarations: " << decl.count(); |
3804 qDebug() << "HbStyle::polish : Number of matching CSS declarations: " << decl.count(); |
3799 #endif |
3805 #endif |
3800 d->layoutParameters.init(profile); |
3806 d->layoutParameters.init(profile); |
3801 |
3807 |
3802 HbCss::ValueExtractor extractor(decl, d->layoutParameters, profile); |
3808 HbCss::ValueExtractor extractor(decl, profile); |
|
3809 extractor.setLayoutParameters(d->layoutParameters); |
3803 QString layoutName; |
3810 QString layoutName; |
3804 QString sectionName; |
3811 QString sectionName; |
3805 |
3812 |
3806 if ( params.count() ) { |
3813 if ( params.count() ) { |
3807 #ifdef HBSTYLE_DEBUG |
3814 #ifdef HBSTYLE_DEBUG |
4126 if ( effectiveProfile.isNull() ) { |
4133 if ( effectiveProfile.isNull() ) { |
4127 effectiveProfile = HbDeviceProfile::current(); |
4134 effectiveProfile = HbDeviceProfile::current(); |
4128 } |
4135 } |
4129 Q_D( const HbStyle ); |
4136 Q_D( const HbStyle ); |
4130 d->layoutParameters.init(effectiveProfile); |
4137 d->layoutParameters.init(effectiveProfile); |
4131 HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile); |
4138 HbCss::ValueExtractor valueExtractor(effectiveProfile); |
|
4139 valueExtractor.setLayoutParameters(d->layoutParameters); |
4132 // todo: parsing variable/expression is done here so that there is no need to change API |
4140 // todo: parsing variable/expression is done here so that there is no need to change API |
4133 // also parameters method not changed (this change is done for docml/widgetml parsing) |
4141 // also parameters method not changed (this change is done for docml/widgetml parsing) |
4134 if (param.startsWith(QLatin1String("var(")) && param.endsWith(QLatin1String(")"))) { |
4142 if (param.startsWith(QLatin1String("var(")) && param.endsWith(QLatin1String(")"))) { |
4135 return valueExtractor.extractVariableValue(param.mid(4,param.length()-5), value); |
4143 return valueExtractor.extractVariableValue(param.mid(4,param.length()-5), value); |
4136 } else if (param.startsWith(QLatin1String("-var(")) && param.endsWith(QLatin1String(")"))) { |
4144 } else if (param.startsWith(QLatin1String("-var(")) && param.endsWith(QLatin1String(")"))) { |
4148 } |
4156 } |
4149 |
4157 |
4150 return valueExtractor.extractVariableValue(param, value); |
4158 return valueExtractor.extractVariableValue(param, value); |
4151 } |
4159 } |
4152 |
4160 |
|
4161 bool HbStylePrivate::parameterFromHashValue(quint32 hashValue, qreal &value, const HbDeviceProfile &profile) const |
|
4162 { |
|
4163 HbDeviceProfile effectiveProfile = profile; |
|
4164 if ( effectiveProfile.isNull() ) { |
|
4165 effectiveProfile = HbDeviceProfile::current(); |
|
4166 } |
|
4167 layoutParameters.init(effectiveProfile); |
|
4168 HbCss::ValueExtractor valueExtractor(effectiveProfile); |
|
4169 valueExtractor.setLayoutParameters(layoutParameters); |
|
4170 return valueExtractor.extractVariableValue(hashValue, value); |
|
4171 } |
|
4172 |
|
4173 |
4153 /*! |
4174 /*! |
4154 Returns copy of all global style parameters. Both names and values |
4175 Returns copy of all global style parameters. Both names and values |
4155 of the parameters are returned. The values are returned in pixels. |
4176 of the parameters are returned. The values are returned in pixels. |
4156 |
4177 |
4157 Available parameters can be found from hbglobalparameters.css. By using these |
4178 Available parameters can be found from hbglobalparameters.css. By using these |
4170 effectiveProfile = HbDeviceProfile::current(); |
4191 effectiveProfile = HbDeviceProfile::current(); |
4171 } |
4192 } |
4172 |
4193 |
4173 Q_D( const HbStyle ); |
4194 Q_D( const HbStyle ); |
4174 d->layoutParameters.init(effectiveProfile); |
4195 d->layoutParameters.init(effectiveProfile); |
4175 HbCss::ValueExtractor valueExtractor(d->layoutParameters, true, effectiveProfile); |
4196 HbCss::ValueExtractor valueExtractor(effectiveProfile); |
|
4197 valueExtractor.setLayoutParameters(d->layoutParameters); |
4176 qreal value = 0; |
4198 qreal value = 0; |
4177 HbLayoutParameters::const_iterator i = d->layoutParameters.constBegin(); |
4199 HbLayoutParameters::const_iterator i = d->layoutParameters.constBegin(); |
4178 while (i != d->layoutParameters.constEnd()) { |
4200 while (i != d->layoutParameters.constEnd()) { |
4179 QString name(d->layoutParameters.name(i)); |
4201 QString name(d->layoutParameters.name(i)); |
4180 if (valueExtractor.extractVariableValue(name, value)) { |
4202 if (valueExtractor.extractVariableValue(name, value)) { |