author | simon <simon> | 2002-12-09 14:48:13 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 14:48:13 (UTC) |
commit | 9ab8a657b23fd1871c4a376fdd097732c14392e0 (patch) (unidiff) | |
tree | 5e507bf74fad84ae6da1ed1facc689fd89de167d /noncore/multimedia/opieplayer2/audiowidget.cpp | |
parent | 174c4a427750a3829ffd81a87454be8abf61ee30 (diff) | |
download | opie-9ab8a657b23fd1871c4a376fdd097732c14392e0.zip opie-9ab8a657b23fd1871c4a376fdd097732c14392e0.tar.gz opie-9ab8a657b23fd1871c4a376fdd097732c14392e0.tar.bz2 |
- migrating from a button vector to a button map
Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 10 |
1 files changed, 5 insertions, 5 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 | |||
@@ -115,17 +115,17 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
115 | for ( int y = 0; y < imgUp.height(); y++ ) { | 115 | for ( int y = 0; y < imgUp.height(); y++ ) { |
116 | uchar *line = dest[y]; | 116 | uchar *line = dest[y]; |
117 | for ( int x = 0; x < imgUp.width(); x++ ) | 117 | for ( int x = 0; x < imgUp.width(); x++ ) |
118 | if ( !qRed( imgMask.pixel( x, y ) ) ) | 118 | if ( !qRed( imgMask.pixel( x, y ) ) ) |
119 | line[x] = i + 1; | 119 | line[x] = i + 1; |
120 | } | 120 | } |
121 | } | 121 | } |
122 | 122 | ||
123 | buttons.push_back( button ); | 123 | buttons.insert( i, button ); |
124 | } | 124 | } |
125 | 125 | ||
126 | setBackgroundPixmap( pixBg ); | 126 | setBackgroundPixmap( pixBg ); |
127 | 127 | ||
128 | songInfo.setFocusPolicy( QWidget::NoFocus ); | 128 | songInfo.setFocusPolicy( QWidget::NoFocus ); |
129 | // changeTextColor( &songInfo ); | 129 | // changeTextColor( &songInfo ); |
130 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); | 130 | // songInfo.setBackgroundColor( QColor( 167, 212, 167 )); |
131 | // songInfo.setFrameStyle( QFrame::NoFrame); | 131 | // songInfo.setFrameStyle( QFrame::NoFrame); |
@@ -203,17 +203,17 @@ void AudioWidget::resizeEvent( QResizeEvent * ) { | |||
203 | 203 | ||
204 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; | 204 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; |
205 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; | 205 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; |
206 | QPoint p = upperLeftOfButtonMask; | 206 | QPoint p = upperLeftOfButtonMask; |
207 | 207 | ||
208 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); | 208 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); |
209 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); | 209 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); |
210 | 210 | ||
211 | for ( uint i = 0; i < buttons.size(); i++ ) { | 211 | for ( uint i = 0; i < buttons.count(); i++ ) { |
212 | if ( !buttons[i].mask.isNull() ) { | 212 | if ( !buttons[i].mask.isNull() ) { |
213 | buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); | 213 | buttons[i].pixUp = maskPixToMask( pixUp, buttons[i].mask ); |
214 | buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); | 214 | buttons[i].pixDown = maskPixToMask( pixDn, buttons[i].mask ); |
215 | } | 215 | } |
216 | } | 216 | } |
217 | } | 217 | } |
218 | 218 | ||
219 | void AudioWidget::sliderPressed() { | 219 | void AudioWidget::sliderPressed() { |
@@ -346,17 +346,17 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
346 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 346 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
347 | } else if ( skipDirection == -1 ) { | 347 | } else if ( skipDirection == -1 ) { |
348 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 348 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
349 | } | 349 | } |
350 | } | 350 | } |
351 | 351 | ||
352 | 352 | ||
353 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 353 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
354 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { | 354 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
355 | if ( event->state() == QMouseEvent::LeftButton ) { | 355 | if ( event->state() == QMouseEvent::LeftButton ) { |
356 | // The test to see if the mouse click is inside the button or not | 356 | // The test to see if the mouse click is inside the button or not |
357 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 357 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
358 | 358 | ||
359 | if ( isOnButton && !buttons[i].isHeld ) { | 359 | if ( isOnButton && !buttons[i].isHeld ) { |
360 | buttons[i].isHeld = TRUE; | 360 | buttons[i].isHeld = TRUE; |
361 | toggleButton(i); | 361 | toggleButton(i); |
362 | switch (i) { | 362 | switch (i) { |
@@ -409,23 +409,23 @@ void AudioWidget::showEvent( QShowEvent* ) { | |||
409 | 409 | ||
410 | void AudioWidget::paintEvent( QPaintEvent * pe ) { | 410 | void AudioWidget::paintEvent( QPaintEvent * pe ) { |
411 | if ( !pe->erased() ) { | 411 | if ( !pe->erased() ) { |
412 | // Combine with background and double buffer | 412 | // Combine with background and double buffer |
413 | QPixmap pix( pe->rect().size() ); | 413 | QPixmap pix( pe->rect().size() ); |
414 | QPainter p( &pix ); | 414 | QPainter p( &pix ); |
415 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 415 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
416 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 416 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
417 | for ( unsigned int i = 0; i < buttons.size(); i++ ) | 417 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
418 | paintButton( p, i ); | 418 | paintButton( p, i ); |
419 | QPainter p2( this ); | 419 | QPainter p2( this ); |
420 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 420 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
421 | } else { | 421 | } else { |
422 | QPainter p( this ); | 422 | QPainter p( this ); |
423 | for ( unsigned int i = 0; i < buttons.size(); i++ ) | 423 | for ( unsigned int i = 0; i < buttons.count(); i++ ) |
424 | paintButton( p, i ); | 424 | paintButton( p, i ); |
425 | } | 425 | } |
426 | } | 426 | } |
427 | 427 | ||
428 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | 428 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { |
429 | switch ( e->key() ) { | 429 | switch ( e->key() ) { |
430 | ////////////////////////////// Zaurus keys | 430 | ////////////////////////////// Zaurus keys |
431 | case Key_Home: | 431 | case Key_Home: |