summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer
authorbipolar <bipolar>2002-03-09 03:10:23 (UTC)
committer bipolar <bipolar>2002-03-09 03:10:23 (UTC)
commit3d03d0e3f679578080bbbf7d8b7f9eba1b9560db (patch) (unidiff)
tree8ff01a8fad92869e97ba7983d16bcf7de531d69f /core/multimedia/opieplayer
parentcb1d684a68565ff70fedd184eedf1ef4f2b71079 (diff)
downloadopie-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') (more/less context) (show whitespace changes)
-rw-r--r--core/multimedia/opieplayer/main.cpp2
-rw-r--r--core/multimedia/opieplayer/playlistwidget.cpp48
2 files changed, 37 insertions, 13 deletions
diff --git a/core/multimedia/opieplayer/main.cpp b/core/multimedia/opieplayer/main.cpp
index 4f43ff6..18cd7a6 100644
--- a/core/multimedia/opieplayer/main.cpp
+++ b/core/multimedia/opieplayer/main.cpp
@@ -47,7 +47,7 @@ int main(int argc, char **argv) {
47 loopControl = &lc; 47 loopControl = &lc;
48 MediaPlayer mp( 0, "mediaPlayer" ); 48 MediaPlayer mp( 0, "mediaPlayer" );
49 49
50 pl.setCaption( MediaPlayer::tr("OpiePlayer") ); 50// pl.setCaption( MediaPlayer::tr("OpiePlayer") );
51 a.showMainDocumentWidget(&pl); 51 a.showMainDocumentWidget(&pl);
52 52
53 return a.exec(); 53 return a.exec();
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
@@ -18,7 +18,6 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
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>
23#include <qpe/qpetoolbar.h> 22#include <qpe/qpetoolbar.h>
24#include <qpe/fileselector.h> 23#include <qpe/fileselector.h>
@@ -256,6 +255,7 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
256 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy 255 playLists = new FileSelector( "playlist/plain", LTab, "fileselector" , FALSE, FALSE); //buggy
257 playLists->setMinimumSize(233,260);; 256 playLists->setMinimumSize(233,260);;
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 & ) ) );
260// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) ); 260// connect( playLists, SIGNAL( newSelected( const DocLnk &) ), this, SLOT( newFile( const DocLnk & ) ) );
261 261
@@ -264,10 +264,10 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
264 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); 264 QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold );
265 265
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
272// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); 272// connect( audioView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
273// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) ); 273// connect( videoView, SIGNAL( clicked( QListViewItem *) ), this, SLOT( fauxPlay( QListViewItem *) ) );
@@ -288,6 +288,10 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
288 288
289 Config cfg( "MediaPlayer" ); 289 Config cfg( "MediaPlayer" );
290 readConfig( cfg ); 290 readConfig( cfg );
291 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
292// qDebug("currentList is "+currentPlaylist);
293 loadList(DocLnk( currentPlaylist));
294 setCaption("OpiePlayer: "+ currentPlaylist );
291 295
292 initializeStates(); 296 initializeStates();
293} 297}
@@ -297,6 +301,7 @@ PlayListWidget::~PlayListWidget() {
297 Config cfg( "MediaPlayer" ); 301 Config cfg( "MediaPlayer" );
298 writeConfig( cfg ); 302 writeConfig( cfg );
299 303
304
300 if ( d->current ) 305 if ( d->current )
301 delete d->current; 306 delete d->current;
302 delete d; 307 delete d;
@@ -314,7 +319,6 @@ 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}
319 323
320 324
@@ -372,7 +376,7 @@ void PlayListWidget::writeConfig( Config& cfg ) const {
372 376
373 377
374void PlayListWidget::addToSelection( const DocLnk& lnk ) { 378void PlayListWidget::addToSelection( const DocLnk& lnk ) {
375 qDebug("add"); 379// qDebug("add");
376 d->setDocumentUsed = FALSE; 380 d->setDocumentUsed = FALSE;
377 if ( mediaPlayerState->playlist() ) 381 if ( mediaPlayerState->playlist() )
378 d->selectedFiles->addToSelection( lnk ); 382 d->selectedFiles->addToSelection( lnk );
@@ -419,6 +423,7 @@ void PlayListWidget::setDocument(const QString& fileref) {
419 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) ); 423 QMessageBox::critical( 0, tr( "Invalid File" ), tr( "There was a problem in getting the file." ) );
420 return; 424 return;
421 } 425 }
426// qDebug("setDocument");
422 if(fileref.find("playlist",0,TRUE) == -1) { 427 if(fileref.find("playlist",0,TRUE) == -1) {
423 addToSelection( DocLnk( fileref ) ); 428 addToSelection( DocLnk( fileref ) );
424 d->setDocumentUsed = TRUE; 429 d->setDocumentUsed = TRUE;
@@ -536,10 +541,19 @@ void PlayListWidget::saveList() {
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;
544// lnk.setComment( ""); 558// lnk.setComment( "");
545 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property 559 lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property
@@ -549,7 +563,10 @@ void PlayListWidget::saveList() {
549 if(!lnk.writeLink()) 563 if(!lnk.writeLink())
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)
554 delete fileDlg; 571 delete fileDlg;
555 572
@@ -557,12 +574,19 @@ void PlayListWidget::saveList() {
557 574
558 575
559void PlayListWidget::loadList( const DocLnk & lnk) { 576void PlayListWidget::loadList( const DocLnk & lnk) {
560 qDebug("load list "+ lnk.name()+".playlist"); 577 QString name= lnk.name();
578// qDebug("currentList is "+name);
579 if( name.length()>1) {
580 setCaption("OpiePlayer: "+name);
581// qDebug("load list "+ name+".playlist");
561 clearList(); 582 clearList();
562 Config cfg( lnk.name()+".playlist"); 583 Config cfg( name+".playlist");
563 readConfig(cfg); 584 readConfig(cfg);
564 tabWidget->setCurrentPage(0); 585 tabWidget->setCurrentPage(0);
565 setCaption("OpiePlayer: "+lnk.name()); 586 Config config( "MediaPlayer" );
587 config.writeEntry("CurrentPlaylist", name);
588 d->selectedFiles->first();
589 }
566} 590}
567 591
568 592