summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.cpp14
-rw-r--r--noncore/multimedia/opieplayer2/playlistfileview.h1
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.cpp30
-rw-r--r--noncore/multimedia/opieplayer2/playlistwidget.h3
4 files changed, 20 insertions, 28 deletions
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.cpp b/noncore/multimedia/opieplayer2/playlistfileview.cpp
index 0ed1061..cb16415 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.cpp
+++ b/noncore/multimedia/opieplayer2/playlistfileview.cpp
@@ -6,7 +6,8 @@
6#include <qpe/resource.h> 6#include <qpe/resource.h>
7 7
8PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name ) 8PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name )
9 : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_itemPixmapName( itemPixmapName ), m_scannedFiles( false ) 9 : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_itemPixmapName( itemPixmapName ), m_scannedFiles( false ),
10 m_viewPopulated( false )
10{ 11{
11 addColumn( tr( "Title" ), 140); 12 addColumn( tr( "Title" ), 140);
12 addColumn( tr( "Size" ), -1 ); 13 addColumn( tr( "Size" ), -1 );
@@ -32,17 +33,28 @@ void PlayListFileView::scanFiles()
32 delete sdit.current(); 33 delete sdit.current();
33 34
34 Global::findDocuments( &m_files, m_mimeTypePattern ); 35 Global::findDocuments( &m_files, m_mimeTypePattern );
36
37 if ( m_viewPopulated ) {
38 m_viewPopulated = false;
39 populateView();
40 }
35} 41}
36 42
37void PlayListFileView::populateView() 43void PlayListFileView::populateView()
38{ 44{
45 if ( m_viewPopulated )
46 return;
47
39 clear(); 48 clear();
40 49
41 if( !m_scannedFiles ) { 50 if( !m_scannedFiles ) {
51 m_viewPopulated = false; // avoid a recursion :)
42 scanFiles(); 52 scanFiles();
43 m_scannedFiles = true; 53 m_scannedFiles = true;
44 } 54 }
45 55
56 m_viewPopulated = true;
57
46 QString storage; 58 QString storage;
47 QListIterator<DocLnk> dit( m_files.children() ); 59 QListIterator<DocLnk> dit( m_files.children() );
48 for ( ; dit.current(); ++dit ) { 60 for ( ; dit.current(); ++dit ) {
diff --git a/noncore/multimedia/opieplayer2/playlistfileview.h b/noncore/multimedia/opieplayer2/playlistfileview.h
index a00349e..448473e 100644
--- a/noncore/multimedia/opieplayer2/playlistfileview.h
+++ b/noncore/multimedia/opieplayer2/playlistfileview.h
@@ -26,6 +26,7 @@ private:
26 QString m_itemPixmapName; 26 QString m_itemPixmapName;
27 DocLnkSet m_files; 27 DocLnkSet m_files;
28 bool m_scannedFiles; 28 bool m_scannedFiles;
29 bool m_viewPopulated;
29}; 30};
30 31
31#endif // PLAYLISTFILEVIEW_H 32#endif // PLAYLISTFILEVIEW_H
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.cpp b/noncore/multimedia/opieplayer2/playlistwidget.cpp
index 460a0bf..eb0606d 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.cpp
+++ b/noncore/multimedia/opieplayer2/playlistwidget.cpp
@@ -151,8 +151,6 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
151 &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); 151 &mediaPlayerState, SLOT( setVideoGamma( int ) ) );
152 152
153 // see which skins are installed 153 // see which skins are installed
154 audioPopulated=false;
155 videoPopulated=false;
156 populateSkinsMenu(); 154 populateSkinsMenu();
157 initializeStates(); 155 initializeStates();
158 156
@@ -254,7 +252,7 @@ void PlayListWidget::addAllToList() {
254 252
255 if(!audioView->scannedFiles()) { 253 if(!audioView->scannedFiles()) {
256 if(audioView->childCount() < 1) 254 if(audioView->childCount() < 1)
257 populateAudioView(); 255 audioView->populateView();
258 } 256 }
259 257
260 QListViewItemIterator audioIt( audioView ); 258 QListViewItemIterator audioIt( audioView );
@@ -270,7 +268,7 @@ void PlayListWidget::addAllToList() {
270 268
271 if(!videoView->scannedFiles()) { 269 if(!videoView->scannedFiles()) {
272 if(videoView->childCount() < 1) 270 if(videoView->childCount() < 1)
273 populateVideoView(); 271 videoView->populateView();
274 } 272 }
275 273
276 QListViewItemIterator videoIt( videoView ); 274 QListViewItemIterator videoIt( videoView );
@@ -314,7 +312,7 @@ void PlayListWidget::addAllMusicToList() {
314 312
315 if(!audioView->scannedFiles()) { 313 if(!audioView->scannedFiles()) {
316 if(audioView->childCount() < 1) 314 if(audioView->childCount() < 1)
317 populateAudioView(); 315 audioView->populateView();
318 } 316 }
319 317
320 QListViewItemIterator audioIt( audioView ); 318 QListViewItemIterator audioIt( audioView );
@@ -347,7 +345,7 @@ void PlayListWidget::addAllVideoToList() {
347 345
348 if(!videoView->scannedFiles()) { 346 if(!videoView->scannedFiles()) {
349 if(videoView->childCount() < 1) 347 if(videoView->childCount() < 1)
350 populateVideoView(); 348 videoView->populateView();
351 } 349 }
352 350
353 QListViewItemIterator videoIt( videoView ); 351 QListViewItemIterator videoIt( videoView );
@@ -572,8 +570,7 @@ void PlayListWidget::tabChanged(QWidget *) {
572 break; 570 break;
573 case AudioFiles: 571 case AudioFiles:
574 { 572 {
575 // audioView->clear(); 573 audioView->populateView();
576 if(!audioPopulated) populateAudioView();
577 574
578 if( !tbDeletePlaylist->isHidden() ) { 575 if( !tbDeletePlaylist->isHidden() ) {
579 tbDeletePlaylist->hide(); 576 tbDeletePlaylist->hide();
@@ -584,8 +581,7 @@ void PlayListWidget::tabChanged(QWidget *) {
584 break; 581 break;
585 case VideoFiles: 582 case VideoFiles:
586 { 583 {
587 // videoView->clear(); 584 videoView->populateView();
588 if(!videoPopulated) populateVideoView();
589 if( !tbDeletePlaylist->isHidden() ) { 585 if( !tbDeletePlaylist->isHidden() ) {
590 tbDeletePlaylist->hide(); 586 tbDeletePlaylist->hide();
591 } 587 }
@@ -636,24 +632,10 @@ void PlayListWidget::playSelected() {
636 632
637void PlayListWidget::scanForAudio() { 633void PlayListWidget::scanForAudio() {
638 audioView->scanFiles(); 634 audioView->scanFiles();
639 audioView->scannedFiles() = true;
640 populateAudioView();
641} 635}
642 636
643void PlayListWidget::scanForVideo() { 637void PlayListWidget::scanForVideo() {
644 videoView->scanFiles(); 638 videoView->scanFiles();
645 videoView->scannedFiles() = true;
646 populateVideoView();
647}
648
649void PlayListWidget::populateAudioView() {
650 audioView->populateView();
651 audioPopulated = true;
652}
653
654void PlayListWidget::populateVideoView() {
655 videoView->populateView();
656 videoPopulated=true;
657} 639}
658 640
659QListView *PlayListWidget::currentFileListView() const 641QListView *PlayListWidget::currentFileListView() const
diff --git a/noncore/multimedia/opieplayer2/playlistwidget.h b/noncore/multimedia/opieplayer2/playlistwidget.h
index 58efd47..8c22f17 100644
--- a/noncore/multimedia/opieplayer2/playlistwidget.h
+++ b/noncore/multimedia/opieplayer2/playlistwidget.h
@@ -94,12 +94,9 @@ signals:
94 94
95private: 95private:
96 int defaultSkinIndex; 96 int defaultSkinIndex;
97 bool audioPopulated, videoPopulated;
98 void readm3u(const QString &); 97 void readm3u(const QString &);
99 void readPls(const QString &); 98 void readPls(const QString &);
100 void initializeStates(); 99 void initializeStates();
101 void populateAudioView();
102 void populateVideoView();
103 100
104 QListView *currentFileListView() const; 101 QListView *currentFileListView() const;
105 102