Cleanup: fold core/helpers.h into core/qthelper.h

helpers.h included qthelper.h and all functions declared in helpers.h
were defined in qthelper.h. Therefore fold the former into the latter,
since the split seems completely arbitrary.

While doing so, change the return-type of get_dc_nichname from
"const QString" to "QString".

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-06-03 22:15:19 +02:00 committed by Dirk Hohndel
parent 9f349a4efc
commit 36b9e5e31e
53 changed files with 85 additions and 106 deletions

View file

@ -6,7 +6,7 @@
#include <QEventLoop>
#include "pref.h"
#include "helpers.h"
#include "qthelper.h"
#include "git-access.h"
#include "checkcloudconnection.h"

View file

@ -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>

View file

@ -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"

View file

@ -7,7 +7,7 @@
#include "divesite.h"
#include "subsurface-string.h"
#include "helpers.h"
#include "qthelper.h"
#include "membuffer.h"
#include <QDebug>
#include <QJsonDocument>

View file

@ -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>

View file

@ -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

View file

@ -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;

View file

@ -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);

View file

@ -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++

View file

@ -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

View file

@ -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) :

View file

@ -5,7 +5,6 @@
#include <QTextDocument>
#include "core/qthelper.h"
#include "core/helpers.h"
#include "core/subsurface-string.h"
#include "qt-models/tankinfomodel.h"

View file

@ -6,7 +6,7 @@
#include <QDate>
#include <QNetworkProxy>
#include "core/helpers.h"
#include "core/qthelper.h"
DiveComputerSettings::DiveComputerSettings(QObject *parent):
QObject(parent)

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "desktop-widgets/configuredivecomputerdialog.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "desktop-widgets/mainwindow.h"
#include "core/display.h"
#include "core/subsurface-qt/SettingsObjectWrapper.h"

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "desktop-widgets/divecomputermanagementdialog.h"
#include "desktop-widgets/mainwindow.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "qt-models/divecomputermodel.h"
#include <QMessageBox>
#include <QShortcut>

View file

@ -24,7 +24,6 @@
#include "desktop-widgets/divelistview.h"
#include "qt-models/divepicturemodel.h"
#include "core/metrics.h"
#include "core/helpers.h"
DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false), sortColumn(0),
currentOrder(Qt::DescendingOrder), dontEmitDiveChangedSignal(false), selectionSaved(false)

View file

@ -5,7 +5,6 @@
#include <QDialog>
#include <QTextStream>
#include <QFuture>
#include "core/helpers.h"
#include "core/statistics.h"
class QAbstractButton;

View file

@ -3,7 +3,7 @@
#include "desktop-widgets/modeldelegates.h"
#include "desktop-widgets/mainwindow.h"
#include "core/planner.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include "qt-models/cylindermodel.h"

View file

@ -4,7 +4,7 @@
#include "desktop-widgets/mainwindow.h"
#include "core/save-html.h"
#include "desktop-widgets/subsurfacewebservices.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/cloudstorage.h"
#include <QDesktopServices>

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "desktop-widgets/downloadfromdivecomputer.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "desktop-widgets/mainwindow.h"
#include "desktop-widgets/divelistview.h"
#include "core/display.h"

View file

@ -26,7 +26,7 @@
#include "profile-widget/profilewidget2.h"
#include "core/pref.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include "ui_socialnetworksdialog.h"

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "preferences_language.h"
#include "ui_preferences_language.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include <QApplication>

View file

@ -2,7 +2,7 @@
#include "printer.h"
#include "templatelayout.h"
#include "core/statistics.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include <algorithm>
#include <QPainter>

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "printoptions.h"
#include "templateedit.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include <QDebug>
#include <QFileDialog>

View file

@ -13,13 +13,12 @@
#include "core/file.h"
#include "desktop-widgets/mainwindow.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "libdivecomputer/parser.h"
#include "desktop-widgets/divelistview.h"
#include "core/display.h"
#include "profile-widget/profilewidget2.h"
#include "desktop-widgets/undocommands.h"
#include "core/qthelper.h"
#include "core/metadata.h"
class MinMaxAvgWidgetPrivate {

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "desktop-widgets/subsurfacewebservices.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/webservice.h"
#include "desktop-widgets/mainwindow.h"
#include "desktop-widgets/usersurvey.h"

View file

@ -3,7 +3,7 @@
#include "ui_TabDiveInformation.h"
#include "../tagwidget.h"
#include <core/helpers.h>
#include <core/qthelper.h>
#include <core/statistics.h>
#include <core/display.h>

View file

@ -2,7 +2,7 @@
#include "TabDiveStatistics.h"
#include "ui_TabDiveStatistics.h"
#include <core/helpers.h>
#include <core/qthelper.h>
#include <core/display.h>
#include <core/statistics.h>

View file

@ -8,7 +8,7 @@
#include "desktop-widgets/tab-widgets/maintab.h"
#include "desktop-widgets/mainwindow.h"
#include "desktop-widgets/mapwidget.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/statistics.h"
#include "desktop-widgets/modeldelegates.h"
#include "qt-models/diveplannermodel.h"

View file

@ -3,7 +3,6 @@
#include <string>
#include "templatelayout.h"
#include "core/helpers.h"
#include "core/display.h"
QList<QString> grantlee_templates, grantlee_statistics_templates;

View file

@ -8,7 +8,6 @@
#include "printoptions.h"
#include "core/statistics.h"
#include "core/qthelper.h"
#include "core/helpers.h"
#include "core/subsurface-qt/DiveObjectHelper.h"
int getTotalWork(print_options *printOptions);

View file

@ -1,6 +1,5 @@
// SPDX-License-Identifier: GPL-2.0
#include "desktop-widgets/updatemanager.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include <QtNetwork>
#include <QMessageBox>

View file

@ -5,7 +5,7 @@
#include "desktop-widgets/usermanual.h"
#include "desktop-widgets/mainwindow.h"
#include "core/helpers.h"
#include "core/qthelper.h"
SearchBar::SearchBar(QWidget *parent): QWidget(parent)
{

View file

@ -9,7 +9,7 @@
#include "desktop-widgets/subsurfacewebservices.h"
#include "desktop-widgets/updatemanager.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/subsurfacesysinfo.h"
UserSurvey::UserSurvey(QWidget *parent) : QDialog(parent),

View file

@ -6,7 +6,7 @@
#include "qmlmapwidgethelper.h"
#include "core/divesite.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "qt-models/maplocationmodel.h"
#define MIN_DISTANCE_BETWEEN_DIVE_SITES_M 50.0

View file

@ -8,6 +8,7 @@
#include <QScreen>
#include <QElapsedTimer>
#include <QColor>
#include <QFile>
#include "core/btdiscovery.h"
#include "core/gpslocation.h"

View file

@ -133,7 +133,6 @@ HEADERS += \
../../core/dive.h \
../../core/git-access.h \
../../core/gpslocation.h \
../../core/helpers.h \
../../core/imagedownloader.h \
../../core/pref.h \
../../core/profile.h \

View file

@ -1,7 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "profile-widget/divecartesianaxis.h"
#include "profile-widget/divetextitem.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/subsurface-string.h"
#include "core/subsurface-qt/SettingsObjectWrapper.h"
#ifndef SUBSURFACE_MOBILE

View file

@ -9,7 +9,7 @@
#include "desktop-widgets/preferences/preferencesdialog.h"
#endif
#include "qt-models/diveplannermodel.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/subsurface-qt/SettingsObjectWrapper.h"
#include "libdivecomputer/parser.h"
#include "profile-widget/profilewidget2.h"

View file

@ -2,7 +2,7 @@
#include "profile-widget/profilewidget2.h"
#include "qt-models/diveplotdatamodel.h"
#include "core/subsurface-string.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/profile.h"
#include "profile-widget/diveeventitem.h"
#include "profile-widget/divetextitem.h"

View file

@ -2,7 +2,7 @@
#include "cylindermodel.h"
#include "tankinfomodel.h"
#include "models.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/color.h"
#include "qt-models/diveplannermodel.h"
#include "core/gettextfromc.h"

View file

@ -1,5 +1,5 @@
#include "diveimportedmodel.h"
#include "core/helpers.h"
#include "core/qthelper.h"
DiveImportedModel::DiveImportedModel(QObject *o) : QAbstractTableModel(o),
firstIndex(0),

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "qt-models/divelistmodel.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include <QDateTime>
DiveListSortModel::DiveListSortModel(QObject *parent) : QSortFilterProxyModel(parent)

View file

@ -5,7 +5,6 @@
#include <QAbstractListModel>
#include <QSortFilterProxyModel>
#include "core/helpers.h"
#include "core/subsurface-qt/DiveObjectHelper.h"
class DiveListSortModel : public QSortFilterProxyModel

View file

@ -1,7 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "diveplannermodel.h"
#include "core/subsurface-string.h"
#include "core/helpers.h"
#include "qt-models/cylindermodel.h"
#include "core/planner.h"
#include "qt-models/models.h"

View file

@ -3,7 +3,7 @@
#include "core/gettextfromc.h"
#include "core/metrics.h"
#include "core/divelist.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/subsurface-string.h"
#include <QIcon>
#include <QDebug>

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "qt-models/gpslistmodel.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include <QVector>
GpsListModel *GpsListModel::m_instance = NULL;

View file

@ -6,7 +6,7 @@
*
*/
#include "qt-models/models.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include <QLocale>

View file

@ -3,7 +3,7 @@
#include "core/subsurface-string.h"
#include "core/gettextfromc.h"
#include "core/metrics.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "qt-models/weightsysteminfomodel.h"
WeightModel::WeightModel(QObject *parent) : CleanerTableModel(parent),

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "qt-models/yearlystatisticsmodel.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/metrics.h"
#include "core/statistics.h"

View file

@ -3,7 +3,7 @@
/* Qt UI implementation */
#include "core/display.h"
#include "desktop-widgets/mainwindow.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include "core/pluginmanager.h"
#include <QApplication>

View file

@ -2,7 +2,7 @@
/* qt-gui.cpp */
/* Qt UI implementation */
#include "core/display.h"
#include "core/helpers.h"
#include "core/qthelper.h"
#include <QApplication>
#include <QDesktopWidget>

View file

@ -10,7 +10,6 @@
#include "core/subsurfacestartup.h"
#include "core/color.h"
#include "core/qthelper.h"
#include "core/helpers.h"
#include "core/downloadfromdcthread.h"
#include <QStringList>