Some more experiments with the QML Mockup
[quandoparte] / application / resources / harmattan / qml / StationListPage.qml
1 import QtQuick 1.0
2 import com.nokia.meego 1.0
3 import "/usr/lib/qt4/imports/com/nokia/meego/UIConstants.js" as UiConstants
4
5 Page {
6     id: stationListPage
7     tools: toolBar
8     anchors.margins: UiConstants.DEFAULT_MARGIN
9     Column {
10         TextField {
11             placeholderText: "Search..."
12         }
13         ListView {
14             id: stationListView
15             anchors.fill: parent
16             model: ListModel {
17                 ListElement {
18                     name: "Genova Sestri Ponente"
19                 }
20                 ListElement {
21                     name: "Genova Cornigliano"
22                 }
23                 ListElement {
24                     name: "Genova Sampierdarena"
25                 }
26                 ListElement {
27                     name: "Genova Piazza Principe"
28                 }
29                 ListElement {
30                     name: "Genova Brignole"
31                 }
32                 ListElement {
33                     name: "Genova Sturla"
34                 }
35                 ListElement {
36                     name: "Genova Quinto"
37                 }
38                 ListElement {
39                     name: "Genova Nervi"
40                 }
41             }
42             delegate: Item {
43                 id: listItem
44                 height: 88
45                 width: parent.width
46                 BorderImage {
47                     id: background
48                     anchors.fill: parent
49                     // Fill page borders
50                     visible: mouseArea.pressed
51                     source: "image://theme/meegotouch-list-background-pressed-center"
52                 }
53                 Row {
54                     anchors.fill: parent
55
56                     Column {
57                         anchors.verticalCenter: parent.verticalCenter
58
59                         Label {
60                             id: mainText
61                             text: model.name
62                             //font.family: UiConstants.FONT_FAMILY
63                             //font.pixelSize: UiConstants.FONT_DEFAULT
64                         }
65                     }
66                 }
67                 MouseArea {
68                     id: mouseArea
69                     anchors.fill: background
70                     onClicked: {
71                         stationListPage.openFile(page)
72                     }
73                 }
74             }
75         }
76     }
77
78     Sheet {
79         id: settingsSheet
80         acceptButtonText: "Save"
81         rejectButtonText: "Cancel"
82         content: Item {
83             x: 16
84             y: 16
85             width: parent.width - 32
86             height: parent.height - 32
87             Column {
88                 spacing: 16
89                 anchors.fill: parent
90                 Row {
91                     height: 40
92                     spacing: 16
93                     anchors.left: parent.left
94                     anchors.right: parent.right
95                     Label {
96                         font.bold: true
97                         text: "Show Last Station on Startup"
98                         anchors.verticalCenter: parent.verticalCenter
99                     }
100                     Switch {
101                         anchors.verticalCenter: parent.verticalCenter
102                         id: showLastStationSwitch
103                         anchors.right: parent.right
104                     }
105                 }
106                 Row {
107                     height: 40
108                     spacing: 16
109                     anchors.left: parent.left
110                     anchors.right: parent.right
111                     Label {
112                         font.bold: true
113                         text: "Update Display Periodically"
114                         anchors.verticalCenter: parent.verticalCenter
115                     }
116                     Switch {
117                         anchors.verticalCenter: parent.verticalCenter
118                         anchors.right: parent.right
119                         id: periodicCheckSwitch
120                     }
121                 }
122             }
123         }
124     }
125
126     ToolBarLayout {
127         id: toolBar
128         ToolIcon { iconId: "icon-m-toolbar-back"; onClicked: pageStack.pop(); }
129         ToolIcon { iconId: "icon-m-toolbar-settings"; onClicked: settingsSheet.open(); }
130         ToolIcon { iconId: "icon-m-toolbar-view-menu"; }
131     }
132 }
133