aboutsummaryrefslogtreecommitdiff
path: root/src/corelib/theme/mthemedaemon.cpp
diff options
context:
space:
mode:
authorJanne Heikkilä <janne.heikkila@symbio.com>2010-07-29 14:04:12 +0300
committerTomas Junnonen <tomas.junnonen@nokia.com>2010-07-30 11:30:05 +0300
commit301e4d1a1237b4b9e4d1c9de244e29ef299f71eb (patch)
treeba7c6ff7c3de7e8e0dc7433b77e28d88768e37cd /src/corelib/theme/mthemedaemon.cpp
parent9f843372fa404951d9e4df08f8b621bf8a8090f9 (diff)
Fixes: NB#176789 - Loading a specific theme icons / styles when the language is switched (example: arabic) is not working
RevBy: Tomas Junnonen Details: Added support for localizing all the graphics assets (images, icons, svgs). Previously only icons could be localized.
Diffstat (limited to 'src/corelib/theme/mthemedaemon.cpp')
-rw-r--r--src/corelib/theme/mthemedaemon.cpp37
1 files changed, 16 insertions, 21 deletions
diff --git a/src/corelib/theme/mthemedaemon.cpp b/src/corelib/theme/mthemedaemon.cpp
index 238add71..249b110d 100644
--- a/src/corelib/theme/mthemedaemon.cpp
+++ b/src/corelib/theme/mthemedaemon.cpp
@@ -396,25 +396,21 @@ void MThemeDaemon::changeLocale(const QString &newLocale, const QList<MThemeDaem
// get all icons from this client
for (; i != end; ++i) {
- // is this image an icon?
- if (dynamic_cast<IconImageResource *>(i.value())) {
-
- bool reload = false;
- foreach(MThemeImagesDirectory * imdir, themeImageDirs) {
- if (imdir->isLocaleSpecificImage(i.key().imageId)) {
- reload = true;
- break;
- }
+ bool reload = false;
+ foreach(MThemeImagesDirectory * imdir, themeImageDirs) {
+ if (imdir->isLocalizedResource(i.key().imageId)) {
+ reload = true;
+ break;
}
+ }
- if (reload) {
- // this image was locale specific icon so mark it to be reloaded
- pixmapsToBeReloaded.append(i.key());
- mostUsedPixmaps.reload(i.key(), i.value());
- } else {
- // this image was icon but not locale specific so mark it as potential
- potentialReloadlist.append(qMakePair(i.key(), i.value()));
- }
+ if (reload) {
+ // this image was locale specific icon so mark it to be reloaded
+ pixmapsToBeReloaded.append(i.key());
+ mostUsedPixmaps.reload(i.key(), i.value());
+ } else {
+ // this image was icon but not locale specific so mark it as potential
+ potentialReloadlist.append(qMakePair(i.key(), i.value()));
}
}
@@ -429,17 +425,16 @@ void MThemeDaemon::changeLocale(const QString &newLocale, const QList<MThemeDaem
// load the new locale specific images
foreach(MThemeImagesDirectory * imdir, themeImageDirs) {
- imdir->reloadLocaleSpecificImages(newLocale);
+ imdir->reloadLocalizedResources(newLocale);
}
+ //if new locale contains some new locale specific resources, reload them as well
typedef QPair<PixmapIdentifier, ImageResource *> pi_ir;
typedef QPair<MThemeDaemonClient *, QList<pi_ir> > c_pi_ir;
-
foreach(const c_pi_ir & potentialIconsFromClient, potentialIconsFromClients) {
foreach(const pi_ir & potentialIcon, potentialIconsFromClient.second) {
-
foreach(MThemeImagesDirectory * imdir, themeImageDirs) {
- if (imdir->isLocaleSpecificImage(potentialIcon.first.imageId)) {
+ if (imdir->isLocalizedResource(potentialIcon.first.imageId)) {
releasePixmap(potentialIconsFromClient.first, potentialIcon.first);
mostUsedPixmaps.reload(potentialIcon.first, potentialIcon.second);
pixmapsToReload[potentialIconsFromClient.first].append(potentialIcon.first);