summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/resource.cpp2
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
@@ -81,48 +81,50 @@ QBitmap Resource::loadBitmap( const QString &pix )
81 bm = loadPixmap(pix); 81 bm = loadPixmap(pix);
82 return bm; 82 return bm;
83} 83}
84 84
85/*! 85/*!
86 Returns the filename of a pixmap called \a pix. You should avoid including 86 Returns the filename of a pixmap called \a pix. You should avoid including
87 any filename type extension (e.g. .png, .xpm). 87 any filename type extension (e.g. .png, .xpm).
88 88
89 Normally you will use loadPixmap() rather than this function. 89 Normally you will use loadPixmap() rather than this function.
90*/ 90*/
91QString Resource::findPixmap( const QString &pix ) 91QString Resource::findPixmap( const QString &pix )
92{ 92{
93 QString picsPath = QPEApplication::qpeDir() + "pics/"; 93 QString picsPath = QPEApplication::qpeDir() + "pics/";
94 94
95 QString f; 95 QString f;
96 96
97 // Common case optimizations... 97 // Common case optimizations...
98 f = picsPath + pix + ".png"; 98 f = picsPath + pix + ".png";
99 if ( QFile( f ).exists() ) 99 if ( QFile( f ).exists() )
100 return f; 100 return f;
101 f = picsPath + pix + ".xpm"; 101 f = picsPath + pix + ".xpm";
102 if ( QFile( f ).exists() ) 102 if ( QFile( f ).exists() )
103 return f; 103 return f;
104 104
105 qDebug ( "\nLoading of image '%s' is not ideal (either it doesn't exist or an extension was specified)\n", pix.latin1());
106
105 // All formats... 107 // All formats...
106 QStrList fileFormats = QImageIO::inputFormats(); 108 QStrList fileFormats = QImageIO::inputFormats();
107 QString ff = fileFormats.first(); 109 QString ff = fileFormats.first();
108 while ( fileFormats.current() ) { 110 while ( fileFormats.current() ) {
109 QStringList exts = MimeType("image/"+ff.lower()).extensions(); 111 QStringList exts = MimeType("image/"+ff.lower()).extensions();
110 for ( QStringList::ConstIterator it = exts.begin(); it!=exts.end(); ++it ) { 112 for ( QStringList::ConstIterator it = exts.begin(); it!=exts.end(); ++it ) {
111 QString f = picsPath + pix + "." + *it; 113 QString f = picsPath + pix + "." + *it;
112 if ( QFile(f).exists() ) 114 if ( QFile(f).exists() )
113 return f; 115 return f;
114 } 116 }
115 ff = fileFormats.next(); 117 ff = fileFormats.next();
116 } 118 }
117 119
118 // Finally, no (or existing) extension... 120 // Finally, no (or existing) extension...
119 if ( QFile( picsPath + pix ).exists() ) 121 if ( QFile( picsPath + pix ).exists() )
120 return picsPath + pix; 122 return picsPath + pix;
121 123
122 //qDebug("Cannot find pixmap: %s", pix.latin1()); 124 //qDebug("Cannot find pixmap: %s", pix.latin1());
123 return QString(); 125 return QString();
124} 126}
125 127
126/*! 128/*!
127 Returns a sound file for a sound called \a name. 129 Returns a sound file for a sound called \a name.
128 130