author | simon <simon> | 2002-12-08 22:39:53 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-08 22:39:53 (UTC) |
commit | 8b72df0bb25ca5a0791756b2444fc6a1ce361082 (patch) (unidiff) | |
tree | 19a7b23fe1d5256d461fe988ba82c359d75a8caf /noncore/multimedia/opieplayer2/audiowidget.cpp | |
parent | bada5d6377a428a96527d465903df7fbabc9d337 (diff) | |
download | opie-8b72df0bb25ca5a0791756b2444fc6a1ce361082.zip opie-8b72df0bb25ca5a0791756b2444fc6a1ce361082.tar.gz opie-8b72df0bb25ca5a0791756b2444fc6a1ce361082.tar.bz2 |
- merged xoff/yoff into a QPointe member variable, shared 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 | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 022aa82..4301a67 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -206,27 +206,27 @@ QPixmap *maskPixToMask( QPixmap pix, QBitmap mask ) { | |||
206 | }; | 206 | }; |
207 | 207 | ||
208 | void AudioWidget::resizeEvent( QResizeEvent * ) { | 208 | void AudioWidget::resizeEvent( QResizeEvent * ) { |
209 | int h = height(); | 209 | int h = height(); |
210 | int w = width(); | 210 | int w = width(); |
211 | 211 | ||
212 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); | 212 | songInfo.setGeometry( QRect( 2, 2, w - 4, 20 ) ); |
213 | slider.setFixedWidth( w - 110 ); | 213 | slider.setFixedWidth( w - 110 ); |
214 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); | 214 | slider.setGeometry( QRect( 15, h - 22, w - 90, 20 ) ); |
215 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); | 215 | slider.setBackgroundOrigin( QWidget::ParentOrigin ); |
216 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); | 216 | time.setGeometry( QRect( w - 85, h - 30, 70, 20 ) ); |
217 | 217 | ||
218 | xoff = ( w - imgUp.width() ) / 2; | 218 | upperLeftOfButtonMask.rx() = ( w - imgUp.width() ) / 2; |
219 | yoff = (( h - imgUp.height() ) / 2) - 10; | 219 | upperLeftOfButtonMask.ry() = (( h - imgUp.height() ) / 2) - 10; |
220 | QPoint p( xoff, yoff ); | 220 | QPoint p = upperLeftOfButtonMask; |
221 | 221 | ||
222 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); | 222 | QPixmap pixUp = combineImageWithBackground( imgUp, pixBg, p ); |
223 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); | 223 | QPixmap pixDn = combineImageWithBackground( imgDn, pixBg, p ); |
224 | 224 | ||
225 | for ( int i = 0; i < 10; i++ ) { | 225 | for ( int i = 0; i < 10; i++ ) { |
226 | if ( !masks[i]->isNull() ) { | 226 | if ( !masks[i]->isNull() ) { |
227 | delete buttonPixUp[i]; | 227 | delete buttonPixUp[i]; |
228 | delete buttonPixDown[i]; | 228 | delete buttonPixDown[i]; |
229 | buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] ); | 229 | buttonPixUp[i] = maskPixToMask( pixUp, *masks[i] ); |
230 | buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] ); | 230 | buttonPixDown[i] = maskPixToMask( pixDn, *masks[i] ); |
231 | } | 231 | } |
232 | } | 232 | } |
@@ -333,27 +333,27 @@ void AudioWidget::setToggleButton( int i, bool down ) { | |||
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | void AudioWidget::toggleButton( int i ) { | 336 | void AudioWidget::toggleButton( int i ) { |
337 | buttons[i].isDown = !buttons[i].isDown; | 337 | buttons[i].isDown = !buttons[i].isDown; |
338 | QPainter p(this); | 338 | QPainter p(this); |
339 | paintButton ( &p, i ); | 339 | paintButton ( &p, i ); |
340 | } | 340 | } |
341 | 341 | ||
342 | 342 | ||
343 | void AudioWidget::paintButton( QPainter *p, int i ) { | 343 | void AudioWidget::paintButton( QPainter *p, int i ) { |
344 | if ( buttons[i].isDown ) { | 344 | if ( buttons[i].isDown ) { |
345 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 345 | p->drawPixmap( upperLeftOfButtonMask, *buttonPixDown[i] ); |
346 | } else { | 346 | } else { |
347 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 347 | p->drawPixmap( upperLeftOfButtonMask, *buttonPixUp[i] ); |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | 351 | ||
352 | void AudioWidget::skipFor() { | 352 | void AudioWidget::skipFor() { |
353 | skipDirection = +1; | 353 | skipDirection = +1; |
354 | startTimer( 50 ); | 354 | startTimer( 50 ); |
355 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 355 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
356 | } | 356 | } |
357 | 357 | ||
358 | void AudioWidget::skipBack() { | 358 | void AudioWidget::skipBack() { |
359 | skipDirection = -1; | 359 | skipDirection = -1; |
@@ -372,26 +372,26 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
372 | if ( skipDirection == +1 ) { | 372 | if ( skipDirection == +1 ) { |
373 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 373 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
374 | } else if ( skipDirection == -1 ) { | 374 | } else if ( skipDirection == -1 ) { |
375 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); | 375 | mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); |
376 | } | 376 | } |
377 | } | 377 | } |
378 | 378 | ||
379 | 379 | ||
380 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 380 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
381 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { | 381 | for ( unsigned int i = 0; i < buttons.size(); i++ ) { |
382 | if ( event->state() == QMouseEvent::LeftButton ) { | 382 | if ( event->state() == QMouseEvent::LeftButton ) { |
383 | // The test to see if the mouse click is inside the button or not | 383 | // The test to see if the mouse click is inside the button or not |
384 | int x = event->pos().x() - xoff; | 384 | int x = event->pos().x() - upperLeftOfButtonMask.x(); |
385 | int y = event->pos().y() - yoff; | 385 | int y = event->pos().y() - upperLeftOfButtonMask.y(); |
386 | 386 | ||
387 | bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width() | 387 | bool isOnButton = ( x > 0 && y > 0 && x < buttonMask.width() |
388 | && y < buttonMask.height() | 388 | && y < buttonMask.height() |
389 | && buttonMask.pixelIndex( x, y ) == i + 1 ); | 389 | && buttonMask.pixelIndex( x, y ) == i + 1 ); |
390 | 390 | ||
391 | if ( isOnButton && !buttons[i].isHeld ) { | 391 | if ( isOnButton && !buttons[i].isHeld ) { |
392 | buttons[i].isHeld = TRUE; | 392 | buttons[i].isHeld = TRUE; |
393 | toggleButton(i); | 393 | toggleButton(i); |
394 | switch (i) { | 394 | switch (i) { |
395 | case VolumeUp: | 395 | case VolumeUp: |
396 | emit moreClicked(); | 396 | emit moreClicked(); |
397 | return; | 397 | return; |