summaryrefslogtreecommitdiff
path: root/library/resource.h
Unidiff
Diffstat (limited to 'library/resource.h') (more/less context) (show whitespace changes)
-rw-r--r--library/resource.h33
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,10 +1,10 @@
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**
@@ -42,39 +42,16 @@ public:
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
46inline QIconSet Resource::loadIconSet( const QString &pix ) 46inline 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