Added copyright and license info to QML files
[chessclock] / qml / MainPage.qml
index e32f942..d7b3987 100644 (file)
@@ -1,3 +1,25 @@
+/**************************************************************************
+
+   Chess Clock
+
+   This file is part of Chess Clock software.
+
+   (This file) Copyright (c) Heli Hyvättinen 2011
+
+   Chess Clock is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   Chess Clock is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+
+**************************************************************************/
+
+
 import QtQuick 1.1
 import com.meego 1.0
 import QtQuick 1.0
@@ -134,6 +156,8 @@ Page {
         property string name
         property bool askAddition
 
+        onAccepted: pageStack.push(clocksPage)
+
 
 
         title:Label
@@ -168,7 +192,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 +234,8 @@ Page {
                     id: whiteInitialTime
                     readOnly: true
 
+                    onTextChanged: {if (equalTimesSwitch.checked) blackInitialTime.text = text}
+
                     MouseArea
                     {
                         anchors.fill: parent
@@ -212,8 +248,12 @@ Page {
                 TextField
                 {
                     id: blackInitialTime
+                    enabled: !equalTimesSwitch.checked
+
                     readOnly: true
 
+
+
                     MouseArea
                     {
                     anchors.fill: parent
@@ -242,6 +282,8 @@ Page {
                     visible:  newGameDialog.askAddition
                     readOnly: true
 
+                    onTextChanged: {if (equalTimesSwitch.checked) blackAdditionalTime.text = text}
+
                     MouseArea
                     {
                         anchors.fill: parent
@@ -253,6 +295,7 @@ Page {
                 {
                     id: blackAdditionalTime
                     visible: newGameDialog.askAddition
+                    enabled: !equalTimesSwitch.checked
                     readOnly: true
 
                     MouseArea
@@ -277,14 +320,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"
                 }