diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2020-04-23 23:17:19 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2020-04-24 10:40:12 -0700 |
commit | 9386eb2a0b8bd2540fef524c62b988858c64c445 (patch) | |
tree | 2214e24fef9bacbeeda8b5d373a4c255612b7e63 /core | |
parent | 3d4698c0a19c452bc322d4be529c7036c61c8c4d (diff) | |
download | subsurface-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')
-rw-r--r-- | core/divecomputer.cpp | 10 | ||||
-rw-r--r-- | core/divecomputer.h | 1 | ||||
-rw-r--r-- | core/qthelper.cpp | 11 | ||||
-rw-r--r-- | core/qthelper.h | 2 |
4 files changed, 11 insertions, 13 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; +} diff --git a/core/divecomputer.h b/core/divecomputer.h index 55d17308d..3b3e7d1b5 100644 --- a/core/divecomputer.h +++ b/core/divecomputer.h @@ -32,6 +32,7 @@ public: QVector<DiveComputerNode> dcs; }; +QString get_dc_nickname(const struct divecomputer *dc); extern DiveComputerList dcList; #endif diff --git a/core/qthelper.cpp b/core/qthelper.cpp index 91b3a3ee7..a6fb800be 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -9,7 +9,6 @@ #include "membuffer.h" #include "subsurfacesysinfo.h" #include "version.h" -#include "divecomputer.h" #include "errorhelper.h" #include "planner.h" #include "time.h" @@ -527,16 +526,6 @@ void set_filename(const char *filename) existing_filename = copy_string(filename); } -QString get_dc_nickname(const char *model, uint32_t deviceid) -{ - const DiveComputerNode *existNode = dcList.getExact(model, deviceid); - - if (existNode && !existNode->nickName.isEmpty()) - return existNode->nickName; - else - return model; -} - QString get_depth_string(int mm, bool showunit, bool showdecimal) { if (prefs.units.length == units::METERS) { diff --git a/core/qthelper.h b/core/qthelper.h index a074e70cd..093cdaad3 100644 --- a/core/qthelper.h +++ b/core/qthelper.h @@ -2,7 +2,6 @@ #ifndef QTHELPER_H #define QTHELPER_H -#include <stdint.h> #include <libxslt/transform.h> #include <libxslt/xsltutils.h> #include "core/pref.h" @@ -60,7 +59,6 @@ QString get_pressure_unit(); QString getSubsurfaceDataPath(QString folderToFind); QString getPrintingTemplatePathUser(); QString getPrintingTemplatePathBundle(); -QString get_dc_nickname(const char *model, uint32_t deviceid); int gettimezoneoffset(timestamp_t when = 0); int parseDurationToSeconds(const QString &text); int parseLengthToMm(const QString &text); |