diff --git a/Subsurface-mobile.pro b/Subsurface-mobile.pro index 5641f422d..38dfd290a 100644 --- a/Subsurface-mobile.pro +++ b/Subsurface-mobile.pro @@ -122,7 +122,6 @@ SOURCES += subsurface-mobile-main.cpp \ core/settings/qPrefLog.cpp \ core/settings/qPrefMedia.cpp \ core/settings/qPrefUpdateManager.cpp \ - core/subsurface-qt/cylinderobjecthelper.cpp \ core/subsurface-qt/diveobjecthelper.cpp \ core/subsurface-qt/divelistnotifier.cpp \ backend-shared/exportfuncs.cpp \ @@ -258,7 +257,6 @@ HEADERS += \ core/settings/qPrefLog.h \ core/settings/qPrefMedia.h \ core/settings/qPrefUpdateManager.h \ - core/subsurface-qt/cylinderobjecthelper.h \ core/subsurface-qt/diveobjecthelper.h \ core/subsurface-qt/divelistnotifier.h \ backend-shared/exportfuncs.h \ diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 5680c5f6b..1a5744356 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -244,8 +244,6 @@ set(SUBSURFACE_CORE_LIB_SRCS settings/qPrefUpdateManager.h #Subsurface Qt have the Subsurface structs QObjectified for easy access via QML. - subsurface-qt/cylinderobjecthelper.cpp - subsurface-qt/cylinderobjecthelper.h subsurface-qt/divelistnotifier.cpp subsurface-qt/divelistnotifier.h subsurface-qt/diveobjecthelper.cpp diff --git a/core/subsurface-qt/cylinderobjecthelper.cpp b/core/subsurface-qt/cylinderobjecthelper.cpp deleted file mode 100644 index 897746952..000000000 --- a/core/subsurface-qt/cylinderobjecthelper.cpp +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#include "cylinderobjecthelper.h" -#include "../qthelper.h" - -static QString EMPTY_CYLINDER_STRING = QStringLiteral(""); -CylinderObjectHelper::CylinderObjectHelper(const cylinder_t *cylinder) -{ - if (!cylinder) - return; - - description = cylinder->type.description ? cylinder->type.description: - EMPTY_CYLINDER_STRING; - size = get_volume_string(cylinder->type.size, true); - workingPressure = get_pressure_string(cylinder->type.workingpressure, true); - startPressure = get_pressure_string(cylinder->start, true); - endPressure = get_pressure_string(cylinder->end, true); - gasMix = get_gas_string(cylinder->gasmix); -} diff --git a/core/subsurface-qt/cylinderobjecthelper.h b/core/subsurface-qt/cylinderobjecthelper.h deleted file mode 100644 index e1e2490e4..000000000 --- a/core/subsurface-qt/cylinderobjecthelper.h +++ /dev/null @@ -1,29 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -#ifndef CYLINDER_QOBJECT_H -#define CYLINDER_QOBJECT_H - -#include "../equipment.h" -#include -#include - -class CylinderObjectHelper { - Q_GADGET - Q_PROPERTY(QString description MEMBER description CONSTANT) - Q_PROPERTY(QString size MEMBER size CONSTANT) - Q_PROPERTY(QString workingPressure MEMBER workingPressure CONSTANT) - Q_PROPERTY(QString startPressure MEMBER startPressure CONSTANT) - Q_PROPERTY(QString endPressure MEMBER endPressure CONSTANT) - Q_PROPERTY(QString gasMix MEMBER gasMix CONSTANT) -public: - CylinderObjectHelper(const cylinder_t *cylinder = NULL); - QString description; - QString size; - QString workingPressure; - QString startPressure; - QString endPressure; - QString gasMix; -}; - -Q_DECLARE_METATYPE(CylinderObjectHelper) - -#endif diff --git a/core/subsurface-qt/diveobjecthelper.h b/core/subsurface-qt/diveobjecthelper.h index b76a9930f..30dee6bf7 100644 --- a/core/subsurface-qt/diveobjecthelper.h +++ b/core/subsurface-qt/diveobjecthelper.h @@ -2,7 +2,7 @@ #ifndef DIVE_QOBJECT_H #define DIVE_QOBJECT_H -#include "cylinderobjecthelper.h" +#include "core/units.h" #include #include #include diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp index 025c1c31d..94cf322f0 100644 --- a/desktop-widgets/templatelayout.cpp +++ b/desktop-widgets/templatelayout.cpp @@ -10,7 +10,6 @@ #include "core/selection.h" #include "core/qthelper.h" #include "core/string-format.h" -#include "core/subsurface-qt/cylinderobjecthelper.h" // TODO: remove once grantlee supports Q_GADGET objects QList grantlee_templates, grantlee_statistics_templates; @@ -499,19 +498,19 @@ QVariant TemplateLayout::getValue(QString list, QString property, const State &s } else if (list == "cylinderObjects") { if (!state.currentCylinderObject) return QVariant(); - const CylinderObjectHelper object(*state.currentCylinderObject); + const cylinder_t *cylinder = *state.currentCylinderObject; if (property == "description") { - return object.description; + return cylinder->type.description; } else if (property == "size") { - return object.size; + return get_volume_string(cylinder->type.size, true); } else if (property == "workingPressure") { - return object.workingPressure; + return get_pressure_string(cylinder->type.workingpressure, true); } else if (property == "startPressure") { - return object.startPressure; + return get_pressure_string(cylinder->start, true); } else if (property == "endPressure") { - return object.endPressure; + return get_pressure_string(cylinder->end, true); } else if (property == "gasMix") { - return object.gasMix; + return get_gas_string(cylinder->gasmix); } } else if (list == "dives") { if (!state.currentDive) diff --git a/desktop-widgets/templatelayout.h b/desktop-widgets/templatelayout.h index 786cd055a..24dfdf278 100644 --- a/desktop-widgets/templatelayout.h +++ b/desktop-widgets/templatelayout.h @@ -6,7 +6,6 @@ #include "core/equipment.h" #include -class CylinderObjectHelper; struct print_options; struct template_options; class QTextStream;