summaryrefslogtreecommitdiffstats
path: root/desktop-widgets
diff options
context:
space:
mode:
Diffstat (limited to 'desktop-widgets')
-rw-r--r--desktop-widgets/mainwindow.cpp17
-rw-r--r--desktop-widgets/mainwindow.h2
2 files changed, 17 insertions, 2 deletions
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