author | simon <simon> | 2002-12-11 11:52:24 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-11 11:52:24 (UTC) |
commit | 9ae7f1a1b5fbadf4ea40f8d7bf07a637299a091a (patch) (unidiff) | |
tree | 08bfee61215df1af5c0a9a7e2068ea3f4fb8045c /noncore/multimedia | |
parent | 03ac4af4d6014bbd46b12d5fe89ee2cc73941080 (diff) | |
download | opie-9ae7f1a1b5fbadf4ea40f8d7bf07a637299a091a.zip opie-9ae7f1a1b5fbadf4ea40f8d7bf07a637299a091a.tar.gz opie-9ae7f1a1b5fbadf4ea40f8d7bf07a637299a091a.tar.bz2 |
- less qimage<>qpixmap conversions
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 865ff91..70ef8d9 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp | |||
@@ -63,38 +63,39 @@ MediaWidget::Button MediaWidget::setupButton( const SkinButtonInfo &buttonInfo, | |||
63 | button.command = buttonInfo.command; | 63 | button.command = buttonInfo.command; |
64 | button.type = buttonInfo.type; | 64 | button.type = buttonInfo.type; |
65 | 65 | ||
66 | QString fileName = imagePrefix + buttonInfo.fileName + ".png"; | 66 | QString fileName = imagePrefix + buttonInfo.fileName + ".png"; |
67 | 67 | ||
68 | button.mask = setupButtonMask( button.command, fileName ); | 68 | button.mask = setupButtonMask( button.command, fileName ); |
69 | 69 | ||
70 | return button; | 70 | return button; |
71 | } | 71 | } |
72 | 72 | ||
73 | QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fileName ) | 73 | QBitmap MediaWidget::setupButtonMask( const Command &command, const QString &fileName ) |
74 | { | 74 | { |
75 | QBitmap mask( Resource::findPixmap( fileName ) ); | 75 | QImage imgMask( Resource::findPixmap( fileName ) ); |
76 | if ( mask.isNull() ) | 76 | if ( imgMask.isNull() ) |
77 | return mask; | 77 | return QBitmap(); |
78 | 78 | ||
79 | QImage imgMask = mask.convertToImage(); | ||
80 | uchar **dest = buttonMask.jumpTable(); | 79 | uchar **dest = buttonMask.jumpTable(); |
81 | for ( int y = 0; y < buttonMask.height(); y++ ) { | 80 | for ( int y = 0; y < buttonMask.height(); y++ ) { |
82 | uchar *line = dest[y]; | 81 | uchar *line = dest[y]; |
83 | for ( int x = 0; x < buttonMask.width(); x++ ) | 82 | for ( int x = 0; x < buttonMask.width(); x++ ) |
84 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 83 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
85 | line[x] = command + 1; | 84 | line[x] = command + 1; |
86 | } | 85 | } |
87 | 86 | ||
88 | return mask; | 87 | // ### grmbl qt2. use constructor when switching to qt3. |
88 | QBitmap bm; bm = imgMask; | ||
89 | return bm; | ||
89 | } | 90 | } |
90 | 91 | ||
91 | void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) | 92 | void MediaWidget::loadDefaultSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &fileNameInfix ) |
92 | { | 93 | { |
93 | Config cfg( "OpiePlayer" ); | 94 | Config cfg( "OpiePlayer" ); |
94 | cfg.setGroup( "Options" ); | 95 | cfg.setGroup( "Options" ); |
95 | QString skin = cfg.readEntry( "Skin","default" ); | 96 | QString skin = cfg.readEntry( "Skin","default" ); |
96 | 97 | ||
97 | loadSkin( skinInfo, buttonCount, skin, fileNameInfix ); | 98 | loadSkin( skinInfo, buttonCount, skin, fileNameInfix ); |
98 | } | 99 | } |
99 | 100 | ||
100 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ) | 101 | void MediaWidget::loadSkin( const SkinButtonInfo *skinInfo, uint buttonCount, const QString &name, const QString &fileNameInfix ) |