New game dialog shows some more texts now
[chessclock] / qml / MainPage.qml
1 import QtQuick 1.1
2 import com.meego 1.0
3 import QtQuick 1.0
4
5
6 Page {
7     id: mainPage
8     tools: commonTools
9 //    Label {
10 //        id: label
11 //        anchors.centerIn: parent
12 //        text: qsTr("Hello world!")
13 //        visible: false
14 //    }
15 //    Button{
16 //        anchors.horizontalCenter: parent.horizontalCenter
17 //        anchors.top: label.bottom
18 //        anchors.topMargin: 10
19 //        text: qsTr("Click here!")
20 //        onClicked: newGameDialog.open()
21 //    }
22
23     Image
24     {
25         id: bigLogo
26 //        anchors.fill: parent
27 //        anchors.left: menuList.right
28
29         source: ":/rc/pic/logo.png"
30     }
31
32     ListModel
33     {
34         id: menuModel
35
36         ListElement
37         {
38             name: "Normal clock"
39             askAddition: false
40
41
42         }
43
44         ListElement
45         {
46             name: "Addition before"
47             askAddition: true
48         }
49
50         ListElement
51         {
52             name: "Addition after"
53             askAddition: true
54         }
55
56         ListElement
57         {
58             name: "Delay"
59             askAddition: true
60         }
61
62         ListElement
63         {
64             name: "Delay after"
65             askAddition: true
66         }
67
68         ListElement
69         {
70             name:"Hour Glass"
71             askAddition: false
72         }
73
74     }
75
76
77     ListView
78     {
79         id: menuList
80
81         anchors.left: bigLogo.right
82         anchors.right: parent.right
83         anchors.top: parent.top
84         anchors.bottom: parent.bottom
85
86
87          model: menuModel
88
89          delegate: Text
90          {
91              text: name
92              font.pointSize: 40
93              anchors.topMargin: 12
94
95             MouseArea
96             {
97                 anchors.fill: parent
98                 onClicked: {newGameDialog.name = name; newGameDialog.askAddition = askAddition; newGameDialog.open()}
99             }
100         }
101
102     }
103
104
105
106
107
108     Dialog
109     {
110         id:newGameDialog
111
112         property string name
113         property bool askAddition
114
115
116         title:Label
117         {
118             color:"white"
119             font.pointSize: 40
120             text: newGameDialog.name
121         }
122
123
124         content:
125             Grid
126             {
127                 columns: 3
128
129                 Row
130                 {
131                     id: rowRow
132                     spacing: 10
133 //                    anchors.top: parent.top
134 //                    anchors.horizontalCenter: parent.horizontalCenter
135
136                     Text
137                     {
138  //                     width: rowRow.width - rowRow.spacing - switchComponent.width - whiteSmall.width - blackSmall.width
139  //                     height: switchComponent.height
140                         verticalAlignment: Text.AlignVCenter
141                         text: "Equal times"
142                         color: "white"
143                         font.pointSize: 26
144                     }
145
146                     Switch
147                     {
148                         id: switchComponent
149                     }
150                 }
151                 Image
152                 {
153                     id: whiteSmall
154                     source: ":/rc/pic/white_small.png"
155                 }
156
157                 Image
158                 {
159                     id: blackSmall
160                     source: ":/rc/pic/black_small.png"
161                 }
162
163                 Text
164                 {
165                     id: initialTimeText
166                     text: "Initial time"
167                     color: "white"
168                     font.pointSize: 26
169 //                    anchors.top: rowRow.bottom
170 //                    anchors.horizontalCenter: parent.horizontalCenter
171 //                    visible: true
172                 }
173
174                 Text
175                 {
176                     id: additionalTimeText
177                     text: "Additional time"
178                     color: "white"
179                     font.pointSize: 26
180 //                    visible: newGameDialog.askAddition
181 //                    anchors.top: initialTimeText.bottom
182 //                    anchors.horizontalCenter: parent.horizontalCenter
183                 }
184
185                 Text
186                 {
187                     text:  "Turns per addition"
188                     color: "white"
189                     font.pointSize: 26
190 //                    visible: newGameDialog.askAddition
191 //                    anchors.top: additionalTimeText.bottom
192 //                    anchors.horizontalCenter: parent.horizontalCenter
193                 }
194     }
195
196
197         buttons:
198
199             Button
200             {
201                 id: bOk
202                 text: "Start game"
203                 y: 170
204
205                 onClicked: newGameDialog.accept()
206             }
207     }
208
209 }
210
211