mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
029c9ccf02
commit
72c6b83866
10 changed files with 132 additions and 59 deletions
|
@ -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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue