devices: add devices in Command::importTable()

Add a device_table parameters to Command::importTable() and
add_imported_dives(). The content of this table will be added
to the global device list (respectively removed on undo).

This is currently a no-op, as the parser doesn't yet fill
out the device table, but adds devices directly to the global
device table.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2020-10-17 16:07:39 +02:00 committed by Dirk Hohndel
parent fadea413cd
commit 39a4090c0a
17 changed files with 113 additions and 40 deletions

View file

@ -6,6 +6,7 @@
#include "command_base.h"
#include "core/filterpreset.h"
#include "core/device.h"
#include <QVector>
@ -99,7 +100,8 @@ class ImportDives : public DiveListBase {
public:
// Note: dives and trips are consumed - after the call they will be empty.
ImportDives(struct dive_table *dives, struct trip_table *trips, struct dive_site_table *sites,
struct filter_preset_table *filter_presets, int flags, const QString &source);
struct device_table *devices, struct filter_preset_table *filter_presets, int flags,
const QString &source);
private:
void undoit() override;
void redoit() override;
@ -108,6 +110,7 @@ private:
// For redo and undo
DivesAndTripsToAdd divesToAdd;
DivesAndSitesToRemove divesAndSitesToRemove;
struct device_table devicesToAddAndRemove;
// For redo
std::vector<OwningDiveSitePtr> sitesToAdd;