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:
parent
36676120ab
commit
81268adfd3
@ -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();
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user