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
Itinerary
Commits
41c5c74b
Commit
41c5c74b
authored
Jul 20, 2022
by
Volker Krause
Browse files
Add basic infrastructure for supporting boat/ferry reservations
Still missing any UI elements.
parent
302bdf8e
Pipeline
#207146
passed with stage
in 5 minutes and 45 seconds
Changes
11
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
autotests/data/timeline/weather-forecast-with-tz-change.model
View file @
41c5c74b
...
...
@@ -323,7 +323,7 @@
}
],
"sectionHeader": "1996-10-16",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
@@ -358,7 +358,7 @@
}
],
"sectionHeader": "1996-10-17",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
autotests/data/tripgroupproxy/current-r0.model
View file @
41c5c74b
...
...
@@ -295,7 +295,7 @@
}
],
"sectionHeader": "2017-09-10",
"type": 1
2
"type": 1
3
},
{
"isToday": false,
...
...
@@ -337,7 +337,7 @@
}
],
"sectionHeader": "2017-09-10",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
@@ -423,7 +423,7 @@
}
],
"sectionHeader": "2017-09-13",
"type": 1
1
"type": 1
2
},
{
"isToday": false,
...
...
@@ -465,7 +465,7 @@
}
],
"sectionHeader": "2017-09-14",
"type": 1
0
"type": 1
1
},
{
"isToday": false,
...
...
@@ -507,7 +507,7 @@
}
],
"sectionHeader": "2017-09-15",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
autotests/data/tripgroupproxy/current-r1.model
View file @
41c5c74b
...
...
@@ -288,7 +288,7 @@
}
],
"sectionHeader": "2017-09-10",
"type": 1
2
"type": 1
3
},
{
"isToday": false,
...
...
@@ -330,7 +330,7 @@
}
],
"sectionHeader": "2017-09-10",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
@@ -416,7 +416,7 @@
}
],
"sectionHeader": "2017-09-13",
"type": 1
1
"type": 1
2
},
{
"isToday": true,
...
...
@@ -465,7 +465,7 @@
}
],
"sectionHeader": "2017-09-14",
"type": 1
0
"type": 1
1
},
{
"isToday": false,
...
...
@@ -507,7 +507,7 @@
}
],
"sectionHeader": "2017-09-15",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
autotests/data/tripgroupproxy/expand-collapse-r0.model
View file @
41c5c74b
...
...
@@ -969,7 +969,7 @@
}
],
"sectionHeader": "2017-09-10",
"type": 1
2
"type": 1
3
},
{
"isToday": false,
...
...
@@ -1011,7 +1011,7 @@
}
],
"sectionHeader": "2017-09-10",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
@@ -1097,7 +1097,7 @@
}
],
"sectionHeader": "2017-09-13",
"type": 1
1
"type": 1
2
},
{
"isToday": false,
...
...
@@ -1139,7 +1139,7 @@
}
],
"sectionHeader": "2017-09-14",
"type": 1
0
"type": 1
1
},
{
"isToday": false,
...
...
@@ -1181,7 +1181,7 @@
}
],
"sectionHeader": "2017-09-15",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
autotests/data/tripgroupproxy/expand-collapse-r1.model
View file @
41c5c74b
...
...
@@ -676,7 +676,7 @@
}
],
"sectionHeader": "2017-09-10",
"type": 1
2
"type": 1
3
},
{
"isToday": false,
...
...
@@ -718,7 +718,7 @@
}
],
"sectionHeader": "2017-09-10",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
@@ -804,7 +804,7 @@
}
],
"sectionHeader": "2017-09-13",
"type": 1
1
"type": 1
2
},
{
"isToday": false,
...
...
@@ -846,7 +846,7 @@
}
],
"sectionHeader": "2017-09-14",
"type": 1
0
"type": 1
1
},
{
"isToday": false,
...
...
@@ -888,7 +888,7 @@
}
],
"sectionHeader": "2017-09-15",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
autotests/data/tripgroupproxy/expand-collapse-r2.model
View file @
41c5c74b
...
...
@@ -337,7 +337,7 @@
}
],
"sectionHeader": "2017-09-10",
"type": 1
2
"type": 1
3
},
{
"isToday": false,
...
...
@@ -379,7 +379,7 @@
}
],
"sectionHeader": "2017-09-10",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
@@ -465,7 +465,7 @@
}
],
"sectionHeader": "2017-09-13",
"type": 1
1
"type": 1
2
},
{
"isToday": false,
...
...
@@ -507,7 +507,7 @@
}
],
"sectionHeader": "2017-09-14",
"type": 1
0
"type": 1
1
},
{
"isToday": false,
...
...
@@ -549,7 +549,7 @@
}
],
"sectionHeader": "2017-09-15",
"type": 1
3
"type": 1
4
},
{
"isToday": false,
...
...
src/app/publictransport.cpp
View file @
41c5c74b
...
...
@@ -62,7 +62,8 @@ KPublicTransport::Location PublicTransport::locationFromPlace(const QVariant& pl
KPublicTransport
::
Location
loc
;
if
(
JsonLd
::
isA
<
FlightReservation
>
(
reservation
)
||
JsonLd
::
isA
<
TrainReservation
>
(
reservation
)
||
JsonLd
::
isA
<
BusReservation
>
(
reservation
))
{
if
(
JsonLd
::
isA
<
FlightReservation
>
(
reservation
)
||
JsonLd
::
isA
<
TrainReservation
>
(
reservation
)
||
JsonLd
::
isA
<
BusReservation
>
(
reservation
)
||
JsonLd
::
isA
<
BoatReservation
>
(
reservation
))
{
loc
.
setName
(
KItinerary
::
LocationUtil
::
name
(
place
));
}
...
...
src/app/reservationhelper.cpp
View file @
41c5c74b
...
...
@@ -58,6 +58,9 @@ bool ReservationHelper::equals(const QVariant &lhs, const QVariant &rhs)
if
(
JsonLd
::
isA
<
BusReservation
>
(
lhs
))
{
return
lhs
.
value
<
BusReservation
>
()
==
rhs
.
value
<
BusReservation
>
();
}
if
(
JsonLd
::
isA
<
BoatReservation
>
(
lhs
))
{
return
lhs
.
value
<
BoatReservation
>
()
==
rhs
.
value
<
BoatReservation
>
();
}
if
(
JsonLd
::
isA
<
FlightReservation
>
(
lhs
))
{
return
lhs
.
value
<
FlightReservation
>
()
==
rhs
.
value
<
FlightReservation
>
();
}
...
...
src/app/timelineelement.cpp
View file @
41c5c74b
...
...
@@ -29,6 +29,7 @@ static TimelineElement::ElementType elementType(const QVariant &res)
if
(
JsonLd
::
isA
<
LodgingReservation
>
(
res
))
{
return
TimelineElement
::
Hotel
;
}
if
(
JsonLd
::
isA
<
TrainReservation
>
(
res
))
{
return
TimelineElement
::
TrainTrip
;
}
if
(
JsonLd
::
isA
<
BusReservation
>
(
res
))
{
return
TimelineElement
::
BusTrip
;
}
if
(
JsonLd
::
isA
<
BoatReservation
>
(
res
))
{
return
TimelineElement
::
BoatTrip
;
}
if
(
JsonLd
::
isA
<
FoodEstablishmentReservation
>
(
res
))
{
return
TimelineElement
::
Restaurant
;
}
if
(
JsonLd
::
isA
<
TouristAttractionVisit
>
(
res
))
{
return
TimelineElement
::
TouristAttraction
;
}
if
(
JsonLd
::
isA
<
EventReservation
>
(
res
))
{
return
TimelineElement
::
Event
;
}
...
...
@@ -114,14 +115,23 @@ bool TimelineElement::isReservation() const
case
TrainTrip
:
case
CarRental
:
case
BusTrip
:
case
BoatTrip
:
case
Restaurant
:
case
TouristAttraction
:
case
Event
:
case
Hotel
:
return
true
;
default:
case
Undefined
:
case
TodayMarker
:
case
TripGroup
:
case
WeatherForecast
:
case
LocationInfo
:
case
Transfer
:
return
false
;
}
Q_UNREACHABLE
();
return
false
;
}
QString
TimelineElement
::
batchId
()
const
...
...
@@ -186,6 +196,7 @@ bool TimelineElement::isTimeBoxed() const
case
Flight
:
case
TrainTrip
:
case
BusTrip
:
case
BoatTrip
:
return
true
;
case
Hotel
:
case
CarRental
:
...
...
src/app/timelineelement.h
View file @
41c5c74b
...
...
@@ -35,6 +35,7 @@ public:
TrainTrip
,
CarRental
,
BusTrip
,
BoatTrip
,
Restaurant
,
TouristAttraction
,
Event
,
...
...
src/app/transfermanager.cpp
View file @
41c5c74b
...
...
@@ -14,6 +14,7 @@
#include
"tripgroup.h"
#include
"tripgroupmanager.h"
#include
<KItinerary/BoatTrip>
#include
<KItinerary/BusTrip>
#include
<KItinerary/Event>
#include
<KItinerary/Flight>
...
...
@@ -465,11 +466,12 @@ bool TransferManager::isNotInTripGroup(const QString &resId) const
}
// default transfer anchor deltas (in minutes)
enum
{
FlightDelta
,
TrainDelta
,
BusDelta
,
FallbackDelta
};
enum
{
FlightDelta
,
TrainDelta
,
BusDelta
,
BoatDelta
,
FallbackDelta
};
static
constexpr
const
int
default_deltas
[][
2
]
=
{
{
90
,
30
},
// Flight
{
20
,
10
},
// Train
{
15
,
10
},
// Bus
{
60
,
30
},
// Boat/Ferry
{
30
,
15
},
// anything else
};
...
...
@@ -486,6 +488,8 @@ void TransferManager::determineAnchorDeltaDefault(Transfer &transfer, const QVar
delta
=
default_deltas
[
TrainDelta
][
transfer
.
alignment
()];
}
else
if
(
JsonLd
::
isA
<
BusReservation
>
(
res
))
{
delta
=
default_deltas
[
BusDelta
][
transfer
.
alignment
()];
}
else
if
(
JsonLd
::
isA
<
BoatReservation
>
(
res
))
{
delta
=
default_deltas
[
BoatDelta
][
transfer
.
alignment
()];
}
else
{
delta
=
default_deltas
[
FallbackDelta
][
transfer
.
alignment
()];
}
...
...
@@ -499,18 +503,17 @@ QDateTime TransferManager::anchorTimeBefore(const QString &resId, const QVariant
if
(
departure
.
hasExpectedDepartureTime
())
{
return
departure
.
expectedDepartureTime
();
}
return
res
.
value
<
TrainReservation
>
().
reservationFor
().
value
<
TrainTrip
>
().
departureTime
();
}
if
(
JsonLd
::
isA
<
BusReservation
>
(
res
))
{
return
res
.
value
<
BusReservation
>
().
reservationFor
().
value
<
BusTrip
>
().
departureTime
();
}
if
(
JsonLd
::
isA
<
FlightReservation
>
(
res
))
{
if
(
JsonLd
::
isA
<
FlightReservation
>
(
res
))
{
const
auto
flight
=
res
.
value
<
FlightReservation
>
().
reservationFor
().
value
<
Flight
>
();
if
(
flight
.
boardingTime
().
isValid
())
{
return
flight
.
boardingTime
();
}
return
flight
.
departureTime
();
}
if
(
LocationUtil
::
isLocationChange
(
res
))
{
return
SortUtil
::
startDateTime
(
res
);
}
if
(
JsonLd
::
isA
<
EventReservation
>
(
res
))
{
const
auto
event
=
res
.
value
<
EventReservation
>
().
reservationFor
().
value
<
Event
>
();
if
(
event
.
doorTime
().
isValid
())
{
...
...
@@ -521,6 +524,7 @@ QDateTime TransferManager::anchorTimeBefore(const QString &resId, const QVariant
if
(
JsonLd
::
isA
<
FoodEstablishmentReservation
>
(
res
))
{
return
res
.
value
<
FoodEstablishmentReservation
>
().
startTime
();
}
return
{};
}
...
...
@@ -531,20 +535,18 @@ QDateTime TransferManager::anchorTimeAfter(const QString &resId, const QVariant
if
(
arrival
.
hasExpectedArrivalTime
())
{
return
arrival
.
expectedArrivalTime
();
}
return
res
.
value
<
TrainReservation
>
().
reservationFor
().
value
<
TrainTrip
>
().
arrivalTime
();
}
if
(
JsonLd
::
isA
<
BusReservation
>
(
res
))
{
return
res
.
value
<
BusReservation
>
().
reservationFor
().
value
<
BusTrip
>
().
arrivalTime
();
}
if
(
JsonLd
::
isA
<
FlightReservation
>
(
res
))
{
return
res
.
value
<
FlightReservation
>
().
reservationFor
().
value
<
Flight
>
().
arrivalTime
();
if
(
LocationUtil
::
isLocationChange
(
res
))
{
return
SortUtil
::
endDateTime
(
res
);
}
if
(
JsonLd
::
isA
<
EventReservation
>
(
res
))
{
return
res
.
value
<
EventReservation
>
().
reservationFor
().
value
<
Event
>
().
endDate
();
}
if
(
JsonLd
::
isA
<
FoodEstablishmentReservation
>
(
res
))
{
return
res
.
value
<
FoodEstablishmentReservation
>
().
endTime
();
}
return
{};
}
...
...
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