Fix for oximetry session display in Daily tab

This commit is contained in:
Mark Watkins 2011-10-07 17:10:36 +10:00
parent a4d497660b
commit 837c6a2b0b
3 changed files with 22 additions and 17 deletions

View File

@ -191,7 +191,8 @@ Daily::Daily(QWidget *parent,gGraphView * shared, MainWindow *mw)
SPO2->AddLayer(AddOXI(new gLineChart(OXI_SPO2,Qt::blue,true)));
PLETHY->AddLayer(AddOXI(new gLineChart(OXI_Plethy,Qt::darkBlue,false)));
SPO2->forceMinY(60);
SPO2->forceMaxY(100);
SPO2->forceMinY(70);
PULSE->forceMinY(40);
for (int i=0;i<ng;i++){
graphs[i]->AddLayer(new gYAxis(),LayerLeft,gYAxis::Margin);
@ -608,21 +609,25 @@ void Daily::Load(QDate date)
html+="<tr><td align=center>SessionID</td><td align=center>Date</td><td align=center>Start</td><td align=center>End</td></tr>";
QDateTime fd,ld;
bool corrupted_waveform=false;
for (QVector<Session *>::iterator s=cpap->begin();s!=cpap->end();s++) {
fd=QDateTime::fromTime_t((*s)->first()/1000L);
ld=QDateTime::fromTime_t((*s)->last()/1000L);
QHash<ChannelID,QVariant>::iterator i=(*s)->settings.find("BrokenWaveform");
if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true;
tmp.sprintf(("<tr><td align=center>%08i</td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session());
html+=tmp;
if (cpap) {
for (QVector<Session *>::iterator s=cpap->begin();s!=cpap->end();s++) {
fd=QDateTime::fromTime_t((*s)->first()/1000L);
ld=QDateTime::fromTime_t((*s)->last()/1000L);
QHash<ChannelID,QVariant>::iterator i=(*s)->settings.find("BrokenWaveform");
if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true;
tmp.sprintf(("<tr><td align=center>%08i</td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session());
html+=tmp;
}
}
for (QVector<Session *>::iterator s=oxi->begin();s!=oxi->end();s++) {
fd=QDateTime::fromTime_t((*s)->first()/1000L);
ld=QDateTime::fromTime_t((*s)->last()/1000L);
QHash<ChannelID,QVariant>::iterator i=(*s)->settings.find("BrokenWaveform");
if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true;
tmp.sprintf(("<tr><td align=center>%08i</td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session());
html+=tmp;
if (oxi) {
for (QVector<Session *>::iterator s=oxi->begin();s!=oxi->end();s++) {
fd=QDateTime::fromTime_t((*s)->first()/1000L);
ld=QDateTime::fromTime_t((*s)->last()/1000L);
QHash<ChannelID,QVariant>::iterator i=(*s)->settings.find("BrokenWaveform");
if ((i!=(*s)->settings.end()) && i.value().toBool()) corrupted_waveform=true;
tmp.sprintf(("<tr><td align=center>%08i</td><td align=center>"+fd.date().toString(Qt::SystemLocaleShortDate)+"</td><td align=center>"+fd.toString("HH:mm ")+"</td><td align=center>"+ld.toString("HH:mm")+"</td></tr>").toLatin1(),(*s)->session());
html+=tmp;
}
}
html+="</table>";
if (corrupted_waveform) {

View File

@ -182,7 +182,7 @@ void Oximetry::on_RunButton_toggled(bool checked)
ev_spo2->getTime().clear();
ev_spo2->setCount(0);
lasttime=qint64(QDateTime::currentDateTime().toTime_t())*1000L; // utc??
lasttime=QDateTime::currentDateTime().toTime_t()*1000L; // utc??
starttime=lasttime;
session->SetSessionID(lasttime/1000L);

View File

@ -66,7 +66,7 @@ private:
QextSerialPort *port;
QString portname;
PORTMODE portmode;
qint64 lasttime,starttime;
double lasttime,starttime;
int lastpulse, lastspo2;
Machine * mach;