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
@@ -728,257 +728,258 @@ void PlayListWidget::addSelected() {
728 } 728 }
729 break; 729 break;
730 case 2: { // video 730 case 2: { // video
731 QListViewItemIterator it( videoView ); 731 QListViewItemIterator it( videoView );
732 // iterate through all items of the listview 732 // iterate through all items of the listview
733 for ( ; it.current(); ++it ) { 733 for ( ; it.current(); ++it ) {
734 if ( it.current()->isSelected() ) { 734 if ( it.current()->isSelected() ) {
735 QListIterator<DocLnk> dit( vFiles.children() ); 735 QListIterator<DocLnk> dit( vFiles.children() );
736 for ( ; dit.current(); ++dit ) { 736 for ( ; dit.current(); ++dit ) {
737 if( dit.current()->name() == it.current()->text(0) ) { 737 if( dit.current()->name() == it.current()->text(0) ) {
738 d->selectedFiles->addToSelection( **dit ); 738 d->selectedFiles->addToSelection( **dit );
739 } 739 }
740 } 740 }
741 741
742 videoView->setSelected( it.current(),FALSE); 742 videoView->setSelected( it.current(),FALSE);
743 } 743 }
744 } 744 }
745// for ( int i = 0; i < noOfFiles; i++ ) { 745// for ( int i = 0; i < noOfFiles; i++ ) {
746// QString entryName; 746// QString entryName;
747// entryName.sprintf( "File%i", i + 1 ); 747// entryName.sprintf( "File%i", i + 1 );
748// QString linkFile = cfg.readEntry( entryName ); 748// QString linkFile = cfg.readEntry( entryName );
749// if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) { 749// if( DocLnk( linkFile).name() == videoView->selectedItem()->text(0) ) {
750// int result= QMessageBox::warning(this,tr("OpiePlayer"), 750// int result= QMessageBox::warning(this,tr("OpiePlayer"),
751// tr("This is all ready in your playlist.\nContinue?"), 751// tr("This is all ready in your playlist.\nContinue?"),
752// tr("Yes"),tr("No"),0,0,1); 752// tr("Yes"),tr("No"),0,0,1);
753// if (result !=0) 753// if (result !=0)
754// return; 754// return;
755// } 755// }
756// } 756// }
757// addToSelection( videoView->selectedItem() ); 757// addToSelection( videoView->selectedItem() );
758 tabWidget->setCurrentPage(0); 758 tabWidget->setCurrentPage(0);
759 } 759 }
760 break; 760 break;
761 }; 761 };
762} 762}
763 763
764void PlayListWidget::removeSelected() { 764void PlayListWidget::removeSelected() {
765 d->selectedFiles->removeSelected( ); 765 d->selectedFiles->removeSelected( );
766} 766}
767 767
768void PlayListWidget::playIt( QListViewItem *it) { 768void PlayListWidget::playIt( QListViewItem *it) {
769// d->setDocumentUsed = FALSE; 769// d->setDocumentUsed = FALSE;
770// mediaPlayerState->curPosition =0; 770// mediaPlayerState->curPosition =0;
771 qDebug("playIt"); 771 qDebug("playIt");
772 mediaPlayerState->setPlaying(FALSE); 772 mediaPlayerState->setPlaying(FALSE);
773 mediaPlayerState->setPlaying(TRUE); 773 mediaPlayerState->setPlaying(TRUE);
774 d->selectedFiles->unSelect(); 774 d->selectedFiles->unSelect();
775} 775}
776 776
777void PlayListWidget::addToSelection( QListViewItem *it) { 777void PlayListWidget::addToSelection( QListViewItem *it) {
778 d->setDocumentUsed = FALSE; 778 d->setDocumentUsed = FALSE;
779 779
780 if(it) { 780 if(it) {
781 switch (tabWidget->currentPageIndex()) { 781 switch (tabWidget->currentPageIndex()) {
782 case 1: { 782 case 1: {
783 QListIterator<DocLnk> dit( files.children() ); 783 QListIterator<DocLnk> dit( files.children() );
784 for ( ; dit.current(); ++dit ) { 784 for ( ; dit.current(); ++dit ) {
785 if( dit.current()->name() == it->text(0)) { 785 if( dit.current()->name() == it->text(0)) {
786 d->selectedFiles->addToSelection( **dit ); 786 d->selectedFiles->addToSelection( **dit );
787 } 787 }
788 } 788 }
789 } 789 }
790 break; 790 break;
791 case 2: { 791 case 2: {
792 QListIterator<DocLnk> dit( vFiles.children() ); 792 QListIterator<DocLnk> dit( vFiles.children() );
793 for ( ; dit.current(); ++dit ) { 793 for ( ; dit.current(); ++dit ) {
794 if( dit.current()->name() == it->text(0)) { 794 if( dit.current()->name() == it->text(0)) {
795 d->selectedFiles->addToSelection( **dit ); 795 d->selectedFiles->addToSelection( **dit );
796 } 796 }
797 } 797 }
798 } 798 }
799 break; 799 break;
800 case 0: 800 case 0:
801 break; 801 break;
802 }; 802 };
803 tabWidget->setCurrentPage(0); 803 tabWidget->setCurrentPage(0);
804 } 804 }
805} 805}
806 806
807void PlayListWidget::tabChanged(QWidget *widg) { 807void PlayListWidget::tabChanged(QWidget *widg) {
808 808
809 switch ( tabWidget->currentPageIndex()) { 809 switch ( tabWidget->currentPageIndex()) {
810 case 0: 810 case 0:
811 { 811 {
812 if( !tbDeletePlaylist->isHidden()) 812 if( !tbDeletePlaylist->isHidden())
813 tbDeletePlaylist->hide(); 813 tbDeletePlaylist->hide();
814 d->tbRemoveFromList->setEnabled(TRUE); 814 d->tbRemoveFromList->setEnabled(TRUE);
815 d->tbAddToList->setEnabled(FALSE); 815 d->tbAddToList->setEnabled(FALSE);
816 } 816 }
817 break; 817 break;
818 case 1: 818 case 1:
819 { 819 {
820 audioView->clear(); 820 audioView->clear();
821 populateAudioView(); 821 populateAudioView();
822 822
823 if( !tbDeletePlaylist->isHidden()) 823 if( !tbDeletePlaylist->isHidden())
824 tbDeletePlaylist->hide(); 824 tbDeletePlaylist->hide();
825 d->tbRemoveFromList->setEnabled(FALSE); 825 d->tbRemoveFromList->setEnabled(FALSE);
826 d->tbAddToList->setEnabled(TRUE); 826 d->tbAddToList->setEnabled(TRUE);
827 } 827 }
828 break; 828 break;
829 case 2: 829 case 2:
830 { 830 {
831 videoView->clear(); 831 videoView->clear();
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);
881 d->selectedFiles->unSelect(); 882 d->selectedFiles->unSelect();
882 insanityBool=FALSE; 883 insanityBool=FALSE;
883 }// videoView->clearSelection(); 884 }// videoView->clearSelection();
884 break; 885 break;
885 }; 886 };
886 887
887} 888}
888 889
889void PlayListWidget::deletePlaylist() { 890void PlayListWidget::deletePlaylist() {
890 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 891 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
891 (tr("You really want to delete\nthis playlist?")), 892 (tr("You really want to delete\nthis playlist?")),
892 (tr("Yes")), (tr("No")), 0 )){ 893 (tr("Yes")), (tr("No")), 0 )){
893 case 0: // Yes clicked, 894 case 0: // Yes clicked,
894 QFile().remove(playLists->selected()->file()); 895 QFile().remove(playLists->selected()->file());
895 QFile().remove(playLists->selected()->linkFile()); 896 QFile().remove(playLists->selected()->linkFile());
896 playLists->reread(); 897 playLists->reread();
897 break; 898 break;
898 case 1: // Cancel 899 case 1: // Cancel
899 break; 900 break;
900 }; 901 };
901} 902}
902 903
903void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 904void PlayListWidget::viewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
904{ 905{
905 switch (mouse) { 906 switch (mouse) {
906 case 1: 907 case 1:
907 break; 908 break;
908 case 2:{ 909 case 2:{
909 910
910 QPopupMenu m; 911 QPopupMenu m;
911 m.insertItem( tr( "Play" ), this, SLOT( playSelected() )); 912 m.insertItem( tr( "Play" ), this, SLOT( playSelected() ));
912 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() )); 913 m.insertItem( tr( "Add to Playlist" ), this, SLOT( addSelected() ));
913 m.insertSeparator(); 914 m.insertSeparator();
914 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() ) 915 if( QFile(QPEApplication::qpeDir()+"lib/libopie.so").exists() )
915 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 916 m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
916 917
917 m.exec( QCursor::pos() ); 918 m.exec( QCursor::pos() );
918 } 919 }
919 break; 920 break;
920 }; 921 };
921} 922}
922 923
923void PlayListWidget::playSelected() 924void PlayListWidget::playSelected()
924{ 925{
925 btnPlay( TRUE); 926 btnPlay( TRUE);
926// d->selectedFiles->unSelect(); 927// d->selectedFiles->unSelect();
927} 928}
928 929
929void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i) 930void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *item, const QPoint& point, int i)
930{ 931{
931 switch (mouse) { 932 switch (mouse) {
932 case 1: 933 case 1:
933 934
934 break; 935 break;
935 case 2:{ 936 case 2:{
936 QPopupMenu m; 937 QPopupMenu m;
937 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() )); 938 m.insertItem( tr( "Play Selected" ), this, SLOT( playSelected() ));
938 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() )); 939 m.insertItem( tr( "Remove" ), this, SLOT( removeSelected() ));
939// m.insertSeparator(); 940// m.insertSeparator();
940// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() )); 941// m.insertItem( tr( "Properties" ), this, SLOT( listDelete() ));
941 m.exec( QCursor::pos() ); 942 m.exec( QCursor::pos() );
942 } 943 }
943 break; 944 break;
944 }; 945 };
945 946
946} 947}
947 948
948void PlayListWidget::listDelete() { 949void PlayListWidget::listDelete() {
949 Config cfg( "OpiePlayer" ); 950 Config cfg( "OpiePlayer" );
950 cfg.setGroup("PlayList"); 951 cfg.setGroup("PlayList");
951 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 952 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
952 QString file; 953 QString file;
953 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 954 int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 );
954 switch ( tabWidget->currentPageIndex()) { 955 switch ( tabWidget->currentPageIndex()) {
955 case 0: 956 case 0:
956 break; 957 break;
957 case 1: 958 case 1:
958 { 959 {
959 file = audioView->selectedItem()->text(0); 960 file = audioView->selectedItem()->text(0);
960// Global::findDocuments(&files, "audio/*"); 961// Global::findDocuments(&files, "audio/*");
961// AppLnkSet appFiles; 962// AppLnkSet appFiles;
962 QListIterator<DocLnk> dit( files.children() ); 963 QListIterator<DocLnk> dit( files.children() );
963 for ( ; dit.current(); ++dit ) { 964 for ( ; dit.current(); ++dit ) {
964 if( dit.current()->name() == file) { 965 if( dit.current()->name() == file) {
965// qDebug(file); 966// qDebug(file);
966 LnkProperties prop( dit.current() ); 967 LnkProperties prop( dit.current() );
967// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *))); 968// connect(&prop, SIGNAL(select(const AppLnk *)), this, SLOT(externalSelected(const AppLnk *)));
968 prop.showMaximized(); 969 prop.showMaximized();
969 prop.exec(); 970 prop.exec();
970 } 971 }
971 } 972 }
972 populateAudioView(); 973 populateAudioView();
973 } 974 }
974 break; 975 break;
975 case 2: 976 case 2:
976 { 977 {
977// file = videoView->selectedItem()->text(0); 978// file = videoView->selectedItem()->text(0);
978// for ( int i = 0; i < noOfFiles; i++ ) { 979// for ( int i = 0; i < noOfFiles; i++ ) {
979// QString entryName; 980// QString entryName;
980// entryName.sprintf( "File%i", i + 1 ); 981// entryName.sprintf( "File%i", i + 1 );
981// QString linkFile = cfg.readEntry( entryName ); 982// QString linkFile = cfg.readEntry( entryName );
982// AppLnk lnk( AppLnk(linkFile)); 983// AppLnk lnk( AppLnk(linkFile));
983// if( lnk.name() == file ) { 984// if( lnk.name() == file ) {
984// LnkProperties prop( &lnk); 985// LnkProperties prop( &lnk);
@@ -1108,204 +1109,213 @@ void PlayListWidget::openFile() {
1108 } 1109 }
1109 } 1110 }
1110 } 1111 }
1111 if(fileDlg) 1112 if(fileDlg)
1112 delete fileDlg; 1113 delete fileDlg;
1113} 1114}
1114 1115
1115void PlayListWidget::keyReleaseEvent( QKeyEvent *e) 1116void PlayListWidget::keyReleaseEvent( QKeyEvent *e)
1116{ 1117{
1117 switch ( e->key() ) { 1118 switch ( e->key() ) {
1118////////////////////////////// Zaurus keys 1119////////////////////////////// Zaurus keys
1119 case Key_F9: //activity 1120 case Key_F9: //activity
1120// if(audioUI->isHidden()) 1121// if(audioUI->isHidden())
1121// audioUI->showMaximized(); 1122// audioUI->showMaximized();
1122 break; 1123 break;
1123 case Key_F10: //contacts 1124 case Key_F10: //contacts
1124// if( videoUI->isHidden()) 1125// if( videoUI->isHidden())
1125// videoUI->showMaximized(); 1126// videoUI->showMaximized();
1126 break; 1127 break;
1127 case Key_F11: //menu 1128 case Key_F11: //menu
1128 break; 1129 break;
1129 case Key_F12: //home 1130 case Key_F12: //home
1130// doBlank(); 1131// doBlank();
1131 break; 1132 break;
1132 case Key_F13: //mail 1133 case Key_F13: //mail
1133// doUnblank(); 1134// doUnblank();
1134 break; 1135 break;
1135 case Key_Q: //add to playlist 1136 case Key_Q: //add to playlist
1136 qDebug("Add"); 1137 qDebug("Add");
1137 addSelected(); 1138 addSelected();
1138 break; 1139 break;
1139 case Key_R: //remove from playlist 1140 case Key_R: //remove from playlist
1140 removeSelected(); 1141 removeSelected();
1141 break; 1142 break;
1142// case Key_P: //play 1143// case Key_P: //play
1143// qDebug("Play"); 1144// qDebug("Play");
1144// playSelected(); 1145// playSelected();
1145// break; 1146// break;
1146 case Key_Space: 1147 case Key_Space:
1147 qDebug("Play"); 1148 qDebug("Play");
1148// playSelected(); puh 1149// playSelected(); puh
1149 break; 1150 break;
1150 case Key_1: 1151 case Key_1:
1151 tabWidget->setCurrentPage(0); 1152 tabWidget->setCurrentPage(0);
1152 break; 1153 break;
1153 case Key_2: 1154 case Key_2:
1154 tabWidget->setCurrentPage(1); 1155 tabWidget->setCurrentPage(1);
1155 break; 1156 break;
1156 case Key_3: 1157 case Key_3:
1157 tabWidget->setCurrentPage(2); 1158 tabWidget->setCurrentPage(2);
1158 break; 1159 break;
1159 case Key_4: 1160 case Key_4:
1160 tabWidget->setCurrentPage(3); 1161 tabWidget->setCurrentPage(3);
1161 break; 1162 break;
1162 } 1163 }
1163} 1164}
1164 1165
1165void PlayListWidget::keyPressEvent( QKeyEvent *e) 1166void PlayListWidget::keyPressEvent( QKeyEvent *e)
1166{ 1167{
1167// qDebug("Key press"); 1168// qDebug("Key press");
1168// switch ( e->key() ) { 1169// switch ( e->key() ) {
1169// ////////////////////////////// Zaurus keys 1170// ////////////////////////////// Zaurus keys
1170// case Key_A: //add to playlist 1171// case Key_A: //add to playlist
1171// qDebug("Add"); 1172// qDebug("Add");
1172// addSelected(); 1173// addSelected();
1173// break; 1174// break;
1174// case Key_R: //remove from playlist 1175// case Key_R: //remove from playlist
1175// removeSelected(); 1176// removeSelected();
1176// break; 1177// break;
1177// case Key_P: //play 1178// case Key_P: //play
1178// qDebug("Play"); 1179// qDebug("Play");
1179// playSelected(); 1180// playSelected();
1180// break; 1181// break;
1181// case Key_Space: 1182// case Key_Space:
1182// qDebug("Play"); 1183// qDebug("Play");
1183// playSelected(); 1184// playSelected();
1184// break; 1185// break;
1185// } 1186// }
1186} 1187}
1187 1188
1188void PlayListWidget::doBlank() { 1189void PlayListWidget::doBlank() {
1189 qDebug("do blanking"); 1190 qDebug("do blanking");
1190 fd=open("/dev/fb0",O_RDWR); 1191 fd=open("/dev/fb0",O_RDWR);
1191 if (fd != -1) { 1192 if (fd != -1) {
1192 ioctl(fd,FBIOBLANK,1); 1193 ioctl(fd,FBIOBLANK,1);
1193// close(fd); 1194// close(fd);
1194 } 1195 }
1195} 1196}
1196 1197
1197void PlayListWidget::doUnblank() { 1198void PlayListWidget::doUnblank() {
1198 // this crashes opieplayer with a segfault 1199 // this crashes opieplayer with a segfault
1199// int fd; 1200// int fd;
1200// fd=open("/dev/fb0",O_RDWR); 1201// fd=open("/dev/fb0",O_RDWR);
1201 qDebug("do unblanking"); 1202 qDebug("do unblanking");
1202 if (fd != -1) { 1203 if (fd != -1) {
1203 ioctl(fd,FBIOBLANK,0); 1204 ioctl(fd,FBIOBLANK,0);
1204 close(fd); 1205 close(fd);
1205 } 1206 }
1206 QCopEnvelope h("QPE/System", "setBacklight(int)"); 1207 QCopEnvelope h("QPE/System", "setBacklight(int)");
1207 h <<-3;// v[1]; // -3 Force on 1208 h <<-3;// v[1]; // -3 Force on
1208} 1209}
1209 1210
1210void PlayListWidget::readm3u(const QString &filename) { 1211void PlayListWidget::readm3u(const QString &filename) {
1211 1212
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;
1274 int i=0; 1284 int i=0;
1275 while ( !t.atEnd()) { 1285 while ( !t.atEnd()) {
1276 s=t.readLine(); 1286 s=t.readLine();
1277 if(s.left(4) == "File") { 1287 if(s.left(4) == "File") {
1278 s=s.right(s.length() - 6); 1288 s=s.right(s.length() - 6);
1279 s.replace(QRegExp("%20")," "); 1289 s.replace(QRegExp("%20")," ");
1280 qDebug("adding "+s+" to playlist"); 1290 qDebug("adding "+s+" to playlist");
1281// numberofentries=2 1291// numberofentries=2
1282// File1=http 1292// File1=http
1283 // Title 1293 // Title
1284// Length 1294// Length
1285// Version 1295// Version
1286// File2=http 1296// File2=http
1287 1297
1288 s=s.replace( QRegExp("\\"),"/"); 1298 s=s.replace( QRegExp("\\"),"/");
1289// Lview->insertLine(t.readLine(),-1); 1299// Lview->insertLine(t.readLine(),-1);
1290// s=t.readLine(); 1300// s=t.readLine();
1291// s=s.right(s.length()-2); 1301// s=s.right(s.length()-2);
1292 DocLnk lnk( s ); 1302 DocLnk lnk( s );
1293 QFileInfo f(s); 1303 QFileInfo f(s);
1294 QString name = f.baseName(); 1304 QString name = f.baseName();
1295 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1); 1305 name = name.right(name.length()-name.findRev("\\",-1,TRUE)-1);
1296// QFileInfo f(s); 1306// QFileInfo f(s);
1297// QString name = f.baseName(); 1307// QString name = f.baseName();
1298// // name = name.left(name.length()-4); 1308// // name = name.left(name.length()-4);
1299// name = name.right(name.findRev("/",0,TRUE)); 1309// name = name.right(name.findRev("/",0,TRUE));
1300 lnk.setName( name); 1310 lnk.setName( name);
1301 lnk.setFile( s+"/"); 1311 lnk.setFile( s+"/");
1302 lnk.setType("audio/x-mpegurl"); 1312 lnk.setType("audio/x-mpegurl");
1303 1313
1304 qDebug("DocLnk add "+name); 1314 qDebug("DocLnk add "+name);
1305 d->selectedFiles->addToSelection( lnk); 1315 d->selectedFiles->addToSelection( lnk);
1306 } 1316 }
1307 } 1317 }
1308 i++; 1318 i++;
1309 } 1319 }
1310} 1320}
1311 1321