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 @@ -62,38 +62,36 @@ const char * const skin_mask_file_names[10] = { }; void changeTextColor( QWidget * w) { QPalette p = w->palette(); 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 setCaption( tr("OpiePlayer") ); Config cfg("OpiePlayer"); @@ -376,33 +374,33 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { emit lessClicked(); return; case Forward: emit forwardClicked(); 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 ); } void AudioWidget::mouseReleaseEvent( QMouseEvent *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 @@ -22,38 +22,39 @@ #ifndef MEDIAWIDGET_H #define MEDIAWIDGET_H #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; signals: void moreReleased(); void lessReleased(); 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 @@ -58,36 +58,34 @@ namespace const int xo = 2; // movable x offset 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" ); connect ( videoFrame, SIGNAL( videoResized ( const QSize & )), this, SIGNAL( videoResized ( const QSize & ))); connect ( videoFrame, SIGNAL( clicked () ), this, SLOT ( backToNormal() ) ); Config cfg("OpiePlayer"); @@ -285,33 +283,33 @@ void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { switch (i) { case VideoVolUp: emit moreClicked(); return; 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 ); mediaPlayerState.setPaused( TRUE ); return; } else { return; |