mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add ability to undo shifting of dive time
Adds the ability to undo shifting of dive times. The change is captured at simplewidgets.cpp and an undo command is created. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
824cc90a9a
commit
87ee8e8aef
3 changed files with 50 additions and 1 deletions
|
@ -34,3 +34,31 @@ void UndoDeleteDive::redo()
|
|||
dives.clear();
|
||||
dives = newList;
|
||||
}
|
||||
|
||||
|
||||
UndoShiftTime::UndoShiftTime(QList<int> diveList, int amount)
|
||||
{
|
||||
setText("shift time");
|
||||
dives = diveList;
|
||||
timeChanged = amount;
|
||||
}
|
||||
|
||||
void UndoShiftTime::undo()
|
||||
{
|
||||
for (int i = 0; i < dives.count(); i++) {
|
||||
struct dive* d = get_dive_by_uniq_id(dives.at(i));
|
||||
d->when -= timeChanged;
|
||||
}
|
||||
mark_divelist_changed(true);
|
||||
MainWindow::instance()->refreshDisplay();
|
||||
}
|
||||
|
||||
void UndoShiftTime::redo()
|
||||
{
|
||||
for (int i = 0; i < dives.count(); i++) {
|
||||
struct dive* d = get_dive_by_uniq_id(dives.at(i));
|
||||
d->when += timeChanged;
|
||||
}
|
||||
mark_divelist_changed(true);
|
||||
MainWindow::instance()->refreshDisplay();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue