mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Undo: implement rudimentary support for undo of dive-splitting
For this, the core functionality of the split_dive() and split_dive_at_time() functions were split out into new split_dive_dont_insert() and split_dive_at_time_dont_insert(), which do not add the new dives to the log. Thus, the undo-command can take ownership of these dives, without having to remove them first. The split-dive functionality is temporarily made desktop-only until mobile also supports "UndoObjects". Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
12df9faaa2
commit
302f6adb79
6 changed files with 145 additions and 36 deletions
|
@ -633,12 +633,16 @@ void DiveListView::splitDives()
|
|||
int i;
|
||||
struct dive *dive;
|
||||
|
||||
// Let's collect the dives to be split first, so that we don't catch newly inserted dives!
|
||||
QVector<struct dive *> dives;
|
||||
for_each_dive (i, dive) {
|
||||
if (dive->selected)
|
||||
split_dive(dive);
|
||||
dives.append(dive);
|
||||
}
|
||||
for (struct dive *d: dives) {
|
||||
UndoSplitDives *undoCommand = new UndoSplitDives(d, duration_t{-1});
|
||||
MainWindow::instance()->undoStack->push(undoCommand);
|
||||
}
|
||||
MainWindow::instance()->refreshProfile();
|
||||
MainWindow::instance()->refreshDisplay();
|
||||
}
|
||||
|
||||
void DiveListView::renumberDives()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue