summaryrefslogtreecommitdiffstats
path: root/qt-models/divecomputerextradatamodel.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-06 22:25:48 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-07 08:46:15 -0700
commit7a443423bc633d8ea085879f9ad675cb134cc93c (patch)
tree6c2d0025273594257530a63a54f3cf3c1990af22 /qt-models/divecomputerextradatamodel.h
parent2ff459c35691f1548cc8a587cd437f5215f8ccc1 (diff)
downloadsubsurface-7a443423bc633d8ea085879f9ad675cb134cc93c.tar.gz
cleanup: generalize ExtraDataModel to display data of any dc
The goal here is to remove a dependency on displayed_dive. While doing so, make the model more general and display any dc. Pass in the dc of the current dive instead of displayed dive, since all other tabs are already converted to show data of the current dive. The QStrings are cached since we generate them anyway, so we may just keep them. Thus, there is no danger of the dc becoming invalid. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'qt-models/divecomputerextradatamodel.h')
-rw-r--r--qt-models/divecomputerextradatamodel.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/qt-models/divecomputerextradatamodel.h b/qt-models/divecomputerextradatamodel.h
index ab78e4541..9af4028eb 100644
--- a/qt-models/divecomputerextradatamodel.h
+++ b/qt-models/divecomputerextradatamodel.h
@@ -4,6 +4,8 @@
#include "cleanertablemodel.h"
+struct divecomputer;
+
/* extra data model for additional dive computer data */
class ExtraDataModel : public CleanerTableModel {
Q_OBJECT
@@ -17,10 +19,14 @@ public:
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
void clear();
- void updateDive();
+ void updateDiveComputer(const struct divecomputer *dc);
private:
- int rows;
+ struct Item {
+ QString key;
+ QString value;
+ };
+ std::vector<Item> items;
};
#endif