diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/divelist.c | 9 | ||||
-rw-r--r-- | core/qthelper.cpp | 6 | ||||
-rw-r--r-- | core/qthelper.h | 2 | ||||
-rw-r--r-- | core/subsurface-qt/divelistnotifier.h | 3 |
4 files changed, 20 insertions, 0 deletions
diff --git a/core/divelist.c b/core/divelist.c index 4325df595..f224b3414 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -835,6 +835,9 @@ void process_loaded_dives() autogroup_dives(&dive_table, &trip_table); fulltext_populate(); + + /* Inform frontend of reset data. This should reset all the models. */ + emit_reset_signal(); } /* @@ -1045,6 +1048,9 @@ void add_imported_dives(struct dive_table *import_table, struct trip_table *impo * Choose the newest dive as selected (if any) */ current_dive = dive_table.nr > 0 ? dive_table.dives[dive_table.nr - 1] : NULL; mark_divelist_changed(true); + + /* Inform frontend of reset data. This should reset all the models. */ + emit_reset_signal(); } /* Helper function for process_imported_dives(): @@ -1373,6 +1379,9 @@ void clear_dive_file_data() reset_min_datafile_version(); clear_git_id(); + + /* Inform frontend of reset data. This should reset all the models. */ + emit_reset_signal(); } bool dive_less_than(const struct dive *a, const struct dive *b) diff --git a/core/qthelper.cpp b/core/qthelper.cpp index e543ad1c1..c5ab24427 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -3,6 +3,7 @@ #include "dive.h" #include "core/settings/qPrefLanguage.h" #include "core/settings/qPrefUpdateManager.h" +#include "core/subsurface-qt/divelistnotifier.h" #include "subsurface-string.h" #include "subsurface-string.h" #include "gettextfromc.h" @@ -1675,3 +1676,8 @@ std::vector<int> get_cylinder_map_for_add(int count, int n) std::iota(mapping.begin() + n, mapping.end(), n + 1); return mapping; } + +extern "C" void emit_reset_signal() +{ + emit diveListNotifier.dataReset(); +} diff --git a/core/qthelper.h b/core/qthelper.h index 8bb0bbdfa..8cd31b29c 100644 --- a/core/qthelper.h +++ b/core/qthelper.h @@ -155,6 +155,8 @@ pressure_t string_to_pressure(const char *str); volume_t string_to_volume(const char *str, pressure_t workp); fraction_t string_to_fraction(const char *str); char *get_changes_made(); +void emit_reset_signal(); + #ifdef __cplusplus } #endif diff --git a/core/subsurface-qt/divelistnotifier.h b/core/subsurface-qt/divelistnotifier.h index 2931e443e..aa82a4bef 100644 --- a/core/subsurface-qt/divelistnotifier.h +++ b/core/subsurface-qt/divelistnotifier.h @@ -78,6 +78,9 @@ struct TripField { class DiveListNotifier : public QObject { Q_OBJECT signals: + // The core structures were completely reset. Repopulate all models. + void dataReset(); + // Note that there are no signals for trips being added and created // because these events never happen without a dive being added, removed or moved. // The dives are always sorted according to the dives_less_than() function of the core. |