Equal times works
authorHeli Hyvättinen <heli.hyvattinen@kymp.net>
Wed, 10 Aug 2011 10:18:11 +0000 (13:18 +0300)
committerHeli Hyvättinen <heli.hyvattinen@kymp.net>
Wed, 10 Aug 2011 13:08:21 +0000 (16:08 +0300)
In the new game dialog, when equal times is selected, black values
cannot be directly changed and are set to same and change with the white
values.

qml/MainPage.qml

index e32f942..b7f7516 100644 (file)
@@ -168,7 +168,17 @@ Page {
 
                     Switch
                     {
-                        id: switchComponent
+                        id: equalTimesSwitch
+                        onCheckedChanged:
+                        {
+                            if (checked)
+                            {
+                                blackInitialTime.text = whiteInitialTime.text
+                                blackAdditionalTime.text = whiteAdditionalTime.text
+                                blackTurnsPerAddition.text = whiteTurnsPerAddition.text
+
+                            }
+                        }
                     }
                 }
                 Image
@@ -200,6 +210,8 @@ Page {
                     id: whiteInitialTime
                     readOnly: true
 
+                    onTextChanged: {if (equalTimesSwitch.checked) blackInitialTime.text = text}
+
                     MouseArea
                     {
                         anchors.fill: parent
@@ -212,8 +224,12 @@ Page {
                 TextField
                 {
                     id: blackInitialTime
+                    enabled: !equalTimesSwitch.checked
+
                     readOnly: true
 
+
+
                     MouseArea
                     {
                     anchors.fill: parent
@@ -242,6 +258,8 @@ Page {
                     visible:  newGameDialog.askAddition
                     readOnly: true
 
+                    onTextChanged: {if (equalTimesSwitch.checked) blackAdditionalTime.text = text}
+
                     MouseArea
                     {
                         anchors.fill: parent
@@ -253,6 +271,7 @@ Page {
                 {
                     id: blackAdditionalTime
                     visible: newGameDialog.askAddition
+                    enabled: !equalTimesSwitch.checked
                     readOnly: true
 
                     MouseArea
@@ -277,14 +296,18 @@ Page {
                 {
                     id: whiteTurnsPerAddition
                     visible: newGameDialog.askAddition
+
                     inputMask: "D00"
                     text: "1"
+
+                    onTextChanged: {if (equalTimesSwitch.checked) blackTurnsPerAddition.text = text}
                 }
 
                 TextField
                 {
                     id: blackTurnsPerAddition
                     visible: newGameDialog.askAddition
+                    enabled: !equalTimesSwitch.checked
                     inputMask: "D00"
                     text: "1"
                 }