summaryrefslogtreecommitdiffstats
path: root/qt-models/diveimportedmodel.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-12-10 14:49:32 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-12-17 07:37:32 -0800
commitbfe69239df6a8d2b2ae986b850246727a21e127b (patch)
tree04c5eeb37790f81861f80a93b28fa752d9a1fe9b /qt-models/diveimportedmodel.h
parenta6a5cf61e2f45eb54721c7ee2dbcc05afe8939f9 (diff)
downloadsubsurface-bfe69239df6a8d2b2ae986b850246727a21e127b.tar.gz
Import: unglobalize downloadTable
To make data flow more clear, unglobalize the downloadTable object. Make it a subobject of DownloadThread. The difficult part was making this compatible with QML, because somehow the pointer to the download-table has to be passed to the DiveImportedModel. Desktop would simply pass it to the constructor. But with objects generated in QML this is not possible. Instead, pass the table in the repopulate() function. This seems to make sense, but for this to work, we have to declare pointer-to-dive-table as a Q_METATYPE. And this only works if we use a typedef, because MOC removes the "struct" from "struct dive_table". This leads to compilation errors, because dive_table is the symbol-name of the global dive table! Sigh. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/diveimportedmodel.h')
-rw-r--r--qt-models/diveimportedmodel.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/qt-models/diveimportedmodel.h b/qt-models/diveimportedmodel.h
index fc4d9147b..0c5ba34cd 100644
--- a/qt-models/diveimportedmodel.h
+++ b/qt-models/diveimportedmodel.h
@@ -3,6 +3,7 @@
#include <QAbstractTableModel>
#include <vector>
+#include "core/dive.h"
class DiveImportedModel : public QAbstractTableModel
{
@@ -11,7 +12,6 @@ public:
enum roleTypes { DateTime = Qt::UserRole + 1, Duration, Depth, Selected};
DiveImportedModel(QObject *parent = 0);
- void setDiveTable(struct dive_table *table);
int columnCount(const QModelIndex& index = QModelIndex()) const;
int rowCount(const QModelIndex& index = QModelIndex()) const;
QVariant data(const QModelIndex& index, int role) const;
@@ -20,7 +20,7 @@ public:
Qt::ItemFlags flags(const QModelIndex &index) const;
Q_INVOKABLE void clearTable();
QHash<int, QByteArray> roleNames() const;
- Q_INVOKABLE void repopulate();
+ Q_INVOKABLE void repopulate(dive_table_t *table);
Q_INVOKABLE void recordDives();
public
slots: