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 <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2021-11-21 17:20:25 -08:00
parent d15ecef706
commit cfd6a1634f
7 changed files with 8 additions and 32 deletions

View file

@ -26,12 +26,6 @@ enum filter_constraint_units {
FILTER_CONSTRAINT_PERCENTAGE_UNIT 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 { static struct type_description {
filter_constraint_type type; filter_constraint_type type;
const char *token; // untranslated token, which will be written to the log and should not contain spaces const char *token; // untranslated token, which will be written to the log and should not contain spaces

View file

@ -13,12 +13,6 @@
#define UINT64_MAX (~0ULL) #define UINT64_MAX (~0ULL)
#endif #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 // 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 // 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<uint16_t>(...)]. // integer is passed via a template argument [e.g. getBE<uint16_t>(...)].

View file

@ -1300,12 +1300,6 @@ QString get_taglist_string(struct tag_entry *tag_list)
return ret; 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 stringToList(const QString &s)
{ {
QStringList res = s.split(",", SKIP_EMPTY); QStringList res = s.split(",", SKIP_EMPTY);

View file

@ -23,6 +23,12 @@ enum watertypes {FRESHWATER, BRACKISHWATER, EN13319WATER, SALTWATER, DC_WATERTYP
#include "core/gettextfromc.h" #include "core/gettextfromc.h"
class QImage; 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 weight_string(int weight_in_grams);
QString distance_string(int distanceInMeters); QString distance_string(int distanceInMeters);
bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out = 0); bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out = 0);

View file

@ -537,12 +537,6 @@ QString TextHyperlinkEventFilter::tryToFormulateUrl(QTextCursor *cursor)
return stringMeetsOurUrlRequirements(maybeUrlStr) ? maybeUrlStr : QString(); 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) QString TextHyperlinkEventFilter::fromCursorTilWhitespace(QTextCursor *cursor, bool searchBackwards)
{ {
// fromCursorTilWhitespace calls cursor->movePosition repeatedly, while // fromCursorTilWhitespace calls cursor->movePosition repeatedly, while

View file

@ -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 // normalize the tag list we have and the one we get from the UI
// try hard to deal with accidental white space issues // try hard to deal with accidental white space issues
QStringList existingTagList = get_taglist_string(d->tag_list).split(",", QString::SkipEmptyParts); QStringList existingTagList = get_taglist_string(d->tag_list).split(",", SKIP_EMPTY);
QStringList newTagList = tags.split(",", QString::SkipEmptyParts); QStringList newTagList = tags.split(",", SKIP_EMPTY);
QStringList newCleanTagList; QStringList newCleanTagList;
for (QString s: newTagList) { for (QString s: newTagList) {
if (!s.simplified().isEmpty()) if (!s.simplified().isEmpty())

View file

@ -14,12 +14,6 @@
#include <limits> #include <limits>
#include <QLocale> #include <QLocale>
#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<double>::quiet_NaN(); static const constexpr double NaN = std::numeric_limits<double>::quiet_NaN();
// Typedefs for year / quarter or month binners // Typedefs for year / quarter or month binners