diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/checkcloudconnection.cpp | 2 | ||||
-rw-r--r-- | core/cloudstorage.cpp | 2 | ||||
-rw-r--r-- | core/divelogexportlogic.cpp | 2 | ||||
-rw-r--r-- | core/divesitehelpers.cpp | 2 | ||||
-rw-r--r-- | core/gpslocation.cpp | 2 | ||||
-rw-r--r-- | core/helpers.h | 55 | ||||
-rw-r--r-- | core/qt-init.cpp | 2 | ||||
-rw-r--r-- | core/qthelper.cpp | 3 | ||||
-rw-r--r-- | core/qthelper.h | 42 | ||||
-rw-r--r-- | core/statistics.h | 3 | ||||
-rw-r--r-- | core/subsurface-qt/CylinderObjectHelper.cpp | 2 | ||||
-rw-r--r-- | core/subsurface-qt/DiveObjectHelper.cpp | 1 | ||||
-rw-r--r-- | core/subsurface-qt/SettingsObjectWrapper.cpp | 2 |
13 files changed, 54 insertions, 66 deletions
diff --git a/core/checkcloudconnection.cpp b/core/checkcloudconnection.cpp index f3e064c16..ce396ebf6 100644 --- a/core/checkcloudconnection.cpp +++ b/core/checkcloudconnection.cpp @@ -6,7 +6,7 @@ #include <QEventLoop> #include "pref.h" -#include "helpers.h" +#include "qthelper.h" #include "git-access.h" #include "checkcloudconnection.h" diff --git a/core/cloudstorage.cpp b/core/cloudstorage.cpp index 5e3f799db..89e4ba553 100644 --- a/core/cloudstorage.cpp +++ b/core/cloudstorage.cpp @@ -1,7 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "cloudstorage.h" #include "pref.h" -#include "helpers.h" +#include "qthelper.h" #include "core/subsurface-qt/SettingsObjectWrapper.h" #include <QApplication> diff --git a/core/divelogexportlogic.cpp b/core/divelogexportlogic.cpp index 283cffbca..7617e6c23 100644 --- a/core/divelogexportlogic.cpp +++ b/core/divelogexportlogic.cpp @@ -5,7 +5,7 @@ #include <QDir> #include <QTextStream> #include "divelogexportlogic.h" -#include "helpers.h" +#include "qthelper.h" #include "units.h" #include "statistics.h" #include "save-html.h" diff --git a/core/divesitehelpers.cpp b/core/divesitehelpers.cpp index 30a5ac608..3f752a320 100644 --- a/core/divesitehelpers.cpp +++ b/core/divesitehelpers.cpp @@ -7,7 +7,7 @@ #include "divesite.h" #include "subsurface-string.h" -#include "helpers.h" +#include "qthelper.h" #include "membuffer.h" #include <QDebug> #include <QJsonDocument> diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp index 7b68c68f0..e0d3e3a10 100644 --- a/core/gpslocation.cpp +++ b/core/gpslocation.cpp @@ -2,7 +2,7 @@ #include "core/gpslocation.h" #include "qt-models/gpslistmodel.h" #include "core/pref.h" -#include "core/helpers.h" +#include "core/qthelper.h" #include <time.h> #include <unistd.h> #include <QDebug> diff --git a/core/helpers.h b/core/helpers.h deleted file mode 100644 index 84551b49e..000000000 --- a/core/helpers.h +++ /dev/null @@ -1,55 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0 -/* - * helpers.h - * - * header file for random helper functions of Subsurface - * - */ -#ifndef HELPERS_H -#define HELPERS_H - -#include <QString> -#include "qthelper.h" - -QString get_depth_string(depth_t depth, bool showunit = false, bool showdecimal = true); -QString get_depth_string(int mm, bool showunit = false, bool showdecimal = true); -QString get_depth_unit(); -QString get_weight_string(weight_t weight, bool showunit = false); -QString get_weight_unit(); -QString get_temperature_string(temperature_t temp, bool showunit = false); -QString get_temp_unit(); -QString get_volume_string(volume_t volume, bool showunit = false); -QString get_volume_string(int mliter, bool showunit = false); -QString get_volume_unit(); -QString get_pressure_string(pressure_t pressure, bool showunit = false); -QString get_pressure_unit(); -QString getSubsurfaceDataPath(QString folderToFind); -QString getPrintingTemplatePathUser(); -QString getPrintingTemplatePathBundle(); -extern const QString get_dc_nickname(const char *model, uint32_t deviceid); -int gettimezoneoffset(timestamp_t when = 0); -int parseDurationToSeconds(const QString &text); -int parseLengthToMm(const QString &text); -int parseTemperatureToMkelvin(const QString &text); -int parseWeightToGrams(const QString &text); -int parsePressureToMbar(const QString &text); -int parseGasMixO2(const QString &text); -int parseGasMixHE(const QString &text); -QString render_seconds_to_string(int seconds); -QString get_dive_duration_string(timestamp_t when, QString hoursText, QString minutesText, QString secondsText = QObject::tr("sec"), QString separator = ":", bool isFreeDive = false); -QString get_dive_surfint_string(timestamp_t when, QString daysText, QString hoursText, QString minutesText, QString separator = " ", int maxdays = 4); -QString get_dive_date_string(timestamp_t when); -QString get_short_dive_date_string(timestamp_t when); -bool is_same_day (timestamp_t trip_when, timestamp_t dive_when); -QString get_trip_date_string(timestamp_t when, int nr, bool getday); -QString uiLanguage(QLocale *callerLoc); -QLocale getLocale(); -void selectedDivesGasUsed(QVector<QPair<QString, int> > &gasUsed); -QString getUserAgent(); - -#if defined __APPLE__ -#define TITLE_OR_TEXT(_t, _m) "", _t + "\n" + _m -#else -#define TITLE_OR_TEXT(_t, _m) _t, _m -#endif -#endif // HELPERS_H diff --git a/core/qt-init.cpp b/core/qt-init.cpp index 42d89f18b..f06da0cab 100644 --- a/core/qt-init.cpp +++ b/core/qt-init.cpp @@ -3,7 +3,7 @@ #include <QNetworkProxy> #include <QLibraryInfo> #include <QTextCodec> -#include "helpers.h" +#include "qthelper.h" #include "core/subsurface-qt/SettingsObjectWrapper.h" char *settings_suffix = NULL; diff --git a/core/qthelper.cpp b/core/qthelper.cpp index cf4f8d021..b09e125ca 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -1,7 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include "qthelper.h" #include "subsurface-string.h" -#include "helpers.h" #include "subsurface-string.h" #include "gettextfromc.h" #include "statistics.h" @@ -556,7 +555,7 @@ void set_filename(const char *filename) existing_filename = copy_string(filename); } -const QString get_dc_nickname(const char *model, uint32_t deviceid) +QString get_dc_nickname(const char *model, uint32_t deviceid) { const DiveComputerNode *existNode = dcList.getExact(model, deviceid); diff --git a/core/qthelper.h b/core/qthelper.h index e6a5d7fd6..e4c64afa8 100644 --- a/core/qthelper.h +++ b/core/qthelper.h @@ -51,6 +51,48 @@ QString getUUID(); QStringList imageExtensionFilters(); char *intdup(int index); char *copy_qstring(const QString &); +QString get_depth_string(depth_t depth, bool showunit = false, bool showdecimal = true); +QString get_depth_string(int mm, bool showunit = false, bool showdecimal = true); +QString get_depth_unit(); +QString get_weight_string(weight_t weight, bool showunit = false); +QString get_weight_unit(); +QString get_temperature_string(temperature_t temp, bool showunit = false); +QString get_temp_unit(); +QString get_volume_string(volume_t volume, bool showunit = false); +QString get_volume_string(int mliter, bool showunit = false); +QString get_volume_unit(); +QString get_pressure_string(pressure_t pressure, bool showunit = false); +QString get_pressure_unit(); +QString getSubsurfaceDataPath(QString folderToFind); +QString getPrintingTemplatePathUser(); +QString getPrintingTemplatePathBundle(); +QString get_dc_nickname(const char *model, uint32_t deviceid); +int gettimezoneoffset(timestamp_t when = 0); +int parseDurationToSeconds(const QString &text); +int parseLengthToMm(const QString &text); +int parseTemperatureToMkelvin(const QString &text); +int parseWeightToGrams(const QString &text); +int parsePressureToMbar(const QString &text); +int parseGasMixO2(const QString &text); +int parseGasMixHE(const QString &text); +QString render_seconds_to_string(int seconds); +QString get_dive_duration_string(timestamp_t when, QString hoursText, QString minutesText, QString secondsText = QObject::tr("sec"), QString separator = ":", bool isFreeDive = false); +QString get_dive_surfint_string(timestamp_t when, QString daysText, QString hoursText, QString minutesText, QString separator = " ", int maxdays = 4); +QString get_dive_date_string(timestamp_t when); +QString get_short_dive_date_string(timestamp_t when); +bool is_same_day (timestamp_t trip_when, timestamp_t dive_when); +QString get_trip_date_string(timestamp_t when, int nr, bool getday); +QString uiLanguage(QLocale *callerLoc); +QLocale getLocale(); +void selectedDivesGasUsed(QVector<QPair<QString, int> > &gasUsed); +QString getUserAgent(); + +#if defined __APPLE__ +#define TITLE_OR_TEXT(_t, _m) "", _t + "\n" + _m +#else +#define TITLE_OR_TEXT(_t, _m) _t, _m +#endif + #endif // 3) Functions visible to C and C++ diff --git a/core/statistics.h b/core/statistics.h index adc363e56..597edfb94 100644 --- a/core/statistics.h +++ b/core/statistics.h @@ -9,6 +9,9 @@ #ifndef STATISTICS_H #define STATISTICS_H +#include "core/units.h" +#include "core/dive.h" // For MAX_CYLINDERS + #ifdef __cplusplus extern "C" { #endif diff --git a/core/subsurface-qt/CylinderObjectHelper.cpp b/core/subsurface-qt/CylinderObjectHelper.cpp index ccff48d36..f2216af6f 100644 --- a/core/subsurface-qt/CylinderObjectHelper.cpp +++ b/core/subsurface-qt/CylinderObjectHelper.cpp @@ -1,6 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 #include "CylinderObjectHelper.h" -#include "../helpers.h" +#include "../qthelper.h" static QString EMPTY_CYLINDER_STRING = QStringLiteral(""); CylinderObjectHelper::CylinderObjectHelper(cylinder_t *cylinder) : diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp index a1cfa4540..46f274522 100644 --- a/core/subsurface-qt/DiveObjectHelper.cpp +++ b/core/subsurface-qt/DiveObjectHelper.cpp @@ -5,7 +5,6 @@ #include <QTextDocument> #include "core/qthelper.h" -#include "core/helpers.h" #include "core/subsurface-string.h" #include "qt-models/tankinfomodel.h" diff --git a/core/subsurface-qt/SettingsObjectWrapper.cpp b/core/subsurface-qt/SettingsObjectWrapper.cpp index 60473ec1a..ec80f62b8 100644 --- a/core/subsurface-qt/SettingsObjectWrapper.cpp +++ b/core/subsurface-qt/SettingsObjectWrapper.cpp @@ -6,7 +6,7 @@ #include <QDate> #include <QNetworkProxy> -#include "core/helpers.h" +#include "core/qthelper.h" DiveComputerSettings::DiveComputerSettings(QObject *parent): QObject(parent) |