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))); connect(oximodule, SIGNAL(updatePlethy(QByteArray)), this, SLOT(on_updatePlethy(QByteArray)));
ui->liveConnectLabel->setText("Live Oximetery Mode"); ui->liveConnectLabel->setText("Live Oximetery Mode");
liveView->setEmptyText(tr("Starting up...")); liveView->setEmptyText(tr("Starting up..."));
updateStatus(tr("If you can still read this after a few seconds, cancel and try again"));
ui->progressBar->hide(); ui->progressBar->hide();
liveView->update(); liveView->update();
oximodule->Open("live",p_profile); oximodule->Open("live",p_profile);
@ -529,16 +532,16 @@ void OximeterImport::updateLiveDisplay()
bool datagood = oximodule->oxirec[size].pulse > 0; bool datagood = oximodule->oxirec[size].pulse > 0;
QString STR_recording = tr("Recording...");
QString STR_nofinger = tr("Finger not detected");
if (datagood & (pulse <= 0)) { if (datagood & (pulse <= 0)) {
QString STR_recording = tr("Recording...");
updateStatus(STR_recording); updateStatus(STR_recording);
liveView->setEmptyText(STR_recording); liveView->setEmptyText(STR_recording);
if (!ui->showLiveGraphs->isChecked()) { if (!ui->showLiveGraphs->isChecked()) {
liveView->redraw(); liveView->redraw();
} }
} else if (!datagood & (pulse != 0)) { } else if (!datagood & (pulse != 0)) {
QString STR_nofinger = tr("Finger not detected");
updateStatus(STR_nofinger); updateStatus(STR_nofinger);
liveView->setEmptyText(STR_nofinger); liveView->setEmptyText(STR_nofinger);
if (!ui->showLiveGraphs->isChecked()) { if (!ui->showLiveGraphs->isChecked()) {
@ -574,6 +577,12 @@ void OximeterImport::on_cancelButton_clicked()
void OximeterImport::on_showLiveGraphs_clicked(bool checked) 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); plethyGraph->setVisible(checked);
liveView->redraw(); liveView->redraw();
} }

View File

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