aboutsummaryrefslogtreecommitdiffstats
path: root/profile-widget
diff options
context:
space:
mode:
Diffstat (limited to 'profile-widget')
-rw-r--r--profile-widget/animationfunctions.cpp11
-rw-r--r--profile-widget/divecartesianaxis.cpp1
-rw-r--r--profile-widget/diveprofileitem.cpp24
-rw-r--r--profile-widget/divetooltipitem.cpp5
-rw-r--r--profile-widget/profilewidget2.cpp23
-rw-r--r--profile-widget/ruleritem.cpp4
6 files changed, 35 insertions, 33 deletions
diff --git a/profile-widget/animationfunctions.cpp b/profile-widget/animationfunctions.cpp
index 13534bf41..0b84fbcd5 100644
--- a/profile-widget/animationfunctions.cpp
+++ b/profile-widget/animationfunctions.cpp
@@ -1,13 +1,14 @@
// SPDX-License-Identifier: GPL-2.0
#include "profile-widget/animationfunctions.h"
#include "core/pref.h"
+#include "core/settings/qPrefAnimations.h"
#include <QPropertyAnimation>
namespace Animations {
void hide(QObject *obj)
{
- if (prefs.animation_speed != 0) {
+ if (qPrefAnimations::animation_speed() != 0) {
QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
animation->setStartValue(1);
animation->setEndValue(0);
@@ -19,7 +20,7 @@ namespace Animations {
void show(QObject *obj)
{
- if (prefs.animation_speed != 0) {
+ if (qPrefAnimations::animation_speed() != 0) {
QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
animation->setStartValue(0);
animation->setEndValue(1);
@@ -31,7 +32,7 @@ namespace Animations {
void animDelete(QObject *obj)
{
- if (prefs.animation_speed != 0) {
+ if (qPrefAnimations::animation_speed() != 0) {
QPropertyAnimation *animation = new QPropertyAnimation(obj, "opacity");
obj->connect(animation, &QPropertyAnimation::finished, &QObject::deleteLater);
animation->setStartValue(1);
@@ -44,7 +45,7 @@ namespace Animations {
void moveTo(QObject *obj, qreal x, qreal y)
{
- if (prefs.animation_speed != 0) {
+ if (qPrefAnimations::animation_speed() != 0) {
QPropertyAnimation *animation = new QPropertyAnimation(obj, "pos");
animation->setDuration(prefs.animation_speed);
animation->setStartValue(obj->property("pos").toPointF());
@@ -57,7 +58,7 @@ namespace Animations {
void scaleTo(QObject *obj, qreal scale)
{
- if (prefs.animation_speed != 0) {
+ if (qPrefAnimations::animation_speed() != 0) {
QPropertyAnimation *animation = new QPropertyAnimation(obj, "scale");
animation->setDuration(prefs.animation_speed);
animation->setStartValue(obj->property("scale").toReal());
diff --git a/profile-widget/divecartesianaxis.cpp b/profile-widget/divecartesianaxis.cpp
index 29a4165b1..e37c311d3 100644
--- a/profile-widget/divecartesianaxis.cpp
+++ b/profile-widget/divecartesianaxis.cpp
@@ -3,7 +3,6 @@
#include "profile-widget/divetextitem.h"
#include "core/qthelper.h"
#include "core/subsurface-string.h"
-#include "core/subsurface-qt/SettingsObjectWrapper.h"
#ifndef SUBSURFACE_MOBILE
#include "desktop-widgets/preferences/preferencesdialog.h"
#endif
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index 2c17b67ad..bedefb97e 100644
--- a/profile-widget/diveprofileitem.cpp
+++ b/profile-widget/diveprofileitem.cpp
@@ -10,7 +10,7 @@
#endif
#include "qt-models/diveplannermodel.h"
#include "core/qthelper.h"
-#include "core/subsurface-qt/SettingsObjectWrapper.h"
+#include "core/settings/qPrefTechnicalDetails.h"
#include "libdivecomputer/parser.h"
#include "profile-widget/profilewidget2.h"
@@ -112,8 +112,8 @@ void AbstractProfilePolygonItem::modelDataChanged(const QModelIndex&, const QMod
DiveProfileItem::DiveProfileItem() : show_reported_ceiling(0), reported_ceiling_in_red(0)
{
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::dcceiling_changed, this, &DiveProfileItem::settingsToggled);
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::redceiling_changed, this, &DiveProfileItem::settingsToggled);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::dcceiling_changed, this, &DiveProfileItem::settingsToggled);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::redceiling_changed, this, &DiveProfileItem::settingsToggled);
}
void DiveProfileItem::settingsToggled(bool)
@@ -267,7 +267,7 @@ DiveHeartrateItem::DiveHeartrateItem()
pen.setCosmetic(true);
pen.setWidth(1);
setPen(pen);
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::hrgraph_changed, this, &DiveHeartrateItem::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::hrgraph_changed, this, &DiveHeartrateItem::setVisible);
}
void DiveHeartrateItem::modelDataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight)
@@ -348,7 +348,7 @@ void DiveHeartrateItem::paint(QPainter *painter, const QStyleOptionGraphicsItem*
DivePercentageItem::DivePercentageItem(int i)
{
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::percentagegraph_changed, this, &DivePercentageItem::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::percentagegraph_changed, this, &DivePercentageItem::setVisible);
tissueIndex = i;
settingsChanged();
}
@@ -465,7 +465,7 @@ void DiveAmbPressureItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
painter->setPen(pen());
painter->drawPolyline(polygon());
painter->restore();
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::percentagegraph_changed, this, &DiveAmbPressureItem::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::percentagegraph_changed, this, &DiveAmbPressureItem::setVisible);
}
DiveGFLineItem::DiveGFLineItem()
@@ -510,7 +510,7 @@ void DiveGFLineItem::paint(QPainter *painter, const QStyleOptionGraphicsItem*, Q
painter->setPen(pen());
painter->drawPolyline(polygon());
painter->restore();
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::percentagegraph_changed, this, &DiveAmbPressureItem::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::percentagegraph_changed, this, &DiveAmbPressureItem::setVisible);
}
DiveTemperatureItem::DiveTemperatureItem()
@@ -635,7 +635,7 @@ void DiveMeanDepthItem::paint(QPainter *painter, const QStyleOptionGraphicsItem*
painter->setPen(pen());
painter->drawPolyline(polygon());
painter->restore();
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::show_average_depth_changed, this, &DiveAmbPressureItem::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_average_depth_changed, this, &DiveAmbPressureItem::setVisible);
}
void DiveMeanDepthItem::createTextItem() {
@@ -821,7 +821,7 @@ DiveCalculatedCeiling::DiveCalculatedCeiling(ProfileWidget2 *widget) :
profileWidget(widget),
is3mIncrement(false)
{
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::calcceiling_changed, this, &DiveCalculatedCeiling::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::calcceiling_changed, this, &DiveCalculatedCeiling::setVisible);
setVisible(prefs.calcceiling);
settingsChanged();
}
@@ -862,8 +862,8 @@ void DiveCalculatedCeiling::paint(QPainter *painter, const QStyleOptionGraphicsI
DiveCalculatedTissue::DiveCalculatedTissue(ProfileWidget2 *widget) : DiveCalculatedCeiling(widget)
{
settingsChanged();
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::calcalltissues_changed, this, &DiveCalculatedTissue::setVisible);
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::calcceiling_changed, this, &DiveCalculatedTissue::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::calcalltissues_changed, this, &DiveCalculatedTissue::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::calcceiling_changed, this, &DiveCalculatedTissue::setVisible);
}
void DiveCalculatedTissue::setVisible(bool)
@@ -878,7 +878,7 @@ void DiveCalculatedTissue::settingsChanged()
DiveReportedCeiling::DiveReportedCeiling()
{
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::dcceiling_changed, this, &DiveReportedCeiling::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::dcceiling_changed, this, &DiveReportedCeiling::setVisible);
setVisible(prefs.dcceiling);
settingsChanged();
}
diff --git a/profile-widget/divetooltipitem.cpp b/profile-widget/divetooltipitem.cpp
index 09719c0ec..21bf82c13 100644
--- a/profile-widget/divetooltipitem.cpp
+++ b/profile-widget/divetooltipitem.cpp
@@ -4,6 +4,7 @@
#include "core/profile.h"
#include "core/membuffer.h"
#include "core/metrics.h"
+#include "core/settings/qPrefAnimations.h"
#include <QPropertyAnimation>
#include <QSettings>
#include <QGraphicsView>
@@ -61,7 +62,7 @@ void ToolTipItem::collapse()
{
int dim = defaultIconMetrics().sz_small;
- if (prefs.animation_speed) {
+ if (qPrefAnimations::animation_speed()) {
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect");
animation->setDuration(100);
animation->setStartValue(nextRectangle);
@@ -119,7 +120,7 @@ void ToolTipItem::expand()
nextRectangle.setHeight(height);
if (nextRectangle != rect()) {
- if (prefs.animation_speed) {
+ if (qPrefAnimations::animation_speed()) {
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect", this);
animation->setDuration(prefs.animation_speed);
animation->setStartValue(rect());
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 5eb40b69e..cbd63cf40 100644
--- a/profile-widget/profilewidget2.cpp
+++ b/profile-widget/profilewidget2.cpp
@@ -4,6 +4,9 @@
#include "core/subsurface-string.h"
#include "core/qthelper.h"
#include "core/profile.h"
+#include "core/settings/qPrefAnimations.h"
+#include "core/settings/qPrefTechnicalDetails.h"
+#include "core/settings/qPrefPartialPressureGas.h"
#include "profile-widget/diveeventitem.h"
#include "profile-widget/divetextitem.h"
#include "profile-widget/divetooltipitem.h"
@@ -16,7 +19,6 @@
#include "qt-models/models.h"
#include "qt-models/divepicturemodel.h"
#include "core/divelist.h"
-#include "core/subsurface-qt/SettingsObjectWrapper.h"
#ifndef SUBSURFACE_MOBILE
#include "desktop-widgets/diveplanner.h"
#include "desktop-widgets/simplewidgets.h"
@@ -345,13 +347,12 @@ void ProfileWidget2::setupItemOnScene()
connect(qPrefPartialPressureGas::instance(), &qPrefPartialPressureGas::po2_changed, po2GasItem, &PartialPressureGasItem::setVisible);
connect(qPrefPartialPressureGas::instance(), &qPrefPartialPressureGas::pn2_changed, pn2GasItem, &PartialPressureGasItem::setVisible);
- //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, &qPrefTechnicalDetails::show_ccr_setpoint_changed, o2SetpointGasItem, &PartialPressureGasItem::setVisible);
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::show_scr_ocpo2_changed, ocpo2GasItem, &PartialPressureGasItem::setVisible);
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::show_ccr_sensors_changed, ccrsensor1GasItem, &PartialPressureGasItem::setVisible);
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::show_ccr_sensors_changed, ccrsensor2GasItem, &PartialPressureGasItem::setVisible);
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::show_ccr_sensors_changed, ccrsensor3GasItem, &PartialPressureGasItem::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_ccr_setpoint_changed, o2SetpointGasItem, &PartialPressureGasItem::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_scr_ocpo2_changed, ocpo2GasItem, &PartialPressureGasItem::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_ccr_sensors_changed, ccrsensor1GasItem, &PartialPressureGasItem::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_ccr_sensors_changed, ccrsensor2GasItem, &PartialPressureGasItem::setVisible);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::show_ccr_sensors_changed, ccrsensor3GasItem, &PartialPressureGasItem::setVisible);
heartBeatAxis->setTextVisible(true);
heartBeatAxis->setLinesVisible(true);
@@ -595,8 +596,8 @@ void ProfileWidget2::plotDive(struct dive *d, bool force, bool doClearPictures)
// special handling for the first time we display things
int animSpeedBackup = 0;
if (firstCall && haveFilesOnCommandLine()) {
- animSpeedBackup = prefs.animation_speed;
- prefs.animation_speed = 0;
+ animSpeedBackup = qPrefAnimations::animation_speed();
+ qPrefAnimations::set_animation_speed(0);
firstCall = false;
}
@@ -806,7 +807,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force, bool doClearPictures)
#endif
diveComputerText->setText(dcText);
if (haveFilesOnCommandLine() && animSpeedBackup != 0) {
- prefs.animation_speed = animSpeedBackup;
+ qPrefAnimations::set_animation_speed(animSpeedBackup);
}
#ifndef SUBSURFACE_MOBILE
@@ -825,7 +826,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force, bool doClearPictures)
// so if we are calculation TTS / NDL then let's force that off.
#ifndef SUBSURFACE_MOBILE
if (measureDuration.elapsed() > 1000 && prefs.calcndltts) {
- SettingsObjectWrapper::instance()->techDetails->set_calcndltts(false);
+ qPrefTechnicalDetails::set_calcndltts(false);
report_error(qPrintable(tr("Show NDL / TTS was disabled because of excessive processing time")));
}
#endif
diff --git a/profile-widget/ruleritem.cpp b/profile-widget/ruleritem.cpp
index 4c49bdc9e..f736f3ac3 100644
--- a/profile-widget/ruleritem.cpp
+++ b/profile-widget/ruleritem.cpp
@@ -5,7 +5,7 @@
#endif
#include "profile-widget/profilewidget2.h"
#include "core/display.h"
-#include "core/subsurface-qt/SettingsObjectWrapper.h"
+#include "core/settings/qPrefTechnicalDetails.h"
#include <qgraphicssceneevent.h>
@@ -83,7 +83,7 @@ RulerItem2::RulerItem2() : source(new RulerNodeItem2()),
textItemBack->setFlag(QGraphicsItem::ItemIgnoresTransformations);
setPen(QPen(QColor(Qt::black), 0.0));
#ifndef SUBSURFACE_MOBILE
- connect(SettingsObjectWrapper::instance()->techDetails, &qPrefTechnicalDetails::rulergraph_changed, this, &RulerItem2::settingsChanged);
+ connect(qPrefTechnicalDetails::instance(), &qPrefTechnicalDetails::rulergraph_changed, this, &RulerItem2::settingsChanged);
#endif
}