New game dialog is now a page
[chessclock] / qml / MainPage.qml
1 /**************************************************************************
2
3    Chess Clock
4
5    This file is part of Chess Clock software.
6
7    (This file) Copyright (c) Heli Hyvättinen 2011
8
9    Chess Clock is free software: you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation, either version 3 of the License, or
12    (at your option) any later version.
13
14    Chess Clock is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19
20 **************************************************************************/
21
22
23 import QtQuick 1.1
24 import com.meego 1.0
25 import ChessClocks 1.0
26
27
28
29 Page {
30     id: mainPage
31     tools: commonTools
32     orientationLock: PageOrientation.LockLandscape
33
34
35     Image
36     {
37         id: bigLogo
38 //        anchors.fill: parent
39 //        anchors.left: menuList.right
40
41         source: ":/rc/pic/logo.png"
42     }
43
44     ListModel
45     {
46         id: menuModel
47
48         ListElement
49         {
50             name: "Normal clock"
51             timeControl: WrappedClocksWidget.NormalClock
52             askAddition: false
53             askTurnsPerAddition: false
54             logoFile: ":/rc/pic/oldclock.png"
55
56
57         }
58
59         ListElement
60         {
61             name: "Addition before"
62             timeControl: WrappedClocksWidget.AdditionBefore
63             askAddition: true
64             askTurnsPerAddition: true
65             logoFile: ":/rc/pic/addbefore.png"
66         }
67
68         ListElement
69         {
70             name: "Addition after"
71             timeControl: WrappedClocksWidget.AdditionAfter
72             askAddition: true
73             askTurnsPerAddition: true
74             logoFile: ":/rc/pic/addafter.png"
75         }
76
77         ListElement
78         {
79             name: "Delay"
80             timeControl: WrappedClocksWidget.Delay
81             askAddition: true
82             askTurnsPerAddition: false
83             logoFile: ":/rc/pic/pausebefore.png"
84         }
85
86         ListElement
87         {
88             name: "Delay after"
89             timeControl: WrappedClocksWidget.DelayAfter
90             askAddition: true
91             askTurnsPerAddition: false
92             logoFile: ":/rc/pic/pauseafter.png"
93         }
94
95         ListElement
96         {
97             name:"Hour Glass"
98             timeControl: WrappedClocksWidget.HourGlass
99             askAddition: false
100             askTurnsPerAddition: false
101             logoFile:":/rc/pic/hourglass.png"
102         }
103
104     }
105
106
107     ListView
108     {
109         id: menuList
110
111         anchors.left: bigLogo.right
112         anchors.right: parent.right
113         anchors.top: parent.top
114         anchors.bottom: parent.bottom
115
116
117          model: menuModel
118
119          delegate: Row
120          {
121             Image
122             {
123                 source: logoFile
124
125                 MouseArea
126                 {
127                     anchors.fill: parent
128                     onClicked:
129                     {
130                         newGameDialogPage.name = name
131                         newGameDialogPage.timeControl = timeControl
132                         newGameDialogPage.askAddition = askAddition
133                         newGameDialogPage.askTurnsPerAddition = askTurnsPerAddition
134                         PageStack.push(newGameDialogPage)                     }
135                 }
136             }
137
138             Text
139             {
140                 text: name
141                 font.pointSize: 40
142                 anchors.topMargin: 12
143                 color: "white"
144
145                 MouseArea
146                 {
147                     anchors.fill: parent
148                     onClicked:
149                     {
150                         newGameDialogPage.name = name
151                         newGameDialogPage.timeControl = timeControl
152                         newGameDialogPage.askAddition = askAddition
153                         newGameDialogPage.askTurnsPerAddition = askTurnsPerAddition
154                         pageStack.push(newGameDialogPage)
155                     }
156                 }
157             }
158
159         }
160     }
161
162 }
163
164
165
166