summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2005-02-19 18:09:40 (UTC)
committer mickeyl <mickeyl>2005-02-19 18:09:40 (UTC)
commit5909f43e922a066637127e48c2e3d99685e4871a (patch) (side-by-side diff)
tree9d87440d0494a52cc8314148e0994039a3856314
parent112337f13c70f1266430f154d486b6f23ec18488 (diff)
downloadopie-5909f43e922a066637127e48c2e3d99685e4871a.zip
opie-5909f43e922a066637127e48c2e3d99685e4871a.tar.gz
opie-5909f43e922a066637127e48c2e3d99685e4871a.tar.bz2
back out an unintentionally commited change
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--library/resource.cpp11
1 files changed, 0 insertions, 11 deletions
diff --git a/library/resource.cpp b/library/resource.cpp
index 3b5e9ec..92d4b60 100644
--- a/library/resource.cpp
+++ b/library/resource.cpp
@@ -63,107 +63,96 @@ static bool g_notUseSet = ::getenv("OVERWRITE_ICON_SET");
*/
#include <stdio.h>
QPixmap Resource::loadPixmap( const QString &pix )
{
QPixmap pm; // null pixmap
QString key="QPE_"+pix;
if ( !QPixmapCache::find(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;
}
/*!
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;
-#ifdef LIBQPE_NO_INLINE_IMAGES
- QString picsPathInline = picsPath + "inline/";
- // Common case optimizations...
- f = picsPathInline + pix + ".png";
- if ( QFile( f ).exists() )
- return f;
- f = picsPathInline + pix + ".xpm";
- if ( QFile( f ).exists() )
- return f;
-#endif
-
// 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();