diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-09-22 20:23:37 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-10-02 08:04:49 -0700 |
commit | 8f3c85f58d0693a07df70a87b265cde0cdc860ac (patch) | |
tree | 95c9ae3885dc34a0d3c0cb07160b562d554d4b91 /qt-models/diveimportedmodel.cpp | |
parent | 10d4ba82a21e3648082ddd9bae5010881d71418a (diff) | |
download | subsurface-8f3c85f58d0693a07df70a87b265cde0cdc860ac.tar.gz |
Import: get tables from DiveImportedModel not DownloadThread
When importing dives, consume the tables from DiveImportedModel
and not the DownloadThread. This appears more logical and avoids
an inconsistent state of the DiveImportedModel: On import the
tables would be reset, but the DiveImportedModel wasn't
informed of that.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/diveimportedmodel.cpp')
-rw-r--r-- | qt-models/diveimportedmodel.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/qt-models/diveimportedmodel.cpp b/qt-models/diveimportedmodel.cpp index 34c247c0c..6342972a7 100644 --- a/qt-models/diveimportedmodel.cpp +++ b/qt-models/diveimportedmodel.cpp @@ -155,6 +155,26 @@ void DiveImportedModel::repopulate(dive_table_t *table, struct dive_site_table * endResetModel(); } +std::pair<struct dive_table, struct dive_site_table> DiveImportedModel::consumeTables() +{ + beginResetModel(); + + // Move tables to result + struct dive_table dives; + struct dive_site_table sites; + move_dive_table(diveTable, &dives); + move_dive_site_table(sitesTable, &sites); + + // Reset indexes + firstIndex = 0; + lastIndex = -1; + checkStates.clear(); + + endResetModel(); + + return std::make_pair(dives, sites); +} + // Delete non-selected dives void DiveImportedModel::deleteDeselected() { |