-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 7 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 16 |
4 files changed, 19 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 714509e..c3e206c 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -105,4 +105,5 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye for ( uint i = 0; i < buttonCount; i++ ) { Button button; + button.command = skinInfo[ i ].command; button.type = skinInfo[ i ].type; @@ -121,5 +122,5 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye } - buttons.insert( i, button ); + buttons.push_back( button ); } @@ -209,5 +210,5 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { QPixmap pixDn = combineImageWithBackground( imgDn, backgroundPixmap, p ); - for ( uint i = 0; i < buttons.count(); i++ ) { + for ( uint i = 0; i < buttons.size(); i++ ) { if ( !buttons[i].mask.isNull() ) { buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); @@ -335,5 +336,5 @@ void AudioWidget::timerEvent( QTimerEvent * ) { void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { - for ( unsigned int i = 0; i < buttons.count(); i++ ) { + for ( unsigned int i = 0; i < buttons.size(); i++ ) { Button &button = buttons[ i ]; diff --git a/noncore/multimedia/opieplayer2/mediawidget.cpp b/noncore/multimedia/opieplayer2/mediawidget.cpp index 66129c9..7891a7e 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.cpp +++ b/noncore/multimedia/opieplayer2/mediawidget.cpp @@ -83,4 +83,5 @@ void MediaWidget::handleCommand( Command command, bool buttonDown ) case Forward: emit forwardReleased(); return; case Back: emit backReleased(); return; + default: assert( false ); } } @@ -96,5 +97,5 @@ bool MediaWidget::isOverButton( const QPoint &position, int buttonId ) const void MediaWidget::paintAllButtons( QPainter &p ) { - for ( ButtonMap::ConstIterator it = buttons.begin(); + for ( ButtonVector::const_iterator it = buttons.begin(); it != buttons.end(); ++it ) paintButton( p, *it ); diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 05b7b71..efba6f3 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -36,10 +36,12 @@ class MediaWidget : public QWidget Q_OBJECT public: - enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back }; + enum Command { Play = 0, Stop, Next, Previous, VolumeUp, VolumeDown, Loop, PlayList, Forward, Back, Undefined }; enum ButtonType { NormalButton, ToggleButton }; struct Button { - Button() : type( NormalButton ), isHeld( false ), isDown( false ) {} + Button() : command( Undefined ), type( NormalButton ), isHeld( false ), isDown( false ) {} + + Command command; ButtonType type : 1; @@ -52,6 +54,4 @@ public: }; typedef std::vector<Button> ButtonVector; - // when the transition is done this should be Command -> Button - typedef QMap<int, Button> ButtonMap; struct SkinButtonInfo @@ -98,5 +98,5 @@ protected: PlayListWidget &playList; - ButtonMap buttons; + ButtonVector buttons; QImage buttonMask; diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 9782b68..f59772e 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -75,11 +75,11 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye toggleButton.type = ToggleButton; - buttons.insert( 0, toggleButton ); // play - buttons.insert( 1, toggleButton ); // stop - buttons.insert( 2, toggleButton ); // next - buttons.insert( 3, toggleButton ); // previous - buttons.insert( 4, toggleButton ); // volUp - buttons.insert( 5, toggleButton ); // volDown - buttons.insert( 6, toggleButton ); // fullscreen + buttons.push_back( toggleButton ); // play + buttons.push_back( toggleButton ); // stop + buttons.push_back( toggleButton ); // next + buttons.push_back( toggleButton ); // previous + buttons.push_back( toggleButton ); // volUp + buttons.push_back( toggleButton ); // volDown + buttons.push_back( toggleButton ); // fullscreen videoFrame = new XineVideoWidget ( this, "Video frame" ); @@ -244,5 +244,5 @@ void VideoWidget::updateSlider( long i, long max ) { void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { - for ( unsigned int i = 0; i < buttons.count(); i++ ) { + for ( unsigned int i = 0; i < buttons.size(); i++ ) { Button &button = buttons[ i ]; |