diff --git a/harbour-berail.pro b/harbour-berail.pro index 5b82fb5..a32cbbc 100644 --- a/harbour-berail.pro +++ b/harbour-berail.pro @@ -85,7 +85,6 @@ DISTFILES += \ qml/pages/StationListPage.qml \ qml/pages/js/util.js \ qml/pages/DatePickerPage.qml \ - qml/pages/TripPage.qml \ qml/pages/components/TripItem.qml \ qml/pages/js/trip.js \ qml/pages/TripDetailPage.qml \ diff --git a/qml/pages/components/GlassButton.qml b/qml/components/GlassButton.qml similarity index 100% rename from qml/pages/components/GlassButton.qml rename to qml/components/GlassButton.qml diff --git a/qml/pages/components/TextLabel.qml b/qml/components/TextLabel.qml similarity index 92% rename from qml/pages/components/TextLabel.qml rename to qml/components/TextLabel.qml index 361eb52..fba6e37 100644 --- a/qml/pages/components/TextLabel.qml +++ b/qml/components/TextLabel.qml @@ -19,13 +19,11 @@ import QtQuick 2.2 import Sailfish.Silica 1.0 Label { - property string labelText anchors { left: parent.left; right: parent.right; leftMargin: Theme.horizontalPageMargin; rightMargin: Theme.horizontalPageMargin } font.pixelSize: Theme.fontSizeMedium wrapMode: Text.WordWrap - text: labelText Behavior on opacity { - FadeAnimation{} + FadeAnimation {} } } diff --git a/qml/harbour-berail.qml b/qml/harbour-berail.qml index c3a323c..76349de 100644 --- a/qml/harbour-berail.qml +++ b/qml/harbour-berail.qml @@ -17,10 +17,11 @@ import QtQuick 2.2 import Sailfish.Silica 1.0 -//import io.thp.pyotherside 1.3 -import org.nemomobile.configuration 1.0 +import Nemo.Configuration 1.0 +import Harbour.BeRail.API 1.0 +import Harbour.BeRail.Models 1.0 import "pages" -import "./pages/js/util.js" as Util +import "components" ApplicationWindow { @@ -30,9 +31,6 @@ ApplicationWindow allowedOrientations: Orientation.All _defaultPageOrientations: Orientation.All - readonly property string name: "BeRail" - readonly property string version: "1.1" - // Colors readonly property string blue: "#3f51b5" readonly property string red: "#f44336" @@ -44,58 +42,21 @@ ApplicationWindow readonly property string white: "#fffde7" readonly property string transparent: "transparent" - property bool pythonReady - // App settings ConfigurationGroup { id: settings path: "/apps/harbour-berail/settings" property bool rememberLiveboardStation: true - property bool favouriteStations - property int arriveFromGivenTime - property string lastLiveboardStation + property bool favouriteStationsEnabled property string favouriteDepartStation property string favouriteArriveStation + property string savedLiveboardStation } - /*Python { - id: python - property bool _networkWasLost - - Component.onCompleted: { - addImportPath(Qt.resolvedUrl("./backend")); //Add the import path for our QML/Python bridge 'app.py' - addImportPath(Qt.resolvedUrl("./backend/berail")); //Add import path for our backend module 'sailfinder' - importModule("platform", function() { //Add the right import path depending on the architecture of the processor - if (evaluate("platform.machine()") == "armv7l") { - console.info("[INFO] ARM processor detected") - addImportPath(Qt.resolvedUrl("./backend/lib/armv7l/")); - } else { - console.info("[INFO] x86 processor detected") - addImportPath(Qt.resolvedUrl("./backend/lib/i486/")); - } - importModule("app", function() {}); // Import "app" after we imported our platform specific modules - Util.updatePythonLocal() // When done, pythonReady will be TRUE - }); - - //Notify user of the current network state - setHandler("network", function (status) { - if(!status) - { - toaster.previewBody = qsTr("Network down") + "!" - toaster.publish() - _networkWasLost = true - } - else if (_networkWasLost) { - toaster.previewBody = qsTr("Network recovered") + "!" - toaster.publish() - _networkWasLost = false - } - }); - - } - onError: console.error("[ERROR] %1".arg(traceback)); - onReceived: console.info("[INFO] Message: " + JSON.stringify(data)); - }*/ + // iRail API + API { + id: api + } } diff --git a/qml/pages/AboutPage.qml b/qml/pages/AboutPage.qml index 3596937..a6f52cf 100644 --- a/qml/pages/AboutPage.qml +++ b/qml/pages/AboutPage.qml @@ -17,7 +17,7 @@ import QtQuick 2.2 import Sailfish.Silica 1.0 -import "./components" +import "../components" Page { SilicaFlickable { @@ -34,23 +34,66 @@ Page { PageHeader { title: qsTr("About %1 V%2").arg(app.name).arg(app.version) } SectionHeader { text: qsTr("What's %1 ?").arg(app.name) } - TextLabel { labelText: qsTr("%1 is an opensource application to plan your NMBS/SNCB railway journeys on your Sailfish OS smartphone!").arg(app.name) } + TextLabel { + text: qsTr("%1 is an opensource application to plan your NMBS/SNCB railway journeys on your Sailfish OS smartphone!").arg(app.name) + } SectionHeader { text: qsTr("Privacy & licensing") } - TextLabel { labelText: qsTr("%1 will never collect any personal information about the user, but this can't be guaranteed from any third-party company used in %1").arg(app.name) } - TextLabel { labelText: qsTr("This application is released under GPLv3. The source code and the license is available in the Github repo of %1").arg(app.name) } + TextLabel { + text: qsTr("%1 will never collect any personal information about the user, but this can't be guaranteed from any third-party company used in %1").arg(app.name) + } + TextLabel { + text: qsTr("This application is released under GPLv3. The source code and the license is available in the Github repo of %1").arg(app.name) + } SectionHeader { text: qsTr("Developer & source code") } - GlassButton { link: "https://github.com/modulebaan"; iconSource: "qrc:///icons/icon-github.png"; iconText: "Dylan Van Assche"; itemScale: 0.75 } - GlassButton { link: "https://paypal.me/minitreintje"; iconSource: "qrc:///icons/icon-paypal.png"; iconText: qsTr("Donate with %1").arg("PayPal"); itemScale: 0.75 } - GlassButton { link: "https://github.com/iRail/harbour-berail"; iconSource: "qrc:///icons/icon-code.png"; iconText: qsTr("Source code"); itemScale: 0.75 } - TextLabel { labelText: qsTr("%1 can be translated into your language but for that we need your help! You can translate this app on %2").arg(app.name).arg("Transifex:") } - GlassButton { link: "https://www.transifex.com/dylanvanassche/harbour-berail"; iconSource: "qrc:///icons/icon-translate.png"; iconText: qsTr("%1 project").arg("Transifex"); itemScale: 0.75 } + GlassButton { + link: "https://github.com/dylanvanassche" + iconSource: "qrc:///icons/icon-github.png" + iconText: "Dylan Van Assche" + itemScale: 0.75 + } + GlassButton { + link: "https://paypal.me/minitreintje" + iconSource: "qrc:///icons/icon-paypal.png" + iconText: qsTr("Donate with %1").arg("PayPal") + itemScale: 0.75 + } + GlassButton { + link: "https://github.com/iRail/harbour-berail" + iconSource: "qrc:///icons/icon-code.png" + iconText: qsTr("Source code") + itemScale: 0.75 + } + TextLabel { + text: qsTr("%1 can be translated into your language but for that we need your help! You can translate this app on %2").arg(app.name).arg("Transifex:") + } + GlassButton { + link: "https://www.transifex.com/dylanvanassche/harbour-berail" + iconSource: "qrc:///icons/icon-translate.png" + iconText: qsTr("%1 project").arg("Transifex") + itemScale: 0.75 + } SectionHeader { text: qsTr("Powered by") } - GlassButton { link: "http://irail.be/"; iconSource: "qrc:///icons/icon-irail.png"; iconText: "iRail"; itemScale: 0.75 } - GlassButton { link: "http://fontawesome.io/"; iconSource: "qrc:///icons/icon-fontawesome.png"; iconText: "FontAwesome icons"; itemScale: 0.75 } - GlassButton { link: "https://twitter.com/eLtMosen"; iconSource: "qrc:///icons/icon-twitter.png"; iconText: qsTr("Icon by %1").arg("Timo Könnecke"); itemScale: 0.75 } + GlassButton { + link: "https://irail.be/" + iconSource: "qrc:///icons/icon-irail.png" + iconText: "iRail" + itemScale: 0.75 + } + GlassButton { + link: "https://fontawesome.io/" + iconSource: "qrc:///icons/icon-fontawesome.png" + iconText: "FontAwesome icons" + itemScale: 0.75 + } + GlassButton { + link: "https://twitter.com/eLtMosen" + iconSource: "qrc:///icons/icon-twitter.png" + iconText: qsTr("Icon by %1").arg("Timo Könnecke") + itemScale: 0.75 + } } } } diff --git a/qml/pages/DatePickerPage.qml b/qml/pages/DatePickerPage.qml deleted file mode 100644 index f88004a..0000000 --- a/qml/pages/DatePickerPage.qml +++ /dev/null @@ -1,48 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 -import "./js/util.js" as Util - -Dialog { - property string dateText: datePicker.day + " " + Util.covertMonth(datePicker.month-1) + " " + datePicker.year - - Column { - width: parent.width - - DialogHeader { title: dateText; anchors {horizontalCenter: parent.horizontalCenter} } - - DatePicker { - id: datePicker - date: new Date() - delegate: MouseArea { - width: datePicker.cellWidth - height: datePicker.cellHeight - - onClicked: datePicker.date = new Date(year, month-1, day, 12, 0, 0) - - Label { - anchors.centerIn: parent - text: day - color: app.white - font.pixelSize: month === primaryMonth ? Theme.fontSizeMedium : Theme.fontSizeExtraSmall - } - } - } - } -} diff --git a/qml/pages/DisturbancesPage.qml b/qml/pages/DisturbancesPage.qml deleted file mode 100644 index ea240d7..0000000 --- a/qml/pages/DisturbancesPage.qml +++ /dev/null @@ -1,39 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 -import "./components" -import "./js/liveboard.js" as LiveBoard - -Page { - id: page - - property string station - property var alertsModel - - // Show detailed list of all alerts for this station - DisturbancesView { - height: parent.height - header: PageHeader { - title: qsTr("Disturbances") - description: station - } - model: alertsModel - showStation: false // Already visible in the header - } -} diff --git a/qml/pages/FirstPage.qml b/qml/pages/FirstPage.qml index b073fc6..5a22931 100644 --- a/qml/pages/FirstPage.qml +++ b/qml/pages/FirstPage.qml @@ -17,467 +17,7 @@ import QtQuick 2.2 import Sailfish.Silica 1.0 -import "./components" -import "./js/util.js" as Util -import "./js/disturbances.js" as Disturbances -import Harbour.BeRail.API 1.0 -import Harbour.BeRail.Models 1.0 Page { - id: page - - property string departureText: qsTr("From") - property string arriveText: qsTr("To") - property bool readyToPlan: departure.iconText != departureText && arrival.iconText != arriveText // Enable when the user added his stations - property bool hasAnnoucement: true - property bool succes: true - //property bool _loading: alertsModel.count==0 && succes - - signal _changeStations() - - on_ChangeStations: { - var temp = departure.iconText; - departure.iconText = arrival.iconText; - arrival.iconText = temp; - } - - Component.onCompleted: Util.getHours() > 12? _changeStations(): undefined // Switch stations when in the afternoon - - API { - id: iRail - onDisturbancesChanged: { - console.log("Disturbances received in QML: " + iRail.disturbances) - //alertsView.model = iRail.disturbances.alertsListModel - console.log(iRail.disturbances.alertListModel) - } - onConnectionsChanged: { - console.log("Connections received in QML") - connectionTest.model = iRail.connections - } - - /*onLiveboardChanged: { - console.log("Liveboard data from QML:") - console.log(iRail.liveboard.station.name); - console.log(iRail.liveboard.station.id); - console.log(iRail.liveboard.station.location); - } - onStationsChanged: { - console.log("Stations data from QML:") - for(var i =0; i<10; i++) { - console.log(iRail.stations[i]) - } - }*/ - onVehicleChanged: { - console.log("Vehicle data from QML:") - console.log(iRail.vehicle.id) - console.log(iRail.vehicle.date) - console.log(iRail.vehicle.canceled) - console.log(iRail.vehicle.occupancy) - console.log(iRail.disturbances.alertsListModel) - vehicleTest.model = iRail.vehicle.stopListModel - myVehiclestop.model = iRail.vehicle.stopListModel; - if(iRail.vehicle.occupancy == IRail.Unknown) { - console.log("Unknown occupancy") - } - - } - - onLiveboardChanged: { - console.log("Liveboard data from QML:") - console.log(iRail.liveboard.station.name) - console.log(iRail.liveboard.alertListModel) - console.log(iRail.liveboard.vehicleListModel) - //liveboardTest.model = iRail.liveboard.vehicleListModel; - //insidelist.model = iRail.liveboard.vehicleListModel.get(0).stops; - vehicleTest2.model = iRail.liveboard.vehicleListModel; - } - - onNetworkStateChanged: console.log("Network state: " + state) - onBusyChanged: console.log("busy changed") - Component.onCompleted: { - iRail.getConnections("Mechelen", "Brugge", IRail.Departure, new Date(), IRail.All) - iRail.getDisturbances() - iRail.getVehicle("BE.NMBS.S11757", new Date()) - iRail.getStations() - iRail.getLiveboard("Vilvoorde", new Date(), IRail.Departure) - } - - onStationsChanged: { - stationTest.model = iRail.stations; - } - } - - SilicaListView { - id: connectionTest - anchors.fill: parent - delegate: ListItem { - id: connectioNDelegate - width: ListView.view.width - height: connectionColumn.height - property var disturbancesModelVar: model.vias // reference of the inner model is lost without this - Component.onCompleted: console.log("Vias model:" + model.vias) - Column { - id: connectionColumn - Label { - text: model.from.station.name - } - Label { - text: model.to.station.name - } - SilicaListView { - anchors.left: parent.left - anchors.right: parent.right - height: Theme.itemSizeExtraLarge*3 - model: connectioNDelegate.disturbancesModelVar - delegate: Label { - text: model.station.name - color: "red" - } - } - } - } - } - - - /*SilicaListView { - // LIVEBOARD DATA (VehicleListModel) - id: vehicleTest2 - anchors.fill: parent - delegate: ListItem { - id: delegate2 - width: ListView.view.width - height: vehicleColumn.height - property var stoplistModelVar: model.stops // reference of the inner model is lost without this - Column { - id: vehicleColumn - Label { - text: index - } - Label { - text: model.timestamp - } - Label { - text: model.canceled - } - - SilicaListView { - anchors.left: parent.left - anchors.right: parent.right - height: Theme.itemSizeExtraLarge*3 - model: delegate2.stoplistModelVar - delegate: Label { - text: model.station.name - } - } - } - } - }*/ - - /*SilicaListView { - id: connectionTest - anchors.fill: parent - delegate: ListItem { - width: ListView.view.width - height: Theme.itemSizeExtraLarge*2 - Column { - Label {text: model.id} - Label {text: model.from.station.name} - Label {text: model.to.station.name} - } - } - onModelChanged: console.log(count) - }*/ - - - /*SilicaListView { - id: stationTest - anchors.fill: parent - delegate: ListItem { - width: ListView.view.width - height: Theme.itemSizeExtraLarge*2 - Column { - Label {text: model.id} - Label {text: model.name} - } - } - onModelChanged: console.log(count) - }*/ - - /*SilicaListView { - id: vehicleTest - anchors.fill: parent - delegate: ListItem { - id: mydelegateIndexshit - width: ListView.view.width - height: mydelegate.height + Theme.itemSizeExtraLarge - - Column { - id: mydelegate - Label {text: model.platform} - Label {text: model.departureDelay/60} - Label {text: model.scheduledDepartureTime} - Label {text: model.left} - Label {text: model.station.name} - Label {text: "INDEX=" + index} - Repeater { - id: myVehiclestop - width: parent.width - height: Theme.itemSizeExtraLarge*2 - model: model.getStops(mydelegateIndexshit.index) - Label {text: model.id} - onModelChanged: console.log("Innermodel=" + count) - } - } - } - onModelChanged: console.log(count) - }*/ - - /*SilicaListView { - id: liveboardTest - anchors.fill: parent - delegate: ListItem { - width: ListView.view.width - height: Theme.itemSizeExtraLarge*2 - /*Column { - Label {text: model.id} - SilicaListView { - anchors.fill: parent; - model: liveboardTest.model.stops - } - - Label {text: model.timestamp} - Label {text: model.canceled} - }*/ - - /*ListView { - anchors.fill: parent; - model: liveboardTest.model.stops - delegate: ListItem { - width: ListView.view.width - height: Theme.itemSizeExtraLarge - Label { - text: model.station.name - } - Label { - text: model.platform - } - - Component.onCompleted: console.log(model.station.name) - - } - onModelChanged: console.log(count) - } - - Column { - - Label { - text: model.id - } - - Repeater { - id: stopsTest - model: liveboardTest.model.stops - onModelChanged: console.log("STOPS MODEL COUNT=" + count) - } - } - } - onModelChanged: stopsTest.model = model.stops - }*/ - - /*ListModel { - id: fruitModel - - ListElement { - name: "Apple" - cost: 2.45 - } - ListElement { - name: "Orange" - cost: 3.25 - } - ListElement { - name: "Banana" - cost: 1.95 - } - } - - - Component { - id: delegate2 - - Item { - width: 100 - height: col2.childrenRect.height - - Column { - id: col2 - anchors.left: parent.left - anchors.right: parent.right - Text { - id: name1 - text: model.name - color: "green" - } - } - } - } - - - /*SilicaFlickable { - anchors { fill: parent } - contentHeight: column.height - - PullDownMenu { - busy: _loading - - MenuItem { - text: qsTr("About") - onClicked: pageStack.push(Qt.resolvedUrl("AboutPage.qml")) - enabled: !_loading - } - - MenuItem { - text: qsTr("Settings") - onClicked: pageStack.push(Qt.resolvedUrl("SettingsPage.qml")) - enabled: !_loading - } - - MenuItem { - text: qsTr("Liveboard") - onClicked: pageStack.push(Qt.resolvedUrl("LiveboardPage.qml")) - enabled: !_loading - } - } - - Column { - id: column - width: page.width - spacing: Theme.paddingLarge - - PageHeader { - title: qsTr("BeRail") - description: qsTr("The official iRail app") - - BusyIndicator { - anchors { verticalCenter: parent.verticalCenter; left: parent.left; leftMargin: Theme.horizontalPageMargin } - size: BusyIndicatorSize.Small - running: _loading - } - } - - Row { - width: parent.width - Column { - width: parent.width-Theme.itemSizeMedium - GlassButton { - id: departure - link: Qt.resolvedUrl("StationListPage.qml") - type: 1 - iconSource: "qrc:///icons/icon-train.png" - iconText: settings.favouriteStations? settings.favouriteDepartStation: departureText - itemScale: 0.75 - } - GlassButton { - id: arrival - link: Qt.resolvedUrl("StationListPage.qml") - type: 1 - iconSource: "qrc:///icons/icon-train.png" - iconText: settings.favouriteStations? settings.favouriteArriveStation: arriveText - itemScale: 0.75 - } - } - BackgroundItem { - width: Theme.itemSizeMedium - height: parent.height - enabled: readyToPlan - opacity: enabled? 1.0: 0.25 - onClicked: _changeStations() - - Image { - width: Theme.itemSizeSmall/1.75 - height: width - anchors { centerIn: parent } - rotation: 180 - source: "qrc:///icons/icon-switch.png" - asynchronous: true - } - } - } - - Row { - width: parent.width - ValueButton { - id: date - width: parent.width/1.75 - label: qsTr("Date") - value: Util.getDay(true) + " " + Util.getMonth() + " " + Util.getYear().toString().substr(2,2) //Get last 2 digits of the year - onClicked: { - var dialog = pageStack.push(Qt.resolvedUrl("DatePickerPage.qml"), {}) - - dialog.accepted.connect(function() { - var temp; // format for iRail API - temp = dialog.dateText.split(" "); - value = Util.addLeadingZero(temp[0]) + " " + Util.addLeadingZero(temp[1]) + " " + temp[2].toString().substr(2,2); - }) - } - } - - ValueButton { - id: time - width: parent.width/2.25 - label: qsTr("Time") - value: Util.getHours(true) + ":" + Util.getMinutes(true) - onClicked: { - var dialog = pageStack.push("Sailfish.Silica.TimePickerDialog", { - hour: Util.getHours(), - minute: Util.getMinutes() - }) - - dialog.accepted.connect(function() { - value = dialog.timeText - }) - } - } - } - - Button { - anchors { horizontalCenter: parent.horizontalCenter } - text: qsTr("Plan my trip") - enabled: readyToPlan - onClicked: pageStack.push(Qt.resolvedUrl("TripPage.qml"), { - from: departure.iconText, - to: arrival.iconText, - time: time.value, - date: date.value - }) - } - - - DisturbancesView { - id: alertsView - //model: iRail.getDisturbances() //alertsModel - } - - SilicaListView { - id: vehicleTest - width: parent.width - delegate: Item { - width: ListView.view.width - height: Theme.itemSizeSmall - Column { - Label {text: model.platform} - Label {text: model.departureDelay} - Label {text: model.scheduledDepartureTime} - Label {text: model.left} - } - } - onModelChanged: console.log(count) - } - - ListModel { - id: alertsModel - } - } - }*/ } diff --git a/qml/pages/LiveboardPage.qml b/qml/pages/LiveboardPage.qml deleted file mode 100644 index fdf3c46..0000000 --- a/qml/pages/LiveboardPage.qml +++ /dev/null @@ -1,195 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 -import "./components" -import "./js/liveboard.js" as LiveBoard - -Page { - id: page - property string station: settings.lastLiveboardStation - property string currentTime: LiveBoard.getTimeString() - property bool succes: true - property bool _firstLaunch: settings.lastLiveboardStation.length == 0 - property bool _loading: liveboardModel.count==0 && succes && !_firstLaunch - - on_FirstLaunchChanged: _firstLaunch? hint.start(): hint.stop() - - onStationChanged: { - LiveBoard.load(station) - settings.rememberLiveboardStation? settings.lastLiveboardStation = station: undefined // Only save when activated in settings - _firstLaunch = false - } - - Timer { // Update the clock - running: Qt.application.active - onTriggered: currentTime = LiveBoard.getTimeString() - interval: 500 - triggeredOnStart: true - repeat: true - } - - SilicaListView { - id: departureList - width: parent.width; height: parent.height - model: liveboardModel - header: Rectangle { - color: app.blue - width: parent.width - height: Theme.itemSizeHuge*1.2 - - // Station name - Label { - id: stationLabel - width: parent.width - anchors { left: parent.left; right: parent.right; top: parent.top; topMargin: Theme.paddingLarge; leftMargin: Theme.horizontalPageMargin; rightMargin: Theme.horizontalPageMargin } - font.pixelSize: Theme.fontSizeHuge - font.bold: true - truncationMode: TruncationMode.Fade - horizontalAlignment: Text.AlignHCenter - text: _firstLaunch? qsTr("Liveboard"): station - } - - // Time - Label { - anchors { left: parent.left; leftMargin: Theme.horizontalPageMargin; verticalCenter: alertsButton.verticalCenter } //bottom: parent.bottom; bottomMargin: Theme.paddingMedium } - font.bold: true - truncationMode: TruncationMode.Fade - horizontalAlignment: Text.AlignLeft - text: currentTime - } - - // Alerts indicator - BackgroundItem { - id: alertsButton - width: Theme.itemSizeLarge - anchors { bottom: parent.bottom; bottomMargin: Theme.paddingMedium; right: parent.right; rightMargin: Theme.horizontalPageMargin } - onClicked: pageStack.push("DisturbancesPage.qml", { alertsModel: alertsModel, station: station }); - visible: alertsModel.count - - Label { - id: alertsLabel; - anchors { right: alertsIcon.left; rightMargin: Theme.paddingMedium; verticalCenter: parent.verticalCenter } - text: alertsModel.count - } - - Image { - id: alertsIcon - width: Theme.iconSizeSmall - height: width - anchors { right: parent.right; rightMargin: Theme.horizontalPageMargin; verticalCenter: parent.verticalCenter} - source: "qrc:///icons/icon-announcement.png" - asynchronous: true - } - } - } - - PullDownMenu { - busy: _loading - - MenuItem { - text: qsTr("Change station") - enabled: !_loading - onClicked: { - var _page = pageStack.push("StationListPage.qml"); - _page.finished.connect(function(newStation) { - station = newStation; - }); - } - } - - MenuItem { - text: qsTr("Disturbances (%1)").arg(alertsModel.count ) - visible: alertsModel.count > 0 - enabled: !_loading - onClicked: pageStack.push("DisturbancesPage.qml", { alertsModel: alertsModel, station: station }); - } - } - - // Error occured - ViewPlaceholder { - enabled: !succes - text: qsTr("Oops!") - hintText: qsTr("No data available") - } - - // When no data, show a hint and a placeholder - InteractionHintLabel { - anchors.bottom: parent.bottom - opacity: _firstLaunch ? 1.0 : 0.0 - Behavior on opacity { FadeAnimation {} } - text: qsTr("Select a station") - } - - TouchInteractionHint { - id: hint - loops: Animation.Infinite - direction: TouchInteraction.Down - } - - delegate: ListItem { - width: ListView.view.width - contentHeight: item.height - enabled: false // Disabled temporaly until intermediate stops are ready - LiveBoardItem { - id: item - departTime: model.depart.time.time - announcements: ["From Saturday 29/04 to 1/05, trains will not stop at Brussels-Central station following works between Brussels-Nord and Brussels-Midi. There will be major changes to the train service. Alternative train service Bruxelles-Nord/Brussel-Noord - Bruxelles-Midi/Brussel-Zuid"] - trainName: model.depart.station - trainType: model.depart.train - trackChanged: model.depart.platformChanged - trainCanceled: model.depart.canceled - modelHasDelay: model.hasDelay - delay: model.depart.delay - track: model.depart.platform - } - - Rectangle { - id: background - z:-1 // Make ListItem Highlight visible - color: index%2? app.black: app.grey - anchors { fill: parent } - } - onClicked: { - if(!item.canceled) { - pageStack.push(Qt.resolvedUrl("TripDetailPage.qml")) - } - } - } - - // Show detailed list of all alerts for this station - DisturbancesView { // TO DO: Move to seperate page or something - id: alertsView - anchors { top: departureList.bottom; topMargin: Theme.paddingLarge } - model: alertsModel - } - } - - LoadIndicator { - anchors { fill: parent } - show: _loading - } - - ListModel { - id: liveboardModel - } - - ListModel { - id: alertsModel - } -} diff --git a/qml/pages/SettingsPage.qml b/qml/pages/SettingsPage.qml deleted file mode 100644 index b1814c2..0000000 --- a/qml/pages/SettingsPage.qml +++ /dev/null @@ -1,105 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 -import "./components" -import "./js/util.js" as Util - -Page { - - Component.onDestruction: { // Save the values when user is done - settings.rememberLiveboardStation = rememberLiveboardStation.checked - if(!rememberLiveboardStation.checked) { // reset to default - settings.lastLiveboardStation = "" - } - settings.favouriteStations = favouriteStations.checked - settings.favouriteDepartStation = favouriteStations.checked? favouriteDepartStation.iconText: "" // reset to default - settings.favouriteArriveStation = favouriteStations.checked? favouriteArriveStation.iconText: "" // reset to default - settings.arriveFromGivenTime = arriveFromGivenTime.currentIndex - } - - SilicaFlickable { - anchors.fill: parent - contentHeight: settingsColumn.height - - VerticalScrollDecorator {} - - Column { - id: settingsColumn - width: parent.width - spacing: Theme.paddingLarge - - PageHeader { title: qsTr("Settings") } - - SectionHeader { text: qsTr("Routeplanner") } - - ComboBox { - id: arriveFromGivenTime - width: parent.width - label: qsTr("Time is") - menu: ContextMenu { - MenuItem { text: qsTr("departure") } - MenuItem { text: qsTr("arrival") } - } - currentIndex: settings.arriveFromGivenTime - description: qsTr("Select here if you want to use the given time as either the time of arrival or departure.") - } - - TextSwitch { - id: favouriteStations - text: qsTr("Enable favourite stations") - description: qsTr("Travelling from/to work or school? Then is this option for you! Select your favourite stations below.") - checked: settings.favouriteStations - } - - GlassButton { - id: favouriteDepartStation - link: Qt.resolvedUrl("StationListPage.qml") - type: 1 - iconSource: "qrc:///icons/icon-train.png" - iconText: settings.favouriteDepartStation.length > 0? settings.favouriteDepartStation: qsTr("From") - itemScale: 0.75 - enabled: favouriteStations.checked - opacity: enabled? 1.0: 0.2 - - Behavior on opacity { FadeAnimation {} } - } - GlassButton { - id: favouriteArriveStation - link: Qt.resolvedUrl("StationListPage.qml") - type: 1 - iconSource: "qrc:///icons/icon-train.png" - iconText: settings.favouriteArriveStation.length > 0? settings.favouriteArriveStation: qsTr("To") - itemScale: 0.75 - enabled: favouriteStations.checked - opacity: enabled? 1.0: 0.2 - - Behavior on opacity { FadeAnimation {} } - } - - SectionHeader { text: qsTr("Liveboard") } - - TextSwitch { - id: rememberLiveboardStation - text: qsTr("Remember liveboard station") - description: qsTr("Save time by automatically saving your last used station!") - checked: settings.rememberLiveboardStation - } - } - } -} diff --git a/qml/pages/StationListPage.qml b/qml/pages/StationListPage.qml deleted file mode 100644 index d213e48..0000000 --- a/qml/pages/StationListPage.qml +++ /dev/null @@ -1,167 +0,0 @@ -/* - This file is part of BeRail. - - It's a modified version of the Jolla searchPage example included in the Sailfish SDK. - The examples are released under the following license: - - Copyright (C) 2013 Jolla Ltd. - Contact: Thomas Perl - All rights reserved. - You may use this file under the terms of BSD license as follows: - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * Neither the name of the Jolla Ltd nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR - ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 -import "./js/util.js" as Util - -Page { - id: searchPage - property string searchString - property bool keepSearchFieldFocus - signal finished(string station) - onFinished: pageStack.pop() - - onSearchStringChanged: listModel.update() - Component.onCompleted: listModel.update() - - Loader { - anchors.fill: parent - sourceComponent: listViewComponent - } - - Column { - id: headerContainer - width: searchPage.width - - PageHeader { title: qsTr("Stations") } - - SearchField { - id: searchField - width: parent.width - - Binding { - target: searchPage - property: "searchString" - value: searchField.text.toLowerCase().trim() - } - } - } - - Component { - id: listViewComponent - SilicaListView { - model: listModel - anchors.fill: parent - currentIndex: -1 // otherwise currentItem will steal focus - header: Item { - id: header - width: headerContainer.width - height: headerContainer.height - Component.onCompleted: headerContainer.parent = header - } - - delegate: BackgroundItem { - id: backgroundItem - onClicked: finished(model.name) - - ListView.onAdd: AddAnimation { - target: backgroundItem - } - ListView.onRemove: RemoveAnimation { - target: backgroundItem - } - - Label { - x: searchField.textLeftMargin - anchors.verticalCenter: parent.verticalCenter - color: searchString.length > 0 ? (highlighted ? Theme.secondaryHighlightColor : Theme.secondaryColor) - : (highlighted ? Theme.highlightColor : Theme.primaryColor) - textFormat: Text.StyledText - text: Theme.highlightText(model.name, searchString, Theme.highlightColor) - } - } - - VerticalScrollDecorator {} - - Component.onCompleted: { - if (keepSearchFieldFocus) { - searchField.forceActiveFocus() - } - keepSearchFieldFocus = false - } - } - } - - ListModel { - id: listModel - - // Static is needed to avoid load times, maybe an other method is better - property var stations: { - "EN": ['Aachen Hbf', 'Aalst', 'Aalst-Kerrebroek', 'Aalter', 'Aarschot', 'Aarsele', 'Acren', 'Agde', 'Aime-la-Plagne', 'Aiseau', 'Aix-en-Provence TGV', 'Albertville', 'Alken', 'Amay', 'Ampsin', 'Amsterdam CS', 'Andenne', 'Angleur', 'Annappes', 'Ans', 'Anseremme', 'Antibes', 'Antoing', 'Antwerp-Berchem', 'Antwerp-Central', 'Antwerp-East', 'Antwerp-Haven', 'Antwerp-Luchtbal', 'Antwerp-Noorderdokken', 'Antwerp-South', 'Anzegem', 'Appelterre', 'Arcaden/Arcades', 'Archennes', 'Arlon', 'Ascq', 'Asse', 'Assesse', 'Ath', 'Athus', 'Aubange', 'Auvelais', 'Avignon TGV', 'Aye', 'Aywaille', 'Aéroport Charles-de-Gaulle TGV', 'Baasrode-Zuid', 'Baisieux', 'Balegem-Dorp', 'Balegem-Zuid', 'Balen', 'Bambrugge', 'Barvaux', 'Bas-Oha', 'Basel', 'Basse-Wavre', 'Bastogne-Nord', 'Bastogne-Sud', 'Beauraing', 'Beernem', 'Beersel', 'Beervelde', 'Begijnendijk', 'Beignée', 'Bellem', 'Belsele', 'Beringen', 'Berlaar', 'Bertrange Strassen', 'Bertrix', 'Berzée', 'Beuzet', 'Beveren', 'Beverlo', 'Bierges-Walibi', 'Bierset-Awans', 'Bilzen', 'Binche', 'Bissegem', 'Blankenberge', 'Blanmont', 'Blaton', 'Bleret', 'Bockstael', 'Boechout', 'Bokrijk', 'Bomal', 'Booischot', 'Boom', 'Boondaal/Boondael', 'Boortmeerbeek', 'Bordet', 'Bornem', 'Bosvoorde/Boitsfort', 'Bourg-Saint-Maurice', 'Boussu', 'Bouwel', 'Bracquegnies', "Braine-l'Alleud", 'Braine-le-Comte', 'Bressoux', 'Brugelette', 'Brugge', 'Brugge-Sint-Pieters', 'Brussels Airport - Zaventem', 'Brussels-Central', 'Brussels-Chapelle/Brussels-Kapellekerk', 'Brussels-Congres', 'Brussels-Luxemburg/Brussels-Luxembourg', 'Brussels-North', 'Brussels-Schuman', 'Brussels-South/Brussels-Midi', 'Brussels-West', 'Buda', 'Buggenhout', 'Buizingen', 'Burst', 'Béziers', 'Callenelle', 'Cambron-Casteau', 'Cannes', 'Capellen', 'Carlsbourg', 'Carnieres', 'Ceroux-Mousty', 'Chambéry-Challes-les-Eaux', 'Chapelle-Dieu', 'Chapois', 'Charleroi-Ouest', 'Charleroi-Sud', 'Chastre', 'Château-de-Seilles', 'Châtelet', 'Chênée', 'Ciney', 'Clervaux', 'Colmar', 'Comblain-la-Tour', 'Comines', 'Coo', 'Couillet', 'Cour-sur-Heure', 'Courcelles-Motte', 'Courrière', 'Court-Saint-Étienne', 'Couvin', 'Croix Wasquehal', "Croix l'Allumette", 'Dave-Saint-Martin', 'De Hoek', 'De Panne', 'De Pinte', 'Deinze', 'Delta', 'Den Haag HS', 'Denderleeuw', 'Dendermonde', 'Diegem', 'Diepenbeek', "Diesdelle/Vivier d'Oie", 'Diest', 'Diksmuide', 'Dilbeek', 'Dinant', 'Dolhain-Gileppe', 'Dordrecht', 'Dortmund Hbf', 'Drauffelt', 'Drongen', 'Duffel', 'Duinbergen', 'Duisburg Hbf', 'Düsseldorf Flughafen Hbf', 'Düsseldorf Hbf', 'Ebbsfleet International', 'Ede', 'Eeklo', 'Eichem', 'Eijsden', 'Eine', 'Eke-Nazareth', 'Ekeren', 'Enghien', 'Engis', 'Eppegem', 'Erbisoeul', 'Erembodegem', 'Ernage', 'Erpe-Mere', 'Erps-Kwerps', 'Erquelinnes', 'Erquelinnes-Village', 'Esneux', 'Essen', 'Essen Hbf', 'Essene-Lombeek', 'Ettelbréck', 'Etterbeek', 'Eupen', 'Evere', 'Evergem', 'Ezemaal', 'Familleureux', 'Farciennes', 'Faux', 'Fexhe-le-Haut-Clocher', 'Flawinne', 'Flemalle-Grande', 'Flemalle-Haute', 'Fleurus', 'Floreffe', 'Florenville', 'Florival', 'Florée', 'Fontaine-Valmont', 'Forchies', 'Forrières', 'Fraipont', 'Frameries', 'Franchimont', 'Franière', 'Frankfurt am Main Airport', 'Frankfurt am Main Hbf', 'Froyennes', 'Galmaarden', 'Gastuche', 'Gavere-Asper', 'Gedinne', 'Geel', 'Gembloux', 'Gendron-Celles', 'Genk', 'Genly', 'Gentbrugge', 'Genval', 'Geraardsbergen', 'Ghent-Dampoort', 'Ghent-Sint-Pieters', 'Ghlin', 'Glons', 'Godarville', 'Godinne', 'Gontrode', 'Gouvy', 'Gouy-lez-Pieton', 'Graide', 'Groenendaal', 'Groot-Bijgaarden', 'Grupont', 'Haacht', 'Haaltert', 'Habay', 'Hainin', 'Halanzy', 'Halle', 'Ham-sur-Heure', 'Ham-sur-Sambre', 'Hambos', 'Hamoir', 'Hamont', 'Hansbeke', 'Harchies', 'Harelbeke', 'Haren', 'Haren-Sud/Haren-Zuid', 'Hasselt', 'Haute-Flône', 'Haute-Picardie TGV', 'Haversin', 'Havre', 'Heide', 'Heist', 'Heist-op-den-Berg', 'Heizijde', 'Hellemmes', 'Hemiksem', 'Hennuyères', 'Herent', 'Herentals', 'Hergenrath', 'Herne', 'Herseaux', 'Herstal', 'Herzele', 'Heusden', 'Hever', 'Heverlee', 'Hillegem', 'Hoboken-Polder', 'Hoeilaart', 'Hofstade', 'Holleken', 'Hony', 'Houraing', 'Hourpes', 'Houyet', 'Hove', 'Huizingen', 'Huy', 'Iddergem', 'Idegem', 'Ieper', 'Ingelmunster', 'Izegem', 'Jambes', 'Jambes-Est', 'Jamioulx', 'Jemappes', 'Rochefort-Jemelle', 'Jemeppe-sur-Meuse', 'Jemeppe-sur-Sambre', 'Jette', 'Jurbeke', 'Juslenville', 'Kalmthout', 'Kapelle-op-den-Bos', 'Kapellen', 'Kautebaach', 'Kessel', 'Kiewit', 'Kijkuit', 'Klengbetten', 'Knokke', 'Koksijde', 'Kontich-Lint', 'Kortemark', 'Kortenberg', 'Kortrijk', 'Kwatrecht', 'Köln Hbf', 'La Hulpe', 'La Louvière-Centre', 'La Louvière-Sud', 'La Roche (Brabant)', 'Labuissière', 'Landegem', 'Landelies', 'Landen', 'Landry', 'Landskouter', 'Langdorp', 'Le Campinaire', 'Lebbeke', 'Lede', 'Leignon', 'Leman', 'Lembeek', 'Lens', 'Leopoldsburg', 'Les Arcs - Draguignan', 'Lessines', 'Leuven', 'Leuze', 'Leval', 'Lezennes', 'Libramont', 'Lichtervelde', 'Liedekerke', 'Lier', 'Lierde', 'Liers', 'Ligny', 'Lille Europe', 'Lille Flandres', 'Lillois', 'Limal', 'Limburg Süd', 'Linkebeek', 'Lissewege', 'Liège-Guillemins', 'Liège-Jonfosse', 'Liège-Palais', 'Lobbes', 'Lodelinsart', 'Lokeren', 'Lommel', 'Londerzeel', 'London Saint Pancras International', 'Lonzée', 'Lot', 'Louvain-la-Neuve-Université', 'Lustin', 'Luttre', 'Lyon Part Dieu TGV', 'Lyon-Perrache TGV', 'Lyon-Saint Exupéry TGV', 'Lëtzebuerg', 'Maastricht', 'Maastricht Randwyck', 'Maffle', 'Malderen', 'Mamer', 'Mamer-Lycée', 'Manage', 'Marbehan', 'Marche-en-Famenne', 'Marche-les-Dames', 'Marche-lez-Écaussinnes', 'Marchienne-Zone', 'Marchienne-au-Pont', 'Maria-Aalter', 'Mariembourg', 'Marloie', 'Marne-la-Vallée - Chessy', 'Marseille-Saint-Charles', 'Masnuy-Saint-Pierre', 'Maubray', 'Mazy', 'Mechelen', 'Mechelen-Nekkerspoel', 'Meiser', 'Melkouwen', 'Melle', 'Melreux-Hotton', 'Melsele', 'Menen', 'Merchtem', 'Merelbeke', 'Merode', 'Mersch', 'Messancy', 'Metz', 'Mevergnies-Attre', 'Michelau', 'Milmort', 'Moensberg', 'Mol', 'Mollem', 'Momalle', 'Mons', 'Mont-Saint-Guibert', 'Montpellier', 'Moortsele', 'Morlanwelz', 'Mortsel', 'Mortsel-Deurnesteenweg', 'Mortsel-Liersesteenweg', 'Mortsel-Oude God', 'Mouscron', 'Moustier', 'Mouterij', 'Moûtiers-Salins-Brides-les-Bai', 'Muizen', 'Mulhouse', 'Munkzwalm', 'Méry', 'Namur', 'Namêche', 'Naninne', 'Narbonne', 'Natoye', 'Neerpelt', 'Neerwinden', 'Nessonvaux', 'Neufchâteau', 'Neufvilles', 'Nice Ville', 'Niel', 'Nieuwkerken-Waas', 'Nijlen', 'Nimy', 'Ninove', 'Nivelles', 'Noorderkempen', 'Nossegem', 'Nîmes', 'Obaix-Buzet', 'Obourg', 'Okegem', 'Olen', 'Oostende', 'Oostkamp', 'Opwijk', 'Ottignies', 'Oud-Heverlee', 'Oudegem', 'Oudenaarde', 'Overpelt', 'Paliseul', 'Papignies', 'Paris Nord', 'Pepinster', 'Pepinster-Cité', 'Perpignan', 'Philippeville', 'Piéton', 'Poix-Saint-Hubert', 'Pont de Bois', 'Pont-de-Seraing', 'Pont-à-Celles', 'Poperinge', 'Poulseur', 'Profondsart', 'Pry', 'Puurs', 'Pécrot', 'Péruwelz', 'Quaregnon', 'Quevy', 'Quievrain', 'Rebaix', 'Remicourt', 'Rhisnes', 'Rivage', 'Rixensart', 'Rodange', 'Roeselare', 'Ronet', 'Ronse', 'Roosendaal', 'Rotterdam CS', 'Roubaix', 'Roux', 'Ruisbroek', 'Ruisbroek-Sauvegarde', 'Saint-Denis-Bovesse', 'Saint-Ghislain', 'Saint-Louis-Haut-Rhin', 'Saint-Raphaël-Valescure', 'Sart-Bernard', 'Saverne', 'Schaarbeek/Schaerbeek', 'Scheldewindeke', 'Schelle', 'Schellebelle', 'Schendelbeke', 'Schiphol', 'Schoonaarde', 'Schulen', 'Sclaigneaux', 'Sclessin', 'Selestat', 'Serskamp', 'Siegburg', 'Silly', 'Simonis', 'Sinaai', 'Sint-Agatha-Berchem/Berchem-Sainte-Agathe', 'Sint-Denijs-Boekel', 'Sint-Genesius-Rode', 'Sint-Gillis-Dendermonde', 'Sint-Job', 'Sint-Joris-Weert', 'Sint-Katelijne-Waver', 'Sint-Mariaburg', 'Sint-Martens-Bodegem', 'Sint-Niklaas', 'Sint-Truiden', 'Sleidinge', 'Soignies', 'Solre-sur-Sambre', 'Spa', 'Spa-Géronstère', 'Statte', 'Stockem', 'Strasbourg', 'Sy', 'Sète', 'Tamines', 'Temse', 'Terhagen', 'Ternat', 'Testelt', 'Theux', 'Thieu', 'Thionville', 'Thuin', 'Thulin', 'Thurn en Taxis', 'Tielen', 'Tielt', 'Tienen', 'Tilff', 'Tilly', 'Tollembeek', 'Tongeren', 'Torhout', 'Toulon', 'Tourcoing', 'Tournai', 'Trois-Ponts', 'Troisvierges', 'Trooz', 'Tubize', 'Turnhout', 'Ukkel-Kalevoet/Uccle-Calevoet', 'Ukkel-Stalle/Uccle-Stalle', 'Valence TGV', 'Veltem', 'Vertrijk', 'Verviers-Central', 'Verviers-Palais', 'Veurne', 'Viane-Moerbeke', 'Vichte', 'Vielsalm', 'Vijfhuizen', 'Ville-Pommerœul', 'Villers-la-Ville', 'Vilvoorde', 'Virton', 'Visé', 'Viville', 'Voroux', 'Vorst-Oost/Forest-Est', 'Vorst-Zuid/Forest-Midi', 'Waarschoot', 'Walcourt', 'Waregem', 'Waremme', 'Waterloo', 'Watermaal/Watermael', 'Wavre', 'Weerde', 'Welkenraedt', 'Welle', 'Wervik', 'Wespelaar-Tildonk', 'Wetteren', 'Wevelgem', 'Wezemaal', 'Wichelen', 'Wijgmaal', 'Wildert', 'Willebroek', 'Wilwerwiltz', 'Wolfstee', 'Wondelgem', 'Yves-Gomezée', 'Yvoir', 'Zandbergen', 'Zaventem', 'Zedelgem', 'Zeebrugge-Dorp', 'Zeebrugge-Strand', 'Zele', 'Zellik', 'Zichem', 'Zingem', 'Zolder', 'Zonhoven', 'Zottegem', 'Zwankendamme', 'Zwijndrecht', 'Ecaussinnes'], - "NL": ["'s Gravenbrakel", 'Aalst', 'Aalst-Kerrebroek', 'Aalter', 'Aarlen', 'Aarschot', 'Aarsele', 'Aat', 'Agde', 'Aime-la-Plagne', 'Aiseau', 'Aix-en-Provence TGV', 'Aken Hbf', 'Akren', 'Albertville', 'Alken', 'Amay', 'Ampsin', 'Amsterdam CS', 'Andenne', 'Angleur', 'Annappes', 'Ans', 'Anseremme', 'Antibes', 'Antoing', 'Antwerpen-Berchem', 'Antwerpen-Centraal', 'Antwerpen-Haven', 'Antwerpen-Luchtbal', 'Antwerpen-Noorderdokken', 'Antwerpen-Oost', 'Antwerpen-Zuid', 'Anzegem', 'Appelterre', 'Arcaden', 'Ascq', 'Asse', 'Assesse', 'Athus', 'Aubange', 'Auvelais', 'Avignon TGV', 'Aye', 'Aywaille', 'Aéroport Charles-de-Gaulle TGV', 'Baasrode-Zuid', 'Baisieux', 'Balegem-Dorp', 'Balegem-Zuid', 'Balen', 'Bambrugge', 'Barvaux', 'Bas-Oha', 'Basse-Wavre', 'Bastenaken-Noord', 'Bastenaken-Zuid', 'Bazel', 'Beauraing', 'Beernem', 'Beersel', 'Beervelde', 'Begijnendijk', 'Beignée', 'Bellem', 'Belsele', 'Bergen', 'Beringen', 'Berlaar', 'Bertrange Strassen', 'Bertrix', 'Berzée', 'Beuzet', 'Beveren', 'Beverlo', 'Bierges-Walibi', 'Bierset-Awans', 'Bilzen', 'Binche', 'Bissegem', 'Blankenberge', 'Blanmont', 'Blaton', 'Bleret', 'Bockstael', 'Boechout', 'Bokrijk', 'Bomal', 'Booischot', 'Boom', 'Boondaal', 'Boortmeerbeek', 'Bordet', 'Borgworm', 'Bornem', 'Bosvoorde', 'Bourg-Saint-Maurice', 'Boussu', 'Bouwel', 'Bracquegnies', 'Bressoux', 'Brugelette', 'Brugge', 'Brugge-Sint-Pieters', 'Brussel-Centraal', 'Brussel-Congres', 'Brussel-Kapellekerk', 'Brussel-Luxemburg', 'Brussel-Noord', 'Brussel-Schuman', 'Brussel-West', 'Brussel-Zuid', 'Brussels Airport - Zaventem', 'Buda', 'Buggenhout', 'Buizingen', 'Burst', 'Béziers', 'Callenelle', 'Cambron-Casteau', 'Cannes', 'Capellen', 'Carlsbourg', 'Carnieres', 'Ceroux-Mousty', 'Chambéry-Challes-les-Eaux', 'Chapelle-Dieu', 'Chapois', 'Charleroi-West', 'Charleroi-Zuid', 'Chastre', 'Château-de-Seilles', 'Châtelet', 'Chênée', 'Ciney', 'Clervaux', 'Colmar', 'Comblain-la-Tour', 'Coo', 'Couillet', 'Cour-sur-Heure', 'Courcelles-Motte', 'Courrière', 'Court-Saint-Étienne', 'Couvin', 'Croix Wasquehal', "Croix l'Allumette", 'Dave-Saint-Martin', 'De Hoek', 'De Panne', 'De Pinte', 'Deinze', 'Delta', 'Den Haag HS', 'Denderleeuw', 'Dendermonde', 'Diegem', 'Diepenbeek', 'Diesdelle', 'Diest', 'Diksmuide', 'Dilbeek', 'Dinant', 'Dolhain-Gileppe', 'Doornik', 'Dordrecht', 'Dortmund Hbf', 'Drauffelt', 'Drongen', 'Duffel', 'Duinbergen', 'Duisburg Hbf', 'Düsseldorf Flughafen Hbf', 'Düsseldorf Hbf', 'Ebbsfleet International', 'Ede', 'Edingen', 'Eeklo', 'Eerken', 'Eichem', 'Eigenbrakel', 'Eijsden', 'Eine', 'Eke-Nazareth', 'Ekeren', 'Engis', 'Eppegem', 'Erbisoeul', 'Erembodegem', 'Ernage', 'Erpe-Mere', 'Erps-Kwerps', 'Erquelinnes', 'Erquelinnes-Village', 'Esneux', 'Essen', 'Essen Hbf', 'Essene-Lombeek', 'Ettelbruck', 'Etterbeek', 'Eupen', 'Evere', 'Evergem', 'Ezemaal', 'Familleureux', 'Farciennes', 'Faux', 'Fexhe-le-Haut-Clocher', 'Flawinne', 'Flemalle-Grande', 'Flemalle-Haute', 'Fleurus', 'Floreffe', 'Florenville', 'Florival', 'Florée', 'Fontaine-Valmont', 'Forchies', 'Forrières', 'Fraipont', 'Frameries', 'Franchimont', 'Franière', 'Frankfurt am Main Hbf', 'Frankfurt am Main Luchthaven', 'Froyennes', 'Galmaarden', 'Gastuche', 'Gavere-Asper', 'Gedinne', 'Geel', 'Gembloux', 'Gendron-Celles', 'Genk', 'Genly', 'Gent-Dampoort', 'Gent-Sint-Pieters', 'Gentbrugge', 'Genval', 'Geraardsbergen', 'Ghlin', 'Glaaien', 'Godarville', 'Godinne', 'Gontrode', 'Gouvy', 'Gouy-lez-Pieton', 'Graide', 'Groenendaal', 'Groot-Bijgaarden', 'Grupont', 'Haacht', 'Haaltert', 'Habay', 'Hainin', 'Halanzy', 'Halle', 'Ham-sur-Heure', 'Ham-sur-Sambre', 'Hambos', 'Hamoir', 'Hamont', 'Hansbeke', 'Harchies', 'Harelbeke', 'Haren', 'Haren-Zuid', 'Hasselt', 'Haute-Flône', 'Haute-Picardie TGV', 'Haversin', 'Havre', 'Heide', 'Heist', 'Heist-op-den-Berg', 'Heizijde', 'Hellemmes', 'Hemiksem', 'Hennuyères', 'Herent', 'Herentals', 'Hergenrath', 'Herne', 'Herseaux', 'Herstal', 'Herzele', 'Heusden', 'Hever', 'Heverlee', 'Hillegem', 'Hoboken-Polder', 'Hoei', 'Hoeilaart', 'Hofstade', 'Holleken', 'Hony', 'Houraing', 'Hourpes', 'Houyet', 'Hove', 'Huizingen', 'Iddergem', 'Idegem', 'Ieper', 'Ingelmunster', 'Izegem', 'Jambes', 'Jambes-Est', 'Jamioulx', 'Jemappes', 'Rochefort-Jemelle', 'Jemeppe-sur-Meuse', 'Jemeppe-sur-Sambre', 'Jette', 'Jurbeke', 'Juslenville', 'Kalmthout', 'Kapelle-op-den-Bos', 'Kapellen', 'Kautenbach', 'Kessel', 'Keulen Hbf', 'Kiewit', 'Kijkuit', 'Kleinbettingen', 'Knokke', 'Koksijde', 'Komen', 'Kontich-Lint', 'Kortemark', 'Kortenberg', 'Kortrijk', 'Kwatrecht', 'La Louvière-Centrum', 'La Louvière-Zuid', 'La Roche (Brabant)', 'Labuissière', 'Landegem', 'Landelies', 'Landen', 'Landry', 'Landskouter', 'Langdorp', 'Le Campinaire', 'Lebbeke', 'Lede', 'Leignon', 'Leman', 'Lembeek', 'Lens', 'Leopoldsburg', 'Les Arcs - Draguignan', 'Lessen', 'Leuven', 'Leuze', 'Leval', 'Lezennes', 'Libramont', 'Lichtervelde', 'Liedekerke', 'Lier', 'Lierde', 'Liers', 'Ligny', 'Lillois', 'Limal', 'Limburg Süd', 'Linkebeek', 'Lissewege', 'Lobbes', 'Lodelinsart', 'Lokeren', 'Lommel', 'Londen Saint Pancras', 'Londerzeel', 'Lonzée', 'Lot', 'Louvain-la-Neuve-Université', 'Luik-Guillemins', 'Luik-Jonfosse', 'Luik-Paleis', 'Lustin', 'Luttre', 'Luxemburg', 'Lyon Part Dieu TGV', 'Lyon-Perrache TGV', 'Lyon-Saint Exupéry TGV', 'Maastricht', 'Maastricht Randwyck', 'Maffle', 'Malderen', 'Mamer', 'Mamer-Lycée', 'Manage', 'Marbehan', 'Marche-en-Famenne', 'Marche-les-Dames', 'Marche-lez-Écaussinnes', 'Marchienne-Zone', 'Marchienne-au-Pont', 'Maria-Aalter', 'Mariembourg', 'Marloie', 'Marne-la-Vallée - Chessy', 'Marseille-Saint-Charles', 'Masnuy-Saint-Pierre', 'Maubray', 'Mazy', 'Mechelen', 'Mechelen-Nekkerspoel', 'Meiser', 'Melkouwen', 'Melle', 'Melreux-Hotton', 'Melsele', 'Menen', 'Merchtem', 'Merelbeke', 'Merode', 'Mersch', 'Messancy', 'Metz', 'Mevergnies-Attre', 'Michelau', 'Milmort', 'Moensberg', 'Moeskroen', 'Mol', 'Mollem', 'Momalle', 'Mont-Saint-Guibert', 'Montpellier', 'Moortsele', 'Morlanwelz', 'Mortsel', 'Mortsel-Deurnesteenweg', 'Mortsel-Liersesteenweg', 'Mortsel-Oude God', 'Moustier', 'Mouterij', 'Moûtiers-Salins-Brides-les-Bai', 'Muizen', 'Mulhouse', 'Munkzwalm', 'Méry', 'Namen', 'Namêche', 'Naninne', 'Narbonne', 'Natoye', 'Neerpelt', 'Neerwinden', 'Nessonvaux', 'Neufchâteau', 'Neufvilles', 'Nice Ville', 'Niel', 'Nieuwkerken-Waas', 'Nijlen', 'Nijvel', 'Nimy', 'Ninove', 'Noorderkempen', 'Nossegem', 'Nîmes', 'Obaix-Buzet', 'Obourg', 'Okegem', 'Olen', 'Oostende', 'Oostkamp', 'Opwijk', 'Opzullik', 'Ottignies', 'Oud-Heverlee', 'Oudegem', 'Oudenaarde', 'Overpelt', 'Paliseul', 'Papegem', 'Parijs Noord', 'Pepinster', 'Pepinster-Cité', 'Perpignan', 'Philippeville', 'Piéton', 'Poix-Saint-Hubert', 'Pont de Bois', 'Pont-de-Seraing', 'Pont-à-Celles', 'Poperinge', 'Poulseur', 'Profondsart', 'Pry', 'Puurs', 'Pécrot', 'Péruwelz', 'Quaregnon', 'Quevy', 'Quievrain', 'Rebaix', 'Remicourt', 'Rhisnes', 'Rijsel-Europa', 'Rijsel-Vlaanderen', 'Rivage', 'Rixensart', 'Rodange', 'Roeselare', 'Ronet', 'Ronse', 'Roosendaal', 'Rotterdam CS', 'Roubaix', 'Roux', 'Ruisbroek', 'Ruisbroek-Sauvegarde', 'Saint-Denis-Bovesse', 'Saint-Ghislain', 'Saint-Louis-Haut-Rhin', 'Saint-Raphaël-Valescure', 'Sart-Bernard', 'Saverne', 'Schaarbeek', 'Scheldewindeke', 'Schelle', 'Schellebelle', 'Schendelbeke', 'Schiphol', 'Schoonaarde', 'Schulen', 'Sclaigneaux', 'Sclessin', 'Selestat', 'Serskamp', 'Siegburg', 'Simonis', 'Sinaai', 'Sint-Agatha-Berchem', 'Sint-Denijs-Boekel', 'Sint-Genesius-Rode', 'Sint-Gillis-Dendermonde', 'Sint-Job', 'Sint-Joris-Weert', 'Sint-Katelijne-Waver', 'Sint-Mariaburg', 'Sint-Martens-Bodegem', 'Sint-Niklaas', 'Sint-Truiden', 'Sleidinge', 'Solre-sur-Sambre', 'Spa', 'Spa-Géronstère', 'Statte', 'Stockem', 'Straatsburg', 'Sy', 'Sète', 'Tamines', 'Temse', 'Terhagen', 'Terhulpen', 'Ternat', 'Testelt', 'Theux', 'Thieu', 'Thionville', 'Thuin', 'Thulin', 'Thurn en Taxis', 'Tielen', 'Tielt', 'Tienen', 'Tilff', 'Tilly', 'Tollembeek', 'Tongeren', 'Torhout', 'Toulon', 'Tourcoing', 'Trois-Ponts', 'Troisvierges', 'Trooz', 'Tubeke', 'Turnhout', 'Ukkel-Kalevoet', 'Ukkel-Stalle', 'Valence TGV', 'Veltem', 'Vertrijk', 'Verviers-Centraal', 'Verviers-Paleis', 'Veurne', 'Viane-Moerbeke', 'Vichte', 'Vielsalm', 'Vijfhuizen', 'Ville-Pommerœul', 'Villers-la-Ville', 'Vilvoorde', 'Virton', 'Viville', 'Voroux', 'Vorst-Oost', 'Vorst-Zuid', 'Waarschoot', 'Walcourt', 'Waregem', 'Waterloo', 'Watermaal', 'Waver', 'Weerde', 'Welkenraedt', 'Welle', 'Wervik', 'Wespelaar-Tildonk', 'Wetteren', 'Wevelgem', 'Wezemaal', 'Wezet', 'Wichelen', 'Wijgmaal', 'Wildert', 'Willebroek', 'Wilwerwiltz', 'Wolfstee', 'Wondelgem', 'Yves-Gomezée', 'Yvoir', 'Zandbergen', 'Zaventem', 'Zedelgem', 'Zeebrugge-Dorp', 'Zeebrugge-Strand', 'Zele', 'Zellik', 'Zichem', 'Zingem', 'Zinnik', 'Zolder', 'Zonhoven', 'Zottegem', 'Zwankendamme', 'Zwijndrecht', 'Écaussinnes'], - "FR": ['Aalst-Kerrebroek', 'Aalter', 'Aarschot', 'Aarsele', 'Acren', 'Agde', 'Aime-la-Plagne', 'Aiseau', 'Aix-en-Provence TGV', 'Aix-la-Chapelle Hbf', 'Albertville', 'Alken', 'Alost', 'Amay', 'Ampsin', 'Amsterdam CS', 'Andenne', 'Angleur', 'Annappes', 'Ans', 'Anseremme', 'Antibes', 'Antoing', 'Anvers-Berchem', 'Anvers-Central', 'Anvers-Est', 'Anvers-Haven', 'Anvers-Luchtbal', 'Anvers-Noorderdokken', 'Anvers-Sud', 'Anzegem', 'Appelterre', 'Arcades', 'Archennes', 'Arlon', 'Ascq', 'Asse', 'Assesse', 'Ath', 'Athus', 'Aubange', 'Audenarde', 'Auvelais', 'Avignon TGV', 'Aye', 'Aywaille', 'Aéroport Charles-de-Gaulle TGV', 'Baelen', 'Baesrode-Sud', 'Baisieux', 'Balegem-Dorp', 'Balegem-Zuid', 'Bambrugge', 'Barvaux', 'Bas-Oha', 'Basel', 'Basse-Wavre', 'Bastogne-Nord', 'Bastogne-Sud', 'Beauraing', 'Beernem', 'Beersel', 'Beervelde', 'Begijnendijk', 'Beignée', 'Bellem', 'Belsele', 'Berchem-Sainte-Agathe', 'Beringen', 'Berlaar', 'Bertrange Strassen', 'Bertrix', 'Berzée', 'Beuzet', 'Beveren', 'Beverlo', 'Bierges-Walibi', 'Bierset-Awans', 'Bilzen', 'Binche', 'Bissegem', 'Blankenberge', 'Blanmont', 'Blaton', 'Bleret', 'Bockstael', 'Bodeghem-Saint-Martin', 'Boechout', 'Boitsfort', 'Bokrijk', 'Bomal', 'Booischot', 'Boom', 'Boondael', 'Boortmeerbeek', 'Bordet', 'Bornem', 'Bourg-Léopold', 'Bourg-Saint-Maurice', 'Boussu', 'Bouwel', 'Bracquegnies', "Braine-l'Alleud", 'Braine-le-Comte', 'Bressoux', 'Brugelette', 'Bruges', 'Bruges-Saint-Pierre', 'Brussels Airport - Zaventem', 'Bruxelles-Central', 'Bruxelles-Chapelle', 'Bruxelles-Congrès', 'Bruxelles-Luxembourg', 'Bruxelles-Midi', 'Bruxelles-Nord', 'Bruxelles-Ouest', 'Bruxelles-Schuman', 'Buda', 'Buggenhout', 'Buizingen', 'Burst', 'Béziers', 'Callenelle', 'Cambron-Casteau', 'Cannes', 'Capellen', 'Carlsbourg', 'Carnieres', 'Ceroux-Mousty', 'Chambéry-Challes-les-Eaux', 'Chapelle-Dieu', 'Chapois', 'Charleroi-Ouest', 'Charleroi-Sud', 'Chastre', 'Château-de-Seilles', 'Châtelet', 'Chênée', 'Ciney', 'Clervaux', 'Colmar', 'Cologne Hbf', 'Comblain-la-Tour', 'Comines', 'Coo', 'Couillet', 'Cour-sur-Heure', 'Courcelles-Motte', 'Courrière', 'Court-Saint-Étienne', 'Courtrai', 'Couvin', 'Coxyde', 'Croix Wasquehal', "Croix l'Allumette", 'Dave-Saint-Martin', 'De Hoek', 'De Pinte', 'Deinze', 'Delta', 'Den Haag HS', 'Denderleeuw', 'Diegem', 'Diepenbeek', 'Diest', 'Dilbeek', 'Dinant', 'Dixmude', 'Dolhain-Gileppe', 'Dordrecht', 'Dortmund Hbf', 'Drauffelt', 'Drongen', 'Duffel', 'Duinbergen', 'Duisburg Hbf', 'Düsseldorf Flughafen Hbf', 'Düsseldorf Hbf', 'Ebbsfleet International', 'Ede', 'Eeklo', 'Eichem', 'Eijsden', 'Eine', 'Eke-Nazareth', 'Ekeren', 'Enghien', 'Engis', 'Eppegem', 'Erbisoeul', 'Erembodegem', 'Ernage', 'Erpe-Mere', 'Erps-Kwerps', 'Erquelinnes', 'Erquelinnes-Village', 'Esneux', 'Essen', 'Essen Hbf', 'Essene-Lombeek', 'Ettelbruck', 'Etterbeek', 'Eupen', 'Evere', 'Evergem', 'Ezemaal', 'Familleureux', 'Farciennes', 'Faux', 'Fexhe-le-Haut-Clocher', 'Flawinne', 'Flemalle-Grande', 'Flemalle-Haute', 'Fleurus', 'Floreffe', 'Florenville', 'Florival', 'Florée', 'Fontaine-Valmont', 'Forchies', 'Forest-Est', 'Forest-Midi', 'Forrières', 'Fraipont', 'Frameries', 'Francfort-sur-le-Main Aéroport', 'Francfort-sur-le-Main Hbf', 'Franchimont', 'Franière', 'Froyennes', 'Furnes', 'Gammerages', 'Gand-Dampoort', 'Gand-Saint-Pierre', 'Gastuche', 'Gavere-Asper', 'Gedinne', 'Geel', 'Gembloux', 'Gendron-Celles', 'Genk', 'Genly', 'Gentbrugge', 'Genval', 'Germoir', 'Ghlin', 'Glons', 'Godarville', 'Godinne', 'Gontrode', 'Gouvy', 'Gouy-lez-Pieton', 'Graide', 'Grammont', 'Grand-Bigard', 'Groenendael', 'Grupont', 'Haacht', 'Haaltert', 'Habay', 'Hainin', 'Hal', 'Halanzy', 'Ham-sur-Heure', 'Ham-sur-Sambre', 'Hambos', 'Hamoir', 'Hamont', 'Hansbeke', 'Harchies', 'Harelbeke', 'Haren', 'Haren-Sud', 'Hasselt', 'Haute-Flône', 'Haute-Picardie TGV', 'Haversin', 'Havre', 'Heide', 'Heist', 'Heist-op-den-Berg', 'Heizijde', 'Hellemmes', 'Hemiksem', 'Hennuyères', 'Herent', 'Herentals', 'Hergenrath', 'Herne', 'Herseaux', 'Herstal', 'Herzele', 'Heusden', 'Hever', 'Heverlee', 'Hillegem', 'Hoboken-Polder', 'Hoeilaart', 'Hofstade', 'Holleken', 'Hony', 'Houraing', 'Hourpes', 'Houyet', 'Hove', 'Huizingen', 'Huy', 'Iddergem', 'Idegem', 'Ingelmunster', 'Izegem', 'Jambes', 'Jambes-Est', 'Jamioulx', 'Jemappes', 'Rochefort-Jemelle', 'Jemeppe-sur-Meuse', 'Jemeppe-sur-Sambre', 'Jette', 'Jurbise', 'Juslenville', 'Kalmthout', 'Kapelle-op-den-Bos', 'Kapellen', 'Kautenbach', 'Kessel', 'Kiewit', 'Kijkuit', 'Kleinbettingen', 'Knokke', 'Kontich-Lint', 'Kortemark', 'Kortenberg', 'La Hulpe', 'La Louvière-Centre', 'La Louvière-Sud', 'La Panne', 'La Roche (Brabant)', 'Labuissière', 'Landegem', 'Landelies', 'Landen', 'Landry', 'Landskouter', 'Langdorp', 'Le Campinaire', 'Lebbeke', 'Lede', 'Leignon', 'Leman', 'Lembeek', 'Lens', 'Les Arcs - Draguignan', 'Lessines', 'Leuze', 'Leval', 'Lezennes', 'Libramont', 'Lichtervelde', 'Liedekerke', 'Lierde', 'Lierre', 'Liers', 'Ligny', 'Lille Europe', 'Lille Flandres', 'Lillois', 'Limal', 'Limburg Süd', 'Linkebeek', 'Lissewege', 'Liège-Guillemins', 'Liège-Jonfosse', 'Liège-Palais', 'Lobbes', 'Lodelinsart', 'Lokeren', 'Lommel', 'Londerzeel', 'Londres Saint Pancras', 'Lonzée', 'Lot', 'Louvain', 'Louvain-la-Neuve-Université', 'Lustin', 'Luttre', 'Luxembourg', 'Lyon Part Dieu TGV', 'Lyon-Perrache TGV', 'Lyon-Saint Exupéry TGV', 'Maastricht', 'Maastricht Randwyck', 'Maffle', 'Malderen', 'Malines', 'Malines-Nekkerspoel', 'Mamer', 'Mamer-Lycée', 'Manage', 'Marbehan', 'Marche-en-Famenne', 'Marche-les-Dames', 'Marche-lez-Écaussinnes', 'Marchienne-Zone', 'Marchienne-au-Pont', 'Maria-Aalter', 'Mariembourg', 'Marloie', 'Marne-la-Vallée - Chessy', 'Marseille-Saint-Charles', 'Masnuy-Saint-Pierre', 'Maubray', 'Mazy', 'Meiser', 'Melkouwen', 'Melle', 'Melreux-Hotton', 'Melsele', 'Menin', 'Merchtem', 'Merelbeke', 'Merode', 'Mersch', 'Messancy', 'Metz', 'Mevergnies-Attre', 'Michelau', 'Milmort', 'Moensberg', 'Mol', 'Mollem', 'Momalle', 'Mons', 'Mont-Saint-Guibert', 'Montpellier', 'Moortsele', 'Morlanwelz', 'Mortsel', 'Mortsel-Deurnesteenweg', 'Mortsel-Liersesteenweg', 'Mortsel-Oude God', 'Mouscron', 'Moustier', 'Moûtiers-Salins-Brides-les-Bai', 'Muizen', 'Mulhouse', 'Munkzwalm', 'Méry', 'Namur', 'Namêche', 'Naninne', 'Narbonne', 'Natoye', 'Neerpelt', 'Neerwinden', 'Nessonvaux', 'Neufchâteau', 'Neufvilles', 'Nice Ville', 'Niel', 'Nieuwkerken-Waas', 'Nijlen', 'Nimy', 'Ninove', 'Nivelles', 'Noorderkempen', 'Nossegem', 'Nîmes', 'Obaix-Buzet', 'Obourg', 'Okegem', 'Olen', 'Oostkamp', 'Opwijk', 'Ostende', 'Ottignies', 'Oud-Heverlee', 'Oudegem', 'Overpelt', 'Paliseul', 'Papignies', 'Paris Nord', 'Pepinster', 'Pepinster-Cité', 'Perpignan', 'Philippeville', 'Piéton', 'Poix-Saint-Hubert', 'Pont de Bois', 'Pont-de-Seraing', 'Pont-à-Celles', 'Poperinge', 'Poulseur', 'Profondsart', 'Pry', 'Puurs', 'Pécrot', 'Péruwelz', 'Quaregnon', 'Quatrecht', 'Quevy', 'Quievrain', 'Rebaix', 'Remicourt', 'Renaix', 'Rhisnes', 'Rhode-Saint-Genèse', 'Rivage', 'Rixensart', 'Rodange', 'Ronet', 'Roosendaal', 'Rotterdam CS', 'Roubaix', 'Roulers', 'Roux', 'Ruisbroek', 'Ruisbroek-Sauvegarde', 'Saint-Denis-Bovesse', 'Saint-Ghislain', 'Saint-Gilles-lez-Termonde', 'Saint-Job', 'Saint-Louis-Haut-Rhin', 'Saint-Nicolas', 'Saint-Raphaël-Valescure', 'Saint-Trond', 'Sart-Bernard', 'Saverne', 'Schaerbeek', 'Scheldewindeke', 'Schelle', 'Schellebelle', 'Schendelbeke', 'Schiphol', 'Schoonaarde', 'Schulen', 'Sclaigneaux', 'Sclessin', 'Selestat', 'Serskamp', 'Siegburg', 'Silly', 'Simonis', 'Sinaai', 'Sint-Denijs-Boekel', 'Sint-Joris-Weert', 'Sint-Mariaburg', 'Sleidinge', 'Soignies', 'Solre-sur-Sambre', 'Spa', 'Spa-Géronstère', 'Statte', 'Stockem', 'Strasbourg', 'Sy', 'Sète', 'Tamines', 'Temse', 'Terhagen', 'Termonde', 'Ternat', 'Testelt', 'Theux', 'Thieu', 'Thionville', 'Thuin', 'Thulin', 'Tielen', 'Tielt', 'Tilff', 'Tilly', 'Tirlemont', 'Tollembeek', 'Tongres', 'Torhout', 'Toulon', 'Tour et Taxis', 'Tourcoing', 'Tournai', 'Trois-Ponts', 'Troisvierges', 'Trooz', 'Tubize', 'Turnhout', 'Uccle-Calevoet', 'Uccle-Stalle', 'Valence TGV', 'Veltem', 'Vertrijk', 'Verviers-Central', 'Verviers-Palais', 'Viane-Moerbeke', 'Vichte', 'Vielsalm', 'Vijfhuizen', 'Ville-Pommerœul', 'Villers-la-Ville', 'Vilvorde', 'Virton', 'Visé', "Vivier d'Oie", 'Viville', 'Voroux', 'Waarschoot', 'Walcourt', 'Waregem', 'Waremme', 'Waterloo', 'Watermael', 'Wavre', 'Wavre-Sainte-Catherine', 'Weerde', 'Welkenraedt', 'Welle', 'Wervik', 'Wespelaar-Tildonk', 'Wetteren', 'Wevelgem', 'Wezemaal', 'Wichelen', 'Wijgmaal', 'Wildert', 'Willebroek', 'Wilwerwiltz', 'Wolfstee', 'Wondelgem', 'Ypres', 'Yves-Gomezée', 'Yvoir', 'Zandbergen', 'Zaventem', 'Zedelgem', 'Zeebrugge-Dorp', 'Zeebrugge-Strand', 'Zele', 'Zellik', 'Zichem', 'Zingem', 'Zolder', 'Zonhoven', 'Zottegem', 'Zwankendamme', 'Zwijndrecht', 'Écaussinnes'], - "DE": ['Aachen Hbf', 'Aalst', 'Aalst-Kerrebroek', 'Aalter', 'Aarschot', 'Aarsele', 'Acren', 'Agde', 'Aime-la-Plagne', 'Aiseau', 'Aix-en-Provence TGV', 'Albertville', 'Alken', 'Amay', 'Ampsin', 'Amsterdam CS', 'Andenne', 'Angleur', 'Annappes', 'Ans', 'Anseremme', 'Antibes', 'Antoing', 'Antwerpen-Berchem', 'Antwerpen-Centraal', 'Antwerpen-Haven', 'Antwerpen-Luchtbal', 'Antwerpen-Noorderdokken', 'Antwerpen-Oost', 'Antwerpen-Zuid', 'Anzegem', 'Appelterre', 'Arcaden/Arcades', 'Archennes', 'Arel', 'Ascq', 'Asse', 'Assesse', 'Ath', 'Athem', 'Aubange', 'Auvelais', 'Avignon TGV', 'Aye', 'Aywaille', 'Aéroport Charles-de-Gaulle TGV', 'Baasrode-Zuid', 'Baisieux', 'Balegem-Dorp', 'Balegem-Zuid', 'Balen', 'Bambrugge', 'Barvaux', 'Bas-Oha', 'Basel', 'Basse-Wavre', 'Bastogne-Nord', 'Bastogne-Sud', 'Beauraing', 'Beernem', 'Beersel', 'Beervelde', 'Begijnendijk', 'Beignée', 'Bellem', 'Belsele', 'Beringen', 'Berlaar', 'Bertrange Strassen', 'Bertrix', 'Berzée', 'Beuzet', 'Beveren', 'Beverlo', 'Bierges-Walibi', 'Bierset-Awans', 'Bilzen', 'Binche', 'Bissegem', 'Blankenberge', 'Blanmont', 'Blaton', 'Bleret', 'Bockstael', 'Boechout', 'Bokrijk', 'Bomal', 'Booischot', 'Boom', 'Boondaal/Boondael', 'Boortmeerbeek', 'Bordet', 'Bornem', 'Bosvoorde/Boitsfort', 'Bourg-Saint-Maurice', 'Boussu', 'Bouwel', 'Bracquegnies', "Braine-l'Alleud", 'Braine-le-Comte', 'Bressoux', 'Brugelette', 'Brugge', 'Brugge-Sint-Pieters', 'Brussel-Centraal/Bruxelles-Central', 'Brussel-Congres/Bruxelles-Congrès', 'Brussel-Kapellekerk/Bruxelles-Chapelle', 'Brussel-Luxemburg/Bruxelles-Luxembourg', 'Brussel-Noord/Bruxelles-Nord', 'Brussel-Schuman/Bruxelles-Schuman', 'Brussel-West/Bruxelles-Ouest', 'Brussel-Zuid/Bruxelles-Midi', 'Brussels Airport - Zaventem', 'Buda', 'Buggenhout', 'Buizingen', 'Burst', 'Béziers', 'Callenelle', 'Cambron-Casteau', 'Cannes', 'Capellen', 'Carlsbourg', 'Carnieres', 'Ceroux-Mousty', 'Chambéry-Challes-les-Eaux', 'Chapelle-Dieu', 'Chapois', 'Charleroi-Ouest', 'Charleroi-Sud', 'Chastre', 'Château-de-Seilles', 'Châtelet', 'Chênée', 'Ciney', 'Clervaux', 'Colmar', 'Comblain-la-Tour', 'Comines', 'Coo', 'Couillet', 'Cour-sur-Heure', 'Courcelles-Motte', 'Courrière', 'Court-Saint-Étienne', 'Couvin', 'Croix Wasquehal', "Croix l'Allumette", 'Dave-Saint-Martin', 'De Hoek', 'De Panne', 'De Pinte', 'Deinze', 'Delta', 'Den Haag HS', 'Denderleeuw', 'Dendermonde', 'Diegem', 'Diepenbeek', "Diesdelle/Vivier d'Oie", 'Diest', 'Diksmuide', 'Dilbeek', 'Dinant', 'Dolhain-Gileppe', 'Dordrecht', 'Dortmund Hbf', 'Drauffelt', 'Drongen', 'Duffel', 'Duinbergen', 'Duisburg Hbf', 'Düsseldorf Flughafen Hbf', 'Düsseldorf Hbf', 'Ebbsfleet International', 'Ede', 'Eeklo', 'Eichem', 'Eijsden', 'Eine', 'Eke-Nazareth', 'Ekeren', 'Enghien', 'Engis', 'Eppegem', 'Erbisoeul', 'Erembodegem', 'Ernage', 'Erpe-Mere', 'Erps-Kwerps', 'Erquelinnes', 'Erquelinnes-Village', 'Esneux', 'Essen', 'Essen Hbf', 'Essene-Lombeek', 'Ettelbrück', 'Etterbeek', 'Eupen', 'Evere', 'Evergem', 'Ezemaal', 'Familleureux', 'Farciennes', 'Faux', 'Fexhe-le-Haut-Clocher', 'Flawinne', 'Flemalle-Grande', 'Flemalle-Haute', 'Fleurus', 'Floreffe', 'Florenville', 'Florival', 'Florée', 'Fontaine-Valmont', 'Forchies', 'Forrières', 'Fraipont', 'Frameries', 'Franchimont', 'Franière', 'Frankfurt am Main Flughafen', 'Frankfurt am Main Hbf', 'Froyennes', 'Galmaarden', 'Gastuche', 'Gavere-Asper', 'Gedinne', 'Geel', 'Gembloux', 'Gendron-Celles', 'Genk', 'Genly', 'Gent-Dampoort', 'Gent-Sint-Pieters', 'Gentbrugge', 'Genval', 'Geraardsbergen', 'Germoir', 'Ghlin', 'Glons', 'Godarville', 'Godinne', 'Gontrode', 'Gouvy', 'Gouy-lez-Pieton', 'Graide', 'Groenendaal', 'Groot-Bijgaarden', 'Grupont', 'Haacht', 'Haaltert', 'Habay', 'Hainin', 'Halanzy', 'Halle', 'Ham-sur-Heure', 'Ham-sur-Sambre', 'Hambos', 'Hamoir', 'Hamont', 'Hansbeke', 'Harchies', 'Harelbeke', 'Haren', 'Haren-Sud/Haren-Zuid', 'Hasselt', 'Haute-Flône', 'Haute-Picardie TGV', 'Haversin', 'Havre', 'Heide', 'Heist', 'Heist-op-den-Berg', 'Heizijde', 'Hellemmes', 'Hemiksem', 'Hennuyères', 'Herent', 'Herentals', 'Hergenrath', 'Herne', 'Herseaux', 'Herstal', 'Herzele', 'Heusden', 'Hever', 'Heverlee', 'Hillegem', 'Hoboken-Polder', 'Hoeilaart', 'Hofstade', 'Holleken', 'Hony', 'Houraing', 'Hourpes', 'Houyet', 'Hove', 'Huizingen', 'Huy', 'Iddergem', 'Idegem', 'Ieper', 'Ingelmunster', 'Izegem', 'Jambes', 'Jambes-Est', 'Jamioulx', 'Jemappes', 'Rochefort-Jemelle', 'Jemeppe-sur-Meuse', 'Jemeppe-sur-Sambre', 'Jette', 'Jurbeke', 'Juslenville', 'Kalmthout', 'Kapelle-op-den-Bos', 'Kapellen', 'Kautenbach', 'Kessel', 'Kiewit', 'Kijkuit', 'Kleinbettingen', 'Knokke', 'Koksijde', 'Kontich-Lint', 'Kortemark', 'Kortenberg', 'Kortrijk', 'Kwatrecht', 'Köln Hbf', 'La Hulpe', 'La Louvière-Centre', 'La Louvière-Sud', 'La Roche (Brabant)', 'Labuissière', 'Landegem', 'Landelies', 'Landen', 'Landry', 'Landskouter', 'Langdorp', 'Le Campinaire', 'Lebbeke', 'Lede', 'Leignon', 'Leman', 'Lembeek', 'Lens', 'Leopoldsburg', 'Les Arcs - Draguignan', 'Lessines', 'Leuze', 'Leval', 'Lezennes', 'Libramont', 'Lichtervelde', 'Liedekerke', 'Lier', 'Lierde', 'Liers', 'Ligny', 'Lille Europe', 'Lille Flandres', 'Lillois', 'Limal', 'Limburg Süd', 'Linkebeek', 'Lissewege', 'Liège-Guillemins', 'Liège-Jonfosse', 'Liège-Palais', 'Lobbes', 'Lodelinsart', 'Lokeren', 'Lommel', 'Londerzeel', 'London Saint Pancras International', 'Lonzée', 'Lot', 'Louvain-la-Neuve-Université', 'Lustin', 'Luttre', 'Luxemburg', 'Lyon Part Dieu TGV', 'Lyon-Perrache TGV', 'Lyon-Saint Exupéry TGV', 'Löwen', 'Maastricht', 'Maastricht Randwyck', 'Maffle', 'Malderen', 'Mamer', 'Mamer-Lycée', 'Manage', 'Marbehan', 'Marche-en-Famenne', 'Marche-les-Dames', 'Marche-lez-Écaussinnes', 'Marchienne-Zone', 'Marchienne-au-Pont', 'Maria-Aalter', 'Mariembourg', 'Marloie', 'Marne-la-Vallée - Chessy', 'Marseille-Saint-Charles', 'Masnuy-Saint-Pierre', 'Maubray', 'Mazy', 'Mechelen', 'Mechelen-Nekkerspoel', 'Meiser', 'Melkouwen', 'Melle', 'Melreux-Hotton', 'Melsele', 'Menen', 'Merchtem', 'Merelbeke', 'Merode', 'Mersch', 'Messancy', 'Metz', 'Mevergnies-Attre', 'Michelau', 'Milmort', 'Moensberg', 'Mol', 'Mollem', 'Momalle', 'Mons', 'Mont-Saint-Guibert', 'Montpellier', 'Moortsele', 'Morlanwelz', 'Mortsel', 'Mortsel-Deurnesteenweg', 'Mortsel-Liersesteenweg', 'Mortsel-Oude God', 'Mouscron', 'Moustier', 'Moûtiers-Salins-Brides-les-Bai', 'Muizen', 'Mulhouse', 'Munkzwalm', 'Méry', 'Namur', 'Namêche', 'Naninne', 'Narbonne', 'Natoye', 'Neerpelt', 'Neerwinden', 'Nessonvaux', 'Neufchâteau', 'Neufvilles', 'Nice Ville', 'Niel', 'Nieuwkerken-Waas', 'Nijlen', 'Nimy', 'Ninove', 'Nivelles', 'Noorderkempen', 'Nossegem', 'Nîmes', 'Obaix-Buzet', 'Obourg', 'Okegem', 'Olen', 'Oostende', 'Oostkamp', 'Opwijk', 'Ottignies', 'Oud-Heverlee', 'Oudegem', 'Oudenaarde', 'Overpelt', 'Paliseul', 'Papignies', 'Paris Nord', 'Pepinster', 'Pepinster-Cité', 'Perpignan', 'Philippeville', 'Piéton', 'Poix-Saint-Hubert', 'Pont de Bois', 'Pont-de-Seraing', 'Pont-à-Celles', 'Poperinge', 'Poulseur', 'Profondsart', 'Pry', 'Puurs', 'Pécrot', 'Péruwelz', 'Quaregnon', 'Quevy', 'Quievrain', 'Rebaix', 'Remicourt', 'Rhisnes', 'Rivage', 'Rixensart', 'Rodange', 'Roeselare', 'Ronet', 'Ronse', 'Roosendaal', 'Rotterdam CS', 'Roubaix', 'Roux', 'Ruisbroek', 'Ruisbroek-Sauvegarde', 'Saint-Denis-Bovesse', 'Saint-Ghislain', 'Saint-Louis-Haut-Rhin', 'Saint-Raphaël-Valescure', 'Sart-Bernard', 'Saverne', 'Schaarbeek/Schaerbeek', 'Scheldewindeke', 'Schelle', 'Schellebelle', 'Schendelbeke', 'Schiphol', 'Schoonaarde', 'Schulen', 'Sclaigneaux', 'Sclessin', 'Selestat', 'Serskamp', 'Siegburg', 'Silly', 'Simonis', 'Sinaai', 'Sint-Agatha-Berchem/Berchem-Sainte-Agathe', 'Sint-Denijs-Boekel', 'Sint-Genesius-Rode', 'Sint-Gillis-Dendermonde', 'Sint-Job', 'Sint-Joris-Weert', 'Sint-Katelijne-Waver', 'Sint-Mariaburg', 'Sint-Martens-Bodegem', 'Sint-Niklaas', 'Sint-Truiden', 'Sleidinge', 'Soignies', 'Solre-sur-Sambre', 'Spa', 'Spa-Géronstère', 'Statte', 'Stockem', 'Straßburg', 'Sy', 'Sète', 'Tamines', 'Temse', 'Terhagen', 'Ternat', 'Testelt', 'Theux', 'Thienen', 'Thieu', 'Thionville', 'Thuin', 'Thulin', 'Tielen', 'Tielt', 'Tilff', 'Tilly', 'Tollembeek', 'Tongern', 'Torhout', 'Toulon', 'Tour et Taxis', 'Tourcoing', 'Tournai', 'Trois-Ponts', 'Troisvierges', 'Trooz', 'Tubize', 'Turnhout', 'Ukkel-Kalevoet/Uccle-Calevoet', 'Ukkel-Stalle/Uccle-Stalle', 'Valence TGV', 'Veltem', 'Vertrijk', 'Verviers-Central', 'Verviers-Palais', 'Veurne', 'Viane-Moerbeke', 'Vichte', 'Vielsalm', 'Vijfhuizen', 'Ville-Pommerœul', 'Villers-la-Ville', 'Vilvoorde', 'Virton', 'Visé', 'Viville', 'Voroux', 'Vorst-Oost/Forest-Est', 'Vorst-Zuid/Forest-Midi', 'Waarschoot', 'Walcourt', 'Waregem', 'Waremme', 'Waterloo', 'Watermaal/Watermael', 'Wavre', 'Weerde', 'Welkenraedt', 'Welle', 'Wervik', 'Wespelaar-Tildonk', 'Wetteren', 'Wevelgem', 'Wezemaal', 'Wichelen', 'Wijgmaal', 'Wildert', 'Willebroek', 'Wilwerwiltz', 'Wolfstee', 'Wondelgem', 'Yves-Gomezée', 'Yvoir', 'Zandbergen', 'Zaventem', 'Zedelgem', 'Zeebrugge-Dorp', 'Zeebrugge-Strand', 'Zele', 'Zellik', 'Zichem', 'Zingem', 'Zolder', 'Zonhoven', 'Zottegem', 'Zwankendamme', 'Zwijndrecht', 'Écaussinnes'] - } - - function update() { - var filteredStations = stations[Util.getLocal()].filter(function (station) { return station.toLowerCase().indexOf(searchString) !== -1 }) - - var station - var found - var i - - // helper objects that can be quickly accessed - var filteredStationObject = new Object - for (i = 0; i < filteredStations.length; ++i) { - filteredStationObject[filteredStations[i]] = true - } - var existingStationObject = new Object - for (i = 0; i < count; ++i) { - station = get(i).name - existingStationObject[station] = true - } - - // remove items no longer in filtered set - i = 0 - while (i < count) { - station = get(i).name - found = filteredStationObject.hasOwnProperty(station) - if (!found) { - remove(i) - } else { - i++ - } - } - - // add new items - for (i = 0; i < filteredStations.length; ++i) { - station = filteredStations[i] - found = existingStationObject.hasOwnProperty(station) - if (!found) { - // for simplicity, just adding to end instead of corresponding position in original list - append({ "name": station}) - } - } - } - } -} diff --git a/qml/pages/TripDetailPage.qml b/qml/pages/TripDetailPage.qml deleted file mode 100644 index 90fe045..0000000 --- a/qml/pages/TripDetailPage.qml +++ /dev/null @@ -1,61 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 -import "./components" - -Page { - property var tripModel - property int indexModel - - SilicaFlickable { - anchors.fill: parent - contentHeight: tripDetailColumn.height - - VerticalScrollDecorator {} - - Column { - id: tripDetailColumn - width: parent.width - spacing: Theme.paddingLarge - - PageHeader { title: qsTr("Trip detail") } - - TripItem { - departStation: tripModel.get(indexModel).depart.station - departTime: tripModel.get(indexModel).depart.time.time - departDelay: tripModel.get(indexModel).depart.delay - departTrain: tripModel.get(indexModel).depart.train - departTrack: tripModel.get(indexModel).depart.platform - departTrackChanged: tripModel.get(indexModel).depart.platformChanged - arriveStation: tripModel.get(indexModel).arrival.station - arriveTime: tripModel.get(indexModel).arrival.time.time - arriveDelay: tripModel.get(indexModel).arrival.delay - arriveTrain: tripModel.get(indexModel).arrival.train - arriveTrack: tripModel.get(indexModel).arrival.platform - arriveTrackChanged: tripModel.get(indexModel).arrival.platformChanged - canceled: tripModel.get(indexModel).depart.canceled || tripModel.get(indexModel).arrival.canceled? true: false // When arrive or depart is canceled then this connection is not valid - vias: tripModel.get(indexModel).vias.number - viasModel: tripModel.get(indexModel).vias.via - alerts: tripModel.get(indexModel).alerts.alert - showAlerts: false - Component.onCompleted: expanded = true - } - } - } -} diff --git a/qml/pages/TripPage.qml b/qml/pages/TripPage.qml deleted file mode 100644 index f6359db..0000000 --- a/qml/pages/TripPage.qml +++ /dev/null @@ -1,78 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 -import "./components" -import "./js/trip.js" as Trip - -Page { - property string from - property string to - property string time - property string date - property bool succes: true //Wait until changed - Component.onCompleted: Trip.load(from, to, time, date) - - SilicaListView { - width: parent.width; height: parent.height - header: PageHeader { title: qsTr("Trip planner") } - model: tripModel - delegate: ListItem { - width: ListView.view.width - contentHeight: item.height - //enabled: false //Temp disabled TripDetailPage until we figured out how to show intermediate stops //!item.canceled // Disable TripDetailPage when train is canceled - onClicked: pageStack.push(Qt.resolvedUrl("TripDetailPage.qml"), { tripModel: tripModel, indexModel: index }) - TripItem { - id: item - departStation: model.depart.station - departTime: model.depart.time.time - departDelay: model.depart.delay - departTrain: model.depart.train - departTrack: model.depart.platform - departTrackChanged: model.depart.platformChanged - arriveStation: model.arrival.station - arriveTime: model.arrival.time.time - arriveDelay: model.arrival.delay - arriveTrain: model.arrival.train - arriveTrack: model.arrival.platform - arriveTrackChanged: model.arrival.platformChanged - canceled: model.depart.canceled || model.arrival.canceled? true: false // When arrive or depart is canceled then this connection is not valid - vias: model.vias.number - viasModel: model.vias.via - alerts: model.alerts.alert - showAlerts: false - expanded: false - } - } - - ViewPlaceholder { - enabled: !succes - text: qsTr("No connections found") - hintText: qsTr("Try another station") + "..." - } - } - - LoadIndicator { - anchors { fill: parent } - show: tripModel.count==0 && succes - } - - ListModel { - id: tripModel - } -} diff --git a/qml/pages/components/CancelOverlay.qml b/qml/pages/components/CancelOverlay.qml deleted file mode 100644 index c47e5b6..0000000 --- a/qml/pages/components/CancelOverlay.qml +++ /dev/null @@ -1,47 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 - -// Train canceled overlay -Item { - width: parent.width - height: parent.height - - // Nice background - Rectangle { - anchors { fill: parent } - opacity: 0.75 - gradient: Gradient { - GradientStop { position: 0.0; color: Theme.highlightBackgroundColor } - GradientStop { position: 0.33; color: Theme.highlightDimmerColor } - GradientStop { position: 0.66; color: Theme.highlightDimmerColor } - GradientStop { position: 1.0; color: Theme.highlightBackgroundColor } - } - } - - // Canceled text - Label { - anchors { centerIn: parent } - text: qsTr("canceled") + " :-(" - color: Theme.primaryColor - font.bold: true - font.capitalization: Font.AllUppercase - font.pixelSize: Theme.fontSizeLarge - } -} diff --git a/qml/pages/components/DisturbancesView.qml b/qml/pages/components/DisturbancesView.qml deleted file mode 100644 index 327a376..0000000 --- a/qml/pages/components/DisturbancesView.qml +++ /dev/null @@ -1,44 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 -import "../js/disturbances.js" as Disturbances - -SilicaListView { - width: parent.width - height: childrenRect.height - - property bool showStation: true - - delegate: ListItem { - width: ListView.view.width - contentHeight: item.height*1.1 - enabled: model.hasOwnProperty("link") - onClicked: Qt.openUrlExternally(model.link) // If model has link then open it when user clicks on the item - Column { - id: item - width: parent.width - anchors { centerIn: parent } - spacing: Theme.paddingSmall - SectionHeader { text: model.title } - TextLabel { labelText: model.text } - //SectionHeader { text: showStation? model.header.replace(".", ""): model.header.split(":")[1].replace(".", "") } // Remove "." at the end - //TextLabel { labelText: model.description } - } - } -} diff --git a/qml/pages/components/LiveBoardItem.qml b/qml/pages/components/LiveBoardItem.qml deleted file mode 100644 index ad672d2..0000000 --- a/qml/pages/components/LiveBoardItem.qml +++ /dev/null @@ -1,98 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 -import "../js/liveboard.js" as LiveBoard - -Item { - width: parent.width - height: liveboardRow.height - - property string trainName - property string trainType - property string delay - property string departTime - property string track - property bool trackChanged - property bool trainCanceled - property bool modelHasDelay - property var announcements - - Row { - id: liveboardRow - width: parent.width - height: Theme.itemSizeSmall - anchors { left: parent.left; right: parent.right; leftMargin: Theme.horizontalPageMargin; rightMargin: Theme.horizontalPageMargin; verticalCenter: parent.verticalCenter } - spacing: Theme.paddingLarge - - Label { - id: departLabel - anchors { verticalCenter: parent.verticalCenter } - truncationMode: TruncationMode.Fade - font.bold: true - color: app.yellow - text: departTime - } - - Label { - id: trainLabel - width: parent.width-departLabel.width-typeLabel.width-trackLabel.width-liveboardRow.spacing*4 - (modelHasDelay? delayLabel.width: 0) - anchors { verticalCenter: parent.verticalCenter } - truncationMode: TruncationMode.Fade - font.bold: true - color: app.yellow - text: trainName - } - - Label { - id: typeLabel - anchors { verticalCenter: parent.verticalCenter } - truncationMode: TruncationMode.Fade - font.bold: true - color: app.yellow - text: page.isPortrait? trainType.substring(0,2): trainType - } - - Rectangle { - id: trackLabel - color: trackChanged? app.yellow: app.transparent - width: parent.height - height: parent.height - - Label { - anchors { centerIn: parent } - truncationMode: TruncationMode.Fade - font.bold: true - color: trackChanged? app.black: app.yellow - text: track - } - } - - Label { - id: delayLabel - anchors { verticalCenter: parent.verticalCenter } - truncationMode: TruncationMode.Fade - font.bold: true - color: app.red - visible: delay > 0 - text: LiveBoard.formatDelay(delay) - } - } - - CancelOverlay { visible: trainCanceled } -} diff --git a/qml/pages/components/LoadIndicator.qml b/qml/pages/components/LoadIndicator.qml deleted file mode 100644 index b5a68a4..0000000 --- a/qml/pages/components/LoadIndicator.qml +++ /dev/null @@ -1,37 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 - -Item { - property bool show - - BusyIndicator { - id: loadingIndicator - anchors { centerIn: parent } - running: Qt.application.active && show //tripModel.count==0 && succes - size: BusyIndicatorSize.Large - } - - Label { - opacity: show? 1.0: 0.0 - anchors { top: loadingIndicator.bottom; topMargin: Theme.paddingLarge; horizontalCenter: parent.horizontalCenter } - text: qsTr("Loading") + "..." - Behavior on opacity { FadeAnimation{} } - } -} diff --git a/qml/pages/components/TripItem.qml b/qml/pages/components/TripItem.qml deleted file mode 100644 index 2310f92..0000000 --- a/qml/pages/components/TripItem.qml +++ /dev/null @@ -1,371 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -import QtQuick 2.2 -import Sailfish.Silica 1.0 -import "../js/trip.js" as Trip - -Item { // Reuse it for TripDetailPage and TripDetail - width: parent.width - height: tripColumn.height + Theme.paddingLarge //Extra margins - - //Properties - property string departTime - property string departStation - property string departTrain - property string departTrack - property bool departTrackChanged - property int departDelay - property string arriveTime - property string arriveStation - property string arriveTrain - property string arriveTrack - property bool arriveTrackChanged - property int arriveDelay - property int currentStop - property bool canceled - property bool expanded - property bool showAlerts: true - property var vias - property var viasModel - property var alerts - property var stopsModel: viasModel // BeRail V1.X build stopsModel with intermediate stops - - // Internal variables - property var _hasDelay: [departDelay > 0, arriveDelay > 0] - property int _changeIndex - property bool _hasAlert: alerts.length > 0 - - onAlertsChanged: Trip.convertAlertsToListmodel(alerts) - - Column { - id: tripColumn - width: parent.width - anchors { left: parent.left; right: parent.right; leftMargin: Theme.horizontalPageMargin; rightMargin: Theme.horizontalPageMargin; verticalCenter: parent.verticalCenter } - - // Depart item - Item { - width: parent.width - height: Theme.itemSizeSmall - - // Depart time - Rectangle { - id: departTimeItem - width: Theme.itemSizeMedium - height: Theme.itemSizeSmall - scale: expanded? 1.0: 0.9 - radius: width/7 - color: app.green - Behavior on height { NumberAnimation { duration: 750 } } - Behavior on width { NumberAnimation { duration: 750 } } - - Label { - id: departTimeLabel - anchors { centerIn: _hasDelay[0]? undefined: parent; top: _hasDelay[0]? parent.top: undefined; topMargin: Theme.paddingSmall; horizontalCenter: _hasDelay[0]? parent.horizontalCenter: undefined } - font.bold: true - text: departTime - } - - Label { - id: departDelayLabel - anchors { top: departTimeLabel.bottom; horizontalCenter: parent.horizontalCenter } - text: Trip.formatDelay(departDelay) - visible: _hasDelay[0] - font.pixelSize: Theme.fontSizeTiny - font.bold: true - } - } - - // Depart station name - Label { - id: departStationLabel - width: parent.width - departTimeItem.width - journeyInformation.width - 3*Theme.paddingLarge - anchors { left: departTimeItem.right; leftMargin: Theme.paddingLarge } - truncationMode: TruncationMode.Fade - font.capitalization: Font.AllUppercase - text: departStation - } - - // Track number - Label { - id: departTrackLabel - z: 1 - anchors { top: departStationLabel.bottom; left: departTimeItem.right; leftMargin: Theme.paddingLarge } - text: departTrack.length > 0? qsTr("Track %1").arg(departTrack): qsTr("Track ???") // Placeholder when unknown - visible: true //settings.showUnknownTrackLabel - font.pixelSize: Theme.fontSizeTiny*1.2 - } - - Rectangle { - width: departTrackLabel.width*1.25 - height: departTrackLabel.height*1.05 - radius: width/4 - opacity: Theme.highlightBackgroundOpacity - anchors { centerIn: departTrackLabel } - color: app.yellow - visible: departTrackChanged - } - - // Train & journey information - Item { - id: journeyInformation - width: Theme.itemSizeMedium - height: childrenRect.height - anchors { right: parent.right; rightMargin: Theme.horizontalPageMargin } - - // Train name - Label { - id: trainName - width: parent.width - wrapMode: Text.WordWrap - truncationMode: TruncationMode.Fade - text: departTrain //train - } - - // #Vias - Label { - id: viasLabel - anchors { top: trainName.bottom; topMargin: Theme.paddingMedium } - text: vias - visible: vias - } - - Image { - id: changeIcon - width: Theme.iconSizeSmall - height: width - anchors { verticalCenter: viasLabel.verticalCenter; left: viasLabel.right; leftMargin: Theme.paddingMedium } - source: "qrc:///icons/icon-change.png" - visible: vias - asynchronous: true - } - - // Alerts - Label { - id: alertsLabel; - anchors { top: changeIcon.bottom; topMargin: Theme.paddingMedium } - text: alerts.length - visible: _hasAlert - } - - Image { - width: Theme.iconSizeSmall - height: width - anchors { verticalCenter: alertsLabel.verticalCenter; left: alertsLabel.right; leftMargin: Theme.paddingMedium } - source: "qrc:///icons/icon-announcement.png" - visible: _hasAlert - asynchronous: true - } - } - - } - - // Traject - Item { - id: trajectItem - width: parent.width - height: expanded? Trip.calculateTraject(viasModel.length): 0 - opacity: expanded? 1.0: 0.0 - Behavior on opacity { FadeAnimation { duration: expanded? 200: 750} } // Overlap with animation when closing - Behavior on height { NumberAnimation { duration: 500 } } - - // Traject indicator + progress - Rectangle { - id: traject - width: Theme.itemSizeSmall/4 - height: parent.height - anchors { left: parent.left; leftMargin: departTimeLabel.x + departTimeLabel.width/2 - width/2 } // Center on labels - color: Theme.highlightDimmerColor - - // Progress indicator - Rectangle { - id: progress - width: Theme.itemSizeSmall/4 - height: 0 //expanded? Trip.calculateProgress(currentStop): 0 BeRail V1.X - color: Theme.highlightColor - Behavior on height { NumberAnimation { duration: 500 } } - } - - // Progress indicator stops - Column { - anchors { horizontalCenter: traject.horizontalCenter; top: parent.top; topMargin: Theme.itemSizeSmall } - spacing: Theme.paddingLarge*3 - Repeater { - id: stopsProgress - model: viasModel - Item { - width: Theme.itemSizeSmall - height: Theme.itemSizeSmall/2 - - // Normal stop - Rectangle { - id: stopBullet - width: Theme.itemSizeSmall/2 - height: width - anchors { horizontalCenter: parent.horizontalCenter } - radius: width/2 - visible: !viaStopBullet.visible - color: index > currentStop? Theme.highlightDimmerColor: Theme.highlightColor - } - - // Change required stop - Rectangle { - id: viaStopBullet - y: viaStopDelayLabel.visible? -height/4: 0 //Use the space in both directions if bigger then other items - width: Theme.itemSizeSmall - height: viaStopDelayLabel.visible? Theme.itemSizeSmall/2 + viaStopDelayLabel.height: Theme.itemSizeSmall/2 - scale: expanded? 1.0: 0.0 // Animate size: 0 <-> full size - radius: width/7 - color: app.orange - visible: true //changes == index TO DO - Behavior on height { NumberAnimation { duration: 750 } } - Behavior on width { NumberAnimation { duration: 750 } } - - // Change time - Label { - id: viaStopTimeLabel - anchors { horizontalCenter: parent.horizontalCenter } - text: modelData.depart.time.time - font.pixelSize: Theme.fontSizeSmall - font.bold: true - } - - // Delay - Label { - id: viaStopDelayLabel - anchors { top: viaStopTimeLabel.bottom; horizontalCenter: parent.horizontalCenter } - text: Trip.formatDelay(modelData.depart.delay) - visible: modelData.depart.delay > 0 - font.pixelSize: Theme.fontSizeTiny - font.bold: true - } - } - - // Stop name - Label { - id: viaStopStationLabel - anchors { left: viaStopBullet.visible? viaStopBullet.right: stopBullet.right; leftMargin: Theme.paddingLarge; right: parent.right; rightMargin: Theme.paddingMedium; verticalCenter: parent.verticalCenter } - font.capitalization: Font.SmallCaps - text: modelData.station - } - - Label { - anchors { left: viaStopBullet.visible? viaStopBullet.right: stopBullet.right; leftMargin: Theme.paddingLarge; right: parent.right; rightMargin: Theme.paddingMedium; top: viaStopStationLabel.bottom; topMargin: Theme.paddingSmall } - font.pixelSize: Theme.fontSizeTiny - text: qsTr("Track %1 → Track %2").arg(modelData.arrival.platform).arg(modelData.depart.platform) + " | ⏱" + modelData.timebetween - } - } - } - } - } - } - - // Arrive item - Item { - width: parent.width - height: Theme.itemSizeSmall - - - // Arrive time - Rectangle { - id: arriveTimeItem - width: Theme.itemSizeMedium - height: Theme.itemSizeSmall - scale: expanded? 1.0: 0.9 - radius: width/7 - color: app.red - Behavior on height { NumberAnimation { duration: 750 } } - Behavior on width { NumberAnimation { duration: 750 } } - - Label { - id: arriveTimeLabel - anchors { centerIn: _hasDelay[1]? undefined: parent; top: _hasDelay[1]? parent.top: undefined; topMargin: Theme.paddingSmall; horizontalCenter: _hasDelay[1]? parent.horizontalCenter: undefined } - font.bold: true - text: arriveTime - } - - Label { - id: arriveDelayLabel - anchors { top: arriveTimeLabel.bottom; horizontalCenter: parent.horizontalCenter } - text: Trip.formatDelay(arriveDelay) - visible: _hasDelay[1] - font.pixelSize: Theme.fontSizeTiny - font.bold: true - } - } - - // Arrive station name - Label { - id: arriveStationLabel - width: parent.width - arriveTimeItem.width - journeyInformation.width - 3*Theme.paddingLarge - anchors { left: arriveTimeItem.right; leftMargin: Theme.paddingLarge } - truncationMode: TruncationMode.Fade - font.capitalization: Font.AllUppercase - text: arriveStation - } - - // Track number - Label { - id: arriveTrackLabel - z: 1 - anchors { top: arriveStationLabel.bottom; left: arriveTimeItem.right; leftMargin: Theme.paddingLarge } - text: arriveTrack.length > 0? qsTr("Track %1").arg(arriveTrack): qsTr("Track ???") - visible: true //settings.showUnknownTrackLabel - font.pixelSize: Theme.fontSizeTiny*1.2 - } - - Rectangle { - width: arriveTrackLabel.width*1.25 - height: arriveTrackLabel.height*1.05 - anchors { centerIn: arriveTrackLabel } - radius: width/4 - opacity: Theme.highlightBackgroundOpacity - color: app.yellow - visible: arriveTrackChanged - } - - Item { - width: Theme.itemSizeMedium - height: childrenRect.height - anchors { right: parent.right; rightMargin: Theme.horizontalPageMargin } - visible: expanded // Only show when enough space is allocated - - // Train name - Label { - id: trainNameArrive - width: parent.width - wrapMode: Text.WordWrap - truncationMode: TruncationMode.Fade - text: arriveTrain //train - } - } - } - - ListModel { - id: alertsModel - } - - DisturbancesView { - id: alertsView - model: alertsModel - showStation: false - visible: expanded // Only visible when expanded - } - } - - CancelOverlay { visible: canceled } -} diff --git a/qml/pages/js/disturbances.js b/qml/pages/js/disturbances.js deleted file mode 100644 index 6874543..0000000 --- a/qml/pages/js/disturbances.js +++ /dev/null @@ -1,43 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -function load() { - alertsModel.clear() // Make model empty - - python.call("app.disturbances.get_disturbances", [], function(disturbances) { - if(disturbances) { // Valid trip is TRUE - if("empty" in disturbances) { // No data available - succes = false; - return false; - } - for(var i=0; i < Object.keys(disturbances.disturbance).length; i++) { // Run through whole connection object - alertsModel.append({ - "header": disturbances.disturbance[i].title, - "description": disturbances.disturbance[i].description, - "time": disturbances.disturbance[i].time, - "id": disturbances.disturbance[i].id, - "link": disturbances.disturbance[i].link - }); - } - return true; - } - else { - succes = false; - return false; - } - }); -} diff --git a/qml/pages/js/liveboard.js b/qml/pages/js/liveboard.js deleted file mode 100644 index 41e760c..0000000 --- a/qml/pages/js/liveboard.js +++ /dev/null @@ -1,138 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -function getTimeString() { - var time = new Date(); - var hours = time.getHours(); - var minutes = time.getMinutes(); - var seconds = time.getSeconds(); - if(hours < 10) { - hours = "0" + hours; - } - if(minutes < 10) { - minutes = "0" + minutes; - } - if(seconds < 10) { - seconds = "0" + seconds; - } - return hours + ":" + minutes + ":" + seconds; -} - -function load(station) { - liveboardModel.clear(); // Make model empty - alertsModel.clear(); - succes = true; // Reset - - python.call("app.liveboard.get_liveboard", [station], function(liveboard) { - if(liveboard) { // Valid liveboard is TRUE - var _hasDelay = false; - - // No data available - if("empty" in liveboard) { - succes = false; - return false; - } - - // Build AlertsModel with all alerts for a certain station - for(var i=0; i < Object.keys(liveboard.departures.departure).length; i++) { - - if(_hasDelay == false && liveboard.departures.departure[i].delay > 0) { // Detect if we have a delay in this data, improve performance by skipping this test if _hasDelay is already 'true' - _hasDelay = true; - } - - if(liveboard.departures.departure[i].hasOwnProperty("alerts")) { // Detect if we have alerts in this data - for(var j=0; j < Object.keys(liveboard.departures.departure[i].alerts.alert).length; j++) { - var newEntry = true; - for(var k=0; k < alertsModel.count; k++) { - if(alertsModel.count == 0) { // Only when we have an entry we should check for duplicates - break; - } - - if(alertsModel.get(k).header == alertsModel.get(j).header) { - newEntry = false; - break; - } - } - - if(newEntry) { - alertsModel.append({ - "header": liveboard.departures.departure[i].alerts.alert[j].header, - "description": liveboard.departures.departure[i].alerts.alert[j].description - }); - } - } - } - } - - // Build liveboardModel - for(var i=0; i < Object.keys(liveboard.departures.departure).length; i++) { - liveboardModel.append({ - "depart": { "station": liveboard.departures.departure[i].station, - "stationinfo": liveboard.departures.departure[i].stationinfo, - "time": formatUnixTimeToUTC(liveboard.departures.departure[i].time, true), - "delay": liveboard.departures.departure[i].delay, - "canceled": parseInt(liveboard.departures.departure[i].canceled) !== 0, // Convert to int first then to boolean - "platform": liveboard.departures.departure[i].platform.length === 0? liveboard.departures.departure[i].platforminfo.name: liveboard.departures.departure[i].platform, // Fallback when platform is missing - "platformChanged": parseInt(liveboard.departures.departure[i].platforminfo.normal) !== 1, // Convert to boolean - "vehicleId": liveboard.departures.departure[i].vehicle, - "train": liveboard.departures.departure[i].vehicle.split(".")[2] // BE.NMBS.TRAINID - }, - "hasDelay": _hasDelay, - "alerts": liveboard.departures.departure[i].hasOwnProperty("alerts")? liveboard.departures.departure[i].alerts.alert: [] - }); - } - } - else { - succes = false; - } - }); -} - -function formatUnixTimeToUTC(unixTime, leadingZero) { // Arrive/depart time is given in UNIX time format - var unixTimeObject = new Date(unixTime * 1000); - var months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; - var year = unixTimeObject.getFullYear(); - var month = months[unixTimeObject.getMonth()]; - var day = unixTimeObject.getDate(); - var hour = unixTimeObject.getHours(); - var min = unixTimeObject.getMinutes(); - var sec = unixTimeObject.getSeconds(); - if (leadingZero && day < 10) { - day = "0" + day; - } - if (leadingZero && min < 10) { - min = "0" + min; - } - if (leadingZero && hour < 10) { - hour = "0" + hour; - } - var time = hour + ":" + min; - var date = day + " " + month + " " + year.toString().substring(2,2); - var object = { "time": time, "date": date}; - return object; -} - -function formatDelay(delay) { // Convert the seconds to a string of hours and minutes - delay = delay/60; // Seconds to minutes - var delayHour = Math.floor(delay/60); // Minutes to hours - var delayMin = Math.ceil(delay); // Round up - if(delayMin < 10) { - delayMin = "0" + delayMin; - } - - return "+" + delayHour + "H" + delayMin; -} diff --git a/qml/pages/js/station.js b/qml/pages/js/station.js deleted file mode 100644 index 7e1a7b4..0000000 --- a/qml/pages/js/station.js +++ /dev/null @@ -1,16 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ diff --git a/qml/pages/js/trip.js b/qml/pages/js/trip.js deleted file mode 100644 index 7f23ea8..0000000 --- a/qml/pages/js/trip.js +++ /dev/null @@ -1,184 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -function convertAlertsToListmodel(data) { - for(var i=0; i < data.length; i++) { - alertsModel.append(data[i]); - } -} - -function calculateTraject(numberOfStops) { - return numberOfStops*(Theme.itemSizeSmall/2) + (numberOfStops-1)*(3*Theme.paddingLarge) + 2*Theme.itemSizeSmall; // Each stop has a height of Theme.itemSizeSmall/2 for the stop itself, 2*Theme.paddingLarge as spacing and Theme.itemsSizeSmall as intial spacing -} - -function calculateProgress(currentStop) { - return currentStop*(Theme.itemSizeSmall/2 + 3*Theme.paddingLarge) + Theme.itemSizeSmall/2; // Middle of the current stop -} - -function formatDelay(delay) { - var hours = Math.floor(delay/60); - var minutes = delay%60; - if(minutes < 10) { - return "+ " + hours + ":0" + minutes; - } - else { - return "+ " + hours + ":" + minutes; - } -} - -function load(from, to, time, date, detail) { - python.call("app.route.get_route", [from, to, formatTimeForAPI(time), formatDateForAPI(date), settings.arriveFromGivenTime], function(trip) { - if(trip) { // Valid trip is TRUE - succes = true; // Reset when previous request failed - for(var i=0; i < Object.keys(trip).length; i++) { // Run through whole connection object - tripModel.append({ - "depart": { "station": trip[i].departure.station, - "stationinfo": trip[i].departure.stationinfo, - "time": formatUnixTimeToUTC(trip[i].departure.time, true), - "delay": trip[i].departure.delay, - "canceled": parseInt(trip[i].departure.canceled) !== 0, //C onvert to int first then to boolean - "platform": trip[i].departure.platform.length === 0? trip[i].departure.platforminfo.name: trip[i].departure.platform, // Fallback when platform is missing - "platformChanged": parseInt(trip[i].departure.platforminfo.normal) !== 1, // Convert to boolean - "vehicleId": trip[i].departure.vehicle, - "direction": trip[i].departure.direction, - "train": trip[i].departure.vehicle.split(".")[2] // BE.NMBS.TRAINID - }, - "arrival": { "station": trip[i].arrival.station, - "stationinfo": trip[i].arrival.stationinfo, - "time": formatUnixTimeToUTC(trip[i].arrival.time, true), - "delay": trip[i].arrival.delay, - "canceled": parseInt(trip[i].arrival.canceled) !== 0, // Convert to int first and then to boolean - "platform": trip[i].arrival.platform.length === 0? trip[i].arrival.platforminfo.name: trip[i].arrival.platform, // Fallback when platform is missing - "platformChanged": parseInt(trip[i].arrival.platforminfo.normal) !== 1, // Convert to boolean - "vehicleId": trip[i].arrival.vehicle, - "direction": trip[i].arrival.direction, - "train": trip[i].arrival.vehicle.split(".")[2] // BE.NMBS.TRAINID - }, - "vias": { - "number": trip[i].hasOwnProperty("vias")? trip[i].vias.number: 0, // When no vias are available then write 0 and an empty array to create the same model for vias and non vias connections - "via": trip[i].hasOwnProperty("vias")? buildViaModel(trip[i]): [] - }, - "alerts": { - "alert": trip[i].hasOwnProperty("alerts")? trip[i].alerts.alert: [], - "number": trip[i].hasOwnProperty("alerts")? trip[i].alerts.number: 0 - }, - "duration": formatDuration(trip[i].duration), - //"stops": detail? buildStopsModel(): undefined; - }); - } - } - else { - succes = false; - } - }); -} - -function buildViaModel(trip) { - var viaArray = []; - for(var j=0; j < Object.keys(trip.vias.via).length; j++) { - viaArray.push({ - "depart": { - "direction": trip.vias.via.hasOwnProperty("direction")? trip.vias.via[j].direction.name: "", // iRail tries to add an direction but that's not always possible - "time": formatUnixTimeToUTC(trip.vias.via[j].departure.time, true), - "delay": trip.vias.via[j].departure.delay, - "canceled": parseInt(trip.vias.via[j].departure.canceled) !== 0, //convert to boolean - "platform": trip.vias.via[j].departure.platform, - "platformChanged": parseInt(trip.vias.via[j].departure.platforminfo.normal) !== 1, //convert to boolean - "vehicleId": trip.vias.via[j].departure.vehicle, - "train": trip.vias.via[j].vehicle.split(".")[2] // BE.NMBS.TRAIN - }, - "arrival": { - "time": formatUnixTimeToUTC(trip.vias.via[j].arrival.time, true), - "delay": trip.vias.via[j].arrival.delay, - "canceled": trip.vias.via[j].arrival.canceled !== 0, //convert to boolean - "platform": trip.vias.via[j].arrival.platform, - "platformChanged": trip.vias.via[j].arrival.platforminfo.normal !== 1, //convert to boolean - }, - "station": trip.vias.via[j].station, - "stationinfo": trip.vias.via[j].stationinfo, - "timebetween": formatTimeBetween(trip.vias.via[j].timeBetween) - }); - } - return viaArray; -} - -function formatUnixTimeToUTC(unixTime, leadingZero) { // Arrive/depart time is given in UNIX time format - var unixTimeObject = new Date(unixTime * 1000); - var months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; - var year = unixTimeObject.getFullYear(); - var month = months[unixTimeObject.getMonth()]; - var day = unixTimeObject.getDate(); - var hour = unixTimeObject.getHours(); - var min = unixTimeObject.getMinutes(); - var sec = unixTimeObject.getSeconds(); - if (leadingZero && day < 10) { - day = "0" + day; - } - if (leadingZero && min < 10) { - min = "0" + min; - } - if (leadingZero && hour < 10) { - hour = "0" + hour; - } - var time = hour + ":" + min; - var date = day + " " + month + " " + year.toString().substring(2,2); - var object = { "time": time, "date": date}; - return object; -} - -function formatTimeBetween(timebetween) { // Same as formatDelay - return formatDelay(timebetween).replace("+", ""); -} - -function formatDuration(duration) { // Same as formatDelay - return formatDelay(duration).replace("+", ""); -} - -function formatDelay(delay) { // Convert the seconds to a string of hours and minutes - delay = delay/60; // Seconds to minutes - var delayHour = Math.floor(delay/60); // Minutes to hours - var delayMin = Math.ceil(delay); // Round up - if(delayMin < 10) { - delayMin = "0" + delayMin; - } - - return "+" + delayHour + "H" + delayMin; -} - -function formatTrainName(iRailTrainId) { //Remove ID related stuff, we only need the name of the train - return iRailTrainId.split(".")[2]; -} - -function formatTimeForAPI(time) { // Convert time to API time - return time.replace(":", ""); -} - -function formatDateForAPI(date) { //Convert date to API date + remove white spaces - date = date.replace(" Jan ", "01"); - date = date.replace(" Feb ", "02"); - date = date.replace(" Mar ", "03"); - date = date.replace(" Apr ", "04"); - date = date.replace(" May ", "05"); - date = date.replace(" Jun ", "06"); - date = date.replace(" Jul ", "07"); - date = date.replace(" Aug ", "08"); - date = date.replace(" Sep ", "09"); - date = date.replace(" Oct ", "10"); - date = date.replace(" Nov ", "11"); - date = date.replace(" Dec ", "12"); - return date -} diff --git a/qml/pages/js/util.js b/qml/pages/js/util.js deleted file mode 100644 index 7796533..0000000 --- a/qml/pages/js/util.js +++ /dev/null @@ -1,84 +0,0 @@ -/* -* This file is part of BeRail. -* -* BeRail is free software: you can redistribute it and/or modify -* it under the terms of the GNU General Public License as published by -* the Free Software Foundation, either version 3 of the License, or -* (at your option) any later version. -* -* Foobar 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 General Public License for more details. -* -* You should have received a copy of the GNU General Public License -* along with BeRail. If not, see . -*/ - -var date = new Date(); - -function getHours(leadingZero) { - if(leadingZero) { - return addLeadingZero(date.getHours()); - } - return date.getHours(); -} - -function getMinutes(leadingZero) { - if(leadingZero) { - return addLeadingZero(date.getMinutes()); - } - return date.getMinutes(); -} - -function getDay(leadingZero) { - if(leadingZero) { - return addLeadingZero(date.getDate()); - } - return date.getDate(); -} - -function getMonth() { - return covertMonth(date.getMonth()); -} - -function covertMonth(month) { - var months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]; - return months[month]; -} - -function getYear() { - return date.getFullYear(); -} - -function addLeadingZero(value) { - if(value < 10) { - return "0" + value - } - return value -} - -function getLocal() { - var locale = Qt.locale().name - if(locale.match("EN")) { - return "EN"; - } - else if(locale.match("NL")) { - return "NL"; - } - else if(locale.match("FR")) { - return "FR" - } - else if(locale.match("DE")) { - return "DE"; - } - else { - return "EN"; - } -} - -function updatePythonLocal() { - python.call("app.language.set_language", [getLocal()], function(callback){ - pythonReady = true; // Local set, Python is ready - }) -}