-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 @@ -5,9 +5,10 @@ #include <qpe/global.h> #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 ); addColumn(tr( "Media" ), 0 ); @@ -31,19 +32,30 @@ void PlayListFileView::scanFiles() for ( ; sdit.current(); ++sdit ) 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 @@ -25,8 +25,9 @@ private: QString m_mimeTypePattern; QString m_itemPixmapName; DocLnkSet m_files; bool m_scannedFiles; + bool m_viewPopulated; }; #endif // PLAYLISTFILEVIEW_H /* vim: et sw=4 ts=4 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 @@ -150,10 +150,8 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par connect ( gammaSlider, SIGNAL( valueChanged( int ) ), &mediaPlayerState, SLOT( setVideoGamma( int ) ) ); // see which skins are installed - audioPopulated=false; - videoPopulated=false; populateSkinsMenu(); initializeStates(); cfg.setGroup("PlayList"); @@ -253,9 +251,9 @@ void PlayListWidget::addAllToList() { // t.start(); if(!audioView->scannedFiles()) { if(audioView->childCount() < 1) - populateAudioView(); + audioView->populateView(); } QListViewItemIterator audioIt( audioView ); DocLnk lnk; @@ -269,9 +267,9 @@ void PlayListWidget::addAllToList() { } if(!videoView->scannedFiles()) { if(videoView->childCount() < 1) - populateVideoView(); + videoView->populateView(); } QListViewItemIterator videoIt( videoView ); for ( ; videoIt.current(); ++videoIt ) { @@ -313,9 +311,9 @@ void PlayListWidget::addAllToList() { void PlayListWidget::addAllMusicToList() { if(!audioView->scannedFiles()) { if(audioView->childCount() < 1) - populateAudioView(); + audioView->populateView(); } QListViewItemIterator audioIt( audioView ); DocLnk lnk; @@ -346,9 +344,9 @@ void PlayListWidget::addAllMusicToList() { void PlayListWidget::addAllVideoToList() { if(!videoView->scannedFiles()) { if(videoView->childCount() < 1) - populateVideoView(); + videoView->populateView(); } QListViewItemIterator videoIt( videoView ); DocLnk lnk; @@ -571,10 +569,9 @@ void PlayListWidget::tabChanged(QWidget *) { } break; case AudioFiles: { - // audioView->clear(); - if(!audioPopulated) populateAudioView(); + audioView->populateView(); if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } @@ -583,10 +580,9 @@ void PlayListWidget::tabChanged(QWidget *) { } break; case VideoFiles: { - // videoView->clear(); - if(!videoPopulated) populateVideoView(); + videoView->populateView(); if( !tbDeletePlaylist->isHidden() ) { tbDeletePlaylist->hide(); } d->tbRemoveFromList->setEnabled(FALSE); @@ -635,26 +631,12 @@ 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 @@ -93,14 +93,11 @@ signals: void skinSelected(); private: int defaultSkinIndex; - bool audioPopulated, videoPopulated; void readm3u(const QString &); void readPls(const QString &); void initializeStates(); - void populateAudioView(); - void populateVideoView(); QListView *currentFileListView() const; bool inFileListMode() const; |