mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
undo: pass dive as unique_ptr to addDive()
Before, a non-owning pointer was passed and the dive moved away from the dive. Instead, let the caller decide if they still want to keep a copy of the dive, or give up ownership: In MainWindow and QMLManager new dives are generated, so one might just as well give up ownership. In contrast, the planner works on a copy (originally the infamous "displayed_dive") and now moves the data manually. This commit also removes duplicate code, by moving the "create default dive" code from MainWindow and QMLManager to struct dive. Finally, determination of the "time zone offset" is not done in POSIX, since we want to avoid calls form the core into Qt. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
bdd5527005
commit
4a165980e7
13 changed files with 71 additions and 77 deletions
|
@ -40,7 +40,7 @@ bool placingCommand(); // Currently executing a new command -> might not have
|
|||
// distance are added to a trip. dive d is consumed (the structure is reset)!
|
||||
// If newNumber is true, the dive is assigned a new number, depending on the
|
||||
// insertion position.
|
||||
void addDive(dive *d, bool autogroup, bool newNumber);
|
||||
void addDive(std::unique_ptr<dive> d, bool autogroup, bool newNumber);
|
||||
void importDives(struct divelog *log, int flags, const QString &source); // The tables are consumed!
|
||||
void deleteDive(const QVector<struct dive*> &divesToDelete);
|
||||
void shiftTime(const std::vector<dive *> &changedDives, int amount);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue