summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp38
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h10
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
@@ -96,25 +96,25 @@ MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0
cfg.setGroup("Options");
skin = cfg.readEntry("Skin","default");
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++ ) {
QString filename = QString( QPEApplication::qpeDir() + "/pics/" + skinPath + "/skinV_mask_" + skinV_mask_file_names[i] + ".png" );
masks[i] = new QBitmap( filename );
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;
}
}
@@ -125,9 +125,9 @@ MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0
buttonPixUp[i] = NULL;
buttonPixDown[i] = NULL;
}
- setBackgroundPixmap( *pixBg );
+ setBackgroundPixmap( pixBg );
slider = new QSlider( Qt::Horizontal, this );
slider->setMinValue( 0 );
slider->setMaxValue( 1 );
@@ -149,12 +149,8 @@ VideoWidget::~VideoWidget() {
delete buttonPixUp[i];
delete buttonPixDown[i];
}
- delete pixBg;
- delete imgUp;
- delete imgDn;
- delete imgButtonMask;
for ( int i = 0; i < 7; i++ ) {
delete masks[i];
}
@@ -183,19 +179,19 @@ void VideoWidget::resizeEvent( QResizeEvent * ) {
slider->setFixedWidth( w - 20 );
slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
slider->setBackgroundOrigin( QWidget::ParentOrigin );
slider->setFocusPolicy( QWidget::NoFocus );
- slider->setBackgroundPixmap( *pixBg );
+ slider->setBackgroundPixmap( pixBg );
xoff = 0;// ( imgUp->width() ) / 2;
if(w>h)
yoff = 0;
else
yoff = 185;//(( Vh - imgUp->height() ) / 2) - 10;
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++ ) {
if ( !masks[i]->isNull() ) {
delete buttonPixUp[i];
@@ -290,11 +286,11 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
// The test to see if the mouse click is inside the button or not
int x = event->pos().x() - xoff;
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 ) {
videoButtons[i].isHeld = TRUE;
toggleButton(i);
@@ -385,9 +381,9 @@ void VideoWidget::makeVisible() {
} else {
showNormal();
showMaximized();
- setBackgroundPixmap( *pixBg );
+ setBackgroundPixmap( pixBg );
QWidget *d = QApplication::desktop();
int w = d->width();
int h = d->height();
@@ -430,9 +426,9 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
// Combine with background and double buffer
QPixmap pix( pe->rect().size() );
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 );
}
QPainter p2( this );
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
@@ -34,8 +34,10 @@
#ifndef VIDEO_WIDGET_H
#define VIDEO_WIDGET_H
#include <qwidget.h>
+#include <qimage.h>
+#include <qpixmap.h>
#include "xinevideowidget.h"
#include "mediawidget.h"
@@ -94,12 +96,12 @@ protected:
void keyReleaseEvent( QKeyEvent *e);
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];
QPixmap *buttonPixDown[7];
QString skin;