summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-10 16:52:56 (UTC)
committer llornkcor <llornkcor>2002-11-10 16:52:56 (UTC)
commit81e63be3c1e21da2a2f97df1fc38417e7ca814e1 (patch) (unidiff)
tree66b526df2913150cc67d0d2d8e4283c791ae891f
parent5a8660a4089fa2160da47e2a4d63baea431b48b1 (diff)
downloadopie-81e63be3c1e21da2a2f97df1fc38417e7ca814e1.zip
opie-81e63be3c1e21da2a2f97df1fc38417e7ca814e1.tar.gz
opie-81e63be3c1e21da2a2f97df1fc38417e7ca814e1.tar.bz2
fix file add slowdown, and make fileselector remember last directory
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/inputDialog.cpp15
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp30
2 files changed, 29 insertions, 16 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
@@ -1,9 +1,11 @@
1#include "inputDialog.h" 1#include "inputDialog.h"
2 2
3#include <qpe/resource.h> 3#include <qpe/resource.h>
4 4#include <qpe/qpeapplication.h>
5#include <qpe/config.h>
5#include <opie/ofiledialog.h> 6#include <opie/ofiledialog.h>
6 7
8#include <qfileinfo.h>
7#include <qlineedit.h> 9#include <qlineedit.h>
8#include <qlayout.h> 10#include <qlayout.h>
9#include <qvariant.h> 11#include <qvariant.h>
@@ -40,8 +42,9 @@ InputDialog::~InputDialog() {
40} 42}
41 43
42void InputDialog::browse() { 44void InputDialog::browse() {
43 45 Config cfg( "OpiePlayer" );
44 MimeTypes types; 46 cfg.setGroup("Dialog");
47 MimeTypes types;
45 QStringList audio, video, all; 48 QStringList audio, video, all;
46 audio << "audio/*"; 49 audio << "audio/*";
47 audio << "playlist/plain"; 50 audio << "playlist/plain";
@@ -56,7 +59,11 @@ void InputDialog::browse() {
56 types.insert("Audio", audio ); 59 types.insert("Audio", audio );
57 types.insert("Video", video ); 60 types.insert("Video", video );
58 61
59 QString str = OFileDialog::getOpenFileName( 1,"/","", types, 0 ); 62 QString str = OFileDialog::getOpenFileName( 1,
63 cfg.readEntry("LastDirectory",QPEApplication::documentDir()),"",
64 types, 0 );
65 if(str.left(2) == "//") str=str.right(str.length()-1);
60 LineEdit1->setText(str); 66 LineEdit1->setText(str);
67 cfg.writeEntry("LastDirectory" ,QFileInfo(str).dirPath());
61} 68}
62 69
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
@@ -157,9 +157,9 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
157 initializeStates(); 157 initializeStates();
158 158
159 cfg.setGroup("PlayList"); 159 cfg.setGroup("PlayList");
160 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" ); 160 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
161 loadList(DocLnk( currentPlaylist ) ); 161 loadList(DocLnk( currentPlaylist ) );
162 setCaption( tr( "OpiePlayer: " ) + currentPlaylist ); 162
163} 163}
164 164
165 165
@@ -740,7 +740,9 @@ void PlayListWidget::openFile() {
740// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 740// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
741 lnk.setName( filename ); //sets name 741 lnk.setName( filename ); //sets name
742 lnk.setFile( filename ); //sets file name 742 lnk.setFile( filename ); //sets file name
743 lnk.setIcon("opieplayer2/musicfile"); 743
744// lnk.setIcon("opieplayer2/musicfile");
745
744 d->selectedFiles->addToSelection( lnk ); 746 d->selectedFiles->addToSelection( lnk );
745 writeCurrentM3u(); 747 writeCurrentM3u();
746 } 748 }
@@ -750,7 +752,9 @@ void PlayListWidget::openFile() {
750 } else if( filename.right(3) == "pls" ) { 752 } else if( filename.right(3) == "pls" ) {
751 readPls( filename ); 753 readPls( filename );
752 } else { 754 } else {
753 d->selectedFiles->addToSelection( DocLnk(filename) ); 755 lnk.setName( QFileInfo(filename).baseName() ); //sets name
756 lnk.setFile( filename ); //sets file name
757 d->selectedFiles->addToSelection( lnk);
754 writeCurrentM3u(); 758 writeCurrentM3u();
755 } 759 }
756 } 760 }
@@ -788,11 +792,13 @@ void PlayListWidget::readm3u( const QString &filename ) {
788 if(s.left(1) != "/") { 792 if(s.left(1) != "/") {
789 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); 793 // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s);
790 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); 794 lnk.setFile( QFileInfo(filename).dirPath()+"/"+s);
791 lnk.setIcon("SoundPlayer"); 795// lnk.setIcon(MimeType(s).pixmap() );
796// lnk.setIcon("SoundPlayer");
792 } else { 797 } else {
793 // qDebug("set link2 "+s); 798 // qDebug("set link2 "+s);
794 lnk.setFile( s); 799 lnk.setFile( s);
795 lnk.setIcon("SoundPlayer"); 800// lnk.setIcon(MimeType(s).pixmap() );
801// lnk.setIcon("SoundPlayer");
796 } 802 }
797 } 803 }
798 d->selectedFiles->addToSelection( lnk ); 804 d->selectedFiles->addToSelection( lnk );
@@ -842,9 +848,9 @@ void PlayListWidget::readPls( const QString &filename ) {
842 if( s.at( s.length() - 4) == '.') {// if this is probably a file 848 if( s.at( s.length() - 4) == '.') {// if this is probably a file
843 lnk.setFile( s ); 849 lnk.setFile( s );
844 } else { //if its a url 850 } else { //if its a url
845 if( name.right( 1 ).find( '/' ) == -1) { 851// if( name.right( 1 ).find( '/' ) == -1) {
846 s += "/"; 852// s += "/";
847 } 853// }
848 lnk.setFile( s ); 854 lnk.setFile( s );
849 } 855 }
850 lnk.setType( "audio/x-mpegurl" ); 856 lnk.setType( "audio/x-mpegurl" );
@@ -865,12 +871,12 @@ void PlayListWidget::writeCurrentM3u() {
865 cfg.setGroup("PlayList"); 871 cfg.setGroup("PlayList");
866 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default"); 872 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","default");
867 873
868 if( d->selectedFiles->first()) {
869 Om3u *m3uList; 874 Om3u *m3uList;
870 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate ); 875 m3uList = new Om3u( currentPlaylist, IO_ReadWrite | IO_Truncate );
876 if( d->selectedFiles->first()) {
871 877
872 do { 878 do {
873 qDebug( "writeCurrentM3u " +d->selectedFiles->current()->file()); 879 qDebug( "add writeCurrentM3u " +d->selectedFiles->current()->file());
874 m3uList->add( d->selectedFiles->current()->file() ); 880 m3uList->add( d->selectedFiles->current()->file() );
875 } 881 }
876 while ( d->selectedFiles->next() ); 882 while ( d->selectedFiles->next() );
@@ -919,7 +925,7 @@ void PlayListWidget::writem3u() {
919 925
920 DocLnk lnk; 926 DocLnk lnk;
921 lnk.setFile( filename); 927 lnk.setFile( filename);
922 lnk.setIcon("opieplayer2/playlist2"); 928// lnk.setIcon("opieplayer2/playlist2");
923 lnk.setName( name); //sets file name 929 lnk.setName( name); //sets file name
924 930
925 // qDebug(filename); 931 // qDebug(filename);