author | simon <simon> | 2002-12-04 11:40:01 (UTC) |
---|---|---|
committer | simon <simon> | 2002-12-04 11:40:01 (UTC) |
commit | 6a11cf48019e28006172cfb9a61e865816c3657e (patch) (side-by-side diff) | |
tree | 45634eded135f17fcdba8e4cb706e87f47f6d5f0 | |
parent | 84d5ca934e9cb8950d1efdb90ac3b00ce6d44e95 (diff) | |
download | opie-6a11cf48019e28006172cfb9a61e865816c3657e.zip opie-6a11cf48019e28006172cfb9a61e865816c3657e.tar.gz opie-6a11cf48019e28006172cfb9a61e865816c3657e.tar.bz2 |
- move more view population logic into PlayListFileView
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistfileview.cpp | 14 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistfileview.h | 1 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.cpp | 30 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/playlistwidget.h | 3 |
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 @@ #include <qpe/resource.h> PlayListFileView::PlayListFileView( const QString &mimeTypePattern, const QString &itemPixmapName, QWidget *parent, const char *name ) - : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_itemPixmapName( itemPixmapName ), m_scannedFiles( false ) + : PlayListView( parent, name ), m_mimeTypePattern( mimeTypePattern ), m_itemPixmapName( itemPixmapName ), m_scannedFiles( false ), + m_viewPopulated( false ) { addColumn( tr( "Title" ), 140); addColumn( tr( "Size" ), -1 ); @@ -32,17 +33,28 @@ void PlayListFileView::scanFiles() delete sdit.current(); Global::findDocuments( &m_files, m_mimeTypePattern ); + + if ( m_viewPopulated ) { + m_viewPopulated = false; + populateView(); + } } void PlayListFileView::populateView() { + if ( m_viewPopulated ) + return; + clear(); if( !m_scannedFiles ) { + m_viewPopulated = false; // avoid a recursion :) scanFiles(); m_scannedFiles = true; } + m_viewPopulated = true; + QString storage; QListIterator<DocLnk> dit( m_files.children() ); 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: QString m_itemPixmapName; DocLnkSet m_files; bool m_scannedFiles; + bool m_viewPopulated; }; #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 &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); // see which skins are installed - audioPopulated=false; - videoPopulated=false; populateSkinsMenu(); initializeStates(); @@ -254,7 +252,7 @@ void PlayListWidget::addAllToList() { if(!audioView->scannedFiles()) { if(audioView->childCount() < 1) - populateAudioView(); + audioView->populateView(); } QListViewItemIterator audioIt( audioView ); @@ -270,7 +268,7 @@ void PlayListWidget::addAllToList() { if(!videoView->scannedFiles()) { if(videoView->childCount() < 1) - populateVideoView(); + videoView->populateView(); } QListViewItemIterator videoIt( videoView ); @@ -314,7 +312,7 @@ void PlayListWidget::addAllMusicToList() { if(!audioView->scannedFiles()) { if(audioView->childCount() < 1) - populateAudioView(); + audioView->populateView(); } QListViewItemIterator audioIt( audioView ); @@ -347,7 +345,7 @@ void PlayListWidget::addAllVideoToList() { if(!videoView->scannedFiles()) { if(videoView->childCount() < 1) - populateVideoView(); + videoView->populateView(); } QListViewItemIterator videoIt( videoView ); @@ -572,8 +570,7 @@ void PlayListWidget::tabChanged(QWidget *) { break; case AudioFiles: { - // audioView->clear(); - if(!audioPopulated) populateAudioView(); + audioView->populateView(); if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); @@ -584,8 +581,7 @@ void PlayListWidget::tabChanged(QWidget *) { break; case VideoFiles: { - // videoView->clear(); - if(!videoPopulated) populateVideoView(); + videoView->populateView(); if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } @@ -636,24 +632,10 @@ void PlayListWidget::playSelected() { void PlayListWidget::scanForAudio() { audioView->scanFiles(); - audioView->scannedFiles() = true; - populateAudioView(); } void PlayListWidget::scanForVideo() { videoView->scanFiles(); - videoView->scannedFiles() = true; - populateVideoView(); -} - -void PlayListWidget::populateAudioView() { - audioView->populateView(); - audioPopulated = true; -} - -void PlayListWidget::populateVideoView() { - videoView->populateView(); - videoPopulated=true; } QListView *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: private: int defaultSkinIndex; - bool audioPopulated, videoPopulated; void readm3u(const QString &); void readPls(const QString &); void initializeStates(); - void populateAudioView(); - void populateVideoView(); QListView *currentFileListView() const; |