summaryrefslogtreecommitdiffstats
path: root/mobile-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-01-02 08:33:37 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-10 09:25:57 -0700
commit2a88ff0ffb7addd086157595e073358595d474b7 (patch)
treeeaff39fd17bb10a55948e48a3dd4b7b15291177a /mobile-widgets
parent5493e7cbf696c79758f2dacaba6d7109d00dea6b (diff)
downloadsubsurface-2a88ff0ffb7addd086157595e073358595d474b7.tar.gz
mobile: reduce the number of model reloads when opening cloud data
The whole load from cloud thing will have to be audited. It appears to me that there are way too many model resets...? The only thing that is left is dive editing. Let's do that next. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'mobile-widgets')
-rw-r--r--mobile-widgets/qmlmanager.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp
index b7a36f156..67f0f53ba 100644
--- a/mobile-widgets/qmlmanager.cpp
+++ b/mobile-widgets/qmlmanager.cpp
@@ -299,7 +299,6 @@ void QMLManager::applicationStateChanged(Qt::ApplicationState state)
void QMLManager::openLocalThenRemote(QString url)
{
- DiveListModel::instance()->clear();
MobileModels::instance()->clear();
setNotificationText(tr("Open local dive data file"));
QByteArray fileNamePrt = QFile::encodeName(url);
@@ -337,7 +336,6 @@ void QMLManager::openLocalThenRemote(QString url)
qPrefTechnicalDetails::set_show_ccr_sensors(git_prefs.show_ccr_sensors);
qPrefPartialPressureGas::set_po2(git_prefs.pp_graphs.po2);
process_loaded_dives();
- DiveListModel::instance()->reload();
MobileModels::instance()->reset();
appendTextToLog(QStringLiteral("%1 dives loaded from cache").arg(dive_table.nr));
setNotificationText(tr("%1 dives loaded from local dive data file").arg(dive_table.nr));
@@ -581,7 +579,6 @@ void QMLManager::saveCloudCredentials(const QString &newEmail, const QString &ne
manager()->clearAccessCache(); // remove any chached credentials
clear_git_id(); // invalidate our remembered GIT SHA
MobileModels::instance()->clear();
- DiveListModel::instance()->reload();
GpsListModel::instance()->clear();
setStartPageText(tr("Attempting to open cloud storage with new credentials"));
// we therefore know that no one else is already accessing THIS git repo;
@@ -769,7 +766,7 @@ void QMLManager::loadDivesWithValidCredentials()
// if we aren't switching from no-cloud mode, let's clear the dive data
if (!noCloudToCloud) {
appendTextToLog("Clear out in memory dive data");
- DiveListModel::instance()->clear();
+ MobileModels::instance()->clear();
} else {
appendTextToLog("Switching from no cloud mode; keep in memory dive data");
}
@@ -800,7 +797,7 @@ successful_exit:
if (noCloudToCloud) {
git_storage_update_progress(qPrintable(tr("Loading dives from local storage ('no cloud' mode)")));
mergeLocalRepo();
- DiveListModel::instance()->reload();
+ MobileModels::instance()->reset();
appendTextToLog(QStringLiteral("%1 dives loaded after importing nocloud local storage").arg(dive_table.nr));
noCloudToCloud = false;
mark_divelist_changed(true);
@@ -863,7 +860,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;
process_loaded_dives();
- DiveListModel::instance()->reload();
+ MobileModels::instance()->reset();
if (currentDiveTimestamp)
setUpdateSelectedDive(DiveListSortModel::instance()->getIdxForId(get_dive_id_closest_to(currentDiveTimestamp)));
appendTextToLog(QStringLiteral("%1 dives loaded").arg(dive_table.nr));
@@ -874,7 +871,7 @@ void QMLManager::consumeFinishedLoad(timestamp_t currentDiveTimestamp)
void QMLManager::refreshDiveList()
{
- DiveListModel::instance()->reload();
+ MobileModels::instance()->reset();
}
void QMLManager::setupDivesite(struct dive *d, struct dive_site *ds, double lat, double lon, const char *locationtext)