summaryrefslogtreecommitdiffstats
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/diveeventitem.cpp16
-rw-r--r--profile-widget/diveeventitem.h6
-rw-r--r--profile-widget/diveprofileitem.cpp28
-rw-r--r--profile-widget/divetooltipitem.cpp15
-rw-r--r--profile-widget/profilewidget2.cpp41
-rw-r--r--profile-widget/ruleritem.cpp4
-rw-r--r--profile-widget/tankitem.cpp10
-rw-r--r--profile-widget/tankitem.h2
10 files changed, 64 insertions, 70 deletions
diff --git a/profile-widget/animationfunctions.cpp b/profile-widget/animationfunctions.cpp
index 13534bf41..89779e3a8 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/qPrefDisplay.h"
#include <QPropertyAnimation>
namespace Animations {
void hide(QObject *obj)
{
- if (prefs.animation_speed != 0) {
+ if (qPrefDisplay::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 (qPrefDisplay::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 (qPrefDisplay::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 (qPrefDisplay::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 (qPrefDisplay::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/diveeventitem.cpp b/profile-widget/diveeventitem.cpp
index 13ab3770b..64de02436 100644
--- a/profile-widget/diveeventitem.cpp
+++ b/profile-widget/diveeventitem.cpp
@@ -51,7 +51,7 @@ struct event *DiveEventItem::getEvent()
return internalEvent;
}
-void DiveEventItem::setEvent(struct event *ev, struct gasmix *lastgasmix)
+void DiveEventItem::setEvent(struct event *ev, struct gasmix lastgasmix)
{
if (!ev)
return;
@@ -63,7 +63,7 @@ void DiveEventItem::setEvent(struct event *ev, struct gasmix *lastgasmix)
recalculatePos(true);
}
-void DiveEventItem::setupPixmap(struct gasmix *lastgasmix)
+void DiveEventItem::setupPixmap(struct gasmix lastgasmix)
{
const IconMetrics& metrics = defaultIconMetrics();
#ifndef SUBSURFACE_MOBILE
@@ -92,10 +92,10 @@ void DiveEventItem::setupPixmap(struct gasmix *lastgasmix)
} else if (internalEvent->type == SAMPLE_EVENT_BOOKMARK) {
setPixmap(EVENT_PIXMAP(":dive-bookmark-icon"));
} else if (event_is_gaschange(internalEvent)) {
- struct gasmix *mix = get_gasmix_from_event(&displayed_dive, internalEvent);
+ struct gasmix mix = get_gasmix_from_event(&displayed_dive, internalEvent);
struct icd_data icd_data;
bool icd = isobaric_counterdiffusion(lastgasmix, mix, &icd_data);
- if (mix->he.permille) {
+ if (mix.he.permille) {
if (icd)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-trimix-ICD-icon"));
else
@@ -105,7 +105,7 @@ void DiveEventItem::setupPixmap(struct gasmix *lastgasmix)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-air-ICD-icon"));
else
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-air-icon"));
- } else if (mix->o2.permille == 1000) {
+ } else if (mix.o2.permille == 1000) {
if (icd)
setPixmap(EVENT_PIXMAP_BIGGER(":gaschange-oxygen-ICD-icon"));
else
@@ -165,7 +165,7 @@ void DiveEventItem::setupPixmap(struct gasmix *lastgasmix)
#undef EVENT_PIXMAP_BIGGER
}
-void DiveEventItem::setupToolTipString(struct gasmix *lastgasmix)
+void DiveEventItem::setupToolTipString(struct gasmix lastgasmix)
{
// we display the event on screen - so translate
QString name = gettextFromC::tr(internalEvent->name);
@@ -174,7 +174,7 @@ void DiveEventItem::setupToolTipString(struct gasmix *lastgasmix)
if (event_is_gaschange(internalEvent)) {
struct icd_data icd_data;
- struct gasmix *mix = get_gasmix_from_event(&displayed_dive, internalEvent);
+ struct gasmix mix = get_gasmix_from_event(&displayed_dive, internalEvent);
struct membuffer mb = {};
name += ": ";
name += gasname(mix);
@@ -192,7 +192,7 @@ void DiveEventItem::setupToolTipString(struct gasmix *lastgasmix)
name += QString::fromUtf8(mb.buffer, mb.len);
free_buffer(&mb);
}
- *lastgasmix = *mix;
+ lastgasmix = mix;
} else if (same_string(internalEvent->name, "modechange")) {
name += QString(": %1").arg(gettextFromC::tr(divemode_text_ui[internalEvent->value]));
} else if (value) {
diff --git a/profile-widget/diveeventitem.h b/profile-widget/diveeventitem.h
index a3535f8aa..6547fa716 100644
--- a/profile-widget/diveeventitem.h
+++ b/profile-widget/diveeventitem.h
@@ -13,7 +13,7 @@ class DiveEventItem : public DivePixmapItem {
public:
DiveEventItem(QGraphicsItem *parent = 0);
~DiveEventItem();
- void setEvent(struct event *ev, struct gasmix *lastgasmix);
+ void setEvent(struct event *ev, struct gasmix lastgasmix);
struct event *getEvent();
void eventVisibilityChanged(const QString &eventName, bool visible);
void setVerticalAxis(DiveCartesianAxis *axis);
@@ -25,8 +25,8 @@ slots:
void recalculatePos(bool instant = false);
private:
- void setupToolTipString(struct gasmix *lastgasmix);
- void setupPixmap(struct gasmix *lastgasmix);
+ void setupToolTipString(struct gasmix lastgasmix);
+ void setupPixmap(struct gasmix lastgasmix);
DiveCartesianAxis *vAxis;
DiveCartesianAxis *hAxis;
DivePlotDataModel *dataModel;
diff --git a/profile-widget/diveprofileitem.cpp b/profile-widget/diveprofileitem.cpp
index 2c17b67ad..932586f12 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();
}
@@ -410,8 +410,8 @@ void DivePercentageItem::paint(QPainter *painter, const QStyleOptionGraphicsItem
for (int i = 1, modelDataCount = dataModel->rowCount(); i < modelDataCount; i++) {
if (i < poly.count()) {
double value = dataModel->index(i, vDataColumn).data().toDouble();
- struct gasmix *gasmix = NULL;
- struct event *ev = NULL;
+ struct gasmix gasmix = { 0 };
+ const struct event *ev = NULL;
int sec = dataModel->index(i, DivePlotDataModel::TIME).data().toInt();
gasmix = get_gasmix(&displayed_dive, displayed_dc, sec, &ev, gasmix);
int inert = 1000 - get_o2(gasmix);
@@ -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..d1bda0a01 100644
--- a/profile-widget/divetooltipitem.cpp
+++ b/profile-widget/divetooltipitem.cpp
@@ -4,8 +4,8 @@
#include "core/profile.h"
#include "core/membuffer.h"
#include "core/metrics.h"
+#include "core/settings/qPrefDisplay.h"
#include <QPropertyAnimation>
-#include <QSettings>
#include <QGraphicsView>
#include <QStyleOptionGraphicsItem>
#include "core/qthelper.h"
@@ -61,7 +61,7 @@ void ToolTipItem::collapse()
{
int dim = defaultIconMetrics().sz_small;
- if (prefs.animation_speed) {
+ if (qPrefDisplay::animation_speed()) {
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect");
animation->setDuration(100);
animation->setStartValue(nextRectangle);
@@ -119,7 +119,7 @@ void ToolTipItem::expand()
nextRectangle.setHeight(height);
if (nextRectangle != rect()) {
- if (prefs.animation_speed) {
+ if (qPrefDisplay::animation_speed()) {
QPropertyAnimation *animation = new QPropertyAnimation(this, "rect", this);
animation->setDuration(prefs.animation_speed);
animation->setStartValue(rect());
@@ -206,17 +206,12 @@ void ToolTipItem::paint(QPainter *painter, const QStyleOptionGraphicsItem *optio
void ToolTipItem::persistPos()
{
- QSettings s;
- s.beginGroup("ProfileMap");
- s.setValue("tooltip_position", pos());
- s.endGroup();
+ qPrefDisplay::set_tooltip_position(pos());
}
void ToolTipItem::readPos()
{
- QSettings s;
- s.beginGroup("ProfileMap");
- QPointF value = s.value("tooltip_position").toPoint();
+ QPointF value = qPrefDisplay::tooltip_position();
if (!scene()->sceneRect().contains(value)) {
value = QPointF(0, 0);
}
diff --git a/profile-widget/profilewidget2.cpp b/profile-widget/profilewidget2.cpp
index 7c70b15f9..ac1af3951 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/qPrefDisplay.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"
@@ -34,7 +36,6 @@
#include <QInputDialog>
#include <QDebug>
#include <QWheelEvent>
-#include <QSettings>
#include <QMenu>
#include <QElapsedTimer>
@@ -341,17 +342,16 @@ void ProfileWidget2::setupItemOnScene()
#ifndef SUBSURFACE_MOBILE
// Visibility Connections
- connect(SettingsObjectWrapper::instance()->pp_gas, &PartialPressureGasSettings::showPheChanged, pheGasItem, &PartialPressureGasItem::setVisible);
- connect(SettingsObjectWrapper::instance()->pp_gas, &PartialPressureGasSettings::showPo2Changed, po2GasItem, &PartialPressureGasItem::setVisible);
- connect(SettingsObjectWrapper::instance()->pp_gas, &PartialPressureGasSettings::showPn2Changed, pn2GasItem, &PartialPressureGasItem::setVisible);
+ connect(qPrefPartialPressureGas::instance(), &qPrefPartialPressureGas::phe_changed, pheGasItem, &PartialPressureGasItem::setVisible);
+ 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 +595,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 = qPrefDisplay::animation_speed();
+ qPrefDisplay::set_animation_speed(0);
firstCall = false;
}
@@ -757,8 +757,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force, bool doClearPictures)
qDeleteAll(eventItems);
eventItems.clear();
struct event *event = currentdc->events;
- struct event *ev;
- struct gasmix lastgasmix = *get_gasmix(&displayed_dive, current_dc, 1, &ev, NULL);
+ struct gasmix lastgasmix = get_gasmix_at_time(&displayed_dive, current_dc, duration_t{1});
while (event) {
#ifndef SUBSURFACE_MOBILE
@@ -781,7 +780,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force, bool doClearPictures)
item->setHorizontalAxis(timeAxis);
item->setVerticalAxis(profileYAxis);
item->setModel(dataModel);
- item->setEvent(event, &lastgasmix);
+ item->setEvent(event, lastgasmix);
item->setZValue(2);
scene()->addItem(item);
eventItems.push_back(item);
@@ -806,7 +805,7 @@ void ProfileWidget2::plotDive(struct dive *d, bool force, bool doClearPictures)
#endif
diveComputerText->setText(dcText);
if (haveFilesOnCommandLine() && animSpeedBackup != 0) {
- prefs.animation_speed = animSpeedBackup;
+ qPrefDisplay::set_animation_speed(animSpeedBackup);
}
#ifndef SUBSURFACE_MOBILE
@@ -825,7 +824,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
@@ -1452,7 +1451,7 @@ void ProfileWidget2::contextMenuEvent(QContextMenuEvent *event)
action->setData(event->globalPos());
QAction *splitAction = m.addAction(tr("Split dive into two"), this, SLOT(splitDive()));
splitAction->setData(event->globalPos());
- struct event *ev = NULL;
+ const struct event *ev = NULL;
enum divemode_t divemode = UNDEF_COMP_TYPE;
QPointF scenePos = mapToScene(mapFromGlobal(event->globalPos()));
QString gas = action->text();
@@ -1695,7 +1694,7 @@ void ProfileWidget2::changeGas()
// if there is a gas change at this time stamp, remove it before adding the new one
struct event *gasChangeEvent = current_dc->events;
- while ((gasChangeEvent = get_next_event(gasChangeEvent, "gaschange")) != NULL) {
+ while ((gasChangeEvent = get_next_event_mutable(gasChangeEvent, "gaschange")) != NULL) {
if (gasChangeEvent->time.seconds == seconds) {
remove_event(gasChangeEvent);
gasChangeEvent = current_dc->events;
@@ -1710,7 +1709,7 @@ void ProfileWidget2::changeGas()
tank = rx.cap(1).toInt() - 1; // we display the tank 1 based
} else {
qDebug() << "failed to parse tank number";
- tank = get_gasidx(&displayed_dive, &gasmix);
+ tank = get_gasidx(&displayed_dive, gasmix);
}
// add this both to the displayed dive and the current dive
add_gas_switch_event(current_dive, current_dc, seconds, tank);
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
}
diff --git a/profile-widget/tankitem.cpp b/profile-widget/tankitem.cpp
index 22e5d3d21..2bbcdc1a7 100644
--- a/profile-widget/tankitem.cpp
+++ b/profile-widget/tankitem.cpp
@@ -57,15 +57,15 @@ void TankItem::setData(DivePlotDataModel *model, struct plot_info *plotInfo, str
modelDataChanged();
}
-void TankItem::createBar(qreal x, qreal w, struct gasmix *gas)
+void TankItem::createBar(qreal x, qreal w, struct gasmix gas)
{
// pick the right gradient, size, position and text
QGraphicsRectItem *rect = new QGraphicsRectItem(x, 0, w, height, this);
if (gasmix_is_air(gas))
rect->setBrush(air);
- else if (gas->he.permille)
+ else if (gas.he.permille)
rect->setBrush(trimix);
- else if (gas->o2.permille == 1000)
+ else if (gas.o2.permille == 1000)
rect->setBrush(oxygen);
else
rect->setBrush(nitrox);
@@ -104,11 +104,11 @@ void TankItem::modelDataChanged(const QModelIndex&, const QModelIndex&)
// start with the first gasmix and at the start of the dive
int cyl = explicit_first_cylinder(&displayed_dive, dc);
- struct gasmix *gasmix = &displayed_dive.cylinder[cyl].gasmix;
+ struct gasmix gasmix = displayed_dive.cylinder[cyl].gasmix;
int startTime = 0;
// work through all the gas changes and add the rectangle for each gas while it was used
- struct event *ev = get_next_event(dc->events, "gaschange");
+ const struct event *ev = get_next_event(dc->events, "gaschange");
while (ev && (int)ev->time.seconds < last_entry->sec) {
width = hAxis->posAtValue(ev->time.seconds) - hAxis->posAtValue(startTime);
left = hAxis->posAtValue(startTime);
diff --git a/profile-widget/tankitem.h b/profile-widget/tankitem.h
index 8ccfcb5bb..433b1444f 100644
--- a/profile-widget/tankitem.h
+++ b/profile-widget/tankitem.h
@@ -25,7 +25,7 @@ public slots:
void modelDataChanged(const QModelIndex &topLeft = QModelIndex(), const QModelIndex &bottomRight = QModelIndex());
private:
- void createBar(qreal x, qreal w, struct gasmix *gas);
+ void createBar(qreal x, qreal w, struct gasmix gas);
DivePlotDataModel *dataModel;
DiveCartesianAxis *hAxis;
struct dive diveCylinderStore;