-rw-r--r-- | library/resource.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/library/resource.cpp b/library/resource.cpp index 4108883..f70658d 100644 --- a/library/resource.cpp +++ b/library/resource.cpp @@ -23,32 +23,34 @@ #include "resource.h" #include "mimetype.h" #include <qdir.h> #include <qfile.h> #include <qregexp.h> #include <qpixmapcache.h> #include <qpainter.h> // this namespace is just a workaround for a gcc bug // gcc exports inline functions in the generated file // inlinepics_p.h namespace { #include "inlinepics_p.h" } +static bool g_notUseSet = ::getenv("OVERWRITE_ICON_SET"); + /*! \class Resource resource.h \brief The Resource class provides access to named resources. The resources may be provided from files or other sources. The allSounds() function returns a list of all the sounds available. A particular sound can be searched for using findSound(). Images can be loaded with loadImage(), loadPixmap(), loadBitmap() and loadIconSet(). \ingroup qtopiaemb */ /*! @@ -146,41 +148,54 @@ QString Resource::findSound( const QString &name ) /*! Returns a list of all sound names. */ QStringList Resource::allSounds() { QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" ); QStringList entries = resourcedir.entryList(); QStringList result; for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i) result.append((*i).replace(QRegExp("\\.wav"),"")); return result; } static QImage load_image(const QString &name) { + if (g_notUseSet ) { + // try file + QImage img; + QString f = Resource::findPixmap(name); + if ( !f.isEmpty() ) + img.load(f); + if (img.isNull() ) + img = qembed_findImage(name.latin1() ); + return img; + } + else{ QImage img = qembed_findImage(name.latin1()); + if ( img.isNull() ) { // No inlined image, try file QString f = Resource::findPixmap(name); if ( !f.isEmpty() ) img.load(f); } return img; } +} /*! Returns the QImage called \a name. You should avoid including any filename type extension (e.g. .png, .xpm). */ QImage Resource::loadImage( const QString &name) { #ifndef QT_NO_DEPTH_32 // have alpha-blended pixmaps static QImage last_enabled; static QString last_enabled_name; if ( name == last_enabled_name ) return last_enabled; #endif QImage img = load_image(name); #ifndef QT_NO_DEPTH_32 // have alpha-blended pixmaps if ( img.isNull() ) { |