summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp18
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h2
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
@@ -147,24 +147,26 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
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
168PlayListWidget::~PlayListWidget() { 170PlayListWidget::~PlayListWidget() {
169 if ( d->current ) { 171 if ( d->current ) {
170 delete d->current; 172 delete d->current;
@@ -609,38 +611,38 @@ void PlayListWidget::tabChanged(QWidget *) {
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 }
@@ -677,36 +679,38 @@ void PlayListWidget::playSelected() {
677} 679}
678 680
679 681
680void PlayListWidget::scanForAudio() { 682void 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
692void PlayListWidget::scanForVideo() { 695void 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
703void PlayListWidget::populateAudioView() { 707void 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 );
@@ -725,24 +729,25 @@ void PlayListWidget::populateAudioView() {
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
740void PlayListWidget::populateVideoView() { 745void 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
@@ -759,24 +764,25 @@ void PlayListWidget::populateVideoView() {
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
774void PlayListWidget::openFile() { 780void 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();
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
@@ -71,25 +71,25 @@ public:
71public slots: 71public 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();
78protected: 78protected:
79 void keyReleaseEvent( QKeyEvent *e); 79 void keyReleaseEvent( QKeyEvent *e);
80 80
81private: 81private:
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
90private slots: 90private 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();