summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2018-01-21 14:58:00 +0100
committerGravatar Robert C. Helling <helling@atdotde.de>2018-01-21 18:01:56 +0100
commitd5cb30efac8f257dd7f8015f9a2a9a24f7df932a (patch)
tree216dc6fc18cd8a802910eccdac762ad32a1dd274
parentc89cfcccbe8700af13554465e4e09b424aa1be00 (diff)
downloadsubsurface-d5cb30efac8f257dd7f8015f9a2a9a24f7df932a.tar.gz
Profile info box ICD: Change format of ICD string
Change the format from (example!) ICD: ΔHe=-34% ΔN₂=3%<3% to ICD: ΔHe=-34% ΔN₂=+3%<+2.8% Change strings given to translation to less complex ones. Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
-rw-r--r--profile-widget/diveeventitem.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/profile-widget/diveeventitem.cpp b/profile-widget/diveeventitem.cpp
index 5a5ba15b5..c1044ecc3 100644
--- a/profile-widget/diveeventitem.cpp
+++ b/profile-widget/diveeventitem.cpp
@@ -7,6 +7,7 @@
#include "core/profile.h"
#include "core/gettextfromc.h"
#include "core/metrics.h"
+#include "core/membuffer.h"
extern struct ev_select *ev_namelist;
extern int evn_used;
@@ -168,6 +169,7 @@ void DiveEventItem::setupToolTipString(struct gasmix *lastgasmix)
if (event_is_gaschange(internalEvent)) {
struct icd_data icd_data;
struct gasmix *mix = get_gasmix_from_event(&displayed_dive, internalEvent);
+ struct membuffer mb = {};
name += ": ";
name += gasname(mix);
@@ -176,10 +178,12 @@ void DiveEventItem::setupToolTipString(struct gasmix *lastgasmix)
name += tr(" (cyl. %1)").arg(internalEvent->gas.index + 1);
bool icd = isobaric_counterdiffusion(lastgasmix, mix, &icd_data);
if (icd_data.dHe < 0) {
- if (icd)
- name += tr("\nICD: ΔHe=%1% ΔN₂=%2%>%3%").arg(icd_data.dHe / 10).arg(icd_data.dN2 / 10).arg(-icd_data.dHe / 50);
- else
- name += tr("\nICD: ΔHe=%1% ΔN₂=%2%<%3%").arg(icd_data.dHe / 10).arg(icd_data.dN2 / 10).arg(-icd_data.dHe / 50);
+ put_format(&mb, "\n%s: %s=%+.3g%% %s=%+.3g%%%s%+.3g%%",
+ tr("ICD").toUtf8().constData(),
+ tr("ΔHe").toUtf8().constData(), icd_data.dHe / 10.0,
+ tr("ΔN₂").toUtf8().constData(), icd_data.dN2 / 10.0,
+ icd ? ">" : "<", -icd_data.dHe / 50.0);
+ name += QString::fromUtf8(mb.buffer, mb.len);
}
*lastgasmix = *mix;
} else if (value) {