author | llornkcor <llornkcor> | 2002-11-10 16:52:56 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-10 16:52:56 (UTC) |
commit | 81e63be3c1e21da2a2f97df1fc38417e7ca814e1 (patch) (side-by-side diff) | |
tree | 66b526df2913150cc67d0d2d8e4283c791ae891f | |
parent | 5a8660a4089fa2160da47e2a4d63baea431b48b1 (diff) | |
download | opie-81e63be3c1e21da2a2f97df1fc38417e7ca814e1.zip opie-81e63be3c1e21da2a2f97df1fc38417e7ca814e1.tar.gz opie-81e63be3c1e21da2a2f97df1fc38417e7ca814e1.tar.bz2 |
fix file add slowdown, and make fileselector remember last directory
-rw-r--r-- | noncore/multimedia/opieplayer2/inputDialog.cpp | 13 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 30 |
2 files changed, 28 insertions, 15 deletions
diff --git a/noncore/multimedia/opieplayer2/inputDialog.cpp b/noncore/multimedia/opieplayer2/inputDialog.cpp index 62240b2..2c4be1b 100644 --- a/noncore/multimedia/opieplayer2/inputDialog.cpp +++ b/noncore/multimedia/opieplayer2/inputDialog.cpp @@ -2,7 +2,9 @@ #include <qpe/resource.h> - +#include <qpe/qpeapplication.h> +#include <qpe/config.h> #include <opie/ofiledialog.h> +#include <qfileinfo.h> #include <qlineedit.h> #include <qlayout.h> @@ -41,5 +43,6 @@ InputDialog::~InputDialog() { void InputDialog::browse() { - + Config cfg( "OpiePlayer" ); + cfg.setGroup("Dialog"); MimeTypes types; QStringList audio, video, all; @@ -57,6 +60,10 @@ void InputDialog::browse() { types.insert("Video", video ); - QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); + QString str = OFileDialog::getOpenFileName( 1, + cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"", + types, 0 ); + if(str.left(2) == "//") str=str.right(str.length()-1); LineEdit1->setText(str); + cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath()); } diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index b15f95e..0825eed 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -158,7 +158,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) cfg.setGroup("PlayList"); - QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" ); + QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); loadList(DocLnk( currentPlaylist ) ); - setCaption( tr( "OpiePlayer: " ) + currentPlaylist ); + } @@ -741,5 +741,7 @@ void PlayListWidget::openFile() { lnk.setName( filename ); //sets name lnk.setFile( filename ); //sets file name - lnk.setIcon("opieplayer2/musicfile"); + +// lnk.setIcon("opieplayer2/musicfile"); + d->selectedFiles->addToSelection( lnk ); writeCurrentM3u(); @@ -751,5 +753,7 @@ void PlayListWidget::openFile() { readPls( filename ); } else { - d->selectedFiles->addToSelection( DocLnk(filename) ); + lnk.setName( QFileInfo(filename).baseName() ); //sets name + lnk.setFile( filename ); //sets file name + d->selectedFiles->addToSelection( lnk); writeCurrentM3u(); } @@ -789,9 +793,11 @@ void PlayListWidget::readm3u( const QString &filename ) { // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); - lnk.setIcon("SoundPlayer"); +// lnk.setIcon(MimeType(s).pixmap() ); +// lnk.setIcon("SoundPlayer"); } else { // qDebug("set link2 "+s); lnk.setFile( s); - lnk.setIcon("SoundPlayer"); +// lnk.setIcon(MimeType(s).pixmap() ); +// lnk.setIcon("SoundPlayer"); } } @@ -843,7 +849,7 @@ void PlayListWidget::readPls( const QString &filename ) { lnk.setFile( s ); } else { //if its a url - if( name.right( 1 ).find( '/' ) == -1) { - s += "/"; - } +// if( name.right( 1 ).find( '/' ) == -1) { +// s += "/"; +// } lnk.setFile( s ); } @@ -866,10 +872,10 @@ void PlayListWidget::writeCurrentM3u() { QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); - if( d->selectedFiles->first()) { Om3u *m3uList; m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); + if( d->selectedFiles->first()) { do { - qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); + qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file()); m3uList->add( d->selectedFiles->current()->file() ); } @@ -920,5 +926,5 @@ void PlayListWidget::writem3u() { DocLnk lnk; lnk.setFile( filename); - lnk.setIcon("opieplayer2/playlist2"); +// lnk.setIcon("opieplayer2/playlist2"); lnk.setName( name); //sets file name |