-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 22 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 6 |
2 files changed, 10 insertions, 18 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index fe7ddc1..2081b4f 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -129,10 +129,8 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
129 | 129 | ||
130 | } | 130 | } |
131 | 131 | ||
132 | for ( int i = 0; i < 10; i++ ) { | 132 | buttonPixUp.resize( masks.size(), QPixmap() ); |
133 | buttonPixUp[i] = 0l; | 133 | buttonPixDown.resize( masks.size(), QPixmap() ); |
134 | buttonPixDown[i] = 0l; | ||
135 | } | ||
136 | 134 | ||
137 | setBackgroundPixmap( pixBg ); | 135 | setBackgroundPixmap( pixBg ); |
138 | 136 | ||
@@ -180,10 +178,6 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
180 | 178 | ||
181 | AudioWidget::~AudioWidget() { | 179 | AudioWidget::~AudioWidget() { |
182 | 180 | ||
183 | for ( int i = 0; i < 10; i++ ) { | ||
184 | delete buttonPixUp[i]; | ||
185 | delete buttonPixDown[i]; | ||
186 | } | ||
187 | // mediaPlayerState->setPlaying(false); | 181 | // mediaPlayerState->setPlaying(false); |
188 | } | 182 | } |
189 | 183 | ||
@@ -198,9 +192,9 @@ QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { | |||
198 | } | 192 | } |
199 | 193 | ||
200 | 194 | ||
201 | QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { | 195 | QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) { |
202 | QPixmap *pixmap = new QPixmap( pix ); | 196 | QPixmap pixmap( pix ); |
203 | pixmap->setMask( mask ); | 197 | pixmap.setMask( mask ); |
204 | return pixmap; | 198 | return pixmap; |
205 | } | 199 | } |
206 | 200 | ||
@@ -225,8 +219,6 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
225 | 219 | ||
226 | for ( int i = 0; i < 10; i++ ) { | 220 | for ( int i = 0; i < 10; i++ ) { |
227 | if ( !masks[i].isNull() ) { | 221 | if ( !masks[i].isNull() ) { |
228 | delete buttonPixUp[i]; | ||
229 | delete buttonPixDown[i]; | ||
230 | buttonPixUp[i] = maskPixToMask( pixUp, masks[i] ); | 222 | buttonPixUp[i] = maskPixToMask( pixUp, masks[i] ); |
231 | buttonPixDown[i] = maskPixToMask( pixDn, masks[i] ); | 223 | buttonPixDown[i] = maskPixToMask( pixDn, masks[i] ); |
232 | } | 224 | } |
@@ -332,9 +324,9 @@ void AudioWidget::setToggleButton( int i, bool down ) { | |||
332 | 324 | ||
333 | void AudioWidget::paintButton( QPainter &p, int i ) { | 325 | void AudioWidget::paintButton( QPainter &p, int i ) { |
334 | if ( buttons[i].isDown ) { | 326 | if ( buttons[i].isDown ) { |
335 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); | 327 | p.drawPixmap( upperLeftOfButtonMask, buttonPixDown[i] ); |
336 | } else { | 328 | } else { |
337 | p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); | 329 | p.drawPixmap( upperLeftOfButtonMask, buttonPixUp[i] ); |
338 | } | 330 | } |
339 | } | 331 | } |
340 | 332 | ||
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index bc7262c..73ce1e5 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h | |||
@@ -92,6 +92,7 @@ private slots: | |||
92 | void stopSkip(); | 92 | void stopSkip(); |
93 | private: | 93 | private: |
94 | typedef std::vector<QBitmap> MaskVector; | 94 | typedef std::vector<QBitmap> MaskVector; |
95 | typedef std::vector<QPixmap> PixmapVector; | ||
95 | 96 | ||
96 | void setToggleButton( int, bool ); | 97 | void setToggleButton( int, bool ); |
97 | virtual void paintButton( QPainter &p, int i ); | 98 | virtual void paintButton( QPainter &p, int i ); |
@@ -101,10 +102,9 @@ private: | |||
101 | QImage imgUp; | 102 | QImage imgUp; |
102 | QImage imgDn; | 103 | QImage imgDn; |
103 | MaskVector masks; | 104 | MaskVector masks; |
104 | QPixmap *buttonPixUp[10]; | 105 | PixmapVector buttonPixUp; |
105 | QPixmap *buttonPixDown[10]; | 106 | PixmapVector buttonPixDown; |
106 | 107 | ||
107 | QPixmap *pixmaps[4]; | ||
108 | OTicker songInfo; | 108 | OTicker songInfo; |
109 | QSlider slider; | 109 | QSlider slider; |
110 | QLineEdit time; | 110 | QLineEdit time; |