From 35b8a4f404de3297cb8d126654e0ec37245a7537 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 23 Sep 2018 12:53:35 +0200 Subject: Core: split process_dives() in post-import and post-load versions process_dives() is used to post-process the dive table after loading or importing. The first parameter states whether this was after load or import. Especially in the light of undo, load and import are fundamentally different things. Notably, that latter should be undo-able, whereas the former is not. Therefore, as a first step to make import undo-able, split the function in two versions and remove the first parameter. It turns out the the load-version is very light. It only sets the DC nicknames and sorts the dive-table. There seems to be no reason to merge dives. Signed-off-by: Berthold Stoeger --- mobile-widgets/qmlmanager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'mobile-widgets') diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index aa9cf3d75..7df920478 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -288,7 +288,7 @@ void QMLManager::openLocalThenRemote(QString url) qPrefTechnicalDetails::set_show_ccr_setpoint(git_prefs.show_ccr_setpoint); qPrefTechnicalDetails::set_show_ccr_sensors(git_prefs.show_ccr_sensors); qPrefPartialPressureGas::set_po2(git_prefs.pp_graphs.po2); - process_dives(false, false); + process_loaded_dives(); DiveListModel::instance()->clear(); DiveListModel::instance()->addAllDives(); appendTextToLog(QStringLiteral("%1 dives loaded from cache").arg(dive_table.nr)); @@ -326,7 +326,7 @@ void QMLManager::mergeLocalRepo() { char *filename = NOCLOUD_LOCALSTORAGE; parse_file(filename, &dive_table); - process_dives(true, false); + process_imported_dives(false); } void QMLManager::copyAppLogToClipboard() @@ -735,7 +735,7 @@ void QMLManager::consumeFinishedLoad(timestamp_t currentDiveTimestamp) prefs.show_ccr_sensors = git_prefs.show_ccr_sensors; prefs.pp_graphs.po2 = git_prefs.pp_graphs.po2; DiveListModel::instance()->clear(); - process_dives(false, false); + process_loaded_dives(); DiveListModel::instance()->addAllDives(); if (currentDiveTimestamp) setUpdateSelectedDive(dlSortModel->getIdxForId(get_dive_id_closest_to(currentDiveTimestamp))); -- cgit v1.2.3-70-g09d2