-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/videowidget.cpp | 4 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 2 |
4 files changed, 8 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 6ccf206..a52319b 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -306,249 +306,249 @@ void AudioWidget::setSeekable( bool isSeekable ) { | |||
306 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 306 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
307 | } | 307 | } |
308 | } | 308 | } |
309 | 309 | ||
310 | 310 | ||
311 | static QString timeAsString( long length ) { | 311 | static QString timeAsString( long length ) { |
312 | int minutes = length / 60; | 312 | int minutes = length / 60; |
313 | int seconds = length % 60; | 313 | int seconds = length % 60; |
314 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 314 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
315 | } | 315 | } |
316 | 316 | ||
317 | void AudioWidget::updateSlider( long i, long max ) { | 317 | void AudioWidget::updateSlider( long i, long max ) { |
318 | 318 | ||
319 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 319 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
320 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 320 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; |
321 | 321 | ||
322 | if ( max == 0 ) { | 322 | if ( max == 0 ) { |
323 | return; | 323 | return; |
324 | } | 324 | } |
325 | // Will flicker too much if we don't do this | 325 | // Will flicker too much if we don't do this |
326 | // Scale to something reasonable | 326 | // Scale to something reasonable |
327 | int width = slider.width(); | 327 | int width = slider.width(); |
328 | int val = int((double)i * width / max); | 328 | int val = int((double)i * width / max); |
329 | if ( !audioSliderBeingMoved ) { | 329 | if ( !audioSliderBeingMoved ) { |
330 | if ( slider.value() != val ) { | 330 | if ( slider.value() != val ) { |
331 | slider.setValue( val ); | 331 | slider.setValue( val ); |
332 | } | 332 | } |
333 | 333 | ||
334 | if ( slider.maxValue() != width ) { | 334 | if ( slider.maxValue() != width ) { |
335 | slider.setMaxValue( width ); | 335 | slider.setMaxValue( width ); |
336 | } | 336 | } |
337 | } | 337 | } |
338 | } | 338 | } |
339 | 339 | ||
340 | 340 | ||
341 | void AudioWidget::setToggleButton( int i, bool down ) { | 341 | void AudioWidget::setToggleButton( int i, bool down ) { |
342 | qDebug("setToggleButton %d", i); | 342 | qDebug("setToggleButton %d", i); |
343 | if ( down != audioButtons[i].isDown ) { | 343 | if ( down != audioButtons[i].isDown ) { |
344 | toggleButton( i ); | 344 | toggleButton( i ); |
345 | } | 345 | } |
346 | } | 346 | } |
347 | 347 | ||
348 | 348 | ||
349 | void AudioWidget::toggleButton( int i ) { | 349 | void AudioWidget::toggleButton( int i ) { |
350 | audioButtons[i].isDown = !audioButtons[i].isDown; | 350 | audioButtons[i].isDown = !audioButtons[i].isDown; |
351 | QPainter p(this); | 351 | QPainter p(this); |
352 | paintButton ( &p, i ); | 352 | paintButton ( &p, i ); |
353 | } | 353 | } |
354 | 354 | ||
355 | 355 | ||
356 | void AudioWidget::paintButton( QPainter *p, int i ) { | 356 | void AudioWidget::paintButton( QPainter *p, int i ) { |
357 | if ( audioButtons[i].isDown ) { | 357 | if ( audioButtons[i].isDown ) { |
358 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 358 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
359 | } else { | 359 | } else { |
360 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 360 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
361 | } | 361 | } |
362 | } | 362 | } |
363 | 363 | ||
364 | 364 | ||
365 | void AudioWidget::skipFor() { | 365 | void AudioWidget::skipFor() { |
366 | skipDirection = +1; | 366 | skipDirection = +1; |
367 | startTimer( 50 ); | 367 | startTimer( 50 ); |
368 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | 368 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); |
369 | } | 369 | } |
370 | 370 | ||
371 | void AudioWidget::skipBack() { | 371 | void AudioWidget::skipBack() { |
372 | skipDirection = -1; | 372 | skipDirection = -1; |
373 | startTimer( 50 ); | 373 | startTimer( 50 ); |
374 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | 374 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); |
375 | } | 375 | } |
376 | 376 | ||
377 | 377 | ||
378 | 378 | ||
379 | void AudioWidget::stopSkip() { | 379 | void AudioWidget::stopSkip() { |
380 | killTimers(); | 380 | killTimers(); |
381 | } | 381 | } |
382 | 382 | ||
383 | 383 | ||
384 | void AudioWidget::timerEvent( QTimerEvent * ) { | 384 | void AudioWidget::timerEvent( QTimerEvent * ) { |
385 | if ( skipDirection == +1 ) { | 385 | if ( skipDirection == +1 ) { |
386 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); | 386 | mediaPlayerState->setPosition( mediaPlayerState->position() + 2 ); |
387 | } else if ( skipDirection == -1 ) { | 387 | } else if ( skipDirection == -1 ) { |
388 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); | 388 | mediaPlayerState->setPosition( mediaPlayerState->position() - 2 ); |
389 | } | 389 | } |
390 | } | 390 | } |
391 | 391 | ||
392 | 392 | ||
393 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | 393 | void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { |
394 | for ( int i = 0; i < numButtons; i++ ) { | 394 | for ( int i = 0; i < numButtons; i++ ) { |
395 | if ( event->state() == QMouseEvent::LeftButton ) { | 395 | if ( event->state() == QMouseEvent::LeftButton ) { |
396 | // The test to see if the mouse click is inside the button or not | 396 | // The test to see if the mouse click is inside the button or not |
397 | int x = event->pos().x() - xoff; | 397 | int x = event->pos().x() - xoff; |
398 | int y = event->pos().y() - yoff; | 398 | int y = event->pos().y() - yoff; |
399 | 399 | ||
400 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 400 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
401 | && y < imgButtonMask->height() | 401 | && y < imgButtonMask->height() |
402 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 402 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
403 | 403 | ||
404 | if ( isOnButton && !audioButtons[i].isHeld ) { | 404 | if ( isOnButton && !audioButtons[i].isHeld ) { |
405 | audioButtons[i].isHeld = TRUE; | 405 | audioButtons[i].isHeld = TRUE; |
406 | toggleButton(i); | 406 | toggleButton(i); |
407 | switch (i) { | 407 | switch (i) { |
408 | case AudioVolumeUp: | 408 | case AudioVolumeUp: |
409 | emit moreClicked(); | 409 | emit moreClicked(); |
410 | return; | 410 | return; |
411 | case AudioVolumeDown: | 411 | case AudioVolumeDown: |
412 | emit lessClicked(); | 412 | emit lessClicked(); |
413 | return; | 413 | return; |
414 | case AudioForward: | 414 | case AudioForward: |
415 | emit forwardClicked(); | 415 | emit forwardClicked(); |
416 | return; | 416 | return; |
417 | case AudioBack: | 417 | case AudioBack: |
418 | emit backClicked(); | 418 | emit backClicked(); |
419 | return; | 419 | return; |
420 | } | 420 | } |
421 | } else if ( !isOnButton && audioButtons[i].isHeld ) { | 421 | } else if ( !isOnButton && audioButtons[i].isHeld ) { |
422 | audioButtons[i].isHeld = FALSE; | 422 | audioButtons[i].isHeld = FALSE; |
423 | toggleButton(i); | 423 | toggleButton(i); |
424 | } | 424 | } |
425 | } else { | 425 | } else { |
426 | if ( audioButtons[i].isHeld ) { | 426 | if ( audioButtons[i].isHeld ) { |
427 | audioButtons[i].isHeld = FALSE; | 427 | audioButtons[i].isHeld = FALSE; |
428 | if ( !audioButtons[i].isToggle ) { | 428 | if ( !audioButtons[i].isToggle ) { |
429 | setToggleButton( i, FALSE ); | 429 | setToggleButton( i, FALSE ); |
430 | } | 430 | } |
431 | qDebug("mouseEvent %d", i); | 431 | qDebug("mouseEvent %d", i); |
432 | switch (i) { | 432 | switch (i) { |
433 | case AudioPlay: | 433 | case AudioPlay: |
434 | if( mediaPlayerState->isPaused ) { | 434 | if( mediaPlayerState->paused() ) { |
435 | mediaPlayerState->setPaused( FALSE ); | 435 | mediaPlayerState->setPaused( FALSE ); |
436 | return; | 436 | return; |
437 | } else if( !mediaPlayerState->isPaused ) { | 437 | } else if( !mediaPlayerState->paused() ) { |
438 | mediaPlayerState->setPaused( TRUE ); | 438 | mediaPlayerState->setPaused( TRUE ); |
439 | return; | 439 | return; |
440 | } | 440 | } |
441 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 441 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
442 | case AudioNext: if( playList->whichList() ==0 ) mediaPlayerState->setNext(); return; | 442 | case AudioNext: if( playList->whichList() ==0 ) mediaPlayerState->setNext(); return; |
443 | case AudioPrevious: if( playList->whichList() ==0 ) mediaPlayerState->setPrev(); return; | 443 | case AudioPrevious: if( playList->whichList() ==0 ) mediaPlayerState->setPrev(); return; |
444 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 444 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
445 | case AudioVolumeUp: emit moreReleased(); return; | 445 | case AudioVolumeUp: emit moreReleased(); return; |
446 | case AudioVolumeDown: emit lessReleased(); return; | 446 | case AudioVolumeDown: emit lessReleased(); return; |
447 | case AudioPlayList: mediaPlayerState->setList(); return; | 447 | case AudioPlayList: mediaPlayerState->setList(); return; |
448 | case AudioForward: emit forwardReleased(); return; | 448 | case AudioForward: emit forwardReleased(); return; |
449 | case AudioBack: emit backReleased(); return; | 449 | case AudioBack: emit backReleased(); return; |
450 | } | 450 | } |
451 | } | 451 | } |
452 | } | 452 | } |
453 | } | 453 | } |
454 | } | 454 | } |
455 | 455 | ||
456 | 456 | ||
457 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 457 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
458 | mouseMoveEvent( event ); | 458 | mouseMoveEvent( event ); |
459 | } | 459 | } |
460 | 460 | ||
461 | 461 | ||
462 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | 462 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { |
463 | mouseMoveEvent( event ); | 463 | mouseMoveEvent( event ); |
464 | } | 464 | } |
465 | 465 | ||
466 | 466 | ||
467 | void AudioWidget::showEvent( QShowEvent* ) { | 467 | void AudioWidget::showEvent( QShowEvent* ) { |
468 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 468 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
469 | mouseMoveEvent( &event ); | 469 | mouseMoveEvent( &event ); |
470 | } | 470 | } |
471 | 471 | ||
472 | 472 | ||
473 | void AudioWidget::closeEvent( QCloseEvent* ) { | 473 | void AudioWidget::closeEvent( QCloseEvent* ) { |
474 | mediaPlayerState->setList(); | 474 | mediaPlayerState->setList(); |
475 | } | 475 | } |
476 | 476 | ||
477 | 477 | ||
478 | void AudioWidget::paintEvent( QPaintEvent * pe ) { | 478 | void AudioWidget::paintEvent( QPaintEvent * pe ) { |
479 | if ( !pe->erased() ) { | 479 | if ( !pe->erased() ) { |
480 | // Combine with background and double buffer | 480 | // Combine with background and double buffer |
481 | QPixmap pix( pe->rect().size() ); | 481 | QPixmap pix( pe->rect().size() ); |
482 | QPainter p( &pix ); | 482 | QPainter p( &pix ); |
483 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 483 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
484 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 484 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
485 | for ( int i = 0; i < numButtons; i++ ) | 485 | for ( int i = 0; i < numButtons; i++ ) |
486 | paintButton( &p, i ); | 486 | paintButton( &p, i ); |
487 | QPainter p2( this ); | 487 | QPainter p2( this ); |
488 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 488 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
489 | } else { | 489 | } else { |
490 | QPainter p( this ); | 490 | QPainter p( this ); |
491 | for ( int i = 0; i < numButtons; i++ ) | 491 | for ( int i = 0; i < numButtons; i++ ) |
492 | paintButton( &p, i ); | 492 | paintButton( &p, i ); |
493 | } | 493 | } |
494 | } | 494 | } |
495 | 495 | ||
496 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { | 496 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) { |
497 | switch ( e->key() ) { | 497 | switch ( e->key() ) { |
498 | ////////////////////////////// Zaurus keys | 498 | ////////////////////////////// Zaurus keys |
499 | case Key_Home: | 499 | case Key_Home: |
500 | break; | 500 | break; |
501 | case Key_F9: //activity | 501 | case Key_F9: //activity |
502 | hide(); | 502 | hide(); |
503 | // qDebug("Audio F9"); | 503 | // qDebug("Audio F9"); |
504 | break; | 504 | break; |
505 | case Key_F10: //contacts | 505 | case Key_F10: //contacts |
506 | break; | 506 | break; |
507 | case Key_F11: //menu | 507 | case Key_F11: //menu |
508 | mediaPlayerState->toggleBlank(); | 508 | mediaPlayerState->toggleBlank(); |
509 | break; | 509 | break; |
510 | case Key_F12: //home | 510 | case Key_F12: //home |
511 | break; | 511 | break; |
512 | case Key_F13: //mail | 512 | case Key_F13: //mail |
513 | mediaPlayerState->toggleBlank(); | 513 | mediaPlayerState->toggleBlank(); |
514 | break; | 514 | break; |
515 | case Key_Space: { | 515 | case Key_Space: { |
516 | if(mediaPlayerState->playing()) { | 516 | if(mediaPlayerState->playing()) { |
517 | // toggleButton(1); | 517 | // toggleButton(1); |
518 | mediaPlayerState->setPlaying(FALSE); | 518 | mediaPlayerState->setPlaying(FALSE); |
519 | // toggleButton(1); | 519 | // toggleButton(1); |
520 | } else { | 520 | } else { |
521 | // toggleButton(0); | 521 | // toggleButton(0); |
522 | mediaPlayerState->setPlaying(TRUE); | 522 | mediaPlayerState->setPlaying(TRUE); |
523 | // toggleButton(0); | 523 | // toggleButton(0); |
524 | } | 524 | } |
525 | } | 525 | } |
526 | break; | 526 | break; |
527 | case Key_Down: | 527 | case Key_Down: |
528 | // toggleButton(6); | 528 | // toggleButton(6); |
529 | emit lessClicked(); | 529 | emit lessClicked(); |
530 | emit lessReleased(); | 530 | emit lessReleased(); |
531 | // toggleButton(6); | 531 | // toggleButton(6); |
532 | break; | 532 | break; |
533 | case Key_Up: | 533 | case Key_Up: |
534 | // toggleButton(5); | 534 | // toggleButton(5); |
535 | emit moreClicked(); | 535 | emit moreClicked(); |
536 | emit moreReleased(); | 536 | emit moreReleased(); |
537 | // toggleButton(5); | 537 | // toggleButton(5); |
538 | break; | 538 | break; |
539 | case Key_Right: | 539 | case Key_Right: |
540 | // toggleButton(3); | 540 | // toggleButton(3); |
541 | mediaPlayerState->setNext(); | 541 | mediaPlayerState->setNext(); |
542 | // toggleButton(3); | 542 | // toggleButton(3); |
543 | break; | 543 | break; |
544 | case Key_Left: | 544 | case Key_Left: |
545 | // toggleButton(4); | 545 | // toggleButton(4); |
546 | mediaPlayerState->setPrev(); | 546 | mediaPlayerState->setPrev(); |
547 | // toggleButton(4); | 547 | // toggleButton(4); |
548 | break; | 548 | break; |
549 | case Key_Escape: { | 549 | case Key_Escape: { |
550 | } | 550 | } |
551 | break; | 551 | break; |
552 | 552 | ||
553 | }; | 553 | }; |
554 | } | 554 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 8c4e09e..154e3b0 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -1,143 +1,143 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | // this file is based on work by trolltech | 34 | // this file is based on work by trolltech |
35 | 35 | ||
36 | #ifndef MEDIA_PLAYER_STATE_H | 36 | #ifndef MEDIA_PLAYER_STATE_H |
37 | #define MEDIA_PLAYER_STATE_H | 37 | #define MEDIA_PLAYER_STATE_H |
38 | 38 | ||
39 | 39 | ||
40 | #include <qobject.h> | 40 | #include <qobject.h> |
41 | 41 | ||
42 | 42 | ||
43 | class MediaPlayerDecoder; | 43 | class MediaPlayerDecoder; |
44 | class Config; | 44 | class Config; |
45 | 45 | ||
46 | 46 | ||
47 | class MediaPlayerState : public QObject { | 47 | class MediaPlayerState : public QObject { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | public: | 49 | public: |
50 | MediaPlayerState( QObject *parent, const char *name ); | 50 | MediaPlayerState( QObject *parent, const char *name ); |
51 | ~MediaPlayerState(); | 51 | ~MediaPlayerState(); |
52 | 52 | ||
53 | bool isPaused; | ||
54 | bool isPlaying; | ||
55 | bool isStoped; | ||
56 | bool streaming(); | 53 | bool streaming(); |
57 | bool seekable(); | 54 | bool seekable(); |
58 | bool fullscreen(); | 55 | bool fullscreen(); |
59 | bool scaled(); | 56 | bool scaled(); |
60 | bool looping(); | 57 | bool looping(); |
61 | bool shuffled(); | 58 | bool shuffled(); |
62 | bool playlist(); | 59 | bool playlist(); |
63 | bool paused(); | 60 | bool paused(); |
64 | bool playing(); | 61 | bool playing(); |
65 | bool stop(); | 62 | bool stop(); |
66 | long position(); | 63 | long position(); |
67 | long length(); | 64 | long length(); |
68 | char view(); | 65 | char view(); |
69 | 66 | ||
70 | public slots: | 67 | public slots: |
71 | void setIsStreaming( bool b ); | 68 | void setIsStreaming( bool b ); |
72 | void setIsSeekable( bool b ); | 69 | void setIsSeekable( bool b ); |
73 | void setFullscreen( bool b ); | 70 | void setFullscreen( bool b ); |
74 | void setScaled( bool b ); | 71 | void setScaled( bool b ); |
75 | void setLooping( bool b ); | 72 | void setLooping( bool b ); |
76 | void setShuffled( bool b ); | 73 | void setShuffled( bool b ); |
77 | void setPlaylist( bool b ); | 74 | void setPlaylist( bool b ); |
78 | void setPaused( bool b ); | 75 | void setPaused( bool b ); |
79 | void setPlaying( bool b ); | 76 | void setPlaying( bool b ); |
80 | void setStop( bool b ); | 77 | void setStop( bool b ); |
81 | void setPosition( long p ); | 78 | void setPosition( long p ); |
82 | void updatePosition( long p ); | 79 | void updatePosition( long p ); |
83 | void setLength( long l ); | 80 | void setLength( long l ); |
84 | void setView( char v ); | 81 | void setView( char v ); |
85 | void setBlanked( bool b ); | 82 | void setBlanked( bool b ); |
86 | void setVideoGamma( int v ); | 83 | void setVideoGamma( int v ); |
87 | 84 | ||
88 | void setPrev(); | 85 | void setPrev(); |
89 | void setNext(); | 86 | void setNext(); |
90 | void setList(); | 87 | void setList(); |
91 | void setVideo(); | 88 | void setVideo(); |
92 | void setAudio(); | 89 | void setAudio(); |
93 | 90 | ||
94 | void toggleFullscreen(); | 91 | void toggleFullscreen(); |
95 | void toggleScaled(); | 92 | void toggleScaled(); |
96 | void toggleLooping(); | 93 | void toggleLooping(); |
97 | void toggleShuffled(); | 94 | void toggleShuffled(); |
98 | void togglePlaylist(); | 95 | void togglePlaylist(); |
99 | void togglePaused(); | 96 | void togglePaused(); |
100 | void togglePlaying(); | 97 | void togglePlaying(); |
101 | void toggleBlank(); | 98 | void toggleBlank(); |
102 | void writeConfig( Config& cfg ) const; | 99 | void writeConfig( Config& cfg ) const; |
103 | 100 | ||
104 | 101 | ||
105 | signals: | 102 | signals: |
106 | void fullscreenToggled( bool ); | 103 | void fullscreenToggled( bool ); |
107 | void scaledToggled( bool ); | 104 | void scaledToggled( bool ); |
108 | void loopingToggled( bool ); | 105 | void loopingToggled( bool ); |
109 | void shuffledToggled( bool ); | 106 | void shuffledToggled( bool ); |
110 | void playlistToggled( bool ); | 107 | void playlistToggled( bool ); |
111 | void pausedToggled( bool ); | 108 | void pausedToggled( bool ); |
112 | void playingToggled( bool ); | 109 | void playingToggled( bool ); |
113 | void stopToggled( bool ); | 110 | void stopToggled( bool ); |
114 | void positionChanged( long ); // When the slider is moved | 111 | void positionChanged( long ); // When the slider is moved |
115 | void positionUpdated( long ); // When the media file progresses | 112 | void positionUpdated( long ); // When the media file progresses |
116 | void lengthChanged( long ); | 113 | void lengthChanged( long ); |
117 | void viewChanged( char ); | 114 | void viewChanged( char ); |
118 | void isSeekableToggled( bool ); | 115 | void isSeekableToggled( bool ); |
119 | void blankToggled( bool ); | 116 | void blankToggled( bool ); |
120 | void videoGammaChanged( int ); | 117 | void videoGammaChanged( int ); |
121 | void prev(); | 118 | void prev(); |
122 | void next(); | 119 | void next(); |
123 | 120 | ||
124 | private: | 121 | private: |
125 | bool isStreaming; | 122 | bool isStreaming; |
126 | bool isSeekable; | 123 | bool isSeekable; |
127 | bool isFullscreen; | 124 | bool isFullscreen; |
128 | bool isScaled; | 125 | bool isScaled; |
129 | bool isBlanked; | 126 | bool isBlanked; |
130 | bool isLooping; | 127 | bool isLooping; |
131 | bool isShuffled; | 128 | bool isShuffled; |
132 | bool usePlaylist; | 129 | bool usePlaylist; |
130 | bool isPaused; | ||
131 | bool isPlaying; | ||
132 | bool isStoped; | ||
133 | long curPosition; | 133 | long curPosition; |
134 | long curLength; | 134 | long curLength; |
135 | char curView; | 135 | char curView; |
136 | int videoGamma; | 136 | int videoGamma; |
137 | void readConfig( Config& cfg ); | 137 | void readConfig( Config& cfg ); |
138 | 138 | ||
139 | }; | 139 | }; |
140 | 140 | ||
141 | 141 | ||
142 | #endif // MEDIA_PLAYER_STATE_H | 142 | #endif // MEDIA_PLAYER_STATE_H |
143 | 143 | ||
diff --git a/noncore/multimedia/opieplayer2/videowidget.cpp b/noncore/multimedia/opieplayer2/videowidget.cpp index c643273..3a757f0 100644 --- a/noncore/multimedia/opieplayer2/videowidget.cpp +++ b/noncore/multimedia/opieplayer2/videowidget.cpp | |||
@@ -202,261 +202,261 @@ void VideoWidget::resizeEvent( QResizeEvent * ) { | |||
202 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); | 202 | QPixmap *pixUp = combineVImageWithBackground( *imgUp, *pixBg, p ); |
203 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); | 203 | QPixmap *pixDn = combineVImageWithBackground( *imgDn, *pixBg, p ); |
204 | 204 | ||
205 | for ( int i = 0; i < 7; i++ ) { | 205 | for ( int i = 0; i < 7; i++ ) { |
206 | if ( !masks[i]->isNull() ) { | 206 | if ( !masks[i]->isNull() ) { |
207 | delete buttonPixUp[i]; | 207 | delete buttonPixUp[i]; |
208 | delete buttonPixDown[i]; | 208 | delete buttonPixDown[i]; |
209 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); | 209 | buttonPixUp[i] = maskVPixToMask( *pixUp, *masks[i] ); |
210 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); | 210 | buttonPixDown[i] = maskVPixToMask( *pixDn, *masks[i] ); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | delete pixUp; | 214 | delete pixUp; |
215 | delete pixDn; | 215 | delete pixDn; |
216 | } | 216 | } |
217 | 217 | ||
218 | static bool videoSliderBeingMoved = FALSE; | 218 | static bool videoSliderBeingMoved = FALSE; |
219 | 219 | ||
220 | void VideoWidget::sliderPressed() { | 220 | void VideoWidget::sliderPressed() { |
221 | videoSliderBeingMoved = TRUE; | 221 | videoSliderBeingMoved = TRUE; |
222 | } | 222 | } |
223 | 223 | ||
224 | void VideoWidget::sliderReleased() { | 224 | void VideoWidget::sliderReleased() { |
225 | videoSliderBeingMoved = FALSE; | 225 | videoSliderBeingMoved = FALSE; |
226 | if ( slider->width() == 0 ) { | 226 | if ( slider->width() == 0 ) { |
227 | return; | 227 | return; |
228 | } | 228 | } |
229 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 229 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); |
230 | mediaPlayerState->setPosition( val ); | 230 | mediaPlayerState->setPosition( val ); |
231 | } | 231 | } |
232 | 232 | ||
233 | void VideoWidget::setPosition( long i ) { | 233 | void VideoWidget::setPosition( long i ) { |
234 | updateSlider( i, mediaPlayerState->length() ); | 234 | updateSlider( i, mediaPlayerState->length() ); |
235 | } | 235 | } |
236 | 236 | ||
237 | 237 | ||
238 | void VideoWidget::setLength( long max ) { | 238 | void VideoWidget::setLength( long max ) { |
239 | updateSlider( mediaPlayerState->position(), max ); | 239 | updateSlider( mediaPlayerState->position(), max ); |
240 | } | 240 | } |
241 | 241 | ||
242 | void VideoWidget::setView( char view ) { | 242 | void VideoWidget::setView( char view ) { |
243 | 243 | ||
244 | if ( view == 'v' ) { | 244 | if ( view == 'v' ) { |
245 | makeVisible(); | 245 | makeVisible(); |
246 | } else { | 246 | } else { |
247 | // Effectively blank the view next time we show it so it looks nicer | 247 | // Effectively blank the view next time we show it so it looks nicer |
248 | scaledWidth = 0; | 248 | scaledWidth = 0; |
249 | scaledHeight = 0; | 249 | scaledHeight = 0; |
250 | hide(); | 250 | hide(); |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | void VideoWidget::updateSlider( long i, long max ) { | 254 | void VideoWidget::updateSlider( long i, long max ) { |
255 | // Will flicker too much if we don't do this | 255 | // Will flicker too much if we don't do this |
256 | if ( max == 0 ) { | 256 | if ( max == 0 ) { |
257 | return; | 257 | return; |
258 | } | 258 | } |
259 | int width = slider->width(); | 259 | int width = slider->width(); |
260 | int val = int((double)i * width / max); | 260 | int val = int((double)i * width / max); |
261 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { | 261 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { |
262 | if ( slider->value() != val ) { | 262 | if ( slider->value() != val ) { |
263 | slider->setValue( val ); | 263 | slider->setValue( val ); |
264 | } | 264 | } |
265 | if ( slider->maxValue() != width ) { | 265 | if ( slider->maxValue() != width ) { |
266 | slider->setMaxValue( width ); | 266 | slider->setMaxValue( width ); |
267 | } | 267 | } |
268 | } | 268 | } |
269 | } | 269 | } |
270 | 270 | ||
271 | void VideoWidget::setToggleButton( int i, bool down ) { | 271 | void VideoWidget::setToggleButton( int i, bool down ) { |
272 | if ( down != videoButtons[i].isDown ) { | 272 | if ( down != videoButtons[i].isDown ) { |
273 | toggleButton( i ); | 273 | toggleButton( i ); |
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
277 | void VideoWidget::toggleButton( int i ) { | 277 | void VideoWidget::toggleButton( int i ) { |
278 | videoButtons[i].isDown = !videoButtons[i].isDown; | 278 | videoButtons[i].isDown = !videoButtons[i].isDown; |
279 | QPainter p(this); | 279 | QPainter p(this); |
280 | paintButton ( &p, i ); | 280 | paintButton ( &p, i ); |
281 | } | 281 | } |
282 | 282 | ||
283 | void VideoWidget::paintButton( QPainter *p, int i ) { | 283 | void VideoWidget::paintButton( QPainter *p, int i ) { |
284 | 284 | ||
285 | if ( videoButtons[i].isDown ) { | 285 | if ( videoButtons[i].isDown ) { |
286 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); | 286 | p->drawPixmap( xoff, yoff, *buttonPixDown[i] ); |
287 | } else { | 287 | } else { |
288 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); | 288 | p->drawPixmap( xoff, yoff, *buttonPixUp[i] ); |
289 | } | 289 | } |
290 | } | 290 | } |
291 | 291 | ||
292 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 292 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
293 | for ( int i = 0; i < numVButtons; i++ ) { | 293 | for ( int i = 0; i < numVButtons; i++ ) { |
294 | if ( event->state() == QMouseEvent::LeftButton ) { | 294 | if ( event->state() == QMouseEvent::LeftButton ) { |
295 | // The test to see if the mouse click is inside the button or not | 295 | // The test to see if the mouse click is inside the button or not |
296 | int x = event->pos().x() - xoff; | 296 | int x = event->pos().x() - xoff; |
297 | int y = event->pos().y() - yoff; | 297 | int y = event->pos().y() - yoff; |
298 | 298 | ||
299 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() | 299 | bool isOnButton = ( x > 0 && y > 0 && x < imgButtonMask->width() |
300 | && y < imgButtonMask->height() | 300 | && y < imgButtonMask->height() |
301 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); | 301 | && imgButtonMask->pixelIndex( x, y ) == i + 1 ); |
302 | 302 | ||
303 | if ( isOnButton && !videoButtons[i].isHeld ) { | 303 | if ( isOnButton && !videoButtons[i].isHeld ) { |
304 | videoButtons[i].isHeld = TRUE; | 304 | videoButtons[i].isHeld = TRUE; |
305 | toggleButton(i); | 305 | toggleButton(i); |
306 | 306 | ||
307 | switch (i) { | 307 | switch (i) { |
308 | case VideoVolUp: | 308 | case VideoVolUp: |
309 | emit moreClicked(); | 309 | emit moreClicked(); |
310 | return; | 310 | return; |
311 | case VideoVolDown: | 311 | case VideoVolDown: |
312 | emit lessClicked(); | 312 | emit lessClicked(); |
313 | return; | 313 | return; |
314 | } | 314 | } |
315 | } else if ( !isOnButton && videoButtons[i].isHeld ) { | 315 | } else if ( !isOnButton && videoButtons[i].isHeld ) { |
316 | videoButtons[i].isHeld = FALSE; | 316 | videoButtons[i].isHeld = FALSE; |
317 | toggleButton(i); | 317 | toggleButton(i); |
318 | } | 318 | } |
319 | } else { | 319 | } else { |
320 | 320 | ||
321 | if ( videoButtons[i].isHeld ) { | 321 | if ( videoButtons[i].isHeld ) { |
322 | videoButtons[i].isHeld = FALSE; | 322 | videoButtons[i].isHeld = FALSE; |
323 | if ( !videoButtons[i].isToggle ) { | 323 | if ( !videoButtons[i].isToggle ) { |
324 | setToggleButton( i, FALSE ); | 324 | setToggleButton( i, FALSE ); |
325 | } | 325 | } |
326 | 326 | ||
327 | switch(i) { | 327 | switch(i) { |
328 | 328 | ||
329 | case VideoPlay: { | 329 | case VideoPlay: { |
330 | if( mediaPlayerState->isPaused ) { | 330 | if( mediaPlayerState->paused() ) { |
331 | setToggleButton( i, FALSE ); | 331 | setToggleButton( i, FALSE ); |
332 | mediaPlayerState->setPaused( FALSE ); | 332 | mediaPlayerState->setPaused( FALSE ); |
333 | return; | 333 | return; |
334 | } else if( !mediaPlayerState->isPaused ) { | 334 | } else if( !mediaPlayerState->paused() ) { |
335 | setToggleButton( i, TRUE ); | 335 | setToggleButton( i, TRUE ); |
336 | mediaPlayerState->setPaused( TRUE ); | 336 | mediaPlayerState->setPaused( TRUE ); |
337 | return; | 337 | return; |
338 | } else { | 338 | } else { |
339 | return; | 339 | return; |
340 | } | 340 | } |
341 | } | 341 | } |
342 | 342 | ||
343 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; | 343 | case VideoStop: mediaPlayerState->setPlaying( FALSE ); return; |
344 | case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; | 344 | case VideoNext: if(playList->whichList() ==0) mediaPlayerState->setNext(); return; |
345 | case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return; | 345 | case VideoPrevious: if(playList->whichList() ==0) mediaPlayerState->setPrev(); return; |
346 | case VideoVolUp: emit moreReleased(); return; | 346 | case VideoVolUp: emit moreReleased(); return; |
347 | case VideoVolDown: emit lessReleased(); return; | 347 | case VideoVolDown: emit lessReleased(); return; |
348 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 348 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
349 | } | 349 | } |
350 | } | 350 | } |
351 | } | 351 | } |
352 | } | 352 | } |
353 | } | 353 | } |
354 | 354 | ||
355 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { | 355 | void VideoWidget::mousePressEvent( QMouseEvent *event ) { |
356 | mouseMoveEvent( event ); | 356 | mouseMoveEvent( event ); |
357 | } | 357 | } |
358 | 358 | ||
359 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 359 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
360 | if ( mediaPlayerState->fullscreen() ) { | 360 | if ( mediaPlayerState->fullscreen() ) { |
361 | mediaPlayerState->setFullscreen( FALSE ); | 361 | mediaPlayerState->setFullscreen( FALSE ); |
362 | makeVisible(); | 362 | makeVisible(); |
363 | } | 363 | } |
364 | mouseMoveEvent( event ); | 364 | mouseMoveEvent( event ); |
365 | } | 365 | } |
366 | 366 | ||
367 | void VideoWidget::showEvent( QShowEvent* ) { | 367 | void VideoWidget::showEvent( QShowEvent* ) { |
368 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 368 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
369 | mouseMoveEvent( &event ); | 369 | mouseMoveEvent( &event ); |
370 | } | 370 | } |
371 | 371 | ||
372 | 372 | ||
373 | void VideoWidget::backToNormal() { | 373 | void VideoWidget::backToNormal() { |
374 | mediaPlayerState->setFullscreen( FALSE ); | 374 | mediaPlayerState->setFullscreen( FALSE ); |
375 | makeVisible(); | 375 | makeVisible(); |
376 | } | 376 | } |
377 | 377 | ||
378 | void VideoWidget::makeVisible() { | 378 | void VideoWidget::makeVisible() { |
379 | if ( mediaPlayerState->fullscreen() ) { | 379 | if ( mediaPlayerState->fullscreen() ) { |
380 | setBackgroundMode( QWidget::NoBackground ); | 380 | setBackgroundMode( QWidget::NoBackground ); |
381 | showFullScreen(); | 381 | showFullScreen(); |
382 | resize( qApp->desktop()->size() ); | 382 | resize( qApp->desktop()->size() ); |
383 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); | 383 | videoFrame-> setGeometry ( 0, 0, width ( ), height ( )); |
384 | 384 | ||
385 | slider->hide(); | 385 | slider->hide(); |
386 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 386 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
387 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 387 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
388 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 388 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
389 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 389 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
390 | 390 | ||
391 | } else { | 391 | } else { |
392 | showNormal(); | 392 | showNormal(); |
393 | showMaximized(); | 393 | showMaximized(); |
394 | setBackgroundPixmap( *pixBg ); | 394 | setBackgroundPixmap( *pixBg ); |
395 | QWidget *d = QApplication::desktop(); | 395 | QWidget *d = QApplication::desktop(); |
396 | int w = d->width(); | 396 | int w = d->width(); |
397 | int h = d->height(); | 397 | int h = d->height(); |
398 | 398 | ||
399 | if(w>h) { | 399 | if(w>h) { |
400 | int newW=(w/2)-(246/2); //this will only work with 320x240 | 400 | int newW=(w/2)-(246/2); //this will only work with 320x240 |
401 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); | 401 | videoFrame->setGeometry( QRect( newW, 4, 240, 170 ) ); |
402 | } else { | 402 | } else { |
403 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); | 403 | videoFrame->setGeometry( QRect( 0, 30, 240, 170 ) ); |
404 | } | 404 | } |
405 | 405 | ||
406 | if ( !mediaPlayerState->seekable() ) { | 406 | if ( !mediaPlayerState->seekable() ) { |
407 | if( !slider->isHidden()) { | 407 | if( !slider->isHidden()) { |
408 | slider->hide(); | 408 | slider->hide(); |
409 | } | 409 | } |
410 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 410 | disconnect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
411 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 411 | disconnect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
412 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 412 | disconnect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
413 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 413 | disconnect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
414 | } else { | 414 | } else { |
415 | slider->show(); | 415 | slider->show(); |
416 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 416 | connect( mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
417 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 417 | connect( mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
418 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 418 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
419 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 419 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
420 | } | 420 | } |
421 | } | 421 | } |
422 | } | 422 | } |
423 | 423 | ||
424 | 424 | ||
425 | 425 | ||
426 | 426 | ||
427 | void VideoWidget::paintEvent( QPaintEvent * pe) { | 427 | void VideoWidget::paintEvent( QPaintEvent * pe) { |
428 | QPainter p( this ); | 428 | QPainter p( this ); |
429 | 429 | ||
430 | if ( mediaPlayerState->fullscreen() ) { | 430 | if ( mediaPlayerState->fullscreen() ) { |
431 | // Clear the background | 431 | // Clear the background |
432 | p.setBrush( QBrush( Qt::black ) ); | 432 | p.setBrush( QBrush( Qt::black ) ); |
433 | } else { | 433 | } else { |
434 | if ( !pe->erased() ) { | 434 | if ( !pe->erased() ) { |
435 | // Combine with background and double buffer | 435 | // Combine with background and double buffer |
436 | QPixmap pix( pe->rect().size() ); | 436 | QPixmap pix( pe->rect().size() ); |
437 | QPainter p( &pix ); | 437 | QPainter p( &pix ); |
438 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 438 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
439 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 439 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
440 | for ( int i = 0; i < numVButtons; i++ ) { | 440 | for ( int i = 0; i < numVButtons; i++ ) { |
441 | paintButton( &p, i ); | 441 | paintButton( &p, i ); |
442 | } | 442 | } |
443 | QPainter p2( this ); | 443 | QPainter p2( this ); |
444 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 444 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
445 | } else { | 445 | } else { |
446 | QPainter p( this ); | 446 | QPainter p( this ); |
447 | for ( int i = 0; i < numVButtons; i++ ) | 447 | for ( int i = 0; i < numVButtons; i++ ) |
448 | paintButton( &p, i ); | 448 | paintButton( &p, i ); |
449 | } | 449 | } |
450 | //slider->repaint( TRUE ); | 450 | //slider->repaint( TRUE ); |
451 | } | 451 | } |
452 | } | 452 | } |
453 | 453 | ||
454 | 454 | ||
455 | void VideoWidget::closeEvent( QCloseEvent* ) { | 455 | void VideoWidget::closeEvent( QCloseEvent* ) { |
456 | mediaPlayerState->setList(); | 456 | mediaPlayerState->setList(); |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { | 460 | void VideoWidget::keyReleaseEvent( QKeyEvent *e) { |
461 | switch ( e->key() ) { | 461 | switch ( e->key() ) { |
462 | ////////////////////////////// Zaurus keys | 462 | ////////////////////////////// Zaurus keys |
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp index c46994a..f6289d7 100644 --- a/noncore/multimedia/opieplayer2/xinecontrol.cpp +++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp | |||
@@ -55,205 +55,205 @@ XineControl::XineControl( QObject *parent, const char *name ) | |||
55 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 55 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
56 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); | 56 | connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); |
57 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); | 57 | connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); |
58 | 58 | ||
59 | disabledSuspendScreenSaver = FALSE; | 59 | disabledSuspendScreenSaver = FALSE; |
60 | } | 60 | } |
61 | 61 | ||
62 | XineControl::~XineControl() { | 62 | XineControl::~XineControl() { |
63 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 63 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
64 | if ( disabledSuspendScreenSaver ) { | 64 | if ( disabledSuspendScreenSaver ) { |
65 | disabledSuspendScreenSaver = FALSE; | 65 | disabledSuspendScreenSaver = FALSE; |
66 | // Re-enable the suspend mode | 66 | // Re-enable the suspend mode |
67 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 67 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
68 | } | 68 | } |
69 | #endif | 69 | #endif |
70 | delete libXine; | 70 | delete libXine; |
71 | } | 71 | } |
72 | 72 | ||
73 | void XineControl::play( const QString& fileName ) { | 73 | void XineControl::play( const QString& fileName ) { |
74 | hasVideoChannel = FALSE; | 74 | hasVideoChannel = FALSE; |
75 | hasAudioChannel = FALSE; | 75 | hasAudioChannel = FALSE; |
76 | m_fileName = fileName; | 76 | m_fileName = fileName; |
77 | 77 | ||
78 | qDebug("<<FILENAME: " + fileName + ">>>>"); | 78 | qDebug("<<FILENAME: " + fileName + ">>>>"); |
79 | 79 | ||
80 | if ( !libXine->play( fileName, 0, 0 ) ) { | 80 | if ( !libXine->play( fileName, 0, 0 ) ) { |
81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); | 81 | QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); |
82 | // toggle stop so the the play button is reset | 82 | // toggle stop so the the play button is reset |
83 | mediaPlayerState->setPlaying( false ); | 83 | mediaPlayerState->setPlaying( false ); |
84 | return; | 84 | return; |
85 | } | 85 | } |
86 | mediaPlayerState->setPlaying( true ); | 86 | mediaPlayerState->setPlaying( true ); |
87 | 87 | ||
88 | char whichGui; | 88 | char whichGui; |
89 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); | 89 | // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); |
90 | if ( !libXine->hasVideo() ) { | 90 | if ( !libXine->hasVideo() ) { |
91 | whichGui = 'a'; | 91 | whichGui = 'a'; |
92 | qDebug("HAS AUDIO"); | 92 | qDebug("HAS AUDIO"); |
93 | libXine->setShowVideo( false ); | 93 | libXine->setShowVideo( false ); |
94 | hasAudioChannel = TRUE; | 94 | hasAudioChannel = TRUE; |
95 | } else { | 95 | } else { |
96 | whichGui = 'v'; | 96 | whichGui = 'v'; |
97 | qDebug("HAS VIDEO"); | 97 | qDebug("HAS VIDEO"); |
98 | libXine->setShowVideo( true ); | 98 | libXine->setShowVideo( true ); |
99 | hasVideoChannel = TRUE; | 99 | hasVideoChannel = TRUE; |
100 | } | 100 | } |
101 | // determine if slider is shown | 101 | // determine if slider is shown |
102 | mediaPlayerState->setIsSeekable( libXine->isSeekable() ); | 102 | mediaPlayerState->setIsSeekable( libXine->isSeekable() ); |
103 | 103 | ||
104 | // which gui (video / audio) | 104 | // which gui (video / audio) |
105 | mediaPlayerState->setView( whichGui ); | 105 | mediaPlayerState->setView( whichGui ); |
106 | 106 | ||
107 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 107 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
108 | if ( !disabledSuspendScreenSaver ) { | 108 | if ( !disabledSuspendScreenSaver ) { |
109 | disabledSuspendScreenSaver = TRUE; | 109 | disabledSuspendScreenSaver = TRUE; |
110 | // Stop the screen from blanking and power saving state | 110 | // Stop the screen from blanking and power saving state |
111 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) | 111 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) |
112 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); | 112 | << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); |
113 | } | 113 | } |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | length(); | 116 | length(); |
117 | position(); | 117 | position(); |
118 | } | 118 | } |
119 | 119 | ||
120 | void XineControl::nextMedia() { | 120 | void XineControl::nextMedia() { |
121 | mediaPlayerState->setNext(); | 121 | mediaPlayerState->setNext(); |
122 | } | 122 | } |
123 | 123 | ||
124 | void XineControl::setGamma( int value ) { | 124 | void XineControl::setGamma( int value ) { |
125 | libXine->setGamma( value ); | 125 | libXine->setGamma( value ); |
126 | } | 126 | } |
127 | 127 | ||
128 | void XineControl::stop( bool isSet ) { | 128 | void XineControl::stop( bool isSet ) { |
129 | if ( !isSet ) { | 129 | if ( !isSet ) { |
130 | libXine->stop(); | 130 | libXine->stop(); |
131 | 131 | ||
132 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 132 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
133 | if ( disabledSuspendScreenSaver ) { | 133 | if ( disabledSuspendScreenSaver ) { |
134 | disabledSuspendScreenSaver = FALSE; | 134 | disabledSuspendScreenSaver = FALSE; |
135 | // Re-enable the suspend mode | 135 | // Re-enable the suspend mode |
136 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; | 136 | QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; |
137 | } | 137 | } |
138 | #endif | 138 | #endif |
139 | } | 139 | } |
140 | } | 140 | } |
141 | 141 | ||
142 | /** | 142 | /** |
143 | * Pause playback | 143 | * Pause playback |
144 | * @isSet | 144 | * @isSet |
145 | */ | 145 | */ |
146 | void XineControl::pause( bool isSet) { | 146 | void XineControl::pause( bool isSet) { |
147 | if ( isSet ) { | 147 | if ( isSet ) { |
148 | libXine->pause(); | 148 | libXine->pause(); |
149 | } else { | 149 | } else { |
150 | libXine->play( m_fileName, 0, m_currentTime ); | 150 | libXine->play( m_fileName, 0, m_currentTime ); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | /** | 155 | /** |
156 | * get current time in playback | 156 | * get current time in playback |
157 | */ | 157 | */ |
158 | long XineControl::currentTime() { | 158 | long XineControl::currentTime() { |
159 | // todo: jede sekunde überprüfen | 159 | // todo: jede sekunde überprüfen |
160 | m_currentTime = libXine->currentTime(); | 160 | m_currentTime = libXine->currentTime(); |
161 | return m_currentTime; | 161 | return m_currentTime; |
162 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); | 162 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); |
163 | } | 163 | } |
164 | 164 | ||
165 | /** | 165 | /** |
166 | * Set the length of the media file | 166 | * Set the length of the media file |
167 | */ | 167 | */ |
168 | void XineControl::length() { | 168 | void XineControl::length() { |
169 | m_length = libXine->length(); | 169 | m_length = libXine->length(); |
170 | mediaPlayerState->setLength( m_length ); | 170 | mediaPlayerState->setLength( m_length ); |
171 | } | 171 | } |
172 | 172 | ||
173 | 173 | ||
174 | /** | 174 | /** |
175 | * Reports the position the xine backend is at right now | 175 | * Reports the position the xine backend is at right now |
176 | * @return long the postion in seconds | 176 | * @return long the postion in seconds |
177 | */ | 177 | */ |
178 | long XineControl::position() { | 178 | long XineControl::position() { |
179 | m_position = ( currentTime() ); | 179 | m_position = ( currentTime() ); |
180 | mediaPlayerState->updatePosition( m_position ); | 180 | mediaPlayerState->updatePosition( m_position ); |
181 | long emitPos = (long)m_position; | 181 | long emitPos = (long)m_position; |
182 | emit positionChanged( emitPos ); | 182 | emit positionChanged( emitPos ); |
183 | if( mediaPlayerState->isPlaying ) { | 183 | if( mediaPlayerState->playing() ) { |
184 | // needs to be stopped the media is stopped | 184 | // needs to be stopped the media is stopped |
185 | QTimer::singleShot( 1000, this, SLOT( position() ) ); | 185 | QTimer::singleShot( 1000, this, SLOT( position() ) ); |
186 | } | 186 | } |
187 | // qDebug("POSITION : %d", m_position); | 187 | // qDebug("POSITION : %d", m_position); |
188 | return m_position; | 188 | return m_position; |
189 | } | 189 | } |
190 | 190 | ||
191 | /** | 191 | /** |
192 | * Set videoplayback to fullscreen | 192 | * Set videoplayback to fullscreen |
193 | * @param isSet | 193 | * @param isSet |
194 | */ | 194 | */ |
195 | void XineControl::setFullscreen( bool isSet ) { | 195 | void XineControl::setFullscreen( bool isSet ) { |
196 | libXine->showVideoFullScreen( isSet ); | 196 | libXine->showVideoFullScreen( isSet ); |
197 | } | 197 | } |
198 | 198 | ||
199 | 199 | ||
200 | QString XineControl::getMetaInfo() { | 200 | QString XineControl::getMetaInfo() { |
201 | 201 | ||
202 | QString returnString; | 202 | QString returnString; |
203 | 203 | ||
204 | if ( !libXine->metaInfo( 0 ).isEmpty() ) { | 204 | if ( !libXine->metaInfo( 0 ).isEmpty() ) { |
205 | returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); | 205 | returnString += tr( " Title: " + libXine->metaInfo( 0 ) ); |
206 | } | 206 | } |
207 | 207 | ||
208 | if ( !libXine->metaInfo( 1 ).isEmpty() ) { | 208 | if ( !libXine->metaInfo( 1 ).isEmpty() ) { |
209 | returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); | 209 | returnString += tr( " Comment: " + libXine->metaInfo( 1 ) ); |
210 | } | 210 | } |
211 | 211 | ||
212 | if ( !libXine->metaInfo( 2 ).isEmpty() ) { | 212 | if ( !libXine->metaInfo( 2 ).isEmpty() ) { |
213 | returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); | 213 | returnString += tr( " Artist: " + libXine->metaInfo( 2 ) ); |
214 | } | 214 | } |
215 | 215 | ||
216 | if ( !libXine->metaInfo( 3 ).isEmpty() ) { | 216 | if ( !libXine->metaInfo( 3 ).isEmpty() ) { |
217 | returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); | 217 | returnString += tr( " Genre: " + libXine->metaInfo( 3 ) ); |
218 | } | 218 | } |
219 | 219 | ||
220 | if ( !libXine->metaInfo( 4 ).isEmpty() ) { | 220 | if ( !libXine->metaInfo( 4 ).isEmpty() ) { |
221 | returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); | 221 | returnString += tr( " Album: " + libXine->metaInfo( 4 ) ); |
222 | } | 222 | } |
223 | 223 | ||
224 | if ( !libXine->metaInfo( 5 ).isEmpty() ) { | 224 | if ( !libXine->metaInfo( 5 ).isEmpty() ) { |
225 | returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); | 225 | returnString += tr( " Year: " + libXine->metaInfo( 5 ) ); |
226 | } | 226 | } |
227 | return returnString; | 227 | return returnString; |
228 | } | 228 | } |
229 | 229 | ||
230 | QString XineControl::getErrorCode() { | 230 | QString XineControl::getErrorCode() { |
231 | 231 | ||
232 | int errorCode = libXine->error(); | 232 | int errorCode = libXine->error(); |
233 | 233 | ||
234 | qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); | 234 | qDebug( QString("ERRORCODE: %1 ").arg(errorCode) ); |
235 | 235 | ||
236 | if ( errorCode == 1 ) { | 236 | if ( errorCode == 1 ) { |
237 | return tr( "No input plugin found for this media type" ); | 237 | return tr( "No input plugin found for this media type" ); |
238 | } else if ( errorCode == 2 ) { | 238 | } else if ( errorCode == 2 ) { |
239 | return tr( "No demux plugin found for this media type" ); | 239 | return tr( "No demux plugin found for this media type" ); |
240 | } else if ( errorCode == 3 ) { | 240 | } else if ( errorCode == 3 ) { |
241 | return tr( "Demuxing failed for this media type" ); | 241 | return tr( "Demuxing failed for this media type" ); |
242 | } else if ( errorCode == 4 ) { | 242 | } else if ( errorCode == 4 ) { |
243 | return tr( "Malformed MRL" ); | 243 | return tr( "Malformed MRL" ); |
244 | } else { | 244 | } else { |
245 | return tr( "Some other error" ); | 245 | return tr( "Some other error" ); |
246 | } | 246 | } |
247 | } | 247 | } |
248 | 248 | ||
249 | /** | 249 | /** |
250 | * Seek to a position in the track | 250 | * Seek to a position in the track |
251 | * @param second the second to jump to | 251 | * @param second the second to jump to |
252 | */ | 252 | */ |
253 | void XineControl::seekTo( long second ) { | 253 | void XineControl::seekTo( long second ) { |
254 | libXine->seekTo( (int)second ); | 254 | libXine->seekTo( (int)second ); |
255 | } | 255 | } |
256 | 256 | ||
257 | void XineControl::videoResized ( const QSize &s ) { | 257 | void XineControl::videoResized ( const QSize &s ) { |
258 | libXine->resize( s ); | 258 | libXine->resize( s ); |
259 | } | 259 | } |