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 | |||
@@ -507,82 +507,83 @@ void AudioWidget::paintEvent( QPaintEvent * pe) { | |||
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,138 +1,137 @@ | |||
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() { |
@@ -220,64 +219,76 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
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 | |||
@@ -86,73 +86,82 @@ bool MediaPlayerState::paused() { | |||
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 | ||
@@ -228,42 +237,45 @@ void MediaPlayerState::setList() { | |||
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 | |||
@@ -49,84 +49,87 @@ public: | |||
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,90 +1,77 @@ | |||
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 | ||
@@ -981,65 +968,65 @@ void PlayListWidget::openFile() { | |||
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: |
@@ -1050,85 +1037,65 @@ void PlayListWidget::keyReleaseEvent( QKeyEvent *e) | |||
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 ); |
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 | |||
@@ -13,95 +13,93 @@ | |||
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(); */ |