summaryrefslogtreecommitdiff
authorsimon <simon>2002-12-02 19:29:34 (UTC)
committer simon <simon>2002-12-02 19:29:34 (UTC)
commitaf73e44e57b1095f92b6f6bcd530c2e4b626a664 (patch) (unidiff)
treef4178ea80b26bec9955e4c529d3b0c92301b08a8
parent24081d2efe5860c9656716b04af00e5ab85d1cd3 (diff)
downloadopie-af73e44e57b1095f92b6f6bcd530c2e4b626a664.zip
opie-af73e44e57b1095f92b6f6bcd530c2e4b626a664.tar.gz
opie-af73e44e57b1095f92b6f6bcd530c2e4b626a664.tar.bz2
- completed MediaPlayer::DisplayType transition
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp2
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.cpp27
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayerstate.h2
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidgetgui.cpp6
-rw-r--r--noncore/multimedia/opieplayer2/xinecontrol.cpp10
5 files changed, 12 insertions, 35 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index 74ab2e3..68bbae9 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -134,65 +134,65 @@ void MediaPlayer::setPlaying( bool play ) {
134 134
135 135
136void MediaPlayer::prev() { 136void MediaPlayer::prev() {
137 if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist 137 if( playList->currentTab() == PlayListWidget::CurrentPlayList ) { //if using the playlist
138 if ( playList->prev() ) { 138 if ( playList->prev() ) {
139 play(); 139 play();
140 } else if ( mediaPlayerState->isLooping() ) { 140 } else if ( mediaPlayerState->isLooping() ) {
141 if ( playList->last() ) { 141 if ( playList->last() ) {
142 play(); 142 play();
143 } 143 }
144 } else { 144 } else {
145 mediaPlayerState->setList(); 145 mediaPlayerState->setList();
146 } 146 }
147 } 147 }
148} 148}
149 149
150 150
151void MediaPlayer::next() { 151void MediaPlayer::next() {
152 152
153 if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist 153 if(playList->currentTab() == PlayListWidget::CurrentPlayList) { //if using the playlist
154 if ( playList->next() ) { 154 if ( playList->next() ) {
155 play(); 155 play();
156 } else if ( mediaPlayerState->isLooping() ) { 156 } else if ( mediaPlayerState->isLooping() ) {
157 if ( playList->first() ) { 157 if ( playList->first() ) {
158 play(); 158 play();
159 } 159 }
160 } else { 160 } else {
161 mediaPlayerState->setList(); 161 mediaPlayerState->setList();
162 } 162 }
163 } else { //if playing from file list, let's just stop 163 } else { //if playing from file list, let's just stop
164 qDebug("<<<<<<<<<<<<<<<<<stop for filelists"); 164 qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
165 mediaPlayerState->setPlaying(false); 165 mediaPlayerState->setPlaying(false);
166 mediaPlayerState->setView('l'); 166 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection );
167 if(l) mediaPlayerState->setLooping(l); 167 if(l) mediaPlayerState->setLooping(l);
168 if(r) mediaPlayerState->setShuffled(r); 168 if(r) mediaPlayerState->setShuffled(r);
169 } 169 }
170 qApp->processEvents(); 170 qApp->processEvents();
171} 171}
172 172
173 173
174void MediaPlayer::startDecreasingVolume() { 174void MediaPlayer::startDecreasingVolume() {
175 volumeDirection = -1; 175 volumeDirection = -1;
176 startTimer( 100 ); 176 startTimer( 100 );
177 volControl->decVol(2); 177 volControl->decVol(2);
178} 178}
179 179
180 180
181void MediaPlayer::startIncreasingVolume() { 181void MediaPlayer::startIncreasingVolume() {
182 volumeDirection = +1; 182 volumeDirection = +1;
183 startTimer( 100 ); 183 startTimer( 100 );
184 volControl->incVol(2); 184 volControl->incVol(2);
185} 185}
186 186
187 187
188bool drawnOnScreenDisplay = FALSE; 188bool drawnOnScreenDisplay = FALSE;
189unsigned int onScreenDisplayVolume = 0; 189unsigned int onScreenDisplayVolume = 0;
190const int yoff = 110; 190const int yoff = 110;
191 191
192void MediaPlayer::stopChangingVolume() { 192void MediaPlayer::stopChangingVolume() {
193 killTimers(); 193 killTimers();
194 // Get rid of the on-screen display stuff 194 // Get rid of the on-screen display stuff
195 drawnOnScreenDisplay = FALSE; 195 drawnOnScreenDisplay = FALSE;
196 onScreenDisplayVolume = 0; 196 onScreenDisplayVolume = 0;
197 int w=0; 197 int w=0;
198 int h=0; 198 int h=0;
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
index 901b43f..40fa1a4 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.cpp
@@ -56,76 +56,64 @@ MediaPlayerState::MediaPlayerState( QObject *parent, const char *name )
56} 56}
57 57
58 58
59MediaPlayerState::~MediaPlayerState() { 59MediaPlayerState::~MediaPlayerState() {
60} 60}
61 61
62 62
63void MediaPlayerState::readConfig( Config& cfg ) { 63void MediaPlayerState::readConfig( Config& cfg ) {
64 cfg.setGroup("Options"); 64 cfg.setGroup("Options");
65 fullscreen = cfg.readBoolEntry( "FullScreen" ); 65 fullscreen = cfg.readBoolEntry( "FullScreen" );
66 scaled = cfg.readBoolEntry( "Scaling" ); 66 scaled = cfg.readBoolEntry( "Scaling" );
67 looping = cfg.readBoolEntry( "Looping" ); 67 looping = cfg.readBoolEntry( "Looping" );
68 shuffled = cfg.readBoolEntry( "Shuffle" ); 68 shuffled = cfg.readBoolEntry( "Shuffle" );
69 videoGamma = cfg.readNumEntry( "VideoGamma" ); 69 videoGamma = cfg.readNumEntry( "VideoGamma" );
70 playing = FALSE; 70 playing = FALSE;
71 streaming = FALSE; 71 streaming = FALSE;
72 paused = FALSE; 72 paused = FALSE;
73 curPosition = 0; 73 curPosition = 0;
74 curLength = 0; 74 curLength = 0;
75 m_displayType = MediaSelection; 75 m_displayType = MediaSelection;
76} 76}
77 77
78 78
79void MediaPlayerState::writeConfig( Config& cfg ) const { 79void MediaPlayerState::writeConfig( Config& cfg ) const {
80 cfg.setGroup( "Options" ); 80 cfg.setGroup( "Options" );
81 cfg.writeEntry( "FullScreen", fullscreen ); 81 cfg.writeEntry( "FullScreen", fullscreen );
82 cfg.writeEntry( "Scaling", scaled ); 82 cfg.writeEntry( "Scaling", scaled );
83 cfg.writeEntry( "Looping", looping ); 83 cfg.writeEntry( "Looping", looping );
84 cfg.writeEntry( "Shuffle", shuffled ); 84 cfg.writeEntry( "Shuffle", shuffled );
85 cfg.writeEntry( "VideoGamma", videoGamma ); 85 cfg.writeEntry( "VideoGamma", videoGamma );
86} 86}
87 87
88char MediaPlayerState::view() const
89{
90 switch ( m_displayType ) {
91 case Audio: return 'a';
92 case Video: return 'v';
93 case MediaSelection: return 'l';
94 default: assert( false );
95 }
96 // never reached
97 return 42;
98}
99
100MediaPlayerState::DisplayType MediaPlayerState::displayType() const 88MediaPlayerState::DisplayType MediaPlayerState::displayType() const
101{ 89{
102 return m_displayType; 90 return m_displayType;
103} 91}
104 92
105// slots 93// slots
106void MediaPlayerState::setIsStreaming( bool b ) { 94void MediaPlayerState::setIsStreaming( bool b ) {
107 streaming = b; 95 streaming = b;
108} 96}
109 97
110void MediaPlayerState::setIsSeekable( bool b ) { 98void MediaPlayerState::setIsSeekable( bool b ) {
111 seekable = b; 99 seekable = b;
112 emit isSeekableToggled(b); 100 emit isSeekableToggled(b);
113} 101}
114 102
115 103
116void MediaPlayerState::setFullscreen( bool b ) { 104void MediaPlayerState::setFullscreen( bool b ) {
117 if ( fullscreen == b ) { 105 if ( fullscreen == b ) {
118 return; 106 return;
119 } 107 }
120 fullscreen = b; 108 fullscreen = b;
121 emit fullscreenToggled(b); 109 emit fullscreenToggled(b);
122} 110}
123 111
124 112
125void MediaPlayerState::setBlanked( bool b ) { 113void MediaPlayerState::setBlanked( bool b ) {
126 if ( blanked == b ) { 114 if ( blanked == b ) {
127 return; 115 return;
128 } 116 }
129 blanked = b; 117 blanked = b;
130 emit blankToggled(b); 118 emit blankToggled(b);
131} 119}
@@ -185,101 +173,92 @@ void MediaPlayerState::setStopped( bool b ) {
185void MediaPlayerState::setPosition( long p ) { 173void MediaPlayerState::setPosition( long p ) {
186 if ( curPosition == p ) { 174 if ( curPosition == p ) {
187 return; 175 return;
188 } 176 }
189 curPosition = p; 177 curPosition = p;
190 emit positionChanged(p); 178 emit positionChanged(p);
191} 179}
192 180
193void MediaPlayerState::updatePosition( long p ){ 181void MediaPlayerState::updatePosition( long p ){
194 if ( curPosition == p ) { 182 if ( curPosition == p ) {
195 return; 183 return;
196 } 184 }
197 curPosition = p; 185 curPosition = p;
198 emit positionUpdated(p); 186 emit positionUpdated(p);
199} 187}
200 188
201void MediaPlayerState::setVideoGamma( int v ){ 189void MediaPlayerState::setVideoGamma( int v ){
202 if ( videoGamma == v ) { 190 if ( videoGamma == v ) {
203 return; 191 return;
204 } 192 }
205 videoGamma = v; 193 videoGamma = v;
206 emit videoGammaChanged( v ); 194 emit videoGammaChanged( v );
207} 195}
208 196
209void MediaPlayerState::setLength( long l ) { 197void MediaPlayerState::setLength( long l ) {
210 if ( curLength == l ) { 198 if ( curLength == l ) {
211 return; 199 return;
212 } 200 }
213 curLength = l; 201 curLength = l;
214 emit lengthChanged(l); 202 emit lengthChanged(l);
215} 203}
216 204
217void MediaPlayerState::setView( char v ) {
218 switch ( v ) {
219 case 'a': setDisplayType( Audio ); return;
220 case 'v': setDisplayType( Video ); return;
221 case 'l': setDisplayType( MediaSelection ); return;
222 default: assert( false );
223 }
224}
225
226void MediaPlayerState::setDisplayType( DisplayType displayType ) 205void MediaPlayerState::setDisplayType( DisplayType displayType )
227{ 206{
228 if ( m_displayType == displayType ) 207 if ( m_displayType == displayType )
229 return; 208 return;
230 209
231 m_displayType = displayType; 210 m_displayType = displayType;
232 emit displayTypeChanged( m_displayType ); 211 emit displayTypeChanged( m_displayType );
233} 212}
234 213
235void MediaPlayerState::setPrev(){ 214void MediaPlayerState::setPrev(){
236 emit prev(); 215 emit prev();
237} 216}
238 217
239void MediaPlayerState::setNext() { 218void MediaPlayerState::setNext() {
240 emit next(); 219 emit next();
241} 220}
242 221
243void MediaPlayerState::setList() { 222void MediaPlayerState::setList() {
244 setPlaying( FALSE ); 223 setPlaying( FALSE );
245 setView('l'); 224 setDisplayType( MediaSelection );
246} 225}
247 226
248void MediaPlayerState::setVideo() { 227void MediaPlayerState::setVideo() {
249 setView('v'); 228 setDisplayType( Video );
250} 229}
251 230
252void MediaPlayerState::setAudio() { 231void MediaPlayerState::setAudio() {
253 setView('a'); 232 setDisplayType( Audio );
254} 233}
255 234
256void MediaPlayerState::toggleFullscreen() { 235void MediaPlayerState::toggleFullscreen() {
257 setFullscreen( !fullscreen ); 236 setFullscreen( !fullscreen );
258} 237}
259 238
260void MediaPlayerState::toggleScaled() { 239void MediaPlayerState::toggleScaled() {
261 setScaled( !scaled); 240 setScaled( !scaled);
262} 241}
263 242
264void MediaPlayerState::toggleLooping() { 243void MediaPlayerState::toggleLooping() {
265 setLooping( !looping); 244 setLooping( !looping);
266} 245}
267 246
268void MediaPlayerState::toggleShuffled() { 247void MediaPlayerState::toggleShuffled() {
269 setShuffled( !shuffled); 248 setShuffled( !shuffled);
270} 249}
271 250
272void MediaPlayerState::togglePaused() { 251void MediaPlayerState::togglePaused() {
273 setPaused( !paused); 252 setPaused( !paused);
274} 253}
275 254
276void MediaPlayerState::togglePlaying() { 255void MediaPlayerState::togglePlaying() {
277 setPlaying( !playing); 256 setPlaying( !playing);
278} 257}
279 258
280void MediaPlayerState::toggleBlank() { 259void MediaPlayerState::toggleBlank() {
281 setBlanked( !blanked); 260 setBlanked( !blanked);
282} 261}
283 262
284 263
285 264
diff --git a/noncore/multimedia/opieplayer2/mediaplayerstate.h b/noncore/multimedia/opieplayer2/mediaplayerstate.h
index b18780b..c887bb8 100644
--- a/noncore/multimedia/opieplayer2/mediaplayerstate.h
+++ b/noncore/multimedia/opieplayer2/mediaplayerstate.h
@@ -34,81 +34,79 @@
34// this file is based on work by trolltech 34// this file is based on work by trolltech
35 35
36#ifndef MEDIA_PLAYER_STATE_H 36#ifndef MEDIA_PLAYER_STATE_H
37#define MEDIA_PLAYER_STATE_H 37#define MEDIA_PLAYER_STATE_H
38 38
39 39
40#include <qobject.h> 40#include <qobject.h>
41 41
42 42
43class MediaPlayerDecoder; 43class MediaPlayerDecoder;
44class Config; 44class Config;
45 45
46 46
47class MediaPlayerState : public QObject { 47class MediaPlayerState : public QObject {
48Q_OBJECT 48Q_OBJECT
49public: 49public:
50 enum DisplayType { Audio, Video, MediaSelection }; 50 enum DisplayType { Audio, Video, MediaSelection };
51 51
52 MediaPlayerState( QObject *parent, const char *name ); 52 MediaPlayerState( QObject *parent, const char *name );
53 ~MediaPlayerState(); 53 ~MediaPlayerState();
54 54
55 bool isStreaming() const { return streaming; } 55 bool isStreaming() const { return streaming; }
56 bool isSeekable() const { return seekable; } 56 bool isSeekable() const { return seekable; }
57 bool isFullscreen() const { return fullscreen; } 57 bool isFullscreen() const { return fullscreen; }
58 bool isScaled() const { return scaled; } 58 bool isScaled() const { return scaled; }
59 bool isLooping() const { return looping; } 59 bool isLooping() const { return looping; }
60 bool isShuffled() const { return shuffled; } 60 bool isShuffled() const { return shuffled; }
61 bool isPaused() const { return paused; } 61 bool isPaused() const { return paused; }
62 bool isPlaying() const { return playing; } 62 bool isPlaying() const { return playing; }
63 bool isStopped() const { return stopped; } 63 bool isStopped() const { return stopped; }
64 long position() const { return curPosition; } 64 long position() const { return curPosition; }
65 long length() const { return curLength; } 65 long length() const { return curLength; }
66 char view() const;
67 DisplayType displayType() const; 66 DisplayType displayType() const;
68 67
69public slots: 68public slots:
70 void setIsStreaming( bool b ); 69 void setIsStreaming( bool b );
71 void setIsSeekable( bool b ); 70 void setIsSeekable( bool b );
72 void setFullscreen( bool b ); 71 void setFullscreen( bool b );
73 void setScaled( bool b ); 72 void setScaled( bool b );
74 void setLooping( bool b ); 73 void setLooping( bool b );
75 void setShuffled( bool b ); 74 void setShuffled( bool b );
76 void setPaused( bool b ); 75 void setPaused( bool b );
77 void setPlaying( bool b ); 76 void setPlaying( bool b );
78 void setStopped( bool b ); 77 void setStopped( bool b );
79 void setPosition( long p ); 78 void setPosition( long p );
80 void updatePosition( long p ); 79 void updatePosition( long p );
81 void setLength( long l ); 80 void setLength( long l );
82 void setView( char v );
83 void setDisplayType( MediaPlayerState::DisplayType displayType ); 81 void setDisplayType( MediaPlayerState::DisplayType displayType );
84 void setBlanked( bool b ); 82 void setBlanked( bool b );
85 void setVideoGamma( int v ); 83 void setVideoGamma( int v );
86 84
87 void setPrev(); 85 void setPrev();
88 void setNext(); 86 void setNext();
89 void setList(); 87 void setList();
90 void setVideo(); 88 void setVideo();
91 void setAudio(); 89 void setAudio();
92 90
93 void toggleFullscreen(); 91 void toggleFullscreen();
94 void toggleScaled(); 92 void toggleScaled();
95 void toggleLooping(); 93 void toggleLooping();
96 void toggleShuffled(); 94 void toggleShuffled();
97 void togglePaused(); 95 void togglePaused();
98 void togglePlaying(); 96 void togglePlaying();
99 void toggleBlank(); 97 void toggleBlank();
100 void writeConfig( Config& cfg ) const; 98 void writeConfig( Config& cfg ) const;
101 99
102 100
103signals: 101signals:
104 void fullscreenToggled( bool ); 102 void fullscreenToggled( bool );
105 void scaledToggled( bool ); 103 void scaledToggled( bool );
106 void loopingToggled( bool ); 104 void loopingToggled( bool );
107 void shuffledToggled( bool ); 105 void shuffledToggled( bool );
108 void pausedToggled( bool ); 106 void pausedToggled( bool );
109 void playingToggled( bool ); 107 void playingToggled( bool );
110 void stopToggled( bool ); 108 void stopToggled( bool );
111 void positionChanged( long ); // When the slider is moved 109 void positionChanged( long ); // When the slider is moved
112 void positionUpdated( long ); // When the media file progresses 110 void positionUpdated( long ); // When the media file progresses
113 void lengthChanged( long ); 111 void lengthChanged( long );
114 void displayTypeChanged( MediaPlayerState::DisplayType type ); 112 void displayTypeChanged( MediaPlayerState::DisplayType type );
diff --git a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
index db7c979..8be7a2f 100644
--- a/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidgetgui.cpp
@@ -192,37 +192,37 @@ PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags
192 192
193 //playlists list 193 //playlists list
194 QWidget *LTab; 194 QWidget *LTab;
195 LTab = new QWidget( tabWidget, "LTab" ); 195 LTab = new QWidget( tabWidget, "LTab" );
196 QGridLayout *Llayout = new QGridLayout( LTab ); 196 QGridLayout *Llayout = new QGridLayout( LTab );
197 Llayout->setSpacing( 2 ); 197 Llayout->setSpacing( 2 );
198 Llayout->setMargin( 2 ); 198 Llayout->setMargin( 2 );
199 199
200 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE ); 200 playLists = new FileSelector( "playlist/plain;audio/x-mpegurl", LTab, "fileselector" , FALSE, FALSE );
201 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 ); 201 Llayout->addMultiCellWidget( playLists, 0, 0, 0, 1 );
202 202
203 tabWidget->insertTab( LTab, tr( "Lists" ) ); 203 tabWidget->insertTab( LTab, tr( "Lists" ) );
204 204
205 setCentralWidget( vbox5 ); 205 setCentralWidget( vbox5 );
206} 206}
207 207
208 208
209 209
210PlayListWidgetGui::~PlayListWidgetGui() { 210PlayListWidgetGui::~PlayListWidgetGui() {
211} 211}
212 212
213void PlayListWidgetGui::setView( char view ) { 213void PlayListWidgetGui::setView( char view ) {
214 if ( view == 'l' ) 214 if ( view == 'l' )
215 showMaximized(); 215 showMaximized();
216 else 216 else
217 hide(); 217 hide();
218} 218}
219 219
220 220
221void PlayListWidgetGui::setActiveWindow() { 221void PlayListWidgetGui::setActiveWindow() {
222 // qDebug("SETTING active window"); 222 // qDebug("SETTING active window");
223 // When we get raised we need to ensure that it switches views 223 // When we get raised we need to ensure that it switches views
224 char origView = mediaPlayerState->view(); 224 MediaPlayerState::DisplayType origDisplayType = mediaPlayerState->displayType();
225 mediaPlayerState->setView( 'l' ); // invalidate 225 mediaPlayerState->setDisplayType( MediaPlayerState::MediaSelection ); // invalidate
226 mediaPlayerState->setView( origView ); // now switch back 226 mediaPlayerState->setDisplayType( origDisplayType ); // now switch back
227} 227}
228 228
diff --git a/noncore/multimedia/opieplayer2/xinecontrol.cpp b/noncore/multimedia/opieplayer2/xinecontrol.cpp
index 71e08a6..e7d5a7b 100644
--- a/noncore/multimedia/opieplayer2/xinecontrol.cpp
+++ b/noncore/multimedia/opieplayer2/xinecontrol.cpp
@@ -56,89 +56,89 @@ XineControl::XineControl( QObject *parent, const char *name )
56 connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) ); 56 connect( mediaPlayerState, SIGNAL( videoGammaChanged( int ) ), this, SLOT( setGamma( int ) ) );
57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) ); 57 connect( libXine, SIGNAL( stopped() ), this, SLOT( nextMedia() ) );
58 58
59 disabledSuspendScreenSaver = FALSE; 59 disabledSuspendScreenSaver = FALSE;
60} 60}
61 61
62XineControl::~XineControl() { 62XineControl::~XineControl() {
63#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 63#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
64 if ( disabledSuspendScreenSaver ) { 64 if ( disabledSuspendScreenSaver ) {
65 disabledSuspendScreenSaver = FALSE; 65 disabledSuspendScreenSaver = FALSE;
66 // Re-enable the suspend mode 66 // Re-enable the suspend mode
67 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 67 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
68 } 68 }
69#endif 69#endif
70 delete libXine; 70 delete libXine;
71} 71}
72 72
73void XineControl::play( const QString& fileName ) { 73void XineControl::play( const QString& fileName ) {
74 hasVideoChannel = FALSE; 74 hasVideoChannel = FALSE;
75 hasAudioChannel = FALSE; 75 hasAudioChannel = FALSE;
76 m_fileName = fileName; 76 m_fileName = fileName;
77 77
78 qDebug("<<FILENAME: " + fileName + ">>>>"); 78 qDebug("<<FILENAME: " + fileName + ">>>>");
79 79
80 if ( !libXine->play( fileName, 0, 0 ) ) { 80 if ( !libXine->play( fileName, 0, 0 ) ) {
81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() ); 81 QMessageBox::warning( 0l , tr( "Failure" ), getErrorCode() );
82 // toggle stop so the the play button is reset 82 // toggle stop so the the play button is reset
83 mediaPlayerState->setPlaying( false ); 83 mediaPlayerState->setPlaying( false );
84 return; 84 return;
85 } 85 }
86 mediaPlayerState->setPlaying( true ); 86 mediaPlayerState->setPlaying( true );
87 87
88 char whichGui; 88 MediaPlayerState::DisplayType displayType;
89 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) ); 89 // qDebug( QString( "libXine->hasVideo() return : %1 ").arg( libXine->hasVideo() ) );
90 if ( !libXine->hasVideo() ) { 90 if ( !libXine->hasVideo() ) {
91 whichGui = 'a'; 91 displayType = MediaPlayerState::Audio;
92 qDebug("HAS AUDIO"); 92 qDebug("HAS AUDIO");
93 libXine->setShowVideo( false ); 93 libXine->setShowVideo( false );
94 hasAudioChannel = TRUE; 94 hasAudioChannel = TRUE;
95 } else { 95 } else {
96 whichGui = 'v'; 96 displayType = MediaPlayerState::Video;
97 qDebug("HAS VIDEO"); 97 qDebug("HAS VIDEO");
98 libXine->setShowVideo( true ); 98 libXine->setShowVideo( true );
99 hasVideoChannel = TRUE; 99 hasVideoChannel = TRUE;
100 } 100 }
101 // determine if slider is shown 101 // determine if slider is shown
102 mediaPlayerState->setIsSeekable( libXine->isSeekable() ); 102 mediaPlayerState->setIsSeekable( libXine->isSeekable() );
103 103
104 // which gui (video / audio) 104 // which gui (video / audio)
105 mediaPlayerState->setView( whichGui ); 105 mediaPlayerState->setDisplayType( displayType );
106 106
107#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 107#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
108 if ( !disabledSuspendScreenSaver ) { 108 if ( !disabledSuspendScreenSaver ) {
109 disabledSuspendScreenSaver = TRUE; 109 disabledSuspendScreenSaver = TRUE;
110 // Stop the screen from blanking and power saving state 110 // Stop the screen from blanking and power saving state
111 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) 111 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" )
112 << ( whichGui == 'v' ? QPEApplication::Disable : QPEApplication::DisableSuspend ); 112 << ( displayType == MediaPlayerState::Video ? QPEApplication::Disable : QPEApplication::DisableSuspend );
113 } 113 }
114#endif 114#endif
115 115
116 length(); 116 length();
117 position(); 117 position();
118} 118}
119 119
120void XineControl::nextMedia() { 120void XineControl::nextMedia() {
121 mediaPlayerState->setNext(); 121 mediaPlayerState->setNext();
122} 122}
123 123
124void XineControl::setGamma( int value ) { 124void XineControl::setGamma( int value ) {
125 libXine->setGamma( value ); 125 libXine->setGamma( value );
126} 126}
127 127
128void XineControl::stop( bool isSet ) { 128void XineControl::stop( bool isSet ) {
129 if ( !isSet ) { 129 if ( !isSet ) {
130 libXine->stop(); 130 libXine->stop();
131 131
132#if defined(Q_WS_QWS) && !defined(QT_NO_COP) 132#if defined(Q_WS_QWS) && !defined(QT_NO_COP)
133 if ( disabledSuspendScreenSaver ) { 133 if ( disabledSuspendScreenSaver ) {
134 disabledSuspendScreenSaver = FALSE; 134 disabledSuspendScreenSaver = FALSE;
135 // Re-enable the suspend mode 135 // Re-enable the suspend mode
136 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable; 136 QCopEnvelope( "QPE/System", "setScreenSaverMode(int)" ) << QPEApplication::Enable;
137 } 137 }
138#endif 138#endif
139 } 139 }
140} 140}
141 141
142/** 142/**
143 * Pause playback 143 * Pause playback
144 * @isSet 144 * @isSet