summaryrefslogtreecommitdiff
authorsandman <sandman>2002-12-11 00:17:09 (UTC)
committer sandman <sandman>2002-12-11 00:17:09 (UTC)
commit6c71f5ccd9506234a317d9ff3d119613c457e769 (patch) (unidiff)
treef78a9d2a0981dbb446096bf072ca5decaa5e1d59
parente9d1213578b83f8380c4681186246a2b32ae6375 (diff)
downloadopie-6c71f5ccd9506234a317d9ff3d119613c457e769.zip
opie-6c71f5ccd9506234a317d9ff3d119613c457e769.tar.gz
opie-6c71f5ccd9506234a317d9ff3d119613c457e769.tar.bz2
fix for a stupid bug .. op1 wants to strip the extension, but instead
stripps everything after the first '.'. So filenames like "02. foobar.mp3" become "02"
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/om3u.cpp11
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp21
2 files changed, 23 insertions, 9 deletions
diff --git a/core/multimedia/opieplayer/om3u.cpp b/core/multimedia/opieplayer/om3u.cpp
index 039f3b1..3541e5f 100644
--- a/core/multimedia/opieplayer/om3u.cpp
+++ b/core/multimedia/opieplayer/om3u.cpp
@@ -47,4 +47,11 @@
47#include <qcstring.h> 47#include <qcstring.h>
48 48
49static inline QString fullBaseName ( const QFileInfo &fi )
50{
51 QString str = fi. fileName ( );
52 return str. left ( str. findRev ( '.' ));
53}
54
55
49//extern PlayListWidget *playList; 56//extern PlayListWidget *playList;
50 57
@@ -69,5 +76,5 @@ void Om3u::readM3u() {
69 s = s.right( s.length() -2 ); 76 s = s.right( s.length() -2 );
70 QFileInfo f( s ); 77 QFileInfo f( s );
71 QString name = f.baseName(); 78 QString name = fullBaseName ( f );
72 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); 79 name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 );
73 s=s.replace( QRegExp( "\\" ), "/" ); 80 s=s.replace( QRegExp( "\\" ), "/" );
@@ -106,5 +113,5 @@ void Om3u::readPls() { //it's a pls file
106 s = s.replace( QRegExp( "\\" ), "/" ); 113 s = s.replace( QRegExp( "\\" ), "/" );
107 QFileInfo f( s ); 114 QFileInfo f( s );
108 QString name = f.baseName(); 115 QString name = fullBaseName ( f );
109 if( name.left( 4 ) == "http" ) { 116 if( name.left( 4 ) == "http" ) {
110 name = s.right( s.length() - 7); 117 name = s.right( s.length() - 7);
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index c28548c..8b25a4c 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -84,4 +84,11 @@ extern VideoWidget *videoUI;
84extern MediaPlayerState *mediaPlayerState; 84extern MediaPlayerState *mediaPlayerState;
85 85
86static inline QString fullBaseName ( const QFileInfo &fi )
87{
88 QString str = fi. fileName ( );
89 return str. left ( str. findRev ( '.' ));
90}
91
92
86QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; 93QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg";
87// class myFileSelector { 94// class myFileSelector {
@@ -325,5 +332,5 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
325 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 332 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
326 loadList(DocLnk( currentPlaylist)); 333 loadList(DocLnk( currentPlaylist));
327 setCaption(tr("OpiePlayer: ")+ QFileInfo(currentPlaylist).baseName()); 334 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist)));
328 335
329 initializeStates(); 336 initializeStates();
@@ -682,5 +689,5 @@ void PlayListWidget::addSelected() {
682 break; 689 break;
683 }; 690 };
684 lnk.setName( QFileInfo(filename).baseName() ); //sets name 691 lnk.setName( fullBaseName ( QFileInfo(filename))); //sets name
685 lnk.setFile( filename ); //sets file name 692 lnk.setFile( filename ); //sets file name
686 d->selectedFiles->addToSelection( lnk); 693 d->selectedFiles->addToSelection( lnk);
@@ -717,5 +724,5 @@ void PlayListWidget::addToSelection( QListViewItem *it) {
717 724
718 filename=it->text(3); 725 filename=it->text(3);
719 lnk.setName( QFileInfo(filename).baseName() ); //sets name 726 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
720 lnk.setFile( filename ); //sets file name 727 lnk.setFile( filename ); //sets file name
721 d->selectedFiles->addToSelection( lnk); 728 d->selectedFiles->addToSelection( lnk);
@@ -1039,5 +1046,5 @@ void PlayListWidget::openFile() {
1039 readPls( filename ); 1046 readPls( filename );
1040 } else { 1047 } else {
1041 lnk.setName( QFileInfo(filename).baseName() ); //sets name 1048 lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name
1042 lnk.setFile( filename ); //sets file name 1049 lnk.setFile( filename ); //sets file name
1043 d->selectedFiles->addToSelection( lnk); 1050 d->selectedFiles->addToSelection( lnk);
@@ -1075,5 +1082,5 @@ void PlayListWidget::readm3u( const QString &filename ) {
1075 } else { 1082 } else {
1076 // if( QFileInfo( s ).exists() ) { 1083 // if( QFileInfo( s ).exists() ) {
1077 lnk.setName( QFileInfo(s).baseName()); 1084 lnk.setName( fullBaseName ( QFileInfo(s)));
1078 // if(s.right(4) == '.') {//if regular file 1085 // if(s.right(4) == '.') {//if regular file
1079 if(s.left(1) != "/") { 1086 if(s.left(1) != "/") {
@@ -1101,5 +1108,5 @@ void PlayListWidget::readm3u( const QString &filename ) {
1101 1108
1102 d->selectedFiles->setSelectedItem( s); 1109 d->selectedFiles->setSelectedItem( s);
1103 setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); 1110 setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename)));
1104 1111
1105} 1112}
@@ -1120,5 +1127,5 @@ void PlayListWidget::readPls( const QString &filename ) {
1120 DocLnk lnk( s ); 1127 DocLnk lnk( s );
1121 QFileInfo f( s ); 1128 QFileInfo f( s );
1122 QString name = f.baseName(); 1129 QString name = fullBaseName ( f);
1123 1130
1124 if( name.left( 4 ) == "http" ) { 1131 if( name.left( 4 ) == "http" ) {