summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-14 02:56:04 (UTC)
committer llornkcor <llornkcor>2002-11-14 02:56:04 (UTC)
commit4a60497bd689bd01ca301378f382bff6863b592e (patch) (unidiff)
tree3b9926eb8f6f89b204eaca2a443b6bb9b5e9f883
parent3bfb64a41ca7948b593982fc1c266d5ec829b9ab (diff)
downloadopie-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
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
@@ -95,128 +95,130 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
95 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ), 95 (void)new MenuItem( pmPlayList, tr( "Open File or URL" ),
96 this,SLOT( openFile() ) ); 96 this,SLOT( openFile() ) );
97 pmPlayList->insertSeparator(-1); 97 pmPlayList->insertSeparator(-1);
98 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ), 98 (void)new MenuItem( pmPlayList, tr( "Rescan for Audio Files" ),
99 this,SLOT( scanForAudio() ) ); 99 this,SLOT( scanForAudio() ) );
100 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ), 100 (void)new MenuItem( pmPlayList, tr( "Rescan for Video Files" ),
101 this,SLOT( scanForVideo() ) ); 101 this,SLOT( scanForVideo() ) );
102 102
103 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"), 103 pmView->insertItem( Resource::loadPixmap("fullscreen") , tr( "Full Screen"),
104 mediaPlayerState, SLOT( toggleFullscreen() ) ); 104 mediaPlayerState, SLOT( toggleFullscreen() ) );
105 105
106 Config cfg( "OpiePlayer" ); 106 Config cfg( "OpiePlayer" );
107 bool b= cfg.readBoolEntry("FullScreen", 0); 107 bool b= cfg.readBoolEntry("FullScreen", 0);
108 mediaPlayerState->setFullscreen( b ); 108 mediaPlayerState->setFullscreen( b );
109 pmView->setItemChecked( -16, b ); 109 pmView->setItemChecked( -16, b );
110 110
111 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up", 111 (void)new ToolButton( vbox1, tr( "Move Up" ), "opieplayer2/up",
112 d->selectedFiles, SLOT(moveSelectedUp() ) ); 112 d->selectedFiles, SLOT(moveSelectedUp() ) );
113 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut", 113 (void)new ToolButton( vbox1, tr( "Remove" ), "opieplayer2/cut",
114 d->selectedFiles, SLOT(removeSelected() ) ); 114 d->selectedFiles, SLOT(removeSelected() ) );
115 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down", 115 (void)new ToolButton( vbox1, tr( "Move Down" ), "opieplayer2/down",
116 d->selectedFiles, SLOT(moveSelectedDown() ) ); 116 d->selectedFiles, SLOT(moveSelectedDown() ) );
117 QVBox *stretch2 = new QVBox( vbox1 ); 117 QVBox *stretch2 = new QVBox( vbox1 );
118 118
119 connect( tbDeletePlaylist, ( SIGNAL( released() ) ), 119 connect( tbDeletePlaylist, ( SIGNAL( released() ) ),
120 SLOT( deletePlaylist() ) ); 120 SLOT( deletePlaylist() ) );
121 connect( pmView, SIGNAL( activated( int ) ), 121 connect( pmView, SIGNAL( activated( int ) ),
122 this, SLOT( pmViewActivated( int ) ) ); 122 this, SLOT( pmViewActivated( int ) ) );
123 connect( skinsMenu, SIGNAL( activated( int ) ) , 123 connect( skinsMenu, SIGNAL( activated( int ) ) ,
124 this, SLOT( skinsMenuActivated( int ) ) ); 124 this, SLOT( skinsMenuActivated( int ) ) );
125 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 125 connect( d->selectedFiles, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
126 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 126 this,SLOT( playlistViewPressed( int, QListViewItem *, const QPoint&, int ) ) );
127 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ), 127 connect( audioView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int ) ),
128 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) ); 128 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int ) ) );
129 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ), 129 connect( audioView, SIGNAL( returnPressed( QListViewItem *) ),
130 this,SLOT( playIt( QListViewItem *) ) ); 130 this,SLOT( playIt( QListViewItem *) ) );
131 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ), 131 connect( audioView, SIGNAL( doubleClicked( QListViewItem *) ),
132 this, SLOT( addToSelection( QListViewItem *) ) ); 132 this, SLOT( addToSelection( QListViewItem *) ) );
133 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ), 133 connect( videoView, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int) ),
134 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) ); 134 this,SLOT( viewPressed( int, QListViewItem *, const QPoint&, int) ) );
135 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ), 135 connect( videoView, SIGNAL( returnPressed( QListViewItem *) ),
136 this,SLOT( playIt( QListViewItem *) ) ); 136 this,SLOT( playIt( QListViewItem *) ) );
137 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ), 137 connect( videoView, SIGNAL( doubleClicked( QListViewItem *) ),
138 this, SLOT( addToSelection( QListViewItem *) ) ); 138 this, SLOT( addToSelection( QListViewItem *) ) );
139 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ), 139 connect( playLists, SIGNAL( fileSelected( const DocLnk &) ),
140 this, SLOT( loadList( const DocLnk & ) ) ); 140 this, SLOT( loadList( const DocLnk & ) ) );
141 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ), 141 connect( tabWidget, SIGNAL ( currentChanged(QWidget*) ),
142 this, SLOT( tabChanged( QWidget* ) ) ); 142 this, SLOT( tabChanged( QWidget* ) ) );
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
168PlayListWidget::~PlayListWidget() { 170PlayListWidget::~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
175 177
176void PlayListWidget::initializeStates() { 178void PlayListWidget::initializeStates() {
177 d->tbPlay->setOn( mediaPlayerState->playing() ); 179 d->tbPlay->setOn( mediaPlayerState->playing() );
178 d->tbLoop->setOn( mediaPlayerState->looping() ); 180 d->tbLoop->setOn( mediaPlayerState->looping() );
179 d->tbShuffle->setOn( mediaPlayerState->shuffled() ); 181 d->tbShuffle->setOn( mediaPlayerState->shuffled() );
180 setPlaylist( true ); 182 setPlaylist( true );
181} 183}
182 184
183void PlayListWidget::writeDefaultPlaylist() { 185void PlayListWidget::writeDefaultPlaylist() {
184 186
185 Config config( "OpiePlayer" ); 187 Config config( "OpiePlayer" );
186 config.setGroup( "PlayList" ); 188 config.setGroup( "PlayList" );
187 QString filename=QPEApplication::documentDir() + "/default.m3u"; 189 QString filename=QPEApplication::documentDir() + "/default.m3u";
188 QString currentString = config.readEntry( "CurrentPlaylist", filename); 190 QString currentString = config.readEntry( "CurrentPlaylist", filename);
189 if( currentString == filename) { 191 if( currentString == filename) {
190 Om3u *m3uList; 192 Om3u *m3uList;
191 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>"); 193 // qDebug("<<<<<<<<<<<<<default>>>>>>>>>>>>>>>>>>>");
192 if( d->selectedFiles->first() ) { 194 if( d->selectedFiles->first() ) {
193 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate); 195 m3uList = new Om3u(filename, IO_ReadWrite | IO_Truncate);
194 do { 196 do {
195 // qDebug(d->selectedFiles->current()->file()); 197 // qDebug(d->selectedFiles->current()->file());
196 m3uList->add( d->selectedFiles->current()->file() ); 198 m3uList->add( d->selectedFiles->current()->file() );
197 } 199 }
198 while ( d->selectedFiles->next() ); 200 while ( d->selectedFiles->next() );
199 201
200 m3uList->write(); 202 m3uList->write();
201 m3uList->close(); 203 m3uList->close();
202 if(m3uList) delete m3uList; 204 if(m3uList) delete m3uList;
203 205
204 } 206 }
205 } 207 }
206} 208}
207 209
208void PlayListWidget::addToSelection( const DocLnk& lnk ) { 210void PlayListWidget::addToSelection( const DocLnk& lnk ) {
209 d->setDocumentUsed = FALSE; 211 d->setDocumentUsed = FALSE;
210 if ( mediaPlayerState->playlist() ) { 212 if ( mediaPlayerState->playlist() ) {
211 if( QFileInfo( lnk.file() ).exists() || 213 if( QFileInfo( lnk.file() ).exists() ||
212 lnk.file().left(4) == "http" ) { 214 lnk.file().left(4) == "http" ) {
213 d->selectedFiles->addToSelection( lnk ); 215 d->selectedFiles->addToSelection( lnk );
214 } 216 }
215// writeCurrentM3u(); 217// writeCurrentM3u();
216 } 218 }
217 else 219 else
218 mediaPlayerState->setPlaying( TRUE ); 220 mediaPlayerState->setPlaying( TRUE );
219} 221}
220 222
221 223
222void PlayListWidget::clearList() { 224void PlayListWidget::clearList() {
@@ -557,278 +559,282 @@ void PlayListWidget::addSelected() {
557 } 559 }
558 break; 560 break;
559 }; 561 };
560 lnk.setName( QFileInfo(filename).baseName() ); //sets name 562 lnk.setName( QFileInfo(filename).baseName() ); //sets name
561 lnk.setFile( filename ); //sets file name 563 lnk.setFile( filename ); //sets file name
562 d->selectedFiles->addToSelection( lnk); 564 d->selectedFiles->addToSelection( lnk);
563 tabWidget->setCurrentPage(0); 565 tabWidget->setCurrentPage(0);
564 writeCurrentM3u(); 566 writeCurrentM3u();
565} 567}
566 568
567 569
568void PlayListWidget::removeSelected() { 570void PlayListWidget::removeSelected() {
569 d->selectedFiles->removeSelected( ); 571 d->selectedFiles->removeSelected( );
570 writeCurrentM3u(); 572 writeCurrentM3u();
571} 573}
572 574
573 575
574void PlayListWidget::playIt( QListViewItem *it) { 576void PlayListWidget::playIt( QListViewItem *it) {
575 if(!it) return; 577 if(!it) return;
576 mediaPlayerState->setPlaying(FALSE); 578 mediaPlayerState->setPlaying(FALSE);
577 mediaPlayerState->setPlaying(TRUE); 579 mediaPlayerState->setPlaying(TRUE);
578 d->selectedFiles->unSelect(); 580 d->selectedFiles->unSelect();
579} 581}
580 582
581 583
582void PlayListWidget::addToSelection( QListViewItem *it) { 584void PlayListWidget::addToSelection( QListViewItem *it) {
583 d->setDocumentUsed = FALSE; 585 d->setDocumentUsed = FALSE;
584 586
585 if(it) { 587 if(it) {
586 switch ( whichList()) { 588 switch ( whichList()) {
587 case 0: //playlist 589 case 0: //playlist
588 return; 590 return;
589 break; 591 break;
590 }; 592 };
591 // case 1: { 593 // case 1: {
592 DocLnk lnk; 594 DocLnk lnk;
593 QString filename; 595 QString filename;
594 596
595 filename=it->text(3); 597 filename=it->text(3);
596 lnk.setName( QFileInfo(filename).baseName() ); //sets name 598 lnk.setName( QFileInfo(filename).baseName() ); //sets name
597 lnk.setFile( filename ); //sets file name 599 lnk.setFile( filename ); //sets file name
598 d->selectedFiles->addToSelection( lnk); 600 d->selectedFiles->addToSelection( lnk);
599 601
600 writeCurrentM3u(); 602 writeCurrentM3u();
601 tabWidget->setCurrentPage(0); 603 tabWidget->setCurrentPage(0);
602 604
603 } 605 }
604} 606}
605 607
606 608
607void PlayListWidget::tabChanged(QWidget *) { 609void 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 };
651} 653}
652 654
653 655
654void PlayListWidget::btnPlay(bool b) { 656void PlayListWidget::btnPlay(bool b) {
655// mediaPlayerState->setPlaying(false); 657// mediaPlayerState->setPlaying(false);
656 mediaPlayerState->setPlaying(b); 658 mediaPlayerState->setPlaying(b);
657 insanityBool=FALSE; 659 insanityBool=FALSE;
658} 660}
659 661
660void PlayListWidget::deletePlaylist() { 662void PlayListWidget::deletePlaylist() {
661 switch( QMessageBox::information( this, (tr("Remove Playlist?")), 663 switch( QMessageBox::information( this, (tr("Remove Playlist?")),
662 (tr("You really want to delete\nthis playlist?")), 664 (tr("You really want to delete\nthis playlist?")),
663 (tr("Yes")), (tr("No")), 0 )){ 665 (tr("Yes")), (tr("No")), 0 )){
664 case 0: // Yes clicked, 666 case 0: // Yes clicked,
665 QFile().remove(playLists->selectedDocument().file()); 667 QFile().remove(playLists->selectedDocument().file());
666 QFile().remove(playLists->selectedDocument().linkFile()); 668 QFile().remove(playLists->selectedDocument().linkFile());
667 playLists->reread(); 669 playLists->reread();
668 break; 670 break;
669 case 1: // Cancel 671 case 1: // Cancel
670 break; 672 break;
671 }; 673 };
672} 674}
673 675
674 676
675void PlayListWidget::playSelected() { 677void PlayListWidget::playSelected() {
676 btnPlay( TRUE); 678 btnPlay( TRUE);
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 );
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 ){
717 const QString name = (*it)->name(); 721 const QString name = (*it)->name();
718 const QString path = (*it)->path(); 722 const QString path = (*it)->path();
719 if(dit.current()->file().find(path) != -1 ) { 723 if(dit.current()->file().find(path) != -1 ) {
720 storage = name; 724 storage = name;
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
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
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;
753 for ( ; Vdit.current(); ++Vdit ) { 758 for ( ; Vdit.current(); ++Vdit ) {
754 for( ; it.current(); ++it ) { 759 for( ; it.current(); ++it ) {
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
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();
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" );
787 cfg.setGroup("PlayList"); 793 cfg.setGroup("PlayList");
788 794
789 if(filename.left(4) == "http") { 795 if(filename.left(4) == "http") {
790 QString m3uFile, m3uFilePath; 796 QString m3uFile, m3uFilePath;
791 if(filename.find(":",8,TRUE) != -1) { //found a port 797 if(filename.find(":",8,TRUE) != -1) { //found a port
792 m3uFile = filename.left( filename.find( ":",8,TRUE)); 798 m3uFile = filename.left( filename.find( ":",8,TRUE));
793 m3uFile = m3uFile.right( 7); 799 m3uFile = m3uFile.right( 7);
794 } else if(filename.left(4) == "http"){ 800 } else if(filename.left(4) == "http"){
795 m3uFile=filename; 801 m3uFile=filename;
796 m3uFile = m3uFile.right( m3uFile.length() - 7); 802 m3uFile = m3uFile.right( m3uFile.length() - 7);
797 } else{ 803 } else{
798 m3uFile=filename; 804 m3uFile=filename;
799 } 805 }
800 806
801// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile); 807// qDebug("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"+ m3uFile);
802 lnk.setName( filename ); //sets name 808 lnk.setName( filename ); //sets name
803 lnk.setFile( filename ); //sets file name 809 lnk.setFile( filename ); //sets file name
804 810
805// lnk.setIcon("opieplayer2/musicfile"); 811// lnk.setIcon("opieplayer2/musicfile");
806 812
807 d->selectedFiles->addToSelection( lnk ); 813 d->selectedFiles->addToSelection( lnk );
808 writeCurrentM3u(); 814 writeCurrentM3u();
809 d->selectedFiles->setSelectedItem( lnk.name()); 815 d->selectedFiles->setSelectedItem( lnk.name());
810 } 816 }
811 else if( filename.right( 3) == "m3u" ) { 817 else if( filename.right( 3) == "m3u" ) {
812 readm3u( filename ); 818 readm3u( filename );
813 819
814 } else if( filename.right(3) == "pls" ) { 820 } else if( filename.right(3) == "pls" ) {
815 readPls( filename ); 821 readPls( filename );
816 } else { 822 } else {
817 lnk.setName( QFileInfo(filename).baseName() ); //sets name 823 lnk.setName( QFileInfo(filename).baseName() ); //sets name
818 lnk.setFile( filename ); //sets file name 824 lnk.setFile( filename ); //sets file name
819 d->selectedFiles->addToSelection( lnk); 825 d->selectedFiles->addToSelection( lnk);
820 writeCurrentM3u(); 826 writeCurrentM3u();
821 d->selectedFiles->setSelectedItem( lnk.name()); 827 d->selectedFiles->setSelectedItem( lnk.name());
822 } 828 }
823 } 829 }
824 830
825 if( fileDlg ) { 831 if( fileDlg ) {
826 delete fileDlg; 832 delete fileDlg;
827 } 833 }
828} 834}
829 835
830/* 836/*
831reads m3u and shows files/urls to playlist widget */ 837reads m3u and shows files/urls to playlist widget */
832void PlayListWidget::readm3u( const QString &filename ) { 838void PlayListWidget::readm3u( const QString &filename ) {
833 qDebug( "read m3u filename " + filename ); 839 qDebug( "read m3u filename " + filename );
834 840
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
@@ -19,103 +19,103 @@
19    : ..    .:,     . . . without even the implied warranty of 19    : ..    .:,     . . . without even the implied warranty of
20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A 20    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU 21  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU
22..}^=.=       =       ; General Public License for more 22..}^=.=       =       ; General Public License for more
23++=   -.     .`     .: details. 23++=   -.     .`     .: details.
24 :     =  ...= . :.=- 24 :     =  ...= . :.=-
25 -.   .:....=;==+<; You should have received a copy of the GNU 25 -.   .:....=;==+<; You should have received a copy of the GNU
26  -_. . .   )=.  = General Public License along with 26  -_. . .   )=.  = General Public License along with
27    --        :-=` this library; see the file COPYING.LIB. 27    --        :-=` this library; see the file COPYING.LIB.
28 If not, write to the Free Software Foundation, 28 If not, write to the Free Software Foundation,
29 Inc., 59 Temple Place - Suite 330, 29 Inc., 59 Temple Place - Suite 330,
30 Boston, MA 02111-1307, USA. 30 Boston, MA 02111-1307, USA.
31 31
32*/ 32*/
33 33
34#ifndef PLAY_LIST_WIDGET_H 34#ifndef PLAY_LIST_WIDGET_H
35#define PLAY_LIST_WIDGET_H 35#define PLAY_LIST_WIDGET_H
36 36
37#include <qmainwindow.h> 37#include <qmainwindow.h>
38#include <qpe/applnk.h> 38#include <qpe/applnk.h>
39#include <qtabwidget.h> 39#include <qtabwidget.h>
40#include <qpe/fileselector.h> 40#include <qpe/fileselector.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qpopupmenu.h> 42#include <qpopupmenu.h>
43 43
44#include "playlistwidgetgui.h" 44#include "playlistwidgetgui.h"
45 45
46 46
47//class PlayListWidgetPrivate; 47//class PlayListWidgetPrivate;
48class Config; 48class Config;
49class QListViewItem; 49class QListViewItem;
50class QListView; 50class QListView;
51class QPoint; 51class QPoint;
52class QAction; 52class QAction;
53class QLabel; 53class QLabel;
54 54
55class PlayListWidget : public PlayListWidgetGui { 55class PlayListWidget : public PlayListWidgetGui {
56 Q_OBJECT 56 Q_OBJECT
57public: 57public:
58 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 58 PlayListWidget( QWidget* parent=0, const char* name=0, WFlags fl=0 );
59 ~PlayListWidget(); 59 ~PlayListWidget();
60 DocLnkSet files; 60 DocLnkSet files;
61 DocLnkSet vFiles; 61 DocLnkSet vFiles;
62 bool fromSetDocument; 62 bool fromSetDocument;
63 bool insanityBool; 63 bool insanityBool;
64 QString setDocFileRef, currentPlayList; 64 QString setDocFileRef, currentPlayList;
65 // retrieve the current playlist entry (media file link) 65 // retrieve the current playlist entry (media file link)
66 const DocLnk *current(); 66 const DocLnk *current();
67 void useSelectedDocument(); 67 void useSelectedDocument();
68 int selected; 68 int selected;
69 int whichList(); 69 int whichList();
70 70
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();
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 );
100 void addToSelection( const DocLnk& ); // Add a media file to the playlist 100 void addToSelection( const DocLnk& ); // Add a media file to the playlist
101 void addToSelection( QListViewItem* ); // Add a media file to the playlist 101 void addToSelection( QListViewItem* ); // Add a media file to the playlist
102 void setPlaylist( bool ); // Show/Hide the playlist 102 void setPlaylist( bool ); // Show/Hide the playlist
103 void clearList(); 103 void clearList();
104 void addAllToList(); 104 void addAllToList();
105 void addAllMusicToList(); 105 void addAllMusicToList();
106 void addAllVideoToList(); 106 void addAllVideoToList();
107 void saveList(); // Save the playlist 107 void saveList(); // Save the playlist
108 void loadList( const DocLnk &); // Load a playlist 108 void loadList( const DocLnk &); // Load a playlist
109 void playIt( QListViewItem *); 109 void playIt( QListViewItem *);
110 void btnPlay(bool); 110 void btnPlay(bool);
111 void deletePlaylist(); 111 void deletePlaylist();
112 void addSelected(); 112 void addSelected();
113 void removeSelected(); 113 void removeSelected();
114 void tabChanged(QWidget*); 114 void tabChanged(QWidget*);
115 void viewPressed( int, QListViewItem *, const QPoint&, int); 115 void viewPressed( int, QListViewItem *, const QPoint&, int);
116 void playlistViewPressed( int, QListViewItem *, const QPoint&, int); 116 void playlistViewPressed( int, QListViewItem *, const QPoint&, int);
117 void playSelected(); 117 void playSelected();
118}; 118};
119 119
120#endif // PLAY_LIST_WIDGET_H 120#endif // PLAY_LIST_WIDGET_H
121 121