summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp53
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h9
2 files changed, 28 insertions, 34 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 5cdfbf2..46d374d 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -76,3 +76,3 @@ MediaButton audioButtons[] = {
76 76
77const char *skin_mask_file_names[10] = { 77const char * const skin_mask_file_names[10] = {
78 "play", "stop", "next", "prev", "up", 78 "play", "stop", "next", "prev", "up",
@@ -105,8 +105,8 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
105 QString skinPath = "opieplayer2/skins/" + skin; 105 QString skinPath = "opieplayer2/skins/" + skin;
106 pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); 106 pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
107 imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) ); 107 imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
108 imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) ); 108 imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
109 109
110 imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); 110 imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
111 imgButtonMask->fill( 0 ); 111 imgButtonMask.fill( 0 );
112 112
@@ -118,6 +118,6 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
118 QImage imgMask = masks[i]->convertToImage(); 118 QImage imgMask = masks[i]->convertToImage();
119 uchar **dest = imgButtonMask->jumpTable(); 119 uchar **dest = imgButtonMask.jumpTable();
120 for ( int y = 0; y < imgUp->height(); y++ ) { 120 for ( int y = 0; y < imgUp.height(); y++ ) {
121 uchar *line = dest[y]; 121 uchar *line = dest[y];
122 for ( int x = 0; x < imgUp->width(); x++ ) 122 for ( int x = 0; x < imgUp.width(); x++ )
123 if ( !qRed( imgMask.pixel( x, y ) ) ) 123 if ( !qRed( imgMask.pixel( x, y ) ) )
@@ -134,3 +134,3 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
134 134
135 setBackgroundPixmap( *pixBg ); 135 setBackgroundPixmap( pixBg );
136 136
@@ -147,3 +147,3 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
147 slider.setFocusPolicy( QWidget::NoFocus ); 147 slider.setFocusPolicy( QWidget::NoFocus );
148 slider.setBackgroundPixmap( *pixBg ); 148 slider.setBackgroundPixmap( pixBg );
149 149
@@ -187,6 +187,2 @@ AudioWidget::~AudioWidget() {
187 } 187 }
188 delete pixBg;
189 delete imgUp;
190 delete imgDn;
191 delete imgButtonMask;
192 for ( int i = 0; i < 10; i++ ) { 188 for ( int i = 0; i < 10; i++ ) {
@@ -199,3 +195,3 @@ namespace {
199 195
200QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) { 196QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
201 QPixmap pix( img.width(), img.height() ); 197 QPixmap pix( img.width(), img.height() );
@@ -204,3 +200,3 @@ QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
204 p.drawImage( 0, 0, img ); 200 p.drawImage( 0, 0, img );
205 return new QPixmap( pix ); 201 return pix;
206} 202}
@@ -226,8 +222,8 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
226 222
227 xoff = ( w - imgUp->width() ) / 2; 223 xoff = ( w - imgUp.width() ) / 2;
228 yoff = (( h - imgUp->height() ) / 2) - 10; 224 yoff = (( h - imgUp.height() ) / 2) - 10;
229 QPoint p( xoff, yoff ); 225 QPoint p( xoff, yoff );
230 226
231 QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); 227 QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p );
232 QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); 228 QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p );
233 229
@@ -237,9 +233,6 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
237 delete buttonPixDown[i]; 233 delete buttonPixDown[i];
238 buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); 234 buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] );
239 buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] ); 235 buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] );
240 } 236 }
241 } 237 }
242
243 delete pixUp;
244 delete pixDn;
245} 238}
@@ -399,5 +392,5 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
399 392
400 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 393 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width()
401 && y < imgButtonMask->height() 394 && y < imgButtonMask.height()
402 && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 395 && imgButtonMask.pixelIndex( x, y ) == i + 1 );
403 396
@@ -483,3 +476,3 @@ void AudioWidget::paintEvent( QPaintEvent * pe ) {
483 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); 476 p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
484 p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); 477 p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() );
485 for ( int i = 0; i < numButtons; i++ ) 478 for ( int i = 0; i < numButtons; i++ )
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 7cb1d79..54adb36 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -44,2 +44,3 @@
44#include <qlineedit.h> 44#include <qlineedit.h>
45#include <qimage.h>
45 46
@@ -115,6 +116,6 @@ private:
115 QString skin; 116 QString skin;
116 QPixmap *pixBg; 117 QPixmap pixBg;
117 QImage *imgUp; 118 QImage imgUp;
118 QImage *imgDn; 119 QImage imgDn;
119 QImage *imgButtonMask; 120 QImage imgButtonMask;
120 QBitmap *masks[10]; 121 QBitmap *masks[10];