mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 13:10:19 +00:00
b19adecb9f
Planned dives were still added by directly calling core code. This could confuse the undo-machinery, leading to crashes. Instead, use the proper undo-command. The problem is that as opposed to the other AddDive-commands, planned dives may belong to a trip. Thus, the interface to the AddDive command was changed to respect the divetrip field. Make sure that the other callers reset that field (actually, it should never be set). Add a comment describing the perhaps surprising interface (the passed-in dive, usually displayed dive, is reset). Moreover, a dive cloned in the planner is not assigned a new number. Thus, add an argument to the AddDive-command, which expresses whether a new number should be generated for the to-be-added dive. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
69 lines
1.3 KiB
C++
69 lines
1.3 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
#include "command.h"
|
|
#include "command_divelist.h"
|
|
|
|
namespace Command {
|
|
|
|
// Dive-list related commands
|
|
void addDive(dive *d, bool autogroup, bool newNumber)
|
|
{
|
|
execute(new AddDive(d, autogroup, newNumber));
|
|
}
|
|
|
|
void deleteDive(const QVector<struct dive*> &divesToDelete)
|
|
{
|
|
execute(new DeleteDive(divesToDelete));
|
|
}
|
|
|
|
void shiftTime(const QVector<dive *> &changedDives, int amount)
|
|
{
|
|
execute(new ShiftTime(changedDives, amount));
|
|
}
|
|
|
|
void renumberDives(const QVector<QPair<dive *, int>> &divesToRenumber)
|
|
{
|
|
execute(new RenumberDives(divesToRenumber));
|
|
}
|
|
|
|
void removeDivesFromTrip(const QVector<dive *> &divesToRemove)
|
|
{
|
|
execute(new RemoveDivesFromTrip(divesToRemove));
|
|
}
|
|
|
|
void removeAutogenTrips()
|
|
{
|
|
execute(new RemoveAutogenTrips);
|
|
}
|
|
|
|
void addDivesToTrip(const QVector<dive *> &divesToAddIn, dive_trip *trip)
|
|
{
|
|
execute(new AddDivesToTrip(divesToAddIn, trip));
|
|
}
|
|
|
|
void createTrip(const QVector<dive *> &divesToAddIn)
|
|
{
|
|
execute(new CreateTrip(divesToAddIn));
|
|
}
|
|
|
|
void autogroupDives()
|
|
{
|
|
execute(new AutogroupDives);
|
|
}
|
|
|
|
void mergeTrips(dive_trip *trip1, dive_trip *trip2)
|
|
{
|
|
execute(new MergeTrips(trip1, trip2));
|
|
}
|
|
|
|
void splitDives(dive *d, duration_t time)
|
|
{
|
|
execute(new SplitDives(d, time));
|
|
}
|
|
|
|
void mergeDives(const QVector <dive *> &dives)
|
|
{
|
|
execute(new MergeDives(dives));
|
|
}
|
|
|
|
} // namespace Command
|