summaryrefslogtreecommitdiff
path: root/library
authormickeyl <mickeyl>2005-02-19 17:18:27 (UTC)
committer mickeyl <mickeyl>2005-02-19 17:18:27 (UTC)
commitbe32e0c045814142954ac37c89715313633d6aa2 (patch) (unidiff)
tree93a6fc7a84b4073fb04cc0b3377c4bb7e11bd091 /library
parentb7bf9c7acdc010eb30bc246372efb0d1b394166a (diff)
downloadopie-be32e0c045814142954ac37c89715313633d6aa2.zip
opie-be32e0c045814142954ac37c89715313633d6aa2.tar.gz
opie-be32e0c045814142954ac37c89715313633d6aa2.tar.bz2
make inline image support optional
Diffstat (limited to 'library') (more/less context) (ignore whitespace changes)
-rw-r--r--library/resource.cpp34
1 files changed, 29 insertions, 5 deletions
diff --git a/library/resource.cpp b/library/resource.cpp
index b31876f..3b5e9ec 100644
--- a/library/resource.cpp
+++ b/library/resource.cpp
@@ -31,2 +31,3 @@
31 31
32#ifndef LIBQPE_NO_INLINE_IMAGES
32namespace { 33namespace {
@@ -34,2 +35,3 @@ namespace {
34} 35}
36#endif
35 37
@@ -98,3 +100,2 @@ QString Resource::findPixmap( const QString &pix )
98 QString picsPath = QPEApplication::qpeDir() + "pics/"; 100 QString picsPath = QPEApplication::qpeDir() + "pics/";
99
100 QString f; 101 QString f;
@@ -109,2 +110,13 @@ QString Resource::findPixmap( const QString &pix )
109 110
111#ifdef LIBQPE_NO_INLINE_IMAGES
112 QString picsPathInline = picsPath + "inline/";
113 // Common case optimizations...
114 f = picsPathInline + pix + ".png";
115 if ( QFile( f ).exists() )
116 return f;
117 f = picsPathInline + pix + ".xpm";
118 if ( QFile( f ).exists() )
119 return f;
120#endif
121
110 // All formats... 122 // All formats...
@@ -165,5 +177,6 @@ static QImage load_image(const QString &name)
165{ 177{
178 QImage img;
179
166 if (g_notUseSet ) { 180 if (g_notUseSet ) {
167 // try file 181 // try file
168 QImage img;
169 QString f = Resource::findPixmap(name); 182 QString f = Resource::findPixmap(name);
@@ -171,4 +184,6 @@ static QImage load_image(const QString &name)
171 img.load(f); 184 img.load(f);
185#ifndef LIBQPE_NO_INLINE_IMAGES
172 if (img.isNull() ) 186 if (img.isNull() )
173 img = qembed_findImage(name.latin1() ); 187 img = qembed_findImage(name.latin1() );
188#endif
174 return img; 189 return img;
@@ -176,5 +191,14 @@ static QImage load_image(const QString &name)
176 else{ 191 else{
177 QImage img = qembed_findImage(name.latin1()); 192#ifndef LIBQPE_NO_INLINE_IMAGES
178 193 img = qembed_findImage(name.latin1());
179 if ( img.isNull() ) { 194#else
195 QString f = Resource::findPixmap( "/inline/" + name );
196 if ( !f.isEmpty() )
197 {
198 img.load(f);
199 return img;
200 }
201#endif
202 if ( img.isNull() )
203 {
180 // No inlined image, try file 204 // No inlined image, try file