summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-08-16 13:39:04 (UTC)
committer harlekin <harlekin>2002-08-16 13:39:04 (UTC)
commit10006a500ed73c7640572b05d9b403e5739bfa0c (patch) (unidiff)
tree870535988a6f603e9087e770778503d94baabfd6
parent5144bf5607a246441f5b37dd0bbb9564017ce017 (diff)
downloadopie-10006a500ed73c7640572b05d9b403e5739bfa0c.zip
opie-10006a500ed73c7640572b05d9b403e5739bfa0c.tar.gz
opie-10006a500ed73c7640572b05d9b403e5739bfa0c.tar.bz2
playing arround with blank
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/audiowidget.cpp3
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp49
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h5
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp16
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h5
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp35
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h10
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
@@ -523,32 +523,33 @@ 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();
@@ -566,23 +567,23 @@ void AudioWidget::keyReleaseEvent( QKeyEvent *e)
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,122 +1,121 @@
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
21extern AudioWidget *audioUI; 26extern AudioWidget *audioUI;
22extern VideoWidget *videoUI; 27extern VideoWidget *videoUI;
23extern PlayListWidget *playList; 28extern PlayListWidget *playList;
24extern MediaPlayerState *mediaPlayerState; 29extern MediaPlayerState *mediaPlayerState;
25 30
26 31
27MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 32MediaPlayer::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
56MediaPlayer::~MediaPlayer() { 62MediaPlayer::~MediaPlayer() {
57 delete xineControl; 63 delete xineControl;
58 delete volControl; 64 delete volControl;
59} 65}
60 66
61void MediaPlayer::pauseCheck( bool b ) { 67void 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
67void MediaPlayer::play() { 73void MediaPlayer::play() {
68 mediaPlayerState->setPlaying( FALSE ); 74 mediaPlayerState->setPlaying( FALSE );
69 mediaPlayerState->setPlaying( TRUE ); 75 mediaPlayerState->setPlaying( TRUE );
70} 76}
71 77
72void MediaPlayer::setPlaying( bool play ) { 78void 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
112void MediaPlayer::prev() { 111void 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}
@@ -236,48 +235,60 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
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
252void 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
252void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 269void 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
271void MediaPlayer::doBlank() {
272
273}
274
275void MediaPlayer::doUnblank() {
276
277}
278
279void MediaPlayer::cleanUp() { 291void 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
@@ -15,32 +15,33 @@ class VolumeControl;
15class MediaPlayer : public QObject { 15class MediaPlayer : public QObject {
16 Q_OBJECT 16 Q_OBJECT
17public: 17public:
18 MediaPlayer( QObject *parent, const char *name ); 18 MediaPlayer( QObject *parent, const char *name );
19 ~MediaPlayer(); 19 ~MediaPlayer();
20 20
21private slots: 21private 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
32protected: 33protected:
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();
37private: 36private:
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
@@ -102,41 +102,50 @@ long MediaPlayerState::length() {
102} 102}
103 103
104char MediaPlayerState::view() { 104char MediaPlayerState::view() {
105 return curView; 105 return curView;
106} 106}
107 107
108// slots 108// slots
109void MediaPlayerState::setIsStreaming( bool b ) { 109void 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
118void MediaPlayerState::setFullscreen( bool b ) { 118void 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
127void MediaPlayerState::setFullscreen( bool b ) {
128 if ( isBlanked == b ) {
129 return;
130 }
131 isBlanked = b;
132 emit blankToggled(b);
133}
134
135
127void MediaPlayerState::setScaled( bool b ) { 136void 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
135void MediaPlayerState::setLooping( bool b ) { 144void 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
@@ -244,26 +253,29 @@ void MediaPlayerState::toggleScaled() {
244 setScaled( !isScaled); 253 setScaled( !isScaled);
245} 254}
246 255
247void MediaPlayerState::toggleLooping() { 256void MediaPlayerState::toggleLooping() {
248 setLooping( !isLooping); 257 setLooping( !isLooping);
249} 258}
250 259
251void MediaPlayerState::toggleShuffled() { 260void MediaPlayerState::toggleShuffled() {
252 setShuffled( !isShuffled); 261 setShuffled( !isShuffled);
253} 262}
254 263
255void MediaPlayerState::togglePlaylist() { 264void MediaPlayerState::togglePlaylist() {
256 setPlaylist( !usePlaylist); 265 setPlaylist( !usePlaylist);
257} 266}
258 267
259void MediaPlayerState::togglePaused() { 268void MediaPlayerState::togglePaused() {
260 setPaused( !isPaused); 269 setPaused( !isPaused);
261} 270}
262 271
263void MediaPlayerState::togglePlaying() { 272void MediaPlayerState::togglePlaying() {
264 setPlaying( !isPlaying); 273 setPlaying( !isPlaying);
265} 274}
266 275
276void 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
@@ -65,68 +65,71 @@ public:
65 char view(); 65 char view();
66 66
67public slots: 67public 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
96signals: 98signals:
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
113private: 115private:
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,20 +1,18 @@
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>
@@ -32,43 +30,32 @@
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
63extern MediaPlayerState *mediaPlayerState; 50extern MediaPlayerState *mediaPlayerState;
64 51
65 52
66class PlayListWidgetPrivate { 53class PlayListWidgetPrivate {
67public: 54public:
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};
@@ -997,33 +984,33 @@ void PlayListWidget::openFile() {
997 984
998void PlayListWidget::keyReleaseEvent( QKeyEvent *e) 985void 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:
@@ -1066,53 +1053,33 @@ void PlayListWidget::keyPressEvent( QKeyEvent *)
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
1082void 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
1091void 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
1104void PlayListWidget::readm3u(const QString &filename) { 1071void 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:") {
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
@@ -29,63 +29,61 @@ public:
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;
46public slots: 46public 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(); */
53protected: 53protected:
54/* void contentsMousePressEvent( QMouseEvent * e ); */ 54/* void contentsMousePressEvent( QMouseEvent * e ); */
55/* void contentsMouseReleaseEvent( QMouseEvent * e ); */ 55/* void contentsMouseReleaseEvent( QMouseEvent * e ); */
56void keyReleaseEvent( QKeyEvent *e); 56void keyReleaseEvent( QKeyEvent *e);
57void keyPressEvent( QKeyEvent *e); 57void keyPressEvent( QKeyEvent *e);
58private: 58private:
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();
73private slots: 71private 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