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>
This commit is contained in:
Berthold Stoeger 2021-01-11 11:14:41 +01:00 committed by Dirk Hohndel
parent 108f6fed2f
commit 5692f0d68a
2 changed files with 7 additions and 0 deletions

View file

@ -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

View file

@ -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);
}