summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 2323ac2..eeaed33 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -832,49 +832,50 @@ void PlayListWidget::tabChanged(QWidget *widg) {
832 populateVideoView(); 832 populateVideoView();
833 if( !tbDeletePlaylist->isHidden()) 833 if( !tbDeletePlaylist->isHidden())
834 tbDeletePlaylist->hide(); 834 tbDeletePlaylist->hide();
835 d->tbRemoveFromList->setEnabled(FALSE); 835 d->tbRemoveFromList->setEnabled(FALSE);
836 d->tbAddToList->setEnabled(TRUE); 836 d->tbAddToList->setEnabled(TRUE);
837 } 837 }
838 break; 838 break;
839 case 3: 839 case 3:
840 { 840 {
841 if( tbDeletePlaylist->isHidden()) 841 if( tbDeletePlaylist->isHidden())
842 tbDeletePlaylist->show(); 842 tbDeletePlaylist->show();
843 playLists->reread(); 843 playLists->reread();
844 } 844 }
845 break; 845 break;
846 }; 846 };
847} 847}
848 848
849void PlayListWidget::btnPlay(bool b) { 849void PlayListWidget::btnPlay(bool b) {
850 850
851// mediaPlayerState->setPlaying(b); 851// mediaPlayerState->setPlaying(b);
852 switch ( tabWidget->currentPageIndex()) { 852 switch ( tabWidget->currentPageIndex()) {
853 case 0: 853 case 0:
854 { 854 {
855 qDebug("here we are"); 855 qDebug("here we are");
856 if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { 856 if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1
857 || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) {
857 QMessageBox::message("Note","You are trying to play\na malformed url."); 858 QMessageBox::message("Note","You are trying to play\na malformed url.");
858 859
859 } else { 860 } else {
860 861
861 mediaPlayerState->setPlaying(b); 862 mediaPlayerState->setPlaying(b);
862 } } 863 } }
863 break; 864 break;
864 case 1: 865 case 1:
865 { 866 {
866 addToSelection( audioView->currentItem() ); 867 addToSelection( audioView->currentItem() );
867 mediaPlayerState->setPlaying(b); 868 mediaPlayerState->setPlaying(b);
868 d->selectedFiles->removeSelected( ); 869 d->selectedFiles->removeSelected( );
869 tabWidget->setCurrentPage(1); 870 tabWidget->setCurrentPage(1);
870 d->selectedFiles->unSelect(); 871 d->selectedFiles->unSelect();
871 insanityBool=FALSE; 872 insanityBool=FALSE;
872 }// audioView->clearSelection(); 873 }// audioView->clearSelection();
873 break; 874 break;
874 case 2: 875 case 2:
875 { 876 {
876 addToSelection( videoView->currentItem() ); 877 addToSelection( videoView->currentItem() );
877 mediaPlayerState->setPlaying(b); 878 mediaPlayerState->setPlaying(b);
878 qApp->processEvents(); 879 qApp->processEvents();
879 d->selectedFiles->removeSelected( ); 880 d->selectedFiles->removeSelected( );
880 tabWidget->setCurrentPage(2); 881 tabWidget->setCurrentPage(2);
@@ -1212,62 +1213,71 @@ void PlayListWidget::readm3u(const QString &filename) {
1212 qDebug("m3u filename is "+filename); 1213 qDebug("m3u filename is "+filename);
1213 QFile f(filename); 1214 QFile f(filename);
1214 1215
1215 if(f.open(IO_ReadOnly)) { 1216 if(f.open(IO_ReadOnly)) {
1216 QTextStream t(&f); 1217 QTextStream t(&f);
1217 QString s;//, first, second; 1218 QString s;//, first, second;
1218 int i=0; 1219 int i=0;
1219 while ( !t.atEnd()) { 1220 while ( !t.atEnd()) {
1220// Lview->insertLine(t.readLine(),-1); 1221// Lview->insertLine(t.readLine(),-1);
1221 s=t.readLine(); 1222 s=t.readLine();
1222 if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { 1223 if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) {
1223 QMessageBox::message("Note","Spaces in urls are not allowed."); 1224 QMessageBox::message("Note","Spaces in urls are not allowed.");
1224 } 1225 }
1225 else if(s.find("#",0,TRUE) == -1) { 1226 else if(s.find("#",0,TRUE) == -1) {
1226 if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat 1227 if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat
1227 if(s.left(2) == "E:" || s.left(2) == "P:") { 1228 if(s.left(2) == "E:" || s.left(2) == "P:") {
1228 s=s.right(s.length()-2); 1229 s=s.right(s.length()-2);
1229 DocLnk lnk( s ); 1230 DocLnk lnk( s );
1230 QFileInfo f(s); 1231 QFileInfo f(s);
1231 QString name = f.baseName(); 1232 QString name = f.baseName();
1232 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1233 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1233 lnk.setName( name); 1234 lnk.setName( name);
1234 s=s.replace( QRegExp("\\"),"/"); 1235 s=s.replace( QRegExp("\\"),"/");
1235 lnk.setFile( s); 1236 lnk.setFile( s);
1237 lnk.writeLink();
1236// lnk.setIcon(opieplayer/MPEGPlayer); 1238// lnk.setIcon(opieplayer/MPEGPlayer);
1237 qDebug("add "+name); 1239 qDebug("add "+name);
1238 d->selectedFiles->addToSelection( lnk); 1240 d->selectedFiles->addToSelection( lnk);
1239 } else { // is url 1241 } else { // is url
1240 1242
1241 s.replace(QRegExp("%20")," "); 1243 s.replace(QRegExp("%20")," ");
1242 DocLnk lnk( s); 1244 DocLnk lnk( s);
1243 QString name = s.right( s.length() - 7); 1245 QString name;
1246 if(name.left(4)=="http")
1247 name = s.right( s.length() - 7);
1248 else
1249 name=s;
1244// name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1250// name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1245 lnk.setName(name); 1251 lnk.setName(name);
1246 lnk.setFile( s+"/"); 1252 if(s.at(s.length()-4) == '.')
1253 lnk.setFile( s);
1254 else
1255 lnk.setFile( s+"/");
1247// lnk.setFile( filename); 1256// lnk.setFile( filename);
1248// lnk.setComment( s+"/"); 1257// lnk.setComment( s+"/");
1249 lnk.setType("audio/x-mpegurl"); 1258 lnk.setType("audio/x-mpegurl");
1259 lnk.writeLink();
1250// lnk.setIcon( "opieplayer/MPEGPlayer"); 1260// lnk.setIcon( "opieplayer/MPEGPlayer");
1251// qDebug("add "+s); 1261// qDebug("add "+s);
1252 d->selectedFiles->addToSelection( lnk); 1262 d->selectedFiles->addToSelection( lnk);
1253 } 1263 }
1254 i++; 1264 i++;
1255 } 1265 }
1256 } 1266 }
1257 } 1267 }
1258 } 1268 }
1259 f.close(); 1269 f.close();
1260} 1270}
1261 1271
1262void PlayListWidget::writem3u(const QString &filename) { 1272void PlayListWidget::writem3u(const QString &filename) {
1263 1273
1264} 1274}
1265 1275
1266void PlayListWidget::readPls(const QString &filename) { 1276void PlayListWidget::readPls(const QString &filename) {
1267 1277
1268 qDebug("pls filename is "+filename); 1278 qDebug("pls filename is "+filename);
1269 QFile f(filename); 1279 QFile f(filename);
1270 1280
1271 if(f.open(IO_ReadOnly)) { 1281 if(f.open(IO_ReadOnly)) {
1272 QTextStream t(&f); 1282 QTextStream t(&f);
1273 QString s;//, first, second; 1283 QString s;//, first, second;