-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.qml
192 lines (144 loc) · 4.58 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
import QtQuick 2.7
import QtQuick.Controls 2.0
import QtQuick.Layouts 1.0
import QtQuick.Controls.Material 2.0
import PadGUI 1.0
ApplicationWindow {
visible: true
width: 640
height: 480
// maximumHeight: height
// maximumWidth: width
minimumWidth: width
minimumHeight: height
title: qsTr("PAD")
header: ToolBar{
RowLayout {
anchors.fill: parent
Text {
text: "PAD"
anchors.centerIn: parent
}
}
}
Item {
id: content
anchors.fill: parent
anchors.margins: 10
Item {
id: padItem
property int orbsX: 6
property int orbsY: 5
property int orbsize: parent.width/orbsX < parent.height/orbsY/1.2? parent.width/orbsX : parent.height/orbsY/1.2
width: orbsize * orbsX
height: orbsize * orbsY * 1.2;
anchors.centerIn: parent
Item {
id: statusbar
width: parent.width
height: 0.1 * padGUI.height
anchors.bottom: padGUI.top
anchors.horizontalCenter: parent.horizontalCenter
Text {
text: padGUI.comboCount + " Combos"
anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left
}
Text {
text: padGUI.movesCount + " Moves"
anchors.verticalCenter: parent.verticalCenter
anchors.right: parent.right
}
Behavior on width { NumberAnimation { } }
Behavior on height { NumberAnimation { } }
}
PadGUI {
id: padGUI
width: parent.width;
height: parent.height / 1.2;
anchors.centerIn: parent
mouseX: mouseArea.mouseX
mouseY: mouseArea.mouseY
mouseDown: mouseArea.pressedButtons & Qt.LeftButton != 0
onRepaintSignal: update()
onComboCountChanged: statusbar.update()
onMovesCountChanged: statusbar.update()
Behavior on width { NumberAnimation { } }
Behavior on height { NumberAnimation { } }
}
Rectangle {
id: loadScreen
visible: padGUI.loading
color: "#aaaaaaaa"
anchors.fill: padGUI
BusyIndicator {
anchors.centerIn: parent
}
}
RowLayout {
id: buttons
width: parent.width
height: 0.1 * padGUI.height
spacing: 0.02 * width
anchors.top: padGUI.bottom
anchors.horizontalCenter: parent.horizontalCenter
Button {
text: "New Board"
onClicked: padGUI.newBoard()
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.fillHeight: true
}
Button {
text: padGUI.showPath? "Showing path" : "Hiding path"
onClicked: padGUI.showPath = ! padGUI.showPath
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.fillHeight: true
}
Button {
text: "Reset"
onClicked: padGUI.resetBoard()
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
Layout.fillHeight: true
}
Behavior on width { NumberAnimation { } }
}
MouseArea {
id: mouseArea
anchors.fill: padGUI
acceptedButtons: Qt.LeftButton
hoverEnabled: true
onExited: padGUI.mouseExited()
}
}
}
/*
SwipeView {
id: swipeView
anchors.fill: parent
currentIndex: tabBar.currentIndex
Page1 {
}
Page {
Label {
text: qsTr("Second page")
anchors.centerIn: parent
}
}
}
*/
/*
footer: TabBar {
id: tabBar
currentIndex: swipeView.currentIndex
TabButton {
text: qsTr("First")
}
TabButton {
text: qsTr("Second")
}
}
*/
}