-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 38 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 10 |
2 files changed, 23 insertions, 25 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 41dddb7..c0039b1 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -98,10 +98,10 @@ MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 QString skinPath = "opieplayer2/skins/" + skin; - pixBg = new QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); - imgUp = new QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); - imgDn = new QImage( Resource::loadImage( QString("%1/skinV_down").arg(skinPath) ) ); + pixBg = QPixmap( Resource::loadPixmap( QString("%1/background").arg(skinPath) ) ); + imgUp = QImage( Resource::loadImage( QString("%1/skinV_up").arg(skinPath) ) ); + imgDn = QImage( Resource::loadImage( QString("%1/skinV_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 ); for ( int i = 0; i < 7; i++ ) { @@ -111,8 +111,8 @@ MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 if ( !masks[i]->isNull() ) { 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 ) ) ) line[x] = i + 1; @@ -127,5 +127,5 @@ MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 } - setBackgroundPixmap( *pixBg ); + setBackgroundPixmap( pixBg ); slider = new QSlider( Qt::Horizontal, this ); @@ -151,8 +151,4 @@ VideoWidget::~VideoWidget() { } - delete pixBg; - delete imgUp; - delete imgDn; - delete imgButtonMask; for ( int i = 0; i < 7; i++ ) { delete masks[i]; @@ -185,5 +181,5 @@ void VideoWidget::resizeEvent( QResizeEvent * ) { slider->setBackgroundOrigin( QWidget::ParentOrigin ); slider->setFocusPolicy( QWidget::NoFocus ); - slider->setBackgroundPixmap( *pixBg ); + slider->setBackgroundPixmap( pixBg ); xoff = 0;// ( imgUp->width() ) / 2; @@ -194,6 +190,6 @@ void VideoWidget::resizeEvent( QResizeEvent * ) { QPoint p( xoff, yoff ); - QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); - QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); + QPixmap *pixUp = combineVImageWithBackground( imgUp, pixBg, p ); + QPixmap *pixDn = combineVImageWithBackground( imgDn, pixBg, p ); for ( int i = 0; i < 7; i++ ) { @@ -292,7 +288,7 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { int y = event->pos().y() - yoff; - 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 ); if ( isOnButton && !videoButtons[i].isHeld ) { @@ -387,5 +383,5 @@ void VideoWidget::makeVisible() { showNormal(); showMaximized(); - setBackgroundPixmap( *pixBg ); + setBackgroundPixmap( pixBg ); QWidget *d = QApplication::desktop(); int w = d->width(); @@ -432,5 +428,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { QPainter p( &pix ); 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 < numVButtons; i++ ) { paintButton( &p, i ); diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 149c78e..ae0e687 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -36,4 +36,6 @@ #include <qwidget.h> +#include <qimage.h> +#include <qpixmap.h> #include "xinevideowidget.h" @@ -96,8 +98,8 @@ protected: private: // Ticker songInfo; - QPixmap *pixBg; - QImage *imgUp; - QImage *imgDn; - QImage *imgButtonMask; + QPixmap pixBg; + QImage imgUp; + QImage imgDn; + QImage imgButtonMask; QBitmap *masks[7]; QPixmap *buttonPixUp[7]; |