Minor crud, threading turned back on (even though it's currently useless)

This commit is contained in:
Mark Watkins 2011-09-04 23:09:21 +10:00
parent 9922efc61a
commit 526eb88a4e
8 changed files with 28 additions and 45 deletions

View File

@ -150,7 +150,7 @@ void gBarChart::paint(gGraph & w,int left, int top, int width, int height)
} }
if (total_days>0) { if (total_days>0) {
float val=total_val/float(total_days); float val=total_val/float(total_days);
QString z=m_label+"="+QString::number(val,'f',2)+" days="+QString::number(total_days,'f',0)+" This needs optimising and will going in overview"; QString z=m_label+"="+QString::number(val,'f',2)+" days="+QString::number(total_days,'f',0)+" This will go in overview";
w.renderText(z,left,top-1); w.renderText(z,left,top-1);
// val = AHI for selected area. // val = AHI for selected area.
} }

View File

@ -1346,11 +1346,10 @@ void gGraphView::paintGL()
bool threaded; bool threaded;
// Tempory hack using this pref.. // Tempory hack using this pref..
if (pref["EnableGraphSnapshots"].toBool() && (m_idealthreads>1)) { if (pref["EnableMultithreading"].toBool() && (m_idealthreads>1)) {
threaded=true; threaded=true;
} else threaded=false; } else threaded=false;
threaded=false;
for (int i=0;i<m_graphs.size();i++) { for (int i=0;i<m_graphs.size();i++) {
if (m_graphs[i]->isEmpty() || !m_graphs[i]->visible()) continue; if (m_graphs[i]->isEmpty() || !m_graphs[i]->visible()) continue;
numgraphs++; numgraphs++;
@ -1392,13 +1391,13 @@ void gGraphView::paintGL()
GetTextExtent(m_emptytext,x,y,bigfont); GetTextExtent(m_emptytext,x,y,bigfont);
AddTextQue(m_emptytext,(width()/2)-x/2,(height()/2)+y/2,0.0,col,bigfont); AddTextQue(m_emptytext,(width()/2)-x/2,(height()/2)+y/2,0.0,col,bigfont);
} }
int thr=1; int thr;
if (threaded) thr=m_idealthreads;
if (threaded) { if (threaded) {
thr=m_idealthreads;
masterlock->acquire(m_idealthreads); // ask for all the CPU's back.. masterlock->acquire(m_idealthreads); // ask for all the CPU's back..
masterlock->release(m_idealthreads); masterlock->release(m_idealthreads);
} } else thr=1;
//((QGLContext*)context())->makeCurrent(); //((QGLContext*)context())->makeCurrent();

View File

@ -146,12 +146,12 @@ protected:
QVector<GLBuffer *> mgl_buffers; QVector<GLBuffer *> mgl_buffers;
// Default layer mouse handling = Do nothing // Default layer mouse handling = Do nothing
virtual bool wheelEvent(QWheelEvent * event) { return false; } virtual bool wheelEvent(QWheelEvent * event) { event=event; return false; }
virtual bool mouseMoveEvent(QMouseEvent * event) { return false; } virtual bool mouseMoveEvent(QMouseEvent * event) { event=event; return false; }
virtual bool mousePressEvent(QMouseEvent * event) { return false; } virtual bool mousePressEvent(QMouseEvent * event) { event=event; return false; }
virtual bool mouseReleaseEvent(QMouseEvent * event) { return false; } virtual bool mouseReleaseEvent(QMouseEvent * event) { event=event; return false; }
virtual bool mouseDoubleClickEvent(QMouseEvent * event) { return false; } virtual bool mouseDoubleClickEvent(QMouseEvent * event) { event=event; return false; }
virtual bool keyPressEvent(QKeyEvent * event) { return false; } virtual bool keyPressEvent(QKeyEvent * event) { event=event; return false; }
}; };
class LayerGroup:public Layer class LayerGroup:public Layer

View File

@ -139,13 +139,7 @@ void gYAxis::paint(gGraph & w,int left,int top, int width, int height)
double mny=miny; double mny=miny;
if (miny<0) { if (miny<0) {
mny=-mxy; mny=-mxy;
} else {
} }
//double mny=MIN(fabs(maxy),fabs(miny));
//if (miny<0) mny=-mny;
//if (maxy<0) mxy=-mxy;
//mny=miny;
//mxy=maxy;
double rxy=mxy-mny; double rxy=mxy-mny;
double ymult=height/rxy; double ymult=height/rxy;
@ -163,11 +157,6 @@ void gYAxis::paint(gGraph & w,int left,int top, int width, int height)
} }
lines=w.backlines(); lines=w.backlines();
//double q=((maxy-(miny+(min_ytick/2.0)))/min_ytick)*4;
/*if (q>=maxverts) {
qDebug() << "Would exeed maxverts. Should be another two bounds exceeded messages after this. (I can do a minor optimisation by disabling the other checks if this turns out to be consistent)" << q << maxverts;
}*/
for (double i=miny; i<=maxy+min_ytick-0.00001; i+=min_ytick) { for (double i=miny; i<=maxy+min_ytick-0.00001; i+=min_ytick) {
ty=(i - miny) * ymult; ty=(i - miny) * ymult;
if (dy<5) { if (dy<5) {
@ -175,12 +164,10 @@ void gYAxis::paint(gGraph & w,int left,int top, int width, int height)
} else { } else {
fd=QString().sprintf("%.1f",i*m_yaxis_scale); fd=QString().sprintf("%.1f",i*m_yaxis_scale);
} }
//fd=Format(i*m_yaxis_scale); // Override this as a function.
GetTextExtent(fd,x,y); GetTextExtent(fd,x,y);
if (x>labelW) labelW=x; if (x>labelW) labelW=x;
h=top+height-ty; h=top+height-ty;
//w.renderText(start_px-12-x,scry-(h-(y/2.0)),fd);
//DrawText(w,fd,left+width-8-x,(h+(y/2.0)),0,m_text_color);
w.renderText(fd,left+width-8-x,(h+(y/2.0)),0,m_text_color); w.renderText(fd,left+width-8-x,(h+(y/2.0)),0,m_text_color);
lines->add(left+width-4,h,left+width,h,m_line_color); lines->add(left+width-4,h,left+width,h,m_line_color);
@ -201,6 +188,5 @@ void gYAxis::paint(gGraph & w,int left,int top, int width, int height)
break; break;
} }
} }
//vertarray->draw();
} }

View File

@ -886,7 +886,7 @@ void Daily::Load(QDate date)
// as it only relates to text drawing, which the Pie chart does not do // as it only relates to text drawing, which the Pie chart does not do
// ^^ Scratch that.. pie now includes text.. // ^^ Scratch that.. pie now includes text..
if (pref["EnableGraphSnapshots"].toBool()) { // AHI Pie Chart // if (pref["EnableGraphSnapshots"].toBool()) { // AHI Pie Chart
// if (ahi+rei+fli>0) { // if (ahi+rei+fli>0) {
// html+="</tr>\n<tr><td colspan=4 align=center><i>"+tr("Event Breakdown")+"</i></td></tr>\n"; // html+="</tr>\n<tr><td colspan=4 align=center><i>"+tr("Event Breakdown")+"</i></td></tr>\n";
// G_AHI->setFixedSize(gwwidth,120); // G_AHI->setFixedSize(gwwidth,120);
@ -899,7 +899,7 @@ void Daily::Load(QDate date)
// } else { // } else {
// html += "<tr><td colspan=4 align=center><img src=\"qrc:/docs/0.0.gif\"></td></tr>\n"; // html += "<tr><td colspan=4 align=center><img src=\"qrc:/docs/0.0.gif\"></td></tr>\n";
// } // }
} // }
} }
html+="</table>"; html+="</table>";
html+="<table cellspacing=0 cellpadding=0 border=0 width='100%'>\n"; html+="<table cellspacing=0 cellpadding=0 border=0 width='100%'>\n";
@ -945,7 +945,7 @@ void Daily::Load(QDate date)
html+="<table cellspacing=0 cellpadding=0 border=0 width='100%'>\n"; html+="<table cellspacing=0 cellpadding=0 border=0 width='100%'>\n";
if (cpap) { if (cpap) {
if (pref["EnableGraphSnapshots"].toBool()) { // if (pref["EnableGraphSnapshots"].toBool()) {
/* if (cpap->channelExists(CPAP_Pressure)) { /* if (cpap->channelExists(CPAP_Pressure)) {
html+=("<tr><td colspan=4 align=center><i>")+tr("Time@Pressure")+("</i></td></tr>\n"); html+=("<tr><td colspan=4 align=center><i>")+tr("Time@Pressure")+("</i></td></tr>\n");
TAP->setFixedSize(gwwidth,30); TAP->setFixedSize(gwwidth,30);
@ -978,7 +978,7 @@ void Daily::Load(QDate date)
html+="<tr><td colspan=4 align=center><img src=\"data:image/png;base64," + byteArray.toBase64() + "\"></td></tr>\n"; html+="<tr><td colspan=4 align=center><img src=\"data:image/png;base64," + byteArray.toBase64() + "\"></td></tr>\n";
} */ } */
} //}
html+="</table><hr height=2><table cellpadding=0 cellspacing=0 border=0 width=100%>"; html+="</table><hr height=2><table cellpadding=0 cellspacing=0 border=0 width=100%>";
html+="<tr><td align=center>SessionID</td><td align=center>Date</td><td align=center>Start</td><td align=center>End</td></tr>"; html+="<tr><td align=center>SessionID</td><td align=center>Date</td><td align=center>Start</td><td align=center>End</td></tr>";
QDateTime fd,ld; QDateTime fd,ld;

View File

@ -100,8 +100,8 @@ MainWindow::MainWindow(QWidget *parent) :
ui->logText->hide(); ui->logText->hide();
} }
if (!pref.Exists("EnableGraphSnapshots")) pref["EnableGraphSnapshots"]=false; if (!pref.Exists("EnableMultithreading")) pref["EnableMultithreading"]=false;
ui->actionDisplay_Graph_Snapshots->setChecked(pref["EnableGraphSnapshots"].toBool()); ui->actionEnable_Multithreading->setChecked(pref["EnableMultithreading"].toBool());
if (!pref.Exists("MemoryHog")) pref["MemoryHog"]=true; if (!pref.Exists("MemoryHog")) pref["MemoryHog"]=true;
@ -367,13 +367,6 @@ void MainWindow::on_action_Preferences_triggered()
} }
} }
void MainWindow::on_actionDisplay_Graph_Snapshots_toggled(bool checked)
{
//if (QMessageBox::question(this,"Warning","Turning this feature on has caused crashes on some hardware configurations due to OpenGL/Qt bugs.\nIf you have already seen Pie Charts & CandleSticks in the left panel of daily view previously, you're not affected by this bug.\nAre you sure you want to enable this?",QMessageBox::Yes|QMessageBox::No)==QMessageBox::Yes) {
pref["EnableGraphSnapshots"]=checked;
//}
}
void MainWindow::on_oximetryButton_clicked() void MainWindow::on_oximetryButton_clicked()
{ {
if (oximetry) { if (oximetry) {
@ -381,3 +374,8 @@ void MainWindow::on_oximetryButton_clicked()
oximetry->RedrawGraphs(); oximetry->RedrawGraphs();
} }
} }
void MainWindow::on_actionEnable_Multithreading_toggled(bool checked)
{
pref["EnableMultithreading"]=checked;
}

View File

@ -78,10 +78,10 @@ private slots:
void on_action_Preferences_triggered(); void on_action_Preferences_triggered();
void on_actionDisplay_Graph_Snapshots_toggled(bool arg1);
void on_oximetryButton_clicked(); void on_oximetryButton_clicked();
void on_actionEnable_Multithreading_toggled(bool arg1);
private: private:
Ui::MainWindow *ui; Ui::MainWindow *ui;
Daily * daily; Daily * daily;

View File

@ -566,7 +566,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>668</width> <width>668</width>
<height>24</height> <height>25</height>
</rect> </rect>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
@ -594,7 +594,7 @@
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="actionUse_AntiAliasing"/> <addaction name="actionUse_AntiAliasing"/>
<addaction name="actionOverlay_Bars"/> <addaction name="actionOverlay_Bars"/>
<addaction name="actionDisplay_Graph_Snapshots"/> <addaction name="actionEnable_Multithreading"/>
<addaction name="action_Link_Graphs"/> <addaction name="action_Link_Graphs"/>
<addaction name="separator"/> <addaction name="separator"/>
<addaction name="action_Fullscreen"/> <addaction name="action_Fullscreen"/>
@ -734,7 +734,7 @@
<string>&amp;Reset Graph Layout</string> <string>&amp;Reset Graph Layout</string>
</property> </property>
</action> </action>
<action name="actionDisplay_Graph_Snapshots"> <action name="actionEnable_Multithreading">
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>