-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.qml
113 lines (100 loc) · 2.67 KB
/
main.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import QtQuick 2.15
import QtQuick.Window 2.15
import QtQuick.Controls 1.4
ApplicationWindow {
// width: 1000
//height: 1000
visible: true
title: qsTr("Qt Chess")
//color: "red"
NamePopup{
id: changeNameDialog
}
JoinPopup{
id: joinDialog
}
Column{
MessageInfo{
id: messageRect
Component.onCompleted: {
setPlayerName(cppSocket.getPlayerName())
}
}
Row{
NumbersColumn{
id:leftNumbersColumn
}
Column{
LettersRow{
id: topLettersRow
//anchors.top: messageRect.bottom
}
Board{
id: chessBoard
width: 100*8;
height: 100*8;
}
LettersRow{
id: bottomLettersRow
//anchors.top: chessBoard.bottom
}
}
NumbersColumn{
id:rightNumbersColumn
}
}
ErrorMessage{
id: errorRect
}
}
menuBar: MenuBar {
Menu {
title: "File"
MenuItem {
text: "New Game"
onTriggered: {
cppBoard.restart();
chessBoard.redrawBoard();
chessBoard.multiplayer = false;
chessBoard.isPlayerTurn = true;
messageRect.setBoardMessage("");
messageRect.setTurnMessage("White's turn");
}
}
MenuItem {
text: "Host Game"
onTriggered: {
cppBoard.restart();
chessBoard.redrawBoard();
messageRect.changeColor("White");
chessBoard.multiplayer = true;
chessBoard.isPlayerTurn = true;
cppSocket.hostGame();
messageRect.setTurnMessage("White's turn");
}
}
MenuItem {
text: "Join Game"
onTriggered: {
cppSocket.requestGames();
joinDialog.open();
}
}
MenuItem {
text: "Quit"
onTriggered: {
Qt.quit();
}
}
}
Menu {
title: "Options"
MenuItem {
text: "Change name"
onTriggered: {
changeNameDialog.open();
}
}
}
}
}