9fd2316f20ebe5a25a4f25b209d30c850199339c
[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.nokia.meego 1.0
25 import ChessClocks 1.2
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.leftMargin: 40
113         anchors.right: parent.right
114         anchors.top: parent.top
115         anchors.bottom: parent.bottom
116
117         spacing:  10
118
119          model: menuModel
120
121          delegate: Row
122          {
123
124
125             Image
126             {
127                 source: logoFile
128                 width:  40
129                 height: 40
130
131                 MouseArea
132                 {
133                     anchors.fill: parent
134                     onClicked:
135                     {
136                         newGameDialogPage.name = name
137                         newGameDialogPage.timeControl = timeControl
138                         newGameDialogPage.askAddition = askAddition
139                         newGameDialogPage.askTurnsPerAddition = askTurnsPerAddition
140                         PageStack.push(newGameDialogPage)                     }
141                 }
142             }
143
144             Text
145             {
146                 text: name
147                 font.pointSize: 38
148                 anchors.topMargin: 12
149                 color: "white"
150
151                 MouseArea
152                 {
153                     anchors.fill: parent
154                     onClicked:
155                     {
156                         newGameDialogPage.name = name
157                         newGameDialogPage.timeControl = timeControl
158                         newGameDialogPage.askAddition = askAddition
159                         newGameDialogPage.askTurnsPerAddition = askTurnsPerAddition
160                         pageStack.push(newGameDialogPage)
161                     }
162                 }
163             }
164
165         }
166     }
167
168 }
169
170
171
172