mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
62adc24d15
commit
c495a49b1b
6 changed files with 14 additions and 30 deletions
|
@ -677,18 +677,10 @@ void MainTab::on_depth_editingFinished()
|
|||
// all dives are shifted by an offset.
|
||||
static void shiftTime(QDateTime &dateTime)
|
||||
{
|
||||
QVector<dive *> dives;
|
||||
struct dive *d;
|
||||
int i;
|
||||
for_each_dive (i, d) {
|
||||
if (d->selected)
|
||||
dives.append(d);
|
||||
}
|
||||
|
||||
timestamp_t when = dateTime.toTime_t();
|
||||
if (current_dive && current_dive->when != when) {
|
||||
timestamp_t offset = when - current_dive->when;
|
||||
Command::shiftTime(dives, (int)offset);
|
||||
Command::shiftTime(getDiveSelection(), (int)offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue