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
|
@ -384,7 +384,6 @@ void DownloadFromDCWidget::on_downloadCancelRetryButton_clicked()
|
|||
}
|
||||
|
||||
data->setForceDownload(ui.forceDownload->isChecked());
|
||||
data->setCreateNewTrip(ui.createNewTrip->isChecked());
|
||||
data->setSaveLog(ui.logToFile->isChecked());
|
||||
data->setSaveDump(ui.dumpToFile->isChecked());
|
||||
|
||||
|
@ -486,7 +485,7 @@ void DownloadFromDCWidget::onDownloadThreadFinished()
|
|||
}
|
||||
ui.downloadCancelRetryButton->setText(tr("Retry download"));
|
||||
ui.downloadCancelRetryButton->setEnabled(true);
|
||||
diveImportedModel->repopulate(thread.table(), thread.trips());
|
||||
diveImportedModel->repopulate(thread.table());
|
||||
}
|
||||
|
||||
void DownloadFromDCWidget::on_cancel_clicked()
|
||||
|
@ -504,7 +503,6 @@ void DownloadFromDCWidget::on_ok_clicked()
|
|||
if (currentState != DONE && currentState != ERROR)
|
||||
return;
|
||||
struct dive_table *table = thread.table();
|
||||
struct trip_table *trips = thread.trips();
|
||||
|
||||
// delete non-selected dives
|
||||
int total = table->nr;
|
||||
|
@ -518,7 +516,7 @@ void DownloadFromDCWidget::on_ok_clicked()
|
|||
|
||||
if (table->nr > 0) {
|
||||
auto data = thread.data();
|
||||
Command::importDives(table, trips, preferDownloaded(), true, false, ui.createNewTrip->isChecked(), data->devName());
|
||||
Command::importDives(table, nullptr, preferDownloaded(), true, false, ui.createNewTrip->isChecked(), data->devName());
|
||||
}
|
||||
|
||||
if (ostcFirmwareCheck && currentState == DONE)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue