231 return "BLOB"; |
223 return "BLOB"; |
232 } |
224 } |
233 return suffix; |
225 return suffix; |
234 } |
226 } |
235 |
227 |
236 QString HbIconLoaderPrivate::findIconHelper(const QString &iconName, bool mirrored, bool& mirroredIconFound, bool useThemeIndex) |
228 QString HbIconLoaderPrivate::findSharedResourceHelper(const QString &resourceName, bool mirrored, bool& mirroredIconFound, Hb::ResourceType itemType, bool useThemeIndex) |
237 { |
229 { |
238 Q_UNUSED(useThemeIndex) |
230 Q_UNUSED(useThemeIndex) |
|
231 Q_UNUSED(itemType) |
239 |
232 |
240 mirroredIconFound = false; |
233 mirroredIconFound = false; |
241 QString iconPath; |
234 QString iconPath; |
242 |
235 |
243 if (QDir::isRelativePath(iconName)) { |
236 if (QDir::isRelativePath(resourceName)) { |
244 bool themeIndexUsed = false; |
|
245 |
237 |
246 #ifdef Q_OS_SYMBIAN |
238 #ifdef Q_OS_SYMBIAN |
247 // Try to get themed icon information from theme index |
239 // Try to get themed icon information from theme index |
248 ThemeIndexTables &themeIndex = hbInstance->theme()->d_ptr->themeIndex; |
240 HbThemeIndexResource resource(resourceName); |
249 // Check if there is a valid theme index |
241 if (resource.isValid()) { |
250 if (useThemeIndex && themeIndex.isValid()) { |
242 if (mirrored) { |
251 themeIndexUsed = true; |
243 return resource.fullMirroredFileName(); |
252 |
244 } else { |
253 int tableIndex; |
245 return resource.fullFileName(); |
254 const HbThemeIndexItem *item = themeIndex.getItem(iconName, tableIndex); |
|
255 |
|
256 if (item) { |
|
257 const char *baseAddress = reinterpret_cast<const char *>(themeIndex.tables[tableIndex]); |
|
258 |
|
259 QString fullfilename; |
|
260 |
|
261 // Add drive letter of the used theme if the path does not point to a QT resource |
|
262 if (*(baseAddress + item->folderOffset) != ':') { |
|
263 fullfilename.append(themeIndex.drives[tableIndex]); |
|
264 fullfilename.append(':'); |
|
265 } |
|
266 // Add folder |
|
267 fullfilename.append(baseAddress + item->folderOffset); |
|
268 |
|
269 if (mirrored) { |
|
270 if (item->mirroredExtOffset >= 0) { |
|
271 mirroredIconFound = true; |
|
272 |
|
273 fullfilename.append("mirrored\\"); |
|
274 fullfilename.append(iconName); |
|
275 fullfilename.append(baseAddress + item->mirroredExtOffset); |
|
276 |
|
277 #ifdef THEME_INDEX_TRACES |
|
278 qDebug() << "ThemeIndex: Resolved icon filename:" << fullfilename.toUtf8(); |
|
279 #endif |
|
280 |
|
281 return fullfilename; |
|
282 } |
|
283 } |
|
284 |
|
285 fullfilename.append(iconName); |
|
286 fullfilename.append(baseAddress + item->extOffset); |
|
287 |
|
288 #ifdef THEME_INDEX_TRACES |
|
289 qDebug() << "ThemeIndex: Resolved icon filename:" << fullfilename.toUtf8(); |
|
290 #endif |
|
291 |
|
292 return fullfilename; |
|
293 } |
246 } |
294 } |
247 } |
295 #endif // Q_OS_SYMBIAN |
248 #endif // Q_OS_SYMBIAN |
296 |
249 |
297 // If there was no theme index, search the icon in theme icon dirs (slow) |
250 // If there was no theme index, search the icon in theme icon dirs (slow) |
298 if (!themeIndexUsed) { |
|
299 foreach (const QString &dir, HbThemePrivate::instance()->iconDirectories()) { |
251 foreach (const QString &dir, HbThemePrivate::instance()->iconDirectories()) { |
300 if (mirrored) { |
252 if (mirrored) { |
301 // If icon is mirrored, try to find the icon in a separate "mirrored" folder used for mirrored icons |
253 // If icon is mirrored, try to find the icon in a separate "mirrored" folder used for mirrored icons |
302 iconPath = HbStandardDirs::findResource( dir + "mirrored" + '/' + iconName, Hb::IconResource ); |
254 iconPath = HbStandardDirs::findResource( dir + "mirrored" + '/' + resourceName, Hb::IconResource ); |
303 if( !iconPath.isEmpty() ) { |
255 if( !iconPath.isEmpty() ) { |
304 mirroredIconFound = true; |
256 mirroredIconFound = true; |
305 break; |
|
306 } |
|
307 } |
|
308 |
|
309 iconPath = HbStandardDirs::findResource( dir + iconName, Hb::IconResource ); |
|
310 |
|
311 // If the file was found in this dir, return the filename. |
|
312 if ( !iconPath.isEmpty() ) { |
|
313 break; |
257 break; |
314 } |
258 } |
315 } |
259 } |
|
260 |
|
261 iconPath = HbStandardDirs::findResource( dir + resourceName, Hb::IconResource ); |
|
262 |
|
263 // If the file was found in this dir, return the filename. |
|
264 if ( !iconPath.isEmpty() ) { |
|
265 break; |
|
266 } |
316 } |
267 } |
317 } else { |
268 } else { |
318 // Absolute path. Do not scan through different theme directories. |
269 // Absolute path. Do not scan through different theme directories. |
319 QString iconNameCopy(iconName); |
270 QString iconNameCopy(resourceName); |
320 if (mirrored) { |
271 if (mirrored) { |
321 // If icon is mirrored, try to find the icon in a separate "mirrored" folder used for mirrored icons |
272 // If icon is mirrored, try to find the icon in a separate "mirrored" folder used for mirrored icons |
322 |
273 |
323 // Find the directory part from the full filename |
274 // Find the directory part from the full filename |
324 int index1 = iconName.lastIndexOf('/'); |
275 int index1 = resourceName.lastIndexOf('/'); |
325 int index2 = iconName.lastIndexOf('\\'); |
276 int index2 = resourceName.lastIndexOf('\\'); |
326 |
277 |
327 int index = index1 > index2 ? index1 : index2; |
278 int index = index1 > index2 ? index1 : index2; |
328 |
279 |
329 QString iconNameCopy(iconName); |
280 QString iconNameCopy(resourceName); |
330 |
281 |
331 if (index > 0) { |
282 if (index > 0) { |
332 iconNameCopy.insert(index+1, QString("mirrored\\")); |
283 iconNameCopy.insert(index+1, QString("mirrored/")); |
333 } |
284 } |
334 iconPath = HbStandardDirs::findResource(iconNameCopy, Hb::IconResource); |
285 iconPath = HbStandardDirs::findResource(iconNameCopy, Hb::IconResource); |
335 |
286 |
336 if( !iconPath.isEmpty() ) { |
287 if( !iconPath.isEmpty() ) { |
337 mirroredIconFound = true; |
288 mirroredIconFound = true; |
338 return iconPath; |
289 return iconPath; |
339 } |
290 } |
340 } |
291 } |
341 |
292 |
342 iconPath = HbStandardDirs::findResource(iconName, Hb::IconResource); |
293 iconPath = HbStandardDirs::findResource(resourceName, Hb::IconResource); |
343 } |
294 } |
344 |
295 |
345 return iconPath; |
296 return iconPath; |
346 /* |
297 /* |
347 From Freedesktop.org: |
298 From Freedesktop.org: |
510 void HbIconLoaderPrivate::setLayoutMirrored(bool mirrored) |
463 void HbIconLoaderPrivate::setLayoutMirrored(bool mirrored) |
511 { |
464 { |
512 layoutMirrored = mirrored ? Mirrored : NotMirrored; |
465 layoutMirrored = mirrored ? Mirrored : NotMirrored; |
513 } |
466 } |
514 |
467 |
515 void HbIconLoaderPrivate::createMirroredList() |
|
516 { |
|
517 /* Todo: mirrored.txt will be refactored |
|
518 // Find mirrored.txt file |
|
519 QString filename = HbStandardDirs::findResource("themes/themes/mirrored.txt", Hb::ThemeResource); |
|
520 if (filename.endsWith("mirrored.txt")) { |
|
521 // Try to read file |
|
522 QFile file(filename); |
|
523 if (file.open(QIODevice::ReadOnly)) { |
|
524 QString line; |
|
525 |
|
526 while(!file.atEnd()) { |
|
527 QByteArray dirtyLine = file.readLine(); |
|
528 line = QString(dirtyLine).trimmed(); |
|
529 // Skip empty lines and comment lines |
|
530 if (line.isEmpty() || line.at(0) == '#') { |
|
531 continue; |
|
532 } |
|
533 mirroredList.append(line); |
|
534 } |
|
535 |
|
536 // Sort the list |
|
537 qSort(mirroredList.begin(), mirroredList.end()); |
|
538 } |
|
539 } |
|
540 */ |
|
541 // button |
|
542 mirroredList << "qtg_fr_btn_normal" << "qtg_fr_btn_pressed" << "qtg_fr_btn_latched" << "qtg_fr_btn_highlight"; |
|
543 mirroredList << "qtg_fr_btn_latched_highlight" << "qtg_fr_btn_disabled"; |
|
544 |
|
545 // form |
|
546 mirroredList << "qtg_fr_form_value"; |
|
547 |
|
548 // grid |
|
549 mirroredList << "qtg_fr_grid_normal" << "qtg_fr_grid_highlight" << "qtg_fr_grid_pressed"; |
|
550 |
|
551 // list |
|
552 mirroredList << "qtg_fr_list_normal" << "qtg_fr_list_highlight" << "qtg_fr_list_pressed" << "qtg_fr_list_parent_normal"; |
|
553 mirroredList << "qtg_fr_convlist_sent_normal" << "qtg_fr_convlist_sent_highlight" << "qtg_fr_convlist_sent_pressed"; |
|
554 mirroredList << "qtg_fr_convlist_received_normal" << "qtg_fr_convlist_received_highlight" << "qtg_fr_convlist_received_pressed"; |
|
555 |
|
556 // popup |
|
557 mirroredList << "qtg_fr_popup_list_normal" << "qtg_fr_popup_list_pressed" << "qtg_fr_popup_list_highlight" << "qtg_fr_popup_list_parent_normal"; |
|
558 mirroredList << "qtg_fr_popup_grid_normal" << "qtg_fr_popup_grid_pressed" << "qtg_fr_popup_grid_highlight" << "qtg_graf_dimming_image"; |
|
559 mirroredList << "qtg_fr_popup" << "qtg_fr_popup_secondary" << "qtg_fr_popup_preview"; |
|
560 |
|
561 // progressive slider |
|
562 mirroredList << "qtg_fr_progslider_frame" << "qtg_fr_progslider_pressed" << "qtg_fr_progslider_loaded"; |
|
563 mirroredList << "qtg_fr_progslider_played" << "qtg_graf_progslider_handle_normal" << "qtg_graf_progslider_handle_pressed"; |
|
564 |
|
565 // slider |
|
566 mirroredList << "qtg_fr_slider_v_frame" << "qtg_fr_slider_v_filled" << "qtg_graf_slider_v_handle_normal" << "qtg_graf_slider_v_tick_minor"; |
|
567 mirroredList << "qtg_graf_slider_v_tick_major" << "qtg_fr_slider_h_frame" << "qtg_fr_slider_h_filled" << "qtg_graf_slider_h_handle_normal"; |
|
568 mirroredList << "qtg_graf_slider_h_tick_minor" << "qtg_graf_slider_h_tick_major"; |
|
569 |
|
570 // tabs |
|
571 mirroredList << "qtg_fr_tab_active" << "qtg_fr_tab_passive_normal" << "qtg_fr_tab_passive_pressed" << "qtg_fr_tab_mask"; |
|
572 |
|
573 // toolbar |
|
574 mirroredList << "qtg_fr_tb_h_normal" << "qtg_fr_tb_h_pressed" << "qtg_fr_tb_h_latched" << "qtg_fr_tb_h_disabled"; |
|
575 mirroredList << "qtg_fr_tb_v_normal" << "qtg_fr_tb_v_pressed" << "qtg_fr_tb_v_latched" << "qtg_fr_tb_v_disabled"; |
|
576 |
|
577 // toolbar extension |
|
578 mirroredList << "qtg_fr_tb_ext"; |
|
579 |
|
580 // scrollbar |
|
581 mirroredList << "qtg_fr_scroll_v_handle" << "qtg_fr_scroll_v_frame" << "qtg_fr_scroll_h_handle" << "qtg_fr_scroll_h_frame"; |
|
582 |
|
583 // status pane |
|
584 mirroredList << "qtg_fr_status_normal" << "qtg_fr_status_pressed" << "qtg_fr_status_latched" << "qtg_indi_status_options"; |
|
585 |
|
586 qSort(mirroredList.begin(), mirroredList.end()); |
|
587 } |
|
588 |
|
589 #ifdef HB_ICONIMPL_CACHE |
468 #ifdef HB_ICONIMPL_CACHE |
590 QByteArray HbIconLoaderPrivate::createCacheKeyFrom(const QString &iconName, const QSizeF &size, |
469 QByteArray HbIconLoaderPrivate::createCacheKeyFrom(const QString &iconName, const QSizeF &size, |
591 Qt::AspectRatioMode aspectRatioMode, QIcon::Mode mode, bool mirrored, const QColor &color) |
470 Qt::AspectRatioMode aspectRatioMode, QIcon::Mode mode, bool mirrored, const QColor &color, |
592 { |
471 HbRenderingMode renderMode) |
593 static const int paramArraySize = 7; |
472 { |
|
473 static const int paramArraySize = 8; |
594 |
474 |
595 // This uses QByteArray to improve performance compared to QString. |
475 // This uses QByteArray to improve performance compared to QString. |
596 // It allows appending stuff with less heap allocations and conversions compared to using QString. |
476 // It allows appending stuff with less heap allocations and conversions compared to using QString. |
597 QByteArray cacheKey; |
477 QByteArray cacheKey; |
598 int nameSize = iconName.size(); |
478 int nameSize = iconName.size(); |
633 : QObject( parent ) |
515 : QObject( parent ) |
634 { |
516 { |
635 setObjectName( appName ); |
517 setObjectName( appName ); |
636 d = new HbIconLoaderPrivate(); |
518 d = new HbIconLoaderPrivate(); |
637 |
519 |
|
520 // Set default rendering mode to EHWRendering |
|
521 renderMode = EHWRendering; |
|
522 |
638 // Delete the icon loader when the application is destroyed. |
523 // Delete the icon loader when the application is destroyed. |
639 connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(destroy())); |
524 connect(QCoreApplication::instance(), SIGNAL(aboutToQuit()), this, SLOT(destroy())); |
640 |
525 |
641 connect(HbLayoutDirectionNotifier::instance(), SIGNAL(layoutDirectionChangeStarted()), |
526 connect(HbLayoutDirectionNotifier::instance(), SIGNAL(layoutDirectionChangeStarted()), |
642 this, SLOT(updateLayoutDirection())); |
527 this, SLOT(updateLayoutDirection())); |
|
528 |
|
529 #ifdef HB_TOOL_INTERFACE |
|
530 // This enables partial theme updates. |
|
531 connect(&hbInstance->theme()->d_ptr->iconTheme, SIGNAL(iconsUpdated(QStringList)), this, SLOT(themeChange(QStringList))); |
|
532 #endif |
643 } |
533 } |
644 |
534 |
645 HbIconLoader::~HbIconLoader() |
535 HbIconLoader::~HbIconLoader() |
646 { |
536 { |
647 delete d; |
537 delete d; |
689 // Step 2: There was no animation definition, try to get default size from theme index if it is a themed icon |
579 // Step 2: There was no animation definition, try to get default size from theme index if it is a themed icon |
690 |
580 |
691 // TODO: change this to simpler function call in Symbian OS env |
581 // TODO: change this to simpler function call in Symbian OS env |
692 if (QDir::isRelativePath(iconName)) { |
582 if (QDir::isRelativePath(iconName)) { |
693 #ifdef Q_OS_SYMBIAN |
583 #ifdef Q_OS_SYMBIAN |
694 |
584 // Try to get themed icon information from theme index |
695 // Try to get themed icon default size from theme index |
585 HbThemeIndexResource resource(iconName); |
696 ThemeIndexTables &themeIndex = hbInstance->theme()->d_ptr->themeIndex; |
586 if (resource.isValid()) { |
697 // Check if there is a valid theme index |
587 // Try to get themed icon default size from theme index |
698 if (themeIndex.isValid()) { |
588 if (params.mirrored && resource.mirroredItemSize().isValid()) { |
699 int tableIndex; |
589 size = resource.mirroredItemSize(); |
700 const HbThemeIndexItem *item = themeIndex.getItem(iconName, tableIndex); |
590 } else { |
701 if (item) { |
591 size = resource.defaultItemSize(); |
702 if (params.mirrored && item->mirroredDefaultSize.isValid()) { |
|
703 size = item->mirroredDefaultSize; |
|
704 } else { |
|
705 size = item->defaultSize; |
|
706 } |
|
707 } |
592 } |
708 // Returns invalid size if there is a valid theme index, but the item was not found there. |
593 // Returns invalid size if there is a valid theme index, but the item was not found there. |
709 return size; |
594 return size; |
710 } else { |
595 } else { |
711 // Step 3: Theme index was not used, try to get icon's default size from theme server's default size cache. |
596 // Step 3: Theme index was not used, try to get icon's default size from theme server's default size cache. |
712 params.iconFileName = resolveIconFileName(params); |
597 params.iconFileName = resolveIconFileName(params); |
713 } |
598 } |
714 |
|
715 #else |
599 #else |
716 params.iconFileName = resolveIconFileName(params); |
600 params.iconFileName = resolveIconFileName(params); |
717 #endif |
601 #endif |
718 } else { // Absolute path, use it directly without resolving anything. |
602 } else { // Absolute path, use it directly without resolving anything. |
719 params.iconFileName = iconName; |
603 params.iconFileName = iconName; |
720 } |
604 } |
721 |
605 |
722 // If icon filename could not be resolved, return |
606 // If icon filename could not be resolved, return |
895 } |
784 } |
896 |
785 |
897 /*! |
786 /*! |
898 \internal |
787 \internal |
899 |
788 |
900 This is a wrapper for findIconHelper() (when the resource type is |
789 This is a wrapper for findSharedResourceHelper(). It is used for getting |
901 Hb::EffectIcon). It is used for getting AXML and other content from the |
790 resources from the themeserver. |
902 themeserver. |
|
903 |
|
904 If \a resType is Hb::EffectResource then the file is searched among the |
|
905 effects in the theme. |
|
906 |
791 |
907 The return value is either same as \a name, when the file is not found in the |
792 The return value is either same as \a name, when the file is not found in the |
908 theme, or the full path and name to the file found in the theme. In certain |
793 theme, or the full path and name to the file found in the theme. In certain |
909 situations the return value can also be an empty string, therefore it should |
794 situations the return value can also be an empty string, therefore it should |
910 not be trusted and used without any further examination. |
795 not be trusted and used without any further examination. |
911 */ |
796 */ |
912 QString HbIconLoader::findSharedResource(const QString &name, Hb::ResourceType resType) |
797 QString HbIconLoader::findSharedResource(const QString &name, Hb::ResourceType resType) |
913 { |
798 { |
914 bool temp; |
799 bool temp; |
915 if (resType == Hb::EffectResource) { |
800 return HbIconLoaderPrivate::findSharedResourceHelper(name, false, temp, resType); |
916 QMap<int, QString> effectHier = HbThemeUtils::constructHierarchyListWithPathInfo( |
|
917 name, HbTheme::instance()->name(), Hb::EffectResource); |
|
918 HbStandardDirs::findResourceList(effectHier, Hb::EffectResource); |
|
919 |
|
920 // Just take the first value from the map. (note that maps are sorted by the key) |
|
921 foreach (const QString &file, effectHier) { |
|
922 return file; |
|
923 } |
|
924 |
|
925 // The map was empty, return empty string. |
|
926 return QString(); |
|
927 } else { |
|
928 // Assume icon case (png, svg, axml, etc.) |
|
929 |
|
930 // TODO: theme index does not support currently axmls, so setting 'useThemeIndex' parameter to false |
|
931 return HbIconLoaderPrivate::findIconHelper(name, false, temp, false); |
|
932 } |
|
933 } |
801 } |
934 |
802 |
935 /*! |
803 /*! |
936 This function is used to register the IconEngine instance to IconLoader |
804 This function is used to register the IconEngine instance to IconLoader |
937 */ |
805 */ |
1379 #endif |
1249 #endif |
1380 } |
1250 } |
1381 |
1251 |
1382 // Delete original pixmap if its size is large |
1252 // Delete original pixmap if its size is large |
1383 source->deletePixmapIfLargerThan(PIXMAP_SIZE_LIMIT); |
1253 source->deletePixmapIfLargerThan(PIXMAP_SIZE_LIMIT); |
|
1254 } |
|
1255 |
|
1256 /*! |
|
1257 * \fn void HbIconLoader::switchRenderingMode() |
|
1258 * |
|
1259 * This function gets notified when the rendering mode of the application changes e.g |
|
1260 * ( Hardware - Software rendering or vice versa ). If the mode is changed from |
|
1261 * Hardware to Software, all Hardware rendered icons will release the GPU resources. |
|
1262 * This function also initiates an IPC call to ThemeServer, so that the server |
|
1263 * can do its part of cleanup. |
|
1264 * \a newRenderMode new rendering mode of application |
|
1265 */ |
|
1266 |
|
1267 void HbIconLoader::switchRenderingMode(HbRenderingMode newRenderMode) |
|
1268 { |
|
1269 #ifndef Q_OS_SYMBIAN |
|
1270 Q_UNUSED(newRenderMode) |
|
1271 #endif |
|
1272 |
|
1273 #if defined(HB_SGIMAGE_ICON) || defined(HB_NVG_CS_ICON) |
|
1274 if (newRenderMode != renderMode) { |
|
1275 if (newRenderMode == ESWRendering) { |
|
1276 // switching from HW to SW mode |
|
1277 freeGpuIconData(); |
|
1278 } |
|
1279 if (HbThemeClient::global()->switchRenderingMode(newRenderMode)) { |
|
1280 renderMode = newRenderMode; |
|
1281 } |
|
1282 } |
|
1283 #endif |
|
1284 } |
|
1285 |
|
1286 void HbIconLoader::updateRenderingMode(QPaintEngine::Type type) |
|
1287 { |
|
1288 if (type == QPaintEngine::OpenVG) { |
|
1289 renderMode = EHWRendering; |
|
1290 } else { |
|
1291 renderMode = ESWRendering; |
|
1292 } |
1384 } |
1293 } |
1385 |
1294 |
1386 /*! |
1295 /*! |
1387 * \fn HbIconImpl* HbIconLoader::loadIcon() |
1296 * \fn HbIconImpl* HbIconLoader::loadIcon() |
1388 * |
1297 * |
1472 // Step 2: There was no animation definition, try get icon from server |
1382 // Step 2: There was no animation definition, try get icon from server |
1473 if (!params.animationCreated) { |
1383 if (!params.animationCreated) { |
1474 |
1384 |
1475 #ifdef HB_ICONIMPL_CACHE |
1385 #ifdef HB_ICONIMPL_CACHE |
1476 QByteArray cacheKey = d->createCacheKeyFrom( params.iconName, params.size, params.aspectRatioMode, |
1386 QByteArray cacheKey = d->createCacheKeyFrom( params.iconName, params.size, params.aspectRatioMode, |
1477 params.mode, params.mirrored, params.color ); |
1387 params.mode, params.mirrored, params.color, params.renderMode ); |
1478 //look up in the local iconImplCache. |
1388 //look up in the local iconImplCache. |
1479 //If found return the ptr directly |
1389 //If found return the ptr directly |
1480 if (iconImplCache.contains(cacheKey)) { |
1390 if (iconImplCache.contains(cacheKey)) { |
1481 HbIconImpl * ptr = iconImplCache.value(cacheKey); |
1391 HbIconImpl * ptr = iconImplCache.value(cacheKey); |
1482 ptr->incrementRefCount(); |
1392 ptr->incrementRefCount(); |
1617 // Consolidated icon will be created for NVG with SGImage lite support. |
1527 // Consolidated icon will be created for NVG with SGImage lite support. |
1618 // and when NVG is not available. |
1528 // and when NVG is not available. |
1619 #if defined(HB_ICONIMPL_CACHE) |
1529 #if defined(HB_ICONIMPL_CACHE) |
1620 |
1530 |
1621 QByteArray cacheKey = d->createCacheKeyFrom(multiPartIconData.multiPartIconId, size, |
1531 QByteArray cacheKey = d->createCacheKeyFrom(multiPartIconData.multiPartIconId, size, |
1622 aspectRatioMode, mode, mirrored, color); |
1532 aspectRatioMode, mode, mirrored, color, renderMode); |
1623 //If consolidated icon found in the client's cache, increment ref-count and return |
1533 //If consolidated icon found in the client's cache, increment ref-count and return |
1624 if (iconImplCache.contains(cacheKey)) { |
1534 if (iconImplCache.contains(cacheKey)) { |
1625 HbIconImpl * ptr = iconImplCache.value(cacheKey); |
1535 HbIconImpl * ptr = iconImplCache.value(cacheKey); |
1626 ptr->incrementRefCount(); |
1536 ptr->incrementRefCount(); |
1627 #ifdef HB_ICON_CACHE_DEBUG |
1537 #ifdef HB_ICON_CACHE_DEBUG |
1649 |
1559 |
1650 //If consolidated icon was not found in the client's cache, initiate an IPC to load |
1560 //If consolidated icon was not found in the client's cache, initiate an IPC to load |
1651 //the consolidated icon on themeserver |
1561 //the consolidated icon on themeserver |
1652 iconInfo = HbThemeClient::global()->getMultiPartIconInfo(iconPathList, |
1562 iconInfo = HbThemeClient::global()->getMultiPartIconInfo(iconPathList, |
1653 multiPartIconData, size, aspectRatioMode, mode, |
1563 multiPartIconData, size, aspectRatioMode, mode, |
1654 (mirrored && !mirroredIconFound), options, color); |
1564 (mirrored && !mirroredIconFound), options, color, renderMode); |
1655 |
1565 |
1656 #ifdef HB_ICON_TRACES |
1566 #ifdef HB_ICON_TRACES |
1657 qDebug() << "HbIconLoader::getMultiPartIconInfo, offset from server: " << iconInfo.pixmapData.offset << iconPathList; |
1567 qDebug() << "HbIconLoader::getMultiPartIconInfo, offset from server: " << iconInfo.pixmapData.offset << iconPathList; |
1658 #endif |
1568 #endif |
1659 |
1569 |
1796 bool mirroredIconFound, |
1708 bool mirroredIconFound, |
1797 HbIconLoader::IconLoaderOptions options, |
1709 HbIconLoader::IconLoaderOptions options, |
1798 const QColor &color, |
1710 const QColor &color, |
1799 HbIconLoader::IconDataType type, |
1711 HbIconLoader::IconDataType type, |
1800 HbIconLoader::Purpose, |
1712 HbIconLoader::Purpose, |
1801 QVector<HbIconImpl *> & iconImplList) |
1713 QVector<HbIconImpl *> & iconImplList, |
1802 { |
1714 HbRenderingMode currRenderMode) |
1803 Q_UNUSED(type); |
1715 { |
1804 QVector<int> posList; |
1716 Q_UNUSED(type); |
|
1717 QVector<int> posList; |
1805 #ifdef HB_ICONIMPL_CACHE |
1718 #ifdef HB_ICONIMPL_CACHE |
1806 // search the client cache first before asking the server |
1719 // search the client cache first before asking the server |
1807 for(int i = 0; i < multiPartIconList.count(); i++) { |
1720 for(int i = 0; i < multiPartIconList.count(); i++) { |
1808 QByteArray cacheKey = d->createCacheKeyFrom( multiPartIconList[i], sizeList[i], aspectRatioMode, |
1721 QByteArray cacheKey = d->createCacheKeyFrom( multiPartIconList[i], sizeList[i], aspectRatioMode, |
1809 mode, mirrored, color ); |
1722 mode, mirrored, color, currRenderMode ); |
1810 //look up in the local iconImplCache. |
1723 //look up in the local iconImplCache. |
1811 //If found return the ptr directly |
1724 //If found return the ptr directly |
1812 HbIconImpl * ptr = 0; |
1725 HbIconImpl * ptr = 0; |
1813 if (iconImplCache.contains(cacheKey)) { |
1726 if (iconImplCache.contains(cacheKey)) { |
1814 ptr = iconImplCache.value(cacheKey); |
1727 ptr = iconImplCache.value(cacheKey); |
1857 |
1770 |
1858 impl = HbIconImplCreator::createIconImpl(iconInfoList.icon[i], params); |
1771 impl = HbIconImplCreator::createIconImpl(iconInfoList.icon[i], params); |
1859 |
1772 |
1860 #ifdef HB_ICONIMPL_CACHE |
1773 #ifdef HB_ICONIMPL_CACHE |
1861 QByteArray cacheKey = d->createCacheKeyFrom(multiPartIconList[i], sizeList.at(i) , aspectRatioMode, |
1774 QByteArray cacheKey = d->createCacheKeyFrom(multiPartIconList[i], sizeList.at(i) , aspectRatioMode, |
1862 mode, mirrored, color); |
1775 mode, mirrored, color, currRenderMode); |
1863 iconImplCache.insert(cacheKey, impl); |
1776 iconImplCache.insert(cacheKey, impl); |
1864 #ifdef HB_ICON_CACHE_DEBUG |
1777 #ifdef HB_ICON_CACHE_DEBUG |
1865 qDebug() << "HbIconLoader::getMultiIconImplFromServer(): " << params.iconName << " inserted into impl-cache, ref-count now = " << impl->refCount(); |
1778 qDebug() << "HbIconLoader::getMultiIconImplFromServer(): " << params.iconName << " inserted into impl-cache, ref-count now = " << impl->refCount(); |
1866 #endif |
1779 #endif |
1867 |
1780 |