SummaryChart highlight improvement, Details tab tooltip position, SearchEvent optimisation.

This commit is contained in:
Mark Watkins 2012-01-06 13:15:52 +10:00
parent b626cd0200
commit 0b3d47a7f0
4 changed files with 25 additions and 43 deletions

View File

@ -391,6 +391,13 @@ void SummaryChart::paint(gGraph & w,int left, int top, int width, int height)
if (x2<x1)
goto jumpnext;
if (zd==hl_day) {
QColor col=QColor("red");
col.setAlpha(64);
quads->add(x1-1,top,x1-1,top+height,x2,top+height,x2,top,col.rgba());
}
if (m_graphtype==GT_SESSIONS) {
int j;
QHash<int,QHash<short,EventDataType> >::iterator times=m_times.find(zd);

View File

@ -21,6 +21,8 @@ bool SearchApnea(Session *session, qint64 time, qint64 dist=15000)
return false;
}
// Support function for calcRespRate()
int filterFlow(Session *session, EventList *in, EventList *out, EventList *tv, EventList *mv, double rate)
{

View File

@ -153,12 +153,6 @@ bool Session::StoreSummary(QString filename)
out << m_timesummary;
out << m_gain;
// First output the Machine Code and type for each summary record
/* for (QHash<ChannelID,QVariant>::iterator i=settings.begin(); i!=settings.end(); i++) {
ChannelID mc=i.key();
out << (qint16)mc;
out << i.value();
} */
file.close();
return true;
}
@ -218,7 +212,6 @@ bool Session::LoadSummary(QString filename)
in >> s_first; // Start time
in >> s_last; // Duration // (16bit==Limited to 18 hours)
QHash<ChannelID,EventDataType> cruft;
if (version<7) {
@ -256,11 +249,6 @@ bool Session::LoadSummary(QString filename)
}
ztmp.clear();
in >> ztmp; // 90p
// Ignore this
// for (QHash<QString,EventDataType>::iterator i=ztmp.begin();i!=ztmp.end();i++) {
// code=schema::channel[i.key()].id();
// m_90p[code]=i.value();
// }
ztmp.clear();
in >> ztmp; // min
for (QHash<QString,EventDataType>::iterator i=ztmp.begin();i!=ztmp.end();i++) {
@ -673,23 +661,12 @@ void Session::updateCountSummary(ChannelID code)
time=start + *tptr++;
raw=*dptr++;
//raw=e.raw(j);
valsum[raw]++;
// vsi=valsum.find(raw);
// if (vsi==valsum.end()) {
// valsum[raw]=1;
// }
// else vsi.value()++;
//time=e.time(j);
// elapsed time in seconds since last event
len=(time-lasttime) / 1000L;
timesum[lastraw]+=len;
// tsi=timesum.find(lastraw);
// if (tsi==timesum.end()) timesum[raw]=len;
// else tsi.value()+=len;
lastraw=raw;
lasttime=time;
@ -735,30 +712,26 @@ void Session::UpdateSummaries()
sph(id);
avg(id);
wavg(id);
// p90(id);
// p95(id);
// median(id);
}
}
/*if (channelExists(CPAP_Obstructive)) {
setCph(CPAP_AHI,cph(CPAP_Obstructive)+cph(CPAP_Hypopnea)+cph(CPAP_ClearAirway));
setSph(CPAP_AHI,sph(CPAP_Obstructive)+sph(CPAP_Hypopnea)+sph(CPAP_ClearAirway));
}*/
}
bool Session::SearchEvent(ChannelID code, qint64 time, qint64 dist)
{
qint64 t;
qint64 t,start;
QHash<ChannelID,QVector<EventList *> >::iterator it;
it=eventlist.find(code);
quint32 * tptr;
int cnt;
if (it!=eventlist.end()) {
for (int i=0;i<it.value().size();i++) {
EventList *el=it.value()[i];
for (unsigned j=0;j<el->count();j++) {
t=el->time(j);
if (qAbs(time-t)<dist)
start=el->first();
tptr=el->rawTime();
cnt=el->count();
for (unsigned j=0;j<cnt;j++) {
t=start + *tptr++;
if (qAbs(time - t) < dist)
return true;
}
}

View File

@ -827,29 +827,29 @@ void Daily::Load(QDate date)
QString cs;
if (!isBrick) {
if (cpap->machine->GetClass()==STR_MACH_ResMed) {
cs="4 width='100%' align=center>";
cs="4 width='70%' align=center>";
} else cs="2 width='50%'>";
html+="<tr><td colspan="+cs+"<table cellspacing=0 cellpadding=1 border=0 width='100%'>";
if (PROFILE.general->calculateRDI()) {
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info2 href='#'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info href='#'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
.arg("#F88017").arg("black").arg(tr("RDI")).arg(schema::channel[CPAP_RDI].description()).arg(ahi,0,'f',2);
} else {
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info2 href='#'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info href='#'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
.arg("#F88017").arg("black").arg(tr("AHI")).arg(schema::channel[CPAP_AHI].description()).arg(ahi,0,'f',2);
//html+="<tr><td align='left' bgcolor='#F88017'><b><font color='black'><a class=info href='#'>"+tr("AHI")+"<span class='classic'>"+schema::channel[CPAP_AHI].description()+"</span></a></font></b></td><td width=20% bgcolor='#F88017'><b><font color='black'>"+QString().sprintf("%.2f",ahi)+"</font></b></td></tr>\n";
}
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info2 href='event=%6'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info href='event=%6'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
.arg("#4040ff").arg("white").arg(tr("Hypopnea")).arg(schema::channel[CPAP_Hypopnea].description()).arg(hi,0,'f',2).arg(CPAP_Hypopnea);
if (cpap->machine->GetClass()==STR_MACH_ResMed) {
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info2 href='event=%6'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info href='event=%6'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
.arg("#208020").arg("black")
.arg(tr("Apnea")).arg(schema::channel[CPAP_Apnea].description()).arg(uai,0,'f',2).arg(CPAP_Apnea);
}
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info2 href='event=%6'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info href='event=%6'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
.arg("#40afbf").arg("black").arg(tr("Obstructive")).arg(schema::channel[CPAP_Obstructive].description()).arg(oai,0,'f',2).arg(CPAP_Obstructive);
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info2 href='event=%6'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
html+=QString("<tr><td align='left' bgcolor='%1'><b><font color='%2'><a class=info href='event=%6'>%3<span>%4</span></a></font></b></td><td width=20% bgcolor='%1'><b><font color='%2'>%5</font></b></td></tr>\n")
.arg("#b254cd").arg("black").arg(tr("Clear Airway")).arg(schema::channel[CPAP_ClearAirway].description()).arg(cai,0,'f',2).arg(CPAP_ClearAirway);
html+="</table></td>";