summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2005-02-22 22:18:11 (UTC)
committer zecke <zecke>2005-02-22 22:18:11 (UTC)
commita2eea1c6273acd16fed2406493923c52fba19ebc (patch) (side-by-side diff)
treec0ab063876da2129b74956fa50092384a39449cb /library
parente5d8117ff25ff91b4ba8029a63b6ffed4ea56d38 (diff)
downloadopie-a2eea1c6273acd16fed2406493923c52fba19ebc.zip
opie-a2eea1c6273acd16fed2406493923c52fba19ebc.tar.gz
opie-a2eea1c6273acd16fed2406493923c52fba19ebc.tar.bz2
Remove overriding of inline pictures. We now can easily disable compilation
of compiled in icons
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/resource.cpp39
1 files changed, 12 insertions, 27 deletions
diff --git a/library/resource.cpp b/library/resource.cpp
index 92d4b60..f6b548d 100644
--- a/library/resource.cpp
+++ b/library/resource.cpp
@@ -14,50 +14,48 @@
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#define QTOPIA_INTERNAL_MIMEEXT
#include <qpe/qpeapplication.h>
#include "resource.h"
#include "mimetype.h"
#include <qdir.h>
#include <qpixmapcache.h>
// this namespace is just a workaround for a gcc bug
// gcc exports inline functions in the generated file
// inlinepics_p.h
#ifndef LIBQPE_NO_INLINE_IMAGES
namespace {
#include "inlinepics_p.h"
}
#endif
-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
*/
/*!
\fn Resource::Resource()
\internal
*/
/*!
Returns the QPixmap called \a pix. You should avoid including
any filename type extension (e.g. .png, .xpm).
*/
@@ -145,79 +143,66 @@ QString Resource::findSound( const QString &name )
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();
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)
{
QImage img;
- if (g_notUseSet ) {
- // try file
- QString f = Resource::findPixmap(name);
- if ( !f.isEmpty() )
- img.load(f);
#ifndef LIBQPE_NO_INLINE_IMAGES
- if (img.isNull() )
- img = qembed_findImage(name.latin1() );
-#endif
+ img = qembed_findImage(name.latin1());
+#else
+ QString f = Resource::findPixmap( "/inline/" + name );
+ if ( !f.isEmpty() )
+ {
+ img.load(f);
return img;
}
- else{
-#ifndef LIBQPE_NO_INLINE_IMAGES
- img = qembed_findImage(name.latin1());
-#else
- QString f = Resource::findPixmap( "/inline/" + name );
+#endif
+ if ( img.isNull() )
+ {
+ // No inlined image, try file
+ QString f = Resource::findPixmap(name);
if ( !f.isEmpty() )
- {
img.load(f);
- return img;
- }
-#endif
- if ( img.isNull() )
- {
- // No inlined image, try file
- QString f = Resource::findPixmap(name);
- if ( !f.isEmpty() )
- img.load(f);
- }
- return img;
}
+ 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() ) {
// No file, try generating
if ( name[name.length()-1]=='d' && name.right(9)=="_disabled" ) {
last_enabled_name = name.left(name.length()-9);
last_enabled = load_image(last_enabled_name);
if ( last_enabled.isNull() ) {
last_enabled_name = QString::null;
} else {