Import: extract number of dives from model not from thread

The plan is to make the model the authoritative source of
the imported dives. Therefore, access the number of
downloaded dives from there.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-09-22 21:00:15 +02:00 committed by Dirk Hohndel
parent 36676120ab
commit 81268adfd3
3 changed files with 7 additions and 1 deletions

View file

@ -272,7 +272,7 @@ void DownloadFromDCWidget::updateState(states state)
markChildrenAsEnabled();
progress_bar_text = "";
} else {
if (diveImportedModel->thread.table()->nr != 0)
if (diveImportedModel->numDives() != 0)
progress_bar_text = "";
ui.progressBar->setValue(100);
markChildrenAsEnabled();

View file

@ -175,6 +175,11 @@ std::pair<struct dive_table, struct dive_site_table> DiveImportedModel::consumeT
return std::make_pair(dives, sites);
}
int DiveImportedModel::numDives() const
{
return diveTable->nr;
}
// Delete non-selected dives
void DiveImportedModel::deleteDeselected()
{

View file

@ -23,6 +23,7 @@ public:
QHash<int, QByteArray> roleNames() const;
void deleteDeselected();
std::pair<struct dive_table, struct dive_site_table> consumeTables(); // Returns dives and sites and resets model.
int numDives() const;
Q_INVOKABLE void recordDives();
Q_INVOKABLE void startDownload();