summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer2/mediaplayer.cpp
Unidiff
Diffstat (limited to 'noncore/multimedia/opieplayer2/mediaplayer.cpp') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/mediaplayer.cpp48
1 files changed, 39 insertions, 9 deletions
diff --git a/noncore/multimedia/opieplayer2/mediaplayer.cpp b/noncore/multimedia/opieplayer2/mediaplayer.cpp
index bf2acc8..553e3c1 100644
--- a/noncore/multimedia/opieplayer2/mediaplayer.cpp
+++ b/noncore/multimedia/opieplayer2/mediaplayer.cpp
@@ -3,6 +3,7 @@
3#include <qpe/resource.h> 3#include <qpe/resource.h>
4#include <qpe/config.h> 4#include <qpe/config.h>
5#include <qpe/qcopenvelope_qws.h> 5#include <qpe/qcopenvelope_qws.h>
6#include <qfileinfo.h>
6 7
7#include <qmainwindow.h> 8#include <qmainwindow.h>
8#include <qmessagebox.h> 9#include <qmessagebox.h>
@@ -89,29 +90,47 @@ void MediaPlayer::setPlaying( bool play ) {
89 return; 90 return;
90 } 91 }
91 92
93 QString tickerText, time, fileName;
94 if( playList->whichList() == 0 ) { //check for filelist
92 const DocLnk *playListCurrent = playList->current(); 95 const DocLnk *playListCurrent = playList->current();
93 if ( playListCurrent != NULL ) { 96 if ( playListCurrent != NULL ) {
94 currentFile = playListCurrent; 97 currentFile = playListCurrent;
95 } 98 }
96
97 xineControl->play( currentFile->file() ); 99 xineControl->play( currentFile->file() );
100 fileName = currentFile->name();
101 long seconds = mediaPlayerState->length();//
102 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
103 qDebug(time);
98 104
105 } else { //if playing in file list.. play in a different way
106 // random and looping settings enabled causes problems here,
107 // since there is no selected file in the playlist, but a selected file in the file list,
108 // so we remember and shutoff
109 l = mediaPlayerState->looping();
110 if(l)
111 mediaPlayerState->setLooping( false );
112 r = mediaPlayerState->shuffled();
113 mediaPlayerState->setShuffled(false);
114
115 fileName = playList->currentFileListPathName();
116 xineControl->play( fileName);
99 long seconds = mediaPlayerState->length();// 117 long seconds = mediaPlayerState->length();//
100 QString time; time.sprintf("%li:%02i", seconds/60, (int)seconds%60 ); 118 time.sprintf("%li:%02i", seconds/60, (int)seconds%60 );
101 qDebug(time); 119 qDebug(time);
120 if( fileName.left(4) != "http" )
121 fileName = QFileInfo( fileName).baseName();
102 122
103 QString tickerText; 123 }
104 if( currentFile->file().left(4) == "http" ) 124 if( fileName.left(4) == "http" )
105 tickerText= tr( " File: " ) + currentFile->name(); 125 tickerText= tr( " File: " ) + fileName;
106 else 126 else
107 tickerText = tr( " File: " ) + currentFile->name() + tr(", Length: ") + time; 127 tickerText = tr( " File: " ) + fileName + tr(", Length: ") + time;
108 128 audioUI->setTickerText( tickerText );
109 audioUI->setTickerText( currentFile->file( ) );
110
111} 129}
112 130
113 131
114void MediaPlayer::prev() { 132void MediaPlayer::prev() {
133 if(playList->whichList() == 0) { //if using the playlist
115 if ( playList->prev() ) { 134 if ( playList->prev() ) {
116 play(); 135 play();
117 } else if ( mediaPlayerState->looping() ) { 136 } else if ( mediaPlayerState->looping() ) {
@@ -122,9 +141,12 @@ void MediaPlayer::prev() {
122 mediaPlayerState->setList(); 141 mediaPlayerState->setList();
123 } 142 }
124} 143}
144}
125 145
126 146
127void MediaPlayer::next() { 147void MediaPlayer::next() {
148
149 if(playList->whichList() == 0) { //if using the playlist
128 if ( playList->next() ) { 150 if ( playList->next() ) {
129 play(); 151 play();
130 } else if ( mediaPlayerState->looping() ) { 152 } else if ( mediaPlayerState->looping() ) {
@@ -134,6 +156,14 @@ void MediaPlayer::next() {
134 } else { 156 } else {
135 mediaPlayerState->setList(); 157 mediaPlayerState->setList();
136 } 158 }
159 } else { //if playing from file list, let's just stop
160 qDebug("<<<<<<<<<<<<<<<<<stop for filelists");
161 mediaPlayerState->setPlaying(false);
162 mediaPlayerState->setView('l');
163 if(l) mediaPlayerState->setLooping(l);
164 if(r) mediaPlayerState->setShuffled(r);
165 }
166 qApp->processEvents();
137} 167}
138 168
139 169