aboutsummaryrefslogtreecommitdiffstats
path: root/subsurface-downloader-main.cpp
diff options
context:
space:
mode:
authorGravatar Robert C. Helling <helling@atdotde.de>2020-11-27 21:32:40 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-12-03 13:26:55 -0800
commit40311362f323fd8a4d62a0b044dbf2e778654174 (patch)
tree98e75dabc07ca19060854bcb3a952d65f8a03422 /subsurface-downloader-main.cpp
parent5e34531e326d8f9b67cddd5f5af34265381be0d0 (diff)
downloadsubsurface-40311362f323fd8a4d62a0b044dbf2e778654174.tar.gz
downloader: save downloaded dives
Signed-off-by: Robert C. Helling <helling@atdotde.de>
Diffstat (limited to 'subsurface-downloader-main.cpp')
-rw-r--r--subsurface-downloader-main.cpp13
1 files changed, 12 insertions, 1 deletions
diff --git a/subsurface-downloader-main.cpp b/subsurface-downloader-main.cpp
index 5cd0b1444..f5e6abaae 100644
--- a/subsurface-downloader-main.cpp
+++ b/subsurface-downloader-main.cpp
@@ -9,6 +9,8 @@
#include "core/tag.h"
#include "core/dive.h"
#include "core/subsurface-string.h"
+#include "core/file.h"
+#include "core/trip.h"
#include <QApplication>
#include <QLoggingCategory>
@@ -37,6 +39,12 @@ int main(int argc, char **argv)
QStringList files;
QStringList importedFiles;
QStringList arguments = QCoreApplication::arguments();
+ struct dive_table dive_table = empty_dive_table;
+ struct dive_site_table sites = empty_dive_site_table;
+ struct device_table devices;
+ struct filter_preset_table presets;
+
+
const char *default_directory = system_default_directory();
const char *default_filename = system_default_filename();
@@ -83,8 +91,10 @@ int main(int argc, char **argv)
}
}
filesOnCommandLine = !files.isEmpty() || !importedFiles.isEmpty();
- if (!files.isEmpty())
+ if (!files.isEmpty()) {
qDebug() << "loading dive data from" << files;
+ parse_file(qPrintable(files.first()), &dive_table, &trip_table, &sites, &devices, &presets);
+ }
print_files();
if (!quit) {
if (!empty_string(prefs.dive_computer.vendor) && !empty_string(prefs.dive_computer.product) && !empty_string(prefs.dive_computer.device)) {
@@ -93,6 +103,7 @@ int main(int argc, char **argv)
cliDownloader(prefs.dive_computer.vendor, prefs.dive_computer.product, prefs.dive_computer.device);
}
}
+ save_dives(qPrintable(files.first()));
taglist_free(g_tag_list);
parse_xml_exit();
free((void *)default_directory);