-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.cpp | 27 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayerstate.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidgetgui.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/xinecontrol.cpp | 10 |
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 | |||
@@ -102,129 +102,129 @@ void MediaPlayer::setPlaying( bool play ) { | |||
102 | // so we remember and shutoff | 102 | // so we remember and shutoff |
103 | l = mediaPlayerState->isLooping(); | 103 | l = mediaPlayerState->isLooping(); |
104 | if(l) { | 104 | if(l) { |
105 | mediaPlayerState->setLooping( false ); | 105 | mediaPlayerState->setLooping( false ); |
106 | } | 106 | } |
107 | r = mediaPlayerState->isShuffled(); | 107 | r = mediaPlayerState->isShuffled(); |
108 | mediaPlayerState->setShuffled( false ); | 108 | mediaPlayerState->setShuffled( false ); |
109 | } | 109 | } |
110 | 110 | ||
111 | PlayListWidget::Entry playListEntry = playList->currentEntry(); | 111 | PlayListWidget::Entry playListEntry = playList->currentEntry(); |
112 | fileName = playListEntry.name; | 112 | fileName = playListEntry.name; |
113 | xineControl->play( playListEntry.file ); | 113 | xineControl->play( playListEntry.file ); |
114 | 114 | ||
115 | long seconds = mediaPlayerState->length(); | 115 | long seconds = mediaPlayerState->length(); |
116 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 116 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
117 | 117 | ||
118 | if( fileName.left(4) == "http" ) { | 118 | if( fileName.left(4) == "http" ) { |
119 | fileName = QFileInfo( fileName ).baseName(); | 119 | fileName = QFileInfo( fileName ).baseName(); |
120 | if ( xineControl->getMetaInfo().isEmpty() ) { | 120 | if ( xineControl->getMetaInfo().isEmpty() ) { |
121 | tickerText = tr( " File: " ) + fileName; | 121 | tickerText = tr( " File: " ) + fileName; |
122 | } else { | 122 | } else { |
123 | tickerText = xineControl->getMetaInfo(); | 123 | tickerText = xineControl->getMetaInfo(); |
124 | } | 124 | } |
125 | } else { | 125 | } else { |
126 | if ( xineControl->getMetaInfo().isEmpty() ) { | 126 | if ( xineControl->getMetaInfo().isEmpty() ) { |
127 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; | 127 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; |
128 | } else { | 128 | } else { |
129 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; | 129 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; |
130 | } | 130 | } |
131 | } | 131 | } |
132 | audioUI->setTickerText( tickerText ); | 132 | audioUI->setTickerText( tickerText ); |
133 | } | 133 | } |
134 | 134 | ||
135 | 135 | ||
136 | void MediaPlayer::prev() { | 136 | void 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 | ||
151 | void MediaPlayer::next() { | 151 | void 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 | ||
174 | void MediaPlayer::startDecreasingVolume() { | 174 | void 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 | ||
181 | void MediaPlayer::startIncreasingVolume() { | 181 | void 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 | ||
188 | bool drawnOnScreenDisplay = FALSE; | 188 | bool drawnOnScreenDisplay = FALSE; |
189 | unsigned int onScreenDisplayVolume = 0; | 189 | unsigned int onScreenDisplayVolume = 0; |
190 | const int yoff = 110; | 190 | const int yoff = 110; |
191 | 191 | ||
192 | void MediaPlayer::stopChangingVolume() { | 192 | void 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; |
199 | if( !xineControl->hasVideo() ) { | 199 | if( !xineControl->hasVideo() ) { |
200 | w = audioUI->width(); | 200 | w = audioUI->width(); |
201 | h = audioUI->height(); | 201 | h = audioUI->height(); |
202 | audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 202 | audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
203 | } else { | 203 | } else { |
204 | w = videoUI->width(); | 204 | w = videoUI->width(); |
205 | h = videoUI->height(); | 205 | h = videoUI->height(); |
206 | videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); | 206 | videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
207 | } | 207 | } |
208 | } | 208 | } |
209 | 209 | ||
210 | 210 | ||
211 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 211 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
212 | if ( volumeDirection == +1 ) { | 212 | if ( volumeDirection == +1 ) { |
213 | volControl->incVol( 2 ); | 213 | volControl->incVol( 2 ); |
214 | } else if ( volumeDirection == -1 ) { | 214 | } else if ( volumeDirection == -1 ) { |
215 | volControl->decVol( 2 ); | 215 | volControl->decVol( 2 ); |
216 | } | 216 | } |
217 | 217 | ||
218 | 218 | ||
219 | // TODO FIXME | 219 | // TODO FIXME |
220 | // huh?? | 220 | // huh?? |
221 | unsigned int v= 0; | 221 | unsigned int v= 0; |
222 | v = volControl->volume(); | 222 | v = volControl->volume(); |
223 | v = v / 10; | 223 | v = v / 10; |
224 | 224 | ||
225 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { | 225 | if ( drawnOnScreenDisplay && onScreenDisplayVolume == v ) { |
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | 228 | ||
229 | int w=0; int h=0; | 229 | int w=0; int h=0; |
230 | if( !xineControl->hasVideo() ) { | 230 | if( !xineControl->hasVideo() ) { |
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 | |||
@@ -24,262 +24,241 @@ | |||
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | // this file is based on work by trolltech | 34 | // this file is based on work by trolltech |
35 | 35 | ||
36 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
37 | #include <qpe/qlibrary.h> | 37 | #include <qpe/qlibrary.h> |
38 | #include <qpe/config.h> | 38 | #include <qpe/config.h> |
39 | #include <qvaluelist.h> | 39 | #include <qvaluelist.h> |
40 | #include <qobject.h> | 40 | #include <qobject.h> |
41 | #include <qdir.h> | 41 | #include <qdir.h> |
42 | #include "mediaplayerstate.h" | 42 | #include "mediaplayerstate.h" |
43 | 43 | ||
44 | #include <assert.h> | 44 | #include <assert.h> |
45 | 45 | ||
46 | //#define MediaPlayerDebug(x) qDebug x | 46 | //#define MediaPlayerDebug(x) qDebug x |
47 | #define MediaPlayerDebug(x) | 47 | #define MediaPlayerDebug(x) |
48 | 48 | ||
49 | 49 | ||
50 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) | 50 | MediaPlayerState::MediaPlayerState( QObject *parent, const char *name ) |
51 | : QObject( parent, name ) { | 51 | : QObject( parent, name ) { |
52 | Config cfg( "OpiePlayer" ); | 52 | Config cfg( "OpiePlayer" ); |
53 | readConfig( cfg ); | 53 | readConfig( cfg ); |
54 | streaming = false; | 54 | streaming = false; |
55 | seekable = true; | 55 | seekable = true; |
56 | } | 56 | } |
57 | 57 | ||
58 | 58 | ||
59 | MediaPlayerState::~MediaPlayerState() { | 59 | MediaPlayerState::~MediaPlayerState() { |
60 | } | 60 | } |
61 | 61 | ||
62 | 62 | ||
63 | void MediaPlayerState::readConfig( Config& cfg ) { | 63 | void 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 | ||
79 | void MediaPlayerState::writeConfig( Config& cfg ) const { | 79 | void 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 | ||
88 | char 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 | |||
100 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const | 88 | MediaPlayerState::DisplayType MediaPlayerState::displayType() const |
101 | { | 89 | { |
102 | return m_displayType; | 90 | return m_displayType; |
103 | } | 91 | } |
104 | 92 | ||
105 | // slots | 93 | // slots |
106 | void MediaPlayerState::setIsStreaming( bool b ) { | 94 | void MediaPlayerState::setIsStreaming( bool b ) { |
107 | streaming = b; | 95 | streaming = b; |
108 | } | 96 | } |
109 | 97 | ||
110 | void MediaPlayerState::setIsSeekable( bool b ) { | 98 | void MediaPlayerState::setIsSeekable( bool b ) { |
111 | seekable = b; | 99 | seekable = b; |
112 | emit isSeekableToggled(b); | 100 | emit isSeekableToggled(b); |
113 | } | 101 | } |
114 | 102 | ||
115 | 103 | ||
116 | void MediaPlayerState::setFullscreen( bool b ) { | 104 | void 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 | ||
125 | void MediaPlayerState::setBlanked( bool b ) { | 113 | void 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 | } |
132 | 120 | ||
133 | 121 | ||
134 | void MediaPlayerState::setScaled( bool b ) { | 122 | void MediaPlayerState::setScaled( bool b ) { |
135 | if ( scaled == b ) { | 123 | if ( scaled == b ) { |
136 | return; | 124 | return; |
137 | } | 125 | } |
138 | scaled = b; | 126 | scaled = b; |
139 | emit scaledToggled(b); | 127 | emit scaledToggled(b); |
140 | } | 128 | } |
141 | 129 | ||
142 | void MediaPlayerState::setLooping( bool b ) { | 130 | void MediaPlayerState::setLooping( bool b ) { |
143 | if ( looping == b ) { | 131 | if ( looping == b ) { |
144 | return; | 132 | return; |
145 | } | 133 | } |
146 | looping = b; | 134 | looping = b; |
147 | emit loopingToggled(b); | 135 | emit loopingToggled(b); |
148 | } | 136 | } |
149 | 137 | ||
150 | void MediaPlayerState::setShuffled( bool b ) { | 138 | void MediaPlayerState::setShuffled( bool b ) { |
151 | if ( shuffled == b ) { | 139 | if ( shuffled == b ) { |
152 | return; | 140 | return; |
153 | } | 141 | } |
154 | shuffled = b; | 142 | shuffled = b; |
155 | emit shuffledToggled(b); | 143 | emit shuffledToggled(b); |
156 | } | 144 | } |
157 | 145 | ||
158 | void MediaPlayerState::setPaused( bool b ) { | 146 | void MediaPlayerState::setPaused( bool b ) { |
159 | if ( paused == b ) { | 147 | if ( paused == b ) { |
160 | paused = FALSE; | 148 | paused = FALSE; |
161 | emit pausedToggled(FALSE); | 149 | emit pausedToggled(FALSE); |
162 | return; | 150 | return; |
163 | } | 151 | } |
164 | paused = b; | 152 | paused = b; |
165 | emit pausedToggled(b); | 153 | emit pausedToggled(b); |
166 | } | 154 | } |
167 | 155 | ||
168 | void MediaPlayerState::setPlaying( bool b ) { | 156 | void MediaPlayerState::setPlaying( bool b ) { |
169 | if ( playing == b ) { | 157 | if ( playing == b ) { |
170 | return; | 158 | return; |
171 | } | 159 | } |
172 | playing = b; | 160 | playing = b; |
173 | stopped = !b; | 161 | stopped = !b; |
174 | emit playingToggled(b); | 162 | emit playingToggled(b); |
175 | } | 163 | } |
176 | 164 | ||
177 | void MediaPlayerState::setStopped( bool b ) { | 165 | void MediaPlayerState::setStopped( bool b ) { |
178 | if ( stopped == b ) { | 166 | if ( stopped == b ) { |
179 | return; | 167 | return; |
180 | } | 168 | } |
181 | stopped = b; | 169 | stopped = b; |
182 | emit stopToggled(b); | 170 | emit stopToggled(b); |
183 | } | 171 | } |
184 | 172 | ||
185 | void MediaPlayerState::setPosition( long p ) { | 173 | void 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 | ||
193 | void MediaPlayerState::updatePosition( long p ){ | 181 | void 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 | ||
201 | void MediaPlayerState::setVideoGamma( int v ){ | 189 | void 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 | ||
209 | void MediaPlayerState::setLength( long l ) { | 197 | void 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 | ||
217 | void 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 | |||
226 | void MediaPlayerState::setDisplayType( DisplayType displayType ) | 205 | void 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 | ||
235 | void MediaPlayerState::setPrev(){ | 214 | void MediaPlayerState::setPrev(){ |
236 | emit prev(); | 215 | emit prev(); |
237 | } | 216 | } |
238 | 217 | ||
239 | void MediaPlayerState::setNext() { | 218 | void MediaPlayerState::setNext() { |
240 | emit next(); | 219 | emit next(); |
241 | } | 220 | } |
242 | 221 | ||
243 | void MediaPlayerState::setList() { | 222 | void MediaPlayerState::setList() { |
244 | setPlaying( FALSE ); | 223 | setPlaying( FALSE ); |
245 | setView('l'); | 224 | setDisplayType( MediaSelection ); |
246 | } | 225 | } |
247 | 226 | ||
248 | void MediaPlayerState::setVideo() { | 227 | void MediaPlayerState::setVideo() { |
249 | setView('v'); | 228 | setDisplayType( Video ); |
250 | } | 229 | } |
251 | 230 | ||
252 | void MediaPlayerState::setAudio() { | 231 | void MediaPlayerState::setAudio() { |
253 | setView('a'); | 232 | setDisplayType( Audio ); |
254 | } | 233 | } |
255 | 234 | ||
256 | void MediaPlayerState::toggleFullscreen() { | 235 | void MediaPlayerState::toggleFullscreen() { |
257 | setFullscreen( !fullscreen ); | 236 | setFullscreen( !fullscreen ); |
258 | } | 237 | } |
259 | 238 | ||
260 | void MediaPlayerState::toggleScaled() { | 239 | void MediaPlayerState::toggleScaled() { |
261 | setScaled( !scaled); | 240 | setScaled( !scaled); |
262 | } | 241 | } |
263 | 242 | ||
264 | void MediaPlayerState::toggleLooping() { | 243 | void MediaPlayerState::toggleLooping() { |
265 | setLooping( !looping); | 244 | setLooping( !looping); |
266 | } | 245 | } |
267 | 246 | ||
268 | void MediaPlayerState::toggleShuffled() { | 247 | void MediaPlayerState::toggleShuffled() { |
269 | setShuffled( !shuffled); | 248 | setShuffled( !shuffled); |
270 | } | 249 | } |
271 | 250 | ||
272 | void MediaPlayerState::togglePaused() { | 251 | void MediaPlayerState::togglePaused() { |
273 | setPaused( !paused); | 252 | setPaused( !paused); |
274 | } | 253 | } |
275 | 254 | ||
276 | void MediaPlayerState::togglePlaying() { | 255 | void MediaPlayerState::togglePlaying() { |
277 | setPlaying( !playing); | 256 | setPlaying( !playing); |
278 | } | 257 | } |
279 | 258 | ||
280 | void MediaPlayerState::toggleBlank() { | 259 | void 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 | |||
@@ -2,142 +2,140 @@ | |||
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | 3 | ||
4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> | 4 | Copyright (c) 2002 Max Reiss <harlekin@handhelds.org> |
5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> | 5 | Copyright (c) 2002 L. Potter <ljp@llornkcor.com> |
6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> | 6 | Copyright (c) 2002 Holger Freyther <zecke@handhelds.org> |
7 | =. | 7 | =. |
8 | .=l. | 8 | .=l. |
9 | .>+-= | 9 | .>+-= |
10 | _;:, .> :=|. This program is free software; you can | 10 | _;:, .> :=|. This program is free software; you can |
11 | .> <`_, > . <= redistribute it and/or modify it under | 11 | .> <`_, > . <= redistribute it and/or modify it under |
12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public | 12 | :`=1 )Y*s>-.-- : the terms of the GNU General Public |
13 | .="- .-=="i, .._ License as published by the Free Software | 13 | .="- .-=="i, .._ License as published by the Free Software |
14 | - . .-<_> .<> Foundation; either version 2 of the License, | 14 | - . .-<_> .<> Foundation; either version 2 of the License, |
15 | ._= =} : or (at your option) any later version. | 15 | ._= =} : or (at your option) any later version. |
16 | .%`+i> _;_. | 16 | .%`+i> _;_. |
17 | .i_,=:_. -<s. This program is distributed in the hope that | 17 | .i_,=:_. -<s. This program is distributed in the hope that |
18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 18 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
19 | : .. .:, . . . without even the implied warranty of | 19 | : .. .:, . . . without even the implied warranty of |
20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 20 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 21 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
22 | ..}^=.= = ; General Public License for more | 22 | ..}^=.= = ; General Public License for more |
23 | ++= -. .` .: details. | 23 | ++= -. .` .: details. |
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | // 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 | ||
43 | class MediaPlayerDecoder; | 43 | class MediaPlayerDecoder; |
44 | class Config; | 44 | class Config; |
45 | 45 | ||
46 | 46 | ||
47 | class MediaPlayerState : public QObject { | 47 | class MediaPlayerState : public QObject { |
48 | Q_OBJECT | 48 | Q_OBJECT |
49 | public: | 49 | public: |
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 | ||
69 | public slots: | 68 | public 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 | ||
103 | signals: | 101 | signals: |
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 ); |
115 | void isSeekableToggled( bool ); | 113 | void isSeekableToggled( bool ); |
116 | void blankToggled( bool ); | 114 | void blankToggled( bool ); |
117 | void videoGammaChanged( int ); | 115 | void videoGammaChanged( int ); |
118 | void prev(); | 116 | void prev(); |
119 | void next(); | 117 | void next(); |
120 | 118 | ||
121 | private: | 119 | private: |
122 | bool streaming : 1; | 120 | bool streaming : 1; |
123 | bool seekable : 1; | 121 | bool seekable : 1; |
124 | bool fullscreen: 1; | 122 | bool fullscreen: 1; |
125 | bool scaled : 1; | 123 | bool scaled : 1; |
126 | bool blanked : 1; | 124 | bool blanked : 1; |
127 | bool looping : 1; | 125 | bool looping : 1; |
128 | bool shuffled : 1; | 126 | bool shuffled : 1; |
129 | bool usePlaylist : 1; | 127 | bool usePlaylist : 1; |
130 | bool paused : 1; | 128 | bool paused : 1; |
131 | bool playing : 1; | 129 | bool playing : 1; |
132 | bool stopped : 1; | 130 | bool stopped : 1; |
133 | long curPosition; | 131 | long curPosition; |
134 | long curLength; | 132 | long curLength; |
135 | DisplayType m_displayType; | 133 | DisplayType m_displayType; |
136 | int videoGamma; | 134 | int videoGamma; |
137 | void readConfig( Config& cfg ); | 135 | void readConfig( Config& cfg ); |
138 | 136 | ||
139 | }; | 137 | }; |
140 | 138 | ||
141 | 139 | ||
142 | #endif // MEDIA_PLAYER_STATE_H | 140 | #endif // MEDIA_PLAYER_STATE_H |
143 | 141 | ||
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 | |||
@@ -160,69 +160,69 @@ PlayListWidgetGui::PlayListWidgetGui( QWidget* parent, const char* name, WFlags | |||
160 | audioView->setColumnAlignment( 2, Qt::AlignRight ); | 160 | audioView->setColumnAlignment( 2, Qt::AlignRight ); |
161 | audioView->setAllColumnsShowFocus( TRUE ); | 161 | audioView->setAllColumnsShowFocus( TRUE ); |
162 | audioView->setSorting( 3, TRUE ); | 162 | audioView->setSorting( 3, TRUE ); |
163 | audioView->setMultiSelection( TRUE ); | 163 | audioView->setMultiSelection( TRUE ); |
164 | audioView->setSelectionMode( QListView::Extended ); | 164 | audioView->setSelectionMode( QListView::Extended ); |
165 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); | 165 | Alayout->addMultiCellWidget( audioView, 0, 0, 0, 1 ); |
166 | tabWidget->insertTab( aTab, tr( "Audio" ) ); | 166 | tabWidget->insertTab( aTab, tr( "Audio" ) ); |
167 | 167 | ||
168 | QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); | 168 | QPEApplication::setStylusOperation( audioView->viewport(), QPEApplication::RightOnHold ); |
169 | 169 | ||
170 | QWidget *vTab; | 170 | QWidget *vTab; |
171 | vTab = new QWidget( tabWidget, "vTab" ); | 171 | vTab = new QWidget( tabWidget, "vTab" ); |
172 | 172 | ||
173 | QGridLayout *Vlayout = new QGridLayout( vTab ); | 173 | QGridLayout *Vlayout = new QGridLayout( vTab ); |
174 | Vlayout->setSpacing( 2 ); | 174 | Vlayout->setSpacing( 2 ); |
175 | Vlayout->setMargin( 2 ); | 175 | Vlayout->setMargin( 2 ); |
176 | videoView = new QListView( vTab, "Videoview" ); | 176 | videoView = new QListView( vTab, "Videoview" ); |
177 | videoView->addColumn( tr( "Title" ), 140); | 177 | videoView->addColumn( tr( "Title" ), 140); |
178 | videoView->addColumn( tr( "Size" ), -1 ); | 178 | videoView->addColumn( tr( "Size" ), -1 ); |
179 | videoView->addColumn(tr( "Media" ), 0 ); | 179 | videoView->addColumn(tr( "Media" ), 0 ); |
180 | videoView->addColumn(tr( "Path" ), -1 ); | 180 | videoView->addColumn(tr( "Path" ), -1 ); |
181 | videoView->setColumnAlignment( 1, Qt::AlignRight ); | 181 | videoView->setColumnAlignment( 1, Qt::AlignRight ); |
182 | videoView->setColumnAlignment( 2, Qt::AlignRight ); | 182 | videoView->setColumnAlignment( 2, Qt::AlignRight ); |
183 | videoView->setAllColumnsShowFocus( TRUE ); | 183 | videoView->setAllColumnsShowFocus( TRUE ); |
184 | videoView->setSorting( 3, TRUE ); | 184 | videoView->setSorting( 3, TRUE ); |
185 | videoView->setMultiSelection( TRUE ); | 185 | videoView->setMultiSelection( TRUE ); |
186 | videoView->setSelectionMode( QListView::Extended ); | 186 | videoView->setSelectionMode( QListView::Extended ); |
187 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); | 187 | Vlayout->addMultiCellWidget( videoView, 0, 0, 0, 1 ); |
188 | 188 | ||
189 | QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); | 189 | QPEApplication::setStylusOperation( videoView->viewport(), QPEApplication::RightOnHold ); |
190 | 190 | ||
191 | tabWidget->insertTab( vTab, tr( "Video" ) ); | 191 | tabWidget->insertTab( vTab, tr( "Video" ) ); |
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 | ||
210 | PlayListWidgetGui::~PlayListWidgetGui() { | 210 | PlayListWidgetGui::~PlayListWidgetGui() { |
211 | } | 211 | } |
212 | 212 | ||
213 | void PlayListWidgetGui::setView( char view ) { | 213 | void 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 | ||
221 | void PlayListWidgetGui::setActiveWindow() { | 221 | void 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 | |||
@@ -24,153 +24,153 @@ | |||
24 | : = ...= . :.=- | 24 | : = ...= . :.=- |
25 | -. .:....=;==+<; You should have received a copy of the GNU | 25 | -. .:....=;==+<; You should have received a copy of the GNU |
26 | -_. . . )=. = General Public License along with | 26 | -_. . . )=. = General Public License along with |
27 | -- :-=` this library; see the file COPYING.LIB. | 27 | -- :-=` this library; see the file COPYING.LIB. |
28 | If not, write to the Free Software Foundation, | 28 | If not, write to the Free Software Foundation, |
29 | Inc., 59 Temple Place - Suite 330, | 29 | Inc., 59 Temple Place - Suite 330, |
30 | Boston, MA 02111-1307, USA. | 30 | Boston, MA 02111-1307, USA. |
31 | 31 | ||
32 | */ | 32 | */ |
33 | 33 | ||
34 | 34 | ||
35 | #include <qtimer.h> | 35 | #include <qtimer.h> |
36 | #include <qmessagebox.h> | 36 | #include <qmessagebox.h> |
37 | #include <qpe/qcopenvelope_qws.h> | 37 | #include <qpe/qcopenvelope_qws.h> |
38 | #include <qpe/qpeapplication.h> | 38 | #include <qpe/qpeapplication.h> |
39 | #include "xinecontrol.h" | 39 | #include "xinecontrol.h" |
40 | #include "mediaplayerstate.h" | 40 | #include "mediaplayerstate.h" |
41 | #include "videowidget.h" | 41 | #include "videowidget.h" |
42 | 42 | ||
43 | extern MediaPlayerState *mediaPlayerState; | 43 | extern MediaPlayerState *mediaPlayerState; |
44 | extern VideoWidget *videoUI; | 44 | extern VideoWidget *videoUI; |
45 | XineControl::XineControl( QObject *parent, const char *name ) | 45 | XineControl::XineControl( QObject *parent, const char *name ) |
46 | : QObject( parent, name ) { | 46 | : QObject( parent, name ) { |
47 | 47 | ||
48 | libXine = new XINE::Lib( videoUI->vidWidget() ); | 48 | libXine = new XINE::Lib( videoUI->vidWidget() ); |
49 | 49 | ||
50 | connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); | 50 | connect ( videoUI, SIGNAL( videoResized( const QSize & )), this, SLOT( videoResized ( const QSize & ) ) ); |
51 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); | 51 | connect( mediaPlayerState, SIGNAL( pausedToggled( bool ) ), this, SLOT( pause( bool ) ) ); |
52 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); | 52 | connect( this, SIGNAL( positionChanged( long ) ), mediaPlayerState, SLOT( updatePosition( long ) ) ); |
53 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); | 53 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), this, SLOT( stop( bool ) ) ); |
54 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); | 54 | connect( mediaPlayerState, SIGNAL( fullscreenToggled( bool ) ), this, SLOT( setFullscreen( bool ) ) ); |
55 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); | 55 | connect( mediaPlayerState, SIGNAL( positionChanged( long ) ), this, SLOT( seekTo( long ) ) ); |
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 | ||
62 | XineControl::~XineControl() { | 62 | XineControl::~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 | ||
73 | void XineControl::play( const QString& fileName ) { | 73 | void 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 | ||
120 | void XineControl::nextMedia() { | 120 | void XineControl::nextMedia() { |
121 | mediaPlayerState->setNext(); | 121 | mediaPlayerState->setNext(); |
122 | } | 122 | } |
123 | 123 | ||
124 | void XineControl::setGamma( int value ) { | 124 | void XineControl::setGamma( int value ) { |
125 | libXine->setGamma( value ); | 125 | libXine->setGamma( value ); |
126 | } | 126 | } |
127 | 127 | ||
128 | void XineControl::stop( bool isSet ) { | 128 | void 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 |
145 | */ | 145 | */ |
146 | void XineControl::pause( bool isSet) { | 146 | void XineControl::pause( bool isSet) { |
147 | if ( isSet ) { | 147 | if ( isSet ) { |
148 | libXine->pause(); | 148 | libXine->pause(); |
149 | } else { | 149 | } else { |
150 | libXine->play( m_fileName, 0, m_currentTime ); | 150 | libXine->play( m_fileName, 0, m_currentTime ); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | /** | 155 | /** |
156 | * get current time in playback | 156 | * get current time in playback |
157 | */ | 157 | */ |
158 | long XineControl::currentTime() { | 158 | long XineControl::currentTime() { |
159 | // todo: jede sekunde überprüfen | 159 | // todo: jede sekunde überprüfen |
160 | m_currentTime = libXine->currentTime(); | 160 | m_currentTime = libXine->currentTime(); |
161 | return m_currentTime; | 161 | return m_currentTime; |
162 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); | 162 | QTimer::singleShot( 1000, this, SLOT( currentTime() ) ); |
163 | } | 163 | } |
164 | 164 | ||
165 | /** | 165 | /** |
166 | * Set the length of the media file | 166 | * Set the length of the media file |
167 | */ | 167 | */ |
168 | void XineControl::length() { | 168 | void XineControl::length() { |
169 | m_length = libXine->length(); | 169 | m_length = libXine->length(); |
170 | mediaPlayerState->setLength( m_length ); | 170 | mediaPlayerState->setLength( m_length ); |
171 | } | 171 | } |
172 | 172 | ||
173 | 173 | ||
174 | /** | 174 | /** |
175 | * Reports the position the xine backend is at right now | 175 | * Reports the position the xine backend is at right now |
176 | * @return long the postion in seconds | 176 | * @return long the postion in seconds |