mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
2ff459c356
commit
7a443423bc
3 changed files with 23 additions and 21 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue