From 41bd1ded63ac0856bfa2da3ec4576ca61d678cd3 Mon Sep 17 00:00:00 2001 From: Guy Scharf Date: Sat, 28 Dec 2019 23:16:59 -0700 Subject: [PATCH] Show n/a for pressure on Daily page below AHI if there is no valid value. Also update release notes to reflect this. --- oscar/SleepLib/day.cpp | 35 ++++++++++++++++++++++++----------- oscar/docs/release_notes.html | 3 ++- 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/oscar/SleepLib/day.cpp b/oscar/SleepLib/day.cpp index e2abbcb1..4fb68689 100644 --- a/oscar/SleepLib/day.cpp +++ b/oscar/SleepLib/day.cpp @@ -1474,6 +1474,11 @@ QString Day::getPressureRelief() return pr_str; } +QString validPressure(float pressure) { + if (fabsf(pressure) == std::numeric_limits::max()) + return QObject::tr("n/a"); + return QString("%1").arg(pressure, 0, 'f', 1); +} QString Day::getPressureSettings() { @@ -1486,26 +1491,34 @@ QString Day::getPressureSettings() QString units = schema::channel[CPAP_Pressure].units(); if (mode == MODE_CPAP) { - return QObject::tr("Fixed %1 (%2)").arg(settings_min(CPAP_Pressure)).arg(units); + return QObject::tr("Fixed %1 (%2)").arg(validPressure(settings_min(CPAP_Pressure))).arg(units); } else if (mode == MODE_APAP) { - return QObject::tr("Min %1 Max %2 (%3)").arg(settings_min(CPAP_PressureMin)).arg(settings_max(CPAP_PressureMax)).arg(units); + return QObject::tr("Min %1 Max %2 (%3)").arg(validPressure(settings_min(CPAP_PressureMin))).arg(validPressure(settings_max(CPAP_PressureMax))).arg(units); } else if (mode == MODE_BILEVEL_FIXED ) { - return QObject::tr("EPAP %1 IPAP %2 (%3)").arg(settings_min(CPAP_EPAP),0,'f',1).arg(settings_max(CPAP_IPAP),0,'f',1).arg(units); + return QObject::tr("EPAP %1 IPAP %2 (%3)").arg(validPressure(settings_min(CPAP_EPAP))).arg(validPressure(settings_max(CPAP_IPAP))).arg(units); } else if (mode == MODE_BILEVEL_AUTO_FIXED_PS) { - return QObject::tr("PS %1 over %2-%3 (%4)").arg(settings_max(CPAP_PS),0,'f',1).arg(settings_min(CPAP_EPAPLo),0,'f',1).arg(settings_max(CPAP_IPAPHi),0,'f',1).arg(units); + return QObject::tr("PS %1 over %2-%3 (%4)").arg(validPressure(settings_max(CPAP_PS))).arg(validPressure(settings_min(CPAP_EPAPLo))).arg(validPressure(settings_max(CPAP_IPAPHi))).arg(units); } else if (mode == MODE_BILEVEL_AUTO_VARIABLE_PS) { - return QObject::tr("Min EPAP %1 Max IPAP %2 PS %3-%4 (%5)").arg(settings_min(CPAP_EPAPLo),0,'f',1).arg(settings_max(CPAP_IPAPHi),0,'f',1).arg(settings_min(CPAP_PSMin),0,'f',1).arg(settings_max(CPAP_PSMax),0,'f',1).arg(units); + return QObject::tr("Min EPAP %1 Max IPAP %2 PS %3-%4 (%5)").arg(validPressure(settings_min(CPAP_EPAPLo))). + arg(validPressure(settings_max(CPAP_IPAPHi))). + arg(validPressure(settings_min(CPAP_PSMin))). + arg(validPressure(settings_max(CPAP_PSMax))).arg(units); } else if (mode == MODE_ASV) { - return QObject::tr("EPAP %1 PS %2-%3 (%4)").arg(settings_min(CPAP_EPAP),0,'f',1).arg(settings_min(CPAP_PSMin),0,'f',1).arg(settings_max(CPAP_PSMax),0,'f',1).arg(units); + return QObject::tr("EPAP %1 PS %2-%3 (%4)").arg(validPressure(settings_min(CPAP_EPAP))). + arg(validPressure(settings_min(CPAP_PSMin))). + arg(validPressure(settings_max(CPAP_PSMax))).arg(units); } else if (mode == MODE_ASV_VARIABLE_EPAP) { return QObject::tr("Min EPAP %1 Max IPAP %2 PS %3-%4 (%5)"). - arg(settings_min(CPAP_EPAPLo),0,'f',1). - arg(settings_max(CPAP_IPAPHi),0,'f',1). - arg(settings_max(CPAP_PSMin),0,'f',1). - arg(settings_min(CPAP_PSMax),0,'f',1). + arg(validPressure(settings_min(CPAP_EPAPLo))). + arg(validPressure(settings_max(CPAP_IPAPHi))). + arg(validPressure(settings_max(CPAP_PSMin))). + arg(validPressure(settings_min(CPAP_PSMax))). arg(units); } else if (mode == MODE_AVAPS) { - return QObject::tr("EPAP %1 IPAP %2 (%3)").arg(settings_min(CPAP_EPAP),0,'f',1).arg(settings_max(CPAP_IPAP),0,'f',1).arg(units); + return QObject::tr("EPAP %1 IPAP %2 (%3)"). + arg(validPressure(settings_min(CPAP_EPAP))). + arg(validPressure(settings_max(CPAP_IPAP))). + arg(units); } return STR_TR_Unknown; diff --git a/oscar/docs/release_notes.html b/oscar/docs/release_notes.html index d6d1d6d4..88d78849 100644 --- a/oscar/docs/release_notes.html +++ b/oscar/docs/release_notes.html @@ -10,7 +10,7 @@ Which was written and copyright 2011-2018 © Mark Watkins Changes and fixes in OSCAR v1.1.0-beta-1