-rw-r--r-- | core/multimedia/opieplayer/om3u.cpp | 11 | ||||
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 21 |
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 @@ -45,8 +45,15 @@ #include <qtextstream.h> #include <qstringlist.h> #include <qcstring.h> +static inline QString fullBaseName ( const QFileInfo &fi ) +{ + QString str = fi. fileName ( ); + return str. left ( str. findRev ( '.' )); +} + + //extern PlayListWidget *playList; Om3u::Om3u( const QString &filePath, int mode) : QStringList (){ @@ -67,9 +74,9 @@ void Om3u::readM3u() { if( s.find( "#", 0, TRUE) == -1 ) { if( s.left(2) == "E:" || s.left(2) == "P:" ) { s = s.right( s.length() -2 ); QFileInfo f( s ); - QString name = f.baseName(); + QString name = fullBaseName ( f ); name = name.right( name.length() - name.findRev( "\\", -1, TRUE ) -1 ); s=s.replace( QRegExp( "\\" ), "/" ); append(s); // qDebug(s); @@ -104,9 +111,9 @@ void Om3u::readPls() { //it's a pls file // Version // File2=http s = s.replace( QRegExp( "\\" ), "/" ); QFileInfo f( s ); - QString name = f.baseName(); + QString name = fullBaseName ( f ); if( name.left( 4 ) == "http" ) { name = s.right( s.length() - 7); } else { name = s; 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 @@ -82,8 +82,15 @@ extern AudioWidget *audioUI; extern VideoWidget *videoUI; extern MediaPlayerState *mediaPlayerState; +static inline QString fullBaseName ( const QFileInfo &fi ) +{ + QString str = fi. fileName ( ); + return str. left ( str. findRev ( '.' )); +} + + QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg"; // class myFileSelector { // }; @@ -323,9 +330,9 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) Config cfg( "OpiePlayer" ); readConfig( cfg ); QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); loadList(DocLnk( currentPlaylist)); - setCaption(tr("OpiePlayer: ")+ QFileInfo(currentPlaylist).baseName()); + setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(currentPlaylist))); initializeStates(); } @@ -680,9 +687,9 @@ void PlayListWidget::addSelected() { } break; }; - lnk.setName( QFileInfo(filename).baseName() ); //sets name + lnk.setName( fullBaseName ( QFileInfo(filename))); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); tabWidget->setCurrentPage(0); writeCurrentM3u(); @@ -715,9 +722,9 @@ void PlayListWidget::addToSelection( QListViewItem *it) { DocLnk lnk; QString filename; filename=it->text(3); - lnk.setName( QFileInfo(filename).baseName() ); //sets name + lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); writeCurrentM3u(); @@ -1037,9 +1044,9 @@ void PlayListWidget::openFile() { } else if( filename.right(3) == "pls" ) { readPls( filename ); } else { - lnk.setName( QFileInfo(filename).baseName() ); //sets name + lnk.setName( fullBaseName ( QFileInfo(filename)) ); //sets name lnk.setFile( filename ); //sets file name d->selectedFiles->addToSelection( lnk); writeCurrentM3u(); } @@ -1073,9 +1080,9 @@ void PlayListWidget::readm3u( const QString &filename ) { lnk.setFile( s ); //sets file name } else { // if( QFileInfo( s ).exists() ) { - lnk.setName( QFileInfo(s).baseName()); + lnk.setName( fullBaseName ( QFileInfo(s))); // if(s.right(4) == '.') {//if regular file if(s.left(1) != "/") { // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); @@ -1099,9 +1106,9 @@ void PlayListWidget::readm3u( const QString &filename ) { m3uList->close(); if(m3uList) delete m3uList; d->selectedFiles->setSelectedItem( s); - setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); + setCaption(tr("OpiePlayer: ")+ fullBaseName ( QFileInfo(filename))); } /* @@ -1118,9 +1125,9 @@ void PlayListWidget::readPls( const QString &filename ) { s = *it; // s.replace( QRegExp( "%20" )," " ); DocLnk lnk( s ); QFileInfo f( s ); - QString name = f.baseName(); + QString name = fullBaseName ( f); if( name.left( 4 ) == "http" ) { name = s.right( s.length() - 7); } else { |