Dont load folder list until view is visible.

This commit is contained in:
craig.p.drummond
2013-11-15 19:40:02 +00:00
committed by craig.p.drummond
parent afd5082a43
commit abc18ca1a7
4 changed files with 13 additions and 1 deletions

View File

@@ -107,6 +107,9 @@
by the artist.
59. Show device copy/delete status in Unity launcher - show current progress,
and track count to be actioned.
60. If playlists page is disabled, then hide 'Add to playlist' actions ahd hide
playqueue save button.
61. Dont load folder list until view is visible.
1.1.3
-----

View File

@@ -35,6 +35,7 @@
FolderPage::FolderPage(QWidget *p)
: QWidget(p)
, loaded(false)
{
setupUi(this);
addToPlayQueue->setDefaultAction(StdActions::self()->addToPlayQueueAction);
@@ -98,6 +99,7 @@ void FolderPage::setEnabled(bool e)
connect(MPDConnection::self(), SIGNAL(updatedFileList()), view, SLOT(hideSpinner()));
refresh();
} else {
loaded=false;
disconnect(MPDConnection::self(), SIGNAL(updatingFileList()), view, SLOT(showSpinner()));
disconnect(MPDConnection::self(), SIGNAL(updatedFileList()), view, SLOT(hideSpinner()));
}
@@ -105,10 +107,11 @@ void FolderPage::setEnabled(bool e)
void FolderPage::refresh()
{
if (DirViewModel::self()->isEnabled()) {
if (DirViewModel::self()->isEnabled() && isVisible()) {
view->setLevel(0);
view->showSpinner();
emit loadFolders();
loaded=true;
}
}
@@ -121,6 +124,10 @@ void FolderPage::showEvent(QShowEvent *e)
{
view->focusView();
QWidget::showEvent(e);
if (!loaded) {
emit loadFolders();
loaded=true;
}
}
void FolderPage::searchItems()

View File

@@ -80,6 +80,7 @@ private:
QStringList walk(QModelIndex rootItem);
private:
bool loaded;
#ifndef Q_OS_WIN
Action *browseAction;
#endif

View File

@@ -79,6 +79,7 @@ void DirViewModel::setEnabled(bool e)
if (enabled) {
connect(MPDConnection::self(), SIGNAL(dirViewUpdated(DirViewItemRoot *)), this, SLOT(updateDirView(DirViewItemRoot *)));
} else {
clear();
disconnect(MPDConnection::self(), SIGNAL(dirViewUpdated(DirViewItemRoot *)), this, SLOT(updateDirView(DirViewItemRoot *)));
}
}