summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-10-08 21:32:13 (UTC)
committer llornkcor <llornkcor>2002-10-08 21:32:13 (UTC)
commitca0c224318a50c6618691fb30f39aa1d9b0b8a4f (patch) (unidiff)
tree961917745cbb5bccf220735b9b62705d4651ffe7
parent9fdf7460f752f979497ee743ba67ddba52c1a7d7 (diff)
downloadopie-ca0c224318a50c6618691fb30f39aa1d9b0b8a4f.zip
opie-ca0c224318a50c6618691fb30f39aa1d9b0b8a4f.tar.gz
opie-ca0c224318a50c6618691fb30f39aa1d9b0b8a4f.tar.bz2
fix addAll* from menu
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index c0d3108..d53c423 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -57,6 +57,8 @@
57 57
58extern MediaPlayerState *mediaPlayerState; 58extern MediaPlayerState *mediaPlayerState;
59 59
60QString audioMimes ="audio/mpeg;audio/x-wav;audio/x-ogg";
61// no m3u's here please
60 62
61PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) 63PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
62 : PlayListWidgetGui( parent, name, fl ) { 64 : PlayListWidgetGui( parent, name, fl ) {
@@ -205,7 +207,7 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) {
205 if( QFileInfo( lnk.file() ).exists() || 207 if( QFileInfo( lnk.file() ).exists() ||
206 lnk.file().left(4) == "http" ) 208 lnk.file().left(4) == "http" )
207 d->selectedFiles->addToSelection( lnk ); 209 d->selectedFiles->addToSelection( lnk );
208 writeCurrentM3u(); 210// writeCurrentM3u();
209 } 211 }
210 else 212 else
211 mediaPlayerState->setPlaying( TRUE ); 213 mediaPlayerState->setPlaying( TRUE );
@@ -252,7 +254,7 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi
252 254
253void PlayListWidget::addAllToList() { 255void PlayListWidget::addAllToList() {
254 DocLnkSet filesAll; 256 DocLnkSet filesAll;
255 Global::findDocuments(&filesAll, "video/*;audio/*"); 257 Global::findDocuments(&filesAll, "video/*;"+audioMimes);
256 QListIterator<DocLnk> Adit( filesAll.children() ); 258 QListIterator<DocLnk> Adit( filesAll.children() );
257 for ( ; Adit.current(); ++Adit ) { 259 for ( ; Adit.current(); ++Adit ) {
258 if( QFileInfo( Adit.current()->file() ).exists() ) { 260 if( QFileInfo( Adit.current()->file() ).exists() ) {
@@ -264,6 +266,8 @@ void PlayListWidget::addAllToList() {
264 266
265 267
266void PlayListWidget::addAllMusicToList() { 268void PlayListWidget::addAllMusicToList() {
269 if(!audioScan)
270 scanForAudio();
267 QListIterator<DocLnk> dit( files.children() ); 271 QListIterator<DocLnk> dit( files.children() );
268 for ( ; dit.current(); ++dit ) { 272 for ( ; dit.current(); ++dit ) {
269 if( QFileInfo(dit.current()->file() ).exists() ) { 273 if( QFileInfo(dit.current()->file() ).exists() ) {
@@ -275,6 +279,8 @@ void PlayListWidget::addAllMusicToList() {
275 279
276 280
277void PlayListWidget::addAllVideoToList() { 281void PlayListWidget::addAllVideoToList() {
282 if(!videoScan)
283 scanForVideo();
278 QListIterator<DocLnk> dit( vFiles.children() ); 284 QListIterator<DocLnk> dit( vFiles.children() );
279 for ( ; dit.current(); ++dit ) { 285 for ( ; dit.current(); ++dit ) {
280 if( QFileInfo( dit.current()->file() ).exists() ) { 286 if( QFileInfo( dit.current()->file() ).exists() ) {
@@ -306,6 +312,8 @@ void PlayListWidget::setDocument( const QString& fileref ) {
306 } else { 312 } else {
307 clearList(); 313 clearList();
308 addToSelection( DocLnk( fileref ) ); 314 addToSelection( DocLnk( fileref ) );
315 writeCurrentM3u();
316
309 d->setDocumentUsed = TRUE; 317 d->setDocumentUsed = TRUE;
310 mediaPlayerState->setPlaying( FALSE ); 318 mediaPlayerState->setPlaying( FALSE );
311 mediaPlayerState->setPlaying( TRUE ); 319 mediaPlayerState->setPlaying( TRUE );
@@ -612,7 +620,7 @@ void PlayListWidget::scanForAudio() {
612 delete sdit.current(); 620 delete sdit.current();
613 } 621 }
614// Global::findDocuments( &files, "audio/*"); 622// Global::findDocuments( &files, "audio/*");
615 Global::findDocuments( &files, "audio/mpeg;audio/x-wav;audio/x-ogg"); 623 Global::findDocuments( &files, audioMimes);
616 audioScan = TRUE; 624 audioScan = TRUE;
617} 625}
618 626
@@ -844,16 +852,17 @@ void PlayListWidget::writeCurrentM3u() {
844 Config cfg( "OpiePlayer" ); 852 Config cfg( "OpiePlayer" );
845 cfg.setGroup("PlayList"); 853 cfg.setGroup("PlayList");
846 QString currentPlaylist = cfg.readEntry("CurrentPlaylist",""); 854 QString currentPlaylist = cfg.readEntry("CurrentPlaylist","");
847 // int noOfFiles = cfg.readNumEntry("NumberOfFiles", 0 ); 855
848 Om3u *m3uList; 856 Om3u *m3uList;
849 m3uList = new Om3u( currentPlaylist, IO_ReadWrite |IO_Truncate ); 857 m3uList = new Om3u( currentPlaylist, IO_ReadWrite |IO_Truncate );
850 d->selectedFiles->first(); 858 d->selectedFiles->first();
851 859 qDebug( d->selectedFiles->current()->file());
852 do { 860 do {
861 qDebug( d->selectedFiles->current()->file());
853 m3uList->add( d->selectedFiles->current()->file()); 862 m3uList->add( d->selectedFiles->current()->file());
854 } 863 }
855 while ( d->selectedFiles->next() ); 864 while ( d->selectedFiles->next() );
856// qDebug( list ); 865 qDebug( "<<<<<<<<<<<<>>>>>>>>>>>>>>>>>" );
857 m3uList->write(); 866 m3uList->write();
858 m3uList->close(); 867 m3uList->close();
859 868