author | harlekin <harlekin> | 2002-08-16 13:39:04 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-08-16 13:39:04 (UTC) |
commit | 10006a500ed73c7640572b05d9b403e5739bfa0c (patch) (unidiff) | |
tree | 870535988a6f603e9087e770778503d94baabfd6 | |
parent | 5144bf5607a246441f5b37dd0bbb9564017ce017 (diff) | |
download | opie-10006a500ed73c7640572b05d9b403e5739bfa0c.zip opie-10006a500ed73c7640572b05d9b403e5739bfa0c.tar.gz opie-10006a500ed73c7640572b05d9b403e5739bfa0c.tar.bz2 |
playing arround with blank
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 3 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 49 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.h | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 5 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 35 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 10 |
7 files changed, 58 insertions, 65 deletions
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 442864f..56203e0 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -443,146 +443,147 @@ void AudioWidget::mouseMoveEvent( QMouseEvent *event ) { | |||
443 | else if ( !isOnButton && audioButtons[i].isHeld ) { | 443 | else if ( !isOnButton && audioButtons[i].isHeld ) { |
444 | audioButtons[i].isHeld = FALSE; | 444 | audioButtons[i].isHeld = FALSE; |
445 | toggleButton(i); | 445 | toggleButton(i); |
446 | } | 446 | } |
447 | } else { | 447 | } else { |
448 | if ( audioButtons[i].isHeld ) { | 448 | if ( audioButtons[i].isHeld ) { |
449 | audioButtons[i].isHeld = FALSE; | 449 | audioButtons[i].isHeld = FALSE; |
450 | if ( !audioButtons[i].isToggle ) { | 450 | if ( !audioButtons[i].isToggle ) { |
451 | setToggleButton( i, FALSE ); | 451 | setToggleButton( i, FALSE ); |
452 | } | 452 | } |
453 | switch (i) { | 453 | switch (i) { |
454 | case AudioPlay: | 454 | case AudioPlay: |
455 | if( mediaPlayerState->isPaused ) { | 455 | if( mediaPlayerState->isPaused ) { |
456 | // setToggleButton( i, FALSE ); | 456 | // setToggleButton( i, FALSE ); |
457 | mediaPlayerState->setPaused( FALSE ); | 457 | mediaPlayerState->setPaused( FALSE ); |
458 | return; | 458 | return; |
459 | } else if( !mediaPlayerState->isPaused ) { | 459 | } else if( !mediaPlayerState->isPaused ) { |
460 | // setToggleButton( i, TRUE ); | 460 | // setToggleButton( i, TRUE ); |
461 | mediaPlayerState->setPaused( TRUE ); | 461 | mediaPlayerState->setPaused( TRUE ); |
462 | return; | 462 | return; |
463 | } else { | 463 | } else { |
464 | // setToggleButton( i, TRUE ); | 464 | // setToggleButton( i, TRUE ); |
465 | // mediaPlayerState->setPlaying( videoButtons[i].isDown ); | 465 | // mediaPlayerState->setPlaying( videoButtons[i].isDown ); |
466 | } | 466 | } |
467 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; | 467 | case AudioStop: mediaPlayerState->setPlaying(FALSE); return; |
468 | case AudioNext: mediaPlayerState->setNext(); return; | 468 | case AudioNext: mediaPlayerState->setNext(); return; |
469 | case AudioPrevious: mediaPlayerState->setPrev(); return; | 469 | case AudioPrevious: mediaPlayerState->setPrev(); return; |
470 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; | 470 | case AudioLoop: mediaPlayerState->setLooping(audioButtons[i].isDown); return; |
471 | case AudioVolumeUp: emit moreReleased(); return; | 471 | case AudioVolumeUp: emit moreReleased(); return; |
472 | case AudioVolumeDown: emit lessReleased(); return; | 472 | case AudioVolumeDown: emit lessReleased(); return; |
473 | case AudioPlayList: mediaPlayerState->setList(); return; | 473 | case AudioPlayList: mediaPlayerState->setList(); return; |
474 | case AudioForward: emit forwardReleased(); return; | 474 | case AudioForward: emit forwardReleased(); return; |
475 | case AudioBack: emit backReleased(); return; | 475 | case AudioBack: emit backReleased(); return; |
476 | } | 476 | } |
477 | } | 477 | } |
478 | } | 478 | } |
479 | } | 479 | } |
480 | } | 480 | } |
481 | 481 | ||
482 | 482 | ||
483 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { | 483 | void AudioWidget::mousePressEvent( QMouseEvent *event ) { |
484 | mouseMoveEvent( event ); | 484 | mouseMoveEvent( event ); |
485 | } | 485 | } |
486 | 486 | ||
487 | 487 | ||
488 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { | 488 | void AudioWidget::mouseReleaseEvent( QMouseEvent *event ) { |
489 | mouseMoveEvent( event ); | 489 | mouseMoveEvent( event ); |
490 | } | 490 | } |
491 | 491 | ||
492 | 492 | ||
493 | void AudioWidget::showEvent( QShowEvent* ) { | 493 | void AudioWidget::showEvent( QShowEvent* ) { |
494 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); | 494 | QMouseEvent event( QEvent::MouseMove, QPoint( 0, 0 ), 0, 0 ); |
495 | mouseMoveEvent( &event ); | 495 | mouseMoveEvent( &event ); |
496 | } | 496 | } |
497 | 497 | ||
498 | 498 | ||
499 | void AudioWidget::closeEvent( QCloseEvent* ) { | 499 | void AudioWidget::closeEvent( QCloseEvent* ) { |
500 | mediaPlayerState->setList(); | 500 | mediaPlayerState->setList(); |
501 | } | 501 | } |
502 | 502 | ||
503 | 503 | ||
504 | void AudioWidget::paintEvent( QPaintEvent * pe) { | 504 | void AudioWidget::paintEvent( QPaintEvent * pe) { |
505 | if ( !pe->erased() ) { | 505 | if ( !pe->erased() ) { |
506 | // Combine with background and double buffer | 506 | // Combine with background and double buffer |
507 | QPixmap pix( pe->rect().size() ); | 507 | QPixmap pix( pe->rect().size() ); |
508 | QPainter p( &pix ); | 508 | QPainter p( &pix ); |
509 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); | 509 | p.translate( -pe->rect().topLeft().x(), -pe->rect().topLeft().y() ); |
510 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); | 510 | p.drawTiledPixmap( pe->rect(), *pixBg, pe->rect().topLeft() ); |
511 | for ( int i = 0; i < numButtons; i++ ) | 511 | for ( int i = 0; i < numButtons; i++ ) |
512 | paintButton( &p, i ); | 512 | paintButton( &p, i ); |
513 | QPainter p2( this ); | 513 | QPainter p2( this ); |
514 | p2.drawPixmap( pe->rect().topLeft(), pix ); | 514 | p2.drawPixmap( pe->rect().topLeft(), pix ); |
515 | } else { | 515 | } else { |
516 | QPainter p( this ); | 516 | QPainter p( this ); |
517 | for ( int i = 0; i < numButtons; i++ ) | 517 | for ( int i = 0; i < numButtons; i++ ) |
518 | paintButton( &p, i ); | 518 | paintButton( &p, i ); |
519 | } | 519 | } |
520 | } | 520 | } |
521 | 521 | ||
522 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) | 522 | void AudioWidget::keyReleaseEvent( QKeyEvent *e) |
523 | { | 523 | { |
524 | switch ( e->key() ) { | 524 | switch ( e->key() ) { |
525 | ////////////////////////////// Zaurus keys | 525 | ////////////////////////////// Zaurus keys |
526 | case Key_Home: | 526 | case Key_Home: |
527 | break; | 527 | break; |
528 | case Key_F9: //activity | 528 | case Key_F9: //activity |
529 | hide(); | 529 | hide(); |
530 | // qDebug("Audio F9"); | 530 | // qDebug("Audio F9"); |
531 | break; | 531 | break; |
532 | case Key_F10: //contacts | 532 | case Key_F10: //contacts |
533 | break; | 533 | break; |
534 | case Key_F11: //menu | 534 | case Key_F11: //menu |
535 | break; | 535 | break; |
536 | case Key_F12: //home | 536 | case Key_F12: //home |
537 | break; | 537 | break; |
538 | case Key_F13: //mail | 538 | case Key_F13: //mail |
539 | mediaPlayerState->toggleBlank(); | ||
539 | break; | 540 | break; |
540 | case Key_Space: { | 541 | case Key_Space: { |
541 | if(mediaPlayerState->playing()) { | 542 | if(mediaPlayerState->playing()) { |
542 | // toggleButton(1); | 543 | // toggleButton(1); |
543 | mediaPlayerState->setPlaying(FALSE); | 544 | mediaPlayerState->setPlaying(FALSE); |
544 | // toggleButton(1); | 545 | // toggleButton(1); |
545 | } else { | 546 | } else { |
546 | // toggleButton(0); | 547 | // toggleButton(0); |
547 | mediaPlayerState->setPlaying(TRUE); | 548 | mediaPlayerState->setPlaying(TRUE); |
548 | // toggleButton(0); | 549 | // toggleButton(0); |
549 | } | 550 | } |
550 | } | 551 | } |
551 | break; | 552 | break; |
552 | case Key_Down: | 553 | case Key_Down: |
553 | // toggleButton(6); | 554 | // toggleButton(6); |
554 | emit lessClicked(); | 555 | emit lessClicked(); |
555 | emit lessReleased(); | 556 | emit lessReleased(); |
556 | // toggleButton(6); | 557 | // toggleButton(6); |
557 | break; | 558 | break; |
558 | case Key_Up: | 559 | case Key_Up: |
559 | // toggleButton(5); | 560 | // toggleButton(5); |
560 | emit moreClicked(); | 561 | emit moreClicked(); |
561 | emit moreReleased(); | 562 | emit moreReleased(); |
562 | // toggleButton(5); | 563 | // toggleButton(5); |
563 | break; | 564 | break; |
564 | case Key_Right: | 565 | case Key_Right: |
565 | // toggleButton(3); | 566 | // toggleButton(3); |
566 | mediaPlayerState->setNext(); | 567 | mediaPlayerState->setNext(); |
567 | // toggleButton(3); | 568 | // toggleButton(3); |
568 | break; | 569 | break; |
569 | case Key_Left: | 570 | case Key_Left: |
570 | // toggleButton(4); | 571 | // toggleButton(4); |
571 | mediaPlayerState->setPrev(); | 572 | mediaPlayerState->setPrev(); |
572 | // toggleButton(4); | 573 | // toggleButton(4); |
573 | break; | 574 | break; |
574 | case Key_Escape: { | 575 | case Key_Escape: { |
575 | #if defined(QT_QWS_IPAQ) | 576 | #if defined(QT_QWS_IPAQ) |
576 | if( mediaPlayerState->isPaused ) { | 577 | if( mediaPlayerState->isPaused ) { |
577 | setToggleButton( i, FALSE ); | 578 | setToggleButton( i, FALSE ); |
578 | mediaPlayerState->setPaused( FALSE ); | 579 | mediaPlayerState->setPaused( FALSE ); |
579 | } else if( !mediaPlayerState->isPaused ) { | 580 | } else if( !mediaPlayerState->isPaused ) { |
580 | setToggleButton( i, TRUE ); | 581 | setToggleButton( i, TRUE ); |
581 | mediaPlayerState->setPaused( TRUE ); | 582 | mediaPlayerState->setPaused( TRUE ); |
582 | } | 583 | } |
583 | #endif | 584 | #endif |
584 | } | 585 | } |
585 | break; | 586 | break; |
586 | 587 | ||
587 | }; | 588 | }; |
588 | } | 589 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 8dadf96..858b51f 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -1,283 +1,294 @@ | |||
1 | #include <qpe/qpeapplication.h> | 1 | #include <qpe/qpeapplication.h> |
2 | #include <qpe/qlibrary.h> | 2 | #include <qpe/qlibrary.h> |
3 | #include <qpe/resource.h> | 3 | #include <qpe/resource.h> |
4 | #include <qpe/config.h> | 4 | #include <qpe/config.h> |
5 | #include <qpe/qcopenvelope_qws.h> | ||
5 | 6 | ||
6 | #include <qmainwindow.h> | 7 | #include <qmainwindow.h> |
7 | #include <qmessagebox.h> | 8 | #include <qmessagebox.h> |
8 | #include <qwidgetstack.h> | 9 | #include <qwidgetstack.h> |
9 | #include <qfile.h> | 10 | #include <qfile.h> |
10 | 11 | ||
11 | #include "mediaplayer.h" | 12 | #include "mediaplayer.h" |
12 | #include "playlistwidget.h" | 13 | #include "playlistwidget.h" |
13 | #include "audiowidget.h" | 14 | #include "audiowidget.h" |
14 | #include "videowidget.h" | 15 | #include "videowidget.h" |
15 | #include "volumecontrol.h" | 16 | #include "volumecontrol.h" |
16 | 17 | ||
17 | #include "mediaplayerstate.h" | 18 | #include "mediaplayerstate.h" |
18 | 19 | ||
20 | // for setBacklight() | ||
21 | #include <linux/fb.h> | ||
22 | #include <sys/file.h> | ||
23 | #include <sys/ioctl.h> | ||
19 | 24 | ||
20 | 25 | ||
21 | extern AudioWidget *audioUI; | 26 | extern AudioWidget *audioUI; |
22 | extern VideoWidget *videoUI; | 27 | extern VideoWidget *videoUI; |
23 | extern PlayListWidget *playList; | 28 | extern PlayListWidget *playList; |
24 | extern MediaPlayerState *mediaPlayerState; | 29 | extern MediaPlayerState *mediaPlayerState; |
25 | 30 | ||
26 | 31 | ||
27 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | 32 | MediaPlayer::MediaPlayer( QObject *parent, const char *name ) |
28 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 33 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { |
29 | 34 | ||
30 | 35 | ||
31 | xineControl = new XineControl(); | 36 | // xineControl = new XineControl(); |
32 | // QPEApplication::grabKeyboard(); // EVIL | 37 | // QPEApplication::grabKeyboard(); // EVIL |
33 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 38 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
34 | 39 | ||
35 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); | 40 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); |
36 | 41 | ||
37 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); | 42 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); |
38 | 43 | ||
39 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); | 44 | connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); |
40 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); | 45 | connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); |
46 | connect( mediaPlayerState, SIGNAL( blankToggled( bool ) ), this, SLOT ( blank( bool ) ) ); | ||
41 | 47 | ||
42 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 48 | connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
43 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 49 | connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
44 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 50 | connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
45 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 51 | connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
46 | 52 | ||
47 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); | 53 | connect( videoUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) ); |
48 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); | 54 | connect( videoUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) ); |
49 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); | 55 | connect( videoUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) ); |
50 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); | 56 | connect( videoUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) ); |
51 | 57 | ||
52 | volControl = new VolumeControl; | 58 | volControl = new VolumeControl; |
53 | 59 | xineControl = new XineControl(); | |
54 | } | 60 | } |
55 | 61 | ||
56 | MediaPlayer::~MediaPlayer() { | 62 | MediaPlayer::~MediaPlayer() { |
57 | delete xineControl; | 63 | delete xineControl; |
58 | delete volControl; | 64 | delete volControl; |
59 | } | 65 | } |
60 | 66 | ||
61 | void MediaPlayer::pauseCheck( bool b ) { | 67 | void MediaPlayer::pauseCheck( bool b ) { |
62 | if ( b && !mediaPlayerState->playing() ) { | 68 | if ( b && !mediaPlayerState->playing() ) { |
63 | mediaPlayerState->setPaused( FALSE ); | 69 | mediaPlayerState->setPaused( FALSE ); |
64 | } | 70 | } |
65 | } | 71 | } |
66 | 72 | ||
67 | void MediaPlayer::play() { | 73 | void MediaPlayer::play() { |
68 | mediaPlayerState->setPlaying( FALSE ); | 74 | mediaPlayerState->setPlaying( FALSE ); |
69 | mediaPlayerState->setPlaying( TRUE ); | 75 | mediaPlayerState->setPlaying( TRUE ); |
70 | } | 76 | } |
71 | 77 | ||
72 | void MediaPlayer::setPlaying( bool play ) { | 78 | void MediaPlayer::setPlaying( bool play ) { |
73 | if ( !play ) { | 79 | if ( !play ) { |
74 | // mediaPlayerState->setPaused( FALSE ); | ||
75 | return; | 80 | return; |
76 | } | 81 | } |
77 | 82 | ||
78 | if ( mediaPlayerState->paused() ) { | 83 | if ( mediaPlayerState->paused() ) { |
79 | mediaPlayerState->setPaused( FALSE ); | 84 | mediaPlayerState->setPaused( FALSE ); |
80 | return; | 85 | return; |
81 | } | 86 | } |
82 | 87 | ||
83 | const DocLnk *playListCurrent = playList->current(); | 88 | const DocLnk *playListCurrent = playList->current(); |
84 | if ( playListCurrent != NULL ) { | 89 | if ( playListCurrent != NULL ) { |
85 | currentFile = playListCurrent; | 90 | currentFile = playListCurrent; |
86 | } | 91 | } |
87 | 92 | ||
88 | xineControl->play( currentFile->file() ); | 93 | xineControl->play( currentFile->file() ); |
89 | 94 | ||
90 | xineControl->length(); | 95 | xineControl->length(); |
91 | long seconds = mediaPlayerState->length();// | 96 | long seconds = mediaPlayerState->length();// |
92 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 97 | QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
93 | qDebug(time); | 98 | qDebug(time); |
94 | 99 | ||
95 | QString tickerText; | 100 | QString tickerText; |
96 | if( currentFile->file().left(4) == "http" ) | 101 | if( currentFile->file().left(4) == "http" ) |
97 | tickerText= tr( " File: " ) + currentFile->name(); | 102 | tickerText= tr( " File: " ) + currentFile->name(); |
98 | else | 103 | else |
99 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; | 104 | tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; |
100 | 105 | ||
101 | // QString fileInfo = mediaPlayerState->curDecoder()->fileInfo(); | ||
102 | |||
103 | // if ( !fileInfo.isEmpty() ) | ||
104 | // tickerText += ", " + fileInfo; | ||
105 | // audioUI->setTickerText( tickerText + "." ); | ||
106 | |||
107 | audioUI->setTickerText( currentFile->file( ) ); | 106 | audioUI->setTickerText( currentFile->file( ) ); |
108 | 107 | ||
109 | } | 108 | } |
110 | 109 | ||
111 | 110 | ||
112 | void MediaPlayer::prev() { | 111 | void MediaPlayer::prev() { |
113 | if ( playList->prev() ) { | 112 | if ( playList->prev() ) { |
114 | play(); | 113 | play(); |
115 | } else if ( mediaPlayerState->looping() ) { | 114 | } else if ( mediaPlayerState->looping() ) { |
116 | if ( playList->last() ) { | 115 | if ( playList->last() ) { |
117 | play(); | 116 | play(); |
118 | } | 117 | } |
119 | } else { | 118 | } else { |
120 | mediaPlayerState->setList(); | 119 | mediaPlayerState->setList(); |
121 | } | 120 | } |
122 | } | 121 | } |
123 | 122 | ||
124 | 123 | ||
125 | void MediaPlayer::next() { | 124 | void MediaPlayer::next() { |
126 | if ( playList->next() ) { | 125 | if ( playList->next() ) { |
127 | play(); | 126 | play(); |
128 | } else if ( mediaPlayerState->looping() ) { | 127 | } else if ( mediaPlayerState->looping() ) { |
129 | if ( playList->first() ) { | 128 | if ( playList->first() ) { |
130 | play(); | 129 | play(); |
131 | } | 130 | } |
132 | } else { | 131 | } else { |
133 | mediaPlayerState->setList(); | 132 | mediaPlayerState->setList(); |
134 | } | 133 | } |
135 | } | 134 | } |
136 | 135 | ||
137 | 136 | ||
138 | void MediaPlayer::startDecreasingVolume() { | 137 | void MediaPlayer::startDecreasingVolume() { |
139 | volumeDirection = -1; | 138 | volumeDirection = -1; |
140 | startTimer( 100 ); | 139 | startTimer( 100 ); |
141 | volControl->decVol(2); | 140 | volControl->decVol(2); |
142 | } | 141 | } |
143 | 142 | ||
144 | 143 | ||
145 | void MediaPlayer::startIncreasingVolume() { | 144 | void MediaPlayer::startIncreasingVolume() { |
146 | volumeDirection = +1; | 145 | volumeDirection = +1; |
147 | startTimer( 100 ); | 146 | startTimer( 100 ); |
148 | volControl->incVol(2); | 147 | volControl->incVol(2); |
149 | } | 148 | } |
150 | 149 | ||
151 | 150 | ||
152 | bool drawnOnScreenDisplay = FALSE; | 151 | bool drawnOnScreenDisplay = FALSE; |
153 | unsigned int onScreenDisplayVolume = 0; | 152 | unsigned int onScreenDisplayVolume = 0; |
154 | const int yoff = 110; | 153 | const int yoff = 110; |
155 | 154 | ||
156 | void MediaPlayer::stopChangingVolume() { | 155 | void MediaPlayer::stopChangingVolume() { |
157 | killTimers(); | 156 | killTimers(); |
158 | // Get rid of the on-screen display stuff | 157 | // Get rid of the on-screen display stuff |
159 | drawnOnScreenDisplay = FALSE; | 158 | drawnOnScreenDisplay = FALSE; |
160 | onScreenDisplayVolume = 0; | 159 | onScreenDisplayVolume = 0; |
161 | int w=0; | 160 | int w=0; |
162 | int h=0; | 161 | int h=0; |
163 | if( !xineControl->hasVideo()) { | 162 | if( !xineControl->hasVideo()) { |
164 | w = audioUI->width(); | 163 | w = audioUI->width(); |
165 | h = audioUI->height(); | 164 | h = audioUI->height(); |
166 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 165 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
167 | } else { | 166 | } else { |
168 | w = videoUI->width(); | 167 | w = videoUI->width(); |
169 | h = videoUI->height(); | 168 | h = videoUI->height(); |
170 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 169 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); |
171 | } | 170 | } |
172 | } | 171 | } |
173 | 172 | ||
174 | 173 | ||
175 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 174 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
176 | if ( volumeDirection == +1 ) { | 175 | if ( volumeDirection == +1 ) { |
177 | volControl->incVol(2); | 176 | volControl->incVol(2); |
178 | } else if ( volumeDirection == -1 ) { | 177 | } else if ( volumeDirection == -1 ) { |
179 | volControl->decVol(2); | 178 | volControl->decVol(2); |
180 | } | 179 | } |
181 | 180 | ||
182 | 181 | ||
183 | // TODO FIXME | 182 | // TODO FIXME |
184 | unsigned int v; | 183 | unsigned int v; |
185 | v = volControl->getVolume(); | 184 | v = volControl->getVolume(); |
186 | v = v / 10; | 185 | v = v / 10; |
187 | 186 | ||
188 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 187 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
189 | return; | 188 | return; |
190 | } | 189 | } |
191 | 190 | ||
192 | int w=0; int h=0; | 191 | int w=0; int h=0; |
193 | if( !xineControl->hasVideo()) { | 192 | if( !xineControl->hasVideo()) { |
194 | w = audioUI->width(); | 193 | w = audioUI->width(); |
195 | h = audioUI->height(); | 194 | h = audioUI->height(); |
196 | 195 | ||
197 | if ( drawnOnScreenDisplay ) { | 196 | if ( drawnOnScreenDisplay ) { |
198 | if ( onScreenDisplayVolume > v ) { | 197 | if ( onScreenDisplayVolume > v ) { |
199 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 198 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
200 | } | 199 | } |
201 | } | 200 | } |
202 | drawnOnScreenDisplay = TRUE; | 201 | drawnOnScreenDisplay = TRUE; |
203 | onScreenDisplayVolume = v; | 202 | onScreenDisplayVolume = v; |
204 | QPainter p( audioUI ); | 203 | QPainter p( audioUI ); |
205 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 204 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
206 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 205 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
207 | 206 | ||
208 | QFont f; | 207 | QFont f; |
209 | f.setPixelSize( 20 ); | 208 | f.setPixelSize( 20 ); |
210 | f.setBold( TRUE ); | 209 | f.setBold( TRUE ); |
211 | p.setFont( f ); | 210 | p.setFont( f ); |
212 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 211 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
213 | 212 | ||
214 | for ( unsigned int i = 0; i < 10; i++ ) { | 213 | for ( unsigned int i = 0; i < 10; i++ ) { |
215 | if ( v > i ) { | 214 | if ( v > i ) { |
216 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 215 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
217 | } else { | 216 | } else { |
218 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 217 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
219 | } | 218 | } |
220 | } | 219 | } |
221 | } else { | 220 | } else { |
222 | w = videoUI->width(); | 221 | w = videoUI->width(); |
223 | h = videoUI->height(); | 222 | h = videoUI->height(); |
224 | 223 | ||
225 | if ( drawnOnScreenDisplay ) { | 224 | if ( drawnOnScreenDisplay ) { |
226 | if ( onScreenDisplayVolume > v ) { | 225 | if ( onScreenDisplayVolume > v ) { |
227 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 226 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); |
228 | } | 227 | } |
229 | } | 228 | } |
230 | drawnOnScreenDisplay = TRUE; | 229 | drawnOnScreenDisplay = TRUE; |
231 | onScreenDisplayVolume = v; | 230 | onScreenDisplayVolume = v; |
232 | QPainter p( videoUI ); | 231 | QPainter p( videoUI ); |
233 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); | 232 | p.setPen( QColor( 0x10, 0xD0, 0x10 ) ); |
234 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); | 233 | p.setBrush( QColor( 0x10, 0xD0, 0x10 ) ); |
235 | 234 | ||
236 | QFont f; | 235 | QFont f; |
237 | f.setPixelSize( 20 ); | 236 | f.setPixelSize( 20 ); |
238 | f.setBold( TRUE ); | 237 | f.setBold( TRUE ); |
239 | p.setFont( f ); | 238 | p.setFont( f ); |
240 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 239 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); |
241 | 240 | ||
242 | for ( unsigned int i = 0; i < 10; i++ ) { | 241 | for ( unsigned int i = 0; i < 10; i++ ) { |
243 | if ( v > i ) { | 242 | if ( v > i ) { |
244 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 243 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
245 | } else { | 244 | } else { |
246 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 245 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
247 | } | 246 | } |
248 | } | 247 | } |
249 | } | 248 | } |
250 | } | 249 | } |
251 | 250 | ||
251 | |||
252 | void MediaPlayer::blank( bool b ) { | ||
253 | fd=open("/dev/fb0",O_RDWR); | ||
254 | if (fd != -1) { | ||
255 | |||
256 | if ( !b ) { | ||
257 | qDebug("do blanking"); | ||
258 | ioctl( fd, FBIOBLANK, 3 ); | ||
259 | isBlanked = TRUE; | ||
260 | } else { | ||
261 | qDebug("do unblanking"); | ||
262 | ioctl( fd, FBIOBLANK, 0); | ||
263 | isBlanked = FALSE; | ||
264 | } | ||
265 | close( fd ); | ||
266 | } | ||
267 | } | ||
268 | |||
252 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { | 269 | void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { |
253 | switch ( e->key() ) { | 270 | switch ( e->key() ) { |
254 | ////////////////////////////// Zaurus keys | 271 | ////////////////////////////// Zaurus keys |
255 | case Key_Home: | 272 | case Key_Home: |
256 | break; | 273 | break; |
257 | case Key_F9: //activity | 274 | case Key_F9: //activity |
258 | break; | 275 | break; |
259 | case Key_F10: //contacts | 276 | case Key_F10: //contacts |
260 | break; | 277 | break; |
261 | case Key_F11: //menu | 278 | case Key_F11: //menu |
262 | break; | 279 | break; |
263 | case Key_F12: //home | 280 | case Key_F12: //home |
264 | qDebug("Blank here"); | 281 | qDebug("Blank here"); |
282 | // mediaPlayerState->toggleBlank(); | ||
265 | break; | 283 | break; |
266 | case Key_F13: //mail | 284 | case Key_F13: //mail |
267 | break; | 285 | qDebug("Blank here"); |
286 | // mediaPlayerState->toggleBlank(); | ||
287 | break; | ||
268 | } | 288 | } |
269 | } | 289 | } |
270 | 290 | ||
271 | void MediaPlayer::doBlank() { | ||
272 | |||
273 | } | ||
274 | |||
275 | void MediaPlayer::doUnblank() { | ||
276 | |||
277 | } | ||
278 | |||
279 | void MediaPlayer::cleanUp() { | 291 | void MediaPlayer::cleanUp() { |
280 | // QPEApplication::grabKeyboard(); | 292 | // QPEApplication::grabKeyboard(); |
281 | // QPEApplication::ungrabKeyboard(); | 293 | // QPEApplication::ungrabKeyboard(); |
282 | |||
283 | } | 294 | } |
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h index 16213b5..81fab88 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.h +++ b/noncore/multimedia/opieplayer2/mediaplayer.h | |||
@@ -1,46 +1,47 @@ | |||
1 | 1 | ||
2 | #ifndef MEDIA_PLAYER_H | 2 | #ifndef MEDIA_PLAYER_H |
3 | #define MEDIA_PLAYER_H | 3 | #define MEDIA_PLAYER_H |
4 | 4 | ||
5 | #include <qmainwindow.h> | 5 | #include <qmainwindow.h> |
6 | #include <qframe.h> | 6 | #include <qframe.h> |
7 | #include <qpe/qlibrary.h> | 7 | #include <qpe/qlibrary.h> |
8 | #include <qpe/mediaplayerplugininterface.h> | 8 | #include <qpe/mediaplayerplugininterface.h> |
9 | 9 | ||
10 | #include "xinecontrol.h" | 10 | #include "xinecontrol.h" |
11 | 11 | ||
12 | class DocLnk; | 12 | class DocLnk; |
13 | class VolumeControl; | 13 | class VolumeControl; |
14 | 14 | ||
15 | class MediaPlayer : public QObject { | 15 | class MediaPlayer : public QObject { |
16 | Q_OBJECT | 16 | Q_OBJECT |
17 | public: | 17 | public: |
18 | MediaPlayer( QObject *parent, const char *name ); | 18 | MediaPlayer( QObject *parent, const char *name ); |
19 | ~MediaPlayer(); | 19 | ~MediaPlayer(); |
20 | 20 | ||
21 | private slots: | 21 | private slots: |
22 | void setPlaying( bool ); | 22 | void setPlaying( bool ); |
23 | void pauseCheck( bool ); | 23 | void pauseCheck( bool ); |
24 | void play(); | 24 | void play(); |
25 | void next(); | 25 | void next(); |
26 | void prev(); | 26 | void prev(); |
27 | void startIncreasingVolume(); | 27 | void startIncreasingVolume(); |
28 | void startDecreasingVolume(); | 28 | void startDecreasingVolume(); |
29 | void stopChangingVolume(); | 29 | void stopChangingVolume(); |
30 | void cleanUp(); | 30 | void cleanUp(); |
31 | void blank( bool ); | ||
31 | 32 | ||
32 | protected: | 33 | protected: |
33 | void timerEvent( QTimerEvent *e ); | 34 | void timerEvent( QTimerEvent *e ); |
34 | void keyReleaseEvent( QKeyEvent *e); | 35 | void keyReleaseEvent( QKeyEvent *e); |
35 | void doBlank(); | ||
36 | void doUnblank(); | ||
37 | private: | 36 | private: |
37 | bool isBlanked; | ||
38 | int fd; | ||
38 | int volumeDirection; | 39 | int volumeDirection; |
39 | const DocLnk *currentFile; | 40 | const DocLnk *currentFile; |
40 | XineControl *xineControl; | 41 | XineControl *xineControl; |
41 | VolumeControl *volControl; | 42 | VolumeControl *volControl; |
42 | }; | 43 | }; |
43 | 44 | ||
44 | 45 | ||
45 | #endif // MEDIA_PLAYER_H | 46 | #endif // MEDIA_PLAYER_H |
46 | 47 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp index bb8d905..6aafb88 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp | |||
@@ -22,248 +22,260 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | |||
22 | 22 | ||
23 | MediaPlayerState::~MediaPlayerState() { | 23 | MediaPlayerState::~MediaPlayerState() { |
24 | Config cfg( "OpiePlayer" ); | 24 | Config cfg( "OpiePlayer" ); |
25 | writeConfig( cfg ); | 25 | writeConfig( cfg ); |
26 | 26 | ||
27 | } | 27 | } |
28 | 28 | ||
29 | 29 | ||
30 | void MediaPlayerState::readConfig( Config& cfg ) { | 30 | void MediaPlayerState::readConfig( Config& cfg ) { |
31 | cfg.setGroup("Options"); | 31 | cfg.setGroup("Options"); |
32 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); | 32 | isFullscreen = cfg.readBoolEntry( "FullScreen" ); |
33 | isScaled = cfg.readBoolEntry( "Scaling" ); | 33 | isScaled = cfg.readBoolEntry( "Scaling" ); |
34 | isLooping = cfg.readBoolEntry( "Looping" ); | 34 | isLooping = cfg.readBoolEntry( "Looping" ); |
35 | isShuffled = cfg.readBoolEntry( "Shuffle" ); | 35 | isShuffled = cfg.readBoolEntry( "Shuffle" ); |
36 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); | 36 | usePlaylist = cfg.readBoolEntry( "UsePlayList" ); |
37 | usePlaylist = TRUE; | 37 | usePlaylist = TRUE; |
38 | isPlaying = FALSE; | 38 | isPlaying = FALSE; |
39 | isPaused = FALSE; | 39 | isPaused = FALSE; |
40 | curPosition = 0; | 40 | curPosition = 0; |
41 | curLength = 0; | 41 | curLength = 0; |
42 | curView = 'l'; | 42 | curView = 'l'; |
43 | } | 43 | } |
44 | 44 | ||
45 | 45 | ||
46 | void MediaPlayerState::writeConfig( Config& cfg ) const { | 46 | void MediaPlayerState::writeConfig( Config& cfg ) const { |
47 | cfg.setGroup("Options"); | 47 | cfg.setGroup("Options"); |
48 | cfg.writeEntry("FullScreen", isFullscreen ); | 48 | cfg.writeEntry("FullScreen", isFullscreen ); |
49 | cfg.writeEntry("Scaling", isScaled ); | 49 | cfg.writeEntry("Scaling", isScaled ); |
50 | cfg.writeEntry("Looping", isLooping ); | 50 | cfg.writeEntry("Looping", isLooping ); |
51 | cfg.writeEntry("Shuffle", isShuffled ); | 51 | cfg.writeEntry("Shuffle", isShuffled ); |
52 | cfg.writeEntry("UsePlayList", usePlaylist ); | 52 | cfg.writeEntry("UsePlayList", usePlaylist ); |
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | // public stuff | 56 | // public stuff |
57 | 57 | ||
58 | 58 | ||
59 | bool MediaPlayerState::streaming() { | 59 | bool MediaPlayerState::streaming() { |
60 | return isStreaming; | 60 | return isStreaming; |
61 | } | 61 | } |
62 | 62 | ||
63 | bool MediaPlayerState::fullscreen() { | 63 | bool MediaPlayerState::fullscreen() { |
64 | return isFullscreen; | 64 | return isFullscreen; |
65 | } | 65 | } |
66 | 66 | ||
67 | bool MediaPlayerState::scaled() { | 67 | bool MediaPlayerState::scaled() { |
68 | return isScaled; | 68 | return isScaled; |
69 | } | 69 | } |
70 | 70 | ||
71 | bool MediaPlayerState::looping() { | 71 | bool MediaPlayerState::looping() { |
72 | return isLooping; | 72 | return isLooping; |
73 | } | 73 | } |
74 | 74 | ||
75 | bool MediaPlayerState::shuffled() { | 75 | bool MediaPlayerState::shuffled() { |
76 | return isShuffled; | 76 | return isShuffled; |
77 | } | 77 | } |
78 | 78 | ||
79 | 79 | ||
80 | bool MediaPlayerState:: playlist() { | 80 | bool MediaPlayerState:: playlist() { |
81 | return usePlaylist; | 81 | return usePlaylist; |
82 | } | 82 | } |
83 | 83 | ||
84 | bool MediaPlayerState::paused() { | 84 | bool MediaPlayerState::paused() { |
85 | return isPaused; | 85 | return isPaused; |
86 | } | 86 | } |
87 | 87 | ||
88 | bool MediaPlayerState::playing() { | 88 | bool MediaPlayerState::playing() { |
89 | return isPlaying; | 89 | return isPlaying; |
90 | } | 90 | } |
91 | 91 | ||
92 | bool MediaPlayerState::stop() { | 92 | bool MediaPlayerState::stop() { |
93 | return isStoped; | 93 | return isStoped; |
94 | } | 94 | } |
95 | 95 | ||
96 | long MediaPlayerState::position() { | 96 | long MediaPlayerState::position() { |
97 | return curPosition; | 97 | return curPosition; |
98 | } | 98 | } |
99 | 99 | ||
100 | long MediaPlayerState::length() { | 100 | long MediaPlayerState::length() { |
101 | return curLength; | 101 | return curLength; |
102 | } | 102 | } |
103 | 103 | ||
104 | char MediaPlayerState::view() { | 104 | char MediaPlayerState::view() { |
105 | return curView; | 105 | return curView; |
106 | } | 106 | } |
107 | 107 | ||
108 | // slots | 108 | // slots |
109 | void MediaPlayerState::setIsStreaming( bool b ) { | 109 | void MediaPlayerState::setIsStreaming( bool b ) { |
110 | 110 | ||
111 | if ( isStreaming == b ) { | 111 | if ( isStreaming == b ) { |
112 | return; | 112 | return; |
113 | } | 113 | } |
114 | isStreaming = b; | 114 | isStreaming = b; |
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | void MediaPlayerState::setFullscreen( bool b ) { | 118 | void MediaPlayerState::setBlank( bool b ) { |
119 | if ( isFullscreen == b ) { | 119 | if ( isFullscreen == b ) { |
120 | return; | 120 | return; |
121 | } | 121 | } |
122 | isFullscreen = b; | 122 | isFullscreen = b; |
123 | emit fullscreenToggled(b); | 123 | emit fullscreenToggled(b); |
124 | } | 124 | } |
125 | 125 | ||
126 | 126 | ||
127 | void MediaPlayerState::setFullscreen( bool b ) { | ||
128 | if ( isBlanked == b ) { | ||
129 | return; | ||
130 | } | ||
131 | isBlanked = b; | ||
132 | emit blankToggled(b); | ||
133 | } | ||
134 | |||
135 | |||
127 | void MediaPlayerState::setScaled( bool b ) { | 136 | void MediaPlayerState::setScaled( bool b ) { |
128 | if ( isScaled == b ) { | 137 | if ( isScaled == b ) { |
129 | return; | 138 | return; |
130 | } | 139 | } |
131 | isScaled = b; | 140 | isScaled = b; |
132 | emit scaledToggled(b); | 141 | emit scaledToggled(b); |
133 | } | 142 | } |
134 | 143 | ||
135 | void MediaPlayerState::setLooping( bool b ) { | 144 | void MediaPlayerState::setLooping( bool b ) { |
136 | if ( isLooping == b ) { | 145 | if ( isLooping == b ) { |
137 | return; | 146 | return; |
138 | } | 147 | } |
139 | isLooping = b; | 148 | isLooping = b; |
140 | emit loopingToggled(b); | 149 | emit loopingToggled(b); |
141 | } | 150 | } |
142 | 151 | ||
143 | void MediaPlayerState::setShuffled( bool b ) { | 152 | void MediaPlayerState::setShuffled( bool b ) { |
144 | if ( isShuffled == b ) { | 153 | if ( isShuffled == b ) { |
145 | return; | 154 | return; |
146 | } | 155 | } |
147 | isShuffled = b; | 156 | isShuffled = b; |
148 | emit shuffledToggled(b); | 157 | emit shuffledToggled(b); |
149 | } | 158 | } |
150 | 159 | ||
151 | void MediaPlayerState::setPlaylist( bool b ) { | 160 | void MediaPlayerState::setPlaylist( bool b ) { |
152 | if ( usePlaylist == b ) { | 161 | if ( usePlaylist == b ) { |
153 | return; | 162 | return; |
154 | } | 163 | } |
155 | usePlaylist = b; | 164 | usePlaylist = b; |
156 | emit playlistToggled(b); | 165 | emit playlistToggled(b); |
157 | } | 166 | } |
158 | 167 | ||
159 | void MediaPlayerState::setPaused( bool b ) { | 168 | void MediaPlayerState::setPaused( bool b ) { |
160 | if ( isPaused == b ) { | 169 | if ( isPaused == b ) { |
161 | isPaused = FALSE; | 170 | isPaused = FALSE; |
162 | emit pausedToggled(FALSE); | 171 | emit pausedToggled(FALSE); |
163 | return; | 172 | return; |
164 | } | 173 | } |
165 | isPaused = b; | 174 | isPaused = b; |
166 | emit pausedToggled(b); | 175 | emit pausedToggled(b); |
167 | } | 176 | } |
168 | 177 | ||
169 | void MediaPlayerState::setPlaying( bool b ) { | 178 | void MediaPlayerState::setPlaying( bool b ) { |
170 | if ( isPlaying == b ) { | 179 | if ( isPlaying == b ) { |
171 | return; | 180 | return; |
172 | } | 181 | } |
173 | isPlaying = b; | 182 | isPlaying = b; |
174 | isStoped = !b; | 183 | isStoped = !b; |
175 | emit playingToggled(b); | 184 | emit playingToggled(b); |
176 | } | 185 | } |
177 | 186 | ||
178 | void MediaPlayerState::setStop( bool b ) { | 187 | void MediaPlayerState::setStop( bool b ) { |
179 | if ( isStoped == b ) { | 188 | if ( isStoped == b ) { |
180 | return; | 189 | return; |
181 | } | 190 | } |
182 | isStoped = b; | 191 | isStoped = b; |
183 | emit stopToggled(b); | 192 | emit stopToggled(b); |
184 | } | 193 | } |
185 | 194 | ||
186 | void MediaPlayerState::setPosition( long p ) { | 195 | void MediaPlayerState::setPosition( long p ) { |
187 | if ( curPosition == p ) { | 196 | if ( curPosition == p ) { |
188 | return; | 197 | return; |
189 | } | 198 | } |
190 | curPosition = p; | 199 | curPosition = p; |
191 | emit positionChanged(p); | 200 | emit positionChanged(p); |
192 | } | 201 | } |
193 | 202 | ||
194 | void MediaPlayerState::updatePosition( long p ){ | 203 | void MediaPlayerState::updatePosition( long p ){ |
195 | if ( curPosition == p ) { | 204 | if ( curPosition == p ) { |
196 | return; | 205 | return; |
197 | } | 206 | } |
198 | curPosition = p; | 207 | curPosition = p; |
199 | emit positionUpdated(p); | 208 | emit positionUpdated(p); |
200 | } | 209 | } |
201 | 210 | ||
202 | void MediaPlayerState::setLength( long l ) { | 211 | void MediaPlayerState::setLength( long l ) { |
203 | if ( curLength == l ) { | 212 | if ( curLength == l ) { |
204 | return; | 213 | return; |
205 | } | 214 | } |
206 | curLength = l; | 215 | curLength = l; |
207 | emit lengthChanged(l); | 216 | emit lengthChanged(l); |
208 | } | 217 | } |
209 | 218 | ||
210 | void MediaPlayerState::setView( char v ) { | 219 | void MediaPlayerState::setView( char v ) { |
211 | if ( curView == v ) { | 220 | if ( curView == v ) { |
212 | return; | 221 | return; |
213 | } | 222 | } |
214 | curView = v; | 223 | curView = v; |
215 | emit viewChanged(v); | 224 | emit viewChanged(v); |
216 | } | 225 | } |
217 | 226 | ||
218 | void MediaPlayerState::setPrev(){ | 227 | void MediaPlayerState::setPrev(){ |
219 | emit prev(); | 228 | emit prev(); |
220 | } | 229 | } |
221 | 230 | ||
222 | void MediaPlayerState::setNext() { | 231 | void MediaPlayerState::setNext() { |
223 | emit next(); | 232 | emit next(); |
224 | } | 233 | } |
225 | 234 | ||
226 | void MediaPlayerState::setList() { | 235 | void MediaPlayerState::setList() { |
227 | setPlaying( FALSE ); | 236 | setPlaying( FALSE ); |
228 | setView('l'); | 237 | setView('l'); |
229 | } | 238 | } |
230 | 239 | ||
231 | void MediaPlayerState::setVideo() { | 240 | void MediaPlayerState::setVideo() { |
232 | setView('v'); | 241 | setView('v'); |
233 | } | 242 | } |
234 | 243 | ||
235 | void MediaPlayerState::setAudio() { | 244 | void MediaPlayerState::setAudio() { |
236 | setView('a'); | 245 | setView('a'); |
237 | } | 246 | } |
238 | 247 | ||
239 | void MediaPlayerState::toggleFullscreen() { | 248 | void MediaPlayerState::toggleFullscreen() { |
240 | setFullscreen( !isFullscreen ); | 249 | setFullscreen( !isFullscreen ); |
241 | } | 250 | } |
242 | 251 | ||
243 | void MediaPlayerState::toggleScaled() { | 252 | void MediaPlayerState::toggleScaled() { |
244 | setScaled( !isScaled); | 253 | setScaled( !isScaled); |
245 | } | 254 | } |
246 | 255 | ||
247 | void MediaPlayerState::toggleLooping() { | 256 | void MediaPlayerState::toggleLooping() { |
248 | setLooping( !isLooping); | 257 | setLooping( !isLooping); |
249 | } | 258 | } |
250 | 259 | ||
251 | void MediaPlayerState::toggleShuffled() { | 260 | void MediaPlayerState::toggleShuffled() { |
252 | setShuffled( !isShuffled); | 261 | setShuffled( !isShuffled); |
253 | } | 262 | } |
254 | 263 | ||
255 | void MediaPlayerState::togglePlaylist() { | 264 | void MediaPlayerState::togglePlaylist() { |
256 | setPlaylist( !usePlaylist); | 265 | setPlaylist( !usePlaylist); |
257 | } | 266 | } |
258 | 267 | ||
259 | void MediaPlayerState::togglePaused() { | 268 | void MediaPlayerState::togglePaused() { |
260 | setPaused( !isPaused); | 269 | setPaused( !isPaused); |
261 | } | 270 | } |
262 | 271 | ||
263 | void MediaPlayerState::togglePlaying() { | 272 | void MediaPlayerState::togglePlaying() { |
264 | setPlaying( !isPlaying); | 273 | setPlaying( !isPlaying); |
265 | } | 274 | } |
266 | 275 | ||
276 | void MediaPlayerState::toggleBlank() { | ||
277 | setBlank( !isBlanked); | ||
278 | } | ||
267 | 279 | ||
268 | 280 | ||
269 | 281 | ||
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h index 887c527..3baffd3 100644 --- a/noncore/multimedia/opieplayer2/mediaplayerstate.h +++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h | |||
@@ -1,132 +1,135 @@ | |||
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 | ..}^=.= = ; Library General Public License for more | 22 | ..}^=.= = ; Library 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 | -_. . . )=. = Library General Public License along with | 26 | -_. . . )=. = Library 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 | #ifndef MEDIA_PLAYER_STATE_H | 34 | #ifndef MEDIA_PLAYER_STATE_H |
35 | #define MEDIA_PLAYER_STATE_H | 35 | #define MEDIA_PLAYER_STATE_H |
36 | 36 | ||
37 | 37 | ||
38 | #include <qobject.h> | 38 | #include <qobject.h> |
39 | 39 | ||
40 | 40 | ||
41 | class MediaPlayerDecoder; | 41 | class MediaPlayerDecoder; |
42 | class Config; | 42 | class Config; |
43 | 43 | ||
44 | 44 | ||
45 | class MediaPlayerState : public QObject { | 45 | class MediaPlayerState : public QObject { |
46 | Q_OBJECT | 46 | Q_OBJECT |
47 | public: | 47 | public: |
48 | MediaPlayerState( QObject *parent, const char *name ); | 48 | MediaPlayerState( QObject *parent, const char *name ); |
49 | ~MediaPlayerState(); | 49 | ~MediaPlayerState(); |
50 | 50 | ||
51 | bool isPaused; | 51 | bool isPaused; |
52 | bool isPlaying; | 52 | bool isPlaying; |
53 | bool isStoped; | 53 | bool isStoped; |
54 | bool streaming(); | 54 | bool streaming(); |
55 | bool fullscreen(); | 55 | bool fullscreen(); |
56 | bool scaled(); | 56 | bool scaled(); |
57 | bool looping(); | 57 | bool looping(); |
58 | bool shuffled(); | 58 | bool shuffled(); |
59 | bool playlist(); | 59 | bool playlist(); |
60 | bool paused(); | 60 | bool paused(); |
61 | bool playing(); | 61 | bool playing(); |
62 | bool stop(); | 62 | bool stop(); |
63 | long position(); | 63 | long position(); |
64 | long length(); | 64 | long length(); |
65 | char view(); | 65 | char view(); |
66 | 66 | ||
67 | public slots: | 67 | public slots: |
68 | void setIsStreaming( bool b ); | 68 | void setIsStreaming( bool b ); |
69 | void setFullscreen( bool b ); | 69 | void setFullscreen( bool b ); |
70 | void setScaled( bool b ); | 70 | void setScaled( bool b ); |
71 | void setLooping( bool b ); | 71 | void setLooping( bool b ); |
72 | void setShuffled( bool b ); | 72 | void setShuffled( bool b ); |
73 | void setPlaylist( bool b ); | 73 | void setPlaylist( bool b ); |
74 | void setPaused( bool b ); | 74 | void setPaused( bool b ); |
75 | void setPlaying( bool b ); | 75 | void setPlaying( bool b ); |
76 | void setStop( bool b ); | 76 | void setStop( bool b ); |
77 | void setPosition( long p ); | 77 | void setPosition( long p ); |
78 | void updatePosition( long p ); | 78 | void updatePosition( long p ); |
79 | void setLength( long l ); | 79 | void setLength( long l ); |
80 | void setView( char v ); | 80 | void setView( char v ); |
81 | void setBlank( bool b ); | ||
81 | 82 | ||
82 | void setPrev(); | 83 | void setPrev(); |
83 | void setNext(); | 84 | void setNext(); |
84 | void setList(); | 85 | void setList(); |
85 | void setVideo(); | 86 | void setVideo(); |
86 | void setAudio(); | 87 | void setAudio(); |
87 | 88 | ||
88 | void toggleFullscreen(); | 89 | void toggleFullscreen(); |
89 | void toggleScaled(); | 90 | void toggleScaled(); |
90 | void toggleLooping(); | 91 | void toggleLooping(); |
91 | void toggleShuffled(); | 92 | void toggleShuffled(); |
92 | void togglePlaylist(); | 93 | void togglePlaylist(); |
93 | void togglePaused(); | 94 | void togglePaused(); |
94 | void togglePlaying(); | 95 | void togglePlaying(); |
96 | void toggleBlank(); | ||
95 | 97 | ||
96 | signals: | 98 | signals: |
97 | void fullscreenToggled( bool ); | 99 | void fullscreenToggled( bool ); |
98 | void scaledToggled( bool ); | 100 | void scaledToggled( bool ); |
99 | void loopingToggled( bool ); | 101 | void loopingToggled( bool ); |
100 | void shuffledToggled( bool ); | 102 | void shuffledToggled( bool ); |
101 | void playlistToggled( bool ); | 103 | void playlistToggled( bool ); |
102 | void pausedToggled( bool ); | 104 | void pausedToggled( bool ); |
103 | void playingToggled( bool ); | 105 | void playingToggled( bool ); |
104 | void stopToggled( bool ); | 106 | void stopToggled( bool ); |
105 | void positionChanged( long ); // When the slider is moved | 107 | void positionChanged( long ); // When the slider is moved |
106 | void positionUpdated( long ); // When the media file progresses | 108 | void positionUpdated( long ); // When the media file progresses |
107 | void lengthChanged( long ); | 109 | void lengthChanged( long ); |
108 | void viewChanged( char ); | 110 | void viewChanged( char ); |
109 | 111 | void blankToggled( bool ); | |
110 | void prev(); | 112 | void prev(); |
111 | void next(); | 113 | void next(); |
112 | 114 | ||
113 | private: | 115 | private: |
114 | bool isStreaming; | 116 | bool isStreaming; |
115 | bool isFullscreen; | 117 | bool isFullscreen; |
116 | bool isScaled; | 118 | bool isScaled; |
119 | bool isBlanked; | ||
117 | bool isLooping; | 120 | bool isLooping; |
118 | bool isShuffled; | 121 | bool isShuffled; |
119 | bool usePlaylist; | 122 | bool usePlaylist; |
120 | long curPosition; | 123 | long curPosition; |
121 | long curLength; | 124 | long curLength; |
122 | char curView; | 125 | char curView; |
123 | 126 | ||
124 | void readConfig( Config& cfg ); | 127 | void readConfig( Config& cfg ); |
125 | void writeConfig( Config& cfg ) const; | 128 | void writeConfig( Config& cfg ) const; |
126 | 129 | ||
127 | 130 | ||
128 | }; | 131 | }; |
129 | 132 | ||
130 | 133 | ||
131 | #endif // MEDIA_PLAYER_STATE_H | 134 | #endif // MEDIA_PLAYER_STATE_H |
132 | 135 | ||
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 6dcc842..0cfd720 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -1,154 +1,141 @@ | |||
1 | 1 | ||
2 | #define QTOPIA_INTERNAL_FSLP | 2 | #define QTOPIA_INTERNAL_FSLP |
3 | #include <qpe/qcopenvelope_qws.h> | ||
4 | |||
5 | #include <qpe/qpemenubar.h> | 3 | #include <qpe/qpemenubar.h> |
6 | #include <qpe/qpetoolbar.h> | 4 | #include <qpe/qpetoolbar.h> |
7 | #include <qpe/fileselector.h> | 5 | #include <qpe/fileselector.h> |
8 | #include <qpe/qpeapplication.h> | 6 | #include <qpe/qpeapplication.h> |
9 | #include <qpe/lnkproperties.h> | 7 | #include <qpe/lnkproperties.h> |
10 | #include <qpe/storage.h> | 8 | #include <qpe/storage.h> |
11 | 9 | ||
12 | #include <qpe/applnk.h> | 10 | #include <qpe/applnk.h> |
13 | #include <qpopupmenu.h> | 11 | #include <qpopupmenu.h> |
14 | #include <qpe/config.h> | 12 | #include <qpe/config.h> |
15 | #include <qpe/global.h> | 13 | #include <qpe/global.h> |
16 | #include <qpe/resource.h> | 14 | #include <qpe/resource.h> |
17 | #include <qaction.h> | 15 | #include <qaction.h> |
18 | #include <qcursor.h> | 16 | #include <qcursor.h> |
19 | #include <qimage.h> | 17 | #include <qimage.h> |
20 | #include <qfile.h> | 18 | #include <qfile.h> |
21 | #include <qdir.h> | 19 | #include <qdir.h> |
22 | #include <qlayout.h> | 20 | #include <qlayout.h> |
23 | #include <qlabel.h> | 21 | #include <qlabel.h> |
24 | #include <qlist.h> | 22 | #include <qlist.h> |
25 | #include <qlistbox.h> | 23 | #include <qlistbox.h> |
26 | #include <qmainwindow.h> | 24 | #include <qmainwindow.h> |
27 | #include <qmessagebox.h> | 25 | #include <qmessagebox.h> |
28 | #include <qtoolbutton.h> | 26 | #include <qtoolbutton.h> |
29 | #include <qtabwidget.h> | 27 | #include <qtabwidget.h> |
30 | #include <qlistview.h> | 28 | #include <qlistview.h> |
31 | #include <qpoint.h> | 29 | #include <qpoint.h> |
32 | #include <qlineedit.h> | 30 | #include <qlineedit.h> |
33 | #include <qpushbutton.h> | 31 | #include <qpushbutton.h> |
34 | #include <qregexp.h> | 32 | #include <qregexp.h> |
35 | #include <qtextstream.h> | 33 | #include <qtextstream.h> |
36 | 34 | ||
37 | 35 | ||
38 | #include "playlistselection.h" | 36 | #include "playlistselection.h" |
39 | #include "playlistwidget.h" | 37 | #include "playlistwidget.h" |
40 | #include "mediaplayerstate.h" | 38 | #include "mediaplayerstate.h" |
41 | 39 | ||
42 | #include "inputDialog.h" | 40 | #include "inputDialog.h" |
43 | 41 | ||
44 | #include <stdlib.h> | 42 | #include <stdlib.h> |
45 | #include "audiowidget.h" | 43 | #include "audiowidget.h" |
46 | #include "videowidget.h" | 44 | #include "videowidget.h" |
47 | 45 | ||
48 | #include <unistd.h> | ||
49 | #include <sys/file.h> | ||
50 | #include <sys/ioctl.h> | ||
51 | #include <sys/soundcard.h> | ||
52 | |||
53 | // for setBacklight() | ||
54 | #include <linux/fb.h> | ||
55 | #include <sys/types.h> | ||
56 | #include <sys/stat.h> | ||
57 | #include <stdlib.h> | ||
58 | |||
59 | #define BUTTONS_ON_TOOLBAR | 46 | #define BUTTONS_ON_TOOLBAR |
60 | #define SIDE_BUTTONS | 47 | #define SIDE_BUTTONS |
61 | #define CAN_SAVE_LOAD_PLAYLISTS | 48 | #define CAN_SAVE_LOAD_PLAYLISTS |
62 | 49 | ||
63 | extern MediaPlayerState *mediaPlayerState; | 50 | extern MediaPlayerState *mediaPlayerState; |
64 | 51 | ||
65 | 52 | ||
66 | class PlayListWidgetPrivate { | 53 | class PlayListWidgetPrivate { |
67 | public: | 54 | public: |
68 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; | 55 | QToolButton *tbPlay, *tbFull, *tbLoop, *tbScale, *tbShuffle, *tbAddToList, *tbRemoveFromList, *tbMoveUp, *tbMoveDown, *tbRemove; |
69 | QFrame *playListFrame; | 56 | QFrame *playListFrame; |
70 | FileSelector *files; | 57 | FileSelector *files; |
71 | PlayListSelection *selectedFiles; | 58 | PlayListSelection *selectedFiles; |
72 | bool setDocumentUsed; | 59 | bool setDocumentUsed; |
73 | DocLnk *current; | 60 | DocLnk *current; |
74 | }; | 61 | }; |
75 | 62 | ||
76 | 63 | ||
77 | class ToolButton : public QToolButton { | 64 | class ToolButton : public QToolButton { |
78 | public: | 65 | public: |
79 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) | 66 | ToolButton( QWidget *parent, const char *name, const QString& icon, QObject *handler, const QString& slot, bool t = FALSE ) |
80 | : QToolButton( parent, name ) { | 67 | : QToolButton( parent, name ) { |
81 | setTextLabel( name ); | 68 | setTextLabel( name ); |
82 | setPixmap( Resource::loadPixmap( icon ) ); | 69 | setPixmap( Resource::loadPixmap( icon ) ); |
83 | setAutoRaise( TRUE ); | 70 | setAutoRaise( TRUE ); |
84 | setFocusPolicy( QWidget::NoFocus ); | 71 | setFocusPolicy( QWidget::NoFocus ); |
85 | setToggleButton( t ); | 72 | setToggleButton( t ); |
86 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); | 73 | connect( this, t ? SIGNAL( toggled(bool) ) : SIGNAL( clicked() ), handler, slot ); |
87 | QPEMenuToolFocusManager::manager()->addWidget( this ); | 74 | QPEMenuToolFocusManager::manager()->addWidget( this ); |
88 | } | 75 | } |
89 | }; | 76 | }; |
90 | 77 | ||
91 | 78 | ||
92 | class MenuItem : public QAction { | 79 | class MenuItem : public QAction { |
93 | public: | 80 | public: |
94 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) | 81 | MenuItem( QWidget *parent, const QString& text, QObject *handler, const QString& slot ) |
95 | : QAction( text, QString::null, 0, 0 ) { | 82 | : QAction( text, QString::null, 0, 0 ) { |
96 | connect( this, SIGNAL( activated() ), handler, slot ); | 83 | connect( this, SIGNAL( activated() ), handler, slot ); |
97 | addTo( parent ); | 84 | addTo( parent ); |
98 | } | 85 | } |
99 | }; | 86 | }; |
100 | 87 | ||
101 | 88 | ||
102 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | 89 | PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) |
103 | : QMainWindow( parent, name, fl ) { | 90 | : QMainWindow( parent, name, fl ) { |
104 | 91 | ||
105 | d = new PlayListWidgetPrivate; | 92 | d = new PlayListWidgetPrivate; |
106 | d->setDocumentUsed = FALSE; | 93 | d->setDocumentUsed = FALSE; |
107 | d->current = NULL; | 94 | d->current = NULL; |
108 | fromSetDocument = FALSE; | 95 | fromSetDocument = FALSE; |
109 | insanityBool=FALSE; | 96 | insanityBool=FALSE; |
110 | audioScan = FALSE; | 97 | audioScan = FALSE; |
111 | videoScan = FALSE; | 98 | videoScan = FALSE; |
112 | 99 | ||
113 | setBackgroundMode( PaletteButton ); | 100 | setBackgroundMode( PaletteButton ); |
114 | 101 | ||
115 | setCaption( tr("OpiePlayer") ); | 102 | setCaption( tr("OpiePlayer") ); |
116 | setIcon( Resource::loadPixmap( "opieplayer2/MPEGPlayer" ) ); | 103 | setIcon( Resource::loadPixmap( "opieplayer2/MPEGPlayer" ) ); |
117 | 104 | ||
118 | setToolBarsMovable( FALSE ); | 105 | setToolBarsMovable( FALSE ); |
119 | 106 | ||
120 | // Create Toolbar | 107 | // Create Toolbar |
121 | QPEToolBar *toolbar = new QPEToolBar( this ); | 108 | QPEToolBar *toolbar = new QPEToolBar( this ); |
122 | toolbar->setHorizontalStretchable( TRUE ); | 109 | toolbar->setHorizontalStretchable( TRUE ); |
123 | 110 | ||
124 | // Create Menubar | 111 | // Create Menubar |
125 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); | 112 | QPEMenuBar *menu = new QPEMenuBar( toolbar ); |
126 | menu->setMargin( 0 ); | 113 | menu->setMargin( 0 ); |
127 | 114 | ||
128 | QPEToolBar *bar = new QPEToolBar( this ); | 115 | QPEToolBar *bar = new QPEToolBar( this ); |
129 | bar->setLabel( tr( "Play Operations" ) ); | 116 | bar->setLabel( tr( "Play Operations" ) ); |
130 | 117 | ||
131 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); | 118 | tbDeletePlaylist = new QPushButton( Resource::loadIconSet("trash"),"",bar,"close"); |
132 | tbDeletePlaylist->setFlat(TRUE); | 119 | tbDeletePlaylist->setFlat(TRUE); |
133 | tbDeletePlaylist->setFixedSize(20,20); | 120 | tbDeletePlaylist->setFixedSize(20,20); |
134 | 121 | ||
135 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", | 122 | d->tbAddToList = new ToolButton( bar, tr( "Add to Playlist" ), "opieplayer2/add_to_playlist", |
136 | this , SLOT(addSelected()) ); | 123 | this , SLOT(addSelected()) ); |
137 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", | 124 | d->tbRemoveFromList = new ToolButton( bar, tr( "Remove from Playlist" ), "opieplayer2/remove_from_playlist", |
138 | this , SLOT(removeSelected()) ); | 125 | this , SLOT(removeSelected()) ); |
139 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", | 126 | d->tbPlay = new ToolButton( bar, tr( "Play" ), "opieplayer2/play", |
140 | this , SLOT( btnPlay(bool) ), TRUE ); | 127 | this , SLOT( btnPlay(bool) ), TRUE ); |
141 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", | 128 | d->tbShuffle = new ToolButton( bar, tr( "Randomize" ),"opieplayer2/shuffle", |
142 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); | 129 | mediaPlayerState, SLOT(setShuffled(bool)), TRUE ); |
143 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer2/loop", | 130 | d->tbLoop = new ToolButton( bar, tr( "Loop" ),"opieplayer2/loop", |
144 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); | 131 | mediaPlayerState, SLOT(setLooping(bool)), TRUE ); |
145 | tbDeletePlaylist->hide(); | 132 | tbDeletePlaylist->hide(); |
146 | 133 | ||
147 | QPopupMenu *pmPlayList = new QPopupMenu( this ); | 134 | QPopupMenu *pmPlayList = new QPopupMenu( this ); |
148 | menu->insertItem( tr( "File" ), pmPlayList ); | 135 | menu->insertItem( tr( "File" ), pmPlayList ); |
149 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); | 136 | new MenuItem( pmPlayList, tr( "Clear List" ), this, SLOT( clearList() ) ); |
150 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); | 137 | new MenuItem( pmPlayList, tr( "Add all audio files" ), this, SLOT( addAllMusicToList() ) ); |
151 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); | 138 | new MenuItem( pmPlayList, tr( "Add all video files" ), this, SLOT( addAllVideoToList() ) ); |
152 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); | 139 | new MenuItem( pmPlayList, tr( "Add all files" ), this, SLOT( addAllToList() ) ); |
153 | pmPlayList->insertSeparator(-1); | 140 | pmPlayList->insertSeparator(-1); |
154 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); | 141 | new MenuItem( pmPlayList, tr( "Save PlayList" ), this, SLOT( saveList() ) ); |
@@ -917,282 +904,262 @@ void PlayListWidget::populateAudioView() { | |||
917 | QListIterator<FileSystem> it ( fs ); | 904 | QListIterator<FileSystem> it ( fs ); |
918 | 905 | ||
919 | QString storage; | 906 | QString storage; |
920 | for ( ; dit.current(); ++dit ) { | 907 | for ( ; dit.current(); ++dit ) { |
921 | for( ; it.current(); ++it ){ | 908 | for( ; it.current(); ++it ){ |
922 | const QString name = (*it)->name(); | 909 | const QString name = (*it)->name(); |
923 | const QString path = (*it)->path(); | 910 | const QString path = (*it)->path(); |
924 | if(dit.current()->file().find(path) != -1 ) storage=name; | 911 | if(dit.current()->file().find(path) != -1 ) storage=name; |
925 | } | 912 | } |
926 | 913 | ||
927 | QListViewItem * newItem; | 914 | QListViewItem * newItem; |
928 | if ( QFile( dit.current()->file()).exists() ) { | 915 | if ( QFile( dit.current()->file()).exists() ) { |
929 | // qDebug(dit.current()->name()); | 916 | // qDebug(dit.current()->name()); |
930 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 917 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
931 | QString::number( QFile( dit.current()->file()).size() ), storage); | 918 | QString::number( QFile( dit.current()->file()).size() ), storage); |
932 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/musicfile" )); | 919 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/musicfile" )); |
933 | } | 920 | } |
934 | } | 921 | } |
935 | 922 | ||
936 | } | 923 | } |
937 | 924 | ||
938 | void PlayListWidget::populateVideoView() { | 925 | void PlayListWidget::populateVideoView() { |
939 | videoView->clear(); | 926 | videoView->clear(); |
940 | StorageInfo storageInfo; | 927 | StorageInfo storageInfo; |
941 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 928 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
942 | 929 | ||
943 | if(!videoScan ) scanForVideo(); | 930 | if(!videoScan ) scanForVideo(); |
944 | 931 | ||
945 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 932 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
946 | QListIterator<FileSystem> it ( fs ); | 933 | QListIterator<FileSystem> it ( fs ); |
947 | videoView->clear(); | 934 | videoView->clear(); |
948 | QString storage; | 935 | QString storage; |
949 | for ( ; Vdit.current(); ++Vdit ) { | 936 | for ( ; Vdit.current(); ++Vdit ) { |
950 | for( ; it.current(); ++it ){ | 937 | for( ; it.current(); ++it ){ |
951 | const QString name = (*it)->name(); | 938 | const QString name = (*it)->name(); |
952 | const QString path = (*it)->path(); | 939 | const QString path = (*it)->path(); |
953 | if( Vdit.current()->file().find(path) != -1 ) storage=name; | 940 | if( Vdit.current()->file().find(path) != -1 ) storage=name; |
954 | } | 941 | } |
955 | 942 | ||
956 | QListViewItem * newItem; | 943 | QListViewItem * newItem; |
957 | if ( QFile( Vdit.current()->file()).exists() ) { | 944 | if ( QFile( Vdit.current()->file()).exists() ) { |
958 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 945 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
959 | QString::number( QFile( Vdit.current()->file()).size() ), storage); | 946 | QString::number( QFile( Vdit.current()->file()).size() ), storage); |
960 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); | 947 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" )); |
961 | } | 948 | } |
962 | } | 949 | } |
963 | } | 950 | } |
964 | 951 | ||
965 | void PlayListWidget::openFile() { | 952 | void PlayListWidget::openFile() { |
966 | QString filename, name; | 953 | QString filename, name; |
967 | InputDialog *fileDlg; | 954 | InputDialog *fileDlg; |
968 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 955 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
969 | fileDlg->exec(); | 956 | fileDlg->exec(); |
970 | if( fileDlg->result() == 1 ) { | 957 | if( fileDlg->result() == 1 ) { |
971 | filename = fileDlg->LineEdit1->text(); | 958 | filename = fileDlg->LineEdit1->text(); |
972 | 959 | ||
973 | qDebug("Selected filename is "+filename); | 960 | qDebug("Selected filename is "+filename); |
974 | if(filename.right(3) == "m3u") { | 961 | if(filename.right(3) == "m3u") { |
975 | readm3u( filename ); | 962 | readm3u( filename ); |
976 | } else if(filename.right(3) == "pls") { | 963 | } else if(filename.right(3) == "pls") { |
977 | readPls( filename ); | 964 | readPls( filename ); |
978 | } else { | 965 | } else { |
979 | DocLnk lnk; | 966 | DocLnk lnk; |
980 | 967 | ||
981 | lnk.setName(filename); //sets file name | 968 | lnk.setName(filename); //sets file name |
982 | lnk.setFile(filename); //sets File property | 969 | lnk.setFile(filename); //sets File property |
983 | lnk.setType("audio/x-mpegurl"); | 970 | lnk.setType("audio/x-mpegurl"); |
984 | lnk.setExec("opieplayer"); | 971 | lnk.setExec("opieplayer"); |
985 | lnk.setIcon("opieplayer2/MPEGPlayer"); | 972 | lnk.setIcon("opieplayer2/MPEGPlayer"); |
986 | 973 | ||
987 | if(!lnk.writeLink()) { | 974 | if(!lnk.writeLink()) { |
988 | qDebug("Writing doclink did not work"); | 975 | qDebug("Writing doclink did not work"); |
989 | } | 976 | } |
990 | d->selectedFiles->addToSelection( lnk); | 977 | d->selectedFiles->addToSelection( lnk); |
991 | } | 978 | } |
992 | } | 979 | } |
993 | if(fileDlg) { | 980 | if(fileDlg) { |
994 | delete fileDlg; | 981 | delete fileDlg; |
995 | } | 982 | } |
996 | } | 983 | } |
997 | 984 | ||
998 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | 985 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e) |
999 | { | 986 | { |
1000 | switch ( e->key() ) { | 987 | switch ( e->key() ) { |
1001 | ////////////////////////////// Zaurus keys | 988 | ////////////////////////////// Zaurus keys |
1002 | case Key_F9: //activity | 989 | case Key_F9: //activity |
1003 | // if(audioUI->isHidden()) | 990 | // if(audioUI->isHidden()) |
1004 | // audioUI->showMaximized(); | 991 | // audioUI->showMaximized(); |
1005 | break; | 992 | break; |
1006 | case Key_F10: //contacts | 993 | case Key_F10: //contacts |
1007 | // if( videoUI->isHidden()) | 994 | // if( videoUI->isHidden()) |
1008 | // videoUI->showMaximized(); | 995 | // videoUI->showMaximized(); |
1009 | break; | 996 | break; |
1010 | case Key_F11: //menu | 997 | case Key_F11: //menu |
1011 | break; | 998 | break; |
1012 | case Key_F12: //home | 999 | case Key_F12: //home |
1013 | // doBlank(); | 1000 | // doBlank(); |
1014 | break; | 1001 | break; |
1015 | case Key_F13: //mail | 1002 | case Key_F13: //mail |
1016 | // doUnblank(); | 1003 | // doUnblank(); |
1017 | break; | 1004 | break; |
1018 | case Key_Q: //add to playlist | 1005 | case Key_Q: //add to playlist |
1019 | qDebug("Add"); | 1006 | qDebug("Add"); |
1020 | addSelected(); | 1007 | addSelected(); |
1021 | break; | 1008 | break; |
1022 | case Key_R: //remove from playlist | 1009 | case Key_R: //remove from playlist |
1023 | removeSelected(); | 1010 | removeSelected(); |
1024 | break; | 1011 | break; |
1025 | // case Key_P: //play | 1012 | // case Key_P: //play |
1026 | // qDebug("Play"); | 1013 | // qDebug("Play"); |
1027 | // playSelected(); | 1014 | // playSelected(); |
1028 | // break; | 1015 | // break; |
1029 | case Key_Space: | 1016 | case Key_Space: |
1030 | qDebug("Play"); | 1017 | qDebug("Play"); |
1031 | // playSelected(); puh | 1018 | // playSelected(); puh |
1032 | break; | 1019 | break; |
1033 | case Key_1: | 1020 | case Key_1: |
1034 | tabWidget->setCurrentPage(0); | 1021 | tabWidget->setCurrentPage(0); |
1035 | break; | 1022 | break; |
1036 | case Key_2: | 1023 | case Key_2: |
1037 | tabWidget->setCurrentPage(1); | 1024 | tabWidget->setCurrentPage(1); |
1038 | break; | 1025 | break; |
1039 | case Key_3: | 1026 | case Key_3: |
1040 | tabWidget->setCurrentPage(2); | 1027 | tabWidget->setCurrentPage(2); |
1041 | break; | 1028 | break; |
1042 | case Key_4: | 1029 | case Key_4: |
1043 | tabWidget->setCurrentPage(3); | 1030 | tabWidget->setCurrentPage(3); |
1044 | break; | 1031 | break; |
1045 | case Key_Down: | 1032 | case Key_Down: |
1046 | if ( !d->selectedFiles->next() ) | 1033 | if ( !d->selectedFiles->next() ) |
1047 | d->selectedFiles->first(); | 1034 | d->selectedFiles->first(); |
1048 | 1035 | ||
1049 | break; | 1036 | break; |
1050 | case Key_Up: | 1037 | case Key_Up: |
1051 | if ( !d->selectedFiles->prev() ) | 1038 | if ( !d->selectedFiles->prev() ) |
1052 | // d->selectedFiles->last(); | 1039 | // d->selectedFiles->last(); |
1053 | 1040 | ||
1054 | break; | 1041 | break; |
1055 | 1042 | ||
1056 | } | 1043 | } |
1057 | } | 1044 | } |
1058 | 1045 | ||
1059 | void PlayListWidget::keyPressEvent( QKeyEvent *) | 1046 | void PlayListWidget::keyPressEvent( QKeyEvent *) |
1060 | { | 1047 | { |
1061 | // qDebug("Key press"); | 1048 | // qDebug("Key press"); |
1062 | // switch ( e->key() ) { | 1049 | // switch ( e->key() ) { |
1063 | // ////////////////////////////// Zaurus keys | 1050 | // ////////////////////////////// Zaurus keys |
1064 | // case Key_A: //add to playlist | 1051 | // case Key_A: //add to playlist |
1065 | // qDebug("Add"); | 1052 | // qDebug("Add"); |
1066 | // addSelected(); | 1053 | // addSelected(); |
1067 | // break; | 1054 | // break; |
1068 | // case Key_R: //remove from playlist | 1055 | // case Key_R: //remove from playlist |
1069 | // removeSelected(); | 1056 | // removeSelected(); |
1070 | // break; | 1057 | // break; |
1071 | // case Key_P: //play | 1058 | // case Key_P: //play |
1072 | // qDebug("Play"); | 1059 | // qDebug("Play"); |
1073 | // playSelected(); | 1060 | // playSelected(); |
1074 | // break; | 1061 | // break; |
1075 | // case Key_Space: | 1062 | // case Key_Space: |
1076 | // qDebug("Play"); | 1063 | // qDebug("Play"); |
1077 | // playSelected(); | 1064 | // playSelected(); |
1078 | // break; | 1065 | // break; |
1079 | // } | 1066 | // } |
1080 | } | 1067 | } |
1081 | 1068 | ||
1082 | void PlayListWidget::doBlank() { | ||
1083 | qDebug("do blanking"); | ||
1084 | fd=open("/dev/fb0",O_RDWR); | ||
1085 | if (fd != -1) { | ||
1086 | ioctl(fd,FBIOBLANK,1); | ||
1087 | // close(fd); | ||
1088 | } | ||
1089 | } | ||
1090 | 1069 | ||
1091 | void PlayListWidget::doUnblank() { | ||
1092 | // this crashes opieplayer with a segfault | ||
1093 | // int fd; | ||
1094 | // fd=open("/dev/fb0",O_RDWR); | ||
1095 | qDebug("do unblanking"); | ||
1096 | if (fd != -1) { | ||
1097 | ioctl(fd,FBIOBLANK,0); | ||
1098 | close(fd); | ||
1099 | } | ||
1100 | QCopEnvelope h("QPE/System", "setBacklight(int)"); | ||
1101 | h <<-3;// v[1]; // -3 Force on | ||
1102 | } | ||
1103 | 1070 | ||
1104 | void PlayListWidget::readm3u(const QString &filename) { | 1071 | void PlayListWidget::readm3u(const QString &filename) { |
1105 | 1072 | ||
1106 | qDebug("m3u filename is "+filename); | 1073 | qDebug("m3u filename is "+filename); |
1107 | QFile f(filename); | 1074 | QFile f(filename); |
1108 | 1075 | ||
1109 | if(f.open(IO_ReadOnly)) { | 1076 | if(f.open(IO_ReadOnly)) { |
1110 | QTextStream t(&f); | 1077 | QTextStream t(&f); |
1111 | QString s;//, first, second; | 1078 | QString s;//, first, second; |
1112 | int i=0; | 1079 | int i=0; |
1113 | while ( !t.atEnd()) { | 1080 | while ( !t.atEnd()) { |
1114 | s=t.readLine(); | 1081 | s=t.readLine(); |
1115 | 1082 | ||
1116 | if(s.find("#",0,TRUE) == -1) { | 1083 | if(s.find("#",0,TRUE) == -1) { |
1117 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat | 1084 | if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat |
1118 | if(s.left(2) == "E:" || s.left(2) == "P:") { | 1085 | if(s.left(2) == "E:" || s.left(2) == "P:") { |
1119 | s=s.right(s.length()-2); | 1086 | s=s.right(s.length()-2); |
1120 | if(QFile(s).exists()) { | 1087 | if(QFile(s).exists()) { |
1121 | DocLnk lnk( s ); | 1088 | DocLnk lnk( s ); |
1122 | QFileInfo f(s); | 1089 | QFileInfo f(s); |
1123 | QString name = f.baseName(); | 1090 | QString name = f.baseName(); |
1124 | name = name.right( name.length()-name.findRev( "\\",-1,TRUE ) -1 ); | 1091 | name = name.right( name.length()-name.findRev( "\\",-1,TRUE ) -1 ); |
1125 | lnk.setName( name ); | 1092 | lnk.setName( name ); |
1126 | s=s.replace( QRegExp("\\"),"/"); | 1093 | s=s.replace( QRegExp("\\"),"/"); |
1127 | lnk.setFile( s ); | 1094 | lnk.setFile( s ); |
1128 | lnk.writeLink(); | 1095 | lnk.writeLink(); |
1129 | qDebug("add "+name); | 1096 | qDebug("add "+name); |
1130 | d->selectedFiles->addToSelection( lnk); | 1097 | d->selectedFiles->addToSelection( lnk); |
1131 | } | 1098 | } |
1132 | } else { // is url | 1099 | } else { // is url |
1133 | s.replace(QRegExp("%20")," "); | 1100 | s.replace(QRegExp("%20")," "); |
1134 | DocLnk lnk( s ); | 1101 | DocLnk lnk( s ); |
1135 | QString name; | 1102 | QString name; |
1136 | if(name.left(4)=="http") { | 1103 | if(name.left(4)=="http") { |
1137 | name = s.right( s.length() - 7); | 1104 | name = s.right( s.length() - 7); |
1138 | } else { | 1105 | } else { |
1139 | name = s; | 1106 | name = s; |
1140 | } | 1107 | } |
1141 | lnk.setName(name); | 1108 | lnk.setName(name); |
1142 | if(s.at(s.length()-4) == '.') { | 1109 | if(s.at(s.length()-4) == '.') { |
1143 | lnk.setFile( s); | 1110 | lnk.setFile( s); |
1144 | } else { | 1111 | } else { |
1145 | lnk.setFile( s+"/"); | 1112 | lnk.setFile( s+"/"); |
1146 | } | 1113 | } |
1147 | lnk.setType("audio/x-mpegurl"); | 1114 | lnk.setType("audio/x-mpegurl"); |
1148 | lnk.writeLink(); | 1115 | lnk.writeLink(); |
1149 | d->selectedFiles->addToSelection( lnk); | 1116 | d->selectedFiles->addToSelection( lnk); |
1150 | } | 1117 | } |
1151 | i++; | 1118 | i++; |
1152 | } | 1119 | } |
1153 | } | 1120 | } |
1154 | } | 1121 | } |
1155 | } | 1122 | } |
1156 | f.close(); | 1123 | f.close(); |
1157 | } | 1124 | } |
1158 | 1125 | ||
1159 | void PlayListWidget::writem3u() { | 1126 | void PlayListWidget::writem3u() { |
1160 | 1127 | ||
1161 | InputDialog *fileDlg; | 1128 | InputDialog *fileDlg; |
1162 | fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0); | 1129 | fileDlg = new InputDialog(this,tr("Save m3u Playlist "),TRUE, 0); |
1163 | fileDlg->exec(); | 1130 | fileDlg->exec(); |
1164 | QString filename,list; | 1131 | QString filename,list; |
1165 | if( fileDlg->result() == 1 ) { | 1132 | if( fileDlg->result() == 1 ) { |
1166 | filename = fileDlg->LineEdit1->text(); | 1133 | filename = fileDlg->LineEdit1->text(); |
1167 | qDebug(filename); | 1134 | qDebug(filename); |
1168 | int noOfFiles = 0; | 1135 | int noOfFiles = 0; |
1169 | d->selectedFiles->first(); | 1136 | d->selectedFiles->first(); |
1170 | do { | 1137 | do { |
1171 | // we dont check for existance because of url's | 1138 | // we dont check for existance because of url's |
1172 | // qDebug(d->selectedFiles->current()->file()); | 1139 | // qDebug(d->selectedFiles->current()->file()); |
1173 | list += d->selectedFiles->current()->file()+"\n"; | 1140 | list += d->selectedFiles->current()->file()+"\n"; |
1174 | noOfFiles++; | 1141 | noOfFiles++; |
1175 | } | 1142 | } |
1176 | while ( d->selectedFiles->next() ); | 1143 | while ( d->selectedFiles->next() ); |
1177 | qDebug(list); | 1144 | qDebug(list); |
1178 | if(filename.left(1) != "/") | 1145 | if(filename.left(1) != "/") |
1179 | filename=QPEApplication::documentDir()+"/"+filename; | 1146 | filename=QPEApplication::documentDir()+"/"+filename; |
1180 | if(filename.right(3) != "m3u") | 1147 | if(filename.right(3) != "m3u") |
1181 | filename=filename+".m3u"; | 1148 | filename=filename+".m3u"; |
1182 | 1149 | ||
1183 | QFile f(filename); | 1150 | QFile f(filename); |
1184 | f.open(IO_WriteOnly); | 1151 | f.open(IO_WriteOnly); |
1185 | f.writeBlock(list, list.length()); | 1152 | f.writeBlock(list, list.length()); |
1186 | f.close(); | 1153 | f.close(); |
1187 | } | 1154 | } |
1188 | if(fileDlg) delete fileDlg; | 1155 | if(fileDlg) delete fileDlg; |
1189 | } | 1156 | } |
1190 | 1157 | ||
1191 | void PlayListWidget::readPls(const QString &filename) { | 1158 | void PlayListWidget::readPls(const QString &filename) { |
1192 | 1159 | ||
1193 | qDebug("pls filename is "+filename); | 1160 | qDebug("pls filename is "+filename); |
1194 | QFile f(filename); | 1161 | QFile f(filename); |
1195 | 1162 | ||
1196 | if(f.open(IO_ReadOnly)) { | 1163 | if(f.open(IO_ReadOnly)) { |
1197 | QTextStream t(&f); | 1164 | QTextStream t(&f); |
1198 | QString s;//, first, second; | 1165 | QString s;//, first, second; |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 67a85a8..dd4bee0 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -1,114 +1,112 @@ | |||
1 | 1 | ||
2 | #ifndef PLAY_LIST_WIDGET_H | 2 | #ifndef PLAY_LIST_WIDGET_H |
3 | #define PLAY_LIST_WIDGET_H | 3 | #define PLAY_LIST_WIDGET_H |
4 | 4 | ||
5 | #include <qmainwindow.h> | 5 | #include <qmainwindow.h> |
6 | #include <qpe/applnk.h> | 6 | #include <qpe/applnk.h> |
7 | #include <qtabwidget.h> | 7 | #include <qtabwidget.h> |
8 | #include <qpe/fileselector.h> | 8 | #include <qpe/fileselector.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | #include <qpopupmenu.h> | 10 | #include <qpopupmenu.h> |
11 | 11 | ||
12 | /* #include <qtimer.h> */ | 12 | /* #include <qtimer.h> */ |
13 | 13 | ||
14 | 14 | ||
15 | class PlayListWidgetPrivate; | 15 | class PlayListWidgetPrivate; |
16 | class Config; | 16 | class Config; |
17 | class QListViewItem; | 17 | class QListViewItem; |
18 | class QListView; | 18 | class QListView; |
19 | class QPoint; | 19 | class QPoint; |
20 | class QAction; | 20 | class QAction; |
21 | class QLabel; | 21 | class QLabel; |
22 | 22 | ||
23 | class PlayListWidget : public QMainWindow { | 23 | class PlayListWidget : public QMainWindow { |
24 | Q_OBJECT | 24 | Q_OBJECT |
25 | public: | 25 | public: |
26 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); | 26 | PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); |
27 | ~PlayListWidget(); | 27 | ~PlayListWidget(); |
28 | QTabWidget * tabWidget; | 28 | QTabWidget * tabWidget; |
29 | // MenuItem *fullScreenButton, *scaleButton; | 29 | // MenuItem *fullScreenButton, *scaleButton; |
30 | // QAction *fullScreenButton, *scaleButton; | 30 | // QAction *fullScreenButton, *scaleButton; |
31 | DocLnkSet files; | 31 | DocLnkSet files; |
32 | DocLnkSet vFiles; | 32 | DocLnkSet vFiles; |
33 | QListView *audioView, *videoView, *playlistView; | 33 | QListView *audioView, *videoView, *playlistView; |
34 | QLabel *libString; | 34 | QLabel *libString; |
35 | QPopupMenu *pmView ; | 35 | QPopupMenu *pmView ; |
36 | bool fromSetDocument; | 36 | bool fromSetDocument; |
37 | bool insanityBool; | 37 | bool insanityBool; |
38 | QString setDocFileRef; | 38 | QString setDocFileRef; |
39 | // retrieve the current playlist entry (media file link) | 39 | // retrieve the current playlist entry (media file link) |
40 | const DocLnk *current(); | 40 | const DocLnk *current(); |
41 | void useSelectedDocument(); | 41 | void useSelectedDocument(); |
42 | /* QTimer * menuTimer; */ | 42 | /* QTimer * menuTimer; */ |
43 | FileSelector* playLists; | 43 | FileSelector* playLists; |
44 | QPushButton *tbDeletePlaylist; | 44 | QPushButton *tbDeletePlaylist; |
45 | int fd, selected; | 45 | int selected; |
46 | public slots: | 46 | public slots: |
47 | bool first(); | 47 | bool first(); |
48 | bool last(); | 48 | bool last(); |
49 | bool next(); | 49 | bool next(); |
50 | bool prev(); | 50 | bool prev(); |
51 | /* void setFullScreen(); */ | 51 | /* void setFullScreen(); */ |
52 | /* void setScaled(); */ | 52 | /* void setScaled(); */ |
53 | protected: | 53 | protected: |
54 | /* void contentsMousePressEvent( QMouseEvent * e ); */ | 54 | /* void contentsMousePressEvent( QMouseEvent * e ); */ |
55 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ | 55 | /* void contentsMouseReleaseEvent( QMouseEvent * e ); */ |
56 | void keyReleaseEvent( QKeyEvent *e); | 56 | void keyReleaseEvent( QKeyEvent *e); |
57 | void keyPressEvent( QKeyEvent *e); | 57 | void keyPressEvent( QKeyEvent *e); |
58 | private: | 58 | private: |
59 | int defaultSkinIndex; | 59 | int defaultSkinIndex; |
60 | QPopupMenu *skinsMenu; | 60 | QPopupMenu *skinsMenu; |
61 | bool audioScan, videoScan; | 61 | bool audioScan, videoScan; |
62 | void doBlank(); | ||
63 | void doUnblank(); | ||
64 | void readm3u(const QString &); | 62 | void readm3u(const QString &); |
65 | void readPls(const QString &); | 63 | void readPls(const QString &); |
66 | 64 | ||
67 | void initializeStates(); | 65 | void initializeStates(); |
68 | void readConfig( Config& cfg ); | 66 | void readConfig( Config& cfg ); |
69 | void writeConfig( Config& cfg ) const; | 67 | void writeConfig( Config& cfg ) const; |
70 | PlayListWidgetPrivate *d; // Private implementation data | 68 | PlayListWidgetPrivate *d; // Private implementation data |
71 | void populateAudioView(); | 69 | void populateAudioView(); |
72 | void populateVideoView(); | 70 | void populateVideoView(); |
73 | private slots: | 71 | private slots: |
74 | void populateSkinsMenu(); | 72 | void populateSkinsMenu(); |
75 | void skinsMenuActivated(int); | 73 | void skinsMenuActivated(int); |
76 | void pmViewActivated(int); | 74 | void pmViewActivated(int); |
77 | void writem3u(); | 75 | void writem3u(); |
78 | void scanForAudio(); | 76 | void scanForAudio(); |
79 | void scanForVideo(); | 77 | void scanForVideo(); |
80 | void openFile(); | 78 | void openFile(); |
81 | void setDocument( const QString& fileref ); | 79 | void setDocument( const QString& fileref ); |
82 | void addToSelection( const DocLnk& ); // Add a media file to the playlist | 80 | void addToSelection( const DocLnk& ); // Add a media file to the playlist |
83 | void addToSelection( QListViewItem* ); // Add a media file to the playlist | 81 | void addToSelection( QListViewItem* ); // Add a media file to the playlist |
84 | void setActiveWindow(); // need to handle this to show the right view | 82 | void setActiveWindow(); // need to handle this to show the right view |
85 | void setPlaylist( bool ); // Show/Hide the playlist | 83 | void setPlaylist( bool ); // Show/Hide the playlist |
86 | void setView( char ); | 84 | void setView( char ); |
87 | void clearList(); | 85 | void clearList(); |
88 | void addAllToList(); | 86 | void addAllToList(); |
89 | void addAllMusicToList(); | 87 | void addAllMusicToList(); |
90 | void addAllVideoToList(); | 88 | void addAllVideoToList(); |
91 | void saveList(); // Save the playlist | 89 | void saveList(); // Save the playlist |
92 | void loadList( const DocLnk &); // Load a playlist | 90 | void loadList( const DocLnk &); // Load a playlist |
93 | void playIt( QListViewItem *); | 91 | void playIt( QListViewItem *); |
94 | 92 | ||
95 | void btnPlay(bool); | 93 | void btnPlay(bool); |
96 | void deletePlaylist(); | 94 | void deletePlaylist(); |
97 | void addSelected(); | 95 | void addSelected(); |
98 | void removeSelected(); | 96 | void removeSelected(); |
99 | void tabChanged(QWidget*); | 97 | void tabChanged(QWidget*); |
100 | void viewPressed( int, QListViewItem *, const QPoint&, int); | 98 | void viewPressed( int, QListViewItem *, const QPoint&, int); |
101 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); | 99 | void playlistViewPressed( int, QListViewItem *, const QPoint&, int); |
102 | void playSelected(); | 100 | void playSelected(); |
103 | void listDelete(); | 101 | void listDelete(); |
104 | 102 | ||
105 | protected slots: | 103 | protected slots: |
106 | /* void cancelMenuTimer(); */ | 104 | /* void cancelMenuTimer(); */ |
107 | /* void showFileMenu(); */ | 105 | /* void showFileMenu(); */ |
108 | 106 | ||
109 | 107 | ||
110 | }; | 108 | }; |
111 | 109 | ||
112 | 110 | ||
113 | #endif // PLAY_LIST_WIDGET_H | 111 | #endif // PLAY_LIST_WIDGET_H |
114 | 112 | ||