mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 18:13:24 +00:00
cleanup: replace membuffer by qasprintf_loc()
There is a function to format QString with C-format strings. Let's use it instead of doing a detour via membuffer. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
16b31985c3
commit
69914964f6
1 changed files with 6 additions and 9 deletions
|
@ -4,11 +4,11 @@
|
|||
#include "profile-widget/divecartesianaxis.h"
|
||||
#include "profile-widget/animationfunctions.h"
|
||||
#include "core/event.h"
|
||||
#include "core/format.h"
|
||||
#include "core/libdivecomputer.h"
|
||||
#include "core/profile.h"
|
||||
#include "core/gettextfromc.h"
|
||||
#include "core/metrics.h"
|
||||
#include "core/membuffer.h"
|
||||
#include "core/sample.h"
|
||||
#include "core/subsurface-string.h"
|
||||
#include <QDebug>
|
||||
|
@ -165,7 +165,6 @@ void DiveEventItem::setupToolTipString(struct gasmix lastgasmix)
|
|||
if (event_is_gaschange(ev)) {
|
||||
struct icd_data icd_data;
|
||||
struct gasmix mix = get_gasmix_from_event(dive, ev);
|
||||
struct membuffer mb = {};
|
||||
name += ": ";
|
||||
name += gasname(mix);
|
||||
|
||||
|
@ -174,13 +173,11 @@ void DiveEventItem::setupToolTipString(struct gasmix lastgasmix)
|
|||
name += tr(" (cyl. %1)").arg(ev->gas.index + 1);
|
||||
bool icd = isobaric_counterdiffusion(lastgasmix, mix, &icd_data);
|
||||
if (icd_data.dHe < 0) {
|
||||
put_format(&mb, "\n%s %s:%+.3g%% %s:%+.3g%%%s%+.3g%%",
|
||||
qPrintable(tr("ICD")),
|
||||
qPrintable(tr("ΔHe")), icd_data.dHe / 10.0,
|
||||
qPrintable(tr("ΔN₂")), icd_data.dN2 / 10.0,
|
||||
icd ? ">" : "<", lrint(-icd_data.dHe / 5.0) / 10.0);
|
||||
name += QString::fromUtf8(mb.buffer, mb.len);
|
||||
free_buffer(&mb);
|
||||
name += qasprintf_loc("\n%s %s:%+.3g%% %s:%+.3g%%%s%+.3g%%",
|
||||
qPrintable(tr("ICD")),
|
||||
qPrintable(tr("ΔHe")), icd_data.dHe / 10.0,
|
||||
qPrintable(tr("ΔN₂")), icd_data.dN2 / 10.0,
|
||||
icd ? ">" : "<", lrint(-icd_data.dHe / 5.0) / 10.0);
|
||||
}
|
||||
} else if (same_string(ev->name, "modechange")) {
|
||||
name += QString(": %1").arg(gettextFromC::tr(divemode_text_ui[ev->value]));
|
||||
|
|
Loading…
Add table
Reference in a new issue