summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp25
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h9
2 files changed, 15 insertions, 19 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 6e9c14a..87e06ee 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -107,16 +107,14 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
107 107
108 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 ); 108 buttonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
109 buttonMask.fill( 0 ); 109 buttonMask.fill( 0 );
110 110
111 masks.reserve( buttonCount ); 111 for ( uint i = 0; i < buttons.size(); i++ ) {
112
113 for ( uint i = 0; i < masks.capacity(); i++ ) {
114 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" ); 112 QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skin_mask_" + skinInfo[i].fileName + ".png" );
115 masks.push_back( QBitmap( filename ) ); 113 buttons[ i ].mask =QBitmap( filename );
116 114
117 if ( !masks[i].isNull() ) { 115 if ( !buttons[i].mask.isNull() ) {
118 QImage imgMask = masks[i].convertToImage(); 116 QImage imgMask = buttons[i].mask.convertToImage();
119 uchar **dest = buttonMask.jumpTable(); 117 uchar **dest = buttonMask.jumpTable();
120 for ( int y = 0; y < imgUp.height(); y++ ) { 118 for ( int y = 0; y < imgUp.height(); y++ ) {
121 uchar *line = dest[y]; 119 uchar *line = dest[y];
122 for ( int x = 0; x < imgUp.width(); x++ ) 120 for ( int x = 0; x < imgUp.width(); x++ )
@@ -126,11 +124,8 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
126 } 124 }
127 125
128 } 126 }
129 127
130 buttonPixUp.resize( masks.size(), QPixmap() );
131 buttonPixDown.resize( masks.size(), QPixmap() );
132
133 setBackgroundPixmap( pixBg ); 128 setBackgroundPixmap( pixBg );
134 129
135 songInfo.setFocusPolicy( QWidget::NoFocus ); 130 songInfo.setFocusPolicy( QWidget::NoFocus );
136// changeTextColor( &songInfo ); 131// changeTextColor( &songInfo );
@@ -214,12 +209,12 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
214 209
215 QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); 210 QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p );
216 QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); 211 QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p );
217 212
218 for ( uint i = 0; i < masks.size(); i++ ) { 213 for ( uint i = 0; i < buttons.size(); i++ ) {
219 if ( !masks[i].isNull() ) { 214 if ( !buttons[i].mask.isNull() ) {
220 buttonPixUp[i] = maskPixToMask( pixUp, masks[i] ); 215 buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask );
221 buttonPixDown[i] = maskPixToMask( pixDn, masks[i] ); 216 buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask );
222 } 217 }
223 } 218 }
224} 219}
225 220
@@ -321,11 +316,11 @@ void AudioWidget::setToggleButton( int i, bool down ) {
321} 316}
322 317
323void AudioWidget::paintButton( QPainter &p, int i ) { 318void AudioWidget::paintButton( QPainter &p, int i ) {
324 if ( buttons[i].isDown ) { 319 if ( buttons[i].isDown ) {
325 p.drawPixmap( upperLeftOfButtonMask, buttonPixDown[i] ); 320 p.drawPixmap( upperLeftOfButtonMask, buttons[i].pixDown );
326 } else { 321 } else {
327 p.drawPixmap( upperLeftOfButtonMask, buttonPixUp[i] ); 322 p.drawPixmap( upperLeftOfButtonMask, buttons[i].pixUp );
328 } 323 }
329} 324}
330 325
331 326
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 2641df6..504b705 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -23,8 +23,9 @@
23#ifndef MEDIAWIDGET_H 23#ifndef MEDIAWIDGET_H
24#define MEDIAWIDGET_H 24#define MEDIAWIDGET_H
25 25
26#include <qwidget.h> 26#include <qwidget.h>
27#include <qmap.h>
27 28
28#include "mediaplayerstate.h" 29#include "mediaplayerstate.h"
29#include "playlistwidget.h" 30#include "playlistwidget.h"
30 31
@@ -43,8 +44,12 @@ public:
43 44
44 ButtonType type : 1; 45 ButtonType type : 1;
45 bool isHeld : 1; 46 bool isHeld : 1;
46 bool isDown : 1; 47 bool isDown : 1;
48
49 QBitmap mask;
50 QPixmap pixUp;
51 QPixmap pixDown;
47 }; 52 };
48 typedef std::vector<Button> ButtonVector; 53 typedef std::vector<Button> ButtonVector;
49 54
50 struct SkinButtonInfo 55 struct SkinButtonInfo
@@ -89,12 +94,8 @@ protected:
89 ButtonVector buttons; 94 ButtonVector buttons;
90 95
91 QImage buttonMask; 96 QImage buttonMask;
92 97
93 MaskVector masks;
94 PixmapVector buttonPixUp;
95 PixmapVector buttonPixDown;
96
97 QPoint upperLeftOfButtonMask; 98 QPoint upperLeftOfButtonMask;
98}; 99};
99 100
100#endif // MEDIAWIDGET_H 101#endif // MEDIAWIDGET_H