summaryrefslogtreecommitdiff
Side-by-side diff
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[] = {
-const char *skin_mask_file_names[10] = {
+const char * const skin_mask_file_names[10] = {
"play", "stop", "next", "prev", "up",
@@ -105,8 +105,8 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
QString skinPath = "opieplayer2/skins/" + skin;
- pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
- imgUp = new QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
- imgDn = new QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
+ pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) );
+ imgUp = QImage( Resource::loadImage( QString("%1/skin_up").arg(skinPath) ) );
+ imgDn = QImage( Resource::loadImage( QString("%1/skin_down").arg(skinPath) ) );
- imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 );
- imgButtonMask->fill( 0 );
+ imgButtonMask = QImage( imgUp.width(), imgUp.height(), 8, 255 );
+ imgButtonMask.fill( 0 );
@@ -118,6 +118,6 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
QImage imgMask = masks[i]->convertToImage();
- uchar **dest = imgButtonMask->jumpTable();
- for ( int y = 0; y < imgUp->height(); y++ ) {
+ uchar **dest = imgButtonMask.jumpTable();
+ for ( int y = 0; y < imgUp.height(); y++ ) {
uchar *line = dest[y];
- for ( int x = 0; x < imgUp->width(); x++ )
+ for ( int x = 0; x < imgUp.width(); x++ )
if ( !qRed( imgMask.pixel( x, y ) ) )
@@ -134,3 +134,3 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
- setBackgroundPixmap( *pixBg );
+ setBackgroundPixmap( pixBg );
@@ -147,3 +147,3 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) :
slider.setFocusPolicy( QWidget::NoFocus );
- slider.setBackgroundPixmap( *pixBg );
+ slider.setBackgroundPixmap( pixBg );
@@ -187,6 +187,2 @@ AudioWidget::~AudioWidget() {
}
- delete pixBg;
- delete imgUp;
- delete imgDn;
- delete imgButtonMask;
for ( int i = 0; i < 10; i++ ) {
@@ -199,3 +195,3 @@ namespace {
-QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
+QPixmap combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
QPixmap pix( img.width(), img.height() );
@@ -204,3 +200,3 @@ QPixmap *combineImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
p.drawImage( 0, 0, img );
- return new QPixmap( pix );
+ return pix;
}
@@ -226,8 +222,8 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
- xoff = ( w - imgUp->width() ) / 2;
- yoff = (( h - imgUp->height() ) / 2) - 10;
+ xoff = ( w - imgUp.width() ) / 2;
+ yoff = (( h - imgUp.height() ) / 2) - 10;
QPoint p( xoff, yoff );
- QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p );
- QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p );
+ QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p );
+ QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p );
@@ -237,9 +233,6 @@ void AudioWidget::resizeEvent( QResizeEvent * ) {
delete buttonPixDown[i];
- buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] );
- buttonPixDown[i] = maskPixToMask( *pixDn, *masks[i] );
+ buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] );
+ buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] );
}
}
-
- delete pixUp;
- delete pixDn;
}
@@ -399,5 +392,5 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
- bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
- && y < imgButtonMask->height()
- && imgButtonMask->pixelIndex( x, y ) == i + 1 );
+ bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width()
+ && y < imgButtonMask.height()
+ && imgButtonMask.pixelIndex( x, y ) == i + 1 );
@@ -483,3 +476,3 @@ void AudioWidget::paintEvent( QPaintEvent * pe ) {
p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() );
- p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() );
+ p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() );
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 @@
#include <qlineedit.h>
+#include <qimage.h>
@@ -115,6 +116,6 @@ private:
QString skin;
- QPixmap *pixBg;
- QImage *imgUp;
- QImage *imgDn;
- QImage *imgButtonMask;
+ QPixmap pixBg;
+ QImage imgUp;
+ QImage imgDn;
+ QImage imgButtonMask;
QBitmap *masks[10];