author | simon <simon> | 2002-12-08 22:20:24 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-08 22:20:24 (UTC) |
commit | 00252c667bf6c6af3f2a1d2519bf23e448e8f174 (patch) (side-by-side diff) | |
tree | 4ecb004aa67d993561178b33cad2a6f0a9e85049 /noncore/multimedia/opieplayer2/audiowidget.cpp | |
parent | 695398075ec5e4d01f29c40c00538ee8c60404d2 (diff) | |
download | opie-00252c667bf6c6af3f2a1d2519bf23e448e8f174.zip opie-00252c667bf6c6af3f2a1d2519bf23e448e8f174.tar.gz opie-00252c667bf6c6af3f2a1d2519bf23e448e8f174.tar.bz2 |
- share the buttons data in a buttons member variable in the base class
Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 7fb3781..a9d5a88 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp @@ -81,15 +81,15 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye toggleButton.isHeld = toggleButton.isDown = false; - audioButtons.reserve( 10 ); - audioButtons.push_back( toggleButton ); // play - audioButtons.push_back( defaultButton ); // stop - audioButtons.push_back( defaultButton ); // next - audioButtons.push_back( defaultButton ); // previous - audioButtons.push_back( defaultButton ); // volume up - audioButtons.push_back( defaultButton ); // volume down - audioButtons.push_back( toggleButton ); // repeat/loop - audioButtons.push_back( defaultButton ); // playlist - audioButtons.push_back( defaultButton ); // forward - audioButtons.push_back( defaultButton ); // back + 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") ); @@ -328,5 +328,5 @@ void AudioWidget::updateSlider( long i, long max ) { void AudioWidget::setToggleButton( int i, bool down ) { qDebug("setToggleButton %d", i); - if ( down != audioButtons[i].isDown ) { + if ( down != buttons[i].isDown ) { toggleButton( i ); } @@ -335,5 +335,5 @@ void AudioWidget::setToggleButton( int i, bool down ) { void AudioWidget::toggleButton( int i ) { - audioButtons[i].isDown = !audioButtons[i].isDown; + buttons[i].isDown = !buttons[i].isDown; QPainter p(this); paintButton ( &p, i ); @@ -342,5 +342,5 @@ void AudioWidget::toggleButton( int i ) { void AudioWidget::paintButton( QPainter *p, int i ) { - if ( audioButtons[i].isDown ) { + if ( buttons[i].isDown ) { p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); } else { @@ -379,5 +379,5 @@ void AudioWidget::timerEvent( QTimerEvent * ) { void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { - for ( unsigned int i = 0; i < audioButtons.size(); i++ ) { + for ( unsigned int i = 0; i < buttons.size(); i++ ) { if ( event->state() == QMouseEvent::LeftButton ) { // The test to see if the mouse click is inside the button or not @@ -389,6 +389,6 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { && imgButtonMask.pixelIndex( x, y ) == i + 1 ); - if ( isOnButton && !audioButtons[i].isHeld ) { - audioButtons[i].isHeld = TRUE; + if ( isOnButton && !buttons[i].isHeld ) { + buttons[i].isHeld = TRUE; toggleButton(i); switch (i) { @@ -406,16 +406,16 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { return; } - } else if ( !isOnButton && audioButtons[i].isHeld ) { - audioButtons[i].isHeld = FALSE; + } else if ( !isOnButton && buttons[i].isHeld ) { + buttons[i].isHeld = FALSE; toggleButton(i); } } else { - if ( audioButtons[i].isHeld ) { - audioButtons[i].isHeld = FALSE; - if ( !audioButtons[i].isToggle ) { + if ( buttons[i].isHeld ) { + buttons[i].isHeld = FALSE; + if ( !buttons[i].isToggle ) { setToggleButton( i, FALSE ); } qDebug("mouseEvent %d", i); - handleCommand( static_cast<Command>( i ), audioButtons[ i ].isDown ); + handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); } } @@ -447,5 +447,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 < audioButtons.size(); i++ ) + for ( unsigned int i = 0; i < buttons.size(); i++ ) paintButton( &p, i ); QPainter p2( this ); @@ -453,5 +453,5 @@ void AudioWidget::paintEvent( QPaintEvent * pe ) { } else { QPainter p( this ); - for ( unsigned int i = 0; i < audioButtons.size(); i++ ) + for ( unsigned int i = 0; i < buttons.size(); i++ ) paintButton( &p, i ); } |