mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
7a443423bc
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>
32 lines
700 B
C++
32 lines
700 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVECOMPUTEREXTRADATAMODEL_H
|
|
#define DIVECOMPUTEREXTRADATAMODEL_H
|
|
|
|
#include "cleanertablemodel.h"
|
|
|
|
struct divecomputer;
|
|
|
|
/* extra data model for additional dive computer data */
|
|
class ExtraDataModel : public CleanerTableModel {
|
|
Q_OBJECT
|
|
public:
|
|
enum Column {
|
|
KEY,
|
|
VALUE
|
|
};
|
|
explicit ExtraDataModel(QObject *parent = 0);
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
|
|
void clear();
|
|
void updateDiveComputer(const struct divecomputer *dc);
|
|
|
|
private:
|
|
struct Item {
|
|
QString key;
|
|
QString value;
|
|
};
|
|
std::vector<Item> items;
|
|
};
|
|
|
|
#endif
|