ScrollArea Fix not working on windows.. Oximeter Live view Fixes

This commit is contained in:
Mark Watkins 2011-08-07 23:57:10 +10:00
parent 3f207fcb37
commit e2f304c2e6
4 changed files with 34 additions and 28 deletions

View File

@ -149,6 +149,13 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
EventList & el=*evec[n];
accel=(el.type()==EVL_Waveform); // Turn on acceleration if this is a waveform.
if (accel) {
sr=el.rate(); // Time distance between samples
if (sr<=0) {
qWarning() << "qLineChart::Plot() assert(sr>0)";
continue;
}
}
if (m_disable_accel) accel=false;
@ -183,11 +190,6 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
}
if (accel) {
//x1=el.time(1);
sr=el.rate(); // Time distance between samples
if (sr<=0) {
qWarning() << "qLineChart::Plot() assert(sr>0)";
continue;
}
double XR=xx/sr;
double Z1=MAX(x0,minx);

View File

@ -43,22 +43,22 @@ void MyScrollArea::scrollContentsBy(int dx, int dy)
{
QScrollArea::scrollContentsBy(dx,dy);
//#ifdef Q_WS_MAC || Q_WS_WIN
#ifdef Q_WS_MAC
if (timer->isActive()) timer->stop();
timer->setSingleShot(true);
timer->setInterval(200);
timer->setInterval(250);
connect(timer,SIGNAL(timeout()),SLOT(UpdateGraphs()));
timer->start();
m_time.start();
//m_daily->RedrawGraphs();
//#endif
#endif
}
void MyScrollArea::UpdateGraphs()
{
if (m_time.elapsed()<200)
if (m_time.elapsed()<250)
return;
m_time.start();
//qDebug() << "Foo!";
qDebug() << "Redraw!";
m_daily->RedrawGraphs();
}

View File

@ -29,7 +29,9 @@ QStatusBar *qstatusbar;
void MainWindow::Log(QString s)
{
ui->logText->appendPlainText(s);
static int start=QDateTime::currentDateTime().toTime_t();
QString tmp=QString("%1: %2").arg(QDateTime::currentDateTime().toTime_t()-start,5,10,QChar('0')).arg(s);
ui->logText->appendPlainText(tmp);
}

View File

@ -48,7 +48,7 @@ Oximetry::Oximetry(QWidget *parent,QGLWidget * shared) :
//ui->graphLayout->addWidget(splitter);
// Create the Event Lists to store / import data
ev_plethy=new EventList(OXI_Plethysomogram,EVL_Event,1,0,0,0,1000.0/50.0);
ev_plethy=new EventList(OXI_Plethysomogram,EVL_Waveform,1,0,0,0,1000.0/50.0);
session->eventlist[OXI_Plethysomogram].push_back(ev_plethy);
ev_pulse=new EventList(OXI_Pulse,EVL_Event,1);
@ -157,8 +157,8 @@ void Oximetry::on_RunButton_toggled(bool checked)
{
if (checked) {
lasttime=0;
lastpulse=-1;
lastspo2=-1;
lastpulse=0;
lastspo2=0;
// Wipe any current data
ev_plethy->getData().clear();
@ -220,18 +220,27 @@ void Oximetry::on_RunButton_toggled(bool checked)
delete port;
port=NULL;
ev_pulse->AddEvent(lasttime,lastpulse);
ev_spo2->AddEvent(lasttime,lastspo2);
ev_spo2->setLast(lasttime);
ev_pulse->setLast(lasttime);
ev_plethy->setLast(lasttime);
day->setLast(lasttime);
session->set_last(lasttime);
SPO2->SetMinX(ev_spo2->first());
SPO2->SetMaxX(lasttime);
PULSE->SetMinX(ev_pulse->first());
PULSE->SetMaxX(lasttime);
PLETHY->SetMinX(ev_plethy->first());
PLETHY->SetMaxX(lasttime);
SPO2->MinX();
SPO2->MaxX();
PULSE->MinX();
PULSE->MaxX();
PLETHY->MinX();
PLETHY->MaxX();
PLETHY->updateGL();
SPO2->updateGL();
@ -245,22 +254,13 @@ void Oximetry::on_SerialPortsCombo_activated(const QString &arg1)
}
void Oximetry::UpdatePlethy(qint8 d)
{
ev_plethy->AddEvent(lasttime,d);
ev_plethy->getData().push_back(d);
if (d<ev_plethy->min()) ev_plethy->setMin(d);
if (d>ev_plethy->max()) ev_plethy->setMax(d);
ev_plethy->setCount(ev_plethy->count()+1);
//ev_plethy->AddEvent(lasttime,d);
lasttime+=20; // 50 samples per second
//ev_plethy->setLast(lasttime);
//if (plethy->RealMaxX()-plethy->RealMinX()>(1.0/(24.0*120.0))) {
// plethy->SetMinX(lasttime/86400000.0-(1.0/(24.0*120.0)));
// plethy->SetMaxX(lasttime/86400000.0);
//}
//plethy->setMinY(ev_plethy->min());
//plethy->setMaxY(ev_plethy->max());
//plethy->setMinY(ev_plethy->min());
//plethy->setMaxY(ev_plethy->max());
PLETHY->MinX();
PLETHY->MaxX();
//PLETHY->MinY();
//PLETHY->MaxY();
PLETHY->SetMinY(ev_plethy->min());
PLETHY->SetMaxY(ev_plethy->max());
PULSE->SetMinY(ev_pulse->min());
@ -276,6 +276,8 @@ void Oximetry::UpdatePlethy(qint8 d)
SPO2->SetMinX(lasttime-30000);
session->set_last(lasttime);
day->setLast(lasttime);
PLETHY->MinX();
PLETHY->MaxX();
}
bool Oximetry::UpdatePulse(qint8 pul)
{