aboutsummaryrefslogtreecommitdiffstats
path: root/core/divecomputer.cpp
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-23 23:17:19 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-04-24 10:40:12 -0700
commit9386eb2a0b8bd2540fef524c62b988858c64c445 (patch)
tree2214e24fef9bacbeeda8b5d373a4c255612b7e63 /core/divecomputer.cpp
parent3d4698c0a19c452bc322d4be529c7036c61c8c4d (diff)
downloadsubsurface-9386eb2a0b8bd2540fef524c62b988858c64c445.tar.gz
cleanup: move get_dc_nickname from qthelper.cpp to divecomputer.cpp
1) qthelper is already huge. 2) set_dc_nickname et al. is already there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divecomputer.cpp')
-rw-r--r--core/divecomputer.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/core/divecomputer.cpp b/core/divecomputer.cpp
index daa4eafbf..f97d5e27c 100644
--- a/core/divecomputer.cpp
+++ b/core/divecomputer.cpp
@@ -158,3 +158,13 @@ extern "C" void set_dc_nickname(struct dive *dive)
}
}
}
+
+QString get_dc_nickname(const struct divecomputer *dc)
+{
+ const DiveComputerNode *existNode = dcList.getExact(dc->model, dc->deviceid);
+
+ if (existNode && !existNode->nickName.isEmpty())
+ return existNode->nickName;
+ else
+ return dc->model;
+}