summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-14 02:21:41 (UTC)
committer llornkcor <llornkcor>2002-11-14 02:21:41 (UTC)
commit8cdfc8e0209bbd9190176fdfcbeea2684cb5e8b8 (patch) (side-by-side diff)
tree89d993febecd3a4396e3c22fe5defaa3431e9375
parent9c48a8f9d70af68b9e57a82cda637ad8c2abf5c9 (diff)
downloadopie-8cdfc8e0209bbd9190176fdfcbeea2684cb5e8b8.zip
opie-8cdfc8e0209bbd9190176fdfcbeea2684cb5e8b8.tar.gz
opie-8cdfc8e0209bbd9190176fdfcbeea2684cb5e8b8.tar.bz2
much faster way of adding files to playlist, when tabs have already been initialized with files
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp109
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
@@ -39,4 +39,5 @@
#include <qpe/resource.h>
+#include <qdatetime.h>
#include <qdir.h>
#include <qmessagebox.h>
@@ -154,6 +155,6 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
// see which skins are installed
- videoScan=FALSE;
- audioScan=FALSE;
+ videoScan=false;
+ audioScan=false;
populateSkinsMenu();
initializeStates();
@@ -162,5 +163,4 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
loadList(DocLnk( currentPlaylist ) );
-
}
@@ -259,12 +259,59 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi
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);
@@ -275,5 +322,22 @@ void PlayListWidget::addAllToList() {
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() );
@@ -283,4 +347,5 @@ void PlayListWidget::addAllMusicToList() {
}
}
+ */
tabWidget->setCurrentPage(0);
writeCurrentM3u();
@@ -290,5 +355,22 @@ void PlayListWidget::addAllMusicToList() {
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() );
@@ -298,4 +380,5 @@ void PlayListWidget::addAllVideoToList() {
}
}
+*/
tabWidget->setCurrentPage(0);
writeCurrentM3u();