e15fa93a2d78b56d31494f07a4cecc3ed5aae03d
[pywienerlinien] / gotovienna / gotovienna_qml / qml / gotovienna_qml / ResultRealtime.qml
1 import QtQuick 1.1
2 import com.nokia.meego 1.0
3 import com.nokia.extras 1.0
4 import "UIConstants.js" as UIConstants
5 import "ExtrasConstants.js" as ExtrasConstants
6
7 Page {
8     tools: commonTools
9
10     property string gline : ""
11     property string gstation : ""
12     property bool busy : true
13
14     Component {
15          id: departureDelegate
16
17          Item {
18              width: parent.width
19              height: 80
20
21              BorderImage {
22                  anchors.fill: parent
23                  visible: mouseArea.pressed
24                  source: theme.inverted ? 'image://theme/meegotouch-list-inverted-background-pressed-vertical-center': 'image://theme/meegotouch-list-background-pressed-vertical-center'
25              }
26
27              Item {
28                  anchors.fill: parent
29                  anchors.margins: UIConstants.DEFAULT_MARGIN
30
31                  Row {
32                      Text {
33                          id: l
34                          text: line // <----
35                          anchors.verticalCenter: parent.verticalCenter
36                          width: 70
37                          font.pixelSize: UIConstants.FONT_XLARGE
38                          font.bold: true
39                          font.family: ExtrasConstants.FONT_FAMILY_LIGHT
40                          color: !theme.inverted ? UIConstants.COLOR_FOREGROUND : UIConstants.COLOR_INVERTED_FOREGROUND
41                      }
42
43                      Column {
44                          anchors.verticalCenter: parent.verticalCenter
45
46                          Text {
47                              id: s
48                              text: station // <----
49                              width: 75
50                              font.pixelSize: UIConstants.FONT_LARGE
51                              font.family: ExtrasConstants.FONT_FAMILY_LIGHT
52                              color: !theme.inverted ? UIConstants.COLOR_FOREGROUND : UIConstants.COLOR_INVERTED_FOREGROUND
53                          }
54
55                          Text {
56                              id: d
57                              text: destination // <----
58                              color: !theme.inverted ? UIConstants.COLOR_SECONDARY_FOREGROUND : UIConstants.COLOR_INVERTED_SECONDARY_FOREGROUND
59                              font.family: ExtrasConstants.FONT_FAMILY_LIGHT
60                              font.pixelSize: UIConstants.FONT_LSMALL
61                          }
62                      }
63                  }
64              }
65
66              Column {
67                  anchors.right: parent.right
68                  anchors.verticalCenter: parent.verticalCenter
69                  Text {
70                      id: dep
71                      // FIXME strange int float transformation appears
72                      text: departure
73                      anchors.right: parent.right
74                      anchors.rightMargin: UIConstants.DEFAULT_MARGIN
75                      font.bold: true
76                      font.pixelSize: UIConstants.FONT_XLARGE
77                      font.family: ExtrasConstants.FONT_FAMILY_LIGHT
78                      color: !theme.inverted ? UIConstants.COLOR_FOREGROUND : UIConstants.COLOR_INVERTED_FOREGROUND
79                  }
80              }
81
82              MouseArea {
83                  id: mouseArea
84                  anchors.fill: parent
85                  onClicked: {
86                      console.debug("clicked: " + l.text)
87                  }
88              }
89          }
90      }
91
92     Component {
93              id: heading
94              Rectangle {
95                  width: parent.width
96                  height: childrenRect.height + 2*UIConstants.DEFAULT_MARGIN
97                  color: "lightsteelblue"
98
99                  Text {
100                      anchors {
101                          top: parent.top
102                          left: parent.left
103                          margins: UIConstants.DEFAULT_MARGIN
104                      }
105
106                      text: gstation + " [" + gline + "]"
107                      font.bold: true
108                      font.family: ExtrasConstants.FONT_FAMILY_LIGHT
109                      font.pixelSize: UIConstants.FONT_LSMALL
110                  }
111              }
112          }
113
114      ListView {
115          id: list
116          width: parent.width; height: parent.height
117
118          header: heading
119
120          model: ListModel {
121             ListElement {
122                 line: "N60"
123                 station: "Schottentor"
124                 destination: "Maurer Hauptplatz"
125                 departure: 5
126             }
127             ListElement {
128                 line: "N38"
129                 station: "Schottentor"
130                 destination: "Grinzing"
131                 departure: 7
132             }
133             ListElement {
134                 line: "N25"
135                 station: "Schottentor"
136                 destination: "Großfeldsiedlung"
137                 departure: 8
138             }
139             ListElement {
140                 line: "N41"
141                 station: "Schottentor"
142                 destination: "Pötzleinsdorf"
143                 departure: 12
144             }
145             ListElement {
146                 line: "N43"
147                 station: "Schottentor"
148                 destination: "Neuwaldegg"
149                 departure: 12
150             }
151             ListElement {
152                 line: "N66"
153                 station: "Schottentor"
154                 destination: "Liesing S"
155                 departure: 20
156             }
157             ListElement {
158                 line: "N38"
159                 station: "Schottentor"
160                 destination: "Grinzing"
161                 departure: 22
162             }
163             ListElement {
164                 line: "N25"
165                 station: "Schottentor"
166                 destination: "Großfeldsiedlung"
167                 departure: 35
168             }
169             ListElement {
170                 line: "N60"
171                 station: "Schottentor"
172                 destination: "Maurer Hauptplatz"
173                 departure: 35
174             }
175             ListElement {
176                 line: "N38"
177                 station: "Schottentor"
178                 destination: "Grinzing"
179                 departure: 37
180             }
181             ListElement {
182                 line: "N41"
183                 station: "Schottentor"
184                 destination: "Pötzleinsdorf"
185                 departure: "03:12"
186             }
187             ListElement {
188                 line: "N43"
189                 station: "Schottentor"
190                 destination: "Neuwaldegg"
191                 departure: 42
192             }
193             ListElement {
194                 line: "N66"
195                 station: "Schottentor"
196                 destination: "Liesing S"
197                 departure: 50
198             }
199             ListElement {
200                 line: "N38"
201                 station: "Schottentor"
202                 destination: "Grinzing"
203                 departure: 52
204             }
205          }
206          delegate: departureDelegate
207      }
208
209      ScrollDecorator {
210          id: scrolldecorator
211          flickableItem: list
212          platformStyle: ScrollDecoratorStyle {}
213      }
214
215      BusyIndicator {
216          id: busyIndicator
217          visible: busy
218          running: true
219          platformStyle: BusyIndicatorStyle { size: 'large' }
220          anchors.centerIn: parent
221      }
222 }