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