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 @@ -120,7 +120,7 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye } } - buttons.push_back( button ); + buttons.insert( i, button ); } setBackgroundPixmap( pixBg ); @@ -208,7 +208,7 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); 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 ); buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); @@ -351,7 +351,7 @@ 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 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); @@ -414,13 +414,13 @@ void AudioWidget::paintEvent( QPaintEvent * pe ) { QPainter p( &pix ); 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 ); p2.drawPixmap( pe->rect().topLeft(), pix ); } 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 @@ -51,6 +51,8 @@ public: QPixmap pixDown; }; typedef std::vector<Button> ButtonVector; + // when the transition is done this should be Command -> Button + typedef QMap<int, Button> ButtonMap; struct SkinButtonInfo { @@ -91,7 +93,7 @@ protected: MediaPlayerState &mediaPlayerState; 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 @@ -74,14 +74,13 @@ VideoWidget::VideoWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye Button toggleButton = defaultButton; 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" ); @@ -271,7 +270,7 @@ 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 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); @@ -413,14 +412,14 @@ void VideoWidget::paintEvent( QPaintEvent * pe) { QPainter p( &pix ); 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 ); p2.drawPixmap( pe->rect().topLeft(), pix ); } 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 ); } //slider->repaint( TRUE ); |