author | llornkcor <llornkcor> | 2002-11-10 15:26:11 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-10 15:26:11 (UTC) |
commit | 804e08f4642353af836bab921d8f732709051de0 (patch) (unidiff) | |
tree | 8e3ee2f1e519ef018a51cc32436ca24ff9d47da9 | |
parent | 1486b6f940adde3cd80592e436e8e025045d7f8e (diff) | |
download | opie-804e08f4642353af836bab921d8f732709051de0.zip opie-804e08f4642353af836bab921d8f732709051de0.tar.gz opie-804e08f4642353af836bab921d8f732709051de0.tar.bz2 |
no extras here either
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 75c7332..b15f95e 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -436,84 +436,86 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
436 | void PlayListWidget::setPlaylist( bool shown ) { | 436 | void PlayListWidget::setPlaylist( bool shown ) { |
437 | if ( shown ) { | 437 | if ( shown ) { |
438 | d->playListFrame->show(); | 438 | d->playListFrame->show(); |
439 | } else { | 439 | } else { |
440 | d->playListFrame->hide(); | 440 | d->playListFrame->hide(); |
441 | } | 441 | } |
442 | } | 442 | } |
443 | 443 | ||
444 | 444 | ||
445 | void PlayListWidget::addSelected() { | 445 | void PlayListWidget::addSelected() { |
446 | qDebug("addSelected"); | 446 | qDebug("addSelected"); |
447 | switch (whichList()) { | 447 | switch (whichList()) { |
448 | case 0: //playlist | 448 | case 0: //playlist |
449 | break; | 449 | break; |
450 | case 1: { //audio | 450 | case 1: { //audio |
451 | QListViewItemIterator it( audioView ); | 451 | QListViewItemIterator it( audioView ); |
452 | // iterate through all items of the listview | 452 | // iterate through all items of the listview |
453 | for ( ; it.current(); ++it ) { | 453 | for ( ; it.current(); ++it ) { |
454 | if ( it.current()->isSelected() ) { | 454 | if ( it.current()->isSelected() ) { |
455 | QListIterator<DocLnk> dit( files.children() ); | 455 | QListIterator<DocLnk> dit( files.children() ); |
456 | for ( ; dit.current(); ++dit ) { | 456 | for ( ; dit.current(); ++dit ) { |
457 | if( dit.current()->name() == it.current()->text(0) ) { | 457 | if( dit.current()->name() == it.current()->text(0) ) { |
458 | if( QFileInfo( dit.current()->file()).exists()) { | 458 | if( QFileInfo( dit.current()->file()).exists()) { |
459 | d->selectedFiles->addToSelection( **dit ); | 459 | d->selectedFiles->addToSelection( **dit ); |
460 | audioView->setSelected( it.current(),FALSE); | 460 | audioView->setSelected( it.current(),FALSE); |
461 | } | 461 | } |
462 | } | 462 | } |
463 | } | 463 | } |
464 | } | 464 | } |
465 | } | 465 | } |
466 | // tabWidget->setCurrentPage(0); | 466 | // tabWidget->setCurrentPage(0); |
467 | writeCurrentM3u(); | 467 | writeCurrentM3u(); |
468 | d->selectedFiles->next(); | ||
468 | } | 469 | } |
469 | break; | 470 | break; |
470 | case 2: { // video | 471 | case 2: { // video |
471 | QListViewItemIterator it( videoView ); | 472 | QListViewItemIterator it( videoView ); |
472 | // iterate through all items of the listview | 473 | // iterate through all items of the listview |
473 | for ( ; it.current(); ++it ) { | 474 | for ( ; it.current(); ++it ) { |
474 | if ( it.current()->isSelected() ) { | 475 | if ( it.current()->isSelected() ) { |
475 | QListIterator<DocLnk> dit( vFiles.children() ); | 476 | QListIterator<DocLnk> dit( vFiles.children() ); |
476 | for ( ; dit.current(); ++dit ) { | 477 | for ( ; dit.current(); ++dit ) { |
477 | if( dit.current()->name() == it.current()->text(0) ) { | 478 | if( dit.current()->name() == it.current()->text(0) ) { |
478 | if(QFileInfo( dit.current()->file()).exists()) { | 479 | if(QFileInfo( dit.current()->file()).exists()) { |
479 | d->selectedFiles->addToSelection( **dit ); | 480 | d->selectedFiles->addToSelection( **dit ); |
480 | videoView->setSelected( it.current(),FALSE); | 481 | videoView->setSelected( it.current(),FALSE); |
481 | } | 482 | } |
482 | } | 483 | } |
483 | } | 484 | } |
484 | } | 485 | } |
485 | } | 486 | } |
486 | // tabWidget->setCurrentPage(0); | 487 | // tabWidget->setCurrentPage(0); |
487 | writeCurrentM3u(); | 488 | writeCurrentM3u(); |
489 | |||
488 | } | 490 | } |
489 | break; | 491 | break; |
490 | }; | 492 | }; |
491 | } | 493 | } |
492 | 494 | ||
493 | 495 | ||
494 | void PlayListWidget::removeSelected() { | 496 | void PlayListWidget::removeSelected() { |
495 | d->selectedFiles->removeSelected( ); | 497 | d->selectedFiles->removeSelected( ); |
496 | writeCurrentM3u(); | 498 | writeCurrentM3u(); |
497 | } | 499 | } |
498 | 500 | ||
499 | 501 | ||
500 | void PlayListWidget::playIt( QListViewItem *it) { | 502 | void PlayListWidget::playIt( QListViewItem *it) { |
501 | if(!it) return; | 503 | if(!it) return; |
502 | mediaPlayerState->setPlaying(FALSE); | 504 | mediaPlayerState->setPlaying(FALSE); |
503 | mediaPlayerState->setPlaying(TRUE); | 505 | mediaPlayerState->setPlaying(TRUE); |
504 | d->selectedFiles->unSelect(); | 506 | d->selectedFiles->unSelect(); |
505 | } | 507 | } |
506 | 508 | ||
507 | 509 | ||
508 | void PlayListWidget::addToSelection( QListViewItem *it) { | 510 | void PlayListWidget::addToSelection( QListViewItem *it) { |
509 | d->setDocumentUsed = FALSE; | 511 | d->setDocumentUsed = FALSE; |
510 | 512 | ||
511 | if(it) { | 513 | if(it) { |
512 | switch ( whichList()) { | 514 | switch ( whichList()) { |
513 | case 1: { | 515 | case 1: { |
514 | QListIterator<DocLnk> dit( files.children() ); | 516 | QListIterator<DocLnk> dit( files.children() ); |
515 | for ( ; dit.current(); ++dit ) { | 517 | for ( ; dit.current(); ++dit ) { |
516 | if( dit.current()->name() == it->text(0)) { | 518 | if( dit.current()->name() == it->text(0)) { |
517 | if(QFileInfo( dit.current()->file()).exists()) | 519 | if(QFileInfo( dit.current()->file()).exists()) |
518 | d->selectedFiles->addToSelection( **dit ); | 520 | d->selectedFiles->addToSelection( **dit ); |
519 | } | 521 | } |
@@ -745,67 +747,67 @@ void PlayListWidget::openFile() { | |||
745 | else if( filename.right( 3) == "m3u" ) { | 747 | else if( filename.right( 3) == "m3u" ) { |
746 | readm3u( filename ); | 748 | readm3u( filename ); |
747 | 749 | ||
748 | } else if( filename.right(3) == "pls" ) { | 750 | } else if( filename.right(3) == "pls" ) { |
749 | readPls( filename ); | 751 | readPls( filename ); |
750 | } else { | 752 | } else { |
751 | d->selectedFiles->addToSelection( DocLnk(filename) ); | 753 | d->selectedFiles->addToSelection( DocLnk(filename) ); |
752 | writeCurrentM3u(); | 754 | writeCurrentM3u(); |
753 | } | 755 | } |
754 | } | 756 | } |
755 | 757 | ||
756 | if( fileDlg ) { | 758 | if( fileDlg ) { |
757 | delete fileDlg; | 759 | delete fileDlg; |
758 | } | 760 | } |
759 | } | 761 | } |
760 | 762 | ||
761 | /* | 763 | /* |
762 | reads m3u and shows files/urls to playlist widget */ | 764 | reads m3u and shows files/urls to playlist widget */ |
763 | void PlayListWidget::readm3u( const QString &filename ) { | 765 | void PlayListWidget::readm3u( const QString &filename ) { |
764 | qDebug( "read m3u filename " + filename ); | 766 | qDebug( "read m3u filename " + filename ); |
765 | 767 | ||
766 | Om3u *m3uList; | 768 | Om3u *m3uList; |
767 | QString s, name; | 769 | QString s, name; |
768 | m3uList = new Om3u( filename, IO_ReadOnly ); | 770 | m3uList = new Om3u( filename, IO_ReadOnly ); |
769 | m3uList->readM3u(); | 771 | m3uList->readM3u(); |
770 | DocLnk lnk; | 772 | DocLnk lnk; |
771 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { | 773 | for ( QStringList::ConstIterator it = m3uList->begin(); it != m3uList->end(); ++it ) { |
772 | s = *it; | 774 | s = *it; |
773 | // qDebug("reading "+ s); | 775 | // qDebug("reading "+ s); |
774 | if(s.left(4)=="http") { | 776 | if(s.left(4)=="http") { |
775 | lnk.setName( s ); //sets file name | 777 | lnk.setName( s ); //sets file name |
776 | lnk.setIcon("opieplayer2/musicfile"); | 778 | lnk.setIcon("opieplayer2/musicfile"); |
777 | if(s.right(4) != '.' || s.right(5) != '.') | 779 | // if(s.right(4) != '.' || s.right(5) != '.') |
778 | lnk.setFile( s+"/"); //if url with no extension | 780 | // lnk.setFile( s+"/"); //if url with no extension |
779 | else | 781 | // else |
780 | lnk.setFile( s ); //sets file name | 782 | lnk.setFile( s ); //sets file name |
781 | 783 | ||
782 | } else { | 784 | } else { |
783 | // if( QFileInfo( s ).exists() ) { | 785 | // if( QFileInfo( s ).exists() ) { |
784 | lnk.setName( QFileInfo(s).baseName()); | 786 | lnk.setName( QFileInfo(s).baseName()); |
785 | // if(s.right(4) == '.') {//if regular file | 787 | // if(s.right(4) == '.') {//if regular file |
786 | if(s.left(1) != "/") { | 788 | if(s.left(1) != "/") { |
787 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); | 789 | // qDebug("set link "+QFileInfo(filename).dirPath()+"/"+s); |
788 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); | 790 | lnk.setFile( QFileInfo(filename).dirPath()+"/"+s); |
789 | lnk.setIcon("SoundPlayer"); | 791 | lnk.setIcon("SoundPlayer"); |
790 | } else { | 792 | } else { |
791 | // qDebug("set link2 "+s); | 793 | // qDebug("set link2 "+s); |
792 | lnk.setFile( s); | 794 | lnk.setFile( s); |
793 | lnk.setIcon("SoundPlayer"); | 795 | lnk.setIcon("SoundPlayer"); |
794 | } | 796 | } |
795 | } | 797 | } |
796 | d->selectedFiles->addToSelection( lnk ); | 798 | d->selectedFiles->addToSelection( lnk ); |
797 | } | 799 | } |
798 | Config config( "OpiePlayer" ); | 800 | Config config( "OpiePlayer" ); |
799 | config.setGroup( "PlayList" ); | 801 | config.setGroup( "PlayList" ); |
800 | 802 | ||
801 | config.writeEntry("CurrentPlaylist",filename); | 803 | config.writeEntry("CurrentPlaylist",filename); |
802 | config.write(); | 804 | config.write(); |
803 | currentPlayList=filename; | 805 | currentPlayList=filename; |
804 | 806 | ||
805 | // m3uList->write(); | 807 | // m3uList->write(); |
806 | m3uList->close(); | 808 | m3uList->close(); |
807 | if(m3uList) delete m3uList; | 809 | if(m3uList) delete m3uList; |
808 | 810 | ||
809 | d->selectedFiles->setSelectedItem( s); | 811 | d->selectedFiles->setSelectedItem( s); |
810 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); | 812 | setCaption(tr("OpiePlayer: ")+ QFileInfo(filename).baseName()); |
811 | 813 | ||