diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ce02770..8821e4f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,2 +1,4 @@ +add_definitions(-DTRANSLATION_DOMAIN=\"kde-itinerary\") + add_subdirectory(weather) add_subdirectory(app) diff --git a/src/app/BusDelegate.qml b/src/app/BusDelegate.qml index 474525d..3caf719 100644 --- a/src/app/BusDelegate.qml +++ b/src/app/BusDelegate.qml @@ -1,100 +1,96 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.itinerary 1.0 import "." as App App.TimelineDelegate { id: root header: Rectangle { id: headerBackground Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.inherit: false color: Kirigami.Theme.backgroundColor implicitHeight: headerLayout.implicitHeight + Kirigami.Units.largeSpacing * 2 anchors.leftMargin: -root.leftPadding anchors.topMargin: -root.topPadding anchors.rightMargin: -root.rightPadding RowLayout { id: headerLayout anchors.fill: parent anchors.margins: Kirigami.Units.largeSpacing QQC2.Label { - text: qsTr("🚌 %1 %2") - .arg(reservation.reservationFor.busName) - .arg(reservation.reservationFor.busNumber) + text: i18n("🚌 %1", reservation.reservationFor.busName + " " + reservation.reservationFor.busNumber) color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale Layout.fillWidth: true } QQC2.Label { text: Localizer.formatTime(reservation.reservationFor, "departureTime") color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale } } } contentItem: ColumnLayout { id: topLayout QQC2.Label { - text: qsTr("From: %1") - .arg(reservation.reservationFor.departureStation.name) + text: i18n("From: %1", reservation.reservationFor.departureStation.name) color: Kirigami.Theme.textColor } App.PlaceDelegate { place: reservation.reservationFor.departureStation Layout.fillWidth: true } Kirigami.Separator { Layout.fillWidth: true } QQC2.Label { - text: qsTr("To: %1") - .arg(reservation.reservationFor.arrivalStation.name) + text: i18n("To: %1", reservation.reservationFor.arrivalStation.name) color: Kirigami.Theme.textColor } App.PlaceDelegate { place: reservation.reservationFor.arrivalStation Layout.fillWidth: true } QQC2.Label { - text: qsTr("Arrival: %1").arg(Localizer.formatDateTime(reservation.reservationFor, "arrivalTime")) + text: i18n("Arrival: %1", Localizer.formatDateTime(reservation.reservationFor, "arrivalTime")) color: Kirigami.Theme.textColor } } Component { id: detailsComponent App.BusPage { resId: root.resId reservation: root.reservation passId: root.passId } } onClicked: applicationWindow().pageStack.push(detailsComponent); } diff --git a/src/app/BusPage.qml b/src/app/BusPage.qml index 2bfeeb4..17a4e47 100644 --- a/src/app/BusPage.qml +++ b/src/app/BusPage.qml @@ -1,145 +1,145 @@ /* Copyright (C) 2018 Volker Krause 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 . */ 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 org.kde.kitinerary 1.0 import org.kde.itinerary 1.0 import "." as App App.DetailsPage { id: root - title: qsTr("Bus Ticket") + title: i18n("Bus Ticket") GridLayout { id: grid width: root.width columns: 2 QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true text: reservation.reservationFor.busName + " " + reservation.reservationFor.busNumber horizontalAlignment: Qt.AlignHCenter font.bold: true } // ticket barcode App.TicketTokenDelegate { Layout.columnSpan: 2 ticket: reservation.reservedTicket } // departure data QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Departure") + text: i18n("Departure") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Departure time:") + text: i18n("Departure time:") } QQC2.Label { text: Localizer.formatDateTime(reservation.reservationFor, "departureTime") } QQC2.Label { text: reservation.reservationFor.departureStation.name Layout.columnSpan: 2 } App.PlaceDelegate { Layout.columnSpan: 2 Layout.fillWidth: true place: reservation.reservationFor.departureStation } Kirigami.Separator { Layout.columnSpan: 2 Layout.fillWidth: true } // arrival data QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Arrival") + text: i18n("Arrival") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Arrival time:") + text: i18n("Arrival time:") } QQC2.Label { text: Localizer.formatDateTime(reservation.reservationFor, "arrivalTime") } QQC2.Label { text: reservation.reservationFor.arrivalStation.name Layout.columnSpan: 2 } App.PlaceDelegate { Layout.columnSpan: 2 Layout.fillWidth: true place: reservation.reservationFor.arrivalStation } Kirigami.Separator { Layout.columnSpan: 2 Layout.fillWidth: true } // seat reservation QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Seat") + text: i18n("Seat") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Seat:") + text: i18n("Seat:") } QQC2.Label { text: reservation.reservedTicket.ticketedSeat.seatNumber } // booking details Kirigami.Separator { Layout.columnSpan: 2 Layout.fillWidth: true } QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Booking") + text: i18n("Booking") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Booking reference:") + text: i18n("Booking reference:") } QQC2.Label { text: reservation.reservationNumber } QQC2.Label { - text: qsTr("Under name:") + text: i18n("Under name:") } QQC2.Label { text: reservation.underName.name } } } diff --git a/src/app/CountryInfoDelegate.qml b/src/app/CountryInfoDelegate.qml index 45f532c..f8ba2ab 100644 --- a/src/app/CountryInfoDelegate.qml +++ b/src/app/CountryInfoDelegate.qml @@ -1,80 +1,80 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.kitinerary 1.0 as KItinerary import org.kde.itinerary 1.0 import "." as App Kirigami.AbstractCard { id: root property var countryInfo; header: Rectangle { id: headerBackground Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.inherit: false color: Kirigami.Theme.backgroundColor implicitHeight: headerLayout.implicitHeight + Kirigami.Units.largeSpacing * 2 anchors.leftMargin: -root.leftPadding anchors.topMargin: -root.topPadding anchors.rightMargin: -root.rightPadding RowLayout { id: headerLayout anchors.fill: parent anchors.margins: Kirigami.Units.largeSpacing QQC2.Label { - text: qsTr("⚠ Entering %1").arg(Localizer.countryName(countryInfo.isoCode)) + text: i18n("⚠ Entering %1", Localizer.countryName(countryInfo.isoCode)) color: Kirigami.Theme.neutralTextColor } } } contentItem: ColumnLayout { id: topLayout QQC2.Label { text: countryInfo.drivingSide == KItinerary.KnowledgeDb.DrivingSide.Right ? - qsTr("People are driving on the right side.") : - qsTr("People are driving on the wrong side.") + i18n("People are driving on the right side.") : + i18n("People are driving on the wrong side.") color: Kirigami.Theme.negativeTextColor visible: countryInfo.drivingSideDiffers } QQC2.Label { - text: qsTr("No compatible power sockets: %1").arg(countryInfo.powerSocketTypes) + text: i18n("No compatible power sockets: %1", countryInfo.powerSocketTypes) color: Kirigami.Theme.negativeTextColor visible: countryInfo.powerPlugCompatibility == CountryInformation.Incompatible } QQC2.Label { - text: qsTr("Some incompatible power sockets: %1").arg(countryInfo.powerSocketTypes) + text: i18n("Some incompatible power sockets: %1", countryInfo.powerSocketTypes) color: Kirigami.Theme.neutralTextColor - visible: countryInfo.powerPlugCompatibility == CountryInformation.PartiallyCompatible && countryInfo.powerSocket != "" + visible: countryInfo.powerPlugCompatibility == CountryInformation.PartiallyCompatible && countryInfo.powerSocketTypes != "" } QQC2.Label { - text: qsTr("Some incompatible power plugs: %1").arg(countryInfo.powerPlugTypes) + text: i18n("Some incompatible power plugs: %1", countryInfo.powerPlugTypes) color: Kirigami.Theme.neutralTextColor visible: countryInfo.powerPlugCompatibility == CountryInformation.PartiallyCompatible && countryInfo.powerPlugTypes != "" } } } diff --git a/src/app/DetailsPage.qml b/src/app/DetailsPage.qml index a0a79a4..2e77960 100644 --- a/src/app/DetailsPage.qml +++ b/src/app/DetailsPage.qml @@ -1,70 +1,70 @@ /* Copyright (C) 2018 Volker Krause 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 . */ 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 org.kde.kitinerary 1.0 import org.kde.itinerary 1.0 import "." as App Kirigami.ScrollablePage { id: root property string resId property variant reservation property string passId Kirigami.OverlaySheet { id: deleteWarningSheet QQC2.Label { - text: qsTr("Do you really want to delete this event?") + text: i18n("Do you really want to delete this event?") wrapMode: Text.WordWrap } footer: RowLayout { QQC2.Button { Layout.alignment: Qt.AlignHCenter - text: qsTr("Delete") + text: i18n("Delete") icon.name: "edit-delete" onClicked: { _reservationManager.removeReservation(root.resId) applicationWindow().pageStack.pop() } } } } actions { contextualActions: [ Kirigami.Action { iconName: "edit-delete" - text: qsTr("Delete") + text: i18n("Delete") onTriggered: deleteWarningSheet.sheetOpen = true }, Kirigami.Action { iconSource: root.passId !== "" ? "image://org.kde.pkpass/" + passId + "/icon" : "" - text: qsTr("Boarding Pass") + text: i18n("Boarding Pass") visible: root.passId !== "" onTriggered: applicationWindow().pageStack.push(pkpassComponent, {"passId": root.passId }); } ] } onBackRequested: pageStack.pop() } diff --git a/src/app/FlightDelegate.qml b/src/app/FlightDelegate.qml index 26da570..d465f73 100644 --- a/src/app/FlightDelegate.qml +++ b/src/app/FlightDelegate.qml @@ -1,124 +1,131 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.itinerary 1.0 import "." as App App.TimelineDelegate { id: root + function airportDisplayString(airport) + { + if (airport.name) { + return airport.name; + } + return airport.iataCode; + } + header: Rectangle { id: headerBackground Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.inherit: false color: Kirigami.Theme.backgroundColor implicitHeight: headerLayout.implicitHeight + Kirigami.Units.largeSpacing * 2 anchors.leftMargin: -root.leftPadding anchors.topMargin: -root.topPadding anchors.rightMargin: -root.rightPadding RowLayout { id: headerLayout anchors.fill: parent anchors.margins: Kirigami.Units.largeSpacing QQC2.Label { - text: qsTr("✈ %1 %2 %3 → %4") - .arg(reservation.reservationFor.airline.iataCode) - .arg(reservation.reservationFor.flightNumber) - .arg(reservation.reservationFor.departureAirport.iataCode) - .arg(reservation.reservationFor.arrivalAirport.iataCode) + text: i18n("✈ %1 %2 → %3", + reservation.reservationFor.airline.iataCode + " " + reservation.reservationFor.flightNumber, + reservation.reservationFor.departureAirport.iataCode, + reservation.reservationFor.arrivalAirport.iataCode) color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale Layout.fillWidth: true } QQC2.Label { text: isNaN(reservation.reservationFor.boardingTime.getTime()) ? Localizer.formatTime(reservation.reservationFor, "departureTime") : Localizer.formatTime(reservation.reservationFor, "boardingTime") color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale } } } contentItem: ColumnLayout { id: topLayout QQC2.Label { - text: qsTr("Departure from %1: %2") - .arg(reservation.reservationFor.departureAirport.name) - .arg(Localizer.formatTime(reservation.reservationFor, "departureTime")) + text: i18n("Departure from %1: %2", + airportDisplayString(reservation.reservationFor.departureAirport), + Localizer.formatTime(reservation.reservationFor, "departureTime") + " ") 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) - .arg(reservation.reservationFor.departureGate) - .arg(reservation.airplaneSeat) + text: i18n("Terminal: %1 Gate: %2 Seat: %3", + reservation.reservationFor.departureTerminal ? reservation.reservationFor.departureTerminal : "-", + reservation.reservationFor.departureGate ? reservation.reservationFor.departureGate : "-", + reservation.airplaneSeat ? reservation.airplaneSeat : "-") color: Kirigami.Theme.textColor } Kirigami.Separator { Layout.fillWidth: true } QQC2.Label { - text: qsTr("Arrival at %1: %2") - .arg(reservation.reservationFor.arrivalAirport.name) - .arg(Localizer.formatDateTime(reservation.reservationFor, "arrivalTime")) + text: i18n("Arrival at %1: %2", + airportDisplayString(reservation.reservationFor.arrivalAirport), + Localizer.formatDateTime(reservation.reservationFor, "arrivalTime") + " ") color: Kirigami.Theme.textColor wrapMode: Text.WordWrap Layout.maximumWidth: root.width } App.PlaceDelegate { place: reservation.reservationFor.arrivalAirport Layout.fillWidth: true } QQC2.Button { Layout.alignment: Qt.AlignHCenter - text: qsTr("Boarding Pass") + text: i18n("Boarding Pass") onClicked: applicationWindow().pageStack.push(pkpassComponent, {"passId": root.passId }); visible: root.passId !== "" icon.source: root.passId !== "" ? "image://org.kde.pkpass/" + passId + "/icon" : "" // this prevents a tinting/masking effect turning the icon monochrome with the breeze style icon.color: "transparent" } } Component { id: detailsComponent App.FlightPage { resId: root.resId reservation: root.reservation passId: root.passId } } onClicked: applicationWindow().pageStack.push(detailsComponent); } diff --git a/src/app/FlightPage.qml b/src/app/FlightPage.qml index 0666054..de065f9 100644 --- a/src/app/FlightPage.qml +++ b/src/app/FlightPage.qml @@ -1,168 +1,168 @@ /* Copyright (C) 2018 Volker Krause 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 . */ 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 org.kde.kitinerary 1.0 import org.kde.itinerary 1.0 import "." as App App.DetailsPage { id: root - title: qsTr("Flight") + title: i18n("Flight") GridLayout { id: grid width: root.width columns: 2 QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true text: reservation.reservationFor.airline.iataCode + " " + reservation.reservationFor.flightNumber horizontalAlignment: Qt.AlignHCenter font.bold: true } // ticket barcode App.TicketTokenDelegate { Layout.columnSpan: 2 ticket: reservation.reservedTicket } // flight details QQC2.Label { - text: qsTr("Boarding time:") + text: i18n("Boarding time:") } QQC2.Label { text: Localizer.formatDateTime(reservation.reservationFor, "boardingTime") } QQC2.Label { - text: qsTr("Boarding group:") + text: i18n("Boarding group:") } QQC2.Label { text: reservation.boardingGroup } QQC2.Label { - text: qsTr("Seat:") + text: i18n("Seat:") } QQC2.Label { text: reservation.airplaneSeat } QQC2.Label { - text: qsTr("Airline:") + text: i18n("Airline:") } QQC2.Label { text: reservation.reservationFor.airline.name } Kirigami.Separator { Layout.columnSpan: 2 Layout.fillWidth: true } // departure data QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Departure") + text: i18n("Departure") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Departure time:") + text: i18n("Departure time:") } QQC2.Label { text: Localizer.formatDateTime(reservation.reservationFor, "departureTime") } QQC2.Label { text: reservation.reservationFor.departureAirport.name + " (" + reservation.reservationFor.departureAirport.iataCode + ")" Layout.columnSpan: 2 } App.PlaceDelegate { Layout.columnSpan: 2 Layout.fillWidth: true place: reservation.reservationFor.departureAirport } QQC2.Label { - text: qsTr("Departure terminal:") + text: i18n("Departure terminal:") } QQC2.Label { text: reservation.reservationFor.departureTerminal } QQC2.Label { - text: qsTr("Departure gate:") + text: i18n("Departure gate:") } QQC2.Label { text: reservation.reservationFor.departureGate } Kirigami.Separator { Layout.columnSpan: 2 Layout.fillWidth: true } // arrival data QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Arrival") + text: i18n("Arrival") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Arrival time:") + text: i18n("Arrival time:") } QQC2.Label { text: Localizer.formatDateTime(reservation.reservationFor, "arrivalTime") } QQC2.Label { text: reservation.reservationFor.arrivalAirport.name + " (" + reservation.reservationFor.arrivalAirport.iataCode + ")" Layout.columnSpan: 2 } App.PlaceDelegate { Layout.columnSpan: 2 Layout.fillWidth: true place: reservation.reservationFor.arrivalAirport } Kirigami.Separator { Layout.columnSpan: 2 Layout.fillWidth: true } // booking details QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Booking") + text: i18n("Booking") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Booking reference:") + text: i18n("Booking reference:") } QQC2.Label { text: reservation.reservationNumber } QQC2.Label { - text: qsTr("Under name:") + text: i18n("Under name:") } QQC2.Label { text: reservation.underName.name } } } diff --git a/src/app/HotelDelegate.qml b/src/app/HotelDelegate.qml index e74b292..83edef5 100644 --- a/src/app/HotelDelegate.qml +++ b/src/app/HotelDelegate.qml @@ -1,85 +1,84 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.itinerary 1.0 import "." as App App.TimelineDelegate { id: root header: Rectangle { id: headerBackground Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.inherit: false color: Kirigami.Theme.backgroundColor implicitHeight: headerLayout.implicitHeight + Kirigami.Units.largeSpacing * 2 anchors.leftMargin: -root.leftPadding anchors.topMargin: -root.topPadding anchors.rightMargin: -root.rightPadding RowLayout { id: headerLayout anchors.fill: parent anchors.margins: Kirigami.Units.largeSpacing QQC2.Label { text: root.rangeType == TimelineModel.RangeEnd ? - qsTr("🏨 Check-out %1").arg(reservation.reservationFor.name) : - qsTr("🏨 %1").arg(reservation.reservationFor.name) + i18n("🏨 Check-out %1", reservation.reservationFor.name) : + i18n("🏨 %1", reservation.reservationFor.name) color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale Layout.fillWidth: true } } } contentItem: ColumnLayout { id: topLayout App.PlaceDelegate { place: reservation.reservationFor Layout.fillWidth: true } QQC2.Label { - text: qsTr("Check-in time: %1") - .arg(Localizer.formatTime(reservation, "checkinTime")) + text: i18n("Check-in time: %1", Localizer.formatTime(reservation, "checkinTime")) color: Kirigami.Theme.textColor visible: root.rangeType == TimelineModel.RangeBegin } QQC2.Label { text: root.rangeType == TimelineModel.RangeBegin ? - qsTr("Check-out time: %1").arg(Localizer.formatDateTime(reservation, "checkoutTime")) : - qsTr("Check-out time: %1").arg(Localizer.formatTime(reservation, "checkoutTime")) + i18n("Check-out time: %1", Localizer.formatDateTime(reservation, "checkoutTime")) : + i18n("Check-out time: %1", Localizer.formatTime(reservation, "checkoutTime")) color: Kirigami.Theme.textColor } } Component { id: detailsComponent App.HotelPage { resId: root.resId reservation: root.reservation } } onClicked: applicationWindow().pageStack.push(detailsComponent); } diff --git a/src/app/HotelPage.qml b/src/app/HotelPage.qml index c534600..588d7aa 100644 --- a/src/app/HotelPage.qml +++ b/src/app/HotelPage.qml @@ -1,89 +1,89 @@ /* Copyright (C) 2018 Volker Krause 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 . */ 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 org.kde.kitinerary 1.0 import org.kde.itinerary 1.0 import "." as App App.DetailsPage { id: root - title: qsTr("Hotel Reservation") + title: i18n("Hotel Reservation") GridLayout { id: grid width: root.width columns: 2 QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true text: reservation.reservationFor.name horizontalAlignment: Qt.AlignHCenter font.bold: true } App.PlaceDelegate { Layout.columnSpan: 2 Layout.fillWidth: true place: reservation.reservationFor } // TODO make these interactive QQC2.Label { - text: qsTr("Telephone:") + text: i18n("Telephone:") } QQC2.Label { text: reservation.reservationFor.telephone } QQC2.Label { - text: qsTr("Email:") + text: i18n("Email:") } QQC2.Label { text: reservation.reservationFor.email } QQC2.Label { - text: qsTr("Check-in time:") + text: i18n("Check-in time:") } QQC2.Label { text: Localizer.formatDateTime(reservation, "checkinTime") } QQC2.Label { - text: qsTr("Check-out time:") + text: i18n("Check-out time:") } QQC2.Label { text: Localizer.formatDateTime(reservation, "checkoutTime") } QQC2.Label { - text: qsTr("Booking reference:") + text: i18n("Booking reference:") } QQC2.Label { text: reservation.reservationNumber } QQC2.Label { - text: qsTr("Under name:") + text: i18n("Under name:") } QQC2.Label { text: reservation.underName.name } } } diff --git a/src/app/Messages.sh b/src/app/Messages.sh deleted file mode 100755 index 1e46092..0000000 --- a/src/app/Messages.sh +++ /dev/null @@ -1,2 +0,0 @@ -#! /usr/bin/env bash -$XGETTEXT `find . -name "*.cpp" -o -name "*.qml" -name "*.h"` -L Java -o $podir/itinerary.pot diff --git a/src/app/PkPassPage.qml b/src/app/PkPassPage.qml index 12eaab8..488e49f 100644 --- a/src/app/PkPassPage.qml +++ b/src/app/PkPassPage.qml @@ -1,32 +1,32 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import org.kde.kirigami 2.0 as Kirigami import "." as App Kirigami.Page { property alias passId: pkpass.passId property alias pass: pkpass.pass - title: qsTr("Boarding Pass") + title: i18n("Boarding Pass") App.BoardingPass { x: (parent.width - implicitWidth) / 2 id: pkpass } onBackRequested: pageStack.pop() } diff --git a/src/app/RestaurantDelegate.qml b/src/app/RestaurantDelegate.qml index 9036cac..136dba7 100644 --- a/src/app/RestaurantDelegate.qml +++ b/src/app/RestaurantDelegate.qml @@ -1,75 +1,75 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.itinerary 1.0 import "." as App App.TimelineDelegate { id: root header: Rectangle { id: headerBackground Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.inherit: false color: Kirigami.Theme.backgroundColor implicitHeight: headerLayout.implicitHeight + Kirigami.Units.largeSpacing * 2 anchors.leftMargin: -root.leftPadding anchors.topMargin: -root.topPadding anchors.rightMargin: -root.rightPadding RowLayout { id: headerLayout anchors.fill: parent anchors.margins: Kirigami.Units.largeSpacing QQC2.Label { - text: qsTr("🍴 %1").arg(reservation.reservationFor.name) + text: i18n("🍴 %1", reservation.reservationFor.name) color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale Layout.fillWidth: true } QQC2.Label { text: Localizer.formatTime(reservation, "startTime") color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale } } } contentItem: ColumnLayout { id: topLayout App.PlaceDelegate { place: reservation.reservationFor Layout.fillWidth: true } } Component { id: detailsComponent App.RestaurantPage { resId: root.resId reservation: root.reservation } } onClicked: applicationWindow().pageStack.push(detailsComponent); } diff --git a/src/app/RestaurantPage.qml b/src/app/RestaurantPage.qml index 5e324a9..28dd899 100644 --- a/src/app/RestaurantPage.qml +++ b/src/app/RestaurantPage.qml @@ -1,95 +1,95 @@ /* Copyright (C) 2018 Volker Krause 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 . */ 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 org.kde.kitinerary 1.0 import org.kde.itinerary 1.0 import "." as App App.DetailsPage { id: root - title: qsTr("Restaurant Reservation") + title: i18n("Restaurant Reservation") GridLayout { id: grid width: root.width columns: 2 QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true text: reservation.reservationFor.name horizontalAlignment: Qt.AlignHCenter font.bold: true } App.PlaceDelegate { Layout.columnSpan: 2 Layout.fillWidth: true place: reservation.reservationFor } // TODO make these interactive QQC2.Label { - text: qsTr("Telephone:") + text: i18n("Telephone:") } QQC2.Label { text: reservation.reservationFor.telephone } QQC2.Label { - text: qsTr("Email:") + text: i18n("Email:") } QQC2.Label { text: reservation.reservationFor.email } QQC2.Label { - text: qsTr("Start time:") + text: i18n("Start time:") } QQC2.Label { text: Localizer.formatDateTime(reservation, "startTime") } QQC2.Label { - text: qsTr("End time:") + text: i18n("End time:") } QQC2.Label { text: Localizer.formatDateTime(reservation, "endTime") } QQC2.Label { - text: qsTr("Party size:") + text: i18n("Party size:") } QQC2.Label { text: reservation.partySize } QQC2.Label { - text: qsTr("Booking reference:") + text: i18n("Booking reference:") } QQC2.Label { text: reservation.reservationNumber } QQC2.Label { - text: qsTr("Under name:") + text: i18n("Under name:") } QQC2.Label { text: reservation.underName.name } } } diff --git a/src/app/SettingsPage.qml b/src/app/SettingsPage.qml index 6d90152..4a13443 100644 --- a/src/app/SettingsPage.qml +++ b/src/app/SettingsPage.qml @@ -1,73 +1,73 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.itinerary 1.0 import "." as App Kirigami.ScrollablePage { id: root - title: qsTr("Settings") + title: i18n("Settings") CountryModel { id: countryModel } GridLayout { columns: 2 width: root.width QQC2.Label { - text: qsTr("Home Country") + text: i18n("Home Country") } QQC2.ComboBox { model: countryModel textRole: "display" currentIndex: countryModel.isoCodeToIndex(_settings.homeCountryIsoCode) onActivated: _settings.homeCountryIsoCode = countryModel.isoCodeFromIndex(currentIndex) } QQC2.Label { - text: qsTr("Weather Forecast") + text: i18n("Weather Forecast") } QQC2.Switch { id: weatherSwitch checked: _settings.weatherForecastEnabled onToggled: _settings.weatherForecastEnabled = checked } QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Showing weather forecasts will query online services.") + text: i18n("Showing weather forecasts will query online services.") visible: !weatherSwitch.checked } // ATTENTION do not remove this note, see https://api.met.no/license_data.html QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Using data from The Norwegian Meteorological Institute under Creative Commons 4.0 BY International license.") + text: i18n("Using data from The Norwegian Meteorological Institute under Creative Commons 4.0 BY International license.") visible: weatherSwitch.checked wrapMode: Text.WordWrap onLinkActivated: Qt.openUrlExternally(link) } } onBackRequested: pageStack.pop() } diff --git a/src/app/TimelinePage.qml b/src/app/TimelinePage.qml index 45f8074..fd9bd82 100644 --- a/src/app/TimelinePage.qml +++ b/src/app/TimelinePage.qml @@ -1,162 +1,162 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.itinerary 1.0 import "." as App Kirigami.ScrollablePage { id: root - title: qsTr("My Itinerary") + title: i18n("My Itinerary") // context drawer content actions { contextualActions: [ Kirigami.Action { - text: qsTr("Today") + text: i18n("Today") iconName: "view-calendar-day" onTriggered: listView.positionViewAtIndex(_timelineModel.todayRow, ListView.Beginning); } ] } // page content Component { id: flightDelegate App.FlightDelegate { resId: modelData.reservationId reservation: modelData.reservation passId: modelData.passId rangeType: modelData.rangeType } } Component { id: hotelDelegate App.HotelDelegate { resId: modelData.reservationId reservation: modelData.reservation passId: modelData.passId rangeType: modelData.rangeType } } Component { id: trainDelegate App.TrainDelegate { resId: modelData.reservationId reservation: modelData.reservation passId: modelData.passId rangeType: modelData.rangeType } } Component { id: busDelegate App.BusDelegate { resId: modelData.reservationId reservation: modelData.reservation passId: modelData.passId rangeType: modelData.rangeType } } Component { id: restaurantDelegate App.RestaurantDelegate { resId: modelData.reservationId reservation: modelData.reservation passId: modelData.passId rangeType: modelData.rangeType } } Component { id: touristAttractionDelegate App.TouristAttractionDelegate { resId: modelData.reservationId reservation: modelData.reservation passId: modelData.passId rangeType: modelData.rangeType } } Component { id: todayDelegate Item { implicitHeight: visible ? label.implicitHeight : 0 visible: modelData.isTodayEmpty QQC2.Label { id: label anchors.fill: parent - text: qsTr("Nothing on the itinerary for today."); + text: i18n("Nothing on the itinerary for today."); color: Kirigami.Theme.textColor horizontalAlignment: Qt.AlignHCenter } } } Component { id: countryInfoDelegate App.CountryInfoDelegate { countryInfo: modelData.countryInformation } } Component { id: weatherForecastDelegate App.WeatherForecastDelegate { weatherForecast: modelData.weatherForecast } } Kirigami.CardsListView { id: listView model: _timelineModel delegate: Loader { property var modelData: model height: item ? item.implicitHeight : 0 sourceComponent: { if (!modelData) return; switch (modelData.type) { case TimelineModel.Flight: return flightDelegate; case TimelineModel.Hotel: return hotelDelegate; case TimelineModel.TrainTrip: return trainDelegate; case TimelineModel.BusTrip: return busDelegate; case TimelineModel.Restaurant: return restaurantDelegate; case TimelineModel.TouristAttraction: return touristAttractionDelegate; case TimelineModel.TodayMarker: return todayDelegate; case TimelineModel.CountryInfo: return countryInfoDelegate; case TimelineModel.WeatherForecast: return weatherForecastDelegate; } } } section.property: "sectionHeader" section.delegate: Item { implicitHeight: headerItem.implicitHeight + Kirigami.Units.largeSpacing*2 implicitWidth: ListView.view.width Kirigami.BasicListItem { id: headerItem label: section backgroundColor: Kirigami.Theme.backgroundColor icon: "view-calendar-day" } } section.criteria: ViewSection.FullString section.labelPositioning: ViewSection.CurrentLabelAtStart | ViewSection.InlineLabels } Component.onCompleted: listView.positionViewAtIndex(_timelineModel.todayRow, ListView.Beginning); } diff --git a/src/app/TouristAttractionDelegate.qml b/src/app/TouristAttractionDelegate.qml index 0a98ee1..c86f082 100644 --- a/src/app/TouristAttractionDelegate.qml +++ b/src/app/TouristAttractionDelegate.qml @@ -1,65 +1,65 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.itinerary 1.0 import "." as App App.TimelineDelegate { id: root header: Rectangle { id: headerBackground Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.inherit: false color: Kirigami.Theme.backgroundColor implicitHeight: headerLayout.implicitHeight + Kirigami.Units.largeSpacing * 2 anchors.leftMargin: -root.leftPadding anchors.topMargin: -root.topPadding anchors.rightMargin: -root.rightPadding RowLayout { id: headerLayout anchors.fill: parent anchors.margins: Kirigami.Units.largeSpacing QQC2.Label { - text: qsTr("🎢 %1").arg(reservation.touristAttraction.name) + text: i18n("🎢 %1", reservation.touristAttraction.name) color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale Layout.fillWidth: true } QQC2.Label { text: Localizer.formatTime(reservation, "arrivalTime") color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale } } } contentItem: ColumnLayout { id: topLayout App.PlaceDelegate { place: reservation.touristAttraction Layout.fillWidth: true } } } diff --git a/src/app/TrainDelegate.qml b/src/app/TrainDelegate.qml index 4a79007..469e3b7 100644 --- a/src/app/TrainDelegate.qml +++ b/src/app/TrainDelegate.qml @@ -1,104 +1,101 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.itinerary 1.0 import "." as App App.TimelineDelegate { id: root header: Rectangle { id: headerBackground Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.inherit: false color: Kirigami.Theme.backgroundColor implicitHeight: headerLayout.implicitHeight + Kirigami.Units.largeSpacing * 2 anchors.leftMargin: -root.leftPadding anchors.topMargin: -root.topPadding anchors.rightMargin: -root.rightPadding RowLayout { id: headerLayout anchors.fill: parent anchors.margins: Kirigami.Units.largeSpacing QQC2.Label { - text: qsTr("🚄 %1 %2") - .arg(reservation.reservationFor.trainName) - .arg(reservation.reservationFor.trainNumber) + text: i18n("🚄 %1", reservation.reservationFor.trainName + " " + reservation.reservationFor.trainNumber) color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale Layout.fillWidth: true } QQC2.Label { text: Localizer.formatTime(reservation.reservationFor, "departureTime") color: Kirigami.Theme.textColor font.pointSize: Kirigami.Theme.defaultFont.pointSize * root.headerFontScale } } } contentItem: ColumnLayout { id: topLayout QQC2.Label { - text: qsTr("Departure from %1 on platform %2") - .arg(reservation.reservationFor.departureStation.name) - .arg(reservation.reservationFor.departurePlatform) + text: i18n("Departure from %1 on platform %2", + reservation.reservationFor.departureStation.name, + reservation.reservationFor.departurePlatform ? reservation.reservationFor.departurePlatform : "-") color: Kirigami.Theme.textColor } App.PlaceDelegate { place: reservation.reservationFor.departureStation Layout.fillWidth: true } // TODO reserved seat Kirigami.Separator { Layout.fillWidth: true } QQC2.Label { - text: qsTr("Arrival at %1 on platform %2") - .arg(reservation.reservationFor.arrivalStation.name) - .arg(reservation.reservationFor.arrivalPlatform) + text: i18n("Arrival at %1 on platform %2", + reservation.reservationFor.arrivalStation.name, + reservation.reservationFor.arrivalPlatform ? reservation.reservationFor.arrivalPlatform : "-") color: Kirigami.Theme.textColor } QQC2.Label { - text: qsTr("Arrival time: %1") - .arg(Localizer.formatDateTime(reservation.reservationFor, "arrivalTime")) + text: i18n("Arrival time: %1", Localizer.formatDateTime(reservation.reservationFor, "arrivalTime")) color: Kirigami.Theme.textColor } App.PlaceDelegate { place: reservation.reservationFor.arrivalStation Layout.fillWidth: true } } Component { id: detailsComponent App.TrainPage { resId: root.resId reservation: root.reservation passId: root.passId } } onClicked: applicationWindow().pageStack.push(detailsComponent); } diff --git a/src/app/TrainPage.qml b/src/app/TrainPage.qml index 0f4c8f5..ba30d11 100644 --- a/src/app/TrainPage.qml +++ b/src/app/TrainPage.qml @@ -1,162 +1,162 @@ /* Copyright (C) 2018 Volker Krause 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 . */ 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 org.kde.kitinerary 1.0 import org.kde.itinerary 1.0 import "." as App App.DetailsPage { id: root - title: qsTr("Train Ticket") + title: i18n("Train Ticket") GridLayout { id: grid width: root.width columns: 2 QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true text: reservation.reservationFor.trainName + " " + reservation.reservationFor.trainNumber horizontalAlignment: Qt.AlignHCenter font.bold: true } // ticket barcode App.TicketTokenDelegate { Layout.columnSpan: 2 ticket: reservation.reservedTicket } // departure data QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Departure") + text: i18n("Departure") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Departure time:") + text: i18n("Departure time:") } QQC2.Label { text: Localizer.formatDateTime(reservation.reservationFor, "departureTime") } QQC2.Label { text: reservation.reservationFor.departureStation.name Layout.columnSpan: 2 } App.PlaceDelegate { Layout.columnSpan: 2 Layout.fillWidth: true place: reservation.reservationFor.departureStation } QQC2.Label { - text: qsTr("Departure platform:") + text: i18n("Departure platform:") } QQC2.Label { text: reservation.reservationFor.departurePlatform } Kirigami.Separator { Layout.columnSpan: 2 Layout.fillWidth: true } // arrival data QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Arrival") + text: i18n("Arrival") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Arrival time:") + text: i18n("Arrival time:") } QQC2.Label { text: Localizer.formatDateTime(reservation.reservationFor, "arrivalTime") } QQC2.Label { text: reservation.reservationFor.arrivalStation.name Layout.columnSpan: 2 } App.PlaceDelegate { Layout.columnSpan: 2 Layout.fillWidth: true place: reservation.reservationFor.arrivalStation } QQC2.Label { - text: qsTr("Arrival platform:") + text: i18n("Arrival platform:") } QQC2.Label { text: reservation.reservationFor.arrivalPlatform } Kirigami.Separator { Layout.columnSpan: 2 Layout.fillWidth: true } // seat reservation QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Seat") + text: i18n("Seat") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Coach:") + text: i18n("Coach:") } QQC2.Label { text: reservation.reservedTicket.ticketedSeat.seatSection } QQC2.Label { - text: qsTr("Seat:") + text: i18n("Seat:") } QQC2.Label { text: reservation.reservedTicket.ticketedSeat.seatNumber } // booking details Kirigami.Separator { Layout.columnSpan: 2 Layout.fillWidth: true } QQC2.Label { Layout.columnSpan: 2 Layout.fillWidth: true - text: qsTr("Booking") + text: i18n("Booking") horizontalAlignment: Qt.AlignHCenter } QQC2.Label { - text: qsTr("Booking reference:") + text: i18n("Booking reference:") } QQC2.Label { text: reservation.reservationNumber } QQC2.Label { - text: qsTr("Under name:") + text: i18n("Under name:") } QQC2.Label { text: reservation.underName.name } } } diff --git a/src/app/WeatherForecastDelegate.qml b/src/app/WeatherForecastDelegate.qml index 8852425..508cec9 100644 --- a/src/app/WeatherForecastDelegate.qml +++ b/src/app/WeatherForecastDelegate.qml @@ -1,66 +1,64 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.4 as Kirigami import org.kde.itinerary 1.0 import "." as App Kirigami.AbstractCard { id: root property var weatherForecast visible: weatherForecast.valid headerOrientation: Qt.Horizontal header: Rectangle { id: headerBackground Kirigami.Theme.colorSet: Kirigami.Theme.Complementary Kirigami.Theme.inherit: false color: Kirigami.Theme.backgroundColor implicitWidth: icon.implicitWidth + Kirigami.Units.largeSpacing * 2 Layout.minimumHeight: implicitWidth Layout.fillHeight: true anchors.leftMargin: -root.leftPadding anchors.topMargin: -root.topPadding anchors.bottomMargin: -root.rightPadding Kirigami.Icon { id: icon anchors.fill: parent anchors.margins: Kirigami.Units.largeSpacing source: weatherForecast.symbolIconName } } contentItem: ColumnLayout { Layout.fillWidth: true QQC2.Label { - text: qsTr("Temperature: %1 °C / %2 °C") - .arg(weatherForecast.minimumTemperature) - .arg(weatherForecast.maximumTemperature) + text: i18n("Temperature: %1 °C / %2 °C", weatherForecast.minimumTemperature, weatherForecast.maximumTemperature) color: Kirigami.Theme.textColor Layout.fillWidth: true } QQC2.Label { - text: qsTr("Precipitation: %1 mm").arg(weatherForecast.precipitation) + text: i18n("Precipitation: %1 mm", weatherForecast.precipitation) color: Kirigami.Theme.textColor Layout.fillWidth: true } } } diff --git a/src/app/main.cpp b/src/app/main.cpp index 07b2f8d..db53f17 100644 --- a/src/app/main.cpp +++ b/src/app/main.cpp @@ -1,156 +1,160 @@ /* Copyright (C) 2018 Volker Krause 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 . */ #include "itinerary_version.h" #include "logging.h" #include "applicationcontroller.h" #include "countryinformation.h" #include "countrymodel.h" #include "localizer.h" #include "pkpassmanager.h" #include "timelinemodel.h" #include "pkpassimageprovider.h" #include "reservationmanager.h" #include "settings.h" #include #include #include #include #include +#include +#include + #include #include #ifdef Q_OS_ANDROID #include #include #endif #include #include #include #include void handleViewIntent(PkPassManager *passMgr) { #ifdef Q_OS_ANDROID // handle opened files const auto activity = QtAndroid::androidActivity(); if (!activity.isValid()) return; const auto intent = activity.callObjectMethod("getIntent", "()Landroid/content/Intent;"); if (!intent.isValid()) return; const auto uri = intent.callObjectMethod("getData", "()Landroid/net/Uri;"); if (!uri.isValid()) return; const auto scheme = uri.callObjectMethod("getScheme", "()Ljava/lang/String;"); if (scheme.toString() == QLatin1String("content")) { const auto tmpFile = activity.callObjectMethod("receiveContent", "(Landroid/net/Uri;)Ljava/lang/String;", uri.object()); passMgr->importPassFromTempFile(tmpFile.toString()); } else if (scheme.toString() == QLatin1String("file")) { const auto uriStr = uri.callObjectMethod("toString", "()Ljava/lang/String;"); passMgr->importPass(QUrl(uriStr.toString())); } else { const auto uriStr = uri.callObjectMethod("toString", "()Ljava/lang/String;"); qCWarning(Log) << "Unknown intent URI:" << uriStr.toString(); } #else Q_UNUSED(passMgr); #endif } #ifdef Q_OS_ANDROID Q_DECL_EXPORT #endif int main(int argc, char **argv) { QCoreApplication::setApplicationName(QStringLiteral("kde-itinerary")); QCoreApplication::setOrganizationName(QStringLiteral("KDE")); QCoreApplication::setOrganizationDomain(QStringLiteral("kde.org")); QCoreApplication::setApplicationVersion(QStringLiteral(ITINERARY_VERSION_STRING)); - QGuiApplication::setApplicationDisplayName(QStringLiteral("KDE Itinerary")); // TODO i18n + QGuiApplication::setApplicationDisplayName(i18n("KDE Itinerary")); QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling); QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); QGuiApplication app(argc, argv); QGuiApplication::setWindowIcon(QIcon::fromTheme(QStringLiteral("map-globe"))); QCommandLineParser parser; parser.addHelpOption(); parser.addVersionOption(); - parser.addPositionalArgument(QStringLiteral("pass"), QStringLiteral("PkPass file to import.")); + parser.addPositionalArgument(QStringLiteral("file"), i18n("PkPass or JSON-LD file to import.")); parser.process(app); Settings settings; ApplicationController appController; PkPassManager passMgr; ReservationManager resMgr; resMgr.setPkPassManager(&passMgr); TimelineModel timelineModel; timelineModel.setHomeCountryIsoCode(settings.homeCountryIsoCode()); timelineModel.setReservationManager(&resMgr); QObject::connect(&settings, &Settings::homeCountryIsoCodeChanged, &timelineModel, &TimelineModel::setHomeCountryIsoCode); WeatherForecastManager weatherForecastMgr; weatherForecastMgr.setAllowNetworkAccess(settings.weatherForecastEnabled()); QObject::connect(&settings, &Settings::weatherForecastEnabledChanged, &weatherForecastMgr, &WeatherForecastManager::setAllowNetworkAccess); timelineModel.setWeatherForecastManager(&weatherForecastMgr); qmlRegisterUncreatableType("org.kde.pkpass", 1, 0, "Barcode", {}); qmlRegisterUncreatableType("org.kde.pkpass", 1, 0, "Field", {}); qRegisterMetaType(); qmlRegisterUncreatableType("org.kde.kitinerary", 1, 0, "Ticket", {}); qmlRegisterUncreatableMetaObject(KItinerary::KnowledgeDb::staticMetaObject, "org.kde.kitinerary", 1, 0, "KnowledgeDb", {}); qmlRegisterUncreatableType("org.kde.itinerary", 1, 0, "CountryInformation", {}); qmlRegisterUncreatableType("org.kde.itinerary", 1, 0, "TimelineModel", {}); qmlRegisterSingletonType("org.kde.itinerary", 1, 0, "Localizer", [](QQmlEngine*, QJSEngine*) -> QObject*{ return new Localizer; }); qmlRegisterType("org.kde.itinerary", 1, 0, "CountryModel"); QQmlApplicationEngine engine; engine.addImageProvider(QStringLiteral("org.kde.pkpass"), new PkPassImageProvider(&passMgr)); + engine.rootContext()->setContextObject(new KLocalizedContext(&engine)); engine.rootContext()->setContextProperty(QStringLiteral("_pkpassManager"), &passMgr); engine.rootContext()->setContextProperty(QStringLiteral("_reservationManager"), &resMgr); engine.rootContext()->setContextProperty(QStringLiteral("_timelineModel"), &timelineModel); engine.rootContext()->setContextProperty(QStringLiteral("_appController"), &appController); engine.rootContext()->setContextProperty(QStringLiteral("_settings"), &settings); engine.load(QStringLiteral(":/main.qml")); for (const auto &file : parser.positionalArguments()) { if (file.endsWith(QLatin1String(".pkpass"))) passMgr.importPass(QUrl::fromLocalFile(file)); else resMgr.importReservation(QUrl::fromLocalFile(file)); } handleViewIntent(&passMgr); return app.exec(); } diff --git a/src/app/main.qml b/src/app/main.qml index 8d28561..1062032 100644 --- a/src/app/main.qml +++ b/src/app/main.qml @@ -1,99 +1,99 @@ /* Copyright (C) 2018 Volker Krause 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 . */ import QtQuick 2.5 import QtQuick.Layouts 1.1 import QtQuick.Dialogs 1.0 import QtQuick.Controls 2.1 as QQC2 import org.kde.kirigami 2.0 as Kirigami import "." as App Kirigami.ApplicationWindow { - title: qsTr("KDE Itinerary") + title: i18n("KDE Itinerary") header: Kirigami.ApplicationHeader {} width: 480 height: 720 FileDialog { property bool loadPass: false id: fileDialog - title: qsTr("Please choose a file") + title: i18n("Please choose a file") folder: shortcuts.home onAccepted: { console.log(fileDialog.fileUrls); if (loadPass) _pkpassManager.importPass(fileDialog.fileUrl); else _reservationManager.importReservation(fileDialog.fileUrl); } } globalDrawer: Kirigami.GlobalDrawer { - title: qsTr("KDE Itinerary") + title: i18n("KDE Itinerary") titleIcon: "map-symbolic" actions: [ Kirigami.Action { - text: qsTr("Import Reservation...") + text: i18n("Import Reservation...") iconName: "document-open" onTriggered: { fileDialog.loadPass = false; fileDialog.visible = true; } }, Kirigami.Action { - text: qsTr("Import Pass...") + text: i18n("Import Pass...") iconName: "document-open" onTriggered: { fileDialog.loadPass = true; fileDialog.visible = true; } }, Kirigami.Action { - text: qsTr("Check for Updates") + text: i18n("Check for Updates") iconName: "view-refresh" onTriggered: { _pkpassManager.updatePasses(); } }, Kirigami.Action { - text: qsTr("Settings...") + text: i18n("Settings...") iconName: "settings-configure" onTriggered: pageStack.push(settingsComponent) } ] } contextDrawer: Kirigami.ContextDrawer { id: contextDrawer } pageStack.initialPage: mainPageComponent Component { id: mainPageComponent App.TimelinePage {} } Component { id: pkpassComponent App.PkPassPage { pass: _pkpassManager.passObject(passId) } } Component { id: settingsComponent App.SettingsPage {} } }