From e99c4c90592c9dba17d5cbb9a99d0bf458fb53d2 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Tue, 12 Mar 2019 17:28:43 +0100 Subject: Dive site: introduce proxy model DiveSiteSortedModel The LocationInformationModel used to sort its entries and was completely rebuilt after every change. This makes it rather complex to support incremental changes. Instead, keep LocationInformationModel sorted by UUID so that indexes are consistent with indices in the core dive site table. Implement sorting by other columns than name and enable sorting in the dive site view. Finally, don't cache the list of dive site names for the mobile app, since that would also need some rather convoluted methods of keeping the list up to date. Calculate it on the fly. Signed-off-by: Berthold Stoeger --- mobile-widgets/qmlmanager.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'mobile-widgets/qmlmanager.cpp') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index d312fac00..9b52ee211 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -223,6 +223,9 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), set_git_update_cb(&gitProgressCB); LOG_STP("qmlmgr git update"); + // present dive site lists sorted by name + locationModel.sort(LocationInformationModel::NAME); + // make sure we know if the current cloud repo has been successfully synced syncLoadFromCloud(); LOG_STP("qmlmgr sync load cloud"); @@ -334,7 +337,8 @@ void QMLManager::updateAllGlobalLists() buddyModel.updateModel(); emit buddyListChanged(); suitModel.updateModel(); emit suitListChanged(); divemasterModel.updateModel(); emit divemasterListChanged(); - locationModel.update(); emit locationListChanged(); + // TODO: Probably not needed anymore, as the dive site list is generated on the fly! + LocationInformationModel::instance()->update(); emit locationListChanged(); } void QMLManager::mergeLocalRepo() -- cgit v1.2.3-70-g09d2