From b4c7b92facbbd6fb8617d0970440db0f953b72c2 Mon Sep 17 00:00:00 2001 From: David Sansome Date: Fri, 15 Jan 2010 16:36:34 +0000 Subject: [PATCH] Don't lazy populate all the children of library items --- TODO | 1 - src/library.cpp | 8 ++++++++ src/library.h | 1 + 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/TODO b/TODO index 923292aca..4651128f8 100644 --- a/TODO +++ b/TODO @@ -5,7 +5,6 @@ - Copy to library, move to library - Edit tags in the playlist - Global shortcut keys -- Make QSortFilterProxyModel on the library obey hasChildren() - Database versioning - Clicking play plays selected item diff --git a/src/library.cpp b/src/library.cpp index 80b3a1a0a..4fb0715a4 100644 --- a/src/library.cpp +++ b/src/library.cpp @@ -502,3 +502,11 @@ void Library::SetFilterText(const QString& text) { query_options_.filter = text; Reset(); } + +bool Library::canFetchMore(const QModelIndex &parent) const { + if (!parent.isValid()) + return false; + + LibraryItem* item = IndexToItem(parent); + return !item->lazy_loaded; +} diff --git a/src/library.h b/src/library.h index 82edc470b..3c19bf1d6 100644 --- a/src/library.h +++ b/src/library.h @@ -39,6 +39,7 @@ class Library : public SimpleTreeModel { Qt::ItemFlags flags(const QModelIndex& index) const; QStringList mimeTypes() const; QMimeData* mimeData(const QModelIndexList& indexes) const; + bool canFetchMore(const QModelIndex &parent) const; signals: void Error(const QString& message);