author | llornkcor <llornkcor> | 2002-11-14 02:56:04 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-11-14 02:56:04 (UTC) |
commit | 4a60497bd689bd01ca301378f382bff6863b592e (patch) (unidiff) | |
tree | 3b9926eb8f6f89b204eaca2a443b6bb9b5e9f883 | |
parent | 3bfb64a41ca7948b593982fc1c266d5ec829b9ab (diff) | |
download | opie-4a60497bd689bd01ca301378f382bff6863b592e.zip opie-4a60497bd689bd01ca301378f382bff6863b592e.tar.gz opie-4a60497bd689bd01ca301378f382bff6863b592e.tar.bz2 |
no longer scans and populates audio_video lists everytime tab is changed. rescan from File menu does it except for the first tab change
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 18 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 2 |
2 files changed, 13 insertions, 7 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index c2b5c77..6bedb57 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp | |||
@@ -143,32 +143,34 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) | |||
143 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), | 143 | connect( mediaPlayerState, SIGNAL( playingToggled( bool ) ), |
144 | d->tbPlay, SLOT( setOn( bool ) ) ); | 144 | d->tbPlay, SLOT( setOn( bool ) ) ); |
145 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), | 145 | connect( mediaPlayerState, SIGNAL( loopingToggled( bool ) ), |
146 | d->tbLoop, SLOT( setOn( bool ) ) ); | 146 | d->tbLoop, SLOT( setOn( bool ) ) ); |
147 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), | 147 | connect( mediaPlayerState, SIGNAL( shuffledToggled( bool ) ), |
148 | d->tbShuffle, SLOT( setOn( bool ) ) ); | 148 | d->tbShuffle, SLOT( setOn( bool ) ) ); |
149 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), | 149 | connect( mediaPlayerState, SIGNAL( playlistToggled( bool ) ), |
150 | this, SLOT( setPlaylist( bool ) ) ); | 150 | this, SLOT( setPlaylist( bool ) ) ); |
151 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), | 151 | connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), |
152 | this, SLOT( playIt( QListViewItem *) ) ); | 152 | this, SLOT( playIt( QListViewItem *) ) ); |
153 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), | 153 | connect ( gammaSlider, SIGNAL( valueChanged( int ) ), |
154 | mediaPlayerState, SLOT( setVideoGamma( int ) ) ); | 154 | mediaPlayerState, SLOT( setVideoGamma( int ) ) ); |
155 | 155 | ||
156 | // see which skins are installed | 156 | // see which skins are installed |
157 | videoScan=false; | 157 | videoScan=false; |
158 | audioScan=false; | 158 | audioScan=false; |
159 | audioPopulated=false; | ||
160 | videoPopulated=false; | ||
159 | populateSkinsMenu(); | 161 | populateSkinsMenu(); |
160 | initializeStates(); | 162 | initializeStates(); |
161 | 163 | ||
162 | cfg.setGroup("PlayList"); | 164 | cfg.setGroup("PlayList"); |
163 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); | 165 | QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); |
164 | loadList(DocLnk( currentPlaylist ) ); | 166 | loadList(DocLnk( currentPlaylist ) ); |
165 | } | 167 | } |
166 | 168 | ||
167 | 169 | ||
168 | PlayListWidget::~PlayListWidget() { | 170 | PlayListWidget::~PlayListWidget() { |
169 | if ( d->current ) { | 171 | if ( d->current ) { |
170 | delete d->current; | 172 | delete d->current; |
171 | } | 173 | } |
172 | delete d; | 174 | delete d; |
173 | } | 175 | } |
174 | 176 | ||
@@ -605,46 +607,46 @@ void PlayListWidget::addToSelection( QListViewItem *it) { | |||
605 | 607 | ||
606 | 608 | ||
607 | void PlayListWidget::tabChanged(QWidget *) { | 609 | void PlayListWidget::tabChanged(QWidget *) { |
608 | 610 | ||
609 | switch ( whichList()) { | 611 | switch ( whichList()) { |
610 | case 0: | 612 | case 0: |
611 | { | 613 | { |
612 | if( !tbDeletePlaylist->isHidden() ) { | 614 | if( !tbDeletePlaylist->isHidden() ) { |
613 | tbDeletePlaylist->hide(); | 615 | tbDeletePlaylist->hide(); |
614 | } | 616 | } |
615 | d->tbRemoveFromList->setEnabled(TRUE); | 617 | d->tbRemoveFromList->setEnabled(TRUE); |
616 | d->tbAddToList->setEnabled(FALSE); | 618 | d->tbAddToList->setEnabled(FALSE); |
617 | } | 619 | } |
618 | break; | 620 | break; |
619 | case 1: | 621 | case 1: |
620 | { | 622 | { |
621 | audioView->clear(); | 623 | // audioView->clear(); |
622 | populateAudioView(); | 624 | if(!audioPopulated) populateAudioView(); |
623 | 625 | ||
624 | if( !tbDeletePlaylist->isHidden() ) { | 626 | if( !tbDeletePlaylist->isHidden() ) { |
625 | tbDeletePlaylist->hide(); | 627 | tbDeletePlaylist->hide(); |
626 | } | 628 | } |
627 | d->tbRemoveFromList->setEnabled(FALSE); | 629 | d->tbRemoveFromList->setEnabled(FALSE); |
628 | d->tbAddToList->setEnabled(TRUE); | 630 | d->tbAddToList->setEnabled(TRUE); |
629 | } | 631 | } |
630 | break; | 632 | break; |
631 | case 2: | 633 | case 2: |
632 | { | 634 | { |
633 | videoView->clear(); | 635 | // videoView->clear(); |
634 | populateVideoView(); | 636 | if(!videoPopulated) populateVideoView(); |
635 | if( !tbDeletePlaylist->isHidden() ) { | 637 | if( !tbDeletePlaylist->isHidden() ) { |
636 | tbDeletePlaylist->hide(); | 638 | tbDeletePlaylist->hide(); |
637 | } | 639 | } |
638 | d->tbRemoveFromList->setEnabled(FALSE); | 640 | d->tbRemoveFromList->setEnabled(FALSE); |
639 | d->tbAddToList->setEnabled(TRUE); | 641 | d->tbAddToList->setEnabled(TRUE); |
640 | } | 642 | } |
641 | break; | 643 | break; |
642 | case 3: | 644 | case 3: |
643 | { | 645 | { |
644 | if( tbDeletePlaylist->isHidden() ) { | 646 | if( tbDeletePlaylist->isHidden() ) { |
645 | tbDeletePlaylist->show(); | 647 | tbDeletePlaylist->show(); |
646 | } | 648 | } |
647 | playLists->reread(); | 649 | playLists->reread(); |
648 | } | 650 | } |
649 | break; | 651 | break; |
650 | }; | 652 | }; |
@@ -673,44 +675,46 @@ void PlayListWidget::deletePlaylist() { | |||
673 | 675 | ||
674 | 676 | ||
675 | void PlayListWidget::playSelected() { | 677 | void PlayListWidget::playSelected() { |
676 | btnPlay( TRUE); | 678 | btnPlay( TRUE); |
677 | } | 679 | } |
678 | 680 | ||
679 | 681 | ||
680 | void PlayListWidget::scanForAudio() { | 682 | void PlayListWidget::scanForAudio() { |
681 | // qDebug("scan for audio"); | 683 | // qDebug("scan for audio"); |
682 | files.detachChildren(); | 684 | files.detachChildren(); |
683 | QListIterator<DocLnk> sdit( files.children() ); | 685 | QListIterator<DocLnk> sdit( files.children() ); |
684 | for ( ; sdit.current(); ++sdit ) { | 686 | for ( ; sdit.current(); ++sdit ) { |
685 | delete sdit.current(); | 687 | delete sdit.current(); |
686 | } | 688 | } |
687 | // Global::findDocuments( &files, "audio/*"); | 689 | // Global::findDocuments( &files, "audio/*"); |
688 | Global::findDocuments( &files, audioMimes); | 690 | Global::findDocuments( &files, audioMimes); |
689 | audioScan = TRUE; | 691 | audioScan = true; |
692 | populateAudioView(); | ||
690 | } | 693 | } |
691 | 694 | ||
692 | void PlayListWidget::scanForVideo() { | 695 | void PlayListWidget::scanForVideo() { |
693 | // qDebug("scan for video"); | 696 | // qDebug("scan for video"); |
694 | vFiles.detachChildren(); | 697 | vFiles.detachChildren(); |
695 | QListIterator<DocLnk> sdit( vFiles.children() ); | 698 | QListIterator<DocLnk> sdit( vFiles.children() ); |
696 | for ( ; sdit.current(); ++sdit ) { | 699 | for ( ; sdit.current(); ++sdit ) { |
697 | delete sdit.current(); | 700 | delete sdit.current(); |
698 | } | 701 | } |
699 | Global::findDocuments(&vFiles, "video/*"); | 702 | Global::findDocuments(&vFiles, "video/*"); |
700 | videoScan = TRUE; | 703 | videoScan = true; |
704 | populateVideoView(); | ||
701 | } | 705 | } |
702 | 706 | ||
703 | void PlayListWidget::populateAudioView() { | 707 | void PlayListWidget::populateAudioView() { |
704 | audioView->clear(); | 708 | audioView->clear(); |
705 | StorageInfo storageInfo; | 709 | StorageInfo storageInfo; |
706 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 710 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
707 | if(!audioScan) { | 711 | if(!audioScan) { |
708 | scanForAudio(); | 712 | scanForAudio(); |
709 | } | 713 | } |
710 | 714 | ||
711 | QListIterator<DocLnk> dit( files.children() ); | 715 | QListIterator<DocLnk> dit( files.children() ); |
712 | QListIterator<FileSystem> it ( fs ); | 716 | QListIterator<FileSystem> it ( fs ); |
713 | 717 | ||
714 | QString storage; | 718 | QString storage; |
715 | for ( ; dit.current(); ++dit ) { | 719 | for ( ; dit.current(); ++dit ) { |
716 | for( ; it.current(); ++it ){ | 720 | for( ; it.current(); ++it ){ |
@@ -721,32 +725,33 @@ void PlayListWidget::populateAudioView() { | |||
721 | } | 725 | } |
722 | } | 726 | } |
723 | 727 | ||
724 | QListViewItem * newItem; | 728 | QListViewItem * newItem; |
725 | if ( QFile( dit.current()->file()).exists() || | 729 | if ( QFile( dit.current()->file()).exists() || |
726 | dit.current()->file().left(4) == "http" ) { | 730 | dit.current()->file().left(4) == "http" ) { |
727 | long size; | 731 | long size; |
728 | if( dit.current()->file().left(4) == "http" ) | 732 | if( dit.current()->file().left(4) == "http" ) |
729 | size=0; | 733 | size=0; |
730 | else | 734 | else |
731 | size = QFile( dit.current()->file() ).size(); | 735 | size = QFile( dit.current()->file() ).size(); |
732 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), | 736 | newItem= /*(void)*/ new QListViewItem( audioView, dit.current()->name(), |
733 | QString::number(size ), storage, dit.current()->file()); | 737 | QString::number(size ), storage, dit.current()->file()); |
734 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); | 738 | newItem->setPixmap( 0, Resource::loadPixmap( "opieplayer2/musicfile" ) ); |
735 | } | 739 | } |
736 | } | 740 | } |
741 | audioPopulated=true; | ||
737 | } | 742 | } |
738 | 743 | ||
739 | 744 | ||
740 | void PlayListWidget::populateVideoView() { | 745 | void PlayListWidget::populateVideoView() { |
741 | videoView->clear(); | 746 | videoView->clear(); |
742 | StorageInfo storageInfo; | 747 | StorageInfo storageInfo; |
743 | const QList<FileSystem> &fs = storageInfo.fileSystems(); | 748 | const QList<FileSystem> &fs = storageInfo.fileSystems(); |
744 | 749 | ||
745 | if(!videoScan ) { | 750 | if(!videoScan ) { |
746 | scanForVideo(); | 751 | scanForVideo(); |
747 | } | 752 | } |
748 | 753 | ||
749 | QListIterator<DocLnk> Vdit( vFiles.children() ); | 754 | QListIterator<DocLnk> Vdit( vFiles.children() ); |
750 | QListIterator<FileSystem> it ( fs ); | 755 | QListIterator<FileSystem> it ( fs ); |
751 | videoView->clear(); | 756 | videoView->clear(); |
752 | QString storage, pathName; | 757 | QString storage, pathName; |
@@ -755,32 +760,33 @@ void PlayListWidget::populateVideoView() { | |||
755 | const QString name = (*it)->name(); | 760 | const QString name = (*it)->name(); |
756 | const QString path = (*it)->path(); | 761 | const QString path = (*it)->path(); |
757 | if( Vdit.current()->file().find(path) != -1 ) { | 762 | if( Vdit.current()->file().find(path) != -1 ) { |
758 | storage=name; | 763 | storage=name; |
759 | pathName=path; | 764 | pathName=path; |
760 | } | 765 | } |
761 | } | 766 | } |
762 | 767 | ||
763 | QListViewItem * newItem; | 768 | QListViewItem * newItem; |
764 | if ( QFile( Vdit.current()->file() ).exists() ) { | 769 | if ( QFile( Vdit.current()->file() ).exists() ) { |
765 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), | 770 | newItem= /*(void)*/ new QListViewItem( videoView, Vdit.current()->name(), |
766 | QString::number( QFile( Vdit.current()->file() ).size() ), | 771 | QString::number( QFile( Vdit.current()->file() ).size() ), |
767 | storage, Vdit.current()->file()); | 772 | storage, Vdit.current()->file()); |
768 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); | 773 | newItem->setPixmap(0, Resource::loadPixmap( "opieplayer2/videofile" ) ); |
769 | } | 774 | } |
770 | } | 775 | } |
776 | videoPopulated=true; | ||
771 | } | 777 | } |
772 | 778 | ||
773 | 779 | ||
774 | void PlayListWidget::openFile() { | 780 | void PlayListWidget::openFile() { |
775 | // http://66.28.164.33:2080 | 781 | // http://66.28.164.33:2080 |
776 | // http://somafm.com/star0242.m3u | 782 | // http://somafm.com/star0242.m3u |
777 | QString filename, name; | 783 | QString filename, name; |
778 | InputDialog *fileDlg; | 784 | InputDialog *fileDlg; |
779 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); | 785 | fileDlg = new InputDialog(this,tr("Open file or URL"),TRUE, 0); |
780 | fileDlg->exec(); | 786 | fileDlg->exec(); |
781 | if( fileDlg->result() == 1 ) { | 787 | if( fileDlg->result() == 1 ) { |
782 | filename = fileDlg->text(); | 788 | filename = fileDlg->text(); |
783 | qDebug( "Selected filename is " + filename ); | 789 | qDebug( "Selected filename is " + filename ); |
784 | Om3u *m3uList; | 790 | Om3u *m3uList; |
785 | DocLnk lnk; | 791 | DocLnk lnk; |
786 | Config cfg( "OpiePlayer" ); | 792 | Config cfg( "OpiePlayer" ); |
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h index 53be7a7..b2c389e 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.h +++ b/noncore/multimedia/opieplayer2/playlistwidget.h | |||
@@ -67,33 +67,33 @@ public: | |||
67 | void useSelectedDocument(); | 67 | void useSelectedDocument(); |
68 | int selected; | 68 | int selected; |
69 | int whichList(); | 69 | int whichList(); |
70 | 70 | ||
71 | public slots: | 71 | public slots: |
72 | bool first(); | 72 | bool first(); |
73 | bool last(); | 73 | bool last(); |
74 | bool next(); | 74 | bool next(); |
75 | bool prev(); | 75 | bool prev(); |
76 | void writeDefaultPlaylist( ); | 76 | void writeDefaultPlaylist( ); |
77 | QString currentFileListPathName(); | 77 | QString currentFileListPathName(); |
78 | protected: | 78 | protected: |
79 | void keyReleaseEvent( QKeyEvent *e); | 79 | void keyReleaseEvent( QKeyEvent *e); |
80 | 80 | ||
81 | private: | 81 | private: |
82 | int defaultSkinIndex; | 82 | int defaultSkinIndex; |
83 | bool audioScan, videoScan; | 83 | bool audioScan, videoScan, audioPopulated, videoPopulated; |
84 | void readm3u(const QString &); | 84 | void readm3u(const QString &); |
85 | void readPls(const QString &); | 85 | void readPls(const QString &); |
86 | void initializeStates(); | 86 | void initializeStates(); |
87 | void populateAudioView(); | 87 | void populateAudioView(); |
88 | void populateVideoView(); | 88 | void populateVideoView(); |
89 | 89 | ||
90 | private slots: | 90 | private slots: |
91 | void populateSkinsMenu(); | 91 | void populateSkinsMenu(); |
92 | void skinsMenuActivated(int); | 92 | void skinsMenuActivated(int); |
93 | void pmViewActivated(int); | 93 | void pmViewActivated(int); |
94 | void writem3u(); | 94 | void writem3u(); |
95 | void writeCurrentM3u(); | 95 | void writeCurrentM3u(); |
96 | void scanForAudio(); | 96 | void scanForAudio(); |
97 | void scanForVideo(); | 97 | void scanForVideo(); |
98 | void openFile(); | 98 | void openFile(); |
99 | void setDocument( const QString& fileref ); | 99 | void setDocument( const QString& fileref ); |