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

Add place delegate

This is where locale-aware address formatting and map/navigation actions
go, to be shared for all reservation delegates.
parent b0442b91
......@@ -61,11 +61,20 @@ App.TimelineDelegate {
.arg(reservation.reservationFor.departureStation.name)
color: Kirigami.Theme.textColor
}
App.PlaceDelegate {
place: reservation.reservationFor.departureStation
Layout.fillWidth: true
}
QQC2.Label {
text: qsTr("To: %1 ")
.arg(reservation.reservationFor.arrivalStation.name)
color: Kirigami.Theme.textColor
}
App.PlaceDelegate {
place: reservation.reservationFor.arrivalStation
Layout.fillWidth: true
}
}
}
......
......@@ -58,6 +58,18 @@ App.TimelineDelegate {
}
}
QQC2.Label {
text: qsTr("Departure from %1: %2")
.arg(reservation.reservationFor.departureAirport.name)
.arg(reservation.reservationFor.departureTimeLocalized)
color: Kirigami.Theme.textColor
wrapMode: Text.WordWrap
Layout.maximumWidth: root.width
}
App.PlaceDelegate {
place: reservation.reservationFor.departureAirport
Layout.fillWidth: true
}
QQC2.Label {
text: qsTr("Terminal: %1 Gate: %2 Seat: %3")
.arg(reservation.reservationFor.departureTerminal)
......@@ -65,17 +77,18 @@ App.TimelineDelegate {
.arg(reservation.airplaneSeat)
color: Kirigami.Theme.textColor
}
QQC2.Label {
text: qsTr("Departure from %1: %2")
.arg(reservation.reservationFor.departureAirport.name)
.arg(reservation.reservationFor.departureTimeLocalized)
color: Kirigami.Theme.textColor
}
QQC2.Label {
text: qsTr("Arrival at %1: %2")
.arg(reservation.reservationFor.arrivalAirport.name)
.arg(reservation.reservationFor.arrivalTimeLocalized)
color: Kirigami.Theme.textColor
wrapMode: Text.WordWrap
Layout.maximumWidth: root.width
}
App.PlaceDelegate {
place: reservation.reservationFor.arrivalAirport
Layout.fillWidth: true
}
QQC2.Button {
......
......@@ -49,13 +49,9 @@ App.TimelineDelegate {
}
}
QQC2.Label {
text: qsTr("Address:\n%1\n%2 %3\n%4 ")
.arg(reservation.reservationFor.address.streetAddress)
.arg(reservation.reservationFor.address.postalCode)
.arg(reservation.reservationFor.address.addressLocality)
.arg(reservation.reservationFor.address.addressCountry)
color: Kirigami.Theme.textColor
App.PlaceDelegate {
place: reservation.reservationFor
Layout.fillWidth: true
}
QQC2.Label {
text: qsTr("Check-in time: %1")
......
/*
Copyright (C) 2018 Volker Krause <vkrause@kde.org>
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import QtQuick 2.5
import QtQuick.Layouts 1.1
import QtQuick.Controls 2.1 as QQC2
import org.kde.kirigami 2.0 as Kirigami
import "." as App
Item {
id: root
property var place
implicitHeight: (!place.address.isEmpty || place.geo.isValid) ? Math.max(buttonLayout.implicitHeight, label.implicitHeight) : 0
QQC2.Label {
id: label
visible: !place.address.isEmpty
// TODO KContact-based locale-dependent address formatting
text: qsTr("%1\n%2 %3\n%4 ")
.arg(place.address.streetAddress)
.arg(place.address.postalCode)
.arg(place.address.addressLocality)
.arg(place.address.addressCountry)
color: Kirigami.Theme.textColor
}
RowLayout {
id: buttonLayout
anchors.right: root.right
y: Math.max(0, label.implicitHeight - buttonLayout.implicitHeight)
QQC2.ToolButton {
icon.name: "map-symbolic"
visible: place.geo.isValid
onClicked: {
// TODO
Qt.openUrlExternally("https://www.openstreetmap.org/#map=17/" + place.geo.latitude + "/" + place.geo.longitude);
}
}
QQC2.ToolButton {
icon.name: "go-next-symbolic"
visible: place.geo.isValid
onClicked: console.log("TODO: navigate to location")
}
}
}
......@@ -54,13 +54,9 @@ App.TimelineDelegate {
}
}
QQC2.Label {
text: qsTr("Address:\n%1\n%2 %3\n%4 ")
.arg(reservation.reservationFor.address.streetAddress)
.arg(reservation.reservationFor.address.postalCode)
.arg(reservation.reservationFor.address.addressLocality)
.arg(reservation.reservationFor.address.addressCountry)
color: Kirigami.Theme.textColor
App.PlaceDelegate {
place: reservation.reservationFor
Layout.fillWidth: true
}
QQC2.Label {
text: qsTr("Person: %1")
......
......@@ -62,13 +62,21 @@ App.TimelineDelegate {
.arg(reservation.reservationFor.departurePlatform)
color: Kirigami.Theme.textColor
}
App.PlaceDelegate {
place: reservation.reservationFor.departureStation
Layout.fillWidth: true
}
// TODO reserved seat
QQC2.Label {
text: qsTr("Arrival at %1 on platform %2")
.arg(reservation.reservationFor.arrivalStation.name)
.arg(reservation.reservationFor.arrivalPlatform)
color: Kirigami.Theme.textColor
}
// TODO reserved seat
App.PlaceDelegate {
place: reservation.reservationFor.arrivalStation
Layout.fillWidth: true
}
}
}
......@@ -5,6 +5,7 @@
<file>BusDelegate.qml</file>
<file>FlightDelegate.qml</file>
<file>HotelDelegate.qml</file>
<file>PlaceDelegate.qml</file>
<file>RestaurantDelegate.qml</file>
<file>TimelineDelegate.qml</file>
<file>TimelinePage.qml</file>
......
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