From ee49d4dedded79161b95dbe9e2408add0e9b6e27 Mon Sep 17 00:00:00 2001 From: Mark Watkins Date: Sat, 30 Jul 2011 10:36:31 +1000 Subject: [PATCH] Force Progress bar updates --- Graphs/gFlagsLine.cpp | 4 +--- Graphs/gLineChart.cpp | 14 ++++++++++---- SleepLib/loader_plugins/cms50_loader.cpp | 2 ++ SleepLib/loader_plugins/prs1_loader.cpp | 7 ++++++- SleepLib/loader_plugins/resmed_loader.cpp | 6 ++++++ SleepLib/machine.cpp | 3 +++ oximetry.cpp | 3 +++ 7 files changed, 31 insertions(+), 8 deletions(-) diff --git a/Graphs/gFlagsLine.cpp b/Graphs/gFlagsLine.cpp index dab1f448..68202aa6 100644 --- a/Graphs/gFlagsLine.cpp +++ b/Graphs/gFlagsLine.cpp @@ -176,13 +176,11 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry) } } } - glLineWidth (1); - glColor4ub(col.red(),col.green(),col.blue(),col.alpha()); glScissor(w.GetLeftMargin(),w.GetBottomMargin(),width,height); glEnable(GL_SCISSOR_TEST); - glLineWidth (1); + glLineWidth (1.5); bool antialias=pref["UseAntiAliasing"].toBool(); if (antialias) { glEnable(GL_BLEND); diff --git a/Graphs/gLineChart.cpp b/Graphs/gLineChart.cpp index b4abd590..7bc906b3 100644 --- a/Graphs/gLineChart.cpp +++ b/Graphs/gLineChart.cpp @@ -263,7 +263,7 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry) EventDataType ymin=miny/gain; const vector & dat=el.getData(); - //const vector & tim=el.getTime(); + const vector & tim=el.getTime(); done=false; first=true; @@ -274,7 +274,9 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry) qint64 rate=sr*sam; if (accel) { - +////////////////////////////////////////////////////////////////// +// Accelerated Waveform Plot +////////////////////////////////////////////////////////////////// for (int i=idx;i5 && (time < minx)) continue; // Skip stuff before the start of our data window first=false; if (i>=sam) i-=sam; // Start with the previous sample (which will be in clipping area) - time=el.time(i); //el.time(i); + time=start+tim[i];//el.time(i); //el.time(i); } data=dat[i]*gain; // //data=el.data(i); // raw access is faster diff --git a/SleepLib/loader_plugins/cms50_loader.cpp b/SleepLib/loader_plugins/cms50_loader.cpp index 87172717..3f967661 100644 --- a/SleepLib/loader_plugins/cms50_loader.cpp +++ b/SleepLib/loader_plugins/cms50_loader.cpp @@ -13,6 +13,7 @@ License: GPL //******************************************************************************************** #include +#include #include #include #include @@ -98,6 +99,7 @@ int CMS50Loader::OpenCMS50(QString & path, Profile *profile) int cnt=0; for (list::iterator n=files.begin();n!=files.end();n++,++cnt) { if (qprogress) qprogress->setValue((float(cnt)/float(size)*50.0)); + QApplication::processEvents(); OpenSPORFile((*n),mach,profile); } mach->Save(); diff --git a/SleepLib/loader_plugins/prs1_loader.cpp b/SleepLib/loader_plugins/prs1_loader.cpp index 0b5d60aa..dc282d62 100644 --- a/SleepLib/loader_plugins/prs1_loader.cpp +++ b/SleepLib/loader_plugins/prs1_loader.cpp @@ -6,6 +6,7 @@ Author: Mark Watkins License: GPL */ +#include #include #include #include @@ -267,9 +268,11 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile) sessfiles[session][2]=fi.canonicalFilePath(); } cnt++; - //if (qprogress) qprogress->Pulse(); //Update((float(cnt)/float(size)*25)); if (qprogress) qprogress->setValue((float(cnt)/float(size)*33.0)); + + QApplication::processEvents(); + } } size=sessfiles.size(); @@ -281,6 +284,7 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile) session=s->first; cnt++; if (qprogress) qprogress->setValue(33.0+(float(cnt)/float(size)*33.0)); + QApplication::processEvents(); if (m->SessionExists(session)) continue; if (s->second[0].isEmpty()) continue; @@ -385,6 +389,7 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile) m->properties["DataVersion"]=s; m->Save(); // Save any new sessions to disk in our format */ if (qprogress) qprogress->setValue(100); + //qDebug() << "OpenMachine Done"; return true; } diff --git a/SleepLib/loader_plugins/resmed_loader.cpp b/SleepLib/loader_plugins/resmed_loader.cpp index 10494da9..cd053ccf 100644 --- a/SleepLib/loader_plugins/resmed_loader.cpp +++ b/SleepLib/loader_plugins/resmed_loader.cpp @@ -6,6 +6,8 @@ Author: Mark Watkins License: GPL */ + +#include #include #include #include @@ -288,6 +290,8 @@ int ResmedLoader::Open(QString & path,Profile *profile) sessfiles[sessionid].push_back(fi.canonicalFilePath()); if (qprogress) qprogress->setValue((float(i+1)/float(size)*33.0)); + QApplication::processEvents(); + } Machine *m=NULL; @@ -348,6 +352,8 @@ int ResmedLoader::Open(QString & path,Profile *profile) } } if (qprogress) qprogress->setValue(33.0+(float(++cnt)/float(size)*33.0)); + QApplication::processEvents(); + if (!sess) continue; if (!sess->first()) { delete sess; diff --git a/SleepLib/machine.cpp b/SleepLib/machine.cpp index 7167183d..2b59c847 100644 --- a/SleepLib/machine.cpp +++ b/SleepLib/machine.cpp @@ -4,6 +4,7 @@ License: GPL */ +#include #include #include #include @@ -342,6 +343,8 @@ bool Machine::Save() if (qprogress) qprogress->setValue(66.0+(float(cnt)/float(size)*33.0)); if ((*s)->IsChanged()) (*s)->Store(path); (*s)->TrashEvents(); + QApplication::processEvents(); + } //qDebug() << "Day Save Completed"; diff --git a/oximetry.cpp b/oximetry.cpp index 8a235a4d..74428621 100644 --- a/oximetry.cpp +++ b/oximetry.cpp @@ -1,3 +1,4 @@ +#include #include #include #include @@ -469,6 +470,8 @@ void Oximetry::on_ImportButton_clicked() memcpy((char *)buffer,(char *)&rb[startpos],bytes); } else { qprogress->setValue((100.0/length)*bytes); + QApplication::processEvents(); + memcpy((char *)&buffer[bytes],(char *)rb,res); bytes+=res; }