Rich Freeman's patchset #1

This commit is contained in:
Mark Watkins 2012-11-12 17:24:18 +10:00
parent b76b772b53
commit a2b4cf1967
9 changed files with 39 additions and 8 deletions

View File

@ -597,7 +597,7 @@ bool PRS1Loader::Parse002v5(qint32 sequence, quint32 timestamp, unsigned char *b
CPAP_LeakTotal, PRS1_12
};
int ncodes=sizeof(Codes)/sizeof(QString);
int ncodes=sizeof(Codes)/sizeof(ChannelID);
EventList * Code[0x20]={NULL};
EventList * OA=session->AddEventList(CPAP_Obstructive, EVL_Event);

View File

@ -31,10 +31,10 @@ TEMPLATE = app
#exists(.git):DEFINES += GIT_BRANCH=\\\"$$system(git rev-parse --symbolic-full-name --abbrev-ref HEAD)\\\"
exists(.git):DEFINES += GIT_BRANCH=\\\"$$system(git rev-parse --abbrev-ref HEAD)\\\"
else:DEFINES += GIT_BRANCH=\\\"NOT BUILT FROM GIT SOURCE\\\"
else:DEFINES += GIT_BRANCH=\\\"UNKNOWN\\\"
exists(.git):DEFINES += GIT_REVISION=\\\"$$system(git rev-parse HEAD)\\\"
else:DEFINES += GIT_BRANCH=\\\"UNKNOWN\\\"
else:DEFINES += GIT_REVISION=\\\"UNKNOWN\\\"
SOURCES += main.cpp\
SleepLib/machine.cpp \

View File

@ -6,6 +6,7 @@
#include "common_gui.h"
#include "qglobal.h"
#include <unistd.h>
#ifdef Q_WS_WIN32
#include "windows.h"

View File

@ -446,6 +446,20 @@ EventDataType calcAHI(QDate start, QDate end)
return val;
}
EventDataType calcFL(QDate start, QDate end)
{
EventDataType val=(p_profile->calcCount(CPAP_FlowLimit,MT_CPAP,start,end));
EventDataType hours=p_profile->calcHours(MT_CPAP,start,end);
if (hours>0)
val/=hours;
else
val=0;
return val;
}
struct RXChange
{
RXChange() { highlight=0; machine=NULL; }
@ -454,6 +468,7 @@ struct RXChange
last=copy.last;
days=copy.days;
ahi=copy.ahi;
fl=copy.fl;
mode=copy.mode;
min=copy.min;
max=copy.max;
@ -470,6 +485,7 @@ struct RXChange
QDate last;
int days;
EventDataType ahi;
EventDataType fl;
CPAPMode mode;
EventDataType min;
EventDataType max;
@ -940,7 +956,7 @@ void MainWindow::on_summaryButton_clicked()
} else {
min=day->settings_min(CPAP_Pressure);
}
if ((mode!=cmode) || (min!=cmin) || (max!=cmax) || (maxhi!=cmaxhi) || (mach!=lastmach) || (prelief!=lastpr)) {
if ((mode!=cmode) || (min!=cmin) || (max!=cmax) || (mach!=lastmach) || (prelset!=lastprelset)) {
if ((cmode!=MODE_UNKNOWN) && (lastmach!=NULL)) {
first=date.addDays(1);
int days=PROFILE.countDays(MT_CPAP,first,last);
@ -949,6 +965,7 @@ void MainWindow::on_summaryButton_clicked()
rx.last=last;
rx.days=days;
rx.ahi=calcAHI(first,last);
rx.fl=calcFL(first,last);
rx.mode=cmode;
rx.min=cmin;
rx.max=cmax;
@ -998,6 +1015,7 @@ void MainWindow::on_summaryButton_clicked()
rx.last=last;
rx.days=days;
rx.ahi=calcAHI(first,last);
rx.fl=calcFL(first,last);
rx.mode=mode;
rx.min=min;
rx.max=max;
@ -1181,11 +1199,12 @@ void MainWindow::on_summaryButton_clicked()
.arg(tr("Pressure"));
}
QString tooltip;
html+=QString("<tr><td><b>%1</b></td><td><b>%2</b></td><td><b>%3</b></td><td><b>%4</b></td><td><b>%5</b></td><td><b>%6</b></td><td><b>%7</td>%8</tr>")
html+=QString("<tr><td><b>%1</b></td><td><b>%2</b></td><td><b>%3</b></td><td><b>%4</b></td><td><b>%5</b></td><td><b>%6</b></td><td><b>%7</td><td><b>%8</td>%9</tr>")
.arg(tr("First"))
.arg(tr("Last"))
.arg(tr("Days"))
.arg(ahitxt)
.arg(tr("FL"))
.arg(tr("Machine"))
.arg(tr("Mode"))
.arg(tr("Pr. Rel."))
@ -1261,13 +1280,14 @@ void MainWindow::on_summaryButton_clicked()
tooltipshow=QString("tooltip.show(\"%1\");").arg(tooltip);
tooltiphide="tooltip.hide();";
}
html+=QString("<tr bgcolor='"+color+"' onmouseover='ChangeColor(this, \"#eeeeee\"); %12' onmouseout='ChangeColor(this, \""+color+"\"); %13' onclick='alert(\"overview=%1,%2\");'><td>%3</td><td>%4</td><td>%5</td><td>%6</td><td>%7</td><td>%8</td><td>%9</td><td>%10</td>%11</tr>")
html+=QString("<tr bgcolor='"+color+"' onmouseover='ChangeColor(this, \"#eeeeee\"); %13' onmouseout='ChangeColor(this, \""+color+"\"); %14' onclick='alert(\"overview=%1,%2\");'><td>%3</td><td>%4</td><td>%5</td><td>%6</td><td>%7</td><td>%8</td><td>%9</td><td>%10</td><td>%11</td>%12</tr>")
.arg(rx.first.toString(Qt::ISODate))
.arg(rx.last.toString(Qt::ISODate))
.arg(rx.first.toString(Qt::SystemLocaleShortDate))
.arg(rx.last.toString(Qt::SystemLocaleShortDate))
.arg(rx.days)
.arg(rx.ahi,0,'f',decimals)
.arg(rx.fl,0,'f',decimals)
.arg(rx.machine->GetClass())
.arg(schema::channel[CPAP_Mode].option(int(rx.mode)-1))
.arg(presrel)

View File

@ -98,6 +98,8 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
UC=createGraph(tr("Usage"),tr("Usage\n(hours)"));
FL=createGraph(tr("Flow Limit"),tr("Flow Limit"));
float percentile=PROFILE.general->prefCalcPercentile()/100.0;
int mididx=PROFILE.general->prefCalcMiddle();
SummaryType ST_mid;
@ -171,6 +173,10 @@ Overview::Overview(QWidget *parent,gGraphView * shared) :
uc->addSlice(NoChannel,QColor("green"),ST_HOURS);
UC->AddLayer(uc);
fl=new SummaryChart(tr("FL"),GT_BAR);
fl->addSlice(CPAP_FlowLimit,QColor("brown"),ST_CPH);
FL->AddLayer(fl);
us=new SummaryChart(STR_UNIT_Hours,GT_SESSIONS);
us->addSlice(NoChannel,QColor("dark blue"),ST_HOURS);
us->addSlice(NoChannel,QColor("blue"),ST_SESSIONS);

View File

@ -58,8 +58,8 @@ public:
\param QString units The units of measurements to show in the popup */
gGraph * createGraph(QString name,QString units="",YTickerType yttype=YT_Number);
gGraph *AHI, *AHIHR, *UC, *US, *PR,*LK,*NPB,*SET,*SES,*RR,*MV,*TV,*PTB,*PULSE,*SPO2,*WEIGHT,*ZOMBIE, *BMI, *TGMV, *TOTLK;
SummaryChart *bc,*uc, *us, *pr,*lk,*npb,*set,*ses,*rr,*mv,*tv,*ptb,*pulse,*spo2,*weight,*zombie, *bmi, *ahihr, *tgmv, *totlk;
gGraph *AHI, *AHIHR, *UC, *FL, *US, *PR,*LK,*NPB,*SET,*SES,*RR,*MV,*TV,*PTB,*PULSE,*SPO2,*WEIGHT,*ZOMBIE, *BMI, *TGMV, *TOTLK;
SummaryChart *bc,*uc, *fl, *us, *pr,*lk,*npb,*set,*ses,*rr,*mv,*tv,*ptb,*pulse,*spo2,*weight,*zombie, *bmi, *ahihr, *tgmv, *totlk;
//! \breif List of SummaryCharts shown on the overview page
QVector<SummaryChart *> OverviewCharts;

View File

@ -11,6 +11,7 @@
#ifndef _ZLIBIOAPI_H
#define _ZLIBIOAPI_H
#define OF(x) x
#define ZLIB_FILEFUNC_SEEK_CUR (1)
#define ZLIB_FILEFUNC_SEEK_END (2)

View File

@ -68,6 +68,7 @@ typedef unzFile__ *unzFile;
typedef voidp unzFile;
#endif
#define OF(x) x
#define UNZ_OK (0)
#define UNZ_END_OF_LIST_OF_FILE (-100)

View File

@ -69,6 +69,8 @@ typedef zipFile__ *zipFile;
typedef voidp zipFile;
#endif
#define OF(x) x
#define ZIP_OK (0)
#define ZIP_EOF (0)
#define ZIP_ERRNO (Z_ERRNO)