summaryrefslogtreecommitdiff
Side-by-side diff
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
@@ -7,5 +7,6 @@
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);
@@ -33,15 +34,26 @@ void PlayListFileView::scanFiles()
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() );
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
@@ -27,4 +27,5 @@ private:
DocLnkSet m_files;
bool m_scannedFiles;
+ bool m_viewPopulated;
};
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
@@ -152,6 +152,4 @@ PlayListWidget::PlayListWidget( MediaPlayerState &mediaPlayerState, QWidget* par
// see which skins are installed
- audioPopulated=false;
- videoPopulated=false;
populateSkinsMenu();
initializeStates();
@@ -255,5 +253,5 @@ void PlayListWidget::addAllToList() {
if(!audioView->scannedFiles()) {
if(audioView->childCount() < 1)
- populateAudioView();
+ audioView->populateView();
}
@@ -271,5 +269,5 @@ void PlayListWidget::addAllToList() {
if(!videoView->scannedFiles()) {
if(videoView->childCount() < 1)
- populateVideoView();
+ videoView->populateView();
}
@@ -315,5 +313,5 @@ void PlayListWidget::addAllMusicToList() {
if(!audioView->scannedFiles()) {
if(audioView->childCount() < 1)
- populateAudioView();
+ audioView->populateView();
}
@@ -348,5 +346,5 @@ void PlayListWidget::addAllVideoToList() {
if(!videoView->scannedFiles()) {
if(videoView->childCount() < 1)
- populateVideoView();
+ videoView->populateView();
}
@@ -573,6 +571,5 @@ void PlayListWidget::tabChanged(QWidget *) {
case AudioFiles:
{
- // audioView->clear();
- if(!audioPopulated) populateAudioView();
+ audioView->populateView();
if( !tbDeletePlaylist->isHidden() ) {
@@ -585,6 +582,5 @@ void PlayListWidget::tabChanged(QWidget *) {
case VideoFiles:
{
- // videoView->clear();
- if(!videoPopulated) populateVideoView();
+ videoView->populateView();
if( !tbDeletePlaylist->isHidden() ) {
tbDeletePlaylist->hide();
@@ -637,22 +633,8 @@ 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;
}
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
@@ -95,10 +95,7 @@ signals:
private:
int defaultSkinIndex;
- bool audioPopulated, videoPopulated;
void readm3u(const QString &);
void readPls(const QString &);
void initializeStates();
- void populateAudioView();
- void populateVideoView();
QListView *currentFileListView() const;