...
 
Commits (3)
......@@ -79,19 +79,19 @@ Kirigami.ScrollablePage {
// middle row: mode symbol, transport mode, duration
Rectangle {
color: departure.route.line.hasColor ? departure.route.line.color : "transparent"
implicitHeight: modeIcon.height
color: (departure.route.line.hasColor && !departure.route.line.hasLogo) ? departure.route.line.color : "transparent"
implicitHeight: Kirigami.Units.iconSizes.smallMedium
implicitWidth: modeIcon.width
Layout.alignment: Qt.AlignHCenter
Kirigami.Icon {
id: modeIcon
anchors.centerIn: parent
source: PublicTransport.lineModeIcon(departure.route.line.mode);
source: PublicTransport.lineIcon(departure.route.line);
color: departure.route.line.hasTextColor ? departure.route.line.textColor : Kirigami.Theme.textColor
width: Kirigami.Units.iconSizes.smallMedium
height: width
isMask: true
width: departure.route.line.hasLogo ? implicitWidth : height
height: parent.height
isMask: !departure.route.line.hasLogo
}
}
QQC2.Label {
......
......@@ -65,8 +65,8 @@ Kirigami.AbstractListItem {
// middle row: mode symbol, transport mode, duration
Rectangle {
color: modelData.route.line.hasColor ? modelData.route.line.color : "transparent"
implicitHeight: modeIcon.height
color: (modelData.route.line.hasColor && !modelData.route.line.hasLogo) ? modelData.route.line.color : "transparent"
implicitHeight: Kirigami.Units.iconSizes.smallMedium
implicitWidth: modeIcon.width
Layout.alignment: Qt.AlignHCenter
......@@ -76,7 +76,7 @@ Kirigami.AbstractListItem {
source: {
switch (modelData.mode) {
case JourneySection.PublicTransport:
return PublicTransport.lineModeIcon(modelData.route.line.mode);
return PublicTransport.lineIcon(modelData.route.line);
case JourneySection.Walking: return "qrc:///images/walk.svg";
case JourneySection.Waiting: return "qrc:///images/wait.svg";
case JourneySection.Transfer: return "qrc:///images/transfer.svg";
......@@ -84,9 +84,9 @@ Kirigami.AbstractListItem {
}
}
color: modelData.route.line.hasTextColor ? modelData.route.line.textColor : Kirigami.Theme.textColor
width: Kirigami.Units.iconSizes.smallMedium
height: width
isMask: true
width: (modelData.mode == JourneySection.PublicTransport && modelData.route.line.hasLogo) ? implicitWidth : height
height: parent.height
isMask: modelData.mode != JourneySection.PublicTransport || !modelData.route.line.hasLogo
}
}
QQC2.Label {
......
......@@ -32,7 +32,7 @@ RowLayout {
source: {
switch (modelData.mode) {
case JourneySection.PublicTransport:
return PublicTransport.lineModeIcon(modelData.route.line.mode);
return PublicTransport.lineIcon(modelData.route.line);
case JourneySection.Walking: return "qrc:///images/walk.svg";
case JourneySection.Waiting: return "qrc:///images/wait.svg";
case JourneySection.Transfer: return "qrc:///images/transfer.svg";
......@@ -40,10 +40,10 @@ RowLayout {
}
}
color: PublicTransport.warnAboutSection(modelData) ? Kirigami.Theme.negativeTextColor : Kirigami.Theme.textColor
width: Kirigami.Units.iconSizes.small
height: width
isMask: true
Layout.preferredWidth: Kirigami.Units.iconSizes.small
width: isMask ? height : implicitWidth
height: Kirigami.Units.iconSizes.small
isMask: modelData.mode != JourneySection.PublicTransport || !modelData.route.line.hasLogo
Layout.preferredWidth: width
Layout.preferredHeight: Kirigami.Units.iconSizes.small
}
}
......
......@@ -97,6 +97,17 @@ KPublicTransport::Location PublicTransport::locationFromPlace(const QVariant& pl
return loc;
}
QString PublicTransport::lineIcon(const QVariant &line)
{
using namespace KPublicTransport;
const auto l = line.value<Line>();
const auto logo = l.logo();
if (!logo.isEmpty()) {
return logo;
}
return lineModeIcon(l.mode());
}
QString PublicTransport::lineModeIcon(int lineMode)
{
using namespace KPublicTransport;
......@@ -239,6 +250,7 @@ QVariant PublicTransport::departureRequestForPlace(const QVariant &place, const
KPublicTransport::DepartureRequest req;
req.setDateTime(std::max(dt, QDateTime::currentDateTime()));
req.setStop(PublicTransport::locationFromPlace(place, {}));
req.setDownloadAssets(true);
return QVariant::fromValue(req);
}
......
......@@ -73,6 +73,13 @@ public:
/** Checks if the given reservation and journey section have a compatible mode of transportation. */
static bool isSameMode(const QVariant &res, const KPublicTransport::JourneySection &section);
/** Provide an icon source for usage in Kirigami.Icon that represents the line mode.
* This can be an official line logo, and official product logo or a generic mode icon,
* depending on what's available.
* @note line/product logos are full-color, the generic ones are monochrome colorable Breeze icons.
*/
Q_INVOKABLE QString lineIcon(const QVariant &line);
/** Convert a KPublicTransport::Line::Mode enum value to an icon source or name
* for usage in Kirigami.Icon.
*/
......
......@@ -391,6 +391,7 @@ KPublicTransport::JourneyRequest TimelineDelegateController::journeyRequest() co
req.setTo(PublicTransport::locationFromPlace(LocationUtil::arrivalLocation(res), res));
req.setDateTime(std::max(QDateTime::currentDateTime(), SortUtil::startDateTime(res)));
req.setDateTimeMode(KPublicTransport::JourneyRequest::Departure);
req.setDownloadAssets(true);
// find full journey by looking at subsequent elements
auto prevRes = res;
......
......@@ -517,6 +517,7 @@ KPublicTransport::JourneyRequest TransferManager::journeyRequestForTransfer(cons
req.setTo(transfer.to());
req.setDateTime(transfer.journeyTime());
req.setDateTimeMode(transfer.alignment() == Transfer::Before ? JourneyRequest::Arrival : JourneyRequest::Departure);
req.setDownloadAssets(true);
return req;
}
......