summaryrefslogtreecommitdiffstats
path: root/desktop-widgets/tab-widgets
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-11-08 22:47:38 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-12-05 10:14:25 -0800
commit72c6b838662f1fb79a806ac2264c7215efa0aa67 (patch)
tree8b10fe7ad548a62ed428347c8a35882ee291b41a /desktop-widgets/tab-widgets
parent029c9ccf020fdb73c148da489e0e7b1acd3ca149 (diff)
downloadsubsurface-72c6b838662f1fb79a806ac2264c7215efa0aa67.tar.gz
Undo: make weight editing undoable
Implement the EditWeight undo command. Since there is common code (storage of the old weight), this creates a common base class for RemoveWeight and EditWeight. The model calls directly into the undo command, which is somewhat unfortunate as it feels like a layering violation. It's the easy thing to do for now. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/tab-widgets')
-rw-r--r--desktop-widgets/tab-widgets/TabDiveEquipment.cpp15
1 files changed, 2 insertions, 13 deletions
diff --git a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
index 4baca44b2..ed15c20bc 100644
--- a/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
+++ b/desktop-widgets/tab-widgets/TabDiveEquipment.cpp
@@ -179,12 +179,10 @@ void TabDiveEquipment::editWeightWidget(const QModelIndex &index)
if (!index.isValid())
return;
- if (index.column() == WeightModel::REMOVE) {
+ if (index.column() == WeightModel::REMOVE)
divesEdited(Command::removeWeight(index.row(), false));
- } else {
- MainWindow::instance()->mainTab->enableEdition();
+ else
ui.weights->edit(index);
- }
}
// tricky little macro to edit all the selected dives
@@ -256,15 +254,6 @@ void TabDiveEquipment::acceptChanges()
do_replot = true;
}
- if (weightModel->changed) {
- mark_divelist_changed(true);
- MODIFY_DIVES(selectedDives,
- if (weightsystems_equal(mydive, cd))
- copy_weights(&displayed_dive.weightsystems, &mydive->weightsystems);
- );
- copy_weights(&displayed_dive.weightsystems, &cd->weightsystems);
- }
-
if (do_replot)
MainWindow::instance()->graphics->replot();