PRS1 Humid/Flex Settings Summary Chart

This commit is contained in:
Mark Watkins 2011-09-19 01:43:14 +10:00
parent e02477cafd
commit bfde64fc36
10 changed files with 46 additions and 11 deletions

View File

@ -68,7 +68,7 @@ void SummaryChart::SetDay(Day * nullday)
type=m_type[j];
for (int i=0;i<d.value().size();i++) {
day=d.value()[i];
if (type==ST_HOURS || day->channelExists(code)) { // too many lookups happening here.. stop the crap..
if (type==ST_HOURS || day->channelExists(code) || day->settingExists(code)) { // too many lookups happening here.. stop the crap..
m_days[dn]=day;
switch(m_type[j]) {
case ST_AVG: tmp=day->avg(code); break;
@ -81,6 +81,11 @@ void SummaryChart::SetDay(Day * nullday)
case ST_CPH: tmp=day->cph(code); break;
case ST_SPH: tmp=day->sph(code); break;
case ST_HOURS: tmp=day->hours(); break;
case ST_SETMIN: tmp=day->settings_min(code); break;
case ST_SETMAX: tmp=day->settings_max(code); break;
case ST_SETAVG: tmp=day->settings_avg(code); break;
case ST_SETWAVG: tmp=day->settings_wavg(code); break;
case ST_SETSUM: tmp=day->settings_sum(code); break;
default: break;
}
//if (tmp>0) {
@ -426,6 +431,7 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event)
} else
val=QString::number(d.value()[0],'f',2);
z+="\r\n"+m_label+"="+val;
//z+="\r\nMode="+QString::number(day->settings_min("FlexSet"),'f',0);
} else {
QString a;
@ -442,7 +448,7 @@ bool SummaryChart::mouseMoveEvent(QMouseEvent *event)
default:
break;
}
if (day && day->channelExists(m_codes[i])) {
if (day && (day->channelExists(m_codes[i]) || day->settingExists(m_codes[i]))) {
schema::Channel & chan=schema::channel[m_codes[i]];
val=QString::number(d.value()[i+1],'f',2);
z+="\r\n"+chan.label()+" "+a+"="+val;

View File

@ -332,9 +332,20 @@ int Day::count(ChannelID code)
}
return sum;
}
bool Day::settingExists(ChannelID id)
{
for (int j=0;j<sessions.size();j++) {
QHash<ChannelID,QVariant>::iterator i=sessions[j]->settings.find(id);
if (i!=sessions[j]->settings.end()) {
return true;
}
}
return false;
}
bool Day::channelExists(ChannelID id)
{
return machine->hasChannel(id);
if (machine->hasChannel(id)) return true;
return false;
}
bool Day::channelHasData(ChannelID id)
{

View File

@ -69,6 +69,8 @@ public:
QVector<Session *> & getSessions() { return sessions; }
bool channelExists(ChannelID id);
bool channelHasData(ChannelID id);
bool settingExists(ChannelID id);
protected:
QVector<Session *> sessions;
qint64 d_first,d_last;

View File

@ -400,9 +400,7 @@ int ResmedLoader::Open(QString & path,Profile *profile)
EDFSignal *sig;
if (mode==0) {
sess->settings["PAPMode"]=MODE_CPAP;
//m->registerChannel(CPAP_EPAP,false);
//m->registerChannel("IPAP",false);
sess->settings[CPAP_Mode]=MODE_CPAP;
sig=stredf.lookup["Set Pressure"];
EventDataType pressure=sig->data[dn]*sig->gain;
sess->settings[CPAP_Pressure]=pressure;

View File

@ -19,7 +19,7 @@
class Machine;
const quint32 magic=0xC73216AB;
enum SummaryType { ST_CNT, ST_SUM, ST_AVG, ST_WAVG, ST_90P, ST_MIN, ST_MAX, ST_CPH, ST_SPH, ST_FIRST, ST_LAST, ST_HOURS };
enum SummaryType { ST_CNT, ST_SUM, ST_AVG, ST_WAVG, ST_90P, ST_MIN, ST_MAX, ST_CPH, ST_SPH, ST_FIRST, ST_LAST, ST_HOURS, ST_SETMIN, ST_SETAVG, ST_SETMAX, ST_SETWAVG, ST_SETSUM };
class Session
{

View File

@ -45,6 +45,7 @@
{{graph.Usage}}
{{graph.Leaks}}
{{graph.Pressure}}
{{graph.Settings}}
{{graph.%PB}}
</body>
</html>

View File

@ -54,6 +54,7 @@ Overview::Overview(QWidget *parent,Profile * _profile,gGraphView * shared) :
AHI=new gGraph(GraphView,"AHI",default_height,0);
UC=new gGraph(GraphView,"Usage",default_height,0);
PR=new gGraph(GraphView,"Pressure",default_height,0);
SET=new gGraph(GraphView,"Settings",default_height,0);
LK=new gGraph(GraphView,"Leaks",default_height,0);
uc=new SummaryChart(profile,"Hours",GT_BAR);
@ -78,6 +79,18 @@ Overview::Overview(QWidget *parent,Profile * _profile,gGraphView * shared) :
AHI->AddLayer(bc);
AHI->AddLayer(new gXGrid());
set=new SummaryChart(profile,"",GT_LINE);
//set->addSlice("SysOneResistSet",QColor("grey"),ST_SETAVG);
set->addSlice("HumidSet",QColor("blue"),ST_SETAVG);
set->addSlice("FlexSet",QColor("red"),ST_SETAVG);
//set->addSlice("PAPMode",QColor("red"),ST_SETAVG);
SET->forceMaxY(6);
SET->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
gx=new gXAxis();
gx->setUtcFix(true);
SET->AddLayer(gx,LayerBottom,0,gXAxis::Margin);
SET->AddLayer(set);
SET->AddLayer(new gXGrid());
pr=new SummaryChart(profile,"cmH2O",GT_LINE);
PR->forceMinY(4.0);
@ -132,6 +145,7 @@ Overview::Overview(QWidget *parent,Profile * _profile,gGraphView * shared) :
ui->dateStart->calendarWidget()->setWeekdayTextFormat(Qt::Sunday, format);
ui->dateEnd->calendarWidget()->setWeekdayTextFormat(Qt::Saturday, format);
ui->dateEnd->calendarWidget()->setWeekdayTextFormat(Qt::Sunday, format);
connect(ui->dateStart->calendarWidget(),SIGNAL(currentPageChanged(int,int)),SLOT(on_dateStart_currentPageChanged(int,int)));
connect(ui->dateEnd->calendarWidget(),SIGNAL(currentPageChanged(int,int)),SLOT(on_dateEnd_currentPageChanged(int,int)));
report=NULL;

View File

@ -33,8 +33,8 @@ public:
//void UpdateGraphs();
void ResetGraphLayout();
gGraph *AHI,*UC,*PR,*LK,*NPB;
SummaryChart *bc,*uc,*pr,*lk,*npb;
gGraph *AHI,*UC,*PR,*LK,*NPB,*SET;
SummaryChart *bc,*uc,*pr,*lk,*npb,*set;
public slots:
void on_printButton_clicked();

View File

@ -47,6 +47,9 @@ Report::Report(QWidget *parent, Profile * _profile, gGraphView * shared, Overvie
graphs["%PB"]=NPB=new gGraph(GraphView,"% in PB",graph_print_height,0);
NPB->AddLayer(m_overview->npb);
graphs["Settings"]=SET=new gGraph(GraphView,"Settings",graph_print_height,0);
SET->AddLayer(m_overview->set);
for (QHash<QString,gGraph *>::iterator g=graphs.begin();g!=graphs.end();g++) {
gGraph *gr=g.value();

View File

@ -36,8 +36,8 @@ private:
Overview * m_overview;
gGraphView * shared;
gGraphView * GraphView;
gGraph *AHI,*UC,*PR,*LK,*NPB;
SummaryChart *bc,*uc,*pr,*lk,*npb;
gGraph *AHI,*UC,*PR,*LK,*NPB,*SET;
SummaryChart *bc,*uc,*pr,*lk,*npb,*set;
QHash<QString,QVariant> locals;
QHash<QString,gGraph *> graphs;