equal
deleted
inserted
replaced
245 \internal |
245 \internal |
246 */ |
246 */ |
247 HbFrameDrawerPrivate::~HbFrameDrawerPrivate() |
247 HbFrameDrawerPrivate::~HbFrameDrawerPrivate() |
248 { |
248 { |
249 unLoadIcon(); |
249 unLoadIcon(); |
250 //Unregister the HbFrameDrawerPrivate Instance to HbIconLoader |
250 // Unregister the HbFrameDrawerPrivate Instance to HbIconLoader. |
251 HbIconLoader::global()->removeFrameDrawerInfo(this); |
251 // However it may already have been destroyed, if the app is shuting down |
|
252 // so be prepared for null ptr too. |
|
253 HbIconLoader *loader = HbIconLoader::global(); |
|
254 if (loader) { |
|
255 loader->removeFrameDrawerInfo(this); |
|
256 } |
252 } |
257 } |
253 |
258 |
254 /*! |
259 /*! |
255 \internal |
260 \internal |
256 */ |
261 */ |
369 data.multiPartIconId = multiPartIconId(); |
374 data.multiPartIconId = multiPartIconId(); |
370 multiPartSizeData = data; |
375 multiPartSizeData = data; |
371 |
376 |
372 // Create the frame icon and add it in the icon cache |
377 // Create the frame icon and add it in the icon cache |
373 HbIconLoader *loader = HbIconLoader::global(); |
378 HbIconLoader *loader = HbIconLoader::global(); |
|
379 if (!loader) { |
|
380 return; |
|
381 } |
374 |
382 |
375 //If it's one-piece frame-item, it's loaded using HbIconLoader::loadIcon() |
383 //If it's one-piece frame-item, it's loaded using HbIconLoader::loadIcon() |
376 if (frameParts == 1) { |
384 if (frameParts == 1) { |
377 HbIconImpl *iconImpl = loader->loadIcon(frameGraphicsName, HbIconLoader::AnyType, |
385 HbIconImpl *iconImpl = loader->loadIcon(frameGraphicsName, HbIconLoader::AnyType, |
378 HbIconLoader::AnyPurpose, |
386 HbIconLoader::AnyPurpose, |
395 |
403 |
396 QVector<HbIconImpl *> listOfIcons; |
404 QVector<HbIconImpl *> listOfIcons; |
397 |
405 |
398 //For multi-piece frame-items, HbIocnLoader::loadMultipieceIcon is used |
406 //For multi-piece frame-items, HbIocnLoader::loadMultipieceIcon is used |
399 //This function returns the consolidate (stitched) icon created on the themeserver. |
407 //This function returns the consolidate (stitched) icon created on the themeserver. |
400 //If the consolidated icon-creation on themeserver fails, then server returns a list |
408 //If the consolidated icon-creation on themeserver fails, then the consolidated |
401 //of individual frame-items. |
409 //icon is created on the client-side (fallback) |
402 HbIconImpl *iconImpl = loader->loadMultiPieceIcon(multiPieceFileNames, data, frameIconSize, |
410 HbIconImpl *iconImpl = loader->loadMultiPieceIcon(multiPieceFileNames, data, frameIconSize, |
403 Qt::IgnoreAspectRatio, QIcon::Normal, iconLoaderOptions(), |
411 Qt::IgnoreAspectRatio, QIcon::Normal, iconLoaderOptions(), |
404 listOfIcons, color); |
412 listOfIcons, color); |
405 |
413 |
406 if (iconImpl) { |
414 if (iconImpl) { |
1065 { |
1073 { |
1066 HbIconLoader *loader = HbIconLoader::global(); |
1074 HbIconLoader *loader = HbIconLoader::global(); |
1067 if (icon) { |
1075 if (icon) { |
1068 //If a consolidated (stitched) icon was created on the themeserver, then |
1076 //If a consolidated (stitched) icon was created on the themeserver, then |
1069 //HbIconLoader::unloadIcon() is used to unload it. |
1077 //HbIconLoader::unloadIcon() is used to unload it. |
1070 loader->unLoadIcon(icon->iconImpl(), unloadedByServer); |
1078 if (loader) { |
|
1079 loader->unLoadIcon(icon->iconImpl(), unloadedByServer); |
|
1080 } |
1071 icon->dispose(); |
1081 icon->dispose(); |
1072 icon = 0; |
1082 icon = 0; |
1073 } |
1083 } |
1074 |
1084 |
1075 // get a vector of QVector<HbIconImpl*> from QVector<HbMaskableIconImpl*> for unloading. |
1085 // get a vector of QVector<HbIconImpl*> from QVector<HbMaskableIconImpl*> for unloading. |
1093 } |
1103 } |
1094 fallbackIconList.clear(); // vector of HbIconImpl* |
1104 fallbackIconList.clear(); // vector of HbIconImpl* |
1095 fallbackMaskableIconList.clear(); // vector of HbMaskableIconImpl* |
1105 fallbackMaskableIconList.clear(); // vector of HbMaskableIconImpl* |
1096 } |
1106 } |
1097 |
1107 |
|
1108 // This is called from HbIconLoader when building for tools. |
|
1109 // It is not in use in normal builds. |
1098 void HbFrameDrawerPrivate::themeChange(const QStringList &updatedFiles) |
1110 void HbFrameDrawerPrivate::themeChange(const QStringList &updatedFiles) |
1099 { |
1111 { |
1100 bool unloadIcons = false; |
1112 bool unloadIcons = false; |
1101 if (updatedFiles.count() == 0 || (icon && updatedFiles.contains(icon->iconFileName()))) { |
1113 if (updatedFiles.count() == 0 || (icon && updatedFiles.contains(icon->iconFileName()))) { |
1102 unloadIcons = true; |
1114 unloadIcons = true; |
1343 */ |
1355 */ |
1344 void HbFrameDrawer::paint(QPainter *painter, const QRectF &rect) const |
1356 void HbFrameDrawer::paint(QPainter *painter, const QRectF &rect) const |
1345 { |
1357 { |
1346 const_cast<HbFrameDrawer *>(this)->setRect(rect); |
1358 const_cast<HbFrameDrawer *>(this)->setRect(rect); |
1347 |
1359 |
1348 if (d->frameGraphicsName.isEmpty() || d->type == HbFrameDrawer::Undefined || d->rect.isEmpty()) { |
1360 HbIconLoader *loader = HbIconLoader::global(); |
|
1361 if (d->frameGraphicsName.isEmpty() || d->type == HbFrameDrawer::Undefined || d->rect.isEmpty() || !loader) { |
1349 return; |
1362 return; |
1350 } |
1363 } |
1351 |
1364 |
1352 // Lazy graphics rasterizing is used. |
1365 // Lazy graphics rasterizing is used. |
1353 // Rasterize the frame parts now if that has not been done yet. |
1366 // Rasterize the frame parts now if that has not been done yet. |
1356 } |
1369 } |
1357 |
1370 |
1358 // update the rendering mode |
1371 // update the rendering mode |
1359 QPaintEngine *paintEngine = painter->paintEngine(); |
1372 QPaintEngine *paintEngine = painter->paintEngine(); |
1360 if (paintEngine) { |
1373 if (paintEngine) { |
1361 HbIconLoader::global()->updateRenderingMode(paintEngine->type()); |
1374 loader->updateRenderingMode(paintEngine->type()); |
1362 } |
1375 } |
1363 d->prepareFrameIcon(); |
1376 d->prepareFrameIcon(); |
1364 d->prevRect = rect.toRect(); |
1377 d->prevRect = rect.toRect(); |
1365 // Paint the frame |
1378 // Paint the frame |
1366 d->paint(painter); |
1379 d->paint(painter); |
1596 return QSize(0, 0); |
1609 return QSize(0, 0); |
1597 } |
1610 } |
1598 |
1611 |
1599 /*! |
1612 /*! |
1600 * This function should be called when the theme changes. This clears the used frame |
1613 * This function should be called when the theme changes. This clears the used frame |
1601 * graphic. |
1614 * graphics. This is typically handled by HbFrameItem so there is no need to call this function |
|
1615 * manually when using the framedrawer with a HbFrameItem. |
1602 */ |
1616 */ |
1603 void HbFrameDrawer::themeChanged() |
1617 void HbFrameDrawer::themeChanged() |
1604 { |
1618 { |
1605 #ifndef HB_TOOL_INTERFACE |
1619 #ifndef HB_TOOL_INTERFACE |
1606 // This needs to be disabled to prevent full theme updates when using partial updates with tools. |
1620 // This needs to be disabled to prevent full theme updates when using partial updates with tools. |