author | llornkcor <llornkcor> | 2003-04-18 16:19:10 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-04-18 16:19:10 (UTC) |
commit | 486db3bff8680e22bade85c348a7673f847a6f37 (patch) (unidiff) | |
tree | adb4c1faff1bc5e97229333ffbbf8cb54d991f2f | |
parent | 81776eb70dcad6748b8494ff13fbd048c60c1fae (diff) | |
download | opie-486db3bff8680e22bade85c348a7673f847a6f37.zip opie-486db3bff8680e22bade85c348a7673f847a6f37.tar.gz opie-486db3bff8680e22bade85c348a7673f847a6f37.tar.bz2 |
fix typed in url file/name problem
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 299181b..8b295b0 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -1039,103 +1039,113 @@ void PlayListWidget::populateVideoView() { | |||
1039 | QListViewItem * newItem; | 1039 | QListViewItem * newItem; |
1040 | if ( QFile( Vdit.current()->file()).exists() ) { | 1040 | if ( QFile( Vdit.current()->file()).exists() ) { |
1041 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 1041 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
1042 | QString::number( QFile( Vdit.current()->file() ).size() ), | 1042 | QString::number( QFile( Vdit.current()->file() ).size() ), |
1043 | storage, Vdit.current()->file()); | 1043 | storage, Vdit.current()->file()); |
1044 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); | 1044 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer/videofile" )); |
1045 | } | 1045 | } |
1046 | } | 1046 | } |
1047 | } | 1047 | } |
1048 | 1048 | ||
1049 | void PlayListWidget::openFile() { | 1049 | void PlayListWidget::openFile() { |
1050 | qDebug("<<<<<<<<<OPEN File"); | 1050 | qDebug("<<<<<<<<<OPEN File"); |
1051 | QString filename, name; | 1051 | QString filename, name; |
1052 | InputDialog *fileDlg; | 1052 | InputDialog *fileDlg; |
1053 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 1053 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
1054 | fileDlg->exec(); | 1054 | fileDlg->exec(); |
1055 | if( fileDlg->result() == 1 ) { | 1055 | if( fileDlg->result() == 1 ) { |
1056 | filename = fileDlg->text(); | 1056 | filename = fileDlg->text(); |
1057 | qDebug( "Selected filename is " + filename ); | 1057 | qDebug( "Selected filename is " + filename ); |
1058 | // Om3u *m3uList; | 1058 | // Om3u *m3uList; |
1059 | DocLnk lnk; | 1059 | DocLnk lnk; |
1060 | Config cfg( "OpiePlayer" ); | 1060 | Config cfg( "OpiePlayer" ); |
1061 | cfg.setGroup("PlayList"); | 1061 | cfg.setGroup("PlayList"); |
1062 | 1062 | ||
1063 | QString m3uFile; | ||
1064 | m3uFile = filename; | ||
1063 | if(filename.left(4) == "http") { | 1065 | if(filename.left(4) == "http") { |
1064 | QString m3uFile, m3uFilePath; | ||
1065 | if(filename.find(":",8,TRUE) != -1) { //found a port | 1066 | if(filename.find(":",8,TRUE) != -1) { //found a port |
1066 | m3uFile = filename.left( filename.find( ":",8,TRUE)); | ||
1067 | m3uFile = m3uFile.right( 7); | ||
1068 | } else if(filename.left(4) == "http"){ | ||
1069 | m3uFile=filename; | ||
1070 | m3uFile = m3uFile.right( m3uFile.length() - 7); | ||
1071 | } else{ | ||
1072 | m3uFile=filename; | ||
1073 | } | ||
1074 | 1067 | ||
1075 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); | 1068 | // m3uFile = filename.left( filename.find( ":",8,TRUE)); |
1076 | lnk.setName( filename ); //sets name | 1069 | m3uFile = filename; |
1070 | if( m3uFile.right( 1 ).find( '/' ) == -1) { | ||
1071 | m3uFile += "/"; | ||
1072 | } | ||
1073 | filename = m3uFile; | ||
1074 | // qDebug("1 "+m3uFile); | ||
1075 | // } else if(filename.left(4) == "http"){ | ||
1076 | // m3uFile=filename; | ||
1077 | // m3uFile = m3uFile.right( m3uFile.length() - 7); | ||
1078 | // qDebug("2 "+m3uFile); | ||
1079 | // } else{ | ||
1080 | // m3uFile=filename; | ||
1081 | // qDebug("3 "+m3uFile); | ||
1082 | } | ||
1083 | lnk.setName( m3uFile ); //sets name | ||
1077 | lnk.setFile( filename ); //sets file name | 1084 | lnk.setFile( filename ); //sets file name |
1078 | lnk.setIcon("opieplayer2/musicfile"); | 1085 | lnk.setIcon("opieplayer2/musicfile"); |
1079 | d->selectedFiles->addToSelection( lnk ); | 1086 | d->selectedFiles->addToSelection( lnk ); |
1080 | writeCurrentM3u(); | 1087 | writeCurrentM3u(); |
1081 | } | 1088 | } |
1082 | else if( filename.right( 3) == "m3u" ) { | 1089 | else if( filename.right( 3) == "m3u" ) { |
1083 | readm3u( filename ); | 1090 | readm3u( filename ); |
1084 | 1091 | ||
1085 | } else if( filename.right(3) == "pls" ) { | 1092 | } else if( filename.right(3) == "pls" ) { |
1086 | readPls( filename ); | 1093 | readPls( filename ); |
1087 | } else { | 1094 | } else { |
1088 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name | 1095 | lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name |
1089 | lnk.setFile( filename ); //sets file name | 1096 | lnk.setFile( filename ); //sets file name |
1090 | d->selectedFiles->addToSelection( lnk); | 1097 | d->selectedFiles->addToSelection( lnk); |
1091 | writeCurrentM3u(); | 1098 | writeCurrentM3u(); |
1092 | } | 1099 | } |
1093 | } | 1100 | } |
1094 | 1101 | ||
1095 | if( fileDlg ) { | 1102 | if( fileDlg ) { |
1096 | delete fileDlg; | 1103 | delete fileDlg; |
1097 | } | 1104 | } |
1098 | } | 1105 | } |
1099 | 1106 | ||
1100 | 1107 | ||
1101 | /* | 1108 | /* |
1102 | reads m3u and shows files/urls to playlist widget */ | 1109 | reads m3u and shows files/urls to playlist widget */ |
1103 | void PlayListWidget::readm3u( const QString &filename ) { | 1110 | void PlayListWidget::readm3u( const QString &filename ) { |
1104 | qDebug( "read m3u filename " + filename ); | 1111 | qDebug( "read m3u filename " + filename ); |
1105 | 1112 | ||
1106 | Om3u *m3uList; | 1113 | Om3u *m3uList; |
1107 | QString s, name; | 1114 | QString s, name; |
1108 | m3uList = new Om3u( filename, IO_ReadOnly ); | 1115 | m3uList = new Om3u( filename, IO_ReadOnly ); |
1109 | m3uList->readM3u(); | 1116 | m3uList->readM3u(); |
1110 | DocLnk lnk; | 1117 | DocLnk lnk; |
1111 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 1118 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
1112 | s = *it; | 1119 | s = *it; |
1113 | // qDebug("reading "+ s); | 1120 | // qDebug("reading "+ s); |
1114 | if(s.left(4)=="http") { | 1121 | if(s.left(4)=="http") { |
1115 | lnk.setName( s ); //sets file name | 1122 | lnk.setName( s ); //sets file name |
1116 | lnk.setIcon("opieplayer2/musicfile"); | 1123 | lnk.setIcon("opieplayer2/musicfile"); |
1117 | if(s.right(4) != '.' || s.right(5) != '.') | 1124 | |
1125 | // if(s.right(4) != '.' || s.right(5) != '.') | ||
1126 | if(s.right(4) != '.' || s.right(5) != '.' ) | ||
1127 | if( s.right(1) != "/") | ||
1118 | lnk.setFile( s+"/"); //if url with no extension | 1128 | lnk.setFile( s+"/"); //if url with no extension |
1119 | else | 1129 | else |
1120 | lnk.setFile( s ); //sets file name | 1130 | lnk.setFile( s ); //sets file name |
1121 | 1131 | ||
1122 | } else { | 1132 | } else { |
1123 | // if( QFileInfo( s ).exists() ) { | 1133 | // if( QFileInfo( s ).exists() ) { |
1124 | lnk.setName( fullBaseName ( QFileInfo(s))); | 1134 | lnk.setName( fullBaseName ( QFileInfo(s))); |
1125 | // if(s.right(4) == '.') {//if regular file | 1135 | // if(s.right(4) == '.') {//if regular file |
1126 | if(s.left(1) != "/") { | 1136 | if(s.left(1) != "/") { |
1127 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 1137 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
1128 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 1138 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
1129 | lnk.setIcon("SoundPlayer"); | 1139 | lnk.setIcon("SoundPlayer"); |
1130 | } else { | 1140 | } else { |
1131 | // qDebug("set link2 "+s); | 1141 | // qDebug("set link2 "+s); |
1132 | lnk.setFile( s); | 1142 | lnk.setFile( s); |
1133 | lnk.setIcon("SoundPlayer"); | 1143 | lnk.setIcon("SoundPlayer"); |
1134 | } | 1144 | } |
1135 | } | 1145 | } |
1136 | d->selectedFiles->addToSelection( lnk ); | 1146 | d->selectedFiles->addToSelection( lnk ); |
1137 | } | 1147 | } |
1138 | Config config( "OpiePlayer" ); | 1148 | Config config( "OpiePlayer" ); |
1139 | config.setGroup( "PlayList" ); | 1149 | config.setGroup( "PlayList" ); |
1140 | 1150 | ||
1141 | config.writeEntry("CurrentPlaylist",filename); | 1151 | config.writeEntry("CurrentPlaylist",filename); |