From fdf8c905d6d3d2a331c1b4870017ca589a527723 Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Tue, 14 Jan 2014 20:54:34 +0700 Subject: 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 --- qt-gui.cpp | 6 ++++++ 1 file changed, 6 insertions(+) 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 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(), -- cgit v1.2.3-70-g09d2