summaryrefslogtreecommitdiff
path: root/library
authorzecke <zecke>2005-02-22 22:33:23 (UTC)
committer zecke <zecke>2005-02-22 22:33:23 (UTC)
commite33e10f5643a2fb5c640667939e4139bf7b580e2 (patch) (side-by-side diff)
tree335b67bdf59a85235aeb3195062a894a9298913d /library
parent214b14b03ca3806142eacb2248af98a06f765e2a (diff)
downloadopie-e33e10f5643a2fb5c640667939e4139bf7b580e2.zip
opie-e33e10f5643a2fb5c640667939e4139bf7b580e2.tar.gz
opie-e33e10f5643a2fb5c640667939e4139bf7b580e2.tar.bz2
No special (2nd) lookup for the inline pictures. This saves additional seeks.
people not having defined LIBQPE_... will not notice a different as we still default to inline pictures
Diffstat (limited to 'library') (more/less context) (show whitespace changes)
-rw-r--r--library/resource.cpp7
1 files changed, 0 insertions, 7 deletions
diff --git a/library/resource.cpp b/library/resource.cpp
index f6b548d..a093e2f 100644
--- a/library/resource.cpp
+++ b/library/resource.cpp
@@ -137,71 +137,64 @@ QString Resource::findPixmap( const QString &pix )
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();
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;
#ifndef LIBQPE_NO_INLINE_IMAGES
img = qembed_findImage(name.latin1());
-#else
- QString f = Resource::findPixmap( "/inline/" + 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;
}
/*!
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;