author | zecke <zecke> | 2005-04-04 20:23:39 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-04-04 20:23:39 (UTC) |
commit | 8ea4d025ded75eee0918258121d54273aead66ad (patch) (unidiff) | |
tree | 9fd3ac0d4c355cc3e5c7345b2de8c7edd3b60db1 /library/resource.h | |
parent | be7d04d2b402e5515cfac3a2b32ed5831e15340b (diff) | |
download | opie-8ea4d025ded75eee0918258121d54273aead66ad.zip opie-8ea4d025ded75eee0918258121d54273aead66ad.tar.gz opie-8ea4d025ded75eee0918258121d54273aead66ad.tar.bz2 |
Speed up start times of applications:
-Do not load MimeType when using Resource::loadIconSet
we introduce a global boolean (like TT)
What is bad: The boolean is visible outside of libqpe and
we've that extern in the header...
On the former we can use visibility attributes soon
-rw-r--r-- | library/resource.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/library/resource.h b/library/resource.h index 1f1ba9a..4a3502a 100644 --- a/library/resource.h +++ b/library/resource.h | |||
@@ -1,57 +1,66 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #ifndef PIXMAPLOADER_H | 20 | #ifndef PIXMAPLOADER_H |
21 | #define PIXMAPLOADER_H | 21 | #define PIXMAPLOADER_H |
22 | 22 | ||
23 | #include <qimage.h> | 23 | #include <qimage.h> |
24 | #include <qbitmap.h> | 24 | #include <qbitmap.h> |
25 | #include <qiconset.h> | 25 | #include <qiconset.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | 27 | ||
28 | class Resource | 28 | class Resource |
29 | { | 29 | { |
30 | public: | 30 | public: |
31 | Resource() {} | 31 | Resource() {} |
32 | 32 | ||
33 | static QImage loadImage( const QString &name); | 33 | static QImage loadImage( const QString &name); |
34 | 34 | ||
35 | static QPixmap loadPixmap( const QString &name ); | 35 | static QPixmap loadPixmap( const QString &name ); |
36 | static QBitmap loadBitmap( const QString &name ); | 36 | static QBitmap loadBitmap( const QString &name ); |
37 | static QString findPixmap( const QString &name ); | 37 | static QString findPixmap( const QString &name ); |
38 | 38 | ||
39 | static QIconSet loadIconSet( const QString &name ); | 39 | static QIconSet loadIconSet( const QString &name ); |
40 | 40 | ||
41 | static QString findSound( const QString &name ); | 41 | static QString findSound( const QString &name ); |
42 | static QStringList allSounds(); | 42 | static QStringList allSounds(); |
43 | }; | 43 | }; |
44 | 44 | ||
45 | extern bool qpe_fast_findPixmap; | ||
45 | // Inline for compatibility with SHARP ROMs | 46 | // Inline for compatibility with SHARP ROMs |
46 | inline QIconSet Resource::loadIconSet( const QString &pix ) | 47 | inline QIconSet Resource::loadIconSet( const QString &pix ) |
47 | { | 48 | { |
49 | /* | ||
50 | * disable the slow load | ||
51 | */ | ||
52 | bool oldMode = qpe_fast_findPixmap; | ||
53 | qpe_fast_findPixmap = true; | ||
54 | |||
48 | QPixmap dpm = loadPixmap( pix + "_disabled" ); | 55 | QPixmap dpm = loadPixmap( pix + "_disabled" ); |
49 | QPixmap pm = loadPixmap( pix ); | 56 | QPixmap pm = loadPixmap( pix ); |
50 | QIconSet is( pm ); | 57 | QIconSet is( pm ); |
51 | if ( !dpm.isNull() ) | 58 | if ( !dpm.isNull() ) |
52 | is.setPixmap( dpm, pm.width() <= 22 ? QIconSet::Small : QIconSet::Large, QIconSet::Disabled ); | 59 | is.setPixmap( dpm, pm.width() <= 22 ? QIconSet::Small : QIconSet::Large, QIconSet::Disabled ); |
60 | |||
61 | qpe_fast_findPixmap = oldMode; | ||
53 | return is; | 62 | return is; |
54 | } | 63 | } |
55 | 64 | ||
56 | 65 | ||
57 | #endif | 66 | #endif |