mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
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>
This commit is contained in:
parent
3d4698c0a1
commit
9386eb2a0b
5 changed files with 13 additions and 14 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
QVector<DiveComputerNode> dcs;
|
||||
};
|
||||
|
||||
QString get_dc_nickname(const struct divecomputer *dc);
|
||||
extern DiveComputerList dcList;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "profile-widget/profilewidget2.h"
|
||||
#include "qt-models/diveplotdatamodel.h"
|
||||
#include "core/divecomputer.h"
|
||||
#include "core/subsurface-string.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/picture.h"
|
||||
|
@ -806,7 +807,7 @@ void ProfileWidget2::plotDive(const struct dive *d, bool force, bool doClearPict
|
|||
Q_FOREACH (DiveEventItem *event, eventItems) {
|
||||
event->setVisible(!event->shouldBeHidden());
|
||||
}
|
||||
QString dcText = get_dc_nickname(currentdc->model, currentdc->deviceid);
|
||||
QString dcText = get_dc_nickname(currentdc);
|
||||
if (dcText == "planned dive")
|
||||
dcText = tr("Planned dive");
|
||||
else if (dcText == "manually added dive")
|
||||
|
|
Loading…
Add table
Reference in a new issue