author | sandman <sandman> | 2002-12-10 23:18:22 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-12-10 23:18:22 (UTC) |
commit | 763b6ad10dbb7a23c446347cb7fb88cfbadd3e27 (patch) (side-by-side diff) | |
tree | 0da5085b632bcd5084065c7814007e413600a7d4 | |
parent | 967fa32fa3eb3296f675c9d7af8cce838c6b592b (diff) | |
download | opie-763b6ad10dbb7a23c446347cb7fb88cfbadd3e27.zip opie-763b6ad10dbb7a23c446347cb7fb88cfbadd3e27.tar.gz opie-763b6ad10dbb7a23c446347cb7fb88cfbadd3e27.tar.bz2 |
added a little debug output to the image loading routine to aid in finding
application startup time problems
-rw-r--r-- | library/resource.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/library/resource.cpp b/library/resource.cpp index 0920b67..6f164c7 100644 --- a/library/resource.cpp +++ b/library/resource.cpp @@ -57,96 +57,98 @@ namespace { */ /*! Returns the QPixmap called \a pix. You should avoid including any filename type extension (e.g. .png, .xpm). */ QPixmap Resource::loadPixmap( const QString &pix ) { QPixmap pm; QString key="QPE_"+pix; if ( !QPixmapCache::find(key,pm) ) { pm.convertFromImage(loadImage(pix)); QPixmapCache::insert(key,pm); } return pm; } /*! Returns the QBitmap called \a pix. You should avoid including any filename type extension (e.g. .png, .xpm). */ QBitmap Resource::loadBitmap( const QString &pix ) { QBitmap bm; bm = loadPixmap(pix); return bm; } /*! Returns the filename of a pixmap called \a pix. You should avoid including any filename type extension (e.g. .png, .xpm). Normally you will use loadPixmap() rather than this function. */ QString Resource::findPixmap( const QString &pix ) { QString picsPath = QPEApplication::qpeDir() + "pics/"; QString f; // Common case optimizations... f = picsPath + pix + ".png"; if ( QFile( f ).exists() ) return f; f = picsPath + pix + ".xpm"; if ( QFile( f ).exists() ) return f; + qDebug ( "\nLoading of image '%s' is not ideal (either it doesn't exist or an extension was specified)\n", pix.latin1()); + // All formats... QStrList fileFormats = QImageIO::inputFormats(); QString ff = fileFormats.first(); while ( fileFormats.current() ) { QStringList exts = MimeType("image/"+ff.lower()).extensions(); for ( QStringList::ConstIterator it = exts.begin(); it!=exts.end(); ++it ) { QString f = picsPath + pix + "." + *it; if ( QFile(f).exists() ) return f; } ff = fileFormats.next(); } // Finally, no (or existing) extension... if ( QFile( picsPath + pix ).exists() ) return picsPath + pix; //qDebug("Cannot find pixmap: %s", pix.latin1()); return QString(); } /*! Returns a sound file for a sound called \a name. You should avoid including any filename type extension (e.g. .wav), as the system will search for only those fileformats which are supported by the library. Currently, only WAV files are supported. */ QString Resource::findSound( const QString &name ) { QString picsPath = QPEApplication::qpeDir() + "sounds/"; QString result; if ( QFile( (result = picsPath + name + ".wav") ).exists() ) return result; return QString(); } /*! Returns a list of all sound names. */ QStringList Resource::allSounds() { QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" ); QStringList entries = resourcedir.entryList(); |