author | harlekin <harlekin> | 2002-10-01 15:36:31 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-10-01 15:36:31 (UTC) |
commit | 657eeb18141838eeb0d18351a6755d7fa686f9d9 (patch) (unidiff) | |
tree | 049c19f776543aee296ce0cd3a1fde8c37ec374b /noncore/multimedia/opieplayer2/mediaplayer.cpp | |
parent | bba0335bbea81519beafb7fec1979a0abbd8a7ea (diff) | |
download | opie-657eeb18141838eeb0d18351a6755d7fa686f9d9.zip opie-657eeb18141838eeb0d18351a6755d7fa686f9d9.tar.gz opie-657eeb18141838eeb0d18351a6755d7fa686f9d9.tar.bz2 |
mediadetect no longer needed, also beginning of id3 etc tag info support along with some other small fixes
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opieplayer2/mediaplayer.cpp | 79 |
1 files changed, 46 insertions, 33 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp index 553e3c1..8da7f73 100644 --- a/noncore/multimedia/opieplayer2/mediaplayer.cpp +++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp | |||
@@ -36,7 +36,7 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name ) | |||
36 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { | 36 | : QObject( parent, name ), volumeDirection( 0 ), currentFile( NULL ) { |
37 | 37 | ||
38 | playList->setCaption(tr("OpiePlayer: Initializating")); | 38 | playList->setCaption(tr("OpiePlayer: Initializating")); |
39 | 39 | ||
40 | qApp->processEvents(); | 40 | qApp->processEvents(); |
41 | // QPEApplication::grabKeyboard(); // EVIL | 41 | // QPEApplication::grabKeyboard(); // EVIL |
42 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); | 42 | connect( qApp,SIGNAL( aboutToQuit()),SLOT( cleanUp()) ); |
@@ -100,37 +100,50 @@ void MediaPlayer::setPlaying( bool play ) { | |||
100 | fileName = currentFile->name(); | 100 | fileName = currentFile->name(); |
101 | long seconds = mediaPlayerState->length();// | 101 | long seconds = mediaPlayerState->length();// |
102 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 102 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
103 | qDebug(time); | 103 | //qDebug(time); |
104 | 104 | ||
105 | } else { //if playing in file list.. play in a different way | 105 | } else { |
106 | // random and looping settings enabled causes problems here, | 106 | //if playing in file list.. play in a different way |
107 | // since there is no selected file in the playlist, but a selected file in the file list, | 107 | // random and looping settings enabled causes problems here, |
108 | // so we remember and shutoff | 108 | // since there is no selected file in the playlist, but a selected file in the file list, |
109 | // so we remember and shutoff | ||
109 | l = mediaPlayerState->looping(); | 110 | l = mediaPlayerState->looping(); |
110 | if(l) | 111 | if(l) { |
111 | mediaPlayerState->setLooping( false ); | 112 | mediaPlayerState->setLooping( false ); |
113 | } | ||
112 | r = mediaPlayerState->shuffled(); | 114 | r = mediaPlayerState->shuffled(); |
113 | mediaPlayerState->setShuffled(false); | 115 | mediaPlayerState->setShuffled( false ); |
114 | 116 | ||
115 | fileName = playList->currentFileListPathName(); | 117 | fileName = playList->currentFileListPathName(); |
116 | xineControl->play( fileName); | 118 | xineControl->play( fileName ); |
117 | long seconds = mediaPlayerState->length();// | 119 | long seconds = mediaPlayerState->length(); |
118 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); | 120 | time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); |
119 | qDebug(time); | 121 | //qDebug(time); |
120 | if( fileName.left(4) != "http" ) | 122 | if( fileName.left(4) != "http" ) { |
121 | fileName = QFileInfo( fileName).baseName(); | 123 | fileName = QFileInfo( fileName ).baseName(); |
124 | } | ||
122 | 125 | ||
123 | } | 126 | } |
124 | if( fileName.left(4) == "http" ) | 127 | |
125 | tickerText= tr( " File: " ) + fileName; | 128 | if( fileName.left(4) == "http" ) { |
126 | else | 129 | if ( xineControl->getMetaInfo().isEmpty() ) { |
127 | tickerText = tr( " File: " ) + fileName + tr(", Length: ") + time; | 130 | tickerText = tr( " File: " ) + fileName; |
131 | } else { | ||
132 | tickerText = xineControl->getMetaInfo(); | ||
133 | } | ||
134 | } else { | ||
135 | if ( xineControl->getMetaInfo().isEmpty() ) { | ||
136 | tickerText = tr( " File: " ) + fileName + tr( ", Length: " ) + time + " "; | ||
137 | } else { | ||
138 | tickerText = xineControl->getMetaInfo() + " Length: " + time + " "; | ||
139 | } | ||
140 | } | ||
128 | audioUI->setTickerText( tickerText ); | 141 | audioUI->setTickerText( tickerText ); |
129 | } | 142 | } |
130 | 143 | ||
131 | 144 | ||
132 | void MediaPlayer::prev() { | 145 | void MediaPlayer::prev() { |
133 | if(playList->whichList() == 0) { //if using the playlist | 146 | if( playList->whichList() == 0 ) { //if using the playlist |
134 | if ( playList->prev() ) { | 147 | if ( playList->prev() ) { |
135 | play(); | 148 | play(); |
136 | } else if ( mediaPlayerState->looping() ) { | 149 | } else if ( mediaPlayerState->looping() ) { |
@@ -192,23 +205,23 @@ void MediaPlayer::stopChangingVolume() { | |||
192 | onScreenDisplayVolume = 0; | 205 | onScreenDisplayVolume = 0; |
193 | int w=0; | 206 | int w=0; |
194 | int h=0; | 207 | int h=0; |
195 | if( !xineControl->hasVideo()) { | 208 | if( !xineControl->hasVideo() ) { |
196 | w = audioUI->width(); | 209 | w = audioUI->width(); |
197 | h = audioUI->height(); | 210 | h = audioUI->height(); |
198 | audioUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 211 | audioUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
199 | } else { | 212 | } else { |
200 | w = videoUI->width(); | 213 | w = videoUI->width(); |
201 | h = videoUI->height(); | 214 | h = videoUI->height(); |
202 | videoUI->repaint( (w - 200) / 2, h - yoff, 200 + 9, 70, FALSE ); | 215 | videoUI->repaint( ( w - 200 ) / 2, h - yoff, 200 + 9, 70, FALSE ); |
203 | } | 216 | } |
204 | } | 217 | } |
205 | 218 | ||
206 | 219 | ||
207 | void MediaPlayer::timerEvent( QTimerEvent * ) { | 220 | void MediaPlayer::timerEvent( QTimerEvent * ) { |
208 | if ( volumeDirection == +1 ) { | 221 | if ( volumeDirection == +1 ) { |
209 | volControl->incVol(2); | 222 | volControl->incVol( 2 ); |
210 | } else if ( volumeDirection == -1 ) { | 223 | } else if ( volumeDirection == -1 ) { |
211 | volControl->decVol(2); | 224 | volControl->decVol( 2 ); |
212 | } | 225 | } |
213 | 226 | ||
214 | 227 | ||
@@ -223,13 +236,13 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
223 | } | 236 | } |
224 | 237 | ||
225 | int w=0; int h=0; | 238 | int w=0; int h=0; |
226 | if( !xineControl->hasVideo()) { | 239 | if( !xineControl->hasVideo() ) { |
227 | w = audioUI->width(); | 240 | w = audioUI->width(); |
228 | h = audioUI->height(); | 241 | h = audioUI->height(); |
229 | 242 | ||
230 | if ( drawnOnScreenDisplay ) { | 243 | if ( drawnOnScreenDisplay ) { |
231 | if ( onScreenDisplayVolume > v ) { | 244 | if ( onScreenDisplayVolume > v ) { |
232 | audioUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 245 | audioUI->repaint( ( w - 200 ) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
233 | } | 246 | } |
234 | } | 247 | } |
235 | drawnOnScreenDisplay = TRUE; | 248 | drawnOnScreenDisplay = TRUE; |
@@ -246,9 +259,9 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
246 | 259 | ||
247 | for ( unsigned int i = 0; i < 10; i++ ) { | 260 | for ( unsigned int i = 0; i < 10; i++ ) { |
248 | if ( v > i ) { | 261 | if ( v > i ) { |
249 | p.drawRect( (w - 200) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); | 262 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 0, h - yoff + 40, 9, 30 ); |
250 | } else { | 263 | } else { |
251 | p.drawRect( (w - 200) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); | 264 | p.drawRect( ( w - 200 ) / 2 + i * 20 + 3, h - yoff + 50, 3, 10 ); |
252 | } | 265 | } |
253 | } | 266 | } |
254 | } else { | 267 | } else { |
@@ -257,7 +270,7 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
257 | 270 | ||
258 | if ( drawnOnScreenDisplay ) { | 271 | if ( drawnOnScreenDisplay ) { |
259 | if ( onScreenDisplayVolume > v ) { | 272 | if ( onScreenDisplayVolume > v ) { |
260 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, (onScreenDisplayVolume - v) * 20 + 9, 30, FALSE ); | 273 | videoUI->repaint( (w - 200) / 2 + v * 20 + 0, h - yoff + 40, ( onScreenDisplayVolume - v ) * 20 + 9, 30, FALSE ); |
261 | } | 274 | } |
262 | } | 275 | } |
263 | drawnOnScreenDisplay = TRUE; | 276 | drawnOnScreenDisplay = TRUE; |
@@ -270,7 +283,7 @@ void MediaPlayer::timerEvent( QTimerEvent * ) { | |||
270 | f.setPixelSize( 20 ); | 283 | f.setPixelSize( 20 ); |
271 | f.setBold( TRUE ); | 284 | f.setBold( TRUE ); |
272 | p.setFont( f ); | 285 | p.setFont( f ); |
273 | p.drawText( (w - 200) / 2, h - yoff + 20, tr("Volume") ); | 286 | p.drawText( (w - 200) / 2, h - yoff + 20, tr( "Volume" ) ); |
274 | 287 | ||
275 | for ( unsigned int i = 0; i < 10; i++ ) { | 288 | for ( unsigned int i = 0; i < 10; i++ ) { |
276 | if ( v > i ) { | 289 | if ( v > i ) { |
@@ -327,7 +340,7 @@ void MediaPlayer::cleanUp() {// this happens on closing | |||
327 | Config cfg( "OpiePlayer" ); | 340 | Config cfg( "OpiePlayer" ); |
328 | mediaPlayerState->writeConfig( cfg ); | 341 | mediaPlayerState->writeConfig( cfg ); |
329 | playList->writeConfig( cfg ); | 342 | playList->writeConfig( cfg ); |
330 | 343 | ||
331 | // QPEApplication::grabKeyboard(); | 344 | // QPEApplication::grabKeyboard(); |
332 | // QPEApplication::ungrabKeyboard(); | 345 | // QPEApplication::ungrabKeyboard(); |
333 | } | 346 | } |