aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/CMakeLists.txt2
-rw-r--r--core/subsurface-qt/diveobjecthelper.cpp108
-rw-r--r--core/subsurface-qt/diveobjecthelper.h99
3 files changed, 0 insertions, 209 deletions
diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt
index 1a5744356..9d92cc1d1 100644
--- a/core/CMakeLists.txt
+++ b/core/CMakeLists.txt
@@ -246,8 +246,6 @@ set(SUBSURFACE_CORE_LIB_SRCS
#Subsurface Qt have the Subsurface structs QObjectified for easy access via QML.
subsurface-qt/divelistnotifier.cpp
subsurface-qt/divelistnotifier.h
- subsurface-qt/diveobjecthelper.cpp
- subsurface-qt/diveobjecthelper.h
${SERIAL_FTDI}
${PLATFORM_SRC}
diff --git a/core/subsurface-qt/diveobjecthelper.cpp b/core/subsurface-qt/diveobjecthelper.cpp
deleted file mode 100644
index aa60355b2..000000000
--- a/core/subsurface-qt/diveobjecthelper.cpp
+++ /dev/null
@@ -1,108 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#include "diveobjecthelper.h"
-
-#include <QDateTime>
-#include <QTextDocument>
-
-#include "core/dive.h"
-#include "core/qthelper.h"
-#include "core/divesite.h"
-#include "core/trip.h"
-#include "core/subsurface-string.h"
-#include "core/string-format.h"
-#include "qt-models/tankinfomodel.h"
-
-#if defined(DEBUG_DOH)
-#include <execinfo.h>
-#include <stdio.h>
-#include <unistd.h>
-static int callCounter = 0;
-#endif /* defined(DEBUG_DOH) */
-
-QString formatDiveSalinity(const dive *d)
-{
- int salinity = get_dive_salinity(d);
- if (!salinity)
- return QString();
- return get_salinity_string(salinity);
-}
-
-QString formatDiveWaterType(const dive *d)
-{
- return get_water_type_string(get_dive_salinity(d));
-}
-
-// Qt's metatype system insists on generating a default constructed object, even if that makes no sense.
-DiveObjectHelper::DiveObjectHelper()
-{
-}
-
-DiveObjectHelper::DiveObjectHelper(const struct dive *d) :
- number(d->number),
- id(d->id),
- rating(d->rating),
- visibility(d->visibility),
- wavesize(d->wavesize),
- current(d->current),
- surge(d->surge),
- chill(d->chill),
- timestamp(d->when),
- location(get_dive_location(d)),
- gps(formatDiveGPS(d)),
- gps_decimal(format_gps_decimal(d)),
- dive_site(QVariant::fromValue(d->dive_site)),
- duration(formatDiveDuration(d)),
- noDive(d->duration.seconds == 0 && d->dc.duration.seconds == 0),
- depth(get_depth_string(d->dc.maxdepth.mm, true, true)),
- divemaster(d->divemaster ? d->divemaster : QString()),
- buddy(d->buddy ? d->buddy : QString()),
- airTemp(get_temperature_string(d->airtemp, true)),
- waterTemp(get_temperature_string(d->watertemp, true)),
- notes(formatNotes(d)),
- tags(get_taglist_string(d->tag_list)),
- gas(formatGas(d)),
- sac(formatSac(d)),
- weightList(formatWeightList(d)),
- weights(formatWeights(d)),
- singleWeight(d->weightsystems.nr <= 1),
- suit(d->suit ? d->suit : QString()),
- cylinders(formatCylinders(d)),
- maxcns(d->maxcns),
- otu(d->otu),
- sumWeight(formatSumWeight(d)),
- getCylinder(formatGetCylinder(d)),
- startPressure(formatStartPressure(d)),
- endPressure(formatEndPressure(d)),
- firstGas(formatFirstGas(d)),
- salinity(formatDiveSalinity(d)),
- waterType(formatDiveWaterType(d))
-{
-#if defined(DEBUG_DOH)
- void *array[4];
- size_t size;
-
- // get void*'s for all entries on the stack
- size = backtrace(array, 4);
-
- // print out all the frames to stderr
- fprintf(stderr, "\n\nCalling DiveObjectHelper constructor for dive %d - call #%d\n", d->number, ++callCounter);
- backtrace_symbols_fd(array, size, STDERR_FILENO);
-#endif /* defined(DEBUG_DOH) */
-}
-
-QString DiveObjectHelper::date() const
-{
- QDateTime localTime = timestampToDateTime(timestamp);
- return localTime.date().toString(prefs.date_format_short);
-}
-
-QString DiveObjectHelper::time() const
-{
- QDateTime localTime = timestampToDateTime(timestamp);
- return localTime.time().toString(prefs.time_format);
-}
-
-QStringList DiveObjectHelper::cylinderList() const
-{
- return formatFullCylinderList();
-}
diff --git a/core/subsurface-qt/diveobjecthelper.h b/core/subsurface-qt/diveobjecthelper.h
deleted file mode 100644
index 8b328673f..000000000
--- a/core/subsurface-qt/diveobjecthelper.h
+++ /dev/null
@@ -1,99 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0
-#ifndef DIVE_QOBJECT_H
-#define DIVE_QOBJECT_H
-
-#include "core/units.h"
-#include <QObject>
-#include <QString>
-#include <QStringList>
-#include <QVector>
-#include <QVariant>
-
-class DiveObjectHelper {
- Q_GADGET
- Q_PROPERTY(int number MEMBER number CONSTANT)
- Q_PROPERTY(int id MEMBER id CONSTANT)
- Q_PROPERTY(int rating MEMBER rating CONSTANT)
- Q_PROPERTY(int visibility MEMBER visibility CONSTANT)
- Q_PROPERTY(int wavesize MEMBER wavesize CONSTANT)
- Q_PROPERTY(int current MEMBER current CONSTANT)
- Q_PROPERTY(int surge MEMBER surge CONSTANT)
- Q_PROPERTY(int chill MEMBER chill CONSTANT)
- Q_PROPERTY(QString date READ date CONSTANT)
- Q_PROPERTY(QString time READ time CONSTANT)
- Q_PROPERTY(int timestamp MEMBER timestamp CONSTANT)
- Q_PROPERTY(QString location MEMBER location CONSTANT)
- Q_PROPERTY(QString gps MEMBER gps CONSTANT)
- Q_PROPERTY(QString gps_decimal MEMBER gps_decimal CONSTANT)
- Q_PROPERTY(QVariant dive_site MEMBER dive_site CONSTANT)
- Q_PROPERTY(QString duration MEMBER duration CONSTANT)
- Q_PROPERTY(bool noDive MEMBER noDive CONSTANT)
- Q_PROPERTY(QString depth MEMBER depth CONSTANT)
- Q_PROPERTY(QString divemaster MEMBER divemaster CONSTANT)
- Q_PROPERTY(QString buddy MEMBER buddy CONSTANT)
- Q_PROPERTY(QString airTemp MEMBER airTemp CONSTANT)
- Q_PROPERTY(QString waterTemp MEMBER waterTemp CONSTANT)
- Q_PROPERTY(QString notes MEMBER notes CONSTANT)
- Q_PROPERTY(QString tags MEMBER tags CONSTANT)
- Q_PROPERTY(QString gas MEMBER gas CONSTANT)
- Q_PROPERTY(QString sac MEMBER sac CONSTANT)
- Q_PROPERTY(QString weightList MEMBER weightList CONSTANT)
- Q_PROPERTY(QStringList weights MEMBER weights CONSTANT)
- Q_PROPERTY(bool singleWeight MEMBER singleWeight CONSTANT)
- Q_PROPERTY(QString suit MEMBER suit CONSTANT)
- Q_PROPERTY(QStringList cylinderList READ cylinderList CONSTANT)
- Q_PROPERTY(QStringList cylinders MEMBER cylinders CONSTANT)
- Q_PROPERTY(int maxcns MEMBER maxcns CONSTANT)
- Q_PROPERTY(int otu MEMBER otu CONSTANT)
- Q_PROPERTY(QString sumWeight MEMBER sumWeight CONSTANT)
- Q_PROPERTY(QStringList getCylinder MEMBER getCylinder CONSTANT)
- Q_PROPERTY(QStringList startPressure MEMBER startPressure CONSTANT)
- Q_PROPERTY(QStringList endPressure MEMBER endPressure CONSTANT)
- Q_PROPERTY(QStringList firstGas MEMBER firstGas CONSTANT)
-public:
- DiveObjectHelper(); // This is only to be used by Qt's metatype system!
- DiveObjectHelper(const struct dive *dive);
- int number;
- int id;
- int rating;
- int visibility;
- int wavesize;
- int current;
- int surge;
- int chill;
- QString date() const;
- timestamp_t timestamp;
- QString time() const;
- QString location;
- QString gps;
- QString gps_decimal;
- QVariant dive_site;
- QString duration;
- bool noDive;
- QString depth;
- QString divemaster;
- QString buddy;
- QString airTemp;
- QString waterTemp;
- QString notes;
- QString tags;
- QString gas;
- QString sac;
- QString weightList;
- QStringList weights;
- bool singleWeight;
- QString suit;
- QStringList cylinderList() const;
- QStringList cylinders;
- int maxcns;
- int otu;
- QString sumWeight;
- QStringList getCylinder;
- QStringList startPressure;
- QStringList endPressure;
- QStringList firstGas;
- QString salinity;
- QString waterType;
-};
-
-#endif