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