author | simon <simon> | 2002-12-09 14:48:13 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 14:48:13 (UTC) |
commit | 9ab8a657b23fd1871c4a376fdd097732c14392e0 (patch) (side-by-side diff) | |
tree | 5e507bf74fad84ae6da1ed1facc689fd89de167d | |
parent | 174c4a427750a3829ffd81a87454be8abf61ee30 (diff) | |
download | opie-9ab8a657b23fd1871c4a376fdd097732c14392e0.zip opie-9ab8a657b23fd1871c4a376fdd097732c14392e0.tar.gz opie-9ab8a657b23fd1871c4a376fdd097732c14392e0.tar.bz2 |
- migrating from a button vector to a button map
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediawidget.h | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 21 |
3 files changed, 18 insertions, 17 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index c148820..12f91a9 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -121,5 +121,5 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye } - buttons.push_back( button ); + buttons.insert( i, button ); } @@ -209,5 +209,5 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); - for ( uint i = 0; i < buttons.size(); i++ ) { + for ( uint i = 0; i < buttons.count(); i++ ) { if ( !buttons[i].mask.isNull() ) { buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); @@ -352,5 +352,5 @@ void AudioWidget::timerEvent( QTimerEvent * ) { void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { - for ( unsigned int i = 0; i < buttons.size(); i++ ) { + for ( unsigned int i = 0; i < buttons.count(); i++ ) { if ( event->state() == QMouseEvent::LeftButton ) { // The test to see if the mouse click is inside the button or not @@ -415,5 +415,5 @@ void AudioWidget::paintEvent( QPaintEvent * pe ) { p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); - for ( unsigned int i = 0; i < buttons.size(); i++ ) + for ( unsigned int i = 0; i < buttons.count(); i++ ) paintButton( p, i ); QPainter p2( this ); @@ -421,5 +421,5 @@ void AudioWidget::paintEvent( QPaintEvent * pe ) { } else { QPainter p( this ); - for ( unsigned int i = 0; i < buttons.size(); i++ ) + for ( unsigned int i = 0; i < buttons.count(); i++ ) paintButton( p, i ); } diff --git a/noncore/multimedia/opieplayer2/mediawidget.h b/noncore/multimedia/opieplayer2/mediawidget.h index 504b705..49bf024 100644 --- a/noncore/multimedia/opieplayer2/mediawidget.h +++ b/noncore/multimedia/opieplayer2/mediawidget.h @@ -52,4 +52,6 @@ public: }; typedef std::vector<Button> ButtonVector; + // when the transition is done this should be Command -> Button + typedef QMap<int, Button> ButtonMap; struct SkinButtonInfo @@ -92,5 +94,5 @@ protected: PlayListWidget &playList; - ButtonVector buttons; + ButtonMap buttons; QImage buttonMask; diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index 380c703..7d85d63 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp @@ -75,12 +75,11 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye toggleButton.type = 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 + 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 videoFrame = new XineVideoWidget ( this, "Video frame" ); @@ -272,5 +271,5 @@ void VideoWidget::paintButton( QPainter &p, int i ) { void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { - for ( unsigned int i = 0; i < buttons.size(); i++ ) { + for ( unsigned int i = 0; i < buttons.count(); i++ ) { if ( event->state() == QMouseEvent::LeftButton ) { // The test to see if the mouse click is inside the button or not @@ -414,5 +413,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); - for ( unsigned int i = 0; i < buttons.size(); i++ ) { + for ( unsigned int i = 0; i < buttons.count(); i++ ) { paintButton( p, i ); } @@ -421,5 +420,5 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { } else { QPainter p( this ); - for ( unsigned int i = 0; i < buttons.size(); i++ ) + for ( unsigned int i = 0; i < buttons.count(); i++ ) paintButton( p, i ); } |