summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp23
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.h3
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h4
-rw-r--r--noncore/multimedia/opieplayer2/opieplayer2.pro10
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp51
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.h38
7 files changed, 116 insertions, 19 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 87184ba..be59d8d 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -1,163 +1,168 @@
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 5
6#include <qmainwindow.h> 6#include <qmainwindow.h>
7#include <qmessagebox.h> 7#include <qmessagebox.h>
8#include <qwidgetstack.h> 8#include <qwidgetstack.h>
9#include <qfile.h> 9#include <qfile.h>
10 10
11#include "mediaplayer.h" 11#include "mediaplayer.h"
12#include "playlistwidget.h" 12#include "playlistwidget.h"
13#include "audiowidget.h" 13#include "audiowidget.h"
14 14
15#include "mediaplayerstate.h" 15#include "mediaplayerstate.h"
16 16
17 17
18
18extern AudioWidget *audioUI; 19extern AudioWidget *audioUI;
19extern PlayListWidget *playList; 20extern PlayListWidget *playList;
20extern MediaPlayerState *mediaPlayerState; 21extern MediaPlayerState *mediaPlayerState;
21 22
22 23
23MediaPlayer::MediaPlayer( QObject *parent, const char *name ) 24MediaPlayer::MediaPlayer( QObject *parent, const char *name )
24 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { 25 : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) {
25 26
26 27
28 xineControl = new XineControl();
27// QPEApplication::grabKeyboard(); // EVIL 29// QPEApplication::grabKeyboard(); // EVIL
28 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); 30 connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) );
29 31
30 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) ); 32 connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( setPlaying( bool ) ) );
31 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) ); 33 connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pauseCheck( bool ) ) );
32 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) ); 34 connect( mediaPlayerState, SIGNAL( next() ), this, SLOT( next() ) );
33 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) ); 35 connect( mediaPlayerState, SIGNAL( prev() ), this, SLOT( prev() ) );
36
37 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
38 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
39 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
40 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
34 41
35 connect( audioUI, SIGNAL( moreClicked() ), this, SLOT( startIncreasingVolume() ) );
36 connect( audioUI, SIGNAL( lessClicked() ), this, SLOT( startDecreasingVolume() ) );
37 connect( audioUI, SIGNAL( moreReleased() ), this, SLOT( stopChangingVolume() ) );
38 connect( audioUI, SIGNAL( lessReleased() ), this, SLOT( stopChangingVolume() ) );
39} 42}
40 43
41MediaPlayer::~MediaPlayer() { 44MediaPlayer::~MediaPlayer() {
42} 45}
43 46
44void MediaPlayer::pauseCheck( bool b ) { 47void MediaPlayer::pauseCheck( bool b ) {
45 // Only pause if playing 48 // Only pause if playing
46 if ( b && !mediaPlayerState->playing() ) 49 if ( b && !mediaPlayerState->playing() ) {
47 mediaPlayerState->setPaused( FALSE ); 50 mediaPlayerState->setPaused( FALSE );
51 }
48} 52}
49 53
50void MediaPlayer::play() { 54void MediaPlayer::play() {
51 mediaPlayerState->setPlaying( FALSE ); 55 mediaPlayerState->setPlaying( FALSE );
52 mediaPlayerState->setPlaying( TRUE ); 56 mediaPlayerState->setPlaying( TRUE );
53} 57}
54 58
55void MediaPlayer::setPlaying( bool play ) { 59void MediaPlayer::setPlaying( bool play ) {
56 if ( !play ) { 60 if ( !play ) {
57 mediaPlayerState->setPaused( FALSE ); 61 mediaPlayerState->setPaused( FALSE );
58 return; 62 return;
59 } 63 }
60 64
61 if ( mediaPlayerState->paused() ) { 65 if ( mediaPlayerState->paused() ) {
62 mediaPlayerState->setPaused( FALSE ); 66 mediaPlayerState->setPaused( FALSE );
63 return; 67 return;
64 } 68 }
65 69
66 const DocLnk *playListCurrent = playList->current(); 70 const DocLnk *playListCurrent = playList->current();
67 if ( playListCurrent != NULL ) { 71 if ( playListCurrent != NULL ) {
68 currentFile = playListCurrent; 72 currentFile = playListCurrent;
69 } 73 }
70 74
71 audioUI->setTickerText( currentFile->file() ); 75 audioUI->setTickerText( currentFile->file( ) );
72 76
77 xineControl->play( currentFile->file() );
73 78
74 // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben 79 // alles nicht nötig, xine kümmert sich drum, man muss nur den return andio oder video gui geben
75 80
76 // Ob auch video 'v' : 'a' 81 // Ob auch video 'v' : 'a'
77 // mediaPlayerState->setView( 'v' ); 82 // mediaPlayerState->setView( 'v' );
78 83
79 // abspielen starten. 84 // abspielen starten.
80} 85}
81 86
82 87
83void MediaPlayer::prev() { 88void MediaPlayer::prev() {
84 if ( playList->prev() ) 89 if ( playList->prev() )
85 play(); 90 play();
86 else if ( mediaPlayerState->looping() ) { 91 else if ( mediaPlayerState->looping() ) {
87 if ( playList->last() ) 92 if ( playList->last() )
88 play(); 93 play();
89 } else 94 } else
90 mediaPlayerState->setList(); 95 mediaPlayerState->setList();
91} 96}
92 97
93 98
94void MediaPlayer::next() { 99void MediaPlayer::next() {
95 if ( playList->next() ) 100 if ( playList->next() )
96 play(); 101 play();
97 else if ( mediaPlayerState->looping() ) { 102 else if ( mediaPlayerState->looping() ) {
98 if ( playList->first() ) 103 if ( playList->first() )
99 play(); 104 play();
100 } else 105 } else
101 mediaPlayerState->setList(); 106 mediaPlayerState->setList();
102} 107}
103 108
104 109
105void MediaPlayer::startDecreasingVolume() { 110void MediaPlayer::startDecreasingVolume() {
106 volumeDirection = -1; 111 volumeDirection = -1;
107 startTimer( 100 ); 112 startTimer( 100 );
108 // da kommt demnächst osound denk ich mal 113 // da kommt demnächst osound denk ich mal
109 // AudioDevice::decreaseVolume(); 114 // AudioDevice::decreaseVolume();
110} 115}
111 116
112 117
113void MediaPlayer::startIncreasingVolume() { 118void MediaPlayer::startIncreasingVolume() {
114 volumeDirection = +1; 119 volumeDirection = +1;
115 startTimer( 100 ); 120 startTimer( 100 );
116 // AudioDevice::increaseVolume(); 121 // AudioDevice::increaseVolume();
117} 122}
118 123
119 124
120void MediaPlayer::stopChangingVolume() { 125void MediaPlayer::stopChangingVolume() {
121 killTimers(); 126 killTimers();
122} 127}
123 128
124 129
125void MediaPlayer::timerEvent( QTimerEvent * ) { 130void MediaPlayer::timerEvent( QTimerEvent * ) {
126 // if ( volumeDirection == +1 ) 131 // if ( volumeDirection == +1 )
127 // AudioDevice::increaseVolume(); 132 // AudioDevice::increaseVolume();
128 // else if ( volumeDirection == -1 ) 133 // else if ( volumeDirection == -1 )
129 // AudioDevice::decreaseVolume(); 134 // AudioDevice::decreaseVolume();
130} 135}
131 136
132void MediaPlayer::keyReleaseEvent( QKeyEvent *e) { 137void MediaPlayer::keyReleaseEvent( QKeyEvent *e) {
133 switch ( e->key() ) { 138 switch ( e->key() ) {
134////////////////////////////// Zaurus keys 139////////////////////////////// Zaurus keys
135 case Key_Home: 140 case Key_Home:
136 break; 141 break;
137 case Key_F9: //activity 142 case Key_F9: //activity
138 break; 143 break;
139 case Key_F10: //contacts 144 case Key_F10: //contacts
140 break; 145 break;
141 case Key_F11: //menu 146 case Key_F11: //menu
142 break; 147 break;
143 case Key_F12: //home 148 case Key_F12: //home
144 qDebug("Blank here"); 149 qDebug("Blank here");
145 break; 150 break;
146 case Key_F13: //mail 151 case Key_F13: //mail
147 break; 152 break;
148 } 153 }
149} 154}
150 155
151void MediaPlayer::doBlank() { 156void MediaPlayer::doBlank() {
152 157
153} 158}
154 159
155void MediaPlayer::doUnblank() { 160void MediaPlayer::doUnblank() {
156 161
157} 162}
158 163
159void MediaPlayer::cleanUp() { 164void MediaPlayer::cleanUp() {
160// QPEApplication::grabKeyboard(); 165// QPEApplication::grabKeyboard();
161// QPEApplication::ungrabKeyboard(); 166// QPEApplication::ungrabKeyboard();
162 167
163} 168}
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.h b/noncore/multimedia/opieplayer2/mediaplayer.h
index c4d38b5..7b79066 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.h
+++ b/noncore/multimedia/opieplayer2/mediaplayer.h
@@ -1,43 +1,46 @@
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 11
11class DocLnk; 12class DocLnk;
12 13
13 14
14class MediaPlayer : public QObject { 15class MediaPlayer : public QObject {
15 Q_OBJECT 16 Q_OBJECT
16public: 17public:
17 MediaPlayer( QObject *parent, const char *name ); 18 MediaPlayer( QObject *parent, const char *name );
18 ~MediaPlayer(); 19 ~MediaPlayer();
19 20
20private slots: 21private slots:
21 void setPlaying( bool ); 22 void setPlaying( bool );
22 void pauseCheck( bool ); 23 void pauseCheck( bool );
23 void play(); 24 void play();
24 void next(); 25 void next();
25 void prev(); 26 void prev();
26 void startIncreasingVolume(); 27 void startIncreasingVolume();
27 void startDecreasingVolume(); 28 void startDecreasingVolume();
28 void stopChangingVolume(); 29 void stopChangingVolume();
29 void cleanUp(); 30 void cleanUp();
30 31
31protected: 32protected:
32 void timerEvent( QTimerEvent *e ); 33 void timerEvent( QTimerEvent *e );
33 void keyReleaseEvent( QKeyEvent *e); 34 void keyReleaseEvent( QKeyEvent *e);
34 void doBlank(); 35 void doBlank();
35 void doUnblank(); 36 void doUnblank();
36private: 37private:
37 int volumeDirection; 38 int volumeDirection;
38 const DocLnk *currentFile; 39 const DocLnk *currentFile;
40 XineControl *xineControl;
41
39}; 42};
40 43
41 44
42#endif // MEDIA_PLAYER_H 45#endif // MEDIA_PLAYER_H
43 46
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 2f24b00..3090b08 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -1,245 +1,243 @@
1
2
3
4#include <qpe/qpeapplication.h> 1#include <qpe/qpeapplication.h>
5#include <qpe/qlibrary.h> 2#include <qpe/qlibrary.h>
6#include <qpe/config.h> 3#include <qpe/config.h>
7#include <qvaluelist.h> 4#include <qvaluelist.h>
8#include <qobject.h> 5#include <qobject.h>
9#include <qdir.h> 6#include <qdir.h>
10#include <qpe/mediaplayerplugininterface.h>
11#include "mediaplayerstate.h" 7#include "mediaplayerstate.h"
12 8
13 9
14 10
15//#define MediaPlayerDebug(x) qDebug x 11//#define MediaPlayerDebug(x) qDebug x
16#define MediaPlayerDebug(x) 12#define MediaPlayerDebug(x)
17 13
18 14
19MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) 15MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
20 : QObject( parent, name ) { 16 : QObject( parent, name ) {
21 Config cfg( "OpiePlayer" ); 17 Config cfg( "OpiePlayer" );
22 readConfig( cfg ); 18 readConfig( cfg );
19
23} 20}
24 21
25 22
26MediaPlayerState::~MediaPlayerState() { 23MediaPlayerState::~MediaPlayerState() {
27 Config cfg( "OpiePlayer" ); 24 Config cfg( "OpiePlayer" );
28 writeConfig( cfg ); 25 writeConfig( cfg );
26
29} 27}
30 28
31 29
32void MediaPlayerState::readConfig( Config& cfg ) { 30void MediaPlayerState::readConfig( Config& cfg ) {
33 cfg.setGroup("Options"); 31 cfg.setGroup("Options");
34 isFullscreen = cfg.readBoolEntry( "FullScreen" ); 32 isFullscreen = cfg.readBoolEntry( "FullScreen" );
35 isScaled = cfg.readBoolEntry( "Scaling" ); 33 isScaled = cfg.readBoolEntry( "Scaling" );
36 isLooping = cfg.readBoolEntry( "Looping" ); 34 isLooping = cfg.readBoolEntry( "Looping" );
37 isShuffled = cfg.readBoolEntry( "Shuffle" ); 35 isShuffled = cfg.readBoolEntry( "Shuffle" );
38 usePlaylist = cfg.readBoolEntry( "UsePlayList" ); 36 usePlaylist = cfg.readBoolEntry( "UsePlayList" );
39 usePlaylist = TRUE; 37 usePlaylist = TRUE;
40 isPlaying = FALSE; 38 isPlaying = FALSE;
41 isPaused = FALSE; 39 isPaused = FALSE;
42 curPosition = 0; 40 curPosition = 0;
43 curLength = 0; 41 curLength = 0;
44 curView = 'l'; 42 curView = 'l';
45} 43}
46 44
47 45
48void MediaPlayerState::writeConfig( Config& cfg ) const { 46void MediaPlayerState::writeConfig( Config& cfg ) const {
49 cfg.setGroup("Options"); 47 cfg.setGroup("Options");
50 cfg.writeEntry("FullScreen", isFullscreen ); 48 cfg.writeEntry("FullScreen", isFullscreen );
51 cfg.writeEntry("Scaling", isScaled ); 49 cfg.writeEntry("Scaling", isScaled );
52 cfg.writeEntry("Looping", isLooping ); 50 cfg.writeEntry("Looping", isLooping );
53 cfg.writeEntry("Shuffle", isShuffled ); 51 cfg.writeEntry("Shuffle", isShuffled );
54 cfg.writeEntry("UsePlayList", usePlaylist ); 52 cfg.writeEntry("UsePlayList", usePlaylist );
55} 53}
56 54
57 55
58 56
59 57
60// public stuff 58// public stuff
61bool MediaPlayerState::fullscreen() { 59bool MediaPlayerState::fullscreen() {
62 return isFullscreen; 60 return isFullscreen;
63} 61}
64 62
65bool MediaPlayerState::scaled() { 63bool MediaPlayerState::scaled() {
66 return isScaled; 64 return isScaled;
67} 65}
68 66
69bool MediaPlayerState::looping() { 67bool MediaPlayerState::looping() {
70 return isLooping; 68 return isLooping;
71} 69}
72 70
73bool MediaPlayerState::shuffled() { 71bool MediaPlayerState::shuffled() {
74 return isShuffled; 72 return isShuffled;
75} 73}
76 74
77 75
78bool MediaPlayerState:: playlist() { 76bool MediaPlayerState:: playlist() {
79 return usePlaylist; 77 return usePlaylist;
80} 78}
81 79
82bool MediaPlayerState::paused() { 80bool MediaPlayerState::paused() {
83 return isPaused; 81 return isPaused;
84} 82}
85 83
86bool MediaPlayerState::playing() { 84bool MediaPlayerState::playing() {
87 return isPlaying; 85 return isPlaying;
88} 86}
89 87
90long MediaPlayerState::position() { 88long MediaPlayerState::position() {
91 return curPosition; 89 return curPosition;
92} 90}
93 91
94long MediaPlayerState::length() { 92long MediaPlayerState::length() {
95 return curLength; 93 return curLength;
96} 94}
97 95
98char MediaPlayerState::view() { 96char MediaPlayerState::view() {
99 return curView; 97 return curView;
100} 98}
101 99
102// slots 100// slots
103void MediaPlayerState::setFullscreen( bool b ) { 101void MediaPlayerState::setFullscreen( bool b ) {
104 if ( isFullscreen == b ) { 102 if ( isFullscreen == b ) {
105 return; 103 return;
106 } 104 }
107 isFullscreen = b; 105 isFullscreen = b;
108 emit fullscreenToggled(b); 106 emit fullscreenToggled(b);
109} 107}
110 108
111 109
112void MediaPlayerState::setScaled( bool b ) { 110void MediaPlayerState::setScaled( bool b ) {
113 if ( isScaled == b ) { 111 if ( isScaled == b ) {
114 return; 112 return;
115 } 113 }
116 isScaled = b; 114 isScaled = b;
117 emit scaledToggled(b); 115 emit scaledToggled(b);
118} 116}
119 117
120void MediaPlayerState::setLooping( bool b ) { 118void MediaPlayerState::setLooping( bool b ) {
121 if ( isLooping == b ) { 119 if ( isLooping == b ) {
122 return; 120 return;
123 } 121 }
124 isLooping = b; 122 isLooping = b;
125 emit loopingToggled(b); 123 emit loopingToggled(b);
126} 124}
127 125
128void MediaPlayerState::setShuffled( bool b ) { 126void MediaPlayerState::setShuffled( bool b ) {
129 if ( isShuffled == b ) { 127 if ( isShuffled == b ) {
130 return; 128 return;
131 } 129 }
132 isShuffled = b; 130 isShuffled = b;
133 emit shuffledToggled(b); 131 emit shuffledToggled(b);
134} 132}
135 133
136void MediaPlayerState::setPlaylist( bool b ) { 134void MediaPlayerState::setPlaylist( bool b ) {
137 if ( usePlaylist == b ) { 135 if ( usePlaylist == b ) {
138 return; 136 return;
139 } 137 }
140 usePlaylist = b; 138 usePlaylist = b;
141 emit playlistToggled(b); 139 emit playlistToggled(b);
142} 140}
143 141
144void MediaPlayerState::setPaused( bool b ) { 142void MediaPlayerState::setPaused( bool b ) {
145 if ( isPaused == b ) { 143 if ( isPaused == b ) {
146 return; 144 return;
147 } 145 }
148 isPaused = b; 146 isPaused = b;
149 emit pausedToggled(b); 147 emit pausedToggled(b);
150} 148}
151 149
152void MediaPlayerState::setPlaying( bool b ) { 150void MediaPlayerState::setPlaying( bool b ) {
153 if ( isPlaying == b ) { 151 if ( isPlaying == b ) {
154 return; 152 return;
155 } 153 }
156 isPlaying = b; 154 isPlaying = b;
157 emit playingToggled(b); 155 emit playingToggled(b);
158} 156}
159 157
160void MediaPlayerState::setPosition( long p ) { 158void MediaPlayerState::setPosition( long p ) {
161 if ( curPosition == p ) { 159 if ( curPosition == p ) {
162 return; 160 return;
163 } 161 }
164 curPosition = p; 162 curPosition = p;
165 emit positionChanged(p); 163 emit positionChanged(p);
166} 164}
167 165
168void MediaPlayerState::updatePosition( long p ){ 166void MediaPlayerState::updatePosition( long p ){
169 if ( curPosition == p ) { 167 if ( curPosition == p ) {
170 return; 168 return;
171 } 169 }
172 curPosition = p; 170 curPosition = p;
173 emit positionUpdated(p); 171 emit positionUpdated(p);
174} 172}
175 173
176void MediaPlayerState::setLength( long l ) { 174void MediaPlayerState::setLength( long l ) {
177 if ( curLength == l ) { 175 if ( curLength == l ) {
178 return; 176 return;
179 } 177 }
180 curLength = l; 178 curLength = l;
181 emit lengthChanged(l); 179 emit lengthChanged(l);
182} 180}
183 181
184void MediaPlayerState::setView( char v ) { 182void MediaPlayerState::setView( char v ) {
185 if ( curView == v ) { 183 if ( curView == v ) {
186 return; 184 return;
187 } 185 }
188 curView = v; 186 curView = v;
189 emit viewChanged(v); 187 emit viewChanged(v);
190} 188}
191 189
192void MediaPlayerState::setPrev(){ 190void MediaPlayerState::setPrev(){
193 emit prev(); 191 emit prev();
194} 192}
195 193
196void MediaPlayerState::setNext() { 194void MediaPlayerState::setNext() {
197 emit next(); 195 emit next();
198} 196}
199 197
200void MediaPlayerState::setList() { 198void MediaPlayerState::setList() {
201 setPlaying( FALSE ); 199 setPlaying( FALSE );
202 setView('l'); 200 setView('l');
203} 201}
204 202
205void MediaPlayerState::setVideo() { 203void MediaPlayerState::setVideo() {
206 setView('v'); 204 setView('v');
207} 205}
208 206
209void MediaPlayerState::setAudio() { 207void MediaPlayerState::setAudio() {
210 setView('a'); 208 setView('a');
211} 209}
212 210
213 211
214 212
215void MediaPlayerState::toggleFullscreen() { 213void MediaPlayerState::toggleFullscreen() {
216 setFullscreen( !isFullscreen ); 214 setFullscreen( !isFullscreen );
217} 215}
218 216
219void MediaPlayerState::toggleScaled() { 217void MediaPlayerState::toggleScaled() {
220 setScaled( !isScaled); 218 setScaled( !isScaled);
221} 219}
222 220
223void MediaPlayerState::toggleLooping() { 221void MediaPlayerState::toggleLooping() {
224 setLooping( !isLooping); 222 setLooping( !isLooping);
225} 223}
226 224
227void MediaPlayerState::toggleShuffled() { 225void MediaPlayerState::toggleShuffled() {
228 setShuffled( !isShuffled); 226 setShuffled( !isShuffled);
229} 227}
230 228
231void MediaPlayerState::togglePlaylist() { 229void MediaPlayerState::togglePlaylist() {
232 setPlaylist( !usePlaylist); 230 setPlaylist( !usePlaylist);
233} 231}
234 232
235void MediaPlayerState::togglePaused() { 233void MediaPlayerState::togglePaused() {
236 setPaused( !isPaused); 234 setPaused( !isPaused);
237} 235}
238 236
239void MediaPlayerState::togglePlaying() { 237void MediaPlayerState::togglePlaying() {
240 setPlaying( !isPlaying); 238 setPlaying( !isPlaying);
241} 239}
242 240
243 241
244 242
245 243
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index 7aa0ff2..dbbb0f2 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -1,92 +1,94 @@
1 1
2#ifndef MEDIA_PLAYER_STATE_H 2#ifndef MEDIA_PLAYER_STATE_H
3#define MEDIA_PLAYER_STATE_H 3#define MEDIA_PLAYER_STATE_H
4 4
5 5
6#include <qobject.h> 6#include <qobject.h>
7 7
8 8
9class MediaPlayerDecoder; 9class MediaPlayerDecoder;
10class Config; 10class Config;
11 11
12 12
13class MediaPlayerState : public QObject { 13class MediaPlayerState : public QObject {
14Q_OBJECT 14Q_OBJECT
15public: 15public:
16 MediaPlayerState( QObject *parent, const char *name ); 16 MediaPlayerState( QObject *parent, const char *name );
17 ~MediaPlayerState(); 17 ~MediaPlayerState();
18 18
19 bool isStreaming; 19 bool isStreaming;
20 bool fullscreen(); 20 bool fullscreen();
21 bool scaled(); 21 bool scaled();
22 bool looping(); 22 bool looping();
23 bool shuffled(); 23 bool shuffled();
24 bool playlist(); 24 bool playlist();
25 bool paused(); 25 bool paused();
26 bool playing(); 26 bool playing();
27 long position(); 27 long position();
28 long length(); 28 long length();
29 char view(); 29 char view();
30 30
31public slots: 31public slots:
32 void setFullscreen( bool b ); 32 void setFullscreen( bool b );
33 void setScaled( bool b ); 33 void setScaled( bool b );
34 void setLooping( bool b ); 34 void setLooping( bool b );
35 void setShuffled( bool b ); 35 void setShuffled( bool b );
36 void setPlaylist( bool b ); 36 void setPlaylist( bool b );
37 void setPaused( bool b ); 37 void setPaused( bool b );
38 void setPlaying( bool b ); 38 void setPlaying( bool b );
39 void setPosition( long p ); 39 void setPosition( long p );
40 void updatePosition( long p ); 40 void updatePosition( long p );
41 void setLength( long l ); 41 void setLength( long l );
42 void setView( char v ); 42 void setView( char v );
43 43
44 void setPrev() ; 44 void setPrev();
45 void setNext(); 45 void setNext();
46 void setList(); 46 void setList();
47 void setVideo(); 47 void setVideo();
48 void setAudio(); 48 void setAudio();
49 49
50 void toggleFullscreen(); 50 void toggleFullscreen();
51 void toggleScaled(); 51 void toggleScaled();
52 void toggleLooping(); 52 void toggleLooping();
53 void toggleShuffled(); 53 void toggleShuffled();
54 void togglePlaylist(); 54 void togglePlaylist();
55 void togglePaused(); 55 void togglePaused();
56 void togglePlaying(); 56 void togglePlaying();
57 57
58signals: 58signals:
59 void fullscreenToggled( bool ); 59 void fullscreenToggled( bool );
60 void scaledToggled( bool ); 60 void scaledToggled( bool );
61 void loopingToggled( bool ); 61 void loopingToggled( bool );
62 void shuffledToggled( bool ); 62 void shuffledToggled( bool );
63 void playlistToggled( bool ); 63 void playlistToggled( bool );
64 void pausedToggled( bool ); 64 void pausedToggled( bool );
65 void playingToggled( bool ); 65 void playingToggled( bool );
66 void positionChanged( long ); // When the slider is moved 66 void positionChanged( long ); // When the slider is moved
67 void positionUpdated( long ); // When the media file progresses 67 void positionUpdated( long ); // When the media file progresses
68 void lengthChanged( long ); 68 void lengthChanged( long );
69 void viewChanged( char ); 69 void viewChanged( char );
70 70
71 void prev(); 71 void prev();
72 void next(); 72 void next();
73 73
74private: 74private:
75 bool isFullscreen; 75 bool isFullscreen;
76 bool isScaled; 76 bool isScaled;
77 bool isLooping; 77 bool isLooping;
78 bool isShuffled; 78 bool isShuffled;
79 bool usePlaylist; 79 bool usePlaylist;
80 bool isPaused; 80 bool isPaused;
81 bool isPlaying; 81 bool isPlaying;
82 long curPosition; 82 long curPosition;
83 long curLength; 83 long curLength;
84 char curView; 84 char curView;
85 85
86 void readConfig( Config& cfg ); 86 void readConfig( Config& cfg );
87 void writeConfig( Config& cfg ) const; 87 void writeConfig( Config& cfg ) const;
88
89
88}; 90};
89 91
90 92
91#endif // MEDIA_PLAYER_STATE_H 93#endif // MEDIA_PLAYER_STATE_H
92 94
diff --git a/noncore/multimedia/opieplayer2/opieplayer2.pro b/noncore/multimedia/opieplayer2/opieplayer2.pro
index 47683ac..a6c7c2b 100644
--- a/noncore/multimedia/opieplayer2/opieplayer2.pro
+++ b/noncore/multimedia/opieplayer2/opieplayer2.pro
@@ -1,17 +1,17 @@
1TEMPLATE = app 1TEMPLATE = app
2CONFIG = qt warn_on release 2CONFIG = qt warn_on release
3#release 3#release
4DESTDIR = $(OPIEDIR)/bin 4DESTDIR = $(OPIEDIR)/bin
5HEADERS = playlistselection.h mediaplayerstate.h \ 5HEADERS = playlistselection.h mediaplayerstate.h xinecontrol.h\
6 videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h 6 videowidget.h audiowidget.h playlistwidget.h mediaplayer.h inputDialog.h
7SOURCES = main.cpp \ 7SOURCES = main.cpp \
8 playlistselection.cpp mediaplayerstate.cpp \ 8 playlistselection.cpp mediaplayerstate.cpp xinecontrol.cpp\
9 videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp 9 videowidget.cpp audiowidget.cpp playlistwidget.cpp mediaplayer.cpp inputDialog.cpp
10TARGET = opieplayer 10TARGET = opieplayer
11INCLUDEPATH += $(OPIEDIR)/include 11INCLUDEPATH += $(OPIEDIR)/include /usr/include
12DEPENDPATH += $(OPIEDIR)/include 12DEPENDPATH += $(OPIEDIR)/include /usr/include
13LIBS += -lqpe -lpthread -lopie 13LIBS += -lqpe -lpthread -lopie -lxine -lxineutils
14 14
15INCLUDEPATH += $(OPIEDIR)/include 15INCLUDEPATH += $(OPIEDIR)/include
16DEPENDPATH += $(OPIEDIR)/include 16DEPENDPATH += $(OPIEDIR)/include
17 17
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
new file mode 100644
index 0000000..aaa1a24
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -0,0 +1,51 @@
1
2#include "xinecontrol.h"
3#include "mediaplayerstate.h"
4
5extern MediaPlayerState *mediaPlayerState;
6
7XineControl::XineControl( QObject *parent, const char *name )
8 : QObject( parent, name ) {
9 libXine = new XINE::Lib();
10
11 connect( mediaPlayerState, SIGNAL( pausedToggled(bool) ), this, SLOT( pause(bool) ) );
12 connect( this, SIGNAL( positionChanged( int position ) ), mediaPlayerState, SLOT( updatePosition( long p ) ) );
13
14}
15
16XineControl::~XineControl() {
17 delete libXine;
18}
19
20void XineControl::play( const QString& fileName ) {
21 libXine->play( fileName );
22 mediaPlayerState->setPlaying( true );
23 // hier dann schaun welcher view
24}
25
26void XineControl::stop() {
27 libXine->stop();
28 mediaPlayerState->setPlaying( false );
29}
30
31void XineControl::pause( bool ) {
32 libXine->pause();
33}
34
35int XineControl::currentTime() {
36 // todo: jede sekunde überprüfen
37 m_currentTime = libXine->currentTime();
38 return m_currentTime;
39}
40
41void XineControl::length() {
42 m_length = libXine->length();
43 mediaPlayerState->setLength( m_length );
44}
45
46int XineControl::position() {
47 m_position = (m_currentTime/m_length*100);
48 mediaPlayerState->setPosition( m_position );
49 return m_position;
50 emit positionChanged( m_position );
51}
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.h b/noncore/multimedia/opieplayer2/xinecontrol.h
new file mode 100644
index 0000000..cba83c0
--- a/dev/null
+++ b/noncore/multimedia/opieplayer2/xinecontrol.h
@@ -0,0 +1,38 @@
1
2#ifndef XINECONTROL_H
3#define XINECONTROL_H
4
5#include "lib.h"
6#include <qobject.h>
7
8class XineControl : public QObject {
9 Q_OBJECT
10public:
11 XineControl( QObject *parent, const char *name );
12 ~XineControl();
13
14private slots:
15 void play( const QString& fileName );
16 void stop();
17 void pause( bool );
18
19 int currentTime();
20
21 // get length of media file and set it
22 void length();
23
24 int position();
25
26private:
27 XINE::Lib *libXine;
28 int m_length;
29 int m_currentTime;
30 int m_position;
31
32signals:
33 void positionChanged( int position );
34
35};
36
37
38#endif