diff options
author | Marvin Borner | 2020-04-12 14:50:42 +0200 |
---|---|---|
committer | Marvin Borner | 2020-04-12 14:50:42 +0200 |
commit | bdbe3a0c074c3a1b81786ffb9f7cc1b41fc0b0dd (patch) | |
tree | d2147ce6f92dadd8cac22ab619438b5b4e7cddb6 /qml/pages/Board.qml | |
parent | 0cc8b365bfdf030820cdbaad87709a38e591b0b2 (diff) |
Added resign, draw and abort logic and chat
Diffstat (limited to 'qml/pages/Board.qml')
-rw-r--r-- | qml/pages/Board.qml | 36 |
1 files changed, 31 insertions, 5 deletions
diff --git a/qml/pages/Board.qml b/qml/pages/Board.qml index 240fa11..0f2af45 100644 --- a/qml/pages/Board.qml +++ b/qml/pages/Board.qml @@ -1,6 +1,6 @@ import QtQuick 2.2 import Sailfish.Silica 1.0 -import org.nemomobile.configuration 1.0 +import Nemo.Configuration 1.0 import ".." Page { @@ -30,15 +30,31 @@ Page { onClicked: functions.start_seek() } MenuItem { - text: qsTr("Play against bot") + text: qsTr("Challenge user") visible: functions.game_id === "" ? true : false - onClicked: functions.challenge("awesomelvin") + onClicked: { + var dialog = pageStack.push("UserDialog.qml"); + dialog.accepted.connect(function() { + functions.challenge(dialog.name); + }); + } } MenuItem { + // I THINK it works like that text: qsTr("Abort game") - visible: functions.game_id === "" ? false : true + visible: functions.game_id !== "" && functions.moves.split(" ").length <= 2 ? true : false onClicked: functions.abort() } + MenuItem { + text: qsTr("Resign game") + visible: functions.game_id !== "" && functions.moves.split(" ").length > 2 ? true : false + onClicked: functions.resign() + } + MenuItem { + text: qsTr("Offer/accept draw") + visible: functions.game_id !== "" && functions.moves.split(" ").length > 2 ? true : false + onClicked: functions.offer_draw() + } } Column { @@ -83,12 +99,22 @@ Page { } Label { - // id: turn_label + id: turn_label anchors.horizontalCenter: parent.horizontalCenter anchors.top: grid.bottom topPadding: Theme.paddingMedium text: functions.turn ? qsTr("Your turn") : qsTr("Opponents turn"); } + + LinkedLabel { + id: chat + width: parent.width + color: "white" + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: turn_label.bottom + topPadding: Theme.paddingMedium + plainText: ""; + } } } |