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