author | llornkcor <llornkcor> | 2002-11-14 03:38:48 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-14 03:38:48 (UTC) |
commit | 8b1dd63f359c491bdcadb7e2ce39410a1d92a926 (patch) (unidiff) | |
tree | b260127fd6b123a57f42e76ce4c2ea4051cd83cd | |
parent | 5250e8571646f422a0830adcb137df8332ec0fe7 (diff) | |
download | opie-8b1dd63f359c491bdcadb7e2ce39410a1d92a926.zip opie-8b1dd63f359c491bdcadb7e2ce39410a1d92a926.tar.gz opie-8b1dd63f359c491bdcadb7e2ce39410a1d92a926.tar.bz2 |
fix multiselect addto playlist
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 16467c0..ccf654f 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -518,79 +518,91 @@ void PlayListWidget::loadList( const DocLnk & lnk) { | |||
518 | QString name = lnk.name(); | 518 | QString name = lnk.name(); |
519 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); | 519 | // qDebug("<<<<<<<<<<<<<<<<<<<<<<<<currentList is "+name); |
520 | 520 | ||
521 | if( name.length()>0) { | 521 | if( name.length()>0) { |
522 | setCaption("OpiePlayer: "+name); | 522 | setCaption("OpiePlayer: "+name); |
523 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); | 523 | // qDebug("<<<<<<<<<<<<load list "+ lnk.file()); |
524 | clearList(); | 524 | clearList(); |
525 | readm3u(lnk.file()); | 525 | readm3u(lnk.file()); |
526 | tabWidget->setCurrentPage(0); | 526 | tabWidget->setCurrentPage(0); |
527 | } | 527 | } |
528 | } | 528 | } |
529 | 529 | ||
530 | 530 | ||
531 | void PlayListWidget::setPlaylist( bool shown ) { | 531 | void PlayListWidget::setPlaylist( bool shown ) { |
532 | if ( shown ) { | 532 | if ( shown ) { |
533 | d->playListFrame->show(); | 533 | d->playListFrame->show(); |
534 | } else { | 534 | } else { |
535 | d->playListFrame->hide(); | 535 | d->playListFrame->hide(); |
536 | } | 536 | } |
537 | } | 537 | } |
538 | 538 | ||
539 | 539 | ||
540 | void PlayListWidget::addSelected() { | 540 | void PlayListWidget::addSelected() { |
541 | qDebug("addSelected"); | 541 | qDebug("addSelected"); |
542 | DocLnk lnk; | 542 | DocLnk lnk; |
543 | QString filename; | 543 | QString filename; |
544 | switch (whichList()) { | 544 | switch (whichList()) { |
545 | 545 | ||
546 | case 0: //playlist | 546 | case 0: //playlist |
547 | return; | 547 | return; |
548 | break; | 548 | break; |
549 | case 1: { //audio | 549 | case 1: { //audio |
550 | filename=audioView->currentItem()->text(3); | 550 | QListViewItemIterator it( audioView ); |
551 | // d->selectedFiles->next(); | 551 | for ( ; it.current(); ++it ) { |
552 | if ( it.current()->isSelected() ) { | ||
553 | filename=it.current()->text(3); | ||
554 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
555 | lnk.setFile( filename ); //sets file name | ||
556 | d->selectedFiles->addToSelection( lnk); | ||
557 | } | ||
558 | } | ||
552 | } | 559 | } |
553 | break; | 560 | break; |
554 | 561 | ||
555 | case 2: { // video | 562 | case 2: { // video |
556 | filename=videoView->currentItem()->text(3); | 563 | QListViewItemIterator it( videoView ); |
557 | // tabWidget->setCurrentPage(0); | 564 | for ( ; it.current(); ++it ) { |
565 | if ( it.current()->isSelected() ) { | ||
566 | // myFile = (*it); | ||
558 | 567 | ||
568 | filename=it.current()->text(3); | ||
569 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
570 | lnk.setFile( filename ); //sets file name | ||
571 | d->selectedFiles->addToSelection( lnk); | ||
572 | } | ||
573 | } | ||
559 | } | 574 | } |
560 | break; | 575 | break; |
561 | }; | 576 | }; |
562 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
563 | lnk.setFile( filename ); //sets file name | ||
564 | d->selectedFiles->addToSelection( lnk); | ||
565 | tabWidget->setCurrentPage(0); | 577 | tabWidget->setCurrentPage(0); |
566 | writeCurrentM3u(); | 578 | writeCurrentM3u(); |
567 | } | 579 | } |
568 | 580 | ||
569 | 581 | ||
570 | void PlayListWidget::removeSelected() { | 582 | void PlayListWidget::removeSelected() { |
571 | d->selectedFiles->removeSelected( ); | 583 | d->selectedFiles->removeSelected( ); |
572 | writeCurrentM3u(); | 584 | writeCurrentM3u(); |
573 | } | 585 | } |
574 | 586 | ||
575 | 587 | ||
576 | void PlayListWidget::playIt( QListViewItem *it) { | 588 | void PlayListWidget::playIt( QListViewItem *it) { |
577 | if(!it) return; | 589 | if(!it) return; |
578 | mediaPlayerState->setPlaying(FALSE); | 590 | mediaPlayerState->setPlaying(FALSE); |
579 | mediaPlayerState->setPlaying(TRUE); | 591 | mediaPlayerState->setPlaying(TRUE); |
580 | d->selectedFiles->unSelect(); | 592 | d->selectedFiles->unSelect(); |
581 | } | 593 | } |
582 | 594 | ||
583 | 595 | ||
584 | void PlayListWidget::addToSelection( QListViewItem *it) { | 596 | void PlayListWidget::addToSelection( QListViewItem *it) { |
585 | d->setDocumentUsed = FALSE; | 597 | d->setDocumentUsed = FALSE; |
586 | 598 | ||
587 | if(it) { | 599 | if(it) { |
588 | switch ( whichList()) { | 600 | switch ( whichList()) { |
589 | case 0: //playlist | 601 | case 0: //playlist |
590 | return; | 602 | return; |
591 | break; | 603 | break; |
592 | }; | 604 | }; |
593 | // case 1: { | 605 | // case 1: { |
594 | DocLnk lnk; | 606 | DocLnk lnk; |
595 | QString filename; | 607 | QString filename; |
596 | 608 | ||
@@ -967,65 +979,65 @@ void PlayListWidget::writem3u() { | |||
967 | fileDlg->exec(); | 979 | fileDlg->exec(); |
968 | QString name, filename, list; | 980 | QString name, filename, list; |
969 | Om3u *m3uList; | 981 | Om3u *m3uList; |
970 | 982 | ||
971 | if( fileDlg->result() == 1 ) { | 983 | if( fileDlg->result() == 1 ) { |
972 | name = fileDlg->text(); | 984 | name = fileDlg->text(); |
973 | // qDebug( filename ); | 985 | // qDebug( filename ); |
974 | 986 | ||
975 | if( name.left( 1) != "/" ) { | 987 | if( name.left( 1) != "/" ) { |
976 | filename = QPEApplication::documentDir() + "/" + name; | 988 | filename = QPEApplication::documentDir() + "/" + name; |
977 | } | 989 | } |
978 | 990 | ||
979 | if( name.right( 3 ) != "m3u" ) { | 991 | if( name.right( 3 ) != "m3u" ) { |
980 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; | 992 | filename = QPEApplication::documentDir() + "/" +name+".m3u"; |
981 | } | 993 | } |
982 | 994 | ||
983 | if( d->selectedFiles->first()) { | 995 | if( d->selectedFiles->first()) { |
984 | m3uList = new Om3u(filename, IO_ReadWrite); | 996 | m3uList = new Om3u(filename, IO_ReadWrite); |
985 | 997 | ||
986 | do { | 998 | do { |
987 | m3uList->add( d->selectedFiles->current()->file()); | 999 | m3uList->add( d->selectedFiles->current()->file()); |
988 | } | 1000 | } |
989 | while ( d->selectedFiles->next() ); | 1001 | while ( d->selectedFiles->next() ); |
990 | // qDebug( list ); | 1002 | // qDebug( list ); |
991 | m3uList->write(); | 1003 | m3uList->write(); |
992 | m3uList->close(); | 1004 | m3uList->close(); |
993 | if(m3uList) delete m3uList; | 1005 | if(m3uList) delete m3uList; |
994 | 1006 | ||
995 | if(fileDlg) delete fileDlg; | 1007 | if(fileDlg) delete fileDlg; |
996 | 1008 | ||
997 | DocLnk lnk; | 1009 | DocLnk lnk; |
998 | lnk.setFile( filename); | 1010 | lnk.setFile( filename); |
999 | // lnk.setIcon("opieplayer2/playlist2"); | 1011 | lnk.setIcon("opieplayer2/playlist2"); |
1000 | lnk.setName( name); //sets file name | 1012 | lnk.setName( name); //sets file name |
1001 | 1013 | ||
1002 | // qDebug(filename); | 1014 | // qDebug(filename); |
1003 | Config config( "OpiePlayer" ); | 1015 | Config config( "OpiePlayer" ); |
1004 | config.setGroup( "PlayList" ); | 1016 | config.setGroup( "PlayList" ); |
1005 | 1017 | ||
1006 | config.writeEntry("CurrentPlaylist",filename); | 1018 | config.writeEntry("CurrentPlaylist",filename); |
1007 | currentPlayList=filename; | 1019 | currentPlayList=filename; |
1008 | 1020 | ||
1009 | if(!lnk.writeLink()) { | 1021 | if(!lnk.writeLink()) { |
1010 | qDebug("Writing doclink did not work"); | 1022 | qDebug("Writing doclink did not work"); |
1011 | } | 1023 | } |
1012 | 1024 | ||
1013 | setCaption(tr("OpiePlayer: ") + name); | 1025 | setCaption(tr("OpiePlayer: ") + name); |
1014 | } | 1026 | } |
1015 | } | 1027 | } |
1016 | } | 1028 | } |
1017 | 1029 | ||
1018 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { | 1030 | void PlayListWidget::keyReleaseEvent( QKeyEvent *e ) { |
1019 | switch ( e->key() ) { | 1031 | switch ( e->key() ) { |
1020 | ////////////////////////////// Zaurus keys | 1032 | ////////////////////////////// Zaurus keys |
1021 | case Key_F9: //activity | 1033 | case Key_F9: //activity |
1022 | // if(audioUI->isHidden()) | 1034 | // if(audioUI->isHidden()) |
1023 | // audioUI->showMaximized(); | 1035 | // audioUI->showMaximized(); |
1024 | break; | 1036 | break; |
1025 | case Key_F10: //contacts | 1037 | case Key_F10: //contacts |
1026 | // if( videoUI->isHidden()) | 1038 | // if( videoUI->isHidden()) |
1027 | // videoUI->showMaximized(); | 1039 | // videoUI->showMaximized(); |
1028 | break; | 1040 | break; |
1029 | case Key_F11: //menu | 1041 | case Key_F11: //menu |
1030 | break; | 1042 | break; |
1031 | case Key_F12: //home | 1043 | case Key_F12: //home |