mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 21:20:19 +00:00
5bc6f5d36c
We keep track of device, i.e. distinct dive computers with id in the core. The corresponding code stuck out like a sore thumb. Firstly, because it is C++. But more importantly, because it used inconsistent nameing conventions. Notably it defined a "DiveComputerNode" when this is something very different from "struct dive_computer", the latter being the dive-computer related data of a single dive. Since the whole thing is defined in "device.h" and the function to create such an entry is called "create_device_node", call the structure "device". Use snake_case for consistency with the other core structures. Moreover, call the collection of devices "device_table" in analogy with "dive_table", etc. Overall, this should make the core code more consistent style-wise. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
32 lines
762 B
C++
32 lines
762 B
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVECOMPUTERMODEL_H
|
|
#define DIVECOMPUTERMODEL_H
|
|
|
|
#include "qt-models/cleanertablemodel.h"
|
|
#include "core/device.h"
|
|
|
|
class DiveComputerModel : public CleanerTableModel {
|
|
Q_OBJECT
|
|
public:
|
|
enum {
|
|
REMOVE,
|
|
MODEL,
|
|
ID,
|
|
NICKNAME
|
|
};
|
|
DiveComputerModel(QObject *parent = 0);
|
|
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
|
|
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
|
|
Qt::ItemFlags flags(const QModelIndex &index) const override;
|
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
|
void keepWorkingList();
|
|
|
|
public
|
|
slots:
|
|
void remove(const QModelIndex &index);
|
|
|
|
private:
|
|
QVector<device> dcs;
|
|
};
|
|
|
|
#endif
|