Commit b9c6df76 authored by Volker Krause's avatar Volker Krause
Browse files

Add Journey::expected[Departure|Arrival]Time() methods

Brings the Journey API in line with that of JourneySection.
parent a45b5599
Pipeline #93359 passed with stage
in 1 minute and 23 seconds
......@@ -583,6 +583,11 @@ bool Journey::hasExpectedDepartureTime() const
return d->sections.empty() ? false : d->sections.front().hasExpectedDepartureTime();
}
QDateTime Journey::expectedDepartureTime() const
{
return d->sections.empty() ? QDateTime() : d->sections.front().expectedDepartureTime();
}
int Journey::departureDelay() const
{
return d->sections.empty() ? 0 : d->sections.front().departureDelay();
......@@ -601,6 +606,11 @@ bool Journey::hasExpectedArrivalTime() const
return d->sections.empty() ? false : d->sections.back().hasExpectedArrivalTime();
}
QDateTime Journey::expectedArrivalTime() const
{
return d->sections.empty() ? QDateTime() : d->sections.back().expectedArrivalTime();
}
int Journey::arrivalDelay() const
{
return d->sections.empty() ? 0 : d->sections.back().arrivalDelay();
......
......@@ -240,6 +240,10 @@ class KPUBLICTRANSPORT_EXPORT Journey
Q_PROPERTY(QDateTime scheduledDepartureTime READ scheduledDepartureTime STORED false)
/** @c true if this has real-time data. */
Q_PROPERTY(bool hasExpectedDepartureTime READ hasExpectedDepartureTime STORED false)
/** Actual departure time, if available.
* Set to invalid to indicate real-time data is not available.
*/
Q_PROPERTY(QDateTime expectedDepartureTime READ expectedDepartureTime STORED false)
/** Difference to schedule in minutes. */
Q_PROPERTY(int departureDelay READ departureDelay STORED false)
......@@ -247,6 +251,10 @@ class KPUBLICTRANSPORT_EXPORT Journey
Q_PROPERTY(QDateTime scheduledArrivalTime READ scheduledArrivalTime STORED false)
/** @c true if this has real-time data. */
Q_PROPERTY(bool hasExpectedArrivalTime READ hasExpectedArrivalTime STORED false)
/** Actual arrival time, if available.
* Set to invalid to indicate real-time data is not available.
*/
Q_PROPERTY(QDateTime expectedArrivalTime READ expectedArrivalTime STORED false)
/** Difference to schedule in minutes. */
Q_PROPERTY(int arrivalDelay READ arrivalDelay STORED false)
......@@ -267,10 +275,12 @@ public:
QDateTime scheduledDepartureTime() const;
bool hasExpectedDepartureTime() const;
QDateTime expectedDepartureTime() const;
int departureDelay() const;
QDateTime scheduledArrivalTime() const;
bool hasExpectedArrivalTime() const;
QDateTime expectedArrivalTime() const;
int arrivalDelay() const;
int duration() const;
......
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