aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
authorGravatar Willem Ferguson <willemferguson@zoology.up.ac.za>2018-03-14 17:13:37 +0200
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-04-28 20:11:22 +0300
commit81a812539c95f2e709995d446065803c09e9136a (patch)
treee75422bbd34a909e3f897e3200e6624ad83e6b9a /profile-widget
parente9fd4cb7dca13c01f85ad63b667100ee15d7dc6d (diff)
downloadsubsurface-81a812539c95f2e709995d446065803c09e9136a.tar.gz
Plot OC-pO2 graph for SCR dives
This commit allows plotting the OC-equivalent pO2 graph for PSCR dives. This happens in both the cases where there is no external O2-monitoring AND when there is external pO2 monitoring. The calculations are only done for PSCR dives and is achieved as follows: 1) Within plot-info create a pressure-t called OC_pO2 in profile.h and populate this variable with the open-circuit pO2 values in profile.c. 2) Create a new partialPressureGasItem ocpo2GasItem in profilewidget2.h and, in profilewidget2.cpp, initialise it to read the plot-info OC_pO2 values and enable its display by using the setVisible method. The diveplotdatamodel was also touched in order to achieve this. 3) Create a pref button that controls the display of OC-pO2 for SCR dives 4) Change the colour of the OC-pO2 grpah to orange 5) Change the connection of the crr_OC_pO2 signal to be appropriate 6) rename the OC_pO2 attribute to scr_OC-pO2 Signed-off-by: Willem Ferguson <willemferguson@zoology.up.ac.za>
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/profilewidget2.cpp9
-rw-r--r--profile-widget/profilewidget2.h1
2 files changed, 10 insertions, 0 deletions
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 16d08f119..da3eaad90 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -109,6 +109,7 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
ccrsensor1GasItem(new PartialPressureGasItem()),
ccrsensor2GasItem(new PartialPressureGasItem()),
ccrsensor3GasItem(new PartialPressureGasItem()),
+ ocpo2GasItem(new PartialPressureGasItem()),
#ifndef SUBSURFACE_MOBILE
diveCeiling(new DiveCalculatedCeiling(this)),
decoModelParameters(new DiveTextItem()),
@@ -198,6 +199,7 @@ void ProfileWidget2::addItemsToScene()
scene()->addItem(ccrsensor1GasItem);
scene()->addItem(ccrsensor2GasItem);
scene()->addItem(ccrsensor3GasItem);
+ scene()->addItem(ocpo2GasItem);
#ifndef SUBSURFACE_MOBILE
scene()->addItem(toolTipItem);
scene()->addItem(diveCeiling);
@@ -315,6 +317,7 @@ void ProfileWidget2::setupItemOnScene()
createPPGas(ccrsensor1GasItem, DivePlotDataModel::CCRSENSOR1, CCRSENSOR1, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
createPPGas(ccrsensor2GasItem, DivePlotDataModel::CCRSENSOR2, CCRSENSOR2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
createPPGas(ccrsensor3GasItem, DivePlotDataModel::CCRSENSOR3, CCRSENSOR3, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
+ createPPGas(ocpo2GasItem, DivePlotDataModel::SCR_OC_PO2, SCR_OCPO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold_min, &prefs.pp_graphs.po2_threshold_max);
#undef CREATE_PP_GAS
#ifndef SUBSURFACE_MOBILE
@@ -327,6 +330,7 @@ void ProfileWidget2::setupItemOnScene()
//WARNING: The old code was broken, I'm not sure what should trigger the visibility of those graphs, since the old code didn't triggered them
// because it was using a wrong settings.
+ connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::showSCROCpO2Changed, ocpo2GasItem, &PartialPressureGasItem::setVisible);
connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::showCCRSensorsChanged, ccrsensor1GasItem, &PartialPressureGasItem::setVisible);
connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::showCCRSensorsChanged, ccrsensor2GasItem, &PartialPressureGasItem::setVisible);
connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::showCCRSensorsChanged, ccrsensor3GasItem, &PartialPressureGasItem::setVisible);
@@ -598,6 +602,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
ccrsensor1GasItem->setVisible(sensorflag);
ccrsensor2GasItem->setVisible(sensorflag && (currentdc->no_o2sensors > 1));
ccrsensor3GasItem->setVisible(sensorflag && (currentdc->no_o2sensors > 2));
+ ocpo2GasItem->setVisible((currentdc->divemode == PSCR) && prefs.show_scr_ocpo2);
/* This struct holds all the data that's about to be plotted.
* I'm not sure this is the best approach ( but since we are
@@ -705,6 +710,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
ccrsensor1GasItem->setVisible(prefs.show_ccr_sensors);
ccrsensor2GasItem->setVisible(prefs.show_ccr_sensors && (currentdc->no_o2sensors > 1));
ccrsensor3GasItem->setVisible(prefs.show_ccr_sensors && (currentdc->no_o2sensors > 1));
+ ocpo2GasItem->setVisible((currentdc->divemode == PSCR) && prefs.show_scr_ocpo2);
temperatureItem->setVisible(false);
} else {
tankItem->setVisible(prefs.tankbar);
@@ -716,6 +722,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force)
ccrsensor1GasItem->setVisible(false);
ccrsensor2GasItem->setVisible(false);
ccrsensor3GasItem->setVisible(false);
+ ocpo2GasItem->setVisible(false);
}
#endif
tankItem->setData(dataModel, &plotInfo, &displayed_dive);
@@ -1074,6 +1081,7 @@ void ProfileWidget2::setEmptyState()
ccrsensor1GasItem->setVisible(false);
ccrsensor2GasItem->setVisible(false);
ccrsensor3GasItem->setVisible(false);
+ ocpo2GasItem->setVisible(false);
#ifndef SUBSURFACE_MOBILE
toolTipItem->setVisible(false);
diveCeiling->setVisible(false);
@@ -1193,6 +1201,7 @@ void ProfileWidget2::setProfileState()
ccrsensor1GasItem->setVisible(sensorflag);
ccrsensor2GasItem->setVisible(sensorflag && (current_dc->no_o2sensors > 1));
ccrsensor3GasItem->setVisible(sensorflag && (current_dc->no_o2sensors > 2));
+ ocpo2GasItem->setVisible((current_dc->divemode == PSCR) && prefs.show_scr_ocpo2);
heartBeatItem->setVisible(prefs.hrgraph);
diveCeiling->setVisible(prefs.calcceiling);
diff --git a/profile-widget/profilewidget2.h b/profile-widget/profilewidget2.h
index 937e0ee4b..0e44424ee 100644
--- a/profile-widget/profilewidget2.h
+++ b/profile-widget/profilewidget2.h
@@ -202,6 +202,7 @@ private:
PartialPressureGasItem *ccrsensor1GasItem;
PartialPressureGasItem *ccrsensor2GasItem;
PartialPressureGasItem *ccrsensor3GasItem;
+ PartialPressureGasItem *ocpo2GasItem;
#ifndef SUBSURFACE_MOBILE
DiveCalculatedCeiling *diveCeiling;
DiveTextItem *decoModelParameters;