summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-12-16 03:52:02 (UTC)
committer llornkcor <llornkcor>2002-12-16 03:52:02 (UTC)
commitb1880703eea8601e06cf3d3e8593b649cd1a485e (patch) (side-by-side diff)
treea7c9d9c1bc2971d4a062cfb68b433bffa4c557d1
parentde714f7a5d6b50b4689a217bbed58180da8acc27 (diff)
downloadopie-b1880703eea8601e06cf3d3e8593b649cd1a485e.zip
opie-b1880703eea8601e06cf3d3e8593b649cd1a485e.tar.gz
opie-b1880703eea8601e06cf3d3e8593b649cd1a485e.tar.bz2
some stuff from op2
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp37
1 files changed, 25 insertions, 12 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp
index 8b25a4c..30e4daa 100644
--- a/core/multimedia/opieplayer/playlistwidget.cpp
+++ b/core/multimedia/opieplayer/playlistwidget.cpp
@@ -462,34 +462,46 @@ void PlayListWidget::addAllVideoToList() {
writeCurrentM3u();
d->selectedFiles->first();
}
void PlayListWidget::setDocument(const QString& fileref) {
qDebug(fileref);
fromSetDocument = TRUE;
- if ( fileref.isNull() ) {
- QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
+ QFileInfo fileInfo(fileref);
+ if ( !fileInfo.exists() ) {
+ QMessageBox::critical( 0, tr( "Invalid File" ),
+ tr( "There was a problem in getting the file." ) );
return;
}
// qDebug("setDocument "+fileref);
- if(fileref.find("m3u",0,TRUE) != -1) { //is m3u
+ QString extension = fileInfo.extension(false);
+ if( extension.find( "m3u", 0, false) != -1) { //is m3u
readm3u( fileref);
}
- else if(fileref.find("pls",0,TRUE) != -1) { //is pls
+ else if( extension.find( "pls", 0, false) != -1 ) { //is pls
readPls( fileref);
}
else if(fileref.find("playlist",0,TRUE) != -1) {//is playlist
clearList();
- loadList(DocLnk(fileref));
+ DocLnk lnk;
+ lnk.setName( fileInfo.baseName() ); //sets name
+ lnk.setFile( fileref ); //sets file name
+ //addToSelection( lnk );
+
+ loadList( lnk);
d->selectedFiles->first();
} else {
clearList();
- addToSelection( DocLnk( fileref ) );
+ DocLnk lnk;
+ lnk.setName( fileInfo.baseName() ); //sets name
+ lnk.setFile( fileref ); //sets file name
+ addToSelection( lnk );
+// addToSelection( DocLnk( fileref ) );
d->setDocumentUsed = TRUE;
mediaPlayerState->setPlaying( FALSE );
qApp->processEvents();
mediaPlayerState->setPlaying( TRUE );
qApp->processEvents();
setCaption(tr("OpiePlayer"));
}
}
@@ -1186,24 +1198,25 @@ void PlayListWidget::writem3u() {
fileDlg = new InputDialog( this, tr( "Save m3u Playlist " ), TRUE, 0);
fileDlg->exec();
QString name, filename, list;
Om3u *m3uList;
if( fileDlg->result() == 1 ) {
name = fileDlg->text();
// qDebug( filename );
-
- if( name.left( 1) != "/" ) {
- filename = QPEApplication::documentDir() + "/" + name;
+ if( name.find("/",0,true) != -1) {// assume they specify a file path
+ filename = name;
+ name = name.right(name.length()- name.findRev("/",-1,true) - 1 );
}
+ else //otherwise dump it somewhere noticable
+ filename = QPEApplication::documentDir() + "/" + name;
- if( name.right( 3 ) != "m3u" ) {
- filename = QPEApplication::documentDir() + "/" +name+".m3u";
- }
+ if( filename.right( 3 ) != "m3u" ) //needs filename extension
+ filename += ".m3u";
if( d->selectedFiles->first()) {
m3uList = new Om3u(filename, IO_ReadWrite);
do {
m3uList->add( d->selectedFiles->current()->file());
}
while ( d->selectedFiles->next() );