summaryrefslogtreecommitdiff
path: root/noncore
Side-by-side diff
Diffstat (limited to 'noncore') (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
@@ -94,42 +94,42 @@ MediaWidget( mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0
Config cfg("OpiePlayer");
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;
}
}
}
}
for ( int i = 0; i < 7; i++ ) {
buttonPixUp[i] = NULL;
buttonPixDown[i] = NULL;
}
- setBackgroundPixmap( *pixBg );
+ setBackgroundPixmap( pixBg );
slider = new QSlider( Qt::Horizontal, this );
slider->setMinValue( 0 );
slider->setMaxValue( 1 );
slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
//slider->setFocusPolicy( QWidget::NoFocus );
@@ -147,16 +147,12 @@ VideoWidget::~VideoWidget() {
for ( int i = 0; i < 7; i++ ) {
delete buttonPixUp[i];
delete buttonPixDown[i];
}
- delete pixBg;
- delete imgUp;
- delete imgDn;
- delete imgButtonMask;
for ( int i = 0; i < 7; i++ ) {
delete masks[i];
}
}
@@ -181,23 +177,23 @@ void VideoWidget::resizeEvent( QResizeEvent * ) {
//int Vw = 220;
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];
delete buttonPixDown[i];
buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] );
@@ -288,15 +284,15 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
for ( int i = 0; i < numVButtons; i++ ) {
if ( event->state() == QMouseEvent::LeftButton ) {
// 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);
switch (i) {
@@ -383,13 +379,13 @@ void VideoWidget::makeVisible() {
disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
} else {
showNormal();
showMaximized();
- setBackgroundPixmap( *pixBg );
+ setBackgroundPixmap( pixBg );
QWidget *d = QApplication::desktop();
int w = d->width();
int h = d->height();
if(w>h) {
int newW=(w/2)-(246/2); //this will only work with 320x240
@@ -428,13 +424,13 @@ void VideoWidget::paintEvent( QPaintEvent * pe) {
} else {
if ( !pe->erased() ) {
// 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 );
p2.drawPixmap( pe->rect().topLeft(), pix );
} else {
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
@@ -32,12 +32,14 @@
*/
#ifndef VIDEO_WIDGET_H
#define VIDEO_WIDGET_H
#include <qwidget.h>
+#include <qimage.h>
+#include <qpixmap.h>
#include "xinevideowidget.h"
#include "mediawidget.h"
class QPixmap;
class QSlider;
@@ -92,16 +94,16 @@ protected:
void mousePressEvent( QMouseEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
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;
// QPixmap *pixmaps[4];
int xoff, yoff;