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 | |||
@@ -79,19 +79,19 @@ AudioWidget::AudioWidget( PlayListWidget &playList, MediaPlayerState &mediaPlaye | |||
79 | Button toggleButton; | 79 | Button toggleButton; |
80 | toggleButton.isToggle = true; | 80 | toggleButton.isToggle = true; |
81 | toggleButton.isHeld = toggleButton.isDown = false; | 81 | toggleButton.isHeld = toggleButton.isDown = false; |
82 | 82 | ||
83 | audioButtons.reserve( 10 ); | 83 | buttons.reserve( 10 ); |
84 | audioButtons.push_back( toggleButton ); // play | 84 | buttons.push_back( toggleButton ); // play |
85 | audioButtons.push_back( defaultButton ); // stop | 85 | buttons.push_back( defaultButton ); // stop |
86 | audioButtons.push_back( defaultButton ); // next | 86 | buttons.push_back( defaultButton ); // next |
87 | audioButtons.push_back( defaultButton ); // previous | 87 | buttons.push_back( defaultButton ); // previous |
88 | audioButtons.push_back( defaultButton ); // volume up | 88 | buttons.push_back( defaultButton ); // volume up |
89 | audioButtons.push_back( defaultButton ); // volume down | 89 | buttons.push_back( defaultButton ); // volume down |
90 | audioButtons.push_back( toggleButton ); // repeat/loop | 90 | buttons.push_back( toggleButton ); // repeat/loop |
91 | audioButtons.push_back( defaultButton ); // playlist | 91 | buttons.push_back( defaultButton ); // playlist |
92 | audioButtons.push_back( defaultButton ); // forward | 92 | buttons.push_back( defaultButton ); // forward |
93 | audioButtons.push_back( defaultButton ); // back | 93 | buttons.push_back( defaultButton ); // back |
94 | 94 | ||
95 | setCaption( tr("OpiePlayer") ); | 95 | setCaption( tr("OpiePlayer") ); |
96 | 96 | ||
97 | Config cfg("OpiePlayer"); | 97 | Config cfg("OpiePlayer"); |
@@ -326,23 +326,23 @@ void AudioWidget::updateSlider( long i, long max ) { | |||
326 | 326 | ||
327 | 327 | ||
328 | void AudioWidget::setToggleButton( int i, bool down ) { | 328 | void AudioWidget::setToggleButton( int i, bool down ) { |
329 | qDebug("setToggleButton %d", i); | 329 | qDebug("setToggleButton %d", i); |
330 | if ( down != audioButtons[i].isDown ) { | 330 | if ( down != buttons[i].isDown ) { |
331 | toggleButton( i ); | 331 | toggleButton( i ); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | 334 | ||
335 | 335 | ||
336 | void AudioWidget::toggleButton( int i ) { | 336 | void AudioWidget::toggleButton( int i ) { |
337 | audioButtons[i].isDown = !audioButtons[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 ( audioButtons[i].isDown ) { | 344 | if ( buttons[i].isDown ) { |
345 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 345 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
346 | } else { | 346 | } else { |
347 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 347 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
348 | } | 348 | } |
@@ -377,9 +377,9 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
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 < audioButtons.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() - xoff; |
385 | int y = event->pos().y() - yoff; | 385 | int y = event->pos().y() - yoff; |
@@ -387,10 +387,10 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
387 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() | 387 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask.width() |
388 | && y < imgButtonMask.height() | 388 | && y < imgButtonMask.height() |
389 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); | 389 | && imgButtonMask.pixelIndex( x, y ) == i + 1 ); |
390 | 390 | ||
391 | if ( isOnButton && !audioButtons[i].isHeld ) { | 391 | if ( isOnButton && !buttons[i].isHeld ) { |
392 | audioButtons[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(); |
@@ -404,20 +404,20 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
404 | case Back: | 404 | case Back: |
405 | emit backClicked(); | 405 | emit backClicked(); |
406 | return; | 406 | return; |
407 | } | 407 | } |
408 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 408 | } else if ( !isOnButton && buttons[i].isHeld ) { |
409 | audioButtons[i].isHeld = FALSE; | 409 | buttons[i].isHeld = FALSE; |
410 | toggleButton(i); | 410 | toggleButton(i); |
411 | } | 411 | } |
412 | } else { | 412 | } else { |
413 | if ( audioButtons[i].isHeld ) { | 413 | if ( buttons[i].isHeld ) { |
414 | audioButtons[i].isHeld = FALSE; | 414 | buttons[i].isHeld = FALSE; |
415 | if ( !audioButtons[i].isToggle ) { | 415 | if ( !buttons[i].isToggle ) { |
416 | setToggleButton( i, FALSE ); | 416 | setToggleButton( i, FALSE ); |
417 | } | 417 | } |
418 | qDebug("mouseEvent %d", i); | 418 | qDebug("mouseEvent %d", i); |
419 | handleCommand( static_cast<Command>( i ), audioButtons[ i ].isDown ); | 419 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); |
420 | } | 420 | } |
421 | } | 421 | } |
422 | } | 422 | } |
423 | } | 423 | } |
@@ -445,15 +445,15 @@ void AudioWidget::paintEvent( QPaintEvent * pe ) { | |||
445 | QPixmap pix( pe->rect().size() ); | 445 | QPixmap pix( pe->rect().size() ); |
446 | QPainter p( &pix ); | 446 | QPainter p( &pix ); |
447 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 447 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
448 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); | 448 | p.drawTiledPixmap( pe->rect(), pixBg, pe->rect().topLeft() ); |
449 | for ( unsigned int i = 0; i < audioButtons.size(); i++ ) | 449 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
450 | paintButton( &p, i ); | 450 | paintButton( &p, i ); |
451 | QPainter p2( this ); | 451 | QPainter p2( this ); |
452 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 452 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
453 | } else { | 453 | } else { |
454 | QPainter p( this ); | 454 | QPainter p( this ); |
455 | for ( unsigned int i = 0; i < audioButtons.size(); i++ ) | 455 | for ( unsigned int i = 0; i < buttons.size(); i++ ) |
456 | paintButton( &p, i ); | 456 | paintButton( &p, i ); |
457 | } | 457 | } |
458 | } | 458 | } |
459 | 459 | ||