Don't update so much when live oximetry graphs are switched off

This commit is contained in:
Mark Watkins 2014-05-26 19:20:29 +10:00
parent 8d3f51584f
commit 83d8f1ea40
2 changed files with 87 additions and 37 deletions

View File

@ -300,7 +300,10 @@ void OximeterImport::on_liveImportButton_clicked()
connect(oximodule, SIGNAL(updatePlethy(QByteArray)), this, SLOT(on_updatePlethy(QByteArray)));
ui->liveConnectLabel->setText("Live Oximetery Mode");
liveView->setEmptyText(tr("Starting up..."));
updateStatus(tr("If you can still read this after a few seconds, cancel and try again"));
ui->progressBar->hide();
liveView->update();
oximodule->Open("live",p_profile);
@ -529,16 +532,16 @@ void OximeterImport::updateLiveDisplay()
bool datagood = oximodule->oxirec[size].pulse > 0;
QString STR_recording = tr("Recording...");
QString STR_nofinger = tr("Finger not detected");
if (datagood & (pulse <= 0)) {
QString STR_recording = tr("Recording...");
updateStatus(STR_recording);
liveView->setEmptyText(STR_recording);
if (!ui->showLiveGraphs->isChecked()) {
liveView->redraw();
}
} else if (!datagood & (pulse != 0)) {
QString STR_nofinger = tr("Finger not detected");
updateStatus(STR_nofinger);
liveView->setEmptyText(STR_nofinger);
if (!ui->showLiveGraphs->isChecked()) {
@ -574,6 +577,12 @@ void OximeterImport::on_cancelButton_clicked()
void OximeterImport::on_showLiveGraphs_clicked(bool checked)
{
if (checked) {
updateTimer.setInterval(50);
} else {
// Don't need to call the timer so often.. Save a little CPU..
updateTimer.setInterval(500);
}
plethyGraph->setVisible(checked);
liveView->redraw();
}

View File

@ -620,7 +620,7 @@
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>1</number>
<number>3</number>
</property>
<widget class="QWidget" name="welcomePage">
<layout class="QVBoxLayout" name="verticalLayout">
@ -968,52 +968,67 @@ p, li { white-space: pre-wrap; }
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_7">
<layout class="QHBoxLayout" name="horizontalLayout_5">
<property name="spacing">
<number>4</number>
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
<number>6</number>
</property>
<property name="topMargin">
<number>0</number>
<number>6</number>
</property>
<property name="rightMargin">
<number>0</number>
<number>6</number>
</property>
<property name="bottomMargin">
<number>0</number>
<number>6</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<widget class="QCheckBox" name="showLiveGraphs">
<property name="text">
<string>Show Live Graphs</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<widget class="QCheckBox" name="showLiveGraphs">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Show Live Graphs</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>139</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_8">
<item>
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Duration</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
@ -1021,22 +1036,35 @@ p, li { white-space: pre-wrap; }
<property name="minimumSize">
<size>
<width>200</width>
<height>0</height>
<height>50</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="digitCount">
<number>8</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_9">
<item>
<widget class="QLabel" name="label_7">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>SpO2 %</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
@ -1094,18 +1122,31 @@ p, li { white-space: pre-wrap; }
<enum>Qt::LeftToRight</enum>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="digitCount">
<number>2</number>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_14">
<item>
<widget class="QLabel" name="label_8">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Pulse Rate</string>
</property>
<property name="alignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set>
</property>
</widget>
</item>
<item>
@ -1160,7 +1201,7 @@ p, li { white-space: pre-wrap; }
</palette>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
<enum>QFrame::StyledPanel</enum>
</property>
<property name="smallDecimalPoint">
<bool>false</bool>