Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
KItinerary
Commits
3239e675
Commit
3239e675
authored
Jan 15, 2022
by
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
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
src/lib/datatypes/ticket.cpp
View file @
3239e675
...
...
@@ -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
();
}
...
...
src/lib/engine/extractorfilter.cpp
View file @
3239e675
...
...
@@ -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
())
{
...
...
src/lib/extractorpostprocessor.cpp
View file @
3239e675
...
...
@@ -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
));
...
...
src/lib/jsapi/jsonld.cpp
View file @
3239e675
...
...
@@ -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
;
}
}
...
...
src/lib/knowledgedb/airportnametokenizer.cpp
View file @
3239e675
...
...
@@ -6,8 +6,6 @@
#include
"airportnametokenizer_p.h"
#include
<QStringList>
using
namespace
KItinerary
;
AirportNameTokenizer
::
AirportNameTokenizer
(
QStringView
text
)
...
...
src/lib/knowledgedb/airportnametokenizer_p.h
View file @
3239e675
...
...
@@ -7,9 +7,8 @@
#ifndef KITINERARY_AIRPORTNAMETOKENIZER_H
#define KITINERARY_AIRPORTNAMETOKENIZER_H
#include
<QStringView>
#include
<QStringList>
#include
<QStringView>
namespace
KItinerary
{
...
...
src/lib/uic9183/rct2ticket.cpp
View file @
3239e675
...
...
@@ -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
;
...
...
src/lib/uic9183/uic9183ticketlayout.cpp
View file @
3239e675
...
...
@@ -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
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment