summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2002-11-14 02:21:41 (UTC)
committer llornkcor <llornkcor>2002-11-14 02:21:41 (UTC)
commit8cdfc8e0209bbd9190176fdfcbeea2684cb5e8b8 (patch) (unidiff)
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
@@ -38,6 +38,7 @@
38#include <qpe/global.h> 38#include <qpe/global.h>
39#include <qpe/resource.h> 39#include <qpe/resource.h>
40 40
41#include <qdatetime.h>
41#include <qdir.h> 42#include <qdir.h>
42#include <qmessagebox.h> 43#include <qmessagebox.h>
43#include <qregexp.h> 44#include <qregexp.h>
@@ -153,15 +154,14 @@ PlayListWidget::PlayListWidget( QWidget* parent, const char* name, WFlags fl )
153 mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 154 mediaPlayerState, SLOT( setVideoGamma( int ) ) );
154 155
155 // see which skins are installed 156 // see which skins are installed
156 videoScan=FALSE; 157 videoScan=false;
157 audioScan=FALSE; 158 audioScan=false;
158 populateSkinsMenu(); 159 populateSkinsMenu();
159 initializeStates(); 160 initializeStates();
160 161
161 cfg.setGroup("PlayList"); 162 cfg.setGroup("PlayList");
162 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default"); 163 QString currentPlaylist = cfg.readEntry( "CurrentPlaylist", "default");
163 loadList(DocLnk( currentPlaylist ) ); 164 loadList(DocLnk( currentPlaylist ) );
164
165} 165}
166 166
167 167
@@ -258,14 +258,61 @@ void PlayListWidget::playlistViewPressed( int mouse, QListViewItem *, const QPoi
258 258
259 259
260void PlayListWidget::addAllToList() { 260void PlayListWidget::addAllToList() {
261 DocLnkSet filesAll; 261
262 Global::findDocuments(&filesAll, "video/*;"+audioMimes); 262// QTime t;
263 QListIterator<DocLnk> Adit( filesAll.children() ); 263// t.start();
264 for ( ; Adit.current(); ++Adit ) { 264
265 if( QFileInfo( Adit.current()->file() ).exists() ) { 265 if(!audioScan) {
266 d->selectedFiles->addToSelection( **Adit ); 266 if(audioView->childCount() < 1)
267 } 267 populateAudioView();
268 } 268 }
269
270 QListViewItemIterator audioIt( audioView );
271 DocLnk lnk;
272 QString filename;
273 // iterate through all items of the listview
274 for ( ; audioIt.current(); ++audioIt ) {
275 filename = audioIt.current()->text(3);
276 lnk.setName( QFileInfo(filename).baseName() ); //sets name
277 lnk.setFile( filename ); //sets file name
278 d->selectedFiles->addToSelection( lnk);
279 }
280
281 if(!videoScan) {
282 if(videoView->childCount() < 1)
283 populateVideoView();
284 }
285
286 QListViewItemIterator videoIt( videoView );
287 for ( ; videoIt.current(); ++videoIt ) {
288 filename = videoIt.current()->text(3);
289 lnk.setName( QFileInfo(filename).baseName() ); //sets name
290 lnk.setFile( filename ); //sets file name
291 d->selectedFiles->addToSelection( lnk);
292 }
293
294 // d->selectedFiles->addToSelection( );
295 // if ( it.current()->isSelected() )
296 // lst->append( audioIt.current() );
297 // }
298
299 /*
300 if(!audioScan)
301 scanForAudio();
302 if(!videoScan)
303 scanForVideo();
304
305 DocLnkSet filesAll;
306 Global::findDocuments(&filesAll, "video/*;"+audioMimes);
307 QListIterator<DocLnk> Adit( filesAll.children() );
308 for ( ; Adit.current(); ++Adit ) {
309 if( QFileInfo( Adit.current()->file() ).exists() ) {
310 d->selectedFiles->addToSelection( **Adit );
311 }
312 }
313*/
314 // qDebug("elapsed time %d", t.elapsed() );
315
269 tabWidget->setCurrentPage(0); 316 tabWidget->setCurrentPage(0);
270 317
271 writeCurrentM3u(); 318 writeCurrentM3u();
@@ -274,7 +321,24 @@ void PlayListWidget::addAllToList() {
274 321
275 322
276void PlayListWidget::addAllMusicToList() { 323void PlayListWidget::addAllMusicToList() {
277 if(!audioScan) 324
325 if(!audioScan) {
326 if(audioView->childCount() < 1)
327 populateAudioView();
328 }
329
330 QListViewItemIterator audioIt( audioView );
331 DocLnk lnk;
332 QString filename;
333 // iterate through all items of the listview
334 for ( ; audioIt.current(); ++audioIt ) {
335 filename = audioIt.current()->text(3);
336 lnk.setName( QFileInfo(filename).baseName() ); //sets name
337 lnk.setFile( filename ); //sets file name
338 d->selectedFiles->addToSelection( lnk);
339 }
340
341 /* if(!audioScan)
278 scanForAudio(); 342 scanForAudio();
279 QListIterator<DocLnk> dit( files.children() ); 343 QListIterator<DocLnk> dit( files.children() );
280 for ( ; dit.current(); ++dit ) { 344 for ( ; dit.current(); ++dit ) {
@@ -282,6 +346,7 @@ void PlayListWidget::addAllMusicToList() {
282 d->selectedFiles->addToSelection( **dit ); 346 d->selectedFiles->addToSelection( **dit );
283 } 347 }
284 } 348 }
349 */
285 tabWidget->setCurrentPage(0); 350 tabWidget->setCurrentPage(0);
286 writeCurrentM3u(); 351 writeCurrentM3u();
287 d->selectedFiles->first(); 352 d->selectedFiles->first();
@@ -289,7 +354,24 @@ void PlayListWidget::addAllMusicToList() {
289 354
290 355
291void PlayListWidget::addAllVideoToList() { 356void PlayListWidget::addAllVideoToList() {
292 if(!videoScan) 357
358 if(!videoScan) {
359 if(videoView->childCount() < 1)
360 populateVideoView();
361 }
362
363 QListViewItemIterator videoIt( videoView );
364 DocLnk lnk;
365 QString filename;
366 for ( ; videoIt.current(); ++videoIt ) {
367 filename = videoIt.current()->text(3);
368 lnk.setName( QFileInfo(filename).baseName() ); //sets name
369 lnk.setFile( filename ); //sets file name
370 d->selectedFiles->addToSelection( lnk);
371 }
372
373
374 /* if(!videoScan)
293 scanForVideo(); 375 scanForVideo();
294 QListIterator<DocLnk> dit( vFiles.children() ); 376 QListIterator<DocLnk> dit( vFiles.children() );
295 for ( ; dit.current(); ++dit ) { 377 for ( ; dit.current(); ++dit ) {
@@ -297,6 +379,7 @@ void PlayListWidget::addAllVideoToList() {
297 d->selectedFiles->addToSelection( **dit ); 379 d->selectedFiles->addToSelection( **dit );
298 } 380 }
299 } 381 }
382*/
300 tabWidget->setCurrentPage(0); 383 tabWidget->setCurrentPage(0);
301 writeCurrentM3u(); 384 writeCurrentM3u();
302 d->selectedFiles->first(); 385 d->selectedFiles->first();