summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp32
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h2
2 files changed, 12 insertions, 22 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 089ef6a..3baa087 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -109,64 +109,56 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye
QImage imgMask = button.mask.convertToImage();
uchar **dest = buttonMask.jumpTable();
for ( int y = 0; y < imgUp.height(); y++ ) {
uchar *line = dest[y];
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 );
slider = new QSlider( Qt::Horizontal, this );
slider->setMinValue( 0 );
slider->setMaxValue( 1 );
slider->setBackgroundPixmap( Resource::loadPixmap( backgroundPix ) );
//slider->setFocusPolicy( QWidget::NoFocus );
resizeEvent( NULL );
setLength( mediaPlayerState.length() );
setPosition( mediaPlayerState.position() );
setFullscreen( mediaPlayerState.isFullscreen() );
setPlaying( mediaPlayerState.isPlaying() );
}
-VideoWidget::~VideoWidget() {
- for ( int i = 0; i < 7; i++ ) {
- delete buttonPixUp[i];
- delete buttonPixDown[i];
- }
+VideoWidget::~VideoWidget()
+{
}
QPixmap *combineVImageWithBackground( QImage img, QPixmap bg, QPoint offset ) {
QPixmap pix( img.width(), img.height() );
QPainter p( &pix );
p.drawTiledPixmap( pix.rect(), bg, offset );
p.drawImage( 0, 0, img );
return new QPixmap( pix );
}
-QPixmap *maskVPixToMask( QPixmap pix, QBitmap mask ) {
- QPixmap *pixmap = new QPixmap( pix );
- pixmap->setMask( mask );
+QPixmap maskVPixToMask( QPixmap pix, QBitmap mask ) {
+ QPixmap pixmap( pix );
+ pixmap.setMask( mask );
return pixmap;
}
void VideoWidget::resizeEvent( QResizeEvent * ) {
int h = height();
int w = width();
//int Vh = 160;
//int Vw = 220;
slider->setFixedWidth( w - 20 );
slider->setGeometry( QRect( 15, h - 22, w - 90, 20 ) );
slider->setBackgroundOrigin( QWidget::ParentOrigin );
@@ -178,28 +170,26 @@ void VideoWidget::resizeEvent( QResizeEvent * ) {
upperLeftOfButtonMask.ry() = 0;
else
upperLeftOfButtonMask.ry() = 185;//(( Vh - imgUp->height() ) / 2) - 10;
QPoint p = upperLeftOfButtonMask;
QPixmap *pixUp = combineVImageWithBackground( imgUp, pixBg, p );
QPixmap *pixDn = combineVImageWithBackground( imgDn, pixBg, p );
for ( int i = 0; i < 7; i++ ) {
Button &button = buttons[ i ];
if ( !button.mask.isNull() ) {
- delete buttonPixUp[i];
- delete buttonPixDown[i];
- buttonPixUp[i] = maskVPixToMask( *pixUp, button.mask );
- buttonPixDown[i] = maskVPixToMask( *pixDn, button.mask );
+ button.pixUp = maskVPixToMask( *pixUp, button.mask );
+ button.pixDown = maskVPixToMask( *pixDn, button.mask );
}
}
delete pixUp;
delete pixDn;
}
static bool videoSliderBeingMoved = FALSE;
void VideoWidget::sliderPressed() {
videoSliderBeingMoved = TRUE;
}
@@ -251,28 +241,30 @@ void VideoWidget::updateSlider( long i, long max ) {
}
}
}
void VideoWidget::setToggleButton( int i, bool down ) {
if ( down != buttons[i].isDown ) {
toggleButton( i );
}
}
void VideoWidget::paintButton( QPainter &p, int i ) {
- if ( buttons[i].isDown ) {
- p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
+ Button &button = buttons[ i ];
+
+ if ( button.isDown ) {
+ p.drawPixmap( upperLeftOfButtonMask, button.pixDown );
} else {
- p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
+ p.drawPixmap( upperLeftOfButtonMask, button.pixUp );
}
}
void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
for ( unsigned int i = 0; i < buttons.count(); i++ ) {
if ( event->state() == QMouseEvent::LeftButton ) {
// The test to see if the mouse click is inside the button or not
bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i );
if ( isOnButton && !buttons[i].isHeld ) {
buttons[i].isHeld = TRUE;
toggleButton(i);
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index fd301f9..aeb6429 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -91,26 +91,24 @@ protected:
void paintEvent( QPaintEvent *pe );
void showEvent( QShowEvent *se );
void mouseMoveEvent( QMouseEvent *event );
void mousePressEvent( QMouseEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
void keyReleaseEvent( QKeyEvent *e);
private:
// Ticker songInfo;
QPixmap pixBg;
QImage imgUp;
QImage imgDn;
- QPixmap *buttonPixUp[7];
- QPixmap *buttonPixDown[7];
QString skin;
virtual void paintButton( QPainter &p, int i );
void setToggleButton( int, bool );
QString backgroundPix;
QSlider *slider;
QPixmap *pixmaps[3];
QImage *currentFrame;
int scaledWidth;
int scaledHeight;