author | simon <simon> | 2002-12-09 15:49:37 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-09 15:49:37 (UTC) |
commit | 743155915f659d701ad468eadcc2b2173b6e2770 (patch) (unidiff) | |
tree | e95ff8ac9e8781865214e92e8a7e84bbdd04b645 /noncore/multimedia/opieplayer2/audiowidget.cpp | |
parent | aa766a6a0818ed0b756f8cd67fc4a1c85906f224 (diff) | |
download | opie-743155915f659d701ad468eadcc2b2173b6e2770.zip opie-743155915f659d701ad468eadcc2b2173b6e2770.tar.gz opie-743155915f659d701ad468eadcc2b2173b6e2770.tar.bz2 |
- less indexing in the mouse event handler
Diffstat (limited to 'noncore/multimedia/opieplayer2/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index ef606ab..714509e 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -335,13 +335,16 @@ void AudioWidget::timerEvent( QTimerEvent * ) { | |||
335 | 335 | ||
336 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 336 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
337 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { | 337 | for ( unsigned int i = 0; i < buttons.count(); i++ ) { |
338 | |||
339 | Button &button = buttons[ i ]; | ||
340 | |||
338 | if ( event->state() == QMouseEvent::LeftButton ) { | 341 | if ( event->state() == QMouseEvent::LeftButton ) { |
339 | // The test to see if the mouse click is inside the button or not | 342 | // The test to see if the mouse click is inside the button or not |
340 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); | 343 | bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, i ); |
341 | 344 | ||
342 | if ( isOnButton && !buttons[i].isHeld ) { | 345 | if ( isOnButton && !button.isHeld ) { |
343 | buttons[i].isHeld = TRUE; | 346 | button.isHeld = TRUE; |
344 | toggleButton( buttons[ i ] ); | 347 | toggleButton( button ); |
345 | switch (i) { | 348 | switch (i) { |
346 | case VolumeUp: | 349 | case VolumeUp: |
347 | emit moreClicked(); | 350 | emit moreClicked(); |
@@ -356,18 +359,18 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
356 | emit backClicked(); | 359 | emit backClicked(); |
357 | return; | 360 | return; |
358 | } | 361 | } |
359 | } else if ( !isOnButton && buttons[i].isHeld ) { | 362 | } else if ( !isOnButton && button.isHeld ) { |
360 | buttons[i].isHeld = FALSE; | 363 | button.isHeld = FALSE; |
361 | toggleButton( buttons[ i ] ); | 364 | toggleButton( button ); |
362 | } | 365 | } |
363 | } else { | 366 | } else { |
364 | if ( buttons[i].isHeld ) { | 367 | if ( button.isHeld ) { |
365 | buttons[i].isHeld = FALSE; | 368 | button.isHeld = FALSE; |
366 | if ( buttons[i].type != ToggleButton ) { | 369 | if ( button.type != ToggleButton ) { |
367 | setToggleButton( buttons[ i ], FALSE ); | 370 | setToggleButton( button, FALSE ); |
368 | } | 371 | } |
369 | qDebug("mouseEvent %d", i); | 372 | qDebug("mouseEvent %d", i); |
370 | handleCommand( static_cast<Command>( i ), buttons[ i ].isDown ); | 373 | handleCommand( static_cast<Command>( i ), button.isDown ); |
371 | } | 374 | } |
372 | } | 375 | } |
373 | } | 376 | } |