diff --git a/Graphs/graphdata_custom.cpp b/Graphs/graphdata_custom.cpp index 63bcf52b..af4095fe 100644 --- a/Graphs/graphdata_custom.cpp +++ b/Graphs/graphdata_custom.cpp @@ -45,7 +45,7 @@ void WaveData::Reload(Day *day) Waveform *w=(*l); double st=w->start().toMSecsSinceEpoch()/86400000.0; double rate=(w->duration()/w->samples())/86400.0; - qDebug("Waveform Chunk contains %i samples",w->samples()); + //qDebug("Waveform Chunk contains %i samples",w->samples()); for (int i=0;isamples();i++) { QPointD r(st,(*w)[i]); st+=rate; diff --git a/SleepLib/loader_plugins/prs1_loader.cpp b/SleepLib/loader_plugins/prs1_loader.cpp index 9b0449d8..951218fa 100644 --- a/SleepLib/loader_plugins/prs1_loader.cpp +++ b/SleepLib/loader_plugins/prs1_loader.cpp @@ -259,7 +259,7 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile) cnt++; //if (qprogress) qprogress->Pulse(); //Update((float(cnt)/float(size)*25)); - if (qprogress) qprogress->setValue((float(cnt)/float(size)*25.0)); + if (qprogress) qprogress->setValue((float(cnt)/float(size)*33.0)); } } size=sessfiles.size(); @@ -270,7 +270,7 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile) for (map::iterator s=sessfiles.begin(); s!=sessfiles.end(); s++) { session=s->first; cnt++; - if (qprogress) qprogress->setValue(25.0+(float(cnt)/float(size)*25.0)); + if (qprogress) qprogress->setValue(33.0+(float(cnt)/float(size)*33.0)); if (m->SessionExists(session)) continue; if (s->second[0].isEmpty()) continue; diff --git a/SleepLib/loader_plugins/resmed_loader.cpp b/SleepLib/loader_plugins/resmed_loader.cpp index 26613da2..a9a4e5cb 100644 --- a/SleepLib/loader_plugins/resmed_loader.cpp +++ b/SleepLib/loader_plugins/resmed_loader.cpp @@ -12,6 +12,7 @@ License: GPL #include #include #include +#include #include "resmed_loader.h" #include "SleepLib/session.h" @@ -80,7 +81,7 @@ bool EDFParser::Parse() return false; } - qDebug(startdate.toString("yyyy-MM-dd HH:mm:ss").toLatin1()); + //qDebug(startdate.toString("yyyy-MM-dd HH:mm:ss").toLatin1()); num_header_bytes=Read(8).toLong(&ok); if (!ok) @@ -130,10 +131,13 @@ bool EDFParser::Parse() for (int x=0;x >::iterator si=sessfiles.begin();si!=sessfiles.end();si++) { sessionid=si->first; - qDebug("Parsing Session %li",sessionid); + //qDebug("Parsing Session %li",sessionid); bool done=false; bool first=true; for (int i=0;isecond.size();i++) { - QString fn=si->second[i].section("_",-1).toLower(); + fn=si->second[i].section("_",-1).toLower(); EDFParser edf(si->second[i]); - qDebug("Parsing File %i %i",i,edf.filesize); + //qDebug("Parsing File %i %i",i,edf.filesize); if (!edf.Parse()) continue; @@ -328,29 +335,35 @@ bool ResmedLoader::Open(QString & path,Profile *profile) if (qprogress) qprogress->setValue(33.0+(float(++cnt)/float(size)*33.0)); } - // m->save(); + //m->Save(); if (qprogress) qprogress->setValue(100); return 0; } -//bool ResmedLoader::ParseTAL(Machine *mach,Session *sess,EDFParser &edf,int pos) bool ResmedLoader::LoadEVE(Machine *mach,Session *sess,EDFParser &edf) { QString t; + long recs; + double totaldur,duration; + char * data; + char c; + long pos; + bool sign,ok; + double d; + QDateTime tt; + EventDataType fields[3]; + MachineCode code; + Event *e; for (int s=0;snr*edf.GetNumDataRecords()*2; - double totaldur=edf.GetNumDataRecords()*edf.GetDuration(); + recs=edf.edfsignals[s]->nr*edf.GetNumDataRecords()*2; + totaldur=edf.GetNumDataRecords()*edf.GetDuration(); totaldur/=3600.0; - t.sprintf("EVE: %li %.2f",recs,totaldur); - qDebug((edf.edfsignals[s]->label+" "+t).toLatin1()); - char * data=(char *)edf.edfsignals[s]->data; - long pos=0; - QDateTime tt=edf.startdate; - bool sign; - double d; - bool ok; - double duration=0; - char c; + //t.sprintf("EVE: %li %.2f",recs,totaldur); + //qDebug((edf.edfsignals[s]->label+" "+t).toLatin1()); + data=(char *)edf.edfsignals[s]->data; + pos=0; + tt=edf.startdate; + duration=0; while (posAddEvent(e); + sess->AddEvent(new Event(tt,code,fields,1)); } else { if (t!="recording starts") { qDebug(("Unknown ResMed annotation field: "+t).toLatin1()); } } - qDebug((tt.toString("yyyy-MM-dd HH:mm:ss")+t).toLatin1()); + // qDebug((tt.toString("yyyy-MM-dd HH:mm:ss")+t).toLatin1()); } if (pos>=recs) { qDebug(("Short EDF EVE file"+edf.filename).toLatin1()); @@ -451,8 +462,8 @@ bool ResmedLoader::LoadBRP(Machine *mach,Session *sess,EDFParser &edf) Waveform *w=new Waveform(edf.startdate,code,edf.edfsignals[s]->data,recs,duration,edf.edfsignals[s]->digital_minimum,edf.edfsignals[s]->digital_maximum); edf.edfsignals[s]->data=NULL; // so it doesn't get deleted when edf gets trashed. sess->AddWaveform(w); - t.sprintf("BRP: %li %.2f",recs,duration); - qDebug((edf.edfsignals[s]->label+" "+t).toLatin1()); + //t.sprintf("BRP: %li %.2f",recs,duration); + //qDebug((edf.edfsignals[s]->label+" "+t).toLatin1()); } } void ResmedLoader::ToTimeDelta(Machine *mach,Session *sess,EDFParser &edf, qint16 *data, MachineCode code, long recs, double duration,EventDataType divisor) @@ -463,6 +474,7 @@ void ResmedLoader::ToTimeDelta(Machine *mach,Session *sess,EDFParser &edf, qint1 EventDataType c,last; for (int i=0;iAddEvent(new Event(tt,code,&c,1)); diff --git a/SleepLib/machine.cpp b/SleepLib/machine.cpp index 9e090306..321f6b4e 100644 --- a/SleepLib/machine.cpp +++ b/SleepLib/machine.cpp @@ -414,7 +414,7 @@ bool Machine::Save() for (s=d->second->begin(); s!=d->second->end(); s++) { cnt++; - if (qprogress) qprogress->setValue(50+(float(cnt)/float(size)*50.0)); + if (qprogress) qprogress->setValue(66+(float(cnt)/float(size)*33)); if ((*s)->IsChanged()) (*s)->Store(path); } } diff --git a/daily.cpp b/daily.cpp index 0391f95f..997ebec4 100644 --- a/daily.cpp +++ b/daily.cpp @@ -387,7 +387,12 @@ void Daily::UpdateEventsTree(QTreeWidget *tree,Day *day) for (m=(*s)->events.begin();m!=(*s)->events.end();m++) { MachineCode code=m->first; if (code==CPAP_Leak) continue; - if (code==CPAP_SnoreGraph) continue; + if (code==CPAP_RespiratoryRate) continue; + if (code==CPAP_TidalVolume) continue; + if (code==CPAP_MinuteVentilation) continue; + if (code==CPAP_Pressure) continue; + + if (code==CPAP_Snore) continue; if (code==PRS1_Unknown12) continue; QTreeWidgetItem *mcr; if (mcroot.find(code)==mcroot.end()) { @@ -509,18 +514,18 @@ void Daily::Load(QDate date) QString submodel=tr("Unknown Model"); - //html=html+""+tr("Machine Information")+"\n"; + //html+=""+tr("Machine Information")+"\n"; if (cpap->machine->properties.find("SubModel")!=cpap->machine->properties.end()) submodel="
"+cpap->machine->properties["SubModel"]; - html=html+""+cpap->machine->properties["Brand"]+"
"+cpap->machine->properties["Model"]+" "+cpap->machine->properties["ModelNumber"]+submodel+"\n"; + html+=""+cpap->machine->properties["Brand"]+"
"+cpap->machine->properties["Model"]+" "+cpap->machine->properties["ModelNumber"]+submodel+"\n"; if (pref.Exists("ShowSerialNumbers") && pref["ShowSerialNumbers"].toBool()) { - html=html+""+cpap->machine->properties["Serial"]+"\n"; + html+=""+cpap->machine->properties["Serial"]+"\n"; } - html=html+"Date"+tr("Sleep")+""+tr("Wake")+""+tr("Hours")+""; + html+="Date"+tr("Sleep")+""+tr("Wake")+""+tr("Hours")+""; int tt=cpap->total_time(); - html=html+""+cpap->first().date().toString(Qt::SystemLocaleShortDate)+""+cpap->first().toString("HH:mm")+""+cpap->last().toString("HH:mm")+""+a.sprintf("%02i:%02i",tt/3600,tt%60)+"\n"; - html=html+"
\n"; + html+=""+cpap->first().date().toString(Qt::SystemLocaleShortDate)+""+cpap->first().toString("HH:mm")+""+cpap->last().toString("HH:mm")+""+a.sprintf("%02i:%02i",tt/3600,tt%60)+"\n"; + html+="
\n"; QString cs; if (cpap->machine->GetClass()!="PRS1") { @@ -542,7 +547,7 @@ void Daily::Load(QDate date) } html+=""; - html=html+("")+tr("Event Breakdown")+("\n"); + html+=("")+tr("Event Breakdown")+("\n"); { G_AHI->setFixedSize(gwwidth,gwheight); QPixmap pixmap=G_AHI->renderPixmap(120,120,false); //gwwidth,gwheight,false); @@ -552,49 +557,49 @@ void Daily::Load(QDate date) pixmap.save(&buffer, "PNG"); html += "\n"; } - html=html+(""); - html=html+("\n"); - //html=html+("\n"); - html=html+("\n"); - //html=html+wxT("\n"); + html+=("
 


"); + html+=("\n"); + //html+=("\n"); + html+=("\n"); + //html+=wxT("\n"); if (mode==MODE_BIPAP) { - html=html+("\n"; - html=html+("\n"; + html+=("\n"; + html+=("\n"; } else if (mode==MODE_APAP) { - html=html+("\n"); + html+=("\n"); } else if (mode==MODE_CPAP) { - html=html+("\n"); + html+=("\n"); } - //html=html+("\n"); + //html+=("\n"); - html=html+(""); + html+=(""); if (mode==MODE_APAP) { - html=html+""); + html+=""); - // html=html+wxT("\n"); + // html+=wxT("\n"); } else if (mode==MODE_BIPAP) { - html=html+(""); + html+=(""); - html=html+(""); + html+=(""); } - html=html+""); + html+=""); - html=html+""); + html+=""); FRW->show(); PRD->show(); LEAK->show(); @@ -624,17 +629,17 @@ void Daily::Load(QDate date) } if (oxi) { - html=html+""; + html+=""; - html=html+""; + html+=""; - //html=html+wxT("\n"); + //html+=wxT("\n"); PULSE->show(); //SPO2->show(); @@ -648,14 +653,11 @@ void Daily::Load(QDate date) } else NoData->hide(); - //ui->graphSizer->invalidate(); - //ui->graphSizer->layout(); - //GraphWindow->FitInside(); if (cpap) { if (mode==MODE_BIPAP) { } else if (mode==MODE_APAP) { - html=html+("\n"); + html+=("\n"); TAP->setFixedSize(gwwidth,gwheight); QPixmap pixmap=TAP->renderPixmap(gwwidth,gwheight,false); @@ -663,21 +665,20 @@ void Daily::Load(QDate date) QBuffer buffer(&byteArray); // use buffer to store pixmap into byteArray buffer.open(QIODevice::WriteOnly); pixmap.save(&buffer, "PNG"); - html += "\n"; + html+="\n"; } - html=html+("
 


")+tr("90% EPAP ")+a.sprintf("%.2f",eap90)+tr("cmH2O")+"
")+tr("90% IPAP ")+a.sprintf("%.2f",iap90)+"
")+tr("90% EPAP ")+a.sprintf("%.2f",eap90)+tr("cmH2O")+"
")+tr("90% IPAP ")+a.sprintf("%.2f",iap90)+"
")+tr("90% Pressure ")+a.sprintf("%.2f",cpap->summary_weighted_avg(CPAP_PressurePercentValue))+("
")+tr("90% Pressure ")+a.sprintf("%.2f",cpap->summary_weighted_avg(CPAP_PressurePercentValue))+("
")+tr("Pressure ")+a.sprintf("%.2f",cpap->summary_min(CPAP_PressureMin))+("
")+tr("Pressure ")+a.sprintf("%.2f",cpap->summary_min(CPAP_PressureMin))+("
 
 
MinAvgMax
MinAvgMax
"+tr("Pressure")+""+a.sprintf("%.2f",cpap->summary_min(CPAP_PressureMinAchieved)); - html=html+("")+a.sprintf("%.2f",cpap->summary_weighted_avg(CPAP_PressureAverage)); - html=html+("")+a.sprintf("%.2f",cpap->summary_max(CPAP_PressureMaxAchieved))+("
"+tr("Pressure:")+""+a.sprintf("%.2f",cpap->summary_min(CPAP_PressureMinAchieved)); + html+=(" ")+a.sprintf("%.2f",cpap->summary_weighted_avg(CPAP_PressureAverage)); + html+=("")+a.sprintf("%.2f",cpap->summary_max(CPAP_PressureMaxAchieved))+("
")+_("90% Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),p90)+wxT("
")+_("90% Pressure")+wxT("")+wxString::Format(wxT("%.1fcmH2O"),p90)+wxT("
"+tr("EPAP")+"")+a.sprintf("%.2f",cpap->summary_min(BIPAP_EAPMin)); - html=html+("")+a.sprintf("%.2f",cpap->summary_weighted_avg(BIPAP_EAPAverage)); - html=html+("")+a.sprintf("%.2f",cpap->summary_max(BIPAP_EAPMax))+("
"+tr("EPAP:")+"")+a.sprintf("%.2f",cpap->summary_min(BIPAP_EAPMin)); + html+=(" ")+a.sprintf("%.2f",cpap->summary_weighted_avg(BIPAP_EAPAverage)); + html+=("")+a.sprintf("%.2f",cpap->summary_max(BIPAP_EAPMax))+("
"+tr("IPAP")+"")+a.sprintf("%.2f",cpap->summary_min(BIPAP_IAPMin)); - html=html+("")+a.sprintf("%.2f",cpap->summary_weighted_avg(BIPAP_IAPAverage)); - html=html+("")+a.sprintf("%.2f",cpap->summary_max(BIPAP_IAPMax))+("
align=left"+tr("IPAP:")+"")+a.sprintf("%.2f",cpap->summary_min(BIPAP_IAPMin)); + html+=("")+a.sprintf("%.2f",cpap->summary_weighted_avg(BIPAP_IAPAverage)); + html+=("")+a.sprintf("%.2f",cpap->summary_max(BIPAP_IAPMax))+("
"+tr("Leak"); - html=html+""+a.sprintf("%.2f",cpap->summary_min(CPAP_LeakMinimum)); - html=html+""+a.sprintf("%.2f",cpap->summary_weighted_avg(CPAP_LeakAverage)); - html=html+""+a.sprintf("%.2f",cpap->summary_max(CPAP_LeakMaximum))+("
"+tr("Leak:"); + html+=""+a.sprintf("%.2f",cpap->summary_min(CPAP_LeakMinimum)); + html+=""+a.sprintf("%.2f",cpap->summary_weighted_avg(CPAP_LeakAverage)); + html+=""+a.sprintf("%.2f",cpap->summary_max(CPAP_LeakMaximum))+("
"+tr("Snore"); - html=html+""+a.sprintf("%.2f",cpap->summary_min(CPAP_SnoreMinimum)); - html=html+""+a.sprintf("%.2f",cpap->summary_avg(CPAP_SnoreAverage)); - html=html+""+a.sprintf("%.2f",cpap->summary_max(CPAP_SnoreMaximum))+("
"+tr("Snore:"); + html+=""+a.sprintf("%.2f",cpap->summary_min(CPAP_SnoreMinimum)); + html+=""+a.sprintf("%.2f",cpap->summary_avg(CPAP_SnoreAverage)); + html+=""+a.sprintf("%.2f",cpap->summary_max(CPAP_SnoreMaximum))+("
"+tr("Pulse"); - html=html+""+a.sprintf("%.2fbpm",oxi->summary_min(OXI_PulseMin)); - html=html+""+a.sprintf("%.2fbpm",oxi->summary_avg(OXI_PulseAverage)); - html=html+""+a.sprintf("%.2fbpm",oxi->summary_max(OXI_PulseMax))+"
"+tr("Pulse:"); + html+=""+a.sprintf("%.2fbpm",oxi->summary_min(OXI_PulseMin)); + html+=""+a.sprintf("%.2fbpm",oxi->summary_avg(OXI_PulseAverage)); + html+=""+a.sprintf("%.2fbpm",oxi->summary_max(OXI_PulseMax))+"
"+tr("SpO2"); - html=html+""+a.sprintf("%.2f%%",oxi->summary_min(OXI_SPO2Min)); - html=html+""+a.sprintf("%.2f%%",oxi->summary_avg(OXI_SPO2Average)); - html=html+""+a.sprintf("%.2f%%",oxi->summary_max(OXI_SPO2Max))+"
"+tr("SpO2:"); + html+=""+a.sprintf("%.2f%%",oxi->summary_min(OXI_SPO2Min)); + html+=""+a.sprintf("%.2f%%",oxi->summary_avg(OXI_SPO2Average)); + html+=""+a.sprintf("%.2f%%",oxi->summary_max(OXI_SPO2Max))+"
 
 
")+tr("Time@Pressure")+("
")+tr("Time@Pressure")+("

"); - + html+="
"; + html+=""; for (vector::iterator s=cpap->begin();s!=cpap->end();s++) { - tmp.sprintf(("%06i "+(*s)->first().toString("yyyy-MM-dd HH:mm ")+(*s)->last().toString("HH:mm")+"
").toLatin1(),(*s)->session()); + + tmp.sprintf(("
").toLatin1(),(*s)->session()); html+=tmp; } + html+="
SessionIDDateStartEnd
%08x"+(*s)->first().toString("yyyy-MM-dd")+""+(*s)->first().toString("HH:mm ")+""+(*s)->last().toString("HH:mm")+"
"; } html+=""; - //PRD->updateGL(); ui->webView->setHtml(html); - //frw->Update(cpap); - //FRW->updateGL(); ui->JournalNotes->clear(); Session *journal=GetJournalSession(date);