summaryrefslogtreecommitdiffstats
path: root/qt-models
diff options
context:
space:
mode:
Diffstat (limited to 'qt-models')
-rw-r--r--qt-models/diveimportedmodel.cpp12
-rw-r--r--qt-models/diveimportedmodel.h4
2 files changed, 5 insertions, 11 deletions
diff --git a/qt-models/diveimportedmodel.cpp b/qt-models/diveimportedmodel.cpp
index be9b4275d..3e8386b94 100644
--- a/qt-models/diveimportedmodel.cpp
+++ b/qt-models/diveimportedmodel.cpp
@@ -6,8 +6,6 @@ DiveImportedModel::DiveImportedModel(QObject *o) : QAbstractTableModel(o),
lastIndex(-1),
diveTable(nullptr)
{
- // Defaults to downloadTable, can be changed later.
- diveTable = &downloadTable;
}
int DiveImportedModel::columnCount(const QModelIndex&) const
@@ -45,11 +43,6 @@ QVariant DiveImportedModel::headerData(int section, Qt::Orientation orientation,
return QVariant();
}
-void DiveImportedModel::setDiveTable(struct dive_table* table)
-{
- diveTable = table;
-}
-
QVariant DiveImportedModel::data(const QModelIndex &index, int role) const
{
if (!index.isValid())
@@ -134,10 +127,11 @@ void DiveImportedModel::clearTable()
endRemoveRows();
}
-void DiveImportedModel::repopulate()
+void DiveImportedModel::repopulate(dive_table_t *table)
{
beginResetModel();
+ diveTable = table;
firstIndex = 0;
lastIndex = diveTable->nr - 1;
checkStates.resize(diveTable->nr);
@@ -159,7 +153,7 @@ void DiveImportedModel::recordDives()
if (checkStates[i])
j++;
else
- delete_dive_from_table(&downloadTable, j);
+ delete_dive_from_table(diveTable, j);
}
process_imported_dives(diveTable, true, true);
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: