diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-01-14 20:54:34 +0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-01-14 20:54:34 +0700 |
commit | fdf8c905d6d3d2a331c1b4870017ca589a527723 (patch) | |
tree | 5a5dfc938d840d787258afafedb1ed39463d8b0a /qt-gui.cpp | |
parent | e4f2c86c8259f9cba3c3b7f32a6262a51cb03b91 (diff) | |
download | subsurface-fdf8c905d6d3d2a331c1b4870017ca589a527723.tar.gz |
Save the divecomputer entries in a consistent order
This is the list of DCs in the settings. This way they don't keep
changing.
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-gui.cpp')
-rw-r--r-- | qt-gui.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/qt-gui.cpp b/qt-gui.cpp index 93b11d37b..57b82b940 100644 --- a/qt-gui.cpp +++ b/qt-gui.cpp @@ -447,10 +447,16 @@ void create_device_node(const char *model, uint32_t deviceid, const char *serial dcList.addDC(model, deviceid, nickname, serial, firmware); } +bool compareDC(const DiveComputerNode &a, const DiveComputerNode &b) +{ + return a.deviceId < b.deviceId; +} + void call_for_each_dc(FILE *f, void (*callback)(FILE *, const char *, uint32_t, const char *, const char *, const char *)) { QList<DiveComputerNode> values = dcList.dcMap.values(); + qSort(values.begin(), values.end(), compareDC); for (int i = 0; i < values.size(); i++) { const DiveComputerNode *node = &values.at(i); callback(f, node->model.toUtf8().data(), node->deviceId, node->nickName.toUtf8().data(), |