summaryrefslogtreecommitdiffstats
path: root/core/divecomputer.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-06-16 14:06:35 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2018-06-17 06:53:13 +0900
commit1f654050fa7e461166ee4d8b46d66b4ca91f31d4 (patch)
treef6158e8fc750ccd5de64b15a04a242f72ca3cd67 /core/divecomputer.h
parent8e8cd7a8d9304b96cc80fbd2ea63e28d9f7595a3 (diff)
downloadsubsurface-1f654050fa7e461166ee4d8b46d66b4ca91f31d4.tar.gz
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>
Diffstat (limited to 'core/divecomputer.h')
-rw-r--r--core/divecomputer.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/core/divecomputer.h b/core/divecomputer.h
index dd82ce241..55d17308d 100644
--- a/core/divecomputer.h
+++ b/core/divecomputer.h
@@ -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;