diff -r 57bc4d78e5cd -r c5c9ba04c01a qml/main.qml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/qml/main.qml Fri Jul 08 22:41:48 2011 +0200 @@ -0,0 +1,142 @@ +// +// Schachuhr - Chess clock graphical user interface client +// Copyright © 2011 Michael Schloh von Bennewitz +// +// Schachuhr 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. +// +// Schachuhr 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. +// +// You should have received a copy of the GNU General Public License +// along with Schachuhr. If not, see . +// +// This file is part of project Schachuhr, a chess clock graphical +// user interface client and is found at http://schachuhr.europalab.com/ +// +// main.qml: QML implementation +// + +import QtQuick 1.0 + +Rectangle { + width: 854; // until better layout design is learned, this hard + height: 480; // codes the client surface to fit on MeeGo handheld + color: "#7D5C2E" // light cocolate brown background + property bool init: true // indicates game clocks in initial state + + // title bar is flush left and rotated + Rectangle { + id: progTitle + width: 480; height: 90 + color: "#503014" + Text { + id: progLabel + text: "Chess Clock" + anchors.centerIn: parent + color: "#7D5C2E" + font.bold: true; font.pixelSize: 72 + style: Text.Raised + styleColor: "black" + } + transform: Rotation { origin.x: 240; origin.y: 240; angle: 270} + } + + // aesthetic top corner is rounded to match clock circumference curve + Image { x: 90; width: 190; height: 190; source: "cornerl.svg" } + //Image { + // x: 80 + // y: 270 + // width: 50 + // height: 50 + // source: "cornerl.svg" + // transform: Rotation { origin.x: 25; origin.y: 25; angle: 270 } + //} + + Row { // space two game subclocks and associated text in a row + anchors.top: parent.top; anchors.topMargin: -10; + anchors.left: parent.left; anchors.leftMargin: 80; + Wecker { + id: opponOne + opponent: "Oppenent 1" // name of player at left of clock + zeitfrist: 15 // opponent's time limit + altercolor: false // opponent's clock colour + MouseArea { // clicking here is only signaled + enabled: true // at start of match when the 'init' + id: weckoneArea // variable is set and thus the entire + anchors.fill: parent // surface mouse area is disabled + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + //if (mouse.button == Qt.RightButton) + // aboutDlg.visible = true + //else { // left button was pressed + init = false + //aboutDlg.visible = false + entireArea.enabled = true // will take precedence + opponOne.toggle() // start opponent one's clock + opponTwo.toggle() // toggle opponent two's clock + opponTwo.toggle() // twice to force into paused + //} + } + } + } + Wecker { + id: opponTwo + opponent: "Opponent 2" // name of player at right of clock + zeitfrist: 15 // opponent's time limit + altercolor: true // opponent's clock colour + MouseArea { // clicking here is only signaled + enabled: true // at start of match when the 'init' + id: wecktwoArea // variable is set and thus the entire + anchors.fill: parent // surface mouse area is disabled + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + //if (mouse.button == Qt.RightButton) + // aboutDlg.visible = true + //else { // left button was pressed + init = false + //aboutDlg.visible = false + entireArea.enabled = true // will take precedence + opponTwo.toggle() // start opponent two's clock + opponOne.toggle() // toggle opponent one's clock + opponOne.toggle() // twice to force into paused + //} + } + } + } + } + + //Image { id: aboutDlg; anchors.centerIn: parent; width: 423; height: 386; source: "wikichess.jpeg"; visible: false } + + // the main area covering the entire client surface + MouseArea { + enabled: false + id: entireArea + anchors.fill: parent + acceptedButtons: Qt.LeftButton | Qt.RightButton + onClicked: { + //if (mouse.button == Qt.LeftButton && init == false) { + //aboutDlg.visible = false + opponOne.toggle() // stop or start opponent one's clock + opponTwo.toggle() // stop or start opponent two's clock + //} + //else if (mouse.button == Qt.RightButton && init == false) + // aboutDlg.visible = true + //else // assert clicked + // console.log("Problem click in initial.") // in init state + } + } + + Timer { // just waits a second before moving the arms of + interval: 1000 // the game subclocks into their initial position + running: true + onTriggered: { + opponOne.timeInit() + opponTwo.timeInit() + } + } +}