From 626ea07f2b4e6542d44dc2752ed3a7e2bcc66a62 Mon Sep 17 00:00:00 2001 From: Luciano Montanaro Date: Fri, 27 Dec 2013 12:12:34 +0100 Subject: [PATCH] Tweaked SailfishOS StationPage --- .../resources/sailfish/qml/pages/StationPage.qml | 46 ++++++++++++-------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/application/resources/sailfish/qml/pages/StationPage.qml b/application/resources/sailfish/qml/pages/StationPage.qml index 9d240d9..18fc8e1 100644 --- a/application/resources/sailfish/qml/pages/StationPage.qml +++ b/application/resources/sailfish/qml/pages/StationPage.qml @@ -9,32 +9,44 @@ Page { SilicaFlickable { id: view + pressDelay: 0 anchors.fill: parent + + function updateStation() { + view.state = "loading" + console.log("Updating station with " + schedule.name + ", " + schedule.code) + schedule.fetch(schedule.name, schedule.code) + } + PullDownMenu { MenuItem { text: qsTr("Update Schedule") - onClicked: updateStation() + onClicked: view.updateStation() } MenuItem { - text: qsTr("Departures") - onClicked: schedule.type = StationScheduleModel.DepartureSchedule + text: (schedule.type === StationScheduleModel.ArrivalSchedule ? + qsTr("Show Departures") : + qsTr("Show Arrivals")) + onClicked: (schedule.type = schedule.type === StationScheduleModel.ArrivalSchedule ? + StationScheduleModel.DepartureSchedule : + StationScheduleModel.ArrivalSchedule) } - MenuItem { - text: qsTr("Arrivals") - onClicked: schedule.type = StationScheduleModel.ArrivalSchedule + MenuLabel { + text: (schedule.type === StationScheduleModel.DepartureSchedule ? qsTr("Departures") : qsTr("Arrivals")) } } + PageHeader { + id: header + title: name + } SilicaListView { id: stationScheduleView - anchors.fill: parent + anchors.top: header.bottom + anchors.bottom: parent.bottom clip: true visible: false width: parent.width - cacheBuffer: 40 - header: PageHeader { - id: header - title: (schedule.type === StationScheduleModel.DepartureSchedule ? qsTr("Departures from ") : qsTr("Arrivals to ")) + name - } + cacheBuffer: 4 * Theme.itemSizeExtraLarge model: schedule delegate: StationScheduleDelegate { width: stationScheduleView.width @@ -48,6 +60,10 @@ Page { actualPlatform: model.actualPlatform expectedPlatfrom: model.expectedPlatform } + ViewPlaceholder { + enabled: stationScheduleView.count === 0 + text: qsTr("No trains are scheduled at this time") + } } BusyIndicator { id: busyIndicator @@ -121,11 +137,6 @@ Page { } ] - function updateStation() { - view.state = "loading" - console.log("Updating station with " + schedule.name + ", " + schedule.code) - schedule.fetch(schedule.name, schedule.code) - } StationScheduleModel { id: schedule onNameChanged: view.updateStation() @@ -137,5 +148,6 @@ Page { updateTimer.triggered.connect(view.updateStation) view.state = "loading" } + VerticalScrollDecorator {} } } -- 1.7.9.5