Force Progress bar updates

This commit is contained in:
Mark Watkins 2011-07-30 10:36:31 +10:00
parent 61520a33f3
commit ee49d4dedd
7 changed files with 31 additions and 8 deletions

View File

@ -176,13 +176,11 @@ void gFlagsLine::Plot(gGraphWindow & w,float scrx,float scry)
} }
} }
} }
glLineWidth (1);
glColor4ub(col.red(),col.green(),col.blue(),col.alpha()); glColor4ub(col.red(),col.green(),col.blue(),col.alpha());
glScissor(w.GetLeftMargin(),w.GetBottomMargin(),width,height); glScissor(w.GetLeftMargin(),w.GetBottomMargin(),width,height);
glEnable(GL_SCISSOR_TEST); glEnable(GL_SCISSOR_TEST);
glLineWidth (1); glLineWidth (1.5);
bool antialias=pref["UseAntiAliasing"].toBool(); bool antialias=pref["UseAntiAliasing"].toBool();
if (antialias) { if (antialias) {
glEnable(GL_BLEND); glEnable(GL_BLEND);

View File

@ -263,7 +263,7 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
EventDataType ymin=miny/gain; EventDataType ymin=miny/gain;
const vector<EventStoreType> & dat=el.getData(); const vector<EventStoreType> & dat=el.getData();
//const vector<qint32> & tim=el.getTime(); const vector<quint32> & tim=el.getTime();
done=false; done=false;
first=true; first=true;
@ -274,7 +274,9 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
qint64 rate=sr*sam; qint64 rate=sr*sam;
if (accel) { if (accel) {
//////////////////////////////////////////////////////////////////
// Accelerated Waveform Plot
//////////////////////////////////////////////////////////////////
for (int i=idx;i<siz;i+=sam) { for (int i=idx;i<siz;i+=sam) {
time+=rate; time+=rate;
//time=el.time(i); //time=el.time(i);
@ -313,6 +315,9 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
} }
} else { // Zoomed in Waveform } else { // Zoomed in Waveform
//////////////////////////////////////////////////////////////////
// Normal Waveform Plot
//////////////////////////////////////////////////////////////////
for (int i=idx;i<siz;i+=sam,time+=rate) { for (int i=idx;i<siz;i+=sam,time+=rate) {
if (time < minx) if (time < minx)
continue; // Skip stuff before the start of our data window continue; // Skip stuff before the start of our data window
@ -350,14 +355,15 @@ void gLineChart::Plot(gGraphWindow & w,float scrx,float scry)
// Standard events/zoomed in Plot // Standard events/zoomed in Plot
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////
first=true; first=true;
qint64 start=el.first();
for (int i=idx;i<siz;i+=sam) { for (int i=idx;i<siz;i+=sam) {
time=el.time(i); time=start+tim[i];//el.time(i);
if (first) { if (first) {
if (num_points>5 && (time < minx)) continue; // Skip stuff before the start of our data window if (num_points>5 && (time < minx)) continue; // Skip stuff before the start of our data window
first=false; first=false;
if (i>=sam) i-=sam; // Start with the previous sample (which will be in clipping area) 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=dat[i]*gain; //
//data=el.data(i); // raw access is faster //data=el.data(i); // raw access is faster

View File

@ -13,6 +13,7 @@ License: GPL
//******************************************************************************************** //********************************************************************************************
#include <QProgressBar> #include <QProgressBar>
#include <QApplication>
#include <QDir> #include <QDir>
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
@ -98,6 +99,7 @@ int CMS50Loader::OpenCMS50(QString & path, Profile *profile)
int cnt=0; int cnt=0;
for (list<QString>::iterator n=files.begin();n!=files.end();n++,++cnt) { for (list<QString>::iterator n=files.begin();n!=files.end();n++,++cnt) {
if (qprogress) qprogress->setValue((float(cnt)/float(size)*50.0)); if (qprogress) qprogress->setValue((float(cnt)/float(size)*50.0));
QApplication::processEvents();
OpenSPORFile((*n),mach,profile); OpenSPORFile((*n),mach,profile);
} }
mach->Save(); mach->Save();

View File

@ -6,6 +6,7 @@ Author: Mark Watkins <jedimark64@users.sourceforge.net>
License: GPL License: GPL
*/ */
#include <QApplication>
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
@ -267,9 +268,11 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile)
sessfiles[session][2]=fi.canonicalFilePath(); sessfiles[session][2]=fi.canonicalFilePath();
} }
cnt++; cnt++;
//if (qprogress) qprogress->Pulse(); //Update((float(cnt)/float(size)*25));
if (qprogress) qprogress->setValue((float(cnt)/float(size)*33.0)); if (qprogress) qprogress->setValue((float(cnt)/float(size)*33.0));
QApplication::processEvents();
} }
} }
size=sessfiles.size(); size=sessfiles.size();
@ -281,6 +284,7 @@ int PRS1Loader::OpenMachine(Machine *m,QString path,Profile *profile)
session=s->first; session=s->first;
cnt++; cnt++;
if (qprogress) qprogress->setValue(33.0+(float(cnt)/float(size)*33.0)); if (qprogress) qprogress->setValue(33.0+(float(cnt)/float(size)*33.0));
QApplication::processEvents();
if (m->SessionExists(session)) continue; if (m->SessionExists(session)) continue;
if (s->second[0].isEmpty()) 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->properties["DataVersion"]=s;
m->Save(); // Save any new sessions to disk in our format */ m->Save(); // Save any new sessions to disk in our format */
if (qprogress) qprogress->setValue(100); if (qprogress) qprogress->setValue(100);
//qDebug() << "OpenMachine Done"; //qDebug() << "OpenMachine Done";
return true; return true;
} }

View File

@ -6,6 +6,8 @@ Author: Mark Watkins <jedimark64@users.sourceforge.net>
License: GPL License: GPL
*/ */
#include <QApplication>
#include <QString> #include <QString>
#include <QDateTime> #include <QDateTime>
#include <QDir> #include <QDir>
@ -288,6 +290,8 @@ int ResmedLoader::Open(QString & path,Profile *profile)
sessfiles[sessionid].push_back(fi.canonicalFilePath()); sessfiles[sessionid].push_back(fi.canonicalFilePath());
if (qprogress) qprogress->setValue((float(i+1)/float(size)*33.0)); if (qprogress) qprogress->setValue((float(i+1)/float(size)*33.0));
QApplication::processEvents();
} }
Machine *m=NULL; 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)); if (qprogress) qprogress->setValue(33.0+(float(++cnt)/float(size)*33.0));
QApplication::processEvents();
if (!sess) continue; if (!sess) continue;
if (!sess->first()) { if (!sess->first()) {
delete sess; delete sess;

View File

@ -4,6 +4,7 @@
License: GPL License: GPL
*/ */
#include <QApplication>
#include <QDir> #include <QDir>
#include <QProgressBar> #include <QProgressBar>
#include <QDebug> #include <QDebug>
@ -342,6 +343,8 @@ bool Machine::Save()
if (qprogress) qprogress->setValue(66.0+(float(cnt)/float(size)*33.0)); if (qprogress) qprogress->setValue(66.0+(float(cnt)/float(size)*33.0));
if ((*s)->IsChanged()) (*s)->Store(path); if ((*s)->IsChanged()) (*s)->Store(path);
(*s)->TrashEvents(); (*s)->TrashEvents();
QApplication::processEvents();
} }
//qDebug() << "Day Save Completed"; //qDebug() << "Day Save Completed";

View File

@ -1,3 +1,4 @@
#include <QApplication>
#include <QDebug> #include <QDebug>
#include <QProgressBar> #include <QProgressBar>
#include <QMessageBox> #include <QMessageBox>
@ -469,6 +470,8 @@ void Oximetry::on_ImportButton_clicked()
memcpy((char *)buffer,(char *)&rb[startpos],bytes); memcpy((char *)buffer,(char *)&rb[startpos],bytes);
} else { } else {
qprogress->setValue((100.0/length)*bytes); qprogress->setValue((100.0/length)*bytes);
QApplication::processEvents();
memcpy((char *)&buffer[bytes],(char *)rb,res); memcpy((char *)&buffer[bytes],(char *)rb,res);
bytes+=res; bytes+=res;
} }