mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-11 03:21:29 +00:00
1f654050fa
The list of known dive computers was stored in a multi-map indexed by the device name. Turn this into a sorted QVector. Thus, no map-to-list conversion is needed in the device editing dialog, which distinctly simplifies the code. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
37 lines
1 KiB
C++
37 lines
1 KiB
C++
// SPDX-License-Identifier: GPL-2.0
|
|
#ifndef DIVECOMPUTER_H
|
|
#define DIVECOMPUTER_H
|
|
|
|
#include <QString>
|
|
#include <QVector>
|
|
#include <stdint.h>
|
|
|
|
class DiveComputerNode {
|
|
public:
|
|
bool operator==(const DiveComputerNode &a) const;
|
|
bool operator!=(const DiveComputerNode &a) const;
|
|
bool operator<(const DiveComputerNode &a) const;
|
|
bool changesValues(const DiveComputerNode &b) const;
|
|
void showchanges(const QString &n, const QString &s, const QString &f) const;
|
|
QString model;
|
|
uint32_t deviceId;
|
|
QString serialNumber;
|
|
QString firmware;
|
|
QString nickName;
|
|
};
|
|
|
|
class DiveComputerList {
|
|
public:
|
|
const DiveComputerNode *getExact(const QString &m, uint32_t d);
|
|
const DiveComputerNode *get(const QString &m);
|
|
void addDC(QString m, uint32_t d, QString n = QString(), QString s = QString(), QString f = QString());
|
|
DiveComputerNode matchDC(const QString &m, uint32_t d);
|
|
DiveComputerNode matchModel(const QString &m);
|
|
|
|
// Keep the dive computers in a vector sorted by (model, deviceId)
|
|
QVector<DiveComputerNode> dcs;
|
|
};
|
|
|
|
extern DiveComputerList dcList;
|
|
|
|
#endif
|