author | unc0rr |
Mon, 30 Nov 2015 23:25:18 +0300 | |
branch | qmlfrontend |
changeset 11439 | 23912c93935a |
parent 11438 | bca9afcc3a72 |
child 11442 | 6e641b5453f9 |
permissions | -rw-r--r-- |
10422 | 1 |
import QtQuick 2.0 |
2 |
import Hedgewars.Engine 1.0 |
|
3 |
||
10442 | 4 |
|
10422 | 5 |
Rectangle { |
11431 | 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 |
|
11439 | 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 |
11439 | 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 |
|
61 |
Connections { |
|
62 |
target: HWEngine |
|
63 |
onThemeChanged: cbTheme.showItem({"iconSource" : "image://theme/" + theme, "text" : theme}); |
|
64 |
} |
|
10519 | 65 |
} |
66 |
} |
|
67 |
||
10612 | 68 |
HWComboBox { |
69 |
id: cbScript |
|
70 |
width: 256 |
|
11431 | 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 |
Connections { |
96 |
target: HWEngine |
|
11438 | 97 |
onScriptChanged: cbScript.showItem({"iconSource" : "", "text" : script}); |
11437 | 98 |
} |
10436 | 99 |
} |
10612 | 100 |
} |
101 |
||
10616 | 102 |
HWComboBox { |
103 |
id: cbScheme |
|
104 |
width: 256 |
|
11431 | 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 |
} |
|
130 |
} |
|
131 |
||
10442 | 132 |
|
10823 | 133 |
HWComboBox { |
134 |
id: cbAmmo |
|
135 |
width: 256 |
|
11431 | 136 |
height: 32 |
10823 | 137 |
|
10888 | 138 |
model: ammosModel |
10823 | 139 |
delegate: Rectangle { |
140 |
height: 25 |
|
141 |
width: 100 |
|
142 |
color: "transparent" |
|
143 |
||
144 |
property string itemIconSource: "" |
|
145 |
property alias itemText: ammoName.text |
|
146 |
||
147 |
Row { |
|
148 |
//Image {id: themeIcon; width: height; height: parent.height; source: "image://theme/" + modelData} |
|
149 |
Text {id: ammoName; text: modelData } |
|
150 |
} |
|
151 |
||
152 |
MouseArea { |
|
153 |
z: 1 |
|
154 |
anchors.fill: parent |
|
155 |
onClicked: { |
|
156 |
cbAmmo.currentIndex = index |
|
157 |
HWEngine.setAmmo(ammoName.text) |
|
158 |
} |
|
159 |
} |
|
160 |
} |
|
161 |
} |
|
11431 | 162 |
} |
10823 | 163 |
|
10442 | 164 |
ListView { |
165 |
id: playingTeamsList |
|
166 |
x: 440 |
|
167 |
y: 16 |
|
168 |
width: 100 |
|
169 |
height: 192 |
|
170 |
highlight: Rectangle { color: "#eaea00"; radius: 4 } |
|
171 |
focus: true |
|
172 |
clip: true |
|
173 |
||
174 |
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
|
175 |
id: playingTeamsModel |
10442 | 176 |
} |
177 |
||
178 |
delegate: Rectangle { |
|
179 |
id: teamDelegate |
|
180 |
height: 24 |
|
181 |
width: parent.width |
|
182 |
radius: 8 |
|
183 |
border.width: 2 |
|
184 |
border.color: "#eaea00" |
|
185 |
||
186 |
Row { |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
187 |
Rectangle { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
188 |
height: 20 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
189 |
width: height |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
190 |
color: teamColor |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
191 |
border.width: 2 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
192 |
border.color: "#eaea00" |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
193 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
194 |
MouseArea { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
195 |
z: 1 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
196 |
anchors.fill: parent |
10454
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
197 |
acceptedButtons: Qt.LeftButton | Qt.RightButton |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
198 |
onClicked: { |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
199 |
if (mouse.button === Qt.LeftButton) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
200 |
HWEngine.changeTeamColor(name, 1) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
201 |
else if (mouse.button === Qt.RightButton) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
202 |
HWEngine.changeTeamColor(name, -1) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
203 |
} |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
204 |
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
|
205 |
} |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
206 |
} |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
207 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
208 |
Text { text: name |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
209 |
MouseArea { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
210 |
z: 1 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
211 |
anchors.fill: parent |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
212 |
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
|
213 |
} |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
214 |
} |
10442 | 215 |
} |
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
|
216 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
217 |
|
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
|
218 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
219 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
220 |
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
|
221 |
target: HWEngine |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
222 |
onPlayingTeamAdded: playingTeamsModel.append({ |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
223 |
"aiLevel": aiLevel |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
224 |
, "name": teamName |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
225 |
, "local": isLocal |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
226 |
, "teamColor": "#000000" |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
227 |
}) |
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
|
228 |
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
|
229 |
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
|
230 |
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
|
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 |
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
|
233 |
} |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
234 |
onTeamColorChanged: { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
235 |
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
|
236 |
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
|
237 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
238 |
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
|
239 |
} |
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
|
240 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
241 |
} |
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 |
|
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 |
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
|
244 |
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
|
245 |
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
|
246 |
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
|
247 |
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
|
248 |
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
|
249 |
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
|
250 |
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
|
251 |
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
|
252 |
|
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 |
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
|
254 |
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
|
255 |
} |
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 |
|
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 |
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
|
258 |
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
|
259 |
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
|
260 |
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
|
261 |
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
|
262 |
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
|
263 |
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
|
264 |
|
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 |
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
|
266 |
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
|
267 |
} |
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 |
|
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 |
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
|
270 |
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
|
271 |
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
|
272 |
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
|
273 |
} |
10442 | 274 |
} |
275 |
||
276 |
Connections { |
|
277 |
target: HWEngine |
|
278 |
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
|
279 |
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
|
280 |
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
|
281 |
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
|
282 |
|
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 |
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
|
284 |
} |
10442 | 285 |
} |
286 |
} |
|
287 |
||
288 |
Component.onCompleted: { |
|
10450 | 289 |
HWEngine.resetGameConfig() |
10442 | 290 |
HWEngine.getTeamsList() |
291 |
HWEngine.getPreview() |
|
292 |
} |
|
10422 | 293 |
} |