Don't Pull this one.. Swapping computers

This commit is contained in:
Mark Watkins 2011-07-02 19:49:53 +10:00
parent 40bb6f32af
commit 454934b246
6 changed files with 36 additions and 16 deletions

View File

@ -400,12 +400,15 @@ void HistoryData::Reload(Day *day)
for (vector<Day *>::iterator dd=daylist.begin(); dd!=daylist.end(); dd++) { // average any multiple data sets
Day *d=(*dd);
if (d->machine_type()==MT_CPAP) {
y=Calc(d);
y+=Calc(d);
z++;
}
}
if (!z) continue;
if (z>1) y /= z;
if (!z)
continue;
if (z>1)
y /= z;
if (first) {
// max_x=min_x=x;
lasty=max_y=min_y=y;
@ -443,6 +446,7 @@ void HistoryData::Reload(Day *day)
max_y++;
}
}
// assert(max_y<10000000);
real_min_y=min_y;
real_max_y=max_y;
m_ready=true;

View File

@ -357,14 +357,18 @@ bool ResmedLoader::LoadEVE(Session *sess,EDFParser &edf)
//Event *e;
for (int s=0;s<edf.GetNumSignals();s++) {
recs=edf.edfsignals[s]->nr*edf.GetNumDataRecords()*2;
totaldur=edf.GetNumDataRecords()*edf.GetDuration();
totaldur/=3600.0;
if (!sess->first().isValid()) {
sess->set_first(edf.startdate);
totaldur=edf.GetNumDataRecords()*edf.GetDuration();
if (totaldur>0) {
sess->set_last(edf.startdate.addMSecs(totaldur*1000.0));
sess->set_hours(totaldur/3600.0);
}
}
// totaldur/=3600.0;
//t.sprintf("EVE: %li %.2f",recs,totaldur);
//qDebug() << edf.edfsignals[s]->label << " " << t;
data=(char *)edf.edfsignals[s]->data;

View File

@ -179,7 +179,7 @@ double Session::weighted_avg_event_field(MachineCode mc,int field)
//double hours=total.GetSeconds().GetLo()/3600.0;
double s0=0,s1=0,s2=0;
if (total==0) return 0;
for (int i=0; i<max_slots; i++) {
if (vtime[i] > 0) {
s0=(vtime[i]/3600.0);
@ -188,7 +188,7 @@ double Session::weighted_avg_event_field(MachineCode mc,int field)
}
}
return (s1/hours())/mult;
return (s1/total)/mult;
}
void Session::AddEvent(Event * e)

View File

@ -66,6 +66,9 @@ public:
s_last=d;
};
void set_hours(float h) {
if (h<=0) {
h=0.000001;
}
s_hours=h;
};

View File

@ -45,7 +45,7 @@ Overview::Overview(QWidget *parent,QGLContext *context) :
gSplitter->setHandleWidth(3);
ui->graphLayout->addWidget(gSplitter);
AHI=new gGraphWindow(ui->SummaryGraphWindow,tr("AHI"),(QGLWidget *)NULL); // Not sure here..
AddGraph(AHI=new gGraphWindow(ui->SummaryGraphWindow,tr("AHI"),(QGLWidget *)NULL));
AHI->SetTopMargin(10);
AHI->SetBottomMargin(AHI->GetBottomMargin()+gXAxis::Margin+25);
AHI->AddLayer(new gFooBar(7));
@ -53,7 +53,7 @@ Overview::Overview(QWidget *parent,QGLContext *context) :
AHI->AddLayer(new gBarChart(ahidata,QColor("red")));
AHI->setMinimumHeight(170);
PRESSURE=new gGraphWindow(ui->SummaryGraphWindow,tr("Pressure"),AHI);
AddGraph(PRESSURE=new gGraphWindow(ui->SummaryGraphWindow,tr("Pressure"),AHI));
//PRESSURE->SetMargins(10,15,65,80);
PRESSURE->AddLayer(new gYAxis());
PRESSURE->AddLayer(new gXAxis());
@ -66,7 +66,7 @@ Overview::Overview(QWidget *parent,QGLContext *context) :
PRESSURE->SetBottomMargin(PRESSURE->GetBottomMargin()+25);
PRESSURE->setMinimumHeight(170);
LEAK=new gGraphWindow(ui->SummaryGraphWindow,tr("Leak"),AHI);
AddGraph(LEAK=new gGraphWindow(ui->SummaryGraphWindow,tr("Leak"),AHI));
//LEAK->SetMargins(10,15,65,80);
//LEAK->AddLayer(new gBarChart(leak,wxYELLOW));
LEAK->AddLayer(new gXAxis());
@ -76,7 +76,7 @@ Overview::Overview(QWidget *parent,QGLContext *context) :
LEAK->SetBottomMargin(LEAK->GetBottomMargin()+25);
LEAK->setMinimumHeight(170);
USAGE=new gGraphWindow(ui->SummaryGraphWindow,tr("Usage (Hours)"),AHI);
AddGraph(USAGE=new gGraphWindow(ui->SummaryGraphWindow,tr("Usage (Hours)"),AHI));
//USAGE->SetMargins(10,15,65,80);
USAGE->AddLayer(new gFooBar(7));
USAGE->AddLayer(new gYAxis());
@ -114,7 +114,12 @@ Overview::~Overview()
delete dummyday;
delete ui;
}
void Overview::RedrawGraphs()
{
for (list<gGraphWindow *>::iterator g=Graphs.begin();g!=Graphs.end();g++) {
(*g)->updateGL();
}
}
void Overview::ReloadGraphs()
{
for (list<HistoryData *>::iterator h=Data.begin();h!=Data.end();h++) {
@ -124,6 +129,7 @@ void Overview::ReloadGraphs()
}
on_rbLastWeek_clicked();
}
void Overview::UpdateGraphs()
{
QDate first=ui->drStart->date();
@ -132,7 +138,7 @@ void Overview::UpdateGraphs()
//(*h)->Update(dummyday);
(*h)->SetDateRange(first,last);
}
RedrawGraphs();
}

View File

@ -51,6 +51,8 @@ private:
QGLContext *shared_context;
void AddData(HistoryData *d) { Data.push_back(d); };
void AddGraph(gGraphWindow *w) { Graphs.push_back(w); };
void RedrawGraphs();
HistoryData *ahidata,*pressure,*leak,*usage,*bedtime,*waketime,*pressure_iap,*pressure_eap;
HistoryData *pressure_min,*pressure_max;
@ -60,6 +62,7 @@ private:
gLayer *prmax,*prmin,*iap,*eap,*pr;
list<HistoryData *> Data;
list<gGraphWindow *> Graphs;
Day *dummyday;
QSplitter *gSplitter;
};