summaryrefslogtreecommitdiff
path: root/core
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 /core
parentde714f7a5d6b50b4689a217bbed58180da8acc27 (diff)
downloadopie-b1880703eea8601e06cf3d3e8593b649cd1a485e.zip
opie-b1880703eea8601e06cf3d3e8593b649cd1a485e.tar.gz
opie-b1880703eea8601e06cf3d3e8593b649cd1a485e.tar.bz2
some stuff from op2
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp45
1 files changed, 29 insertions, 16 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
@@ -85,8 +85,8 @@ extern MediaPlayerState *mediaPlayerState;
static inline QString fullBaseName ( const QFileInfo &fi )
{
- QString str = fi. fileName ( );
- return str. left ( str. findRev ( '.' ));
+ QString str = fi. fileName ( );
+ return str. left ( str. findRev ( '.' ));
}
@@ -467,24 +467,36 @@ void PlayListWidget::addAllVideoToList() {
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
+ 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();
@@ -1191,15 +1203,16 @@ void PlayListWidget::writem3u() {
if( fileDlg->result() == 1 ) {
name = fileDlg->text();
// qDebug( filename );
-
- if( name.left( 1) != "/" ) {
- filename = QPEApplication::documentDir() + "/" + name;
- }
-
- if( name.right( 3 ) != "m3u" ) {
- filename = QPEApplication::documentDir() + "/" +name+".m3u";
+ 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( filename.right( 3 ) != "m3u" ) //needs filename extension
+ filename += ".m3u";
+
if( d->selectedFiles->first()) {
m3uList = new Om3u(filename, IO_ReadWrite);