summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index ce73252..b04fe8d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -533,168 +533,172 @@ void PlayListWidget::setPlaylist( bool shown ) {
533} 533}
534 534
535 535
536void PlayListWidget::addSelected() { 536void PlayListWidget::addSelected() {
537 assert( inFileListMode() ); 537 assert( inFileListMode() );
538 538
539 QListView *fileListView = currentFileListView(); 539 QListView *fileListView = currentFileListView();
540 QListViewItemIterator it( fileListView ); 540 QListViewItemIterator it( fileListView );
541 for ( ; it.current(); ++it ) 541 for ( ; it.current(); ++it )
542 if ( it.current()->isSelected() ) { 542 if ( it.current()->isSelected() ) {
543 QString filename = it.current()->text(3); 543 QString filename = it.current()->text(3);
544 544
545 DocLnk lnk; 545 DocLnk lnk;
546 lnk.setName( QFileInfo( filename ).baseName() ); //sets name 546 lnk.setName( QFileInfo( filename ).baseName() ); //sets name
547 lnk.setFile( filename ); //sets file name 547 lnk.setFile( filename ); //sets file name
548 548
549 d->selectedFiles->addToSelection( lnk ); 549 d->selectedFiles->addToSelection( lnk );
550 } 550 }
551 551
552 fileListView->clearSelection(); 552 fileListView->clearSelection();
553 553
554 tabWidget->setCurrentPage( 0 ); 554 tabWidget->setCurrentPage( 0 );
555 writeCurrentM3u(); 555 writeCurrentM3u();
556} 556}
557 557
558 558
559void PlayListWidget::removeSelected() { 559void PlayListWidget::removeSelected() {
560 d->selectedFiles->removeSelected( ); 560 d->selectedFiles->removeSelected( );
561 writeCurrentM3u(); 561 writeCurrentM3u();
562} 562}
563 563
564 564
565void PlayListWidget::playIt( QListViewItem *it) { 565void PlayListWidget::playIt( QListViewItem *it) {
566 if(!it) return; 566 if(!it) return;
567 mediaPlayerState->setPlaying(FALSE); 567 mediaPlayerState->setPlaying(FALSE);
568 mediaPlayerState->setPlaying(TRUE); 568 mediaPlayerState->setPlaying(TRUE);
569 d->selectedFiles->unSelect(); 569 d->selectedFiles->unSelect();
570} 570}
571 571
572 572
573void PlayListWidget::addToSelection( QListViewItem *it) { 573void PlayListWidget::addToSelection( QListViewItem *it) {
574 d->setDocumentUsed = FALSE; 574 d->setDocumentUsed = FALSE;
575 575
576 if(it) { 576 if(it) {
577 if ( currentTab() == CurrentPlayList ) 577 if ( currentTab() == CurrentPlayList )
578 return; 578 return;
579 // case 1: { 579 // case 1: {
580 DocLnk lnk; 580 DocLnk lnk;
581 QString filename; 581 QString filename;
582 582
583 filename=it->text(3); 583 filename=it->text(3);
584 lnk.setName( QFileInfo(filename).baseName() ); //sets name 584 lnk.setName( QFileInfo(filename).baseName() ); //sets name
585 lnk.setFile( filename ); //sets file name 585 lnk.setFile( filename ); //sets file name
586 d->selectedFiles->addToSelection( lnk); 586 d->selectedFiles->addToSelection( lnk);
587 587
588 writeCurrentM3u(); 588 writeCurrentM3u();
589 tabWidget->setCurrentPage(0); 589 tabWidget->setCurrentPage(0);
590 590
591 } 591 }
592} 592}
593 593
594 594
595void PlayListWidget::tabChanged(QWidget *) { 595void PlayListWidget::tabChanged(QWidget *) {
596 596
597 d->tbPlay->setEnabled( true );
598
597 switch ( currentTab() ) { 599 switch ( currentTab() ) {
598 case CurrentPlayList: 600 case CurrentPlayList:
599 { 601 {
600 if( !tbDeletePlaylist->isHidden() ) { 602 if( !tbDeletePlaylist->isHidden() ) {
601 tbDeletePlaylist->hide(); 603 tbDeletePlaylist->hide();
602 } 604 }
603 d->tbRemoveFromList->setEnabled(TRUE); 605 d->tbRemoveFromList->setEnabled(TRUE);
604 d->tbAddToList->setEnabled(FALSE); 606 d->tbAddToList->setEnabled(FALSE);
605 } 607 }
606 break; 608 break;
607 case AudioFiles: 609 case AudioFiles:
608 { 610 {
609 // audioView->clear(); 611 // audioView->clear();
610 if(!audioPopulated) populateAudioView(); 612 if(!audioPopulated) populateAudioView();
611 613
612 if( !tbDeletePlaylist->isHidden() ) { 614 if( !tbDeletePlaylist->isHidden() ) {
613 tbDeletePlaylist->hide(); 615 tbDeletePlaylist->hide();
614 } 616 }
615 d->tbRemoveFromList->setEnabled(FALSE); 617 d->tbRemoveFromList->setEnabled(FALSE);
616 d->tbAddToList->setEnabled(TRUE); 618 d->tbAddToList->setEnabled(TRUE);
617 } 619 }
618 break; 620 break;
619 case VideoFiles: 621 case VideoFiles:
620 { 622 {
621 // videoView->clear(); 623 // videoView->clear();
622 if(!videoPopulated) populateVideoView(); 624 if(!videoPopulated) populateVideoView();
623 if( !tbDeletePlaylist->isHidden() ) { 625 if( !tbDeletePlaylist->isHidden() ) {
624 tbDeletePlaylist->hide(); 626 tbDeletePlaylist->hide();
625 } 627 }
626 d->tbRemoveFromList->setEnabled(FALSE); 628 d->tbRemoveFromList->setEnabled(FALSE);
627 d->tbAddToList->setEnabled(TRUE); 629 d->tbAddToList->setEnabled(TRUE);
628 } 630 }
629 break; 631 break;
630 case PlayLists: 632 case PlayLists:
631 { 633 {
632 if( tbDeletePlaylist->isHidden() ) { 634 if( tbDeletePlaylist->isHidden() ) {
633 tbDeletePlaylist->show(); 635 tbDeletePlaylist->show();
634 } 636 }
635 playLists->reread(); 637 playLists->reread();
636 d->tbAddToList->setEnabled(FALSE); 638 d->tbAddToList->setEnabled(FALSE);
639
640 d->tbPlay->setEnabled( false );
637 } 641 }
638 break; 642 break;
639 }; 643 };
640} 644}
641 645
642 646
643void PlayListWidget::btnPlay(bool b) { 647void PlayListWidget::btnPlay(bool b) {
644// mediaPlayerState->setPlaying(false); 648// mediaPlayerState->setPlaying(false);
645 mediaPlayerState->setPlaying(b); 649 mediaPlayerState->setPlaying(b);
646 insanityBool=FALSE; 650 insanityBool=FALSE;
647} 651}
648 652
649void PlayListWidget::deletePlaylist() { 653void PlayListWidget::deletePlaylist() {
650 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 654 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
651 (tr("You really want to delete\nthis playlist?")), 655 (tr("You really want to delete\nthis playlist?")),
652 (tr("Yes")), (tr("No")), 0 )){ 656 (tr("Yes")), (tr("No")), 0 )){
653 case 0: // Yes clicked, 657 case 0: // Yes clicked,
654 QFile().remove(playLists->selectedDocument().file()); 658 QFile().remove(playLists->selectedDocument().file());
655 QFile().remove(playLists->selectedDocument().linkFile()); 659 QFile().remove(playLists->selectedDocument().linkFile());
656 playLists->reread(); 660 playLists->reread();
657 break; 661 break;
658 case 1: // Cancel 662 case 1: // Cancel
659 break; 663 break;
660 }; 664 };
661} 665}
662 666
663 667
664void PlayListWidget::playSelected() { 668void PlayListWidget::playSelected() {
665 btnPlay( TRUE); 669 btnPlay( TRUE);
666} 670}
667 671
668 672
669void PlayListWidget::scanForAudio() { 673void PlayListWidget::scanForAudio() {
670// qDebug("scan for audio"); 674// qDebug("scan for audio");
671 files.detachChildren(); 675 files.detachChildren();
672 QListIterator<DocLnk> sdit( files.children() ); 676 QListIterator<DocLnk> sdit( files.children() );
673 for ( ; sdit.current(); ++sdit ) { 677 for ( ; sdit.current(); ++sdit ) {
674 delete sdit.current(); 678 delete sdit.current();
675 } 679 }
676// Global::findDocuments( &files, "audio/*"); 680// Global::findDocuments( &files, "audio/*");
677 Global::findDocuments( &files, audioMimes); 681 Global::findDocuments( &files, audioMimes);
678 audioScan = true; 682 audioScan = true;
679 populateAudioView(); 683 populateAudioView();
680} 684}
681 685
682void PlayListWidget::scanForVideo() { 686void PlayListWidget::scanForVideo() {
683// qDebug("scan for video"); 687// qDebug("scan for video");
684 vFiles.detachChildren(); 688 vFiles.detachChildren();
685 QListIterator<DocLnk> sdit( vFiles.children() ); 689 QListIterator<DocLnk> sdit( vFiles.children() );
686 for ( ; sdit.current(); ++sdit ) { 690 for ( ; sdit.current(); ++sdit ) {
687 delete sdit.current(); 691 delete sdit.current();
688 } 692 }
689 Global::findDocuments(&vFiles, "video/*"); 693 Global::findDocuments(&vFiles, "video/*");
690 videoScan = true; 694 videoScan = true;
691 populateVideoView(); 695 populateVideoView();
692} 696}
693 697
694void PlayListWidget::populateAudioView() { 698void PlayListWidget::populateAudioView() {
695 audioView->clear(); 699 audioView->clear();
696 StorageInfo storageInfo; 700 StorageInfo storageInfo;
697 // const QList<FileSystem> &fs = storageInfo.fileSystems(); 701 // const QList<FileSystem> &fs = storageInfo.fileSystems();
698 if(!audioScan) { 702 if(!audioScan) {
699 scanForAudio(); 703 scanForAudio();
700 } 704 }