Initial code to show ResMed EPR with a space between number and cmH2O

This commit is contained in:
Seeker4 2019-05-10 17:53:09 -07:00
parent 0967b2013e
commit b87e700119
3 changed files with 25 additions and 4 deletions

View File

@ -238,6 +238,23 @@ QString weightString(float kg, UnitSystem us)
return ("Bad UnitSystem");
}
// Format perssure relief
QString formatRelief (QString relief)
{
int icm = 0;
QString newRelief = relief;
if (relief == nullptr )
return relief;
icm = relief.indexOf("cmH2O");
if (icm >= 1) {
QChar t = relief.mid(icm-1,1)[0];
if (t.isDigit())
newRelief = relief.insert(icm, " ");
}
// qDebug() << "Relief input" << relief << "returning" << newRelief;
return newRelief;
}
bool operator <(const ValueCount &a, const ValueCount &b)
{
return a.value < b.value;

View File

@ -85,6 +85,9 @@ const float pound_convert = ounce_convert * 16;
QString weightString(float kg, UnitSystem us = US_Undefined);
//! \brief Format pressure relief by placing a space before cmH2O if not already there
QString formatRelief (QString relief);
//! \brief Mercilessly trash a directory
bool removeDir(const QString &path);

View File

@ -34,6 +34,7 @@ QString formatTime(float time)
return QString().sprintf("%02i:%02i", hours, minutes); //,seconds);
}
QDataStream & operator>>(QDataStream & in, RXItem & rx)
{
in >> rx.start;
@ -375,7 +376,7 @@ void Statistics::updateRXChanges()
// Get Event flags list
QList<ChannelID> flags3 = day->getSortedMachineChannels(MT_CPAP, schema::FLAG | schema::MINOR_FLAG | schema::SPAN);
// Generate pressure/mode/relief strings
// Generate pressure/mode/`strings
QString relief = day->getPressureRelief();
QString mode = day->getCPAPMode();
QString pressure = day->getPressureSettings();
@ -936,7 +937,7 @@ QString Statistics::GenerateRXChanges()
QString("<td>%1</td>").arg(ahi, 0, 'f', 2)+
QString("<td>%1</td>").arg(fli, 0, 'f', 2)+
QString("<td>%1 (%2)</td>").arg(rx.machine->model()).arg(rx.machine->modelnumber())+
QString("<td>%1</td>").arg(rx.relief)+
QString("<td>%1</td>").arg(formatRelief(rx.relief))+
QString("<td>%1</td>").arg(rx.mode)+
QString("<td>%1</td>").arg(rx.pressure)+
"</tr>";
@ -1456,7 +1457,7 @@ void Statistics::UpdateRecordsBox()
html += tr("Culminative AHI: %1").arg(double(rxbest.ahi) / rxbest.hours, 0, 'f', 2) + "<br/>";
html += tr("Culminative Hours: %1").arg(rxbest.hours, 0, 'f', 2) + "<br/>";
html += QString("%1").arg(rxbest.pressure) + "<br/>";
html += QString("%1").arg(rxbest.relief) + "<br/>";
html += QString("%1").arg(formatRelief(rxbest.relief)) + "<br/>";
html += "<br/>";
html += "<b>"+tr("Worst RX Setting")+"</b><br/>";
@ -1469,7 +1470,7 @@ void Statistics::UpdateRecordsBox()
html += tr("Culminative Hours: %1").arg(rxworst.hours, 0, 'f', 2) + "<br/>";
html += QString("%1").arg(rxworst.pressure) + "<br/>";
html += QString("%1").arg(rxworst.relief) + "<br/>";
html += QString("%1").arg(formatRelief(rxworst.relief)) + "<br/>";
}
}