diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2020-02-17 17:16:11 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-03-07 18:47:34 -0800 |
commit | 7d9e907681cd48d7fa013e05d4b90160ee593426 (patch) | |
tree | 9e8770d9b22a1640cc8ce48a1dc008d14a66cbca | |
parent | 45d37fd51b06680e8b2e75973217e8663597ede3 (diff) | |
download | subsurface-7d9e907681cd48d7fa013e05d4b90160ee593426.tar.gz |
debug: try to capture changes that don't invalidate git cache
At least in those cases where we are sending a divesChanged signal we can
easily check if the cache was properly invalidated. Of course this won't help
in cases where we don't notify the dive list about changes, either.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r-- | commands/command_edit.cpp | 1 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.cpp | 17 | ||||
-rw-r--r-- | desktop-widgets/mainwindow.h | 2 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.cpp | 15 | ||||
-rw-r--r-- | mobile-widgets/qmlmanager.h | 2 |
5 files changed, 34 insertions, 3 deletions
diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp index 80a7ac986..1a9684e1f 100644 --- a/commands/command_edit.cpp +++ b/commands/command_edit.cpp @@ -688,7 +688,6 @@ void EditTagsBase::undo() #else emit diveListNotifier.divesChanged(QVector<dive *>::fromStdVector(dives), id); #endif - setSelection(selectedDives, current); } diff --git a/desktop-widgets/mainwindow.cpp b/desktop-widgets/mainwindow.cpp index 1ad9a3308..9d2b31136 100644 --- a/desktop-widgets/mainwindow.cpp +++ b/desktop-widgets/mainwindow.cpp @@ -37,8 +37,6 @@ #include "core/settings/qPrefPartialPressureGas.h" #include "core/settings/qPrefTechnicalDetails.h" -#include "core/subsurface-qt/divelistnotifier.h" - #include "desktop-widgets/about.h" #include "desktop-widgets/divecomputermanagementdialog.h" #include "desktop-widgets/divelistview.h" @@ -218,6 +216,11 @@ MainWindow::MainWindow() : QMainWindow(), connect(&windowTitleUpdate, &WindowTitleUpdate::updateTitle, this, &MainWindow::setAutomaticTitle); connect(&diveListNotifier, &DiveListNotifier::numShownChanged, this, &MainWindow::setAutomaticTitle); + // monitor when dives changed - but only in verbose mode + // careful - changing verbose at runtime isn't enough (of course that could be added if we want it) + if (verbose) + connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &MainWindow::divesChanged); + #ifdef NO_PRINTING plannerDetails->printPlan()->hide(); ui.menuFile->removeAction(ui.actionPrint); @@ -1944,3 +1947,13 @@ void MainWindow::unsetProfTissues() ui.profTissues->setChecked(false); qPrefTechnicalDetails::set_percentagegraph(false); } + +void MainWindow::divesChanged(const QVector<dive *> &dives, DiveField field) +{ + Q_UNUSED(field) + for (struct dive *d: dives) { + qDebug() << "dive #" << d->number << "changed, cache is" << (dive_cache_is_valid(d) ? "valid" : "invalidated"); + // a brute force way to deal with that would of course be to call + // invalidate_dive_cache(d); + } +} diff --git a/desktop-widgets/mainwindow.h b/desktop-widgets/mainwindow.h index 109ca0e0c..247bddaf3 100644 --- a/desktop-widgets/mainwindow.h +++ b/desktop-widgets/mainwindow.h @@ -22,6 +22,7 @@ #include "core/applicationstate.h" #include "core/gpslocation.h" #include "core/dive.h" +#include "core/subsurface-qt/divelistnotifier.h" #define NUM_RECENT_FILES 4 @@ -252,6 +253,7 @@ private: GpsLocation *locationProvider; QMenu *connections; QAction *share_on_fb; + void divesChanged(const QVector<dive *> &dives, DiveField field); }; #endif // MAINWINDOW_H diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index 4f16cf1d0..06d93ce2c 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -264,6 +264,11 @@ QMLManager::QMLManager() : m_locationServiceEnabled(false), what.tags = true; what.cylinders = true; what.weights = true; + + // monitor when dives changed - but only in verbose mode + // careful - changing verbose at runtime isn't enough (of course that could be added if we want it) + if (verbose) + connect(&diveListNotifier, &DiveListNotifier::divesChanged, this, &QMLManager::divesChanged); } void QMLManager::applicationStateChanged(Qt::ApplicationState state) @@ -2189,3 +2194,13 @@ void QMLManager::setOldStatus(const qPrefCloudStorage::cloud_status value) emit oldStatusChanged(); } } + +void QMLManager::divesChanged(const QVector<dive *> &dives, DiveField field) +{ + Q_UNUSED(field) + for (struct dive *d: dives) { + qDebug() << "dive #" << d->number << "changed, cache is" << (dive_cache_is_valid(d) ? "valid" : "invalidated"); + // a brute force way to deal with that would of course be to call + // invalidate_dive_cache(d); + } +} diff --git a/mobile-widgets/qmlmanager.h b/mobile-widgets/qmlmanager.h index 466413dd3..145a3df17 100644 --- a/mobile-widgets/qmlmanager.h +++ b/mobile-widgets/qmlmanager.h @@ -17,6 +17,7 @@ #include "qt-models/completionmodels.h" #include "qt-models/divelocationmodel.h" #include "core/settings/qPrefCloudStorage.h" +#include "core/subsurface-qt/divelistnotifier.h" #define NOCLOUD_LOCALSTORAGE format_string("%s/cloudstorage/localrepo[master]", system_default_directory()) @@ -226,6 +227,7 @@ public slots: void hasLocationSourceChanged(); void btRescan(); void showDownloadPage(QString deviceString); + void divesChanged(const QVector<dive *> &dives, DiveField field); private: BuddyCompletionModel buddyModel; |