-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 109 |
1 files changed, 96 insertions, 13 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp index a6a9eca..c2b5c77 100644 --- a/noncore/multimedia/opieplayer2/playlistwidget.cpp +++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp @@ -35,12 +35,13 @@ #include <qpe/qpeapplication.h> #include <qpe/storage.h> #include <qpe/mimetype.h> #include <qpe/global.h> #include <qpe/resource.h> +#include <qdatetime.h> #include <qdir.h> #include <qmessagebox.h> #include <qregexp.h> #include <qtextstream.h> #include "playlistselection.h" @@ -150,21 +151,20 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl ) connect( d->selectedFiles, SIGNAL( doubleClicked( QListViewItem *) ), this, SLOT( playIt( QListViewItem *) ) ); connect ( gammaSlider, SIGNAL( valueChanged( int ) ), mediaPlayerState, SLOT( setVideoGamma( int ) ) ); // see which skins are installed - videoScan=FALSE; - audioScan=FALSE; + videoScan=false; + audioScan=false; populateSkinsMenu(); initializeStates(); cfg.setGroup("PlayList"); QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); loadList(DocLnk( currentPlaylist ) ); - } PlayListWidget::~PlayListWidget() { if ( d->current ) { delete d->current; @@ -255,51 +255,134 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi break; } } void PlayListWidget::addAllToList() { - DocLnkSet filesAll; - Global::findDocuments(&filesAll, "video/*;"+audioMimes); - QListIterator<DocLnk> Adit( filesAll.children() ); - for ( ; Adit.current(); ++Adit ) { - if( QFileInfo( Adit.current()->file() ).exists() ) { - d->selectedFiles->addToSelection( **Adit ); - } - } + +// QTime t; +// t.start(); + + if(!audioScan) { + if(audioView->childCount() < 1) + populateAudioView(); + } + + QListViewItemIterator audioIt( audioView ); + DocLnk lnk; + QString filename; + // iterate through all items of the listview + for ( ; audioIt.current(); ++audioIt ) { + filename = audioIt.current()->text(3); + lnk.setName( QFileInfo(filename).baseName() ); //sets name + lnk.setFile( filename ); //sets file name + d->selectedFiles->addToSelection( lnk); + } + + if(!videoScan) { + if(videoView->childCount() < 1) + populateVideoView(); + } + + QListViewItemIterator videoIt( videoView ); + for ( ; videoIt.current(); ++videoIt ) { + filename = videoIt.current()->text(3); + lnk.setName( QFileInfo(filename).baseName() ); //sets name + lnk.setFile( filename ); //sets file name + d->selectedFiles->addToSelection( lnk); + } + + // d->selectedFiles->addToSelection( ); + // if ( it.current()->isSelected() ) + // lst->append( audioIt.current() ); + // } + + /* + if(!audioScan) + scanForAudio(); + if(!videoScan) + scanForVideo(); + + DocLnkSet filesAll; + Global::findDocuments(&filesAll, "video/*;"+audioMimes); + QListIterator<DocLnk> Adit( filesAll.children() ); + for ( ; Adit.current(); ++Adit ) { + if( QFileInfo( Adit.current()->file() ).exists() ) { + d->selectedFiles->addToSelection( **Adit ); + } + } +*/ + // qDebug("elapsed time %d", t.elapsed() ); + tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::addAllMusicToList() { - if(!audioScan) + + if(!audioScan) { + if(audioView->childCount() < 1) + populateAudioView(); + } + + QListViewItemIterator audioIt( audioView ); + DocLnk lnk; + QString filename; + // iterate through all items of the listview + for ( ; audioIt.current(); ++audioIt ) { + filename = audioIt.current()->text(3); + lnk.setName( QFileInfo(filename).baseName() ); //sets name + lnk.setFile( filename ); //sets file name + d->selectedFiles->addToSelection( lnk); + } + + /* if(!audioScan) scanForAudio(); QListIterator<DocLnk> dit( files.children() ); for ( ; dit.current(); ++dit ) { if( QFileInfo(dit.current()->file() ).exists() ) { d->selectedFiles->addToSelection( **dit ); } } + */ tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } void PlayListWidget::addAllVideoToList() { - if(!videoScan) + + if(!videoScan) { + if(videoView->childCount() < 1) + populateVideoView(); + } + + QListViewItemIterator videoIt( videoView ); + DocLnk lnk; + QString filename; + for ( ; videoIt.current(); ++videoIt ) { + filename = videoIt.current()->text(3); + lnk.setName( QFileInfo(filename).baseName() ); //sets name + lnk.setFile( filename ); //sets file name + d->selectedFiles->addToSelection( lnk); + } + + + /* if(!videoScan) scanForVideo(); QListIterator<DocLnk> dit( vFiles.children() ); for ( ; dit.current(); ++dit ) { if( QFileInfo( dit.current()->file() ).exists() ) { d->selectedFiles->addToSelection( **dit ); } } +*/ tabWidget->setCurrentPage(0); writeCurrentM3u(); d->selectedFiles->first(); } |