From bfe69239df6a8d2b2ae986b850246727a21e127b Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 10 Dec 2018 14:49:32 +0100 Subject: Import: unglobalize downloadTable To make data flow more clear, unglobalize the downloadTable object. Make it a subobject of DownloadThread. The difficult part was making this compatible with QML, because somehow the pointer to the download-table has to be passed to the DiveImportedModel. Desktop would simply pass it to the constructor. But with objects generated in QML this is not possible. Instead, pass the table in the repopulate() function. This seems to make sense, but for this to work, we have to declare pointer-to-dive-table as a Q_METATYPE. And this only works if we use a typedef, because MOC removes the "struct" from "struct dive_table". This leads to compilation errors, because dive_table is the symbol-name of the global dive table! Sigh. Signed-off-by: Berthold Stoeger --- core/libdivecomputer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/libdivecomputer.c') diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c index a2e2890b8..4d2d29bad 100644 --- a/core/libdivecomputer.c +++ b/core/libdivecomputer.c @@ -1387,7 +1387,7 @@ const char *do_libdivecomputer_import(device_data_t *data) /* TODO: Show the logfile to the user on error. */ dc_device_close(data->device); data->device = NULL; - if (!downloadTable.nr) + if (!data->download_table->nr) dev_info(data, translate("gettextFromC", "No new dives downloaded from dive computer")); } dc_iostream_close(data->iostream); -- cgit v1.2.3-70-g09d2