author | zecke <zecke> | 2004-12-30 14:07:11 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-12-30 14:07:11 (UTC) |
commit | 8467a23d6a7f4b52619b60462c8ba80d8a736a9e (patch) (unidiff) | |
tree | b2ee7da7ee41cd4b3aab4215cddfcfaebd7c72e0 | |
parent | e3fa443e845e76707171c6fae79125892a369b75 (diff) | |
download | opie-8467a23d6a7f4b52619b60462c8ba80d8a736a9e.zip opie-8467a23d6a7f4b52619b60462c8ba80d8a736a9e.tar.gz opie-8467a23d6a7f4b52619b60462c8ba80d8a736a9e.tar.bz2 |
Remove the 'namespacing' of global and app icons in the PixmapCache
as it didn't utilize the embedded pixmaps anymore.
Revert of the last commit
-rw-r--r-- | library/resource.cpp | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/library/resource.cpp b/library/resource.cpp index 43fdc60..cfa0d26 100644 --- a/library/resource.cpp +++ b/library/resource.cpp | |||
@@ -59,41 +59,16 @@ static bool g_notUseSet = ::getenv("OVERWRITE_ICON_SET"); | |||
59 | Returns the QPixmap called \a pix. You should avoid including | 59 | Returns the QPixmap called \a pix. You should avoid including |
60 | any filename type extension (e.g. .png, .xpm). | 60 | any filename type extension (e.g. .png, .xpm). |
61 | */ | 61 | */ |
62 | QPixmap Resource::loadPixmap( const QString &pix ) | 62 | QPixmap Resource::loadPixmap( const QString &pix ) |
63 | { | 63 | { |
64 | QPixmap pm; | 64 | QPixmap pm; |
65 | 65 | QString key="QPE_"+pix; | |
66 | // Give the pixmaps some kind of namespace in the pixmapcache | 66 | if ( !QPixmapCache::find(key,pm) ) { |
67 | int index = pix.find('/'); | 67 | pm.convertFromImage(loadImage(pix)); |
68 | QString appName1 = qApp->argv()[0]; | 68 | QPixmapCache::insert(key,pm); |
69 | appName1 = appName1.replace(QRegExp(".*/"),""); | ||
70 | QString appName2 = pix.left(index); | ||
71 | |||
72 | if ( appName2 == "" || appName2 == pix || appName2 == "icons" ) | ||
73 | appName2 = "Global"; | ||
74 | |||
75 | QString appKey1 = "_QPE_" + appName1 + "_" + pix; | ||
76 | QString appKey2 = "_QPE_" + appName2 + "_" + pix.mid(index+1); | ||
77 | |||
78 | if ( !QPixmapCache::find(appKey1, pm) ) { | ||
79 | if ( !QPixmapCache::find(appKey2, pm) ) { | ||
80 | QImage img; | ||
81 | QString f = findPixmap( pix ); | ||
82 | if ( !f.isEmpty() ) { | ||
83 | img.load(f); | ||
84 | if ( !img.isNull() ) { | ||
85 | pm.convertFromImage(img); | ||
86 | if ( f.contains(appName1) ) { | ||
87 | QPixmapCache::insert( appKey1, pm); | ||
88 | } else { | ||
89 | QPixmapCache::insert( appKey2, pm); | ||
90 | } | ||
91 | } | ||
92 | } | ||
93 | } | ||
94 | } | 69 | } |
95 | return pm; | 70 | return pm; |
96 | } | 71 | } |
97 | 72 | ||
98 | /*! | 73 | /*! |
99 | Returns the QBitmap called \a pix. You should avoid including | 74 | Returns the QBitmap called \a pix. You should avoid including |