summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-08-15 16:42:08 (UTC)
committer llornkcor <llornkcor>2002-08-15 16:42:08 (UTC)
commit71520dfe386a04f8bce5d6f5d9d86dcbeda000d2 (patch) (unidiff)
tree78a284abbce1cc1da57b78f39e9e47fe5271cc1c
parent07ea5f165a2f17f818147b2e8afb02af2c269b55 (diff)
downloadopie-71520dfe386a04f8bce5d6f5d9d86dcbeda000d2.zip
opie-71520dfe386a04f8bce5d6f5d9d86dcbeda000d2.tar.gz
opie-71520dfe386a04f8bce5d6f5d9d86dcbeda000d2.tar.bz2
fix rightmouse hold
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/videowidget.cpp8
1 files changed, 1 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp
index fbcd775..f5780aa 100644
--- a/noncore/multimedia/opieplayer2/videowidget.cpp
+++ b/noncore/multimedia/opieplayer2/videowidget.cpp
@@ -289,128 +289,122 @@ void VideoWidget::setToggleButton( int i, bool down ) {
289void VideoWidget::toggleButton( int i ) { 289void VideoWidget::toggleButton( int i ) {
290 videoButtons[i].isDown = !videoButtons[i].isDown; 290 videoButtons[i].isDown = !videoButtons[i].isDown;
291 QPainter p(this); 291 QPainter p(this);
292 paintButton ( &p, i ); 292 paintButton ( &p, i );
293} 293}
294 294
295void VideoWidget::paintButton( QPainter *p, int i ) { 295void VideoWidget::paintButton( QPainter *p, int i ) {
296 296
297 if ( videoButtons[i].isDown ) { 297 if ( videoButtons[i].isDown ) {
298 p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); 298 p->drawPixmap( xoff, yoff, *buttonPixDown[i] );
299 } else { 299 } else {
300 p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); 300 p->drawPixmap( xoff, yoff, *buttonPixUp[i] );
301 } 301 }
302} 302}
303 303
304void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { 304void VideoWidget::mouseMoveEvent( QMouseEvent *event ) {
305 for ( int i = 0; i < numVButtons; i++ ) { 305 for ( int i = 0; i < numVButtons; i++ ) {
306 if ( event->state() == QMouseEvent::LeftButton ) { 306 if ( event->state() == QMouseEvent::LeftButton ) {
307 // The test to see if the mouse click is inside the button or not 307 // The test to see if the mouse click is inside the button or not
308 int x = event->pos().x() - xoff; 308 int x = event->pos().x() - xoff;
309 int y = event->pos().y() - yoff; 309 int y = event->pos().y() - yoff;
310 310
311 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() 311 bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width()
312 && y < imgButtonMask->height() 312 && y < imgButtonMask->height()
313 && imgButtonMask->pixelIndex( x, y ) == i + 1 ); 313 && imgButtonMask->pixelIndex( x, y ) == i + 1 );
314 314
315 if ( isOnButton && !videoButtons[i].isHeld ) { 315 if ( isOnButton && !videoButtons[i].isHeld ) {
316 videoButtons[i].isHeld = TRUE; 316 videoButtons[i].isHeld = TRUE;
317 toggleButton(i); 317 toggleButton(i);
318 318
319 switch (i) { 319 switch (i) {
320 case VideoVolUp: 320 case VideoVolUp:
321 qDebug("more clicked");
322 emit moreClicked(); 321 emit moreClicked();
323 return; 322 return;
324 case VideoVolDown: 323 case VideoVolDown:
325 qDebug("less clicked");
326 emit lessClicked(); 324 emit lessClicked();
327 return; 325 return;
328 } 326 }
329 } else if ( !isOnButton && videoButtons[i].isHeld ) { 327 } else if ( !isOnButton && videoButtons[i].isHeld ) {
330 videoButtons[i].isHeld = FALSE; 328 videoButtons[i].isHeld = FALSE;
331 toggleButton(i); 329 toggleButton(i);
332 } 330 }
333 } else { 331 } else {
334 332
335 if ( videoButtons[i].isHeld ) { 333 if ( videoButtons[i].isHeld ) {
336 videoButtons[i].isHeld = FALSE; 334 videoButtons[i].isHeld = FALSE;
337 if ( !videoButtons[i].isToggle ) { 335 if ( !videoButtons[i].isToggle ) {
338 setToggleButton( i, FALSE ); 336 setToggleButton( i, FALSE );
339 qDebug("button toggled3 %d",i);
340 } 337 }
341 338
342 switch(i) { 339 switch(i) {
343 340
344 case VideoPlay: { 341 case VideoPlay: {
345 if( mediaPlayerState->isPaused ) { 342 if( mediaPlayerState->isPaused ) {
346 qDebug("play again clicked");
347 setToggleButton( i, FALSE ); 343 setToggleButton( i, FALSE );
348 mediaPlayerState->setPaused( FALSE ); 344 mediaPlayerState->setPaused( FALSE );
349 return; 345 return;
350 } else if( !mediaPlayerState->isPaused ) { 346 } else if( !mediaPlayerState->isPaused ) {
351 qDebug("pause now clicked");
352 setToggleButton( i, TRUE ); 347 setToggleButton( i, TRUE );
353 mediaPlayerState->setPaused( TRUE ); 348 mediaPlayerState->setPaused( TRUE );
354 return; 349 return;
355 } else { 350 } else {
356 // setToggleButton( i, TRUE ); 351 // setToggleButton( i, TRUE );
357 // mediaPlayerState->setPlaying( videoButtons[i].isDown ); 352 // mediaPlayerState->setPlaying( videoButtons[i].isDown );
358 } 353 }
359 } 354 }
360 355
361 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; 356 case VideoStop: mediaPlayerState->setPlaying( FALSE ); return;
362// case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; 357// case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return;
363 case VideoNext: mediaPlayerState->setNext(); return; 358 case VideoNext: mediaPlayerState->setNext(); return;
364 case VideoPrevious: mediaPlayerState->setPrev(); return; 359 case VideoPrevious: mediaPlayerState->setPrev(); return;
365 case VideoVolUp: emit moreReleased(); return; 360 case VideoVolUp: emit moreReleased(); return;
366 case VideoVolDown: emit lessReleased(); return; 361 case VideoVolDown: emit lessReleased(); return;
367 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; 362 case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return;
368 } 363 }
369 } 364 }
370 } 365 }
371 } 366 }
372} 367}
373 368
374void VideoWidget::mousePressEvent( QMouseEvent *event ) { 369void VideoWidget::mousePressEvent( QMouseEvent *event ) {
375 mouseMoveEvent( event ); 370 mouseMoveEvent( event );
376} 371}
377 372
378void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { 373void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) {
379 if ( mediaPlayerState->fullscreen() ) { 374 if ( mediaPlayerState->fullscreen() ) {
380 mediaPlayerState->setFullscreen( FALSE ); 375 mediaPlayerState->setFullscreen( FALSE );
381 makeVisible(); 376 makeVisible();
382
383 mouseMoveEvent( event );
384 } 377 }
378 mouseMoveEvent( event );
385} 379}
386 380
387void VideoWidget::showEvent( QShowEvent* ) { 381void VideoWidget::showEvent( QShowEvent* ) {
388 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); 382 QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 );
389 mouseMoveEvent( &event ); 383 mouseMoveEvent( &event );
390} 384}
391 385
392 386
393void VideoWidget::makeVisible() { 387void VideoWidget::makeVisible() {
394 if ( mediaPlayerState->fullscreen() ) { 388 if ( mediaPlayerState->fullscreen() ) {
395 setBackgroundMode( QWidget::NoBackground ); 389 setBackgroundMode( QWidget::NoBackground );
396 showFullScreen(); 390 showFullScreen();
397 resize( qApp->desktop()->size() ); 391 resize( qApp->desktop()->size() );
398 slider->hide(); 392 slider->hide();
399 videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); 393 videoFrame-> setGeometry ( 0, 0, width ( ), height ( ));
400 } else { 394 } else {
401 showNormal(); 395 showNormal();
402 showMaximized(); 396 showMaximized();
403 slider->show(); 397 slider->show();
404 videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) ); 398 videoFrame->setGeometry( QRect( 10, 20, 220, 160 ) );
405 qApp->processEvents(); 399 qApp->processEvents();
406 } 400 }
407} 401}
408 402
409 403
410void VideoWidget::paintEvent( QPaintEvent * pe) { 404void VideoWidget::paintEvent( QPaintEvent * pe) {
411 QPainter p( this ); 405 QPainter p( this );
412 406
413 if ( mediaPlayerState->fullscreen() ) { 407 if ( mediaPlayerState->fullscreen() ) {
414 // Clear the background 408 // Clear the background
415 p.setBrush( QBrush( Qt::black ) ); 409 p.setBrush( QBrush( Qt::black ) );
416 // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) ); 410 // videoFrame->setGeometry( QRect( 0, 0 , 240 ,320 ) );