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
- property alias url: view.url
- 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: settings.showArrivalsPreferred ? 1 : 0
- options: ListModel {
- id: dialogOptions
- ListElement {
- name: QT_TR_NOOP("Departures")
- }
- ListElement {
- name: QT_TR_NOOP("Arrivals")
- }
- }
+ selectedIndex: schedule.type
+ options: [
+ qsTr("Departures"),
+ qsTr("Arrivals")
+ ]
+ }
+ InfoBar {
+ id: infoBar
+ anchors.top: header.bottom
+ text: parent.name
}
Binding {
- target: settings
- property: "showArrivalsPreferred"
- value: header.selectedIndex === 1 ? true : false
+ target: schedule
+ property: "type"
+ value: header.selectedIndex
}
LabelStyle {
id: labelStyle
}
- WebView {
+ Item {
id: view
anchors {
- top: header.bottom;
- bottom: parent.bottom;
+ top: infoBar.bottom
+ bottom: parent.bottom
+ left: parent.left
+ right: parent.right
}
- width: parent.width
-
- settings.defaultFontSize: labelStyle.fontPixelSize
- settings.defaultFixedFontSize: labelStyle.fontPixelSize
- settings.standardFontFamily: labelStyle.fontFamily
+ 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)
+ }
+}