summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/inputDialog.cpp13
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp30
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
@@ -1,12 +1,14 @@
#include "inputDialog.h"
#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>
#include <qvariant.h>
#include <qpushbutton.h>
#include <qwhatsthis.h>
@@ -37,13 +39,14 @@ QString InputDialog::text() const {
* Destroys the object and frees any allocated resources
*/
InputDialog::~InputDialog() {
}
void InputDialog::browse() {
-
+ Config cfg( "OpiePlayer" );
+ cfg.setGroup("Dialog");
MimeTypes types;
QStringList audio, video, all;
audio << "audio/*";
audio << "playlist/plain";
audio << "audio/x-mpegurl";
@@ -53,10 +56,14 @@ void InputDialog::browse() {
all += audio;
all += video;
types.insert("All Media Files", all );
types.insert("Audio", audio );
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
@@ -154,15 +154,15 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
videoScan=FALSE;
audioScan=FALSE;
populateSkinsMenu();
initializeStates();
cfg.setGroup("PlayList");
- QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "" );
+ QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
loadList(DocLnk( currentPlaylist ) );
- setCaption( tr( "OpiePlayer: " ) + currentPlaylist );
+
}
PlayListWidget::~PlayListWidget() {
if ( d->current ) {
delete d->current;
@@ -737,23 +737,27 @@ void PlayListWidget::openFile() {
m3uFile=filename;
}
// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
lnk.setName( filename ); //sets name
lnk.setFile( filename ); //sets file name
- lnk.setIcon("opieplayer2/musicfile");
+
+// lnk.setIcon("opieplayer2/musicfile");
+
d->selectedFiles->addToSelection( lnk );
writeCurrentM3u();
}
else if( filename.right( 3) == "m3u" ) {
readm3u( filename );
} else if( filename.right(3) == "pls" ) {
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();
}
}
if( fileDlg ) {
delete fileDlg;
@@ -785,17 +789,19 @@ void PlayListWidget::readm3u( const QString &filename ) {
// if( QFileInfo( s ).exists() ) {
lnk.setName( QFileInfo(s).baseName());
// if(s.right(4) == '.') {//if regular file
if(s.left(1) != "/") {
// 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");
}
}
d->selectedFiles->addToSelection( lnk );
}
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );
@@ -839,15 +845,15 @@ void PlayListWidget::readPls( const QString &filename ) {
name = name.right( name.length() - name.findRev( "\\", -1, TRUE) - 1 );
lnk.setName( name );
if( s.at( s.length() - 4) == '.') {// if this is probably a file
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 );
}
lnk.setType( "audio/x-mpegurl" );
lnk.writeLink();
d->selectedFiles->addToSelection( lnk );
@@ -862,18 +868,18 @@ void PlayListWidget::readPls( const QString &filename ) {
void PlayListWidget::writeCurrentM3u() {
qDebug("writing to current m3u");
Config cfg( "OpiePlayer" );
cfg.setGroup("PlayList");
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() );
}
while ( d->selectedFiles->next() );
qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
m3uList->write();
m3uList->close();
@@ -916,13 +922,13 @@ void PlayListWidget::writem3u() {
if(m3uList) delete m3uList;
if(fileDlg) delete fileDlg;
DocLnk lnk;
lnk.setFile( filename);
- lnk.setIcon("opieplayer2/playlist2");
+// lnk.setIcon("opieplayer2/playlist2");
lnk.setName( name); //sets file name
// qDebug(filename);
Config config( "OpiePlayer" );
config.setGroup( "PlayList" );