1 /**************************************************************************
5 This file is part of Chess Clock software.
7 (This file) Copyright (c) Heli Hyvättinen 2011
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.
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.
20 **************************************************************************/
26 import com.nokia.extras 1.0
40 // anchors.centerIn: parent
41 // text: qsTr("Hello world!")
49 // anchors.fill: parent
50 // anchors.left: menuList.right
52 source: ":/rc/pic/logo.png"
63 logoFile: ":/rc/pic/oldclock.png"
70 name: "Addition before"
72 logoFile: ":/rc/pic/addbefore.png"
77 name: "Addition after"
79 logoFile: ":/rc/pic/addafter.png"
86 logoFile: ":/rc/pic/pausebefore.png"
93 logoFile: ":/rc/pic/pauseafter.png"
100 logoFile:":/rc/pic/hourglass.png"
110 anchors.left: bigLogo.right
111 anchors.right: parent.right
112 anchors.top: parent.top
113 anchors.bottom: parent.bottom
127 onClicked: {newGameDialog.name = name; newGameDialog.askAddition = askAddition; newGameDialog.open()}
135 anchors.topMargin: 12
141 onClicked: {newGameDialog.name = name; newGameDialog.askAddition = askAddition; newGameDialog.open()}
157 property bool askAddition
159 onAccepted: pageStack.push(clocksPage)
167 text: newGameDialog.name
180 // anchors.top: parent.top
181 // anchors.horizontalCenter: parent.horizontalCenter
185 // width: rowRow.width - rowRow.spacing - switchComponent.width - whiteSmall.width - blackSmall.width
186 // height: switchComponent.height
187 verticalAlignment: Text.AlignVCenter
200 blackInitialTime.text = whiteInitialTime.text
201 blackAdditionalTime.text = whiteAdditionalTime.text
202 blackTurnsPerAddition.text = whiteTurnsPerAddition.text
211 source: ":/rc/pic/white_small.png"
217 source: ":/rc/pic/black_small.png"
226 // anchors.top: rowRow.bottom
227 // anchors.horizontalCenter: parent.horizontalCenter
237 onTextChanged: {if (equalTimesSwitch.checked) blackInitialTime.text = text}
242 onClicked: {timePicker.timeType = "initial"; timePicker.player = "white"; timePicker.open()}
251 enabled: !equalTimesSwitch.checked
260 onClicked: {timePicker.timeType = "initial"; timePicker.player = "black"; timePicker.open()}
268 id: additionalTimeText
269 text: "Additional time"
272 visible: newGameDialog.askAddition
273 // anchors.top: initialTimeText.bottom
274 // anchors.horizontalCenter: parent.horizontalCenter
281 id: whiteAdditionalTime
282 visible: newGameDialog.askAddition
285 onTextChanged: {if (equalTimesSwitch.checked) blackAdditionalTime.text = text}
290 onClicked: {timePicker.timeType = "additional"; timePicker.player = "white"; timePicker.open()}
296 id: blackAdditionalTime
297 visible: newGameDialog.askAddition
298 enabled: !equalTimesSwitch.checked
304 onClicked: {timePicker.timeType = "additional"; timePicker.player = "black"; timePicker.open()}
312 text: "Turns per addition"
315 visible: newGameDialog.askAddition
316 // anchors.top: additionalTimeText.bottom
317 // anchors.horizontalCenter: parent.horizontalCenter
321 id: whiteTurnsPerAddition
322 visible: newGameDialog.askAddition
327 onTextChanged: {if (equalTimesSwitch.checked) blackTurnsPerAddition.text = text}
332 id: blackTurnsPerAddition
333 visible: newGameDialog.askAddition
334 enabled: !equalTimesSwitch.checked
352 onClicked: newGameDialog.accept()
360 property string timeType
361 property string player
362 property string result
365 titleText: "Choose " + timeType + " time for " + player
366 rejectButtonText: "Cancel"
367 acceptButtonText: "Ok"
368 hourMode: DateTime.TwentyFourHours
371 result = hour + " h " + minute + " min " + second + " s"
372 if (timeType == "initial")
373 if (player == "white")
374 whiteInitialTime.text = result
376 blackInitialTime.text = result
378 else if (player == "white")
379 whiteAdditionalTime.text = result
381 blackAdditionalTime.text = result