mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Dive computers: turn QMultiMap into sorted vector
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>
This commit is contained in:
parent
8e8cd7a8d9
commit
1f654050fa
6 changed files with 63 additions and 103 deletions
|
@ -3,13 +3,14 @@
|
|||
#define DIVECOMPUTER_H
|
||||
|
||||
#include <QString>
|
||||
#include <QMap>
|
||||
#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;
|
||||
|
@ -26,7 +27,9 @@ public:
|
|||
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);
|
||||
QMultiMap<QString, DiveComputerNode> dcMap;
|
||||
|
||||
// Keep the dive computers in a vector sorted by (model, deviceId)
|
||||
QVector<DiveComputerNode> dcs;
|
||||
};
|
||||
|
||||
extern DiveComputerList dcList;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue