author | bipolar <bipolar> | 2002-03-09 03:10:23 (UTC) |
---|---|---|
committer | bipolar <bipolar> | 2002-03-09 03:10:23 (UTC) |
commit | 3d03d0e3f679578080bbbf7d8b7f9eba1b9560db (patch) (unidiff) | |
tree | 8ff01a8fad92869e97ba7983d16bcf7de531d69f /core/multimedia/opieplayer/playlistwidget.cpp | |
parent | cb1d684a68565ff70fedd184eedf1ef4f2b71079 (diff) | |
download | opie-3d03d0e3f679578080bbbf7d8b7f9eba1b9560db.zip opie-3d03d0e3f679578080bbbf7d8b7f9eba1b9560db.tar.gz opie-3d03d0e3f679578080bbbf7d8b7f9eba1b9560db.tar.bz2 |
ljp:added playlist in caption, startup playlist, and saving currentplaylist to config file
something like that
Diffstat (limited to 'core/multimedia/opieplayer/playlistwidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 64 |
1 files changed, 44 insertions, 20 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index cb58888..9969526 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp | |||
@@ -20,3 +20,2 @@ | |||
20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 | 20 | // code added by L. J. Potter Sat 03-02-2002 06:17:54 |
21 | |||
22 | #include <qpe/qpemenubar.h> | 21 | #include <qpe/qpemenubar.h> |
@@ -258,2 +257,3 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
258 | tabWidget->insertTab(LTab,"Lists"); | 257 | tabWidget->insertTab(LTab,"Lists"); |
258 | |||
259 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); | 259 | connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), this, SLOT( loadList( const DocLnk & ) ) ); |
@@ -266,6 +266,6 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
266 | 266 | ||
267 | connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 267 | // connect( audioView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
268 | this, SLOT( fauxPlay( QListViewItem *) ) ); | 268 | // this, SLOT( fauxPlay( QListViewItem *) ) ); |
269 | connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), | 269 | // connect( videoView, SIGNAL( rightButtonClicked( QListViewItem *, const QPoint &, int)), |
270 | this, SLOT( fauxPlay( QListViewItem *)) ); | 270 | // this, SLOT( fauxPlay( QListViewItem *)) ); |
271 | 271 | ||
@@ -290,3 +290,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
290 | readConfig( cfg ); | 290 | readConfig( cfg ); |
291 | 291 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | |
292 | // qDebug("currentList is "+currentPlaylist); | ||
293 | loadList(DocLnk( currentPlaylist)); | ||
294 | setCaption("OpiePlayer: "+ currentPlaylist ); | ||
295 | |||
292 | initializeStates(); | 296 | initializeStates(); |
@@ -298,2 +302,3 @@ PlayListWidget::~PlayListWidget() { | |||
298 | writeConfig( cfg ); | 302 | writeConfig( cfg ); |
303 | |||
299 | 304 | ||
@@ -314,5 +319,4 @@ void PlayListWidget::initializeStates() { | |||
314 | // setPlaylist( mediaPlayerState->playlist() ); | 319 | // setPlaylist( mediaPlayerState->playlist() ); |
315 | setPlaylist( true); | 320 | setPlaylist( true); |
316 | d->selectedFiles->first(); | 321 | d->selectedFiles->first(); |
317 | |||
318 | } | 322 | } |
@@ -374,3 +378,3 @@ void PlayListWidget::writeConfig( Config& cfg ) const { | |||
374 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { | 378 | void PlayListWidget::addToSelection( const DocLnk& lnk ) { |
375 | qDebug("add"); | 379 | // qDebug("add"); |
376 | d->setDocumentUsed = FALSE; | 380 | d->setDocumentUsed = FALSE; |
@@ -421,2 +425,3 @@ void PlayListWidget::setDocument(const QString& fileref) { | |||
421 | } | 425 | } |
426 | // qDebug("setDocument"); | ||
422 | if(fileref.find("playlist",0,TRUE) == -1) { | 427 | if(fileref.find("playlist",0,TRUE) == -1) { |
@@ -535,9 +540,18 @@ void PlayListWidget::saveList() { | |||
535 | InputDialog *fileDlg; | 540 | InputDialog *fileDlg; |
536 | fileDlg=new InputDialog(this,"Save Playlist",TRUE, 0); | 541 | fileDlg = new InputDialog(this,"Save Playlist",TRUE, 0); |
537 | fileDlg->exec(); | 542 | fileDlg->exec(); |
538 | if( fileDlg->result() == 1 ) { | 543 | if( fileDlg->result() == 1 ) { |
544 | if ( d->current ) | ||
545 | delete d->current; | ||
539 | filename = fileDlg->LineEdit1->text();//+".playlist"; | 546 | filename = fileDlg->LineEdit1->text();//+".playlist"; |
540 | qDebug("saving playlist "+filename+".playlist"); | 547 | // qDebug("saving playlist "+filename+".playlist"); |
541 | Config cfg( filename +".playlist"); | 548 | Config cfg( filename +".playlist"); |
542 | writeConfig( cfg ); | 549 | writeConfig( cfg ); |
550 | if( playLists->selected()->name() == filename) { | ||
551 | // qDebug("same name so delete lnk"); | ||
552 | QFile().remove(playLists->selected()->file()); | ||
553 | QFile().remove(playLists->selected()->linkFile()); | ||
554 | playLists->reread(); | ||
555 | } | ||
556 | |||
543 | DocLnk lnk; | 557 | DocLnk lnk; |
@@ -550,4 +564,7 @@ void PlayListWidget::saveList() { | |||
550 | qDebug("Writing doclink did not work"); | 564 | qDebug("Writing doclink did not work"); |
551 | } | 565 | } |
552 | 566 | Config config( "MediaPlayer" ); | |
567 | config.writeEntry("CurrentPlaylist",filename); | ||
568 | setCaption("OpiePlayer: "+filename); | ||
569 | d->selectedFiles->first(); | ||
553 | if(fileDlg) | 570 | if(fileDlg) |
@@ -559,8 +576,15 @@ void PlayListWidget::saveList() { | |||
559 | void PlayListWidget::loadList( const DocLnk & lnk) { | 576 | void PlayListWidget::loadList( const DocLnk & lnk) { |
560 | qDebug("load list "+ lnk.name()+".playlist"); | 577 | QString name= lnk.name(); |
561 | clearList(); | 578 | // qDebug("currentList is "+name); |
562 | Config cfg( lnk.name()+".playlist"); | 579 | if( name.length()>1) { |
563 | readConfig(cfg); | 580 | setCaption("OpiePlayer: "+name); |
564 | tabWidget->setCurrentPage(0); | 581 | // qDebug("load list "+ name+".playlist"); |
565 | setCaption("OpiePlayer: "+lnk.name()); | 582 | clearList(); |
583 | Config cfg( name+".playlist"); | ||
584 | readConfig(cfg); | ||
585 | tabWidget->setCurrentPage(0); | ||
586 | Config config( "MediaPlayer" ); | ||
587 | config.writeEntry("CurrentPlaylist", name); | ||
588 | d->selectedFiles->first(); | ||
589 | } | ||
566 | } | 590 | } |