-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 | |||
@@ -27,24 +27,26 @@ | |||
27 | #include <qregexp.h> | 27 | #include <qregexp.h> |
28 | #include <qpixmapcache.h> | 28 | #include <qpixmapcache.h> |
29 | #include <qpainter.h> | 29 | #include <qpainter.h> |
30 | 30 | ||
31 | // this namespace is just a workaround for a gcc bug | 31 | // this namespace is just a workaround for a gcc bug |
32 | // gcc exports inline functions in the generated file | 32 | // gcc exports inline functions in the generated file |
33 | // inlinepics_p.h | 33 | // inlinepics_p.h |
34 | 34 | ||
35 | namespace { | 35 | namespace { |
36 | #include "inlinepics_p.h" | 36 | #include "inlinepics_p.h" |
37 | } | 37 | } |
38 | 38 | ||
39 | static bool g_notUseSet = ::getenv("OVERWRITE_ICON_SET"); | ||
40 | |||
39 | /*! | 41 | /*! |
40 | \class Resource resource.h | 42 | \class Resource resource.h |
41 | \brief The Resource class provides access to named resources. | 43 | \brief The Resource class provides access to named resources. |
42 | 44 | ||
43 | The resources may be provided from files or other sources. | 45 | The resources may be provided from files or other sources. |
44 | 46 | ||
45 | The allSounds() function returns a list of all the sounds available. | 47 | The allSounds() function returns a list of all the sounds available. |
46 | A particular sound can be searched for using findSound(). | 48 | A particular sound can be searched for using findSound(). |
47 | 49 | ||
48 | Images can be loaded with loadImage(), loadPixmap(), loadBitmap() | 50 | Images can be loaded with loadImage(), loadPixmap(), loadBitmap() |
49 | and loadIconSet(). | 51 | and loadIconSet(). |
50 | 52 | ||
@@ -150,33 +152,46 @@ QString Resource::findSound( const QString &name ) | |||
150 | QStringList Resource::allSounds() | 152 | QStringList Resource::allSounds() |
151 | { | 153 | { |
152 | QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" ); | 154 | QDir resourcedir( QPEApplication::qpeDir() + "sounds/", "*.wav" ); |
153 | QStringList entries = resourcedir.entryList(); | 155 | QStringList entries = resourcedir.entryList(); |
154 | QStringList result; | 156 | QStringList result; |
155 | for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i) | 157 | for (QStringList::Iterator i=entries.begin(); i != entries.end(); ++i) |
156 | result.append((*i).replace(QRegExp("\\.wav"),"")); | 158 | result.append((*i).replace(QRegExp("\\.wav"),"")); |
157 | return result; | 159 | return result; |
158 | } | 160 | } |
159 | 161 | ||
160 | static QImage load_image(const QString &name) | 162 | static QImage load_image(const QString &name) |
161 | { | 163 | { |
164 | if (g_notUseSet ) { | ||
165 | // try file | ||
166 | QImage img; | ||
167 | QString f = Resource::findPixmap(name); | ||
168 | if ( !f.isEmpty() ) | ||
169 | img.load(f); | ||
170 | if (img.isNull() ) | ||
171 | img = qembed_findImage(name.latin1() ); | ||
172 | return img; | ||
173 | } | ||
174 | else{ | ||
162 | QImage img = qembed_findImage(name.latin1()); | 175 | QImage img = qembed_findImage(name.latin1()); |
176 | |||
163 | if ( img.isNull() ) { | 177 | if ( img.isNull() ) { |
164 | // No inlined image, try file | 178 | // No inlined image, try file |
165 | QString f = Resource::findPixmap(name); | 179 | QString f = Resource::findPixmap(name); |
166 | if ( !f.isEmpty() ) | 180 | if ( !f.isEmpty() ) |
167 | img.load(f); | 181 | img.load(f); |
168 | } | 182 | } |
169 | return img; | 183 | return img; |
170 | } | 184 | } |
185 | } | ||
171 | 186 | ||
172 | /*! | 187 | /*! |
173 | Returns the QImage called \a name. You should avoid including | 188 | Returns the QImage called \a name. You should avoid including |
174 | any filename type extension (e.g. .png, .xpm). | 189 | any filename type extension (e.g. .png, .xpm). |
175 | */ | 190 | */ |
176 | QImage Resource::loadImage( const QString &name) | 191 | QImage Resource::loadImage( const QString &name) |
177 | { | 192 | { |
178 | #ifndef QT_NO_DEPTH_32// have alpha-blended pixmaps | 193 | #ifndef QT_NO_DEPTH_32// have alpha-blended pixmaps |
179 | static QImage last_enabled; | 194 | static QImage last_enabled; |
180 | static QString last_enabled_name; | 195 | static QString last_enabled_name; |
181 | if ( name == last_enabled_name ) | 196 | if ( name == last_enabled_name ) |
182 | return last_enabled; | 197 | return last_enabled; |