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
161 clocksPage.whiteInitialTime = 60*60*1000*whiteInitialTime.hours+60*1000*whiteInitialTime.minutes+1000*whiteInitialTime.seconds
162 clocksPage.blackInitialTime = 60*60*1000*blackInitialTime.hours+60*1000*blackInitialTime.minutes+1000*blackInitialTime.seconds
163 clocksPage.whiteAdditionalTime = 60*60*1000*whiteAdditionalTime.hours+60*1000*whiteAdditionalTime.minutes+1000*whiteAdditionalTime.seconds
164 clocksPage.blackAdditionalTime = 60*60*1000*blackAdditionalTime.hours+60*1000*blackAdditionalTime.minutes+1000*blackAdditionalTime.seconds
165 clocksPage.whiteTurnsPerAddition = whiteTurnsPerAddition.text
166 clocksPage.blackTurnsPerAddition = blackTurnsPerAddition.text
167 pageStack.push(clocksPage)
175 text: newGameDialog.name
188 // anchors.top: parent.top
189 // anchors.horizontalCenter: parent.horizontalCenter
193 // width: rowRow.width - rowRow.spacing - switchComponent.width - whiteSmall.width - blackSmall.width
194 // height: switchComponent.height
195 verticalAlignment: Text.AlignVCenter
208 blackInitialTime.text = whiteInitialTime.text
209 blackAdditionalTime.text = whiteAdditionalTime.text
210 blackTurnsPerAddition.text = whiteTurnsPerAddition.text
219 source: ":/rc/pic/white_small.png"
225 source: ":/rc/pic/black_small.png"
234 // anchors.top: rowRow.bottom
235 // anchors.horizontalCenter: parent.horizontalCenter
249 text: {hours + " h " + minutes + " min " + seconds + " s"}
251 onTextChanged: {if (equalTimesSwitch.checked) blackInitialTime.text = text}
256 onClicked: {timePicker.timeType = "initial"; timePicker.player = "white"; timePicker.open()}
265 enabled: !equalTimesSwitch.checked
273 text: hours + " h " + minutes + " min " + seconds + " s"
280 onClicked: {timePicker.timeType = "initial"; timePicker.player = "black"; timePicker.open()}
288 id: additionalTimeText
289 text: "Additional time"
292 visible: newGameDialog.askAddition
293 // anchors.top: initialTimeText.bottom
294 // anchors.horizontalCenter: parent.horizontalCenter
301 id: whiteAdditionalTime
302 visible: newGameDialog.askAddition
309 text: hours + " h " + minutes + " min " + seconds + " s"
311 onTextChanged: {if (equalTimesSwitch.checked) blackAdditionalTime.text = text}
316 onClicked: {timePicker.timeType = "additional"; timePicker.player = "white"; timePicker.open()}
322 id: blackAdditionalTime
323 visible: newGameDialog.askAddition
324 enabled: !equalTimesSwitch.checked
331 text: hours + " h " + minutes + " min " + seconds + " s"
336 onClicked: {timePicker.timeType = "additional"; timePicker.player = "black"; timePicker.open()}
344 text: "Turns per addition"
347 visible: newGameDialog.askAddition
348 // anchors.top: additionalTimeText.bottom
349 // anchors.horizontalCenter: parent.horizontalCenter
353 id: whiteTurnsPerAddition
354 visible: newGameDialog.askAddition
359 onTextChanged: {if (equalTimesSwitch.checked) blackTurnsPerAddition.text = text}
364 id: blackTurnsPerAddition
365 visible: newGameDialog.askAddition
366 enabled: !equalTimesSwitch.checked
384 onClicked: newGameDialog.accept()
392 property string timeType
393 property string player
395 titleText: "Choose " + timeType + " time for " + player
396 rejectButtonText: "Cancel"
397 acceptButtonText: "Ok"
398 hourMode: DateTime.TwentyFourHours
401 if (timeType == "initial")
402 if (player == "white")
404 whiteInitialTime.hours = hour
405 whiteInitialTime.minutes = minute
406 whiteInitialTime.seconds = second
410 blackInitialTime.hours = hour
411 blackInitialTime.minutes = minute
412 blackInitialTime.seconds = second
414 else if (player == "white")
416 whiteAdditionalTime.hours = hour
417 whiteAdditionalTime.minutes = minute
418 whiteAdditionalTime.seconds = second
422 blackAdditionalTime.hours = hour
423 blackAdditionalTime.minutes = minute
424 blackAdditionalTime.seconds = second