From cfd6a1634fa88b9bc8f3b65260a77a744403b23b Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 21 Nov 2021 17:20:25 -0800 Subject: [PATCH] cleanup: fix SkipEmptyParts warning for mobile And while doing that, have all the cases where we already include qthelper.h simply use a define in that header file - but keep the two other instances of the define where the C++ source don't need qthelper.h otherwise. Signed-off-by: Dirk Hohndel --- core/filterconstraint.cpp | 6 ------ core/metadata.cpp | 6 ------ core/qthelper.cpp | 6 ------ core/qthelper.h | 6 ++++++ desktop-widgets/simplewidgets.cpp | 6 ------ mobile-widgets/qmlmanager.cpp | 4 ++-- stats/statsvariables.cpp | 6 ------ 7 files changed, 8 insertions(+), 32 deletions(-) diff --git a/core/filterconstraint.cpp b/core/filterconstraint.cpp index 21428b607..8f7b27246 100644 --- a/core/filterconstraint.cpp +++ b/core/filterconstraint.cpp @@ -26,12 +26,6 @@ enum filter_constraint_units { FILTER_CONSTRAINT_PERCENTAGE_UNIT }; -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) -#define SKIP_EMPTY Qt::SkipEmptyParts -#else -#define SKIP_EMPTY QString::SkipEmptyParts -#endif - static struct type_description { filter_constraint_type type; const char *token; // untranslated token, which will be written to the log and should not contain spaces diff --git a/core/metadata.cpp b/core/metadata.cpp index 9c7a06116..2596276c6 100644 --- a/core/metadata.cpp +++ b/core/metadata.cpp @@ -13,12 +13,6 @@ #define UINT64_MAX (~0ULL) #endif -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) -#define SKIP_EMPTY Qt::SkipEmptyParts -#else -#define SKIP_EMPTY QString::SkipEmptyParts -#endif - // The following functions fetch an arbitrary-length _unsigned_ integer from either // a file or a memory location in big-endian or little-endian mode. The size of the // integer is passed via a template argument [e.g. getBE(...)]. diff --git a/core/qthelper.cpp b/core/qthelper.cpp index 7c7e38ba8..3e699d889 100644 --- a/core/qthelper.cpp +++ b/core/qthelper.cpp @@ -1300,12 +1300,6 @@ QString get_taglist_string(struct tag_entry *tag_list) return ret; } -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) -#define SKIP_EMPTY Qt::SkipEmptyParts -#else -#define SKIP_EMPTY QString::SkipEmptyParts -#endif - QStringList stringToList(const QString &s) { QStringList res = s.split(",", SKIP_EMPTY); diff --git a/core/qthelper.h b/core/qthelper.h index cd28e1705..7ae14ed13 100644 --- a/core/qthelper.h +++ b/core/qthelper.h @@ -23,6 +23,12 @@ enum watertypes {FRESHWATER, BRACKISHWATER, EN13319WATER, SALTWATER, DC_WATERTYP #include "core/gettextfromc.h" class QImage; +#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) +#define SKIP_EMPTY Qt::SkipEmptyParts +#else +#define SKIP_EMPTY QString::SkipEmptyParts +#endif + QString weight_string(int weight_in_grams); QString distance_string(int distanceInMeters); bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out = 0); diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp index 286f91e64..d654ccac0 100644 --- a/desktop-widgets/simplewidgets.cpp +++ b/desktop-widgets/simplewidgets.cpp @@ -537,12 +537,6 @@ QString TextHyperlinkEventFilter::tryToFormulateUrl(QTextCursor *cursor) return stringMeetsOurUrlRequirements(maybeUrlStr) ? maybeUrlStr : QString(); } -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) -#define SKIP_EMPTY Qt::SkipEmptyParts -#else -#define SKIP_EMPTY QString::SkipEmptyParts -#endif - QString TextHyperlinkEventFilter::fromCursorTilWhitespace(QTextCursor *cursor, bool searchBackwards) { // fromCursorTilWhitespace calls cursor->movePosition repeatedly, while diff --git a/mobile-widgets/qmlmanager.cpp b/mobile-widgets/qmlmanager.cpp index c2c937345..f6e9cad08 100644 --- a/mobile-widgets/qmlmanager.cpp +++ b/mobile-widgets/qmlmanager.cpp @@ -1218,8 +1218,8 @@ void QMLManager::commitChanges(QString diveId, QString number, QString date, QSt } // normalize the tag list we have and the one we get from the UI // try hard to deal with accidental white space issues - QStringList existingTagList = get_taglist_string(d->tag_list).split(",", QString::SkipEmptyParts); - QStringList newTagList = tags.split(",", QString::SkipEmptyParts); + QStringList existingTagList = get_taglist_string(d->tag_list).split(",", SKIP_EMPTY); + QStringList newTagList = tags.split(",", SKIP_EMPTY); QStringList newCleanTagList; for (QString s: newTagList) { if (!s.simplified().isEmpty()) diff --git a/stats/statsvariables.cpp b/stats/statsvariables.cpp index 9042f5535..d68022275 100644 --- a/stats/statsvariables.cpp +++ b/stats/statsvariables.cpp @@ -14,12 +14,6 @@ #include #include -#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) -#define SKIP_EMPTY Qt::SkipEmptyParts -#else -#define SKIP_EMPTY QString::SkipEmptyParts -#endif - static const constexpr double NaN = std::numeric_limits::quiet_NaN(); // Typedefs for year / quarter or month binners