summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediaplayer.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp79
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
@@ -38,3 +38,3 @@ MediaPlayer::MediaPlayer( QObject *parent, const char *name )
38 playList->setCaption(tr("OpiePlayer: Initializating")); 38 playList->setCaption(tr("OpiePlayer: Initializating"));
39 39
40 qApp->processEvents(); 40 qApp->processEvents();
@@ -102,27 +102,40 @@ void MediaPlayer::setPlaying( bool play ) {
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 );
@@ -132,3 +145,3 @@ void MediaPlayer::setPlaying( bool play ) {
132void MediaPlayer::prev() { 145void 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() ) {
@@ -194,6 +207,6 @@ void MediaPlayer::stopChangingVolume() {
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 {
@@ -201,3 +214,3 @@ void MediaPlayer::stopChangingVolume() {
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 }
@@ -208,5 +221,5 @@ 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 }
@@ -225,3 +238,3 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
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();
@@ -231,3 +244,3 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
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 }
@@ -248,5 +261,5 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
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 }
@@ -259,3 +272,3 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
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 }
@@ -272,3 +285,3 @@ void MediaPlayer::timerEvent( QTimerEvent * ) {
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
@@ -329,3 +342,3 @@ void MediaPlayer::cleanUp() {// this happens on closing
329 playList->writeConfig( cfg ); 342 playList->writeConfig( cfg );
330 343
331// QPEApplication::grabKeyboard(); 344// QPEApplication::grabKeyboard();