author | llornkcor <llornkcor> | 2002-09-21 02:34:35 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-09-21 02:34:35 (UTC) |
commit | 2f560ac908935bd4bc4a6b8852d27676100510bb (patch) (unidiff) | |
tree | 867ee58eb1846f68ec2adf0ec3e6a8d1cccd7ef0 | |
parent | 56d434ffe69337186941eba1b5b5dee16da537d7 (diff) | |
download | opie-2f560ac908935bd4bc4a6b8852d27676100510bb.zip opie-2f560ac908935bd4bc4a6b8852d27676100510bb.tar.gz opie-2f560ac908935bd4bc4a6b8852d27676100510bb.tar.bz2 |
playlist might have only one letter in name.. needs to be seen also
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 20adf17..4c4a921 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -396,98 +396,98 @@ bool PlayListWidget::first() { | |||
396 | else | 396 | else |
397 | return mediaPlayerState->looping(); | 397 | return mediaPlayerState->looping(); |
398 | } | 398 | } |
399 | 399 | ||
400 | 400 | ||
401 | bool PlayListWidget::last() { | 401 | bool PlayListWidget::last() { |
402 | if ( mediaPlayerState->playlist() ) | 402 | if ( mediaPlayerState->playlist() ) |
403 | return d->selectedFiles->last(); | 403 | return d->selectedFiles->last(); |
404 | else | 404 | else |
405 | return mediaPlayerState->looping(); | 405 | return mediaPlayerState->looping(); |
406 | } | 406 | } |
407 | 407 | ||
408 | 408 | ||
409 | void PlayListWidget::saveList() { | 409 | void PlayListWidget::saveList() { |
410 | 410 | ||
411 | QString filename; | 411 | QString filename; |
412 | InputDialog *fileDlg = 0l; | 412 | InputDialog *fileDlg = 0l; |
413 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); | 413 | fileDlg = new InputDialog(this,tr("Save Playlist"),TRUE, 0); |
414 | fileDlg->exec(); | 414 | fileDlg->exec(); |
415 | if( fileDlg->result() == 1 ) { | 415 | if( fileDlg->result() == 1 ) { |
416 | if ( d->current ) | 416 | if ( d->current ) |
417 | delete d->current; | 417 | delete d->current; |
418 | filename = fileDlg->text();//+".playlist"; | 418 | filename = fileDlg->text();//+".playlist"; |
419 | // qDebug("saving playlist "+filename+".playlist"); | 419 | // qDebug("saving playlist "+filename+".playlist"); |
420 | Config cfg( filename +".playlist"); | 420 | Config cfg( filename +".playlist"); |
421 | writeConfig( cfg ); | 421 | writeConfig( cfg ); |
422 | 422 | ||
423 | DocLnk lnk; | 423 | DocLnk lnk; |
424 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property | 424 | lnk.setFile(QDir::homeDirPath()+"/Settings/"+filename+".playlist.conf"); //sets File property |
425 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D | 425 | lnk.setType("playlist/plain");// hey is this a REGISTERED mime type?!?!? ;D |
426 | lnk.setIcon("opieplayer2/playlist2"); | 426 | lnk.setIcon("opieplayer2/playlist2"); |
427 | lnk.setName( filename); //sets file name | 427 | lnk.setName( filename); //sets file name |
428 | // qDebug(filename); | 428 | // qDebug(filename); |
429 | if(!lnk.writeLink()) { | 429 | if(!lnk.writeLink()) { |
430 | qDebug("Writing doclink did not work"); | 430 | qDebug("Writing doclink did not work"); |
431 | } | 431 | } |
432 | } | 432 | } |
433 | Config config( "OpiePlayer" ); | 433 | Config config( "OpiePlayer" ); |
434 | config.writeEntry("CurrentPlaylist",filename); | 434 | config.writeEntry("CurrentPlaylist",filename); |
435 | setCaption(tr("OpiePlayer: ")+filename); | 435 | setCaption(tr("OpiePlayer: ")+filename); |
436 | d->selectedFiles->first(); | 436 | d->selectedFiles->first(); |
437 | if(fileDlg) { | 437 | if(fileDlg) { |
438 | delete fileDlg; | 438 | delete fileDlg; |
439 | } | 439 | } |
440 | } | 440 | } |
441 | 441 | ||
442 | void PlayListWidget::loadList( const DocLnk & lnk) { | 442 | void PlayListWidget::loadList( const DocLnk & lnk) { |
443 | QString name= lnk.name(); | 443 | QString name= lnk.name(); |
444 | // qDebug("currentList is "+name); | 444 | // qDebug("currentList is "+name); |
445 | if( name.length()>1) { | 445 | if( name.length()>0) { |
446 | setCaption("OpiePlayer: "+name); | 446 | setCaption("OpiePlayer: "+name); |
447 | // qDebug("load list "+ name+".playlist"); | 447 | // qDebug("load list "+ name+".playlist"); |
448 | clearList(); | 448 | clearList(); |
449 | Config cfg( name+".playlist"); | 449 | Config cfg( name+".playlist"); |
450 | readConfig(cfg); | 450 | readConfig(cfg); |
451 | 451 | ||
452 | tabWidget->setCurrentPage(0); | 452 | tabWidget->setCurrentPage(0); |
453 | 453 | ||
454 | Config config( "OpiePlayer" ); | 454 | Config config( "OpiePlayer" ); |
455 | config.writeEntry("CurrentPlaylist", name); | 455 | config.writeEntry("CurrentPlaylist", name); |
456 | // d->selectedFiles->first(); | 456 | // d->selectedFiles->first(); |
457 | } | 457 | } |
458 | } | 458 | } |
459 | 459 | ||
460 | 460 | ||
461 | void PlayListWidget::setPlaylist( bool shown ) { | 461 | void PlayListWidget::setPlaylist( bool shown ) { |
462 | if ( shown ) { | 462 | if ( shown ) { |
463 | d->playListFrame->show(); | 463 | d->playListFrame->show(); |
464 | } else { | 464 | } else { |
465 | d->playListFrame->hide(); | 465 | d->playListFrame->hide(); |
466 | } | 466 | } |
467 | } | 467 | } |
468 | 468 | ||
469 | 469 | ||
470 | void PlayListWidget::addSelected() { | 470 | void PlayListWidget::addSelected() { |
471 | 471 | ||
472 | Config cfg( "OpiePlayer" ); | 472 | Config cfg( "OpiePlayer" ); |
473 | cfg.setGroup("PlayList"); | 473 | cfg.setGroup("PlayList"); |
474 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); | 474 | QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); |
475 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); | 475 | // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); |
476 | 476 | ||
477 | switch (whichList()) { | 477 | switch (whichList()) { |
478 | case 0: //playlist | 478 | case 0: //playlist |
479 | break; | 479 | break; |
480 | case 1: { //audio | 480 | case 1: { //audio |
481 | QListViewItemIterator it( audioView ); | 481 | QListViewItemIterator it( audioView ); |
482 | // iterate through all items of the listview | 482 | // iterate through all items of the listview |
483 | for ( ; it.current(); ++it ) { | 483 | for ( ; it.current(); ++it ) { |
484 | if ( it.current()->isSelected() ) { | 484 | if ( it.current()->isSelected() ) { |
485 | QListIterator<DocLnk> dit( files.children() ); | 485 | QListIterator<DocLnk> dit( files.children() ); |
486 | for ( ; dit.current(); ++dit ) { | 486 | for ( ; dit.current(); ++dit ) { |
487 | if( dit.current()->name() == it.current()->text(0) ) { | 487 | if( dit.current()->name() == it.current()->text(0) ) { |
488 | if(QFileInfo( dit.current()->file()).exists()) | 488 | if(QFileInfo( dit.current()->file()).exists()) |
489 | d->selectedFiles->addToSelection( **dit ); | 489 | d->selectedFiles->addToSelection( **dit ); |
490 | } | 490 | } |
491 | } | 491 | } |
492 | audioView->setSelected( it.current(),FALSE); | 492 | audioView->setSelected( it.current(),FALSE); |
493 | } | 493 | } |