summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-09 15:19:47 (UTC)
committer simon <simon>2002-12-09 15:19:47 (UTC)
commit47d689545e68f2439cc88630ac78016712f92cc9 (patch) (side-by-side diff)
tree5d2d01f7a68c2bed804c0b6518f9a8858de27a2e
parent3f37a852175ace7ee69b626f48eaea19d736b6ed (diff)
downloadopie-47d689545e68f2439cc88630ac78016712f92cc9.zip
opie-47d689545e68f2439cc88630ac78016712f92cc9.tar.gz
opie-47d689545e68f2439cc88630ac78016712f92cc9.tar.bz2
- merged the duplicated (and identical) paintEvent methods into the
base class
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp19
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.h1
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.cpp28
-rw-r--r--noncore/multimedia/opieplayer2/mediawidget.h2
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp31
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.h1
6 files changed, 30 insertions, 52 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 553c56b..277d162 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -392,35 +392,16 @@ void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
}
void AudioWidget::showEvent( QShowEvent* ) {
QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
mouseMoveEvent( &event );
}
-
-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(), backgroundPixmap, pe->rect().topLeft() );
- for ( unsigned int i = 0; i < buttons.count(); i++ )
- paintButton( p, buttons[ i ] );
- QPainter p2( this );
- p2.drawPixmap( pe->rect().topLeft(), pix );
- } else {
- QPainter p( this );
- for ( unsigned int i = 0; i < buttons.count(); i++ )
- paintButton( p, buttons[ i ] );
- }
-}
-
void AudioWidget::keyReleaseEvent( QKeyEvent *e) {
switch ( e->key() ) {
////////////////////////////// Zaurus keys
case Key_Home:
break;
case Key_F9: //activity
hide();
// qDebug("Audio F9");
diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h
index 69837cd..8c433ac 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.h
+++ b/noncore/multimedia/opieplayer2/audiowidget.h
@@ -73,17 +73,16 @@ signals:
void lessClicked();
void forwardClicked();
void backClicked();
void sliderMoved(long);
protected:
void doBlank();
void doUnblank();
- void paintEvent( QPaintEvent *pe );
void showEvent( QShowEvent *se );
void resizeEvent( QResizeEvent *re );
void mouseMoveEvent( QMouseEvent *event );
void mousePressEvent( QMouseEvent *event );
void mouseReleaseEvent( QMouseEvent *event );
void timerEvent( QTimerEvent *event );
void keyReleaseEvent( QKeyEvent *e);
private slots:
diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp
index f977b61..3a44185 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.cpp
+++ b/noncore/multimedia/opieplayer2/mediawidget.cpp
@@ -39,16 +39,44 @@ MediaWidget::~MediaWidget()
{
}
void MediaWidget::closeEvent( QCloseEvent * )
{
mediaPlayerState.setList();
}
+void MediaWidget::paintEvent( QPaintEvent *pe )
+{
+ QPainter p( this );
+
+ if ( mediaPlayerState.isFullscreen() ) {
+ // Clear the background
+ p.setBrush( QBrush( Qt::black ) );
+ return;
+ }
+
+ 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(), backgroundPixmap, pe->rect().topLeft() );
+ for ( unsigned int i = 0; i < buttons.count(); i++ ) {
+ paintButton( p, buttons[ i ] );
+ }
+ QPainter p2( this );
+ p2.drawPixmap( pe->rect().topLeft(), pix );
+ } else {
+ QPainter p( this );
+ for ( unsigned int i = 0; i < buttons.count(); i++ )
+ paintButton( p, buttons[ i ] );
+ }
+}
+
void MediaWidget::handleCommand( Command command, bool buttonDown )
{
switch ( command ) {
case Play: mediaPlayerState.togglePaused();
case Stop: mediaPlayerState.setPlaying(FALSE); return;
case Next: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setNext(); return;
case Previous: if( playList.currentTab() == PlayListWidget::CurrentPlayList ) mediaPlayerState.setPrev(); return;
case Loop: mediaPlayerState.setLooping( buttonDown ); return;
diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h
index 211e56c..8cdaad1 100644
--- a/noncore/multimedia/opieplayer2/mediawidget.h
+++ b/noncore/multimedia/opieplayer2/mediawidget.h
@@ -76,16 +76,18 @@ signals:
void moreReleased();
void lessReleased();
void forwardReleased();
void backReleased();
protected:
virtual void closeEvent( QCloseEvent * );
+ virtual void paintEvent( QPaintEvent *pe );
+
void handleCommand( Command command, bool buttonDown );
bool isOverButton( const QPoint &position, int buttonId ) const;
void paintButton( int buttonId );
void paintButton( QPainter &p, const Button &button );
void toggleButton( int buttonId );
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index a8bf252..8f6a8a9 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -370,47 +370,16 @@ void VideoWidget::makeVisible() {
connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) );
connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) );
connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) );
connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) );
}
}
}
-
-
-
-void VideoWidget::paintEvent( QPaintEvent * pe) {
- QPainter p( this );
-
- if ( mediaPlayerState.isFullscreen() ) {
- // Clear the background
- p.setBrush( QBrush( Qt::black ) );
- } 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(), backgroundPixmap, pe->rect().topLeft() );
- for ( unsigned int i = 0; i < buttons.count(); i++ ) {
- paintButton( p, buttons[ i ] );
- }
- QPainter p2( this );
- p2.drawPixmap( pe->rect().topLeft(), pix );
- } else {
- QPainter p( this );
- for ( unsigned int i = 0; i < buttons.count(); i++ )
- paintButton( p, buttons[ i ] );
- }
- //slider->repaint( TRUE );
- }
-}
-
-
void VideoWidget::keyReleaseEvent( QKeyEvent *e) {
switch ( e->key() ) {
////////////////////////////// Zaurus keys
case Key_Home:
break;
case Key_F9: //activity
break;
case Key_F10: //contacts
diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h
index 9d5239b..45279d7 100644
--- a/noncore/multimedia/opieplayer2/videowidget.h
+++ b/noncore/multimedia/opieplayer2/videowidget.h
@@ -83,17 +83,16 @@ signals:
void moreReleased();
void lessReleased();
void sliderMoved( long );
void videoResized ( const QSize &s );
protected:
void resizeEvent( QResizeEvent * );
- 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;