summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h3
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp12
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h2
5 files changed, 17 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index d083273..10b1e58 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -331,25 +331,25 @@ void AudioWidget::setToggleButton( int i, bool down ) {
toggleButton( i );
}
}
void AudioWidget::toggleButton( int i ) {
buttons[i].isDown = !buttons[i].isDown;
QPainter p(this);
- paintButton ( &p, i );
+ paintButton ( p, i );
}
-void AudioWidget::paintButton( QPainter *p, int i ) {
+void AudioWidget::paintButton( QPainter &p, int i ) {
if ( buttons[i].isDown ) {
- p->drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
+ p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
} else {
- p->drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
+ p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
}
}
void AudioWidget::skipFor() {
skipDirection = +1;
startTimer( 50 );
mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
@@ -437,23 +437,23 @@ void AudioWidget::showEvent( QShowEvent* ) {
void AudioWidget::paintEvent( QPaintEvent * pe ) {
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() );
for ( unsigned int i = 0; i < buttons.size(); i++ )
- paintButton( &p, i );
+ paintButton( p, i );
QPainter p2( this );
p2.drawPixmap( pe->rect().topLeft(), pix );
} else {
QPainter p( this );
for ( unsigned int i = 0; i < buttons.size(); i++ )
- paintButton( &p, i );
+ paintButton( p, i );
}
}
void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
switch ( e->key() ) {
////////////////////////////// Zaurus keys
case Key_Home:
break;
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index acf2dda..a1a839c 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -88,17 +88,17 @@ protected:
void keyReleaseEvent( QKeyEvent *e);
private slots:
void skipFor();
void skipBack();
void stopSkip();
private:
void toggleButton( int );
void setToggleButton( int, bool );
- void paintButton( QPainter *p, int i );
+ virtual void paintButton( QPainter &p, int i );
int skipDirection;
QString skin;
QPixmap pixBg;
QImage imgUp;
QImage imgDn;
QBitmap *masks[10];
QPixmap *buttonPixUp[10];
QPixmap *buttonPixDown[10];
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 6e12a3b..066d2ac 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -62,16 +62,19 @@ signals:
protected:
virtual void closeEvent( QCloseEvent * );
void handleCommand( Command command, bool buttonDown );
bool isOverButton( const QPoint &position, int buttonId ) const;
+ void paintButton( int buttonId );
+ virtual void paintButton( QPainter &p, int i ) = 0;
+
MediaPlayerState &mediaPlayerState;
PlayListWidget &playList;
ButtonVector buttons;
QImage buttonMask;
QPoint upperLeftOfButtonMask;
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 6451ac4..3e677c6 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -261,25 +261,25 @@ void VideoWidget::setToggleButton( int i, bool down ) {
if ( down != buttons[i].isDown ) {
toggleButton( i );
}
}
void VideoWidget::toggleButton( int i ) {
buttons[i].isDown = !buttons[i].isDown;
QPainter p(this);
- paintButton ( &p, i );
+ paintButton ( p, i );
}
-void VideoWidget::paintButton( QPainter *p, int i ) {
+void VideoWidget::paintButton( QPainter &p, int i ) {
if ( buttons[i].isDown ) {
- p->drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
+ p.drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] );
} else {
- p->drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
+ p.drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] );
}
}
void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
for ( unsigned int i = 0; i < buttons.size(); 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 );
@@ -417,24 +417,24 @@ 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() );
for ( unsigned int i = 0; i < buttons.size(); i++ ) {
- paintButton( &p, i );
+ paintButton( p, i );
}
QPainter p2( this );
p2.drawPixmap( pe->rect().topLeft(), pix );
} else {
QPainter p( this );
for ( unsigned int i = 0; i < buttons.size(); i++ )
- paintButton( &p, i );
+ paintButton( p, i );
}
//slider->repaint( TRUE );
}
}
void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
switch ( e->key() ) {
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 2a9f1e0..28f720b 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -102,17 +102,17 @@ private:
QImage imgDn;
QBitmap *masks[7];
QPixmap *buttonPixUp[7];
QPixmap *buttonPixDown[7];
QString skin;
// QPixmap *pixmaps[4];
- void paintButton( QPainter *p, int i );
+ virtual void paintButton( QPainter &p, int i );
void toggleButton( int );
void setToggleButton( int, bool );
QString backgroundPix;
QSlider *slider;
QPixmap *pixmaps[3];
QImage *currentFrame;
int scaledWidth;