author | wimpie <wimpie> | 2005-01-09 02:59:13 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2005-01-09 02:59:13 (UTC) |
commit | 987bc9a2c5b39ddd4dc2a665cea65688bfd2179e (patch) (unidiff) | |
tree | 815fc6d12162f1a5eccc4b1ae0da61dea3811bdf /library/resource.cpp | |
parent | e54346d28b19d3ac671802a25e8c03f346693291 (diff) | |
download | opie-987bc9a2c5b39ddd4dc2a665cea65688bfd2179e.zip opie-987bc9a2c5b39ddd4dc2a665cea65688bfd2179e.tar.gz opie-987bc9a2c5b39ddd4dc2a665cea65688bfd2179e.tar.bz2 |
applnk : lazy loading of mime type icons (load only when needed)
resource.cpp : print warning when requested image cannot be found
and print the name of that image too
-rw-r--r-- | library/resource.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/library/resource.cpp b/library/resource.cpp index cfa0d26..b31876f 100644 --- a/library/resource.cpp +++ b/library/resource.cpp | |||
@@ -61,9 +61,15 @@ static bool g_notUseSet = ::getenv("OVERWRITE_ICON_SET"); | |||
61 | */ | 61 | */ |
62 | #include <stdio.h> | ||
62 | QPixmap Resource::loadPixmap( const QString &pix ) | 63 | QPixmap Resource::loadPixmap( const QString &pix ) |
63 | { | 64 | { |
64 | QPixmap pm; | 65 | QPixmap pm; // null pixmap |
65 | QString key="QPE_"+pix; | 66 | QString key="QPE_"+pix; |
66 | if ( !QPixmapCache::find(key,pm) ) { | 67 | if ( !QPixmapCache::find(key,pm) ) { |
67 | pm.convertFromImage(loadImage(pix)); | 68 | QImage I = loadImage(pix); |
68 | QPixmapCache::insert(key,pm); | 69 | if( I.isNull() ) { |
70 | qWarning( "Could not load %s", pix.latin1() ); | ||
71 | } else { | ||
72 | pm.convertFromImage(I); | ||
73 | QPixmapCache::insert(key,pm); | ||
74 | } | ||
69 | } | 75 | } |
@@ -103,3 +109,2 @@ QString Resource::findPixmap( const QString &pix ) | |||
103 | 109 | ||
104 | |||
105 | // All formats... | 110 | // All formats... |