always display red-line for FlowRate graph.

This commit is contained in:
LoudSnorer 2023-05-16 21:21:59 -04:00
parent 6d9d7d0c50
commit 74c85eb8c6
3 changed files with 28 additions and 12 deletions

View File

@ -2309,6 +2309,12 @@ void gGraphView::populateMenu(gGraph * graph)
if (!lc->m_enabled[dot.code]) continue;
#if defined(ENABLE_ALWAYS_ON_ZERO_RED_LINE_FLOW_RATE)
// if red line is always on then there is no need for the button to turn it on /off
// skip creating UI to change value. or turn enabled off.
if (lc->code() == CPAP_FlowRate && dot.type == Calc_Zero) continue;
#endif
schema::Channel &chan = schema::channel[dot.code];
if (dot.available) {
@ -3602,14 +3608,14 @@ QString gGraphView::settingsFilename (QString title,QString folderName, QString
/* This note is for the save and restore settings.
* all versions prior to 4 were sleepyHead versions and have never been used.
* The layouts (version 4 and 5) are identical
* The layouts (version 4 and 5) are identical
* The rollback to a gVversion should always work.
* So new addtions to the saved configuration must be placed at the end of the file.
* So new addtions to the saved configuration must be placed at the end of the file.
* the SHG file will then be
* SHG FILE HEADER - Must never change
* SHG VERSION 4(5) changes - for all graphs
* SHG VERSION 6 changes - for all graphs
* SHG VERSION 7 changes - for all graphs
* SHG VERSION 4(5) changes - for all graphs
* SHG VERSION 6 changes - for all graphs
* SHG VERSION 7 changes - for all graphs
* ...
*/
@ -3653,7 +3659,7 @@ void gGraphView::SaveSettings(QString title,QString folderName)
#if 0
// add changes for additional settings
for (auto & graph : m_graphs) {
}
#endif
@ -3779,7 +3785,7 @@ bool gGraphView::LoadSettings(QString title,QString folderName)
// Do this for gVersion 5
#if 0
// Version 5 had no changes
if (version>=gVversion)
if (version>=gVversion)
for (int i = 0; i < numGraphs; i++) {
}
#endif
@ -3788,7 +3794,7 @@ bool gGraphView::LoadSettings(QString title,QString folderName)
#if 0
// repeat this for each additional version change
// this for the next additions to the saved information.
if (version>=gVversion)
if (version>=gVversion)
for (int i = 0; i < numGraphs; i++) {
}
#endif

View File

@ -58,10 +58,13 @@ QColor darken(QColor color, float p)
}
void gLineChart::resetGraphViewSettings() {
#if !defined(ENABLE_ALWAYS_ON_ZERO_RED_LINE_FLOW_RATE)
// always turn zero red line on as default value.
if (m_code==CPAP_FlowRate) {
m_dot_enabled[m_code][Calc_Zero] = true;
}
else if (m_code==CPAP_Leak) {
} else
#endif
if (m_code==CPAP_Leak) {
m_dot_enabled[m_code][Calc_UpperThresh] = true;
}
}
@ -259,7 +262,12 @@ skipcheck:
if (m_codes[0] == CPAP_Leak) {
addDotLine(DottedLine(CPAP_Leak, Calc_UpperThresh, schema::channel[CPAP_Leak].calc[Calc_UpperThresh].enabled));
} else if (m_codes[0] == CPAP_FlowRate) {
addDotLine(DottedLine(CPAP_FlowRate, Calc_Zero, schema::channel[CPAP_FlowRate].calc[Calc_Zero].enabled));
//addDotLine(DottedLine(CPAP_FlowRate, Calc_Zero, schema::channel[CPAP_FlowRate].calc[Calc_Zero].enabled));
addDotLine(DottedLine(CPAP_FlowRate, Calc_Zero, false ));
#if defined(ENABLE_ALWAYS_ON_ZERO_RED_LINE_FLOW_RATE)
//on set day force red line on.
m_dot_enabled[m_code][Calc_Zero] = true;
#endif
} else if (m_codes[0] == OXI_Pulse) {
addDotLine(DottedLine(OXI_Pulse, Calc_UpperThresh, schema::channel[OXI_Pulse].calc[Calc_UpperThresh].enabled));
addDotLine(DottedLine(OXI_Pulse, Calc_LowerThresh, schema::channel[OXI_Pulse].calc[Calc_LowerThresh].enabled));
@ -268,6 +276,7 @@ skipcheck:
}
if (m_day) {
for (auto & dot : m_dotlines) {
dot.calc(m_day);
@ -1099,7 +1108,7 @@ void gLineChart::paint(QPainter &painter, gGraph &w, const QRegion &region)
//The problem was that turning lineCUrsor mode off (or Control L) also stopped flag event on most daily graphs.
// The user didn't know what trigger the problem. Best quess is that Control L was typed by mistable.
// this fix allows flag events to be normally displayed when the line Cursor mode is off.
//was if (m_day /*&& (AppSetting->lineCursorMode() || (m_codes[0]==CPAP_FlowRate))*/)
//was if (m_day /*&& (AppSetting->lineCursorMode() || (m_codes[0]==CPAP_FlowRate))*/)
if (m_day) {
bool blockhover = false;
for (auto fit=flags.begin(), end=flags.end(); fit != end; ++fit) {

View File

@ -18,6 +18,7 @@
#include "SleepLib/day.h"
#include "Graphs/gLineOverlay.h"
#define ENABLE_ALWAYS_ON_ZERO_RED_LINE_FLOW_RATE
enum DottedLineCalc {
DLC_Zero, DLC_Min, DLC_Mid, DLC_Perc, DLC_Max, DLC_UpperThresh, DLC_LowerThresh
};