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
|
@ -13,9 +13,9 @@
|
|||
namespace Command {
|
||||
|
||||
// Dive-list related commands
|
||||
void addDive(dive *d, bool autogroup, bool newNumber)
|
||||
void addDive(std::unique_ptr<dive> d, bool autogroup, bool newNumber)
|
||||
{
|
||||
execute(new AddDive(d, autogroup, newNumber));
|
||||
execute(new AddDive(std::move(d), autogroup, newNumber));
|
||||
}
|
||||
|
||||
void importDives(struct divelog *log, int flags, const QString &source)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue