author | unc0rr |
Mon, 16 Feb 2015 22:33:15 +0300 | |
branch | qmlfrontend |
changeset 10823 | 1ff3dd3705b1 |
parent 10819 | 57e21f7621b0 |
child 10888 | a04e04aaf599 |
permissions | -rw-r--r-- |
10422 | 1 |
import QtQuick 2.0 |
2 |
import Hedgewars.Engine 1.0 |
|
3 |
||
10442 | 4 |
|
10422 | 5 |
Rectangle { |
6 |
HWButton { |
|
7 |
id: btnPreview |
|
8 |
x: 50 |
|
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
9 |
y: 16 |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
10 |
width: 256 |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
11 |
height: 128 |
10422 | 12 |
|
10432 | 13 |
onClicked: HWEngine.getPreview() |
10422 | 14 |
|
15 |
Connections { |
|
16 |
target: HWEngine |
|
10424
4be6cd55f1cf
- Get rid of engine's PathPrefix and UserPathPrefix
unc0rr
parents:
10422
diff
changeset
|
17 |
onPreviewImageChanged: previewImage.source = "image://preview/" + HWEngine.currentSeed() |
10422 | 18 |
} |
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
19 |
|
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
20 |
Image { |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
21 |
id: previewImage |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
22 |
x: 0 |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
23 |
y: 0 |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
24 |
width: 256 |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
25 |
height: 128 |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
26 |
cache: false |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
27 |
} |
10422 | 28 |
} |
29 |
||
10448 | 30 |
HWButton { |
31 |
id: btnRunGame |
|
32 |
x: 600 |
|
33 |
y: 440 |
|
34 |
width: 32 |
|
35 |
height: 32 |
|
36 |
||
37 |
onClicked: HWEngine.runLocalGame() |
|
38 |
} |
|
39 |
||
10519 | 40 |
HWComboBox { |
10608 | 41 |
id: cbTheme |
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
42 |
x: 50 |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
43 |
y: 160 |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
44 |
width: 256 |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
45 |
height: 64 |
10519 | 46 |
|
47 |
model: themesModel |
|
48 |
delegate: Rectangle { |
|
49 |
height: 25 |
|
50 |
width: 100 |
|
51 |
color: "transparent" |
|
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
52 |
|
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
53 |
property alias itemIconSource: themeIcon.source |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
54 |
property alias itemText: themeName.text |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
55 |
|
10608 | 56 |
Row { |
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
57 |
Image {id: themeIcon; width: height; height: parent.height; source: "image://theme/" + modelData} |
10608 | 58 |
Text {id: themeName; text: modelData } |
59 |
} |
|
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
60 |
|
10519 | 61 |
MouseArea { |
62 |
z: 1 |
|
63 |
anchors.fill: parent |
|
64 |
onClicked: { |
|
10608 | 65 |
cbTheme.currentIndex = index |
10519 | 66 |
HWEngine.setTheme(themeName.text) |
67 |
} |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
71 |
||
10612 | 72 |
HWComboBox { |
73 |
id: cbScript |
|
74 |
x: 50 |
|
75 |
y: 256 |
|
76 |
width: 256 |
|
77 |
height: 64 |
|
78 |
||
79 |
model: scriptsModel |
|
80 |
delegate: Rectangle { |
|
81 |
height: 25 |
|
82 |
width: 100 |
|
83 |
color: "transparent" |
|
84 |
||
85 |
property string itemIconSource: "" |
|
86 |
property alias itemText: scriptName.text |
|
87 |
||
88 |
Row { |
|
89 |
//Image {id: themeIcon; width: height; height: parent.height; source: "image://theme/" + modelData} |
|
90 |
Text {id: scriptName; text: modelData } |
|
91 |
} |
|
92 |
||
93 |
MouseArea { |
|
94 |
z: 1 |
|
95 |
anchors.fill: parent |
|
96 |
onClicked: { |
|
97 |
cbScript.currentIndex = index |
|
98 |
HWEngine.setScript(scriptName.text) |
|
99 |
} |
|
100 |
} |
|
10436 | 101 |
} |
10612 | 102 |
} |
103 |
||
10616 | 104 |
HWComboBox { |
105 |
id: cbScheme |
|
106 |
x: 50 |
|
107 |
y: 336 |
|
108 |
width: 256 |
|
109 |
height: 64 |
|
110 |
||
111 |
model: schemesModel |
|
112 |
delegate: Rectangle { |
|
113 |
height: 25 |
|
114 |
width: 100 |
|
115 |
color: "transparent" |
|
116 |
||
117 |
property string itemIconSource: "" |
|
118 |
property alias itemText: schemeName.text |
|
119 |
||
120 |
Row { |
|
121 |
//Image {id: themeIcon; width: height; height: parent.height; source: "image://theme/" + modelData} |
|
122 |
Text {id: schemeName; text: modelData } |
|
123 |
} |
|
124 |
||
125 |
MouseArea { |
|
126 |
z: 1 |
|
127 |
anchors.fill: parent |
|
128 |
onClicked: { |
|
129 |
cbScheme.currentIndex = index |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10616
diff
changeset
|
130 |
HWEngine.setScheme(schemeName.text) |
10616 | 131 |
} |
132 |
} |
|
133 |
} |
|
134 |
} |
|
135 |
||
10442 | 136 |
|
10823 | 137 |
HWComboBox { |
138 |
id: cbAmmo |
|
139 |
x: 50 |
|
140 |
y: 416 |
|
141 |
width: 256 |
|
142 |
height: 64 |
|
143 |
||
144 |
model: ammoModel |
|
145 |
delegate: Rectangle { |
|
146 |
height: 25 |
|
147 |
width: 100 |
|
148 |
color: "transparent" |
|
149 |
||
150 |
property string itemIconSource: "" |
|
151 |
property alias itemText: ammoName.text |
|
152 |
||
153 |
Row { |
|
154 |
//Image {id: themeIcon; width: height; height: parent.height; source: "image://theme/" + modelData} |
|
155 |
Text {id: ammoName; text: modelData } |
|
156 |
} |
|
157 |
||
158 |
MouseArea { |
|
159 |
z: 1 |
|
160 |
anchors.fill: parent |
|
161 |
onClicked: { |
|
162 |
cbAmmo.currentIndex = index |
|
163 |
HWEngine.setAmmo(ammoName.text) |
|
164 |
} |
|
165 |
} |
|
166 |
} |
|
167 |
} |
|
168 |
||
10442 | 169 |
ListView { |
170 |
id: playingTeamsList |
|
171 |
x: 440 |
|
172 |
y: 16 |
|
173 |
width: 100 |
|
174 |
height: 192 |
|
175 |
highlight: Rectangle { color: "#eaea00"; radius: 4 } |
|
176 |
focus: true |
|
177 |
clip: true |
|
178 |
||
179 |
model: ListModel { |
|
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
180 |
id: playingTeamsModel |
10442 | 181 |
} |
182 |
||
183 |
delegate: Rectangle { |
|
184 |
id: teamDelegate |
|
185 |
height: 24 |
|
186 |
width: parent.width |
|
187 |
radius: 8 |
|
188 |
border.width: 2 |
|
189 |
border.color: "#eaea00" |
|
190 |
||
191 |
Row { |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
192 |
Rectangle { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
193 |
height: 20 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
194 |
width: height |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
195 |
color: teamColor |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
196 |
border.width: 2 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
197 |
border.color: "#eaea00" |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
198 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
199 |
MouseArea { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
200 |
z: 1 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
201 |
anchors.fill: parent |
10454
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
202 |
acceptedButtons: Qt.LeftButton | Qt.RightButton |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
203 |
onClicked: { |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
204 |
if (mouse.button === Qt.LeftButton) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
205 |
HWEngine.changeTeamColor(name, 1) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
206 |
else if (mouse.button === Qt.RightButton) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
207 |
HWEngine.changeTeamColor(name, -1) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
208 |
} |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
209 |
onWheel: HWEngine.changeTeamColor(name, -wheel.angleDelta.y) |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
210 |
} |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
211 |
} |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
212 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
213 |
Text { text: name |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
214 |
MouseArea { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
215 |
z: 1 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
216 |
anchors.fill: parent |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
217 |
onClicked: HWEngine.tryRemoveTeam(name) |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
218 |
} |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
219 |
} |
10442 | 220 |
} |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
221 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
222 |
|
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
223 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
224 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
225 |
Connections { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
226 |
target: HWEngine |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
227 |
onPlayingTeamAdded: playingTeamsModel.append({ |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
228 |
"aiLevel": aiLevel |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
229 |
, "name": teamName |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
230 |
, "local": isLocal |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
231 |
, "teamColor": "#000000" |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
232 |
}) |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
233 |
onPlayingTeamRemoved: { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
234 |
var i = playingTeamsModel.count - 1; |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
235 |
while ((i >= 0) && (playingTeamsModel.get(i).name !== teamName)) --i |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
236 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
237 |
if(i >= 0) playingTeamsModel.remove(i, 1) |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
238 |
} |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
239 |
onTeamColorChanged: { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
240 |
var i = playingTeamsModel.count - 1; |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
241 |
while ((i >= 0) && (playingTeamsModel.get(i).name !== teamName)) --i |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
242 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
243 |
if(i >= 0) playingTeamsModel.setProperty(i, "teamColor", colorValue) |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
244 |
} |
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
245 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
246 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
247 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
248 |
ListView { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
249 |
id: localTeamsList |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
250 |
x: 440 |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
251 |
y: 224 |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
252 |
width: 100 |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
253 |
height: 192 |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
254 |
highlight: Rectangle { color: "#eaea00"; radius: 4 } |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
255 |
focus: true |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
256 |
clip: true |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
257 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
258 |
model: ListModel { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
259 |
id: localTeamsModel |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
260 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
261 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
262 |
delegate: Rectangle { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
263 |
id: localTeamDelegate |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
264 |
height: 24 |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
265 |
width: parent.width |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
266 |
radius: 8 |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
267 |
border.width: 2 |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
268 |
border.color: "#eaea00" |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
269 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
270 |
Row { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
271 |
Text { text: name } |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
272 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
273 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
274 |
MouseArea { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
275 |
z: 1 |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
276 |
anchors.fill: parent |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
277 |
onClicked: HWEngine.tryAddTeam(name) |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
278 |
} |
10442 | 279 |
} |
280 |
||
281 |
Connections { |
|
282 |
target: HWEngine |
|
283 |
onLocalTeamAdded: localTeamsModel.append({"aiLevel": aiLevel, "name": teamName}) |
|
10444
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
284 |
onLocalTeamRemoved: { |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
285 |
var i = localTeamsModel.count - 1; |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
286 |
while ((i >= 0) && (localTeamsModel.get(i).name !== teamName)) --i |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
287 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
288 |
if(i >= 0) localTeamsModel.remove(i, 1) |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
289 |
} |
10442 | 290 |
} |
291 |
} |
|
292 |
||
293 |
Component.onCompleted: { |
|
10450 | 294 |
HWEngine.resetGameConfig() |
10442 | 295 |
HWEngine.getTeamsList() |
296 |
HWEngine.getPreview() |
|
297 |
} |
|
10422 | 298 |
} |