mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Import: don't add to new trip while downloading
Since process_imported_dives() can add dives to a newly generated trip, this need not be done in the downloading code. This makes data flow distinctly simpler, as no trip table and no add-new-trip flag has to be passed down to the libdivecomputer glue code. Moreover, since now the trip creation is done at the import step rather than the download step, the latest status of the "add to new trip" checkbox will be considered. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
1cd0863cca
commit
ff9506b21b
12 changed files with 18 additions and 74 deletions
|
@ -211,17 +211,6 @@ static struct dive *get_dive_by_uemis_diveid(device_data_t *devdata, uint32_t ob
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static void record_uemis_dive(device_data_t *devdata, struct dive *dive)
|
||||
{
|
||||
if (devdata->create_new_trip) {
|
||||
if (!devdata->trip)
|
||||
devdata->trip = create_and_hookup_trip_from_dive(dive, &trip_table);
|
||||
else
|
||||
add_dive_to_trip(dive, devdata->trip);
|
||||
}
|
||||
record_dive_to_table(dive, devdata->download_table);
|
||||
}
|
||||
|
||||
/* send text to the importer progress bar */
|
||||
static void uemis_info(const char *fmt, ...)
|
||||
{
|
||||
|
@ -1024,14 +1013,14 @@ static bool process_raw_buffer(device_data_t *devdata, uint32_t deviceid, char *
|
|||
* be a short read because of some error */
|
||||
if (done && ++bp < endptr && *bp != '{' && strstr(bp, "{{")) {
|
||||
done = false;
|
||||
record_uemis_dive(devdata, dive);
|
||||
record_dive_to_table(dive, devdata->download_table);
|
||||
mark_divelist_changed(true);
|
||||
dive = uemis_start_dive(deviceid);
|
||||
}
|
||||
}
|
||||
if (is_log) {
|
||||
if (dive->dc.diveid) {
|
||||
record_uemis_dive(devdata, dive);
|
||||
record_dive_to_table(dive, devdata->download_table);
|
||||
mark_divelist_changed(true);
|
||||
} else { /* partial dive */
|
||||
free(dive);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue