diff --git a/Graphs/gFlagsLine.cpp b/Graphs/gFlagsLine.cpp index 2b395333..72c22a1c 100644 --- a/Graphs/gFlagsLine.cpp +++ b/Graphs/gFlagsLine.cpp @@ -52,8 +52,8 @@ void gFlagsGroup::Plot(gGraphWindow &w, float scrx, float scry) } -gFlagsLine::gFlagsLine(gPointData *d,QColor col,QString _label,bool always_visible, int _line_num,int _total_lines) -:gLayer(d),label(_label),m_always_visible(always_visible),line_num(_line_num),total_lines(_total_lines) +gFlagsLine::gFlagsLine(gPointData *d,QColor col,QString _label,bool always_visible) +:gLayer(d),label(_label),m_always_visible(always_visible) { color.clear(); color.push_back(col); diff --git a/Graphs/gFlagsLine.h b/Graphs/gFlagsLine.h index 456416e7..bc27319a 100644 --- a/Graphs/gFlagsLine.h +++ b/Graphs/gFlagsLine.h @@ -15,7 +15,7 @@ class gFlagsLine:public gLayer { friend class gFlagsGroup; public: - gFlagsLine(gPointData *d=NULL,QColor col=Qt::black,QString _label="",bool always_visible=false, int _line_num=0,int _total_lines=0); + gFlagsLine(gPointData *d=NULL,QColor col=Qt::black,QString _label="",bool always_visible=false); virtual ~gFlagsLine(); virtual void Plot(gGraphWindow & w,float scrx,float scry); @@ -23,10 +23,12 @@ class gFlagsLine:public gLayer void setAlwaysVisible(bool b) { m_always_visible=b; } QString Label() { return label; } void Label(QString s) { label=s; } + void setTotalLines(int i) { total_lines=i; }; + void setLineNum(int i) { line_num=i; }; protected: QString label; bool m_always_visible; - int line_num,total_lines; + int total_lines,line_num; }; class gFlagsGroup:public gLayerGroup diff --git a/Graphs/graphdata_custom.cpp b/Graphs/graphdata_custom.cpp index 3761bebb..35efcbfa 100644 --- a/Graphs/graphdata_custom.cpp +++ b/Graphs/graphdata_custom.cpp @@ -289,15 +289,15 @@ void AHIData::Reload(Day *day) point[0][3].setX(point[0][3].y()); point[0][4].setY(day->count(CPAP_FlowLimit)/day->hours()); point[0][4].setX(point[0][4].y()); - point[0][5].setY((100.0/day->hours())*(day->sum(CPAP_CSR)/3600.0)); - point[0][5].setX(point[0][5].y()); - np[0]=6; + //point[0][5].setY((100.0/day->hours())*(day->sum(CPAP_CSR)/3600.0)); + //point[0][5].setX(point[0][5].y()); + np[0]=5; m_ready=true; //REFRESH?? } -FlagData::FlagData(MachineCode _code,double _value,int _field,int _offset) -:gPointData(65536),code(_code),value(_value),field(_field),offset(_offset) +FlagData::FlagData(MachineCode _code,int _field,int _offset) +:gPointData(65536),code(_code),field(_field),offset(_offset) { AddSegment(max_points); } @@ -330,7 +330,6 @@ void FlagData::Reload(Day *day) point[vc][c].setY(v2); v1=point[vc][c].x(); v2=point[vc][c].y(); - //point[vc][c].z=value; c++; if (c>=max_points) { qWarning() << "FlagData: max_points exceeded"; @@ -348,8 +347,8 @@ void FlagData::Reload(Day *day) } if (done) break; } - min_y=-value; - max_y=value; + min_y=0;//-value; + max_y=1;//value; np[vc]=c; vc++; real_min_x=min_x; diff --git a/Graphs/graphdata_custom.h b/Graphs/graphdata_custom.h index 32520c6f..8d8a7cdf 100644 --- a/Graphs/graphdata_custom.h +++ b/Graphs/graphdata_custom.h @@ -16,12 +16,11 @@ class FlagData:public gPointData { public: - FlagData(MachineCode _code,double _value=0,int _field=-1,int _offset=-1); + FlagData(MachineCode _code,int _field=-1,int _offset=-1); virtual ~FlagData(); virtual void Reload(Day *day=NULL); protected: MachineCode code; - double value; int field; int offset; }; diff --git a/SleepLib/loader_plugins/resmed_loader.cpp b/SleepLib/loader_plugins/resmed_loader.cpp index e569b10f..b3ca3cfa 100644 --- a/SleepLib/loader_plugins/resmed_loader.cpp +++ b/SleepLib/loader_plugins/resmed_loader.cpp @@ -557,7 +557,7 @@ bool ResmedLoader::LoadPLD(Session *sess,EDFParser &edf) code=CPAP_Snore; ToTimeDelta(sess,edf,edf.edfsignals[s]->data, code,recs,duration); } else if (edf.edfsignals[s]->label=="Therapy Pres") { - code=CPAP_Pressure; + code=CPAP_TherapyPressure; ToTimeDelta(sess,edf,edf.edfsignals[s]->data, code,recs,duration,50.0); //50.0 } else if (edf.edfsignals[s]->label=="MV") { code=CPAP_MinuteVentilation; @@ -584,7 +584,7 @@ bool ResmedLoader::LoadPLD(Session *sess,EDFParser &edf) code=CPAP_FlowLimitGraph; ToTimeDelta(sess,edf,edf.edfsignals[s]->data, code,recs,duration,1.0); } else if (edf.edfsignals[s]->label=="Mask Pres") { - code=CPAP_MaskPressureEvt; + code=CPAP_Pressure; ToTimeDelta(sess,edf,edf.edfsignals[s]->data, code,recs,duration,50.0); } else if (edf.edfsignals[s]->label=="Exp Press") { code=CPAP_ExpPressure; diff --git a/SleepLib/machine_common.h b/SleepLib/machine_common.h index 624ae012..c326cdd8 100644 --- a/SleepLib/machine_common.h +++ b/SleepLib/machine_common.h @@ -43,7 +43,7 @@ enum MachineCode//:qint16 CPAP_PressureReliefSetting, CPAP_HumidifierSetting, CPAP_HumidifierStatus, CPAP_PressureMinAchieved, CPAP_PressureMaxAchieved, CPAP_PressurePercentValue, CPAP_PressurePercentName, CPAP_PressureAverage, CPAP_PressureMedian, CPAP_LeakMedian,CPAP_LeakMinimum,CPAP_LeakMaximum,CPAP_LeakAverage,CPAP_Duration, - CPAP_SnoreMinimum, CPAP_SnoreMaximum, CPAP_SnoreAverage, CPAP_SnoreMedian, CPAP_MaskPressureEvt, CPAP_ExpPressure, + CPAP_SnoreMinimum, CPAP_SnoreMaximum, CPAP_SnoreAverage, CPAP_SnoreMedian, CPAP_TherapyPressure, CPAP_ExpPressure, BIPAP_EAPAverage,BIPAP_IAPAverage,BIPAP_EAPMin,BIPAP_EAPMax,BIPAP_IAPMin,BIPAP_IAPMax, BIPAP_PSAverage,BIPAP_PSMin, BIPAP_PSMax, diff --git a/daily.cpp b/daily.cpp index 7b3b7fea..cb4e5cfe 100644 --- a/daily.cpp +++ b/daily.cpp @@ -66,16 +66,17 @@ Daily::Daily(QWidget *parent,QGLWidget * shared) : //fmt.setDefaultFormat(fmt); offscreen_context=new QGLContext(fmt); */ - AddCPAPData(flags[3]=new FlagData(CPAP_Hypopnea,4)); - AddCPAPData(flags[0]=new FlagData(CPAP_CSR,7,1,0)); - AddCPAPData(flags[1]=new FlagData(CPAP_ClearAirway,6)); - AddCPAPData(flags[2]=new FlagData(CPAP_Obstructive,5)); - AddCPAPData(flags[4]=new FlagData(CPAP_FlowLimit,3)); - AddCPAPData(flags[5]=new FlagData(CPAP_VSnore,2)); - AddCPAPData(flags[6]=new FlagData(CPAP_RERA,1)); - AddCPAPData(flags[7]=new FlagData(PRS1_PressurePulse,1)); - AddCPAPData(flags[8]=new FlagData(PRS1_Unknown0E,1)); - AddCPAPData(flags[9]=new FlagData(CPAP_Snore,1)); // Snore Index + AddCPAPData(flags[0]=new FlagData(CPAP_CSR,1,0)); + AddCPAPData(flags[1]=new FlagData(CPAP_ClearAirway)); + AddCPAPData(flags[2]=new FlagData(CPAP_Obstructive)); + AddCPAPData(flags[3]=new FlagData(CPAP_Hypopnea)); + AddCPAPData(flags[4]=new FlagData(CPAP_FlowLimit)); + AddCPAPData(flags[5]=new FlagData(CPAP_VSnore)); + AddCPAPData(flags[6]=new FlagData(CPAP_RERA)); + AddCPAPData(flags[7]=new FlagData(PRS1_PressurePulse)); + AddCPAPData(flags[8]=new FlagData(PRS1_Unknown0E)); + AddCPAPData(flags[9]=new FlagData(CPAP_Apnea)); + AddCPAPData(flags[10]=new FlagData(CPAP_Snore)); TAP=new gGraphWindow(NULL,"",(QGLWidget* )NULL); TAP_EAP=new gGraphWindow(NULL,"",(QGLWidget* )NULL); @@ -88,26 +89,27 @@ Daily::Daily(QWidget *parent,QGLWidget * shared) : SF->AddLayer(new gXAxis()); SF->setMinimumHeight(160); - int sfc=7; fg=new gFlagsGroup(); - fg->AddLayer(new gFlagsLine(flags[0],QColor("light green"),"CSR",false,0,sfc)); - fg->AddLayer(new gFlagsLine(flags[1],QColor("purple"),"CA",true,1,sfc)); - fg->AddLayer(new gFlagsLine(flags[2],QColor("#40c0ff"),"OA",true,2,sfc)); - fg->AddLayer(new gFlagsLine(flags[3],QColor("blue"),"H",true,3,sfc)); - fg->AddLayer(new gFlagsLine(flags[4],QColor("black"),"FL",false,4,sfc)); - fg->AddLayer(new gFlagsLine(flags[6],QColor("gold"),"RE",false,6,sfc)); - fg->AddLayer(new gFlagsLine(flags[5],QColor("red"),"VS",false,5,sfc)); - fg->AddLayer(new gFlagsLine(flags[8],QColor("dark green"),"U0E",7,sfc)); - //fg->AddLayer(new gFlagsLine(flags[9],QColor("red"),"VS2",8,sfc)); + fg->AddLayer(new gFlagsLine(flags[0],QColor("light green"),"CSR")); + fg->AddLayer(new gFlagsLine(flags[1],QColor("purple"),"CA",true)); + fg->AddLayer(new gFlagsLine(flags[2],QColor("#40c0ff"),"OA",true)); + fg->AddLayer(new gFlagsLine(flags[3],QColor("blue"),"H",true)); + fg->AddLayer(new gFlagsLine(flags[4],QColor("black"),"FL")); + fg->AddLayer(new gFlagsLine(flags[6],QColor("gold"),"RE")); + fg->AddLayer(new gFlagsLine(flags[5],QColor("red"),"VS")); + fg->AddLayer(new gFlagsLine(flags[8],QColor("dark green"),"U0E")); + fg->AddLayer(new gFlagsLine(flags[9],QColor("dark green"),"A")); + //fg->AddLayer(new gFlagsLine(flags[10],QColor("red"),"VS2")); + SF->AddLayer(fg); // SF Foobar must go last SF->AddLayer(new gFooBar(10,QColor("orange"),QColor("dark grey"),true)); AddCPAPData(pressure_iap=new EventData(CPAP_IAP)); AddCPAPData(pressure_eap=new EventData(CPAP_EAP)); - AddCPAPData(prd=new EventData(CPAP_MaskPressureEvt)); - pressure_eap->ForceMinY(0); - pressure_eap->ForceMaxY(30); + AddCPAPData(prd=new EventData(CPAP_Pressure)); + //pressure_eap->ForceMinY(0); + //pressure_eap->ForceMaxY(30); PRD->AddLayer(new gXAxis()); PRD->AddLayer(new gYAxis()); @@ -246,14 +248,14 @@ Daily::Daily(QWidget *parent,QGLWidget * shared) : l->AddName(tr("CA")); l->AddName(tr("RE")); l->AddName(tr("FL")); - l->AddName(tr("CSR")); + // l->AddName(tr("CSR")); l->color.clear(); l->color.push_back(QColor(0x40,0x40,0xff,0xff)); // blue l->color.push_back(QColor(0x40,0xaf,0xbf,0xff)); // aqua l->color.push_back(QColor(0xb2,0x54,0xcd,0xff)); // purple l->color.push_back(QColor(0xff,0xff,0x80,0xff)); // yellow l->color.push_back(QColor(0x40,0x40,0x40,0xff)); // dark grey - l->color.push_back(QColor(0x60,0xff,0x60,0xff)); // green + //l->color.push_back(QColor(0x60,0xff,0x60,0xff)); // green G_AHI->AddLayer(l); G_AHI->SetGradientBackground(false); diff --git a/daily.h b/daily.h index f40abffc..68c13165 100644 --- a/daily.h +++ b/daily.h @@ -74,7 +74,7 @@ private: void UpdateCPAPGraphs(Day *day); void UpdateOXIGraphs(Day *day); - gPointData *flags[10]; + gPointData *flags[11]; Ui::Daily *ui; Profile *profile; diff --git a/mainwindow.cpp b/mainwindow.cpp index a5da2dd5..0b796459 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -87,26 +87,26 @@ MainWindow::MainWindow(QWidget *parent) : if (!pref.Exists("Profile")) pref["Profile"]=getUserName(); if (!pref.Exists("LinkGraphMovement")) pref["LinkGraphMovement"]=true; - else ui->action_Link_Graphs->setChecked(pref["LinkGraphMovement"].toBool()); + ui->action_Link_Graphs->setChecked(pref["LinkGraphMovement"].toBool()); if (!pref.Exists("ShowDebug")) pref["ShowDebug"]=true; - else ui->actionDebug->setChecked(pref["ShowDebug"].toBool()); + ui->actionDebug->setChecked(pref["ShowDebug"].toBool()); if (!pref["ShowDebug"].toBool()) { ui->logText->hide(); } if (!pref.Exists("NoonDateSplit")) pref["NoonDateSplit"]=false; - else ui->action_Noon_Date_Split->setChecked(pref["NoonDateSplit"].toBool()); + ui->action_Noon_Date_Split->setChecked(pref["NoonDateSplit"].toBool()); if (!pref.Exists("fruitsalad")) pref["fruitsalad"]=true; if (!pref.Exists("UseAntiAliasing")) pref["UseAntiAliasing"]=false; - else ui->actionUse_AntiAliasing->setChecked(pref["UseAntiAliasing"].toBool()); + ui->actionUse_AntiAliasing->setChecked(pref["UseAntiAliasing"].toBool()); first_load=true; if (!pref.Exists("AlwaysShowOverlayBars")) pref["AlwaysShowOverlayBars"]=true; - else ui->actionOverlay_Bars->setChecked(pref["AlwaysShowOverlayBars"].toBool()); + ui->actionOverlay_Bars->setChecked(pref["AlwaysShowOverlayBars"].toBool()); daily=new Daily(ui->tabWidget); ui->tabWidget->insertTab(1,daily,tr("Daily"));