mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-09 04:30:43 +00:00
Remove some redundant hard-coding in daily settings view.
This commit is contained in:
parent
787a6ed128
commit
cb036c4497
@ -1104,6 +1104,9 @@ QString Daily::getMachineSettings(Day * day) {
|
|||||||
.arg(chan.description())
|
.arg(chan.description())
|
||||||
.arg(day->getCPAPModeStr());
|
.arg(day->getCPAPModeStr());
|
||||||
|
|
||||||
|
// The order in which to present pressure settings, which will appear first.
|
||||||
|
QVector<ChannelID> first_channels = { cpapmode, CPAP_Pressure, CPAP_PressureMin, CPAP_PressureMax, CPAP_EPAP, CPAP_EPAPLo, CPAP_EPAPHi, CPAP_IPAP, CPAP_IPAPLo, CPAP_IPAPHi, CPAP_PS, CPAP_PSMin, CPAP_PSMax };
|
||||||
|
|
||||||
if (sess) for (; it != it_end; ++it) {
|
if (sess) for (; it != it_end; ++it) {
|
||||||
ChannelID code = it.key();
|
ChannelID code = it.key();
|
||||||
|
|
||||||
@ -1133,30 +1136,19 @@ QString Daily::getMachineSettings(Day * day) {
|
|||||||
.arg(schema::channel[code].description())
|
.arg(schema::channel[code].description())
|
||||||
.arg(data);
|
.arg(data);
|
||||||
|
|
||||||
if ((code == CPAP_IPAP)
|
if (first_channels.contains(code)) {
|
||||||
|| (code == CPAP_EPAP)
|
|
||||||
|| (code == CPAP_IPAPHi)
|
|
||||||
|| (code == CPAP_EPAPHi)
|
|
||||||
|| (code == CPAP_IPAPLo)
|
|
||||||
|| (code == CPAP_EPAPLo)
|
|
||||||
|| (code == CPAP_PressureMin)
|
|
||||||
|| (code == CPAP_PressureMax)
|
|
||||||
|| (code == CPAP_Pressure)
|
|
||||||
|| (code == CPAP_PSMin)
|
|
||||||
|| (code == CPAP_PSMax)
|
|
||||||
|| (code == CPAP_PS)) {
|
|
||||||
first[code] = tmp;
|
first[code] = tmp;
|
||||||
} else {
|
} else {
|
||||||
other[schema::channel[code].label()] = tmp;
|
other[schema::channel[code].label()] = tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ChannelID order[] = { cpapmode, CPAP_Pressure, CPAP_PressureMin, CPAP_PressureMax, CPAP_EPAP, CPAP_EPAPLo, CPAP_EPAPHi, CPAP_IPAP, CPAP_IPAPLo, CPAP_IPAPHi, CPAP_PS, CPAP_PSMin, CPAP_PSMax };
|
// Put the pressure settings in order.
|
||||||
int os = sizeof(order) / sizeof(ChannelID);
|
for (auto & code : first_channels) {
|
||||||
for (int i=0 ;i < os; ++i) {
|
if (first.contains(code)) html += first[code];
|
||||||
if (first.contains(order[i])) html += first[order[i]];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: add logical (rather than alphabetical) ordering to this list, preferably driven by loader somehow
|
||||||
for (QMap<QString,QString>::iterator it = other.begin(); it != other.end(); ++it) {
|
for (QMap<QString,QString>::iterator it = other.begin(); it != other.end(); ++it) {
|
||||||
html += it.value();
|
html += it.value();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user