diff options
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); |