mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:13:25 +00:00
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>
This commit is contained in:
parent
e4f2c86c82
commit
fdf8c905d6
1 changed files with 6 additions and 0 deletions
|
@ -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(),
|
||||
|
|
Loading…
Add table
Reference in a new issue