author | simon <simon> | 2002-12-09 13:52:00 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 13:52:00 (UTC) |
commit | 46bca195f0dacc3b596eb1537ae47bc2117ce8e4 (patch) (side-by-side diff) | |
tree | 135414127395da9466d77ef71fa85bd41b130bf0 | |
parent | 374d7ba11f669449900c7e93f7929d724eb85f26 (diff) | |
download | opie-46bca195f0dacc3b596eb1537ae47bc2117ce8e4.zip opie-46bca195f0dacc3b596eb1537ae47bc2117ce8e4.tar.gz opie-46bca195f0dacc3b596eb1537ae47bc2117ce8e4.tar.bz2 |
- isToggle is now an enum ButtonType { NormalButton, ToggleButton };
-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 @@ -72,18 +72,16 @@ void changeTextColor( QWidget * w) { AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name) : 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 buttons.push_back( defaultButton ); // next buttons.push_back( defaultButton ); // previous @@ -386,13 +384,13 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { buttons[i].isHeld = FALSE; toggleButton(i); } } 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 @@ -32,18 +32,19 @@ 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; MediaWidget( PlayListWidget &_playList, MediaPlayerState &_mediaPlayerState, QWidget *parent = 0, const char *name = 0 ); 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 @@ -68,16 +68,14 @@ const char * const skinV_mask_file_names[7] = { VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlayerState, QWidget* parent, const char* name ) : MediaWidget( playList, mediaPlayerState, parent, name ), scaledWidth( 0 ), scaledHeight( 0 ) { 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 buttons.push_back( defaultButton ); // next buttons.push_back( defaultButton ); // previous @@ -295,13 +293,13 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { toggleButton(i); } } else { if ( buttons[i].isHeld ) { buttons[i].isHeld = FALSE; - if ( !buttons[i].isToggle ) { + if ( buttons[i].buttonType != ToggleButton ) { setToggleButton( i, FALSE ); } switch(i) { case VideoPlay: { |