From 987bc9a2c5b39ddd4dc2a665cea65688bfd2179e Mon Sep 17 00:00:00 2001 From: wimpie Date: Sun, 09 Jan 2005 02:59:13 +0000 Subject: 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 --- (limited to 'library/resource.cpp') diff --git a/library/resource.cpp b/library/resource.cpp index cfa0d26..b31876f 100644 --- a/library/resource.cpp +++ b/library/resource.cpp @@ -59,13 +59,19 @@ static bool g_notUseSet = ::getenv("OVERWRITE_ICON_SET"); Returns the QPixmap called \a pix. You should avoid including any filename type extension (e.g. .png, .xpm). */ +#include QPixmap Resource::loadPixmap( const QString &pix ) { - QPixmap pm; + QPixmap pm; // null pixmap QString key="QPE_"+pix; if ( !QPixmapCache::find(key,pm) ) { - pm.convertFromImage(loadImage(pix)); - QPixmapCache::insert(key,pm); + QImage I = loadImage(pix); + if( I.isNull() ) { + qWarning( "Could not load %s", pix.latin1() ); + } else { + pm.convertFromImage(I); + QPixmapCache::insert(key,pm); + } } return pm; } @@ -101,7 +107,6 @@ QString Resource::findPixmap( const QString &pix ) if ( QFile( f ).exists() ) return f; - // All formats... QStrList fileFormats = QImageIO::inputFormats(); QString ff = fileFormats.first(); -- cgit v0.9.0.2