Remove trailing whitespace (no code changes)
[pywienerlinien] / ui / Overview.qml
1
2 import Qt 4.7
3
4 Rectangle {
5     width: 800
6     height: 400
7     color: 'black'
8
9     property alias model: lv.model
10
11
12     ListView {
13         id: lv
14         anchors.fill: parent
15
16         delegate: OverviewItem {
17             onShowDetails: lv.showDetails(details)
18         }
19
20         states: [
21             State {
22                 name: 'overview'
23             },
24             State {
25                 name: 'details'
26                 PropertyChanges {
27                     target: detailsRect
28                     opacity: 1
29                     scale: 1
30                 }
31             }
32         ]
33
34         Rectangle {
35             id: detailsRect
36             width: parent.width - 50
37             height: parent.height - 50
38             anchors.centerIn: parent
39             scale: 0
40             opacity: 0
41             color: '#aaa'
42
43             border {
44                 color: '#888'
45                 width: 10
46             }
47
48             Behavior on opacity { PropertyAnimation { duration: 250 }}
49
50             Behavior on scale {
51                 PropertyAnimation {
52                     duration: 500
53                     easing.type: Easing.InCubic
54                 }
55             }
56
57             Text {
58                 id: detailsTitle
59
60                 anchors.left: parent.left
61                 anchors.right: parent.right
62                 anchors.top: parent.top
63                 horizontalAlignment: Text.AlignHCenter
64                 anchors.topMargin: 20
65                 font.pixelSize: 30
66             }
67             
68             Text {
69                 id: detailsList
70
71                 anchors.left: parent.left
72                 anchors.right: parent.right
73                 anchors.top: detailsTitle.bottom
74                 horizontalAlignment: Text.AlignLeft
75                 font.pixelSize: 20
76             }
77
78             MouseArea {
79                 anchors.fill: parent
80                 onClicked: lv.state = 'overview'
81             }
82         }
83
84         function showDetails(details) {
85             detailsTitle.text = 'Details for ' + details.time_from + '-' + details.time_to
86             detailsList.text = ''
87             for(var k=0; k < details.details.length; k++) {
88                 if (details.details[k].station != '') {
89                         detailsList.text += 'Station: ' + details.details[k].station + '\n' + details.details[k].info + '\n'
90                 }
91             }
92             lv.state = 'details'
93         }
94     }
95 }
96