summaryrefslogtreecommitdiff
path: root/noncore/multimedia
Side-by-side diff
Diffstat (limited to 'noncore/multimedia') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp22
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h6
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
}
- for ( int i = 0; i < 10; i++ ) {
- buttonPixUp[i] = 0l;
- buttonPixDown[i] = 0l;
- }
+ buttonPixUp.resize( masks.size(), QPixmap() );
+ buttonPixDown.resize( masks.size(), QPixmap() );
setBackgroundPixmap( pixBg );
@@ -180,10 +178,6 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
AudioWidget::~AudioWidget() {
- for ( int i = 0; i < 10; i++ ) {
- delete buttonPixUp[i];
- delete buttonPixDown[i];
- }
// mediaPlayerState->setPlaying(false);
}
@@ -198,9 +192,9 @@ QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
}
-QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) {
- QPixmap *pixmap = new QPixmap( pix );
- pixmap->setMask( mask );
+QPixmap maskPixToMask( QPixmap pix, QBitmap mask ) {
+ QPixmap pixmap( pix );
+ pixmap.setMask( mask );
return pixmap;
}
@@ -225,8 +219,6 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
for ( int i = 0; i < 10; i++ ) {
if ( !masks[i].isNull() ) {
- delete buttonPixUp[i];
- delete buttonPixDown[i];
buttonPixUp[i] = maskPixToMask( pixUp, masks[i] );
buttonPixDown[i] = maskPixToMask( pixDn, masks[i] );
}
@@ -332,9 +324,9 @@ void AudioWidget::setToggleButton( int i, bool down ) {
void AudioWidget::paintButton( QPainter &p, int i ) {
if ( buttons[i].isDown ) {
- p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
+ p.drawPixmap( upperLeftOfButtonMask, buttonPixDown[i] );
} else {
- p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
+ p.drawPixmap( upperLeftOfButtonMask, buttonPixUp[i] );
}
}
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:
void stopSkip();
private:
typedef std::vector<QBitmap> MaskVector;
+ typedef std::vector<QPixmap> PixmapVector;
void setToggleButton( int, bool );
virtual void paintButton( QPainter &p, int i );
@@ -101,10 +102,9 @@ private:
QImage imgUp;
QImage imgDn;
MaskVector masks;
- QPixmap *buttonPixUp[10];
- QPixmap *buttonPixDown[10];
+ PixmapVector buttonPixUp;
+ PixmapVector buttonPixDown;
- QPixmap *pixmaps[4];
OTicker songInfo;
QSlider slider;
QLineEdit time;