summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-09-22 21:00:15 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-10-02 08:04:49 -0700
commit81268adfd3eb4cfdc7eb614957294798598a56f9 (patch)
treefcaf11724640cab0629d6cbad411e8611bed56a5 /qt-models
parent36676120ab59a60667f2591af55636517b41ff27 (diff)
downloadsubsurface-81268adfd3eb4cfdc7eb614957294798598a56f9.tar.gz
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>
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveimportedmodel.cpp5
-rw-r--r--qt-models/diveimportedmodel.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/qt-models/diveimportedmodel.cpp b/qt-models/diveimportedmodel.cpp
index 6342972a7..1c9b0cfcd 100644
--- a/qt-models/diveimportedmodel.cpp
+++ b/qt-models/diveimportedmodel.cpp
@@ -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()
{
diff --git a/qt-models/diveimportedmodel.h b/qt-models/diveimportedmodel.h
index db0f813b2..468385f6a 100644
--- a/qt-models/diveimportedmodel.h
+++ b/qt-models/diveimportedmodel.h
@@ -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();