From 411f455291a547c782588ec8327ec5f8a34f243c Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Mon, 25 Jan 2016 18:15:06 -0200 Subject: Fix bug on the visibility of the Ruler Graph Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- profile-widget/ruleritem.cpp | 10 ++++------ profile-widget/ruleritem.h | 2 +- subsurface-core/qthelper.cpp | 1 + subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp | 2 +- 4 files changed, 7 insertions(+), 8 deletions(-) diff --git a/profile-widget/ruleritem.cpp b/profile-widget/ruleritem.cpp index 1b9c0e929..ce217b918 100644 --- a/profile-widget/ruleritem.cpp +++ b/profile-widget/ruleritem.cpp @@ -4,6 +4,7 @@ #endif #include "profilewidget2.h" #include "display.h" +#include "subsurface-core/subsurface-qt/SettingsObjectWrapper.h" #include @@ -81,20 +82,17 @@ RulerItem2::RulerItem2() : source(new RulerNodeItem2()), textItemBack->setFlag(QGraphicsItem::ItemIgnoresTransformations); setPen(QPen(QColor(Qt::black), 0.0)); #ifndef SUBSURFACE_MOBILE - connect(PreferencesDialog::instance(), SIGNAL(settingsChanged()), this, SLOT(settingsChanged())); + connect(SettingsObjectWrapper::instance()->techDetails, &TechnicalDetailsSettings::rulerGraphChanged, this, &RulerItem2::settingsChanged); #endif } -void RulerItem2::settingsChanged() +void RulerItem2::settingsChanged(bool value) { ProfileWidget2 *profWidget = NULL; if (scene() && scene()->views().count()) profWidget = qobject_cast(scene()->views().first()); - if (profWidget && profWidget->currentState == ProfileWidget2::PROFILE) - setVisible(prefs.rulergraph); - else - setVisible(false); + setVisible( (profWidget && profWidget->currentState == ProfileWidget2::PROFILE) ? value : false); } void RulerItem2::recalculate() diff --git a/profile-widget/ruleritem.h b/profile-widget/ruleritem.h index 4fad0451c..343a24862 100644 --- a/profile-widget/ruleritem.h +++ b/profile-widget/ruleritem.h @@ -44,7 +44,7 @@ public: public slots: - void settingsChanged(); + void settingsChanged(bool toggled); private: struct plot_info pInfo; diff --git a/subsurface-core/qthelper.cpp b/subsurface-core/qthelper.cpp index b8e168873..e5cb2cec9 100644 --- a/subsurface-core/qthelper.cpp +++ b/subsurface-core/qthelper.cpp @@ -1310,6 +1310,7 @@ void loadPreferences() GET_BOOL("calcalltissues", calcalltissues); GET_BOOL("hrgraph", hrgraph); GET_BOOL("tankbar", tankbar); + GET_BOOL("RulerBar", rulergraph); GET_BOOL("percentagegraph", percentagegraph); GET_INT("gflow", gflow); GET_INT("gfhigh", gfhigh); diff --git a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp index 02ec8a0fc..22d9a09d8 100644 --- a/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/subsurface-core/subsurface-qt/SettingsObjectWrapper.cpp @@ -363,7 +363,7 @@ void TechnicalDetailsSettings::setRulerGraph(bool value) QSettings s; s.beginGroup(tecDetails); s.setValue("RulerBar", value); - prefs.pp_graphs.phe_threshold = value; + prefs.rulergraph = value; emit rulerGraphChanged(value); } -- cgit v1.2.3-70-g09d2