Commit 0f768fd5 authored by Volker Krause's avatar Volker Krause
Browse files

Highlight unreachable transfers following an arrival

This is particularly useful in case of arrival delays.

We still need the same for transfers before departures, but there we
first need proper live monitoring for transfer journeys first.
parent dadd8deb
......@@ -21,7 +21,7 @@ Kirigami.AbstractCard {
id: headerBackground
Kirigami.Theme.colorSet: Kirigami.Theme.Complementary
Kirigami.Theme.inherit: false
color: Kirigami.Theme.backgroundColor
color: transfer.isReachable ? Kirigami.Theme.backgroundColor : Kirigami.Theme.negativeBackgroundColor
radius: Kirigami.Units.smallSpacing
implicitHeight: headerLayout.implicitHeight + Kirigami.Units.largeSpacing * 2
anchors.leftMargin: -root.leftPadding
......
......@@ -182,6 +182,21 @@ QDateTime Transfer::journeyTime() const
return std::max(dt, QDateTime::currentDateTime());
}
bool Transfer::isReachable() const
{
if (state() == Transfer::Selected) {
if (alignment() == Transfer::After) {
if (journey().hasExpectedDepartureTime()) {
return journey().expectedDepartureTime() > anchorTime();
}
if (journey().scheduledDepartureTime().isValid()) {
return journey().scheduledDepartureTime() > anchorTime();
}
}
}
return true;
}
QString Transfer::identifier() const
{
return identifier(d->m_resId, d->m_alignment);
......
......@@ -37,6 +37,7 @@ class Transfer
Q_PROPERTY(QDateTime anchorTime READ anchorTime WRITE setAnchorTime)
Q_PROPERTY(int anchorTimeDelta READ anchorTimeDelta WRITE setAnchorTimeDelta)
Q_PROPERTY(QDateTime journeyTime READ journeyTime STORED false)
Q_PROPERTY(bool isReachable READ isReachable STORED false)
public:
Transfer();
Transfer(const Transfer&);
......@@ -102,6 +103,9 @@ public:
/** Anchor time +/- anchor delta, ie. the time we actually want to arrive/depart. */
QDateTime journeyTime() const;
/** Returns @c false when this transfer isn't reachable (e.g. due to anchor time changes or a wrong journey pick). */
bool isReachable() const;
/** Unique identifier usable naming the file to store this into. */
QString identifier() const;
static QString identifier(const QString &resId, Transfer::Alignment alignment);
......
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