-rw-r--r-- | library/resource.h | 33 |
1 files changed, 5 insertions, 28 deletions
diff --git a/library/resource.h b/library/resource.h index 982c58a..1f1ba9a 100644 --- a/library/resource.h +++ b/library/resource.h | |||
@@ -1,12 +1,12 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of 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. |
@@ -40,41 +40,18 @@ public: | |||
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 | // Inline for compatibility with SHARP ROMs | 45 | // Inline for compatibility with SHARP ROMs |
46 | inline QIconSet Resource::loadIconSet( const QString &pix ) | 46 | inline QIconSet Resource::loadIconSet( const QString &pix ) |
47 | { | 47 | { |
48 | QImage img = loadImage( pix ); | ||
49 | QPixmap pm; | ||
50 | pm.convertFromImage( img ); | ||
51 | QIconSet is( pm ); | ||
52 | QIconSet::Size size = pm.width() <= 22 ? QIconSet::Small : QIconSet::Large; | ||
53 | |||
54 | QPixmap dpm = loadPixmap( pix + "_disabled" ); | 48 | QPixmap dpm = loadPixmap( pix + "_disabled" ); |
55 | 49 | QPixmap pm = loadPixmap( pix ); | |
56 | #ifndef QT_NO_DEPTH_32// have alpha-blended pixmaps | 50 | QIconSet is( pm ); |
57 | if ( dpm.isNull() ) { | ||
58 | QImage dimg( img.width(), img.height(), 32 ); | ||
59 | for ( int y = 0; y < img.height(); y++ ) { | ||
60 | for ( int x = 0; x < img.width(); x++ ) { | ||
61 | QRgb p = img.pixel( x, y ); | ||
62 | uint a = (p & 0xff000000) / 3; | ||
63 | p = (p & 0x00ffffff) | (a & 0xff000000); | ||
64 | dimg.setPixel( x, y, p ); | ||
65 | } | ||
66 | } | ||
67 | |||
68 | dimg.setAlphaBuffer( TRUE ); | ||
69 | dpm.convertFromImage( dimg ); | ||
70 | } | ||
71 | #endif | ||
72 | |||
73 | if ( !dpm.isNull() ) | 51 | if ( !dpm.isNull() ) |
74 | is.setPixmap( dpm, size, QIconSet::Disabled ); | 52 | is.setPixmap( dpm, pm.width() <= 22 ? QIconSet::Small : QIconSet::Large, QIconSet::Disabled ); |
75 | |||
76 | return is; | 53 | return is; |
77 | } | 54 | } |
78 | 55 | ||
79 | 56 | ||
80 | #endif | 57 | #endif |