src/hbcore/image/hbframedrawer.cpp
changeset 2 06ff229162e9
parent 1 f7ac710697a9
child 5 627c4a0fd0e7
equal deleted inserted replaced
1:f7ac710697a9 2:06ff229162e9
   920 }
   920 }
   921 
   921 
   922 /*!
   922 /*!
   923 \internal
   923 \internal
   924 */
   924 */
   925 void HbFrameDrawerPrivate::reset( bool resetFrameCount )
   925 void HbFrameDrawerPrivate::reset(bool resetFrameCount, bool unloadedByServer)
   926 {
   926 {
   927     unLoadIcon();
   927     unLoadIcon(unloadedByServer);
   928     if ( resetFrameCount ) {
   928     if ( resetFrameCount ) {
   929         frameParts = 0;
   929         frameParts = 0;
   930     }
   930     }
   931 }
   931 }
   932 
   932 
  1018     }
  1018     }
  1019 
  1019 
  1020     return id;
  1020     return id;
  1021 }
  1021 }
  1022 
  1022 
  1023 void HbFrameDrawerPrivate::unLoadIcon()
  1023 void HbFrameDrawerPrivate::unLoadIcon(bool unloadedByServer)
  1024 {
  1024 {
  1025     HbIconLoader *loader = HbIconLoader::global();
  1025     HbIconLoader *loader = HbIconLoader::global();
  1026     if (icon) {
  1026     if (icon) {
  1027         //If a consolidated (stitched) icon was created on the themeserver, then
  1027         //If a consolidated (stitched) icon was created on the themeserver, then
  1028         //HbIconLoader::unloadIcon() is used to unload it.
  1028         //HbIconLoader::unloadIcon() is used to unload it.
  1029         loader->unLoadIcon(icon->iconImpl());
  1029         loader->unLoadIcon(icon->iconImpl(),unloadedByServer);
  1030         icon->dispose();
  1030         icon->dispose();
  1031         icon = 0;
  1031         icon = 0;
  1032     }
  1032     }
  1033 
  1033 
  1034     // get a vector of QVector<HbIconImpl*> from QVector<HbMaskableIconImpl*> for unloading.
  1034     // get a vector of QVector<HbIconImpl*> from QVector<HbMaskableIconImpl*> for unloading.
  1050             }
  1050             }
  1051         }
  1051         }
  1052      }
  1052      }
  1053     fallbackIconList.clear();  // vector of HbIconImpl*
  1053     fallbackIconList.clear();  // vector of HbIconImpl*
  1054     fallbackMaskableIconList.clear(); // vector of HbMaskableIconImpl*
  1054     fallbackMaskableIconList.clear(); // vector of HbMaskableIconImpl*
       
  1055 }
       
  1056 
       
  1057 void HbFrameDrawerPrivate::themeChange( const QStringList &updatedFiles)
       
  1058 {
       
  1059     bool unloadIcons = false;
       
  1060     if (updatedFiles.count() == 0 || (icon && updatedFiles.contains(icon->iconFileName()))) {
       
  1061         unloadIcons = true;
       
  1062     } else {
       
  1063         HbMaskableIconImpl *fallbackIcon;
       
  1064         foreach (fallbackIcon, fallbackMaskableIconList) {
       
  1065             if (fallbackIcon && updatedFiles.contains(fallbackIcon->iconFileName())) {
       
  1066                 unloadIcons = true;
       
  1067                 break;
       
  1068             }
       
  1069         }
       
  1070     }
       
  1071 
       
  1072     if (unloadIcons) {
       
  1073         unLoadIcon(true);
       
  1074     }
  1055 }
  1075 }
  1056 
  1076 
  1057 /*! Constructs a new frame drawer item with the cacheFlag enabled  by default.
  1077 /*! Constructs a new frame drawer item with the cacheFlag enabled  by default.
  1058 */
  1078 */
  1059 HbFrameDrawer::HbFrameDrawer(bool cacheFlag)
  1079 HbFrameDrawer::HbFrameDrawer(bool cacheFlag)
  1285 
  1305 
  1286     // Lazy graphics rasterizing is used.
  1306     // Lazy graphics rasterizing is used.
  1287     // Rasterize the frame parts now if that has not been done yet.
  1307     // Rasterize the frame parts now if that has not been done yet.
  1288     if (d->icon && (rect.toRect().size() !=  d->prevRect.size())) {
  1308     if (d->icon && (rect.toRect().size() !=  d->prevRect.size())) {
  1289         d->reset(); 
  1309         d->reset(); 
  1290     } 
  1310     }    
       
  1311     
       
  1312     // update the rendering mode
       
  1313     HbIconLoader::global()->updateRenderingMode(painter->paintEngine()->type());    
  1291     d->prepareFrameIcon();
  1314     d->prepareFrameIcon();
  1292     d->prevRect = rect.toRect();
  1315     d->prevRect = rect.toRect();
  1293     // Paint the frame
  1316     // Paint the frame
  1294     d->paint(painter);
  1317     d->paint(painter);
  1295 }
  1318 }
  1528 * This function should be called when the theme changes. This clears the used frame
  1551 * This function should be called when the theme changes. This clears the used frame
  1529 * graphic.
  1552 * graphic.
  1530 */
  1553 */
  1531 void HbFrameDrawer::themeChanged()
  1554 void HbFrameDrawer::themeChanged()
  1532 {
  1555 {
  1533     d->reset();
  1556 #ifndef HB_TOOL_INTERFACE
       
  1557     // This needs to be disabled to prevent full theme updates when using partial updates with tools.
       
  1558     d->reset(true, true);
       
  1559 #endif
  1534 }
  1560 }
  1535 
  1561 
  1536 /*!
  1562 /*!
  1537 * Sets the layout direction of the frame drawer.
  1563 * Sets the layout direction of the frame drawer.
  1538 *
  1564 *