diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2014-11-01 09:22:07 -0700 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2014-11-01 09:22:07 -0700 |
commit | 89e7cae8549c801660b08c2b070e00ff77d562b6 (patch) | |
tree | 8ae0fc59c548ea0e9d1b212dbab344f0fb78b0e9 /qt-ui | |
parent | f0cee72444b2433d140b54c2b236aafc21932a8f (diff) | |
download | subsurface-89e7cae8549c801660b08c2b070e00ff77d562b6.tar.gz |
Fix partial pressure graph thresholds
Since we only store things in the preferences if they are different from
the default, the existing code that simply compared with the settings
value didn't work when people used the defaults.
We now compare to the actual preference at runtime which should address
that.
Fixes #731
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui')
-rw-r--r-- | qt-ui/profile/diveprofileitem.cpp | 8 | ||||
-rw-r--r-- | qt-ui/profile/diveprofileitem.h | 4 | ||||
-rw-r--r-- | qt-ui/profile/profilewidget2.cpp | 6 |
3 files changed, 9 insertions, 9 deletions
diff --git a/qt-ui/profile/diveprofileitem.cpp b/qt-ui/profile/diveprofileitem.cpp index 1e7a5b535..1a6eeae5c 100644 --- a/qt-ui/profile/diveprofileitem.cpp +++ b/qt-ui/profile/diveprofileitem.cpp @@ -833,14 +833,14 @@ void PartialPressureGasItem::modelDataChanged(const QModelIndex &topLeft, const alertPolygons.clear(); QSettings s; s.beginGroup("TecDetails"); - double threshould = s.value(threshouldKey).toDouble(); + double threshold = *thresholdPtr; bool inAlertFragment = false; for (int i = 0; i < dataModel->rowCount(); i++, entry++) { double value = dataModel->index(i, vDataColumn).data().toDouble(); int time = dataModel->index(i, hDataColumn).data().toInt(); QPointF point(hAxis->posAtValue(time), vAxis->posAtValue(value)); poly.push_back(point); - if (value >= threshould) { + if (value >= threshold) { if (inAlertFragment) { alertPolygons.back().push_back(point); } else { @@ -873,9 +873,9 @@ void PartialPressureGasItem::paint(QPainter *painter, const QStyleOptionGraphics painter->restore(); } -void PartialPressureGasItem::setThreshouldSettingsKey(const QString &threshouldSettingsKey) +void PartialPressureGasItem::setThreshouldSettingsKey(double *prefPointer) { - threshouldKey = threshouldSettingsKey; + thresholdPtr = prefPointer; } PartialPressureGasItem::PartialPressureGasItem() diff --git a/qt-ui/profile/diveprofileitem.h b/qt-ui/profile/diveprofileitem.h index 86e90224a..1bdf4b368 100644 --- a/qt-ui/profile/diveprofileitem.h +++ b/qt-ui/profile/diveprofileitem.h @@ -211,13 +211,13 @@ public: virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0); virtual void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex()); virtual void settingsChanged(); - void setThreshouldSettingsKey(const QString &threshouldSettingsKey); + void setThreshouldSettingsKey(double *prefPointer); void setVisibilitySettingsKey(const QString &setVisibilitySettingsKey); void setColors(const QColor &normalColor, const QColor &alertColor); private: QVector<QPolygonF> alertPolygons; - QString threshouldKey; + double *thresholdPtr; QString visibilityKey; QColor normalColor; QColor alertColor; diff --git a/qt-ui/profile/profilewidget2.cpp b/qt-ui/profile/profilewidget2.cpp index 17cb19f65..76b5cc1e9 100644 --- a/qt-ui/profile/profilewidget2.cpp +++ b/qt-ui/profile/profilewidget2.cpp @@ -272,9 +272,9 @@ void ProfileWidget2::setupItemOnScene() ITEM->settingsChanged(); \ ITEM->setZValue(99); - CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, "pn2threshold", "pn2graph"); - CREATE_PP_GAS(pheGasItem, PHE, PHE, PHE_ALERT, "phethreshold", "phegraph"); - CREATE_PP_GAS(po2GasItem, PO2, PO2, PO2_ALERT, "po2threshold", "po2graph"); + CREATE_PP_GAS(pn2GasItem, PN2, PN2, PN2_ALERT, &prefs.pp_graphs.pn2_threshold, "pn2graph"); + CREATE_PP_GAS(pheGasItem, PHE, PHE, PHE_ALERT, &prefs.pp_graphs.phe_threshold, "phegraph"); + CREATE_PP_GAS(po2GasItem, PO2, PO2, PO2_ALERT, &prefs.pp_graphs.po2_threshold, "po2graph"); #undef CREATE_PP_GAS temperatureAxis->setTextVisible(false); |