-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 13 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 15 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.h | 1 |
6 files changed, 14 insertions, 28 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 12f91a9..5cc2814 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -300,41 +300,32 @@ void AudioWidget::updateSlider( long i, long max ) { } if ( slider.maxValue() != width ) { slider.setMaxValue( width ); } } } void AudioWidget::setToggleButton( int i, bool down ) { qDebug("setToggleButton %d", i); if ( down != buttons[i].isDown ) { toggleButton( i ); } } -void AudioWidget::paintButton( QPainter &p, int i ) { - if ( buttons[i].isDown ) { - p.drawPixmap( upperLeftOfButtonMask, buttons[i].pixDown ); - } else { - p.drawPixmap( upperLeftOfButtonMask, buttons[i].pixUp ); - } -} - - void AudioWidget::skipFor() { skipDirection = +1; startTimer( 50 ); mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); } void AudioWidget::skipBack() { skipDirection = -1; startTimer( 50 ); mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); } void AudioWidget::stopSkip() { killTimers(); @@ -402,39 +393,39 @@ 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(), pixBg, pe->rect().topLeft() ); for ( unsigned int i = 0; i < buttons.count(); i++ ) - paintButton( p, 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, 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"); break; case Key_F10: //contacts break; case Key_F11: //menu mediaPlayerState.toggleBlank(); diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index 332fb4b..7a775cd 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -79,33 +79,32 @@ 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: void skipFor(); void skipBack(); void stopSkip(); private: void setToggleButton( int, bool ); - virtual void paintButton( QPainter &p, int i ); int skipDirection; QString skin; QPixmap pixBg; QImage imgUp; QImage imgDn; OTicker songInfo; QSlider slider; QLineEdit time; bool isStreaming : 1; bool audioSliderBeingMoved : 1; }; #endif // AUDIO_WIDGET_H diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 62266ad..f977b61 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp @@ -58,27 +58,35 @@ void MediaWidget::handleCommand( Command command, bool buttonDown ) case Forward: emit forwardReleased(); return; case Back: emit backReleased(); return; } } bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const { return ( position.x() > 0 && position.y() > 0 && position.x() < buttonMask.width() && position.y() < buttonMask.height() && buttonMask.pixelIndex( position.x(), position.y() ) == buttonId + 1 ); } void MediaWidget::paintButton( int buttonId ) { QPainter p( this ); - paintButton( p, buttonId ); + paintButton( p, buttons[ buttonId ] ); +} + +void MediaWidget::paintButton( QPainter &p, const Button &button ) +{ + if ( button.isDown ) + p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); + else + p.drawPixmap( upperLeftOfButtonMask, button.pixUp ); } void MediaWidget::toggleButton( int buttonId ) { buttons[ buttonId ].isDown = !buttons[ buttonId ].isDown; paintButton( buttonId ); } /* vim: et sw=4 ts=4 */ diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 49bf024..163f449 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -73,33 +73,33 @@ public slots: virtual void setPlaying( bool playing ) = 0; signals: void moreReleased(); void lessReleased(); void forwardReleased(); void backReleased(); 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; + void paintButton( QPainter &p, const Button &button ); void toggleButton( int buttonId ); MediaPlayerState &mediaPlayerState; PlayListWidget &playList; ButtonMap buttons; QImage buttonMask; QPoint upperLeftOfButtonMask; }; #endif // MEDIAWIDGET_H /* vim: et sw=4 ts=4 */ diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 3baa087..a483434 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -235,43 +235,32 @@ void VideoWidget::updateSlider( long i, long max ) { if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { if ( slider->value() != val ) { slider->setValue( val ); } if ( slider->maxValue() != width ) { slider->setMaxValue( width ); } } } void VideoWidget::setToggleButton( int i, bool down ) { if ( down != buttons[i].isDown ) { toggleButton( i ); } } -void VideoWidget::paintButton( QPainter &p, int i ) { - - Button &button = buttons[ i ]; - - if ( button.isDown ) { - p.drawPixmap( upperLeftOfButtonMask, button.pixDown ); - } else { - 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); switch (i) { case VideoVolUp: emit moreClicked(); return; case VideoVolDown: emit lessClicked(); @@ -390,40 +379,40 @@ void VideoWidget::makeVisible() { 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(), pixBg, pe->rect().topLeft() ); for ( unsigned int i = 0; i < buttons.count(); i++ ) { - paintButton( p, 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, 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 // hide(); break; diff --git a/noncore/multimedia/opieplayer2/videowidget.h b/noncore/multimedia/opieplayer2/videowidget.h index 937feac..a271120 100644 --- a/noncore/multimedia/opieplayer2/videowidget.h +++ b/noncore/multimedia/opieplayer2/videowidget.h @@ -90,31 +90,30 @@ 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; QPixmap pixBg; QImage imgUp; QImage imgDn; QString skin; - virtual void paintButton( QPainter &p, int i ); void setToggleButton( int, bool ); QString backgroundPix; QSlider *slider; QImage *currentFrame; int scaledWidth; int scaledHeight; XineVideoWidget* videoFrame; }; #endif // VIDEO_WIDGET_H |