import QtQuick 1.1
-import QtWebKit 1.0
import com.nokia.meego 1.0
+import net.cirulla.quandoparte 1.0
+import "uiconstants.js" as UiConstants
Page {
- property alias html: view.html
- anchors.fill: parent
+ property alias name: schedule.name
tools: ToolBarLayout {
id: toolBar
- ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
- ToolIcon { iconId: "icon-m-toolbar-view-menu"; }
+ ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop() }
+ ToolIcon { iconId: "icon-m-toolbar-view-menu"; onClicked: menu.open() }
+ }
+ PageHeader {
+ id: header
+ anchors.top: parent.top
+ selectedIndex: schedule.type
+ options: [
+ qsTr("Departures"),
+ qsTr("Arrivals")
+ ]
+ }
+ InfoBar {
+ id: infoBar
+ anchors.top: header.bottom
+ text: parent.name
+ }
+ Binding {
+ target: schedule
+ property: "type"
+ value: header.selectedIndex
}
LabelStyle {
id: labelStyle
}
- WebView {
+ Item {
id: view
- anchors.fill: parent
- settings.defaultFontSize: labelStyle.fontPixelSize
- settings.defaultFixedFontSize: labelStyle.fontPixelSize
- settings.standardFontFamily: labelStyle.fontFamily
+ anchors {
+ top: infoBar.bottom
+ bottom: parent.bottom
+ left: parent.left
+ right: parent.right
+ }
+ DroppedShadow {
+ id: shadow
+ anchors.top: view.top
+ }
+ ListView {
+ id: stationScheduleView
+ clip: true
+ visible: false
+ width: parent.width
+ anchors {
+ top: shadow.top
+ bottom: parent.bottom
+ }
+ model: schedule
+ delegate: StationScheduleDelegate {
+ type: schedule.type
+ arrivalTime: model.arrivalTime
+ departureTime: model.departureTime
+ train: model.train
+ arrivalStation: model.arrivalStation
+ departureStation: model.departureStation
+ delay: model.delay
+ actualPlatform: model.actualPlatform
+ expectedPlatfrom: model.expectedPlatform
+ }
+ }
+ ScrollDecorator {
+ id: decorator
+ flickableItem: stationScheduleView
+ }
+ BusyIndicator {
+ id: busyIndicator
+ platformStyle: BusyIndicatorStyle {
+ size: "large"
+ }
+ anchors.centerIn: parent
+ visible: !stationScheduleView.visible
+ running: visible
+ }
+ states: [
+ State {
+ name: "loading"
+ PropertyChanges {
+ target: stationScheduleView
+ visible: false
+ }
+ },
+ State {
+ name: "ready"
+ PropertyChanges {
+ target: stationScheduleView
+ visible: true
+ }
+ }
+ ]
+ }
+ StationScheduleModel {
+ id: schedule
+ onNameChanged: schedule.fetch(name)
+ onLayoutChanged: view.state = "ready"
+ }
+ Settings {
+ id: settings
}
- }
+ Component.onCompleted: {
+ updateTimer.timeout.connect(updateStation)
+ }
+ function updateStation() {
+ schedule.fetch(schedule.name)
+ }
+}