aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2021-01-11 11:14:41 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-01-11 08:42:17 -0800
commit5692f0d68aa1224cce7f2f25e66b8dd8663f2d66 (patch)
tree73442c5e20d80f540b274d22c79174ef98f08845
parent108f6fed2f383be32808a1eb5a6ac82d078d6330 (diff)
downloadsubsurface-5692f0d68aa1224cce7f2f25e66b8dd8663f2d66.tar.gz
undo: add missing invalidate_dive_cache() calls
The AddWeight, RemoveWeight, EditWeight and ReplanDive commands were missing invalidate_dive_cache() calls. Add them to ensure that the dives are written to git logs on save. Fixes #3150 Reported-by: Peter Zaal <peter.zaal@gmail.com> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--CHANGELOG.md1
-rw-r--r--commands/command_edit.cpp6
2 files changed, 7 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 663957818..1b058cb61 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,4 @@
+- undo: save to git after editing weights [#3159]
- desktop: complete rewrite of the statistics code, significantly expanding capabilities
- desktop: add preferences option to disable default cylinder types
- mobile: add ability to show fundamentally the same statistics as on the desktop
diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp
index 62150ad9c..345ca0cfe 100644
--- a/commands/command_edit.cpp
+++ b/commands/command_edit.cpp
@@ -838,6 +838,7 @@ void ReplanDive::undo()
std::swap(d->duration, duration);
std::swap(d->salinity, salinity);
fixup_dive(d);
+ invalidate_dive_cache(d); // Ensure that dive is written in git_save()
QVector<dive *> divesToNotify = { d };
// Note that we have to emit cylindersReset before divesChanged, because the divesChanged
@@ -875,6 +876,7 @@ void AddWeight::undo()
continue;
remove_weightsystem(d, d->weightsystems.nr - 1);
emit diveListNotifier.weightRemoved(d, d->weightsystems.nr);
+ invalidate_dive_cache(d); // Ensure that dive is written in git_save()
}
}
@@ -883,6 +885,7 @@ void AddWeight::redo()
for (dive *d: dives) {
add_cloned_weightsystem(&d->weightsystems, empty_weightsystem);
emit diveListNotifier.weightAdded(d, d->weightsystems.nr - 1);
+ invalidate_dive_cache(d); // Ensure that dive is written in git_save()
}
}
@@ -954,6 +957,7 @@ void RemoveWeight::undo()
for (size_t i = 0; i < dives.size(); ++i) {
add_to_weightsystem_table(&dives[i]->weightsystems, indices[i], clone_weightsystem(ws));
emit diveListNotifier.weightAdded(dives[i], indices[i]);
+ invalidate_dive_cache(dives[i]); // Ensure that dive is written in git_save()
}
}
@@ -962,6 +966,7 @@ void RemoveWeight::redo()
for (size_t i = 0; i < dives.size(); ++i) {
remove_weightsystem(dives[i], indices[i]);
emit diveListNotifier.weightRemoved(dives[i], indices[i]);
+ invalidate_dive_cache(dives[i]); // Ensure that dive is written in git_save()
}
}
@@ -1012,6 +1017,7 @@ void EditWeight::redo()
for (size_t i = 0; i < dives.size(); ++i) {
set_weightsystem(dives[i], indices[i], new_ws);
emit diveListNotifier.weightEdited(dives[i], indices[i]);
+ invalidate_dive_cache(dives[i]); // Ensure that dive is written in git_save()
}
std::swap(ws, new_ws);
}