Commit 3239e675 authored by Volker Krause's avatar Volker Krause
Browse files

Use Qt6 code paths unconditionally

Those work for Qt5 as well.
parent 347b9720
Pipeline #123870 passed with stage
in 2 minutes and 44 seconds
......@@ -68,11 +68,7 @@ QVariant Ticket::ticketTokenData() const
} else if (d->ticketToken.startsWith(QLatin1String("azteccode:"), Qt::CaseInsensitive)) {
return ticketToken().mid(10);
} else if (d->ticketToken.startsWith(QLatin1String("aztecbin:"), Qt::CaseInsensitive)) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QByteArray::fromBase64(d->ticketToken.midRef(9).toLatin1());
#else
return QByteArray::fromBase64(QStringView(d->ticketToken).mid(9).toLatin1());
#endif
} else if (d->ticketToken.startsWith(QLatin1String("barcode128:"), Qt::CaseInsensitive)) {
return ticketToken().mid(11);
} else if (d->ticketToken.startsWith(QLatin1String("datamatrix:"), Qt::CaseInsensitive)) {
......@@ -80,11 +76,7 @@ QVariant Ticket::ticketTokenData() const
} else if (d->ticketToken.startsWith(QLatin1String("pdf417:"), Qt::CaseInsensitive)) {
return ticketToken().mid(7);
} else if (d->ticketToken.startsWith(QLatin1String("pdf417bin:"), Qt::CaseInsensitive)) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
return QByteArray::fromBase64(d->ticketToken.midRef(10).toLatin1());
#else
return QByteArray::fromBase64(QStringView(d->ticketToken).mid(10).toLatin1());
#endif
}
return ticketToken();
}
......
......@@ -136,11 +136,7 @@ void ExtractorFilter::setScope(Scope scope)
static QString valueForJsonPath(const QJsonObject &obj, const QString &path)
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto pathSections = path.splitRef(QLatin1Char('.'));
#else
const auto pathSections = QStringView(path).split(QLatin1Char('.'));
#endif
QJsonValue v(obj);
for (const auto &pathSection : pathSections) {
if (!v.isObject()) {
......
......@@ -240,20 +240,12 @@ TrainStation ExtractorPostprocessorPrivate::processTrainStation(TrainStation sta
} else if (id.startsWith(QLatin1String("ibnr:")) && id.size() == 12) {
const auto record = KnowledgeDb::stationForIbnr(KnowledgeDb::IBNR{id.mid(5).toUInt()});
applyStationData(record, station);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto country = KnowledgeDb::countryIdForUicCode(id.midRef(5, 2).toUShort()).toString();
#else
const auto country = KnowledgeDb::countryIdForUicCode(QStringView(id).mid(5, 2).toUShort()).toString();
#endif
applyStationCountry(country, station);
} else if (id.startsWith(QLatin1String("uic:")) && id.size() == 11) {
const auto record = KnowledgeDb::stationForUic(KnowledgeDb::UICStation{id.mid(4).toUInt()});
applyStationData(record, station);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto country = KnowledgeDb::countryIdForUicCode(id.midRef(4, 2).toUShort()).toString();
#else
const auto country = KnowledgeDb::countryIdForUicCode(QStringView(id).mid(4, 2).toUShort()).toString();
#endif
applyStationCountry(country, station);
} else if (id.startsWith(QLatin1String("ir:")) && id.size() > 4) {
const auto record = KnowledgeDb::stationForIndianRailwaysStationCode(id.mid(3));
......
......@@ -351,13 +351,8 @@ QJSValue JsApi::JsonLd::toGeoCoordinates(const QString &mapUrl)
if (match.hasMatch()) {
auto geo = m_engine->newObject();
geo.setProperty(QStringLiteral("@type"), QStringLiteral("GeoCoordinates"));
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
geo.setProperty(QStringLiteral("latitude"), match.capturedRef(1).toDouble());
geo.setProperty(QStringLiteral("longitude"), match.capturedRef(2).toDouble());
#else
geo.setProperty(QStringLiteral("latitude"), match.capturedView(1).toDouble());
geo.setProperty(QStringLiteral("longitude"), match.capturedView(2).toDouble());
#endif
return geo;
}
}
......
......@@ -6,8 +6,6 @@
#include "airportnametokenizer_p.h"
#include <QStringList>
using namespace KItinerary;
AirportNameTokenizer::AirportNameTokenizer(QStringView text)
......
......@@ -7,9 +7,8 @@
#ifndef KITINERARY_AIRPORTNAMETOKENIZER_H
#define KITINERARY_AIRPORTNAMETOKENIZER_H
#include <QStringView>
#include <QStringList>
#include <QStringView>
namespace KItinerary {
......
......@@ -38,11 +38,7 @@ QDate Rct2TicketPrivate::firstDayOfValidity() const
if (it == f.end()) {
return {};
}
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto dtStr = f.midRef(std::distance(f.begin(), it));
#else
const auto dtStr = QStringView(f).mid(std::distance(f.begin(), it));
#endif
auto dt = QDate::fromString(dtStr.left(10).toString(), QStringLiteral("dd.MM.yyyy"));
if (dt.isValid()) {
return dt;
......
......@@ -161,11 +161,7 @@ QString Uic9183TicketLayout::text(int row, int column, int width, int height) co
// split field into lines
// TODO this needs to follow the U_TLAY word-wrapping algorithm?
const auto content = f.text();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto lines = content.splitRef(QLatin1Char('\n'));
#else
const auto lines = QStringView(content).split(QLatin1Char('\n'));
#endif
// cut out the right part of the line
for (int i = 0; i < lines.size(); ++i) {
if (f.row() + i < row) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment