diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-01-03 16:04:54 +0100 |
---|---|---|
committer | bstoeger <32835590+bstoeger@users.noreply.github.com> | 2020-03-06 10:00:13 +0100 |
commit | c495a49b1b044ab54ee60d4b0db14caa3f8e3de1 (patch) | |
tree | a32ec02598b1cc53690c72f7c783c25e8ce38096 /desktop-widgets/simplewidgets.cpp | |
parent | 62adc24d150b0566b9cc9ab449de4ed30ac2ab62 (diff) | |
download | subsurface-c495a49b1b044ab54ee60d4b0db14caa3f8e3de1.tar.gz |
Cleanup: use getDiveSelection() for shifting time
There are two cases where dive-times are shifted: in an explicit
dialog and when editing the date/time of a dive.
In each of these cases, the selected dives were collected manually.
Instead use the getDiveSelection() function. Since this returns
a std::vector, change the argument of Command::ShiftTime() to
such a std::vector.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'desktop-widgets/simplewidgets.cpp')
-rw-r--r-- | desktop-widgets/simplewidgets.cpp | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index cf4b9b0ae..fb4d3750b 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -222,17 +222,8 @@ void ShiftTimesDialog::buttonClicked(QAbstractButton *button) amount = ui.timeEdit->time().hour() * 3600 + ui.timeEdit->time().minute() * 60; if (ui.backwards->isChecked()) amount *= -1; - if (amount != 0) { - // DANGER, DANGER - this could get our dive_table unsorted... - int i; - struct dive *d; - QVector<dive *> affectedDives; - for_each_dive (i, d) { - if (d->selected) - affectedDives.append(d); - } - Command::shiftTime(affectedDives, amount); - } + if (amount != 0) + Command::shiftTime(getDiveSelection(), amount); } } |