-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 8 |
3 files changed, 10 insertions, 13 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 8659971..56b75f2 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -74,14 +74,12 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye MediaWidget( playList, mediaPlayerState, parent, name ), songInfo( this ), slider( Qt::Horizontal, this ), time( this ), audioSliderBeingMoved( false ) { + Button defaultButton; - Button defaultButton; - defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; - Button toggleButton; - toggleButton.isToggle = true; - toggleButton.isHeld = toggleButton.isDown = false; + Button toggleButton = defaultButton; + toggleButton.buttonType = ToggleButton; buttons.reserve( 10 ); buttons.push_back( toggleButton ); // play buttons.push_back( defaultButton ); // stop @@ -388,9 +386,9 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { } } else { if ( buttons[i].isHeld ) { buttons[i].isHeld = FALSE; - if ( !buttons[i].isToggle ) { + if ( buttons[i].buttonType != ToggleButton ) { setToggleButton( i, FALSE ); } qDebug("mouseEvent %d", i); handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 46c304d..aa8891f 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -34,14 +34,15 @@ class MediaWidget : public QWidget { Q_OBJECT public: enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; + enum ButtonType { NormalButton, ToggleButton }; struct Button { - Button() : isToggle( false ), isHeld( false ), isDown( false ) {} + Button() : buttonType( NormalButton ), isHeld( false ), isDown( false ) {} - bool isToggle : 1; + ButtonType buttonType : 1; bool isHeld : 1; bool isDown : 1; }; typedef std::vector<Button> ButtonVector; diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 2f51c82..23acfa3 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -70,12 +70,10 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye { setCaption( tr("OpiePlayer - Video") ); Button defaultButton; - defaultButton.isToggle = defaultButton.isHeld = defaultButton.isDown = false; - Button toggleButton; - toggleButton.isToggle = true; - toggleButton.isHeld = toggleButton.isDown = false; + Button toggleButton = defaultButton; + toggleButton.buttonType = ToggleButton; buttons.reserve( 7 ); buttons.push_back( toggleButton ); // play buttons.push_back( defaultButton ); // stop @@ -297,9 +295,9 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { } else { if ( buttons[i].isHeld ) { buttons[i].isHeld = FALSE; - if ( !buttons[i].isToggle ) { + if ( buttons[i].buttonType != ToggleButton ) { setToggleButton( i, FALSE ); } switch(i) { |