From fed2c5b6a1c71649bcb310c0bd118cb1abcf9ea0 Mon Sep 17 00:00:00 2001 From: Jan Mulder Date: Sun, 28 Jan 2018 09:52:51 +0100 Subject: mobile cleanup: unduplicate code and do not loop over dives (1) This is the first of a set of commits that are (very) similar. It appeared that a number of more or less static lists, which are constructed by a loop over all dives in the logbook, were executed when changing focus to a next dive. For example, the in this commit addressed list of used dive suits. What was wrong was that the suitList was linked to a dive. There is only a need to construct the list of used suits when data is changed (and obviously, once on startup of the app). Further, it appeared that a lot of code was duplicated and that we can use (in this case) the same code from the desktop completionmodels.cpp. Basically, this commit involves the following changes: - include completionmodels.cpp in mobile and desktop (so move it from the desktop only category to the generic category). - remove double code from DiveObjectHelper.cpp - Do not differentiate in the init phase and the normal refresh of the list - the per dive logic is now only the getting of a previously constructed list (in init or update of the divelist). There are no visible changes in the UI, other than a better performance when scrolling over dive details. Signed-off-by: Jan Mulder --- qt-models/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'qt-models') diff --git a/qt-models/CMakeLists.txt b/qt-models/CMakeLists.txt index 0f80740c6..f24f6d2a5 100644 --- a/qt-models/CMakeLists.txt +++ b/qt-models/CMakeLists.txt @@ -5,6 +5,7 @@ set(SUBSURFACE_GENERIC_MODELS_LIB_SRCS diveplotdatamodel.cpp diveimportedmodel.cpp + completionmodels.cpp ) # models exclusively used in desktop builds @@ -24,7 +25,6 @@ set(SUBSURFACE_DESKTOP_MODELS_LIB_SRCS divetripmodel.cpp diveplannermodel.cpp divecomputerextradatamodel.cpp - completionmodels.cpp divelocationmodel.cpp ssrfsortfilterproxymodel.cpp ) -- cgit v1.2.3-70-g09d2