From d5cb30efac8f257dd7f8015f9a2a9a24f7df932a Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Sun, 21 Jan 2018 14:58:00 +0100 Subject: Profile info box ICD: Change format of ICD string MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- profile-widget/diveeventitem.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'profile-widget/diveeventitem.cpp') 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) { -- cgit v1.2.3-70-g09d2