-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 31 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.h | 6 |
2 files changed, 23 insertions, 14 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 2cb1385..cc6187c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -99,9 +99,8 @@ struct MediaButton { //Layout information for the audioButtons (and if it is a toggle button or not) MediaButton audioButtons[] = { { TRUE, FALSE, FALSE }, // play { FALSE, FALSE, FALSE }, // stop - { FALSE, FALSE, FALSE }, // pause { FALSE, FALSE, FALSE }, // next { FALSE, FALSE, FALSE }, // previous { FALSE, FALSE, FALSE }, // volume up { FALSE, FALSE, FALSE }, // volume down @@ -110,10 +109,10 @@ MediaButton audioButtons[] = { { FALSE, FALSE, FALSE }, // forward { FALSE, FALSE, FALSE } // back }; -const char *skin_mask_file_names[11] = { - "play", "stop", "pause", "next", "prev", "up", +const char *skin_mask_file_names[10] = { + "play", "stop", "next", "prev", "up", "down", "loop", "playlist", "forward", "back" }; @@ -144,9 +143,9 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : imgButtonMask = new QImage( imgUp->width(), imgUp->height(), 8, 255 ); imgButtonMask->fill( 0 ); - for ( int i = 0; i < 11; i++ ) { + for ( int i = 0; i < 10; i++ ) { QString filename = QString(getenv("OPIEDIR")) + "/pics/" + skinPath + "/skin_mask_" + skin_mask_file_names[i] + ".png"; masks[i] = new QBitmap( filename ); if ( !masks[i]->isNull() ) { @@ -161,9 +160,9 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : } } - for ( int i = 0; i < 11; i++ ) { + for ( int i = 0; i < 10; i++ ) { buttonPixUp[i] = NULL; buttonPixDown[i] = NULL; } @@ -211,17 +210,17 @@ AudioWidget::AudioWidget(QWidget* parent, const char* name, WFlags f) : } AudioWidget::~AudioWidget() { - for ( int i = 0; i < 11; i++ ) { + for ( int i = 0; i < 10; i++ ) { delete buttonPixUp[i]; delete buttonPixDown[i]; } delete pixBg; delete imgUp; delete imgDn; delete imgButtonMask; - for ( int i = 0; i < 11; i++ ) { + for ( int i = 0; i < 10; i++ ) { delete masks[i]; } } @@ -259,9 +258,9 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { QPixmap *pixUp = combineImageWithBackground( *imgUp, *pixBg, p ); QPixmap *pixDn = combineImageWithBackground( *imgDn, *pixBg, p ); - for ( int i = 0; i < 11; i++ ) { + for ( int i = 0; i < 10; i++ ) { if ( !masks[i]->isNull() ) { delete buttonPixUp[i]; delete buttonPixDown[i]; buttonPixUp[i] = maskPixToMask( *pixUp, *masks[i] ); @@ -426,9 +425,8 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { toggleButton(i); switch (i) { case AudioVolumeUp: - qDebug("more clicked"); emit moreClicked(); return; case AudioVolumeDown: emit lessClicked(); @@ -451,11 +449,22 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { setToggleButton( i, FALSE ); qDebug("button toggled3 %d",i); } switch (i) { - case AudioPlay: mediaPlayerState->setPlaying(audioButtons[i].isDown); return; + case AudioPlay: + if( mediaPlayerState->isPaused ) { + setToggleButton( i, FALSE ); + mediaPlayerState->setPaused( FALSE ); + return; + } else if( !mediaPlayerState->isPaused ) { + setToggleButton( i, TRUE ); + mediaPlayerState->setPaused( TRUE ); + return; + } else { + // setToggleButton( i, TRUE ); + // mediaPlayerState->setPlaying( videoButtons[i].isDown ); + } case AudioStop: mediaPlayerState->setPlaying(FALSE); return; - case AudioPause: mediaPlayerState->setPaused( audioButtons[i].isDown); return; case AudioNext: mediaPlayerState->setNext(); return; case AudioPrevious: mediaPlayerState->setPrev(); return; case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; case AudioVolumeUp: emit moreReleased(); return; diff --git a/noncore/multimedia/opieplayer2/audiowidget.h b/noncore/multimedia/opieplayer2/audiowidget.h index e05188e..772d1d1 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.h +++ b/noncore/multimedia/opieplayer2/audiowidget.h @@ -132,11 +132,11 @@ private: QPixmap *pixBg; QImage *imgUp; QImage *imgDn; QImage *imgButtonMask; - QBitmap *masks[11]; - QPixmap *buttonPixUp[11]; - QPixmap *buttonPixDown[11]; + QBitmap *masks[10]; + QPixmap *buttonPixUp[10]; + QPixmap *buttonPixDown[10]; QPixmap *pixmaps[4]; Ticker songInfo; QSlider slider; |