author | simon <simon> | 2002-12-02 15:00:35 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-02 15:00:35 (UTC) |
commit | 77147a2001cf991e3581bcb2401143e20a3973d4 (patch) (unidiff) | |
tree | 2f42819217f97431082a54459d6a7cfe76ea5702 | |
parent | f90e42128a496a0fb5a67c3148c30ef46092624b (diff) | |
download | opie-77147a2001cf991e3581bcb2401143e20a3973d4.zip opie-77147a2001cf991e3581bcb2401143e20a3973d4.tar.gz opie-77147a2001cf991e3581bcb2401143e20a3973d4.tar.bz2 |
- simplified addSelected
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 58 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 2 |
2 files changed, 24 insertions, 36 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index 92da73b..c9ae225 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -529,55 +529,35 @@ void PlayListWidget::setPlaylist( bool shown ) { | |||
529 | d->playListFrame->show(); | 529 | d->playListFrame->show(); |
530 | } else { | 530 | } else { |
531 | d->playListFrame->hide(); | 531 | d->playListFrame->hide(); |
532 | } | 532 | } |
533 | } | 533 | } |
534 | 534 | ||
535 | 535 | ||
536 | void PlayListWidget::addSelected() { | 536 | void PlayListWidget::addSelected() { |
537 | qDebug("addSelected"); | 537 | assert( inFileListMode() ); |
538 | DocLnk lnk; | ||
539 | QString filename; | ||
540 | switch (whichList()) { | ||
541 | 538 | ||
542 | case 0: //playlist | 539 | QListView *fileListView = currentFileListView(); |
543 | return; | 540 | QListViewItemIterator it( fileListView ); |
544 | break; | 541 | for ( ; it.current(); ++it ) |
545 | case 1: { //audio | ||
546 | QListViewItemIterator it( audioView ); | ||
547 | for ( ; it.current(); ++it ) { | ||
548 | if ( it.current()->isSelected() ) { | 542 | if ( it.current()->isSelected() ) { |
549 | filename=it.current()->text(3); | 543 | QString filename = it.current()->text(3); |
550 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | 544 | |
551 | lnk.setFile( filename ); //sets file name | 545 | DocLnk lnk; |
552 | d->selectedFiles->addToSelection( lnk); | 546 | lnk.setName( QFileInfo( filename ).baseName() ); //sets name |
553 | 547 | lnk.setFile( filename ); //sets file name | |
554 | } | 548 | |
555 | } | 549 | d->selectedFiles->addToSelection( lnk ); |
556 | audioView->clearSelection(); | ||
557 | } | ||
558 | break; | ||
559 | |||
560 | case 2: { // video | ||
561 | QListViewItemIterator it( videoView ); | ||
562 | for ( ; it.current(); ++it ) { | ||
563 | if ( it.current()->isSelected() ) { | ||
564 | filename=it.current()->text(3); | ||
565 | lnk.setName( QFileInfo(filename).baseName() ); //sets name | ||
566 | lnk.setFile( filename ); //sets file name | ||
567 | d->selectedFiles->addToSelection( lnk); | ||
568 | } | 550 | } |
569 | } | 551 | |
570 | videoView->clearSelection(); | 552 | fileListView->clearSelection(); |
571 | } | 553 | |
572 | break; | 554 | tabWidget->setCurrentPage( 0 ); |
573 | }; | 555 | writeCurrentM3u(); |
574 | tabWidget->setCurrentPage(0); | ||
575 | writeCurrentM3u(); | ||
576 | } | 556 | } |
577 | 557 | ||
578 | 558 | ||
579 | void PlayListWidget::removeSelected() { | 559 | void PlayListWidget::removeSelected() { |
580 | d->selectedFiles->removeSelected( ); | 560 | d->selectedFiles->removeSelected( ); |
581 | writeCurrentM3u(); | 561 | writeCurrentM3u(); |
582 | } | 562 | } |
583 | 563 | ||
@@ -794,16 +774,22 @@ QListView *PlayListWidget::currentFileListView() const | |||
794 | switch ( currentTab() ) { | 774 | switch ( currentTab() ) { |
795 | case AudioFiles: return audioView; | 775 | case AudioFiles: return audioView; |
796 | case VideoFiles: return videoView; | 776 | case VideoFiles: return videoView; |
797 | default: assert( false ); | 777 | default: assert( false ); |
798 | } | 778 | } |
799 | return 0; | 779 | return 0; |
800 | } | 780 | } |
801 | 781 | ||
782 | bool PlayListWidget::inFileListMode() const | ||
783 | { | ||
784 | TabType tab = currentTab(); | ||
785 | return tab == AudioFiles || tab == VideoFiles; | ||
786 | } | ||
787 | |||
802 | void PlayListWidget::openFile() { | 788 | void PlayListWidget::openFile() { |
803 | // http://66.28.164.33:2080 | 789 | // http://66.28.164.33:2080 |
804 | // http://somafm.com/star0242.m3u | 790 | // http://somafm.com/star0242.m3u |
805 | QString filename, name; | 791 | QString filename, name; |
806 | InputDialog *fileDlg; | 792 | InputDialog *fileDlg; |
807 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 793 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
808 | fileDlg->exec(); | 794 | fileDlg->exec(); |
809 | if( fileDlg->result() == 1 ) { | 795 | if( fileDlg->result() == 1 ) { |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index a608eae..238a75c 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -87,16 +87,18 @@ private: | |||
87 | void readm3u(const QString &); | 87 | void readm3u(const QString &); |
88 | void readPls(const QString &); | 88 | void readPls(const QString &); |
89 | void initializeStates(); | 89 | void initializeStates(); |
90 | void populateAudioView(); | 90 | void populateAudioView(); |
91 | void populateVideoView(); | 91 | void populateVideoView(); |
92 | 92 | ||
93 | QListView *currentFileListView() const; | 93 | QListView *currentFileListView() const; |
94 | 94 | ||
95 | bool inFileListMode() const; | ||
96 | |||
95 | private slots: | 97 | private slots: |
96 | void populateSkinsMenu(); | 98 | void populateSkinsMenu(); |
97 | void skinsMenuActivated(int); | 99 | void skinsMenuActivated(int); |
98 | void pmViewActivated(int); | 100 | void pmViewActivated(int); |
99 | void writem3u(); | 101 | void writem3u(); |
100 | void writeCurrentM3u(); | 102 | void writeCurrentM3u(); |
101 | void scanForAudio(); | 103 | void scanForAudio(); |
102 | void scanForVideo(); | 104 | void scanForVideo(); |