author | llornkcor <llornkcor> | 2003-04-20 04:15:39 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-04-20 04:15:39 (UTC) |
commit | 138fbbf45ce46228f2bec63099e0bc3a4e0537e2 (patch) (unidiff) | |
tree | 424f7bffb331270f5888f3659d02f447fbae0794 | |
parent | 0bc47585aef17477ca5564dde4da4a41cf57a1c0 (diff) | |
download | opie-138fbbf45ce46228f2bec63099e0bc3a4e0537e2.zip opie-138fbbf45ce46228f2bec63099e0bc3a4e0537e2.tar.gz opie-138fbbf45ce46228f2bec63099e0bc3a4e0537e2.tar.bz2 |
remove commentout code
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 6ed0108..48104ca 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -265,276 +265,169 @@ void VideoWidget::setView( char view ) { | |||
265 | else | 265 | else |
266 | { | 266 | { |
267 | // Effectively blank the view next time we show it so it looks nicer | 267 | // Effectively blank the view next time we show it so it looks nicer |
268 | scaledWidth = 0; | 268 | scaledWidth = 0; |
269 | scaledHeight = 0; | 269 | scaledHeight = 0; |
270 | hide(); | 270 | hide(); |
271 | } | 271 | } |
272 | } | 272 | } |
273 | 273 | ||
274 | 274 | ||
275 | void VideoWidget::updateSlider( long i, long max ) { | 275 | void VideoWidget::updateSlider( long i, long max ) { |
276 | // Will flicker too much if we don't do this | 276 | // Will flicker too much if we don't do this |
277 | if ( max == 0 ) | 277 | if ( max == 0 ) |
278 | return; | 278 | return; |
279 | int width = slider->width(); | 279 | int width = slider->width(); |
280 | int val = int((double)i * width / max); | 280 | int val = int((double)i * width / max); |
281 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) | 281 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) |
282 | { | 282 | { |
283 | if ( slider->value() != val ) | 283 | if ( slider->value() != val ) |
284 | slider->setValue( val ); | 284 | slider->setValue( val ); |
285 | if ( slider->maxValue() != width ) | 285 | if ( slider->maxValue() != width ) |
286 | slider->setMaxValue( width ); | 286 | slider->setMaxValue( width ); |
287 | } | 287 | } |
288 | } | 288 | } |
289 | 289 | ||
290 | 290 | ||
291 | void VideoWidget::setToggleButton( int i, bool down ) { | 291 | void VideoWidget::setToggleButton( int i, bool down ) { |
292 | if ( down != videoButtons[i].isDown ) | 292 | if ( down != videoButtons[i].isDown ) |
293 | toggleButton( i ); | 293 | toggleButton( i ); |
294 | } | 294 | } |
295 | 295 | ||
296 | 296 | ||
297 | void VideoWidget::toggleButton( int i ) { | 297 | void VideoWidget::toggleButton( int i ) { |
298 | videoButtons[i].isDown = !videoButtons[i].isDown; | 298 | videoButtons[i].isDown = !videoButtons[i].isDown; |
299 | QPainter p(this); | 299 | QPainter p(this); |
300 | paintButton ( &p, i ); | 300 | paintButton ( &p, i ); |
301 | } | 301 | } |
302 | 302 | ||
303 | 303 | ||
304 | void VideoWidget::paintButton( QPainter *p, int i ) { | 304 | void VideoWidget::paintButton( QPainter *p, int i ) { |
305 | if ( videoButtons[i].isDown ) | 305 | if ( videoButtons[i].isDown ) |
306 | { | 306 | { |
307 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 307 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
308 | } | 308 | } |
309 | else | 309 | else |
310 | { | 310 | { |
311 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 311 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
312 | } | 312 | } |
313 | // int x = videoButtons[i].xPos; | ||
314 | // int y = videoButtons[i].yPos; | ||
315 | // int offset = 10 + videoButtons[i].isDown; | ||
316 | // p->drawPixmap( x, y, *pixmaps[videoButtons[i].isDown] ); | ||
317 | // p->drawPixmap( x + 1 + offset, y + offset, *pixmaps[2], 9 * videoButtons[i].controlType, 0, 9, 9 ); | ||
318 | } | 313 | } |
319 | 314 | ||
320 | 315 | ||
321 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 316 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
322 | for ( int i = 0; i < numVButtons; i++ ) { | 317 | for ( int i = 0; i < numVButtons; i++ ) { |
323 | if ( event->state() == QMouseEvent::LeftButton ) { | 318 | if ( event->state() == QMouseEvent::LeftButton ) { |
324 | // The test to see if the mouse click is inside the button or not | 319 | // The test to see if the mouse click is inside the button or not |
325 | int x = event->pos().x() - xoff; | 320 | int x = event->pos().x() - xoff; |
326 | int y = event->pos().y() - yoff; | 321 | int y = event->pos().y() - yoff; |
327 | 322 | ||
328 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 323 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
329 | && y < imgButtonMask->height() | 324 | && y < imgButtonMask->height() |
330 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 325 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
331 | 326 | ||
332 | if ( isOnButton && !videoButtons[i].isHeld ) { | 327 | if ( isOnButton && !videoButtons[i].isHeld ) { |
333 | videoButtons[i].isHeld = TRUE; | 328 | videoButtons[i].isHeld = TRUE; |
334 | toggleButton(i); | 329 | toggleButton(i); |
335 | 330 | ||
336 | switch (i) { | 331 | switch (i) { |
337 | case VideoVolUp: | 332 | case VideoVolUp: |
338 | emit moreClicked(); | 333 | emit moreClicked(); |
339 | return; | 334 | return; |
340 | case VideoVolDown: | 335 | case VideoVolDown: |
341 | emit lessClicked(); | 336 | emit lessClicked(); |
342 | return; | 337 | return; |
343 | } | 338 | } |
344 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 339 | } else if ( !isOnButton && videoButtons[i].isHeld ) { |
345 | videoButtons[i].isHeld = FALSE; | 340 | videoButtons[i].isHeld = FALSE; |
346 | toggleButton(i); | 341 | toggleButton(i); |
347 | } | 342 | } |
348 | } else { | 343 | } else { |
349 | 344 | ||
350 | if ( videoButtons[i].isHeld ) { | 345 | if ( videoButtons[i].isHeld ) { |
351 | videoButtons[i].isHeld = FALSE; | 346 | videoButtons[i].isHeld = FALSE; |
352 | if ( !videoButtons[i].isToggle ) { | 347 | if ( !videoButtons[i].isToggle ) { |
353 | setToggleButton( i, FALSE ); | 348 | setToggleButton( i, FALSE ); |
354 | } | 349 | } |
355 | 350 | ||
356 | switch(i) { | 351 | switch(i) { |
357 | 352 | ||
358 | case VideoPlay: { | 353 | case VideoPlay: { |
359 | qDebug("play"); | 354 | qDebug("play"); |
360 | if( !mediaPlayerState->playing()) { | 355 | if( !mediaPlayerState->playing()) { |
361 | mediaPlayerState->setPlaying( true); | 356 | mediaPlayerState->setPlaying( true); |
362 | setToggleButton( i-1, false ); | 357 | setToggleButton( i-1, false ); |
363 | setToggleButton( i, false ); | 358 | setToggleButton( i, false ); |
364 | return; | 359 | return; |
365 | } | 360 | } |
366 | if( mediaPlayerState->isPaused ) { | 361 | if( mediaPlayerState->isPaused ) { |
367 | qDebug("isPaused"); | 362 | qDebug("isPaused"); |
368 | setToggleButton( i, FALSE ); | 363 | setToggleButton( i, FALSE ); |
369 | mediaPlayerState->setPaused( FALSE ); | 364 | mediaPlayerState->setPaused( FALSE ); |
370 | return; | 365 | return; |
371 | } else if( !mediaPlayerState->isPaused ) { | 366 | } else if( !mediaPlayerState->isPaused ) { |
372 | qDebug("is not paused"); | 367 | qDebug("is not paused"); |
373 | setToggleButton( i, TRUE ); | 368 | setToggleButton( i, TRUE ); |
374 | mediaPlayerState->setPaused( TRUE ); | 369 | mediaPlayerState->setPaused( TRUE ); |
375 | return; | 370 | return; |
376 | } else { | 371 | } else { |
377 | return; | 372 | return; |
378 | } | 373 | } |
379 | } | 374 | } |
380 | 375 | ||
381 | case VideoStop: qDebug("stop"); mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; | 376 | case VideoStop: qDebug("stop"); mediaPlayerState->setPlaying( FALSE ); setToggleButton( i+1, true); setToggleButton( i, true ); return; |
382 | case VideoNext: mediaPlayerState->setNext(); return; | 377 | case VideoNext: mediaPlayerState->setNext(); return; |
383 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 378 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
384 | case VideoVolUp: emit moreReleased(); return; | 379 | case VideoVolUp: emit moreReleased(); return; |
385 | case VideoVolDown: emit lessReleased(); return; | 380 | case VideoVolDown: emit lessReleased(); return; |
386 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 381 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
387 | } | 382 | } |
388 | } | 383 | } |
389 | } | 384 | } |
390 | } | 385 | } |
391 | |||
392 | // for ( int i = 0; i < numVButtons; i++ ) | ||
393 | // { | ||
394 | // if ( event->state() == QMouseEvent::LeftButton ) | ||
395 | // { | ||
396 | // // The test to see if the mouse click is inside the button or not | ||
397 | // int x = event->pos().x() - xoff; | ||
398 | // int y = event->pos().y() - yoff; | ||
399 | |||
400 | // bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | ||
401 | // && y < imgButtonMask->height() | ||
402 | // && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | ||
403 | |||
404 | // if ( isOnButton && !videoButtons[i].isHeld ) | ||
405 | // { | ||
406 | // qDebug("key %d", i); | ||
407 | |||
408 | // videoButtons[i].isHeld = TRUE; | ||
409 | // toggleButton(i); | ||
410 | // switch (i) { | ||
411 | // case VideoVolUp: | ||
412 | // emit moreClicked(); | ||
413 | // return; | ||
414 | // case VideoVolDown: | ||
415 | // emit lessClicked(); | ||
416 | // return; | ||
417 | // } | ||
418 | // } else if ( !isOnButton && videoButtons[i].isHeld ) { | ||
419 | // videoButtons[i].isHeld = FALSE; | ||
420 | // toggleButton(i); | ||
421 | // } | ||
422 | |||
423 | |||
424 | // } else { | ||
425 | |||
426 | // if ( videoButtons[i].isHeld ) | ||
427 | // { | ||
428 | // videoButtons[i].isHeld = FALSE; | ||
429 | // if ( !videoButtons[i].isToggle ) { | ||
430 | // setToggleButton( i, FALSE ); | ||
431 | // } | ||
432 | // qDebug("key %d", i); | ||
433 | // switch(i) { | ||
434 | // case VideoPlay: | ||
435 | // { | ||
436 | // if( mediaPlayerState->isPaused ) { | ||
437 | // setToggleButton( i, FALSE ); | ||
438 | // mediaPlayerState->setPaused( FALSE ); | ||
439 | // return; | ||
440 | // } | ||
441 | // else if( !mediaPlayerState->isPaused ) { | ||
442 | // setToggleButton( i, TRUE ); | ||
443 | // mediaPlayerState->setPaused( TRUE ); | ||
444 | // return; | ||
445 | // } else { | ||
446 | // return; | ||
447 | // } | ||
448 | // } | ||
449 | |||
450 | // case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | ||
451 | // // case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | ||
452 | // // case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | ||
453 | // case VideoNext: mediaPlayerState->setNext(); return; | ||
454 | // case VideoPrevious: mediaPlayerState->setPrev(); return; | ||
455 | // case VideoVolUp: emit moreReleased(); return; | ||
456 | // case VideoVolDown: emit lessReleased(); return; | ||
457 | // // case VideoPlayList: mediaPlayerState->setList(); return; | ||
458 | // case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | ||
459 | // } | ||
460 | // } | ||
461 | // } | ||
462 | // } | ||
463 | |||
464 | |||
465 | |||
466 | |||
467 | |||
468 | // for ( int i = 0; i < numButtons; i++ ) { | ||
469 | // int x = videoButtons[i].xPos; | ||
470 | // int y = videoButtons[i].yPos; | ||
471 | // if ( event->state() == QMouseEvent::LeftButton ) { | ||
472 | // // The test to see if the mouse click is inside the circular button or not | ||
473 | // // (compared with the radius squared to avoid a square-root of our distance) | ||
474 | // int radius = 16; | ||
475 | // QPoint center = QPoint( x + radius, y + radius ); | ||
476 | // QPoint dXY = center - event->pos(); | ||
477 | // int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | ||
478 | // bool isOnButton = dist <= (radius * radius); | ||
479 | // if ( isOnButton != videoButtons[i].isHeld ) { | ||
480 | // videoButtons[i].isHeld = isOnButton; | ||
481 | // toggleButton(i); | ||
482 | // } | ||
483 | // } else { | ||
484 | // if ( videoButtons[i].isHeld ) { | ||
485 | // videoButtons[i].isHeld = FALSE; | ||
486 | // if ( !videoButtons[i].isToggle ) | ||
487 | // setToggleButton( i, FALSE ); | ||
488 | // } | ||
489 | // } | ||
490 | |||
491 | |||
492 | // } | ||
493 | } | 386 | } |
494 | 387 | ||
495 | 388 | ||
496 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 389 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
497 | mouseMoveEvent( event ); | 390 | mouseMoveEvent( event ); |
498 | } | 391 | } |
499 | 392 | ||
500 | 393 | ||
501 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 394 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
502 | if ( mediaPlayerState->fullscreen() ) | 395 | if ( mediaPlayerState->fullscreen() ) |
503 | { | 396 | { |
504 | mediaPlayerState->setFullscreen( FALSE ); | 397 | mediaPlayerState->setFullscreen( FALSE ); |
505 | makeVisible(); | 398 | makeVisible(); |
506 | } | 399 | } |
507 | mouseMoveEvent( event ); | 400 | mouseMoveEvent( event ); |
508 | // } | 401 | // } |
509 | } | 402 | } |
510 | 403 | ||
511 | 404 | ||
512 | void VideoWidget::makeVisible() { | 405 | void VideoWidget::makeVisible() { |
513 | if ( mediaPlayerState->fullscreen() ) | 406 | if ( mediaPlayerState->fullscreen() ) |
514 | { | 407 | { |
515 | setBackgroundMode( QWidget::NoBackground ); | 408 | setBackgroundMode( QWidget::NoBackground ); |
516 | showFullScreen(); | 409 | showFullScreen(); |
517 | resize( qApp->desktop()->size() ); | 410 | resize( qApp->desktop()->size() ); |
518 | slider->hide(); | 411 | slider->hide(); |
519 | } | 412 | } |
520 | else | 413 | else |
521 | { | 414 | { |
522 | setBackgroundPixmap( *pixBg ); | 415 | setBackgroundPixmap( *pixBg ); |
523 | showNormal(); | 416 | showNormal(); |
524 | showMaximized(); | 417 | showMaximized(); |
525 | slider->show(); | 418 | slider->show(); |
526 | } | 419 | } |
527 | } | 420 | } |
528 | 421 | ||
529 | 422 | ||
530 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 423 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
531 | QPainter p( this ); | 424 | QPainter p( this ); |
532 | 425 | ||
533 | if ( mediaPlayerState->fullscreen() ) { | 426 | if ( mediaPlayerState->fullscreen() ) { |
534 | // Clear the background | 427 | // Clear the background |
535 | p.setBrush( QBrush( Qt::black ) ); | 428 | p.setBrush( QBrush( Qt::black ) ); |
536 | p.drawRect( rect() ); | 429 | p.drawRect( rect() ); |
537 | } else { | 430 | } else { |
538 | if ( !pe->erased() ) { | 431 | if ( !pe->erased() ) { |
539 | // Combine with background and double buffer | 432 | // Combine with background and double buffer |
540 | QPixmap pix( pe->rect().size() ); | 433 | QPixmap pix( pe->rect().size() ); |