summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-09 16:33:52 (UTC)
committer simon <simon>2002-12-09 16:33:52 (UTC)
commit1ae041fba55e218a2523de441bec6ec3a1eecf02 (patch) (unidiff)
treee12caa0db284f3237f52c91bbcd9578c5dcce8a7
parent8eb71085cec5e24e20b441ceae9e5e66448405b3 (diff)
downloadopie-1ae041fba55e218a2523de441bec6ec3a1eecf02.zip
opie-1ae041fba55e218a2523de441bec6ec3a1eecf02.tar.gz
opie-1ae041fba55e218a2523de441bec6ec3a1eecf02.tar.bz2
- more cleanups in the mouse event handler
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp5
2 files changed, 4 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp
index 3838e2c..37c565b 100644
--- a/noncore/multimedia/opieplayer2/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer2/audiowidget.cpp
@@ -322,35 +322,34 @@ void AudioWidget::skipBack() {
322 322
323void AudioWidget::stopSkip() { 323void AudioWidget::stopSkip() {
324 killTimers(); 324 killTimers();
325} 325}
326 326
327 327
328void AudioWidget::timerEvent( QTimerEvent * ) { 328void AudioWidget::timerEvent( QTimerEvent * ) {
329 if ( skipDirection == +1 ) { 329 if ( skipDirection == +1 ) {
330 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); 330 mediaPlayerState.setPosition( mediaPlayerState.position() + 2 );
331 } else if ( skipDirection == -1 ) { 331 } else if ( skipDirection == -1 ) {
332 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 ); 332 mediaPlayerState.setPosition( mediaPlayerState.position() - 2 );
333 } 333 }
334} 334}
335 335
336 336
337void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { 337void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
338 for ( unsigned int i = 0; i < buttons.size(); i++ ) { 338 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
339 339 Button &button = *it;
340 Button &button = buttons[ i ];
341 Command command = button.command; 340 Command command = button.command;
342 341
343 if ( event->state() == QMouseEvent::LeftButton ) { 342 if ( event->state() == QMouseEvent::LeftButton ) {
344 // The test to see if the mouse click is inside the button or not 343 // The test to see if the mouse click is inside the button or not
345 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, command ); 344 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, command );
346 345
347 if ( isOnButton && !button.isHeld ) { 346 if ( isOnButton && !button.isHeld ) {
348 button.isHeld = TRUE; 347 button.isHeld = TRUE;
349 toggleButton( button ); 348 toggleButton( button );
350 switch ( command ) { 349 switch ( command ) {
351 case VolumeUp: 350 case VolumeUp:
352 emit moreClicked(); 351 emit moreClicked();
353 return; 352 return;
354 case VolumeDown: 353 case VolumeDown:
355 emit lessClicked(); 354 emit lessClicked();
356 return; 355 return;
@@ -359,33 +358,32 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) {
359 return; 358 return;
360 case Back: 359 case Back:
361 emit backClicked(); 360 emit backClicked();
362 return; 361 return;
363 default: break; 362 default: break;
364 } 363 }
365 } else if ( !isOnButton && button.isHeld ) { 364 } else if ( !isOnButton && button.isHeld ) {
366 button.isHeld = FALSE; 365 button.isHeld = FALSE;
367 toggleButton( button ); 366 toggleButton( button );
368 } 367 }
369 } else { 368 } else {
370 if ( button.isHeld ) { 369 if ( button.isHeld ) {
371 button.isHeld = FALSE; 370 button.isHeld = FALSE;
372 if ( button.type != ToggleButton ) { 371 if ( button.type != ToggleButton ) {
373 setToggleButton( button, FALSE ); 372 setToggleButton( button, FALSE );
374 } 373 }
375 qDebug("mouseEvent %d", i);
376 handleCommand( command, button.isDown ); 374 handleCommand( command, button.isDown );
377 } 375 }
378 } 376 }
379 } 377 }
380} 378}
381 379
382 380
383void AudioWidget::mousePressEvent( QMouseEvent *event ) { 381void AudioWidget::mousePressEvent( QMouseEvent *event ) {
384 mouseMoveEvent( event ); 382 mouseMoveEvent( event );
385} 383}
386 384
387 385
388void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { 386void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) {
389 mouseMoveEvent( event ); 387 mouseMoveEvent( event );
390} 388}
391 389
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index 06f6cd2..12316f8 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -231,35 +231,34 @@ void VideoWidget::updateSlider( long i, long max ) {
231 if ( max == 0 ) { 231 if ( max == 0 ) {
232 return; 232 return;
233 } 233 }
234 int width = slider->width(); 234 int width = slider->width();
235 int val = int((double)i * width / max); 235 int val = int((double)i * width / max);
236 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) { 236 if ( !mediaPlayerState.isFullscreen() && !videoSliderBeingMoved ) {
237 if ( slider->value() != val ) { 237 if ( slider->value() != val ) {
238 slider->setValue( val ); 238 slider->setValue( val );
239 } 239 }
240 if ( slider->maxValue() != width ) { 240 if ( slider->maxValue() != width ) {
241 slider->setMaxValue( width ); 241 slider->setMaxValue( width );
242 } 242 }
243 } 243 }
244} 244}
245 245
246void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 246void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
247 for ( unsigned int i = 0; i < buttons.size(); i++ ) { 247 for ( ButtonVector::iterator it = buttons.begin(); it != buttons.end(); ++it ) {
248 248 Button &button = *it;
249 Button &button = buttons[ i ];
250 Command command = button.command; 249 Command command = button.command;
251 250
252 if ( event->state() == QMouseEvent::LeftButton ) { 251 if ( event->state() == QMouseEvent::LeftButton ) {
253 // The test to see if the mouse click is inside the button or not 252 // The test to see if the mouse click is inside the button or not
254 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, command ); 253 bool isOnButton = isOverButton( event->pos() - upperLeftOfButtonMask, command );
255 254
256 if ( isOnButton && !button.isHeld ) { 255 if ( isOnButton && !button.isHeld ) {
257 button.isHeld = TRUE; 256 button.isHeld = TRUE;
258 toggleButton( button ); 257 toggleButton( button );
259 258
260 switch ( command ) { 259 switch ( command ) {
261 case VolumeUp: 260 case VolumeUp:
262 emit moreClicked(); 261 emit moreClicked();
263 return; 262 return;
264 case VolumeDown: 263 case VolumeDown:
265 emit lessClicked(); 264 emit lessClicked();