-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 @@ -66,30 +66,28 @@ void changeTextColor( QWidget * w) { p.setBrush( QColorGroup::Background, QColor( 167, 212, 167 ) ); p.setBrush( QColorGroup::Base, QColor( 167, 212, 167 ) ); w->setPalette( p ); } } 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; - 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 buttons.push_back( defaultButton ); // volume up buttons.push_back( defaultButton ); // volume down buttons.push_back( toggleButton ); // repeat/loop buttons.push_back( defaultButton ); // playlist buttons.push_back( defaultButton ); // forward buttons.push_back( defaultButton ); // back @@ -380,25 +378,25 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { return; case Back: emit backClicked(); return; } } else if ( !isOnButton && buttons[i].isHeld ) { 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 ); } } } } void AudioWidget::mousePressEvent( QMouseEvent *event ) { mouseMoveEvent( event ); 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 @@ -26,30 +26,31 @@ #include <qwidget.h> #include "mediaplayerstate.h" #include "playlistwidget.h" #include <vector> 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 ); virtual ~MediaWidget(); public slots: virtual void setDisplayType( MediaPlayerState::DisplayType displayType ) = 0; virtual void setLength( long length ) = 0; virtual void setPlaying( bool playing ) = 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 @@ -62,28 +62,26 @@ const int yo = 0; // movable y offset const char * const skinV_mask_file_names[7] = { "play","stop","fwd","back","up","down","full" }; } 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 buttons.push_back( defaultButton ); // volUp buttons.push_back( defaultButton ); // volDown buttons.push_back( toggleButton ); //fullscreen videoFrame = new XineVideoWidget ( this, "Video frame" ); @@ -289,25 +287,25 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { case VideoVolDown: emit lessClicked(); return; } } else if ( !isOnButton && buttons[i].isHeld ) { 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 ); } switch(i) { case VideoPlay: { if( mediaPlayerState.isPaused() ) { setToggleButton( i, FALSE ); mediaPlayerState.setPaused( FALSE ); return; } else if( !mediaPlayerState.isPaused() ) { setToggleButton( i, TRUE ); |