aboutsummaryrefslogtreecommitdiffstats
path: root/commands/command_divelist.cpp
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2021-08-17 11:14:42 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2021-08-18 13:22:02 -0700
commite7a5ec46f5577656acd1ce44b34e761193ab015b (patch)
tree512c0739ba44f41e44ea2c1d6e7ccddd4a33fdc9 /commands/command_divelist.cpp
parentfbe17e620e7b92b2af0d65d7b4c8fe688f2b6058 (diff)
downloadsubsurface-e7a5ec46f5577656acd1ce44b34e761193ab015b.tar.gz
undo/device: adjust device management infrastructure
We no longer need the remove infrastructure, and the edit nickname function becomes much more intuitive to use by passing in the dive computer for which we want to create a nickname instead of the internal index into the array of devices. This also removes / simplifies the device list update signals in the DiveListNotifier. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'commands/command_divelist.cpp')
-rw-r--r--commands/command_divelist.cpp13
1 files changed, 4 insertions, 9 deletions
diff --git a/commands/command_divelist.cpp b/commands/command_divelist.cpp
index baf81c1ac..f7e6b8f71 100644
--- a/commands/command_divelist.cpp
+++ b/commands/command_divelist.cpp
@@ -553,10 +553,8 @@ void ImportDives::redoit()
divesAndSitesToRemove = std::move(divesAndSitesToRemoveNew);
// Add devices
- for (const device &dev: devicesToAddAndRemove.devices) {
- int idx = add_to_device_table(&device_table, &dev);
- emit diveListNotifier.deviceAdded(idx);
- }
+ for (const device &dev: devicesToAddAndRemove.devices)
+ add_to_device_table(&device_table, &dev);
// Add new filter presets
for (auto &it: filterPresetsToAdd) {
@@ -583,11 +581,8 @@ void ImportDives::undoit()
setSelection(selection, currentDive);
// Remove devices
- for (const device &dev: devicesToAddAndRemove.devices) {
- int idx = remove_device(&device_table, &dev);
- if (idx >= 0)
- emit diveListNotifier.deviceDeleted(idx);
- }
+ for (const device &dev: devicesToAddAndRemove.devices)
+ remove_device(&device_table, &dev);
// Remove filter presets. Do this in reverse order.
for (auto it = filterPresetsToRemove.rbegin(); it != filterPresetsToRemove.rend(); ++it) {