-rw-r--r-- | library/resource.cpp | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/library/resource.cpp b/library/resource.cpp index 3b5e9ec..92d4b60 100644 --- a/library/resource.cpp +++ b/library/resource.cpp | |||
@@ -79,75 +79,64 @@ QPixmap Resource::loadPixmap( const QString &pix ) | |||
79 | } | 79 | } |
80 | 80 | ||
81 | /*! | 81 | /*! |
82 | Returns the QBitmap called \a pix. You should avoid including | 82 | Returns the QBitmap called \a pix. You should avoid including |
83 | any filename type extension (e.g. .png, .xpm). | 83 | any filename type extension (e.g. .png, .xpm). |
84 | */ | 84 | */ |
85 | QBitmap Resource::loadBitmap( const QString &pix ) | 85 | QBitmap Resource::loadBitmap( const QString &pix ) |
86 | { | 86 | { |
87 | QBitmap bm; | 87 | QBitmap bm; |
88 | bm = loadPixmap(pix); | 88 | bm = loadPixmap(pix); |
89 | return bm; | 89 | return bm; |
90 | } | 90 | } |
91 | 91 | ||
92 | /*! | 92 | /*! |
93 | Returns the filename of a pixmap called \a pix. You should avoid including | 93 | Returns the filename of a pixmap called \a pix. You should avoid including |
94 | any filename type extension (e.g. .png, .xpm). | 94 | any filename type extension (e.g. .png, .xpm). |
95 | 95 | ||
96 | Normally you will use loadPixmap() rather than this function. | 96 | Normally you will use loadPixmap() rather than this function. |
97 | */ | 97 | */ |
98 | QString Resource::findPixmap( const QString &pix ) | 98 | QString Resource::findPixmap( const QString &pix ) |
99 | { | 99 | { |
100 | QString picsPath = QPEApplication::qpeDir() + "pics/"; | 100 | QString picsPath = QPEApplication::qpeDir() + "pics/"; |
101 | QString f; | 101 | QString f; |
102 | 102 | ||
103 | // Common case optimizations... | 103 | // Common case optimizations... |
104 | f = picsPath + pix + ".png"; | 104 | f = picsPath + pix + ".png"; |
105 | if ( QFile( f ).exists() ) | 105 | if ( QFile( f ).exists() ) |
106 | return f; | 106 | return f; |
107 | f = picsPath + pix + ".xpm"; | 107 | f = picsPath + pix + ".xpm"; |
108 | if ( QFile( f ).exists() ) | 108 | if ( QFile( f ).exists() ) |
109 | return f; | 109 | return f; |
110 | 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 | |||
122 | // All formats... | 111 | // All formats... |
123 | QStrList fileFormats = QImageIO::inputFormats(); | 112 | QStrList fileFormats = QImageIO::inputFormats(); |
124 | QString ff = fileFormats.first(); | 113 | QString ff = fileFormats.first(); |
125 | while ( fileFormats.current() ) { | 114 | while ( fileFormats.current() ) { |
126 | QStringList exts = MimeType("image/"+ff.lower()).extensions(); | 115 | QStringList exts = MimeType("image/"+ff.lower()).extensions(); |
127 | for ( QStringList::ConstIterator it = exts.begin(); it!=exts.end(); ++it ) { | 116 | for ( QStringList::ConstIterator it = exts.begin(); it!=exts.end(); ++it ) { |
128 | QString f = picsPath + pix + "." + *it; | 117 | QString f = picsPath + pix + "." + *it; |
129 | if ( QFile(f).exists() ) | 118 | if ( QFile(f).exists() ) |
130 | return f; | 119 | return f; |
131 | } | 120 | } |
132 | ff = fileFormats.next(); | 121 | ff = fileFormats.next(); |
133 | } | 122 | } |
134 | 123 | ||
135 | // Finally, no (or existing) extension... | 124 | // Finally, no (or existing) extension... |
136 | if ( QFile( picsPath + pix ).exists() ) | 125 | if ( QFile( picsPath + pix ).exists() ) |
137 | return picsPath + pix; | 126 | return picsPath + pix; |
138 | 127 | ||
139 | //qDebug("Cannot find pixmap: %s", pix.latin1()); | 128 | //qDebug("Cannot find pixmap: %s", pix.latin1()); |
140 | return QString(); | 129 | return QString(); |
141 | } | 130 | } |
142 | 131 | ||
143 | /*! | 132 | /*! |
144 | Returns a sound file for a sound called \a name. | 133 | Returns a sound file for a sound called \a name. |
145 | 134 | ||
146 | You should avoid including any filename type extension (e.g. .wav), | 135 | You should avoid including any filename type extension (e.g. .wav), |
147 | as the system will search for only those fileformats which are supported | 136 | as the system will search for only those fileformats which are supported |
148 | by the library. | 137 | by the library. |
149 | 138 | ||
150 | Currently, only WAV files are supported. | 139 | Currently, only WAV files are supported. |
151 | */ | 140 | */ |
152 | QString Resource::findSound( const QString &name ) | 141 | QString Resource::findSound( const QString &name ) |
153 | { | 142 | { |