author | sheepluva |
Sun, 01 May 2016 21:09:45 +0200 | |
branch | qmlfrontend |
changeset 11787 | bcba7938ccb5 |
parent 11786 | 0aa4b3d02cba |
child 11827 | 8c71c5a1172f |
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 |
|
11786
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
11 |
// this, as well as the positions of images, seems to have the border thickness (3px) into account |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
12 |
width: 262 |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
13 |
height: 134 |
10422 | 14 |
|
10432 | 15 |
onClicked: HWEngine.getPreview() |
10422 | 16 |
|
17 |
Connections { |
|
18 |
target: HWEngine |
|
11786
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
19 |
onPreviewImageChanged: { |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
20 |
previewImage.visible = true |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
21 |
previewImage.source = "image://preview/image" |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
22 |
previewWaitImage.visible = false |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
23 |
} |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
24 |
onPreviewIsRendering: { |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
25 |
previewImage.source = "" |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
26 |
previewImage.visible = false |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
27 |
previewWaitImage.visible = true |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
28 |
} |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
29 |
} |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
30 |
|
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
31 |
Image { |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
32 |
id: previewBackground |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
33 |
x: 3 |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
34 |
y: 3 |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
35 |
width: 256 |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
36 |
height: 128 |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
37 |
cache: true |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
38 |
source: "qrc:/res/prevBg.png" |
10422 | 39 |
} |
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
40 |
|
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
41 |
Image { |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
42 |
id: previewImage |
11786
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
43 |
x: 3 |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
44 |
y: 3 |
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
45 |
width: 256 |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
46 |
height: 128 |
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
47 |
cache: false |
11786
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
48 |
source: "" |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
49 |
} |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
50 |
|
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
51 |
Image { |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
52 |
id: previewWaitImage |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
53 |
x: 117 |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
54 |
y: 53 |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
55 |
width: 26 |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
56 |
height: 26 |
0aa4b3d02cba
qmlfrontend: tweak map preview a little in an attempt to buy back unC0Rr's <3
sheepluva
parents:
11443
diff
changeset
|
57 |
cache: true |
11434 | 58 |
source: "qrc:/res/iconTime.png" |
10434
1614b13ad35e
Themes model, also add some files I forgot to add previously
unc0rr
parents:
10432
diff
changeset
|
59 |
} |
11787
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
60 |
|
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
61 |
Image { |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
62 |
id: hogCountBackground |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
63 |
x: 216 |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
64 |
y: 6 |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
65 |
width: 41 |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
66 |
height: 21 |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
67 |
cache: true |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
68 |
source: "qrc:/res/hogCntBg.png" |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
69 |
} |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
70 |
|
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
71 |
Text { |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
72 |
id: hogCount |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
73 |
x: 230 |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
74 |
y: 10 |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
75 |
text: "?" |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
76 |
horizontalAlignment: Text.AlignHRight |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
77 |
font.family: "MS Shell Dlg" |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
78 |
font.pixelSize: 12 |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
79 |
color: "#ffcc00" |
bcba7938ccb5
qmlfrontend/map-preview: add hog count display thingy (only displays "?" for now)
sheepluva
parents:
11786
diff
changeset
|
80 |
} |
10422 | 81 |
} |
82 |
||
10519 | 83 |
HWComboBox { |
10608 | 84 |
id: cbTheme |
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
85 |
width: 256 |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
86 |
height: 64 |
10519 | 87 |
|
88 |
model: themesModel |
|
89 |
delegate: Rectangle { |
|
90 |
height: 25 |
|
91 |
width: 100 |
|
92 |
color: "transparent" |
|
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
93 |
|
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
94 |
property alias itemIconSource: themeIcon.source |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
95 |
property alias itemText: themeName.text |
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
96 |
|
10608 | 97 |
Row { |
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
98 |
Image {id: themeIcon; width: height; height: parent.height; source: "image://theme/" + modelData} |
10608 | 99 |
Text {id: themeName; text: modelData } |
100 |
} |
|
10610
eadf2cea55e0
Finish combobox implementation (except for visual part)
unc0rr
parents:
10608
diff
changeset
|
101 |
|
10519 | 102 |
MouseArea { |
103 |
z: 1 |
|
104 |
anchors.fill: parent |
|
105 |
onClicked: { |
|
10608 | 106 |
cbTheme.currentIndex = index |
10519 | 107 |
HWEngine.setTheme(themeName.text) |
108 |
} |
|
109 |
} |
|
11437 | 110 |
} |
11432 | 111 |
|
11437 | 112 |
Connections { |
113 |
target: HWEngine |
|
114 |
onThemeChanged: cbTheme.showItem({"iconSource" : "image://theme/" + theme, "text" : theme}); |
|
10519 | 115 |
} |
116 |
} |
|
117 |
||
10612 | 118 |
HWComboBox { |
119 |
id: cbScript |
|
120 |
width: 256 |
|
11426 | 121 |
height: 32 |
10612 | 122 |
|
123 |
model: scriptsModel |
|
124 |
delegate: Rectangle { |
|
125 |
height: 25 |
|
126 |
width: 100 |
|
127 |
color: "transparent" |
|
128 |
||
129 |
property string itemIconSource: "" |
|
130 |
property alias itemText: scriptName.text |
|
131 |
||
132 |
Row { |
|
133 |
//Image {id: themeIcon; width: height; height: parent.height; source: "image://theme/" + modelData} |
|
134 |
Text {id: scriptName; text: modelData } |
|
135 |
} |
|
136 |
||
137 |
MouseArea { |
|
138 |
z: 1 |
|
139 |
anchors.fill: parent |
|
140 |
onClicked: { |
|
141 |
cbScript.currentIndex = index |
|
142 |
HWEngine.setScript(scriptName.text) |
|
143 |
} |
|
144 |
} |
|
11437 | 145 |
} |
146 |
Connections { |
|
147 |
target: HWEngine |
|
148 |
onScriptChanged: cbScript.showItem({"iconSource" : "", "text" : script}); |
|
10436 | 149 |
} |
10612 | 150 |
} |
151 |
||
10616 | 152 |
HWComboBox { |
153 |
id: cbScheme |
|
154 |
width: 256 |
|
11426 | 155 |
height: 32 |
10616 | 156 |
|
157 |
model: schemesModel |
|
158 |
delegate: Rectangle { |
|
159 |
height: 25 |
|
160 |
width: 100 |
|
161 |
color: "transparent" |
|
162 |
||
163 |
property string itemIconSource: "" |
|
164 |
property alias itemText: schemeName.text |
|
165 |
||
166 |
Row { |
|
167 |
//Image {id: themeIcon; width: height; height: parent.height; source: "image://theme/" + modelData} |
|
168 |
Text {id: schemeName; text: modelData } |
|
169 |
} |
|
170 |
||
171 |
MouseArea { |
|
172 |
z: 1 |
|
173 |
anchors.fill: parent |
|
174 |
onClicked: { |
|
175 |
cbScheme.currentIndex = index |
|
10819
57e21f7621b0
Send selected scheme config on engine initialization (WIP)
unc0rr
parents:
10616
diff
changeset
|
176 |
HWEngine.setScheme(schemeName.text) |
10616 | 177 |
} |
178 |
} |
|
179 |
} |
|
11440 | 180 |
Connections { |
181 |
target: HWEngine |
|
182 |
onSchemeChanged: cbScheme.showItem({"iconSource" : "", "text" : scheme}); |
|
183 |
} |
|
10616 | 184 |
} |
185 |
||
10442 | 186 |
|
10823 | 187 |
HWComboBox { |
188 |
id: cbAmmo |
|
189 |
width: 256 |
|
11426 | 190 |
height: 32 |
10823 | 191 |
|
10888 | 192 |
model: ammosModel |
10823 | 193 |
delegate: Rectangle { |
194 |
height: 25 |
|
195 |
width: 100 |
|
196 |
color: "transparent" |
|
197 |
||
198 |
property string itemIconSource: "" |
|
199 |
property alias itemText: ammoName.text |
|
200 |
||
201 |
Row { |
|
202 |
//Image {id: themeIcon; width: height; height: parent.height; source: "image://theme/" + modelData} |
|
203 |
Text {id: ammoName; text: modelData } |
|
204 |
} |
|
205 |
||
206 |
MouseArea { |
|
207 |
z: 1 |
|
208 |
anchors.fill: parent |
|
209 |
onClicked: { |
|
210 |
cbAmmo.currentIndex = index |
|
211 |
HWEngine.setAmmo(ammoName.text) |
|
212 |
} |
|
213 |
} |
|
214 |
} |
|
11437 | 215 |
Connections { |
216 |
target: HWEngine |
|
217 |
onAmmoChanged: cbAmmo.showItem({"iconSource" : "", "text" : ammo}); |
|
218 |
} |
|
10823 | 219 |
} |
11426 | 220 |
} |
10823 | 221 |
|
10442 | 222 |
ListView { |
223 |
id: playingTeamsList |
|
224 |
x: 440 |
|
225 |
y: 16 |
|
226 |
width: 100 |
|
227 |
height: 192 |
|
228 |
highlight: Rectangle { color: "#eaea00"; radius: 4 } |
|
229 |
focus: true |
|
230 |
clip: true |
|
231 |
||
232 |
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
|
233 |
id: playingTeamsModel |
10442 | 234 |
} |
235 |
||
236 |
delegate: Rectangle { |
|
237 |
id: teamDelegate |
|
238 |
height: 24 |
|
239 |
width: parent.width |
|
240 |
radius: 8 |
|
241 |
border.width: 2 |
|
242 |
border.color: "#eaea00" |
|
243 |
||
244 |
Row { |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
245 |
Rectangle { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
246 |
height: 20 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
247 |
width: height |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
248 |
color: teamColor |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
249 |
border.width: 2 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
250 |
border.color: "#eaea00" |
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 |
MouseArea { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
253 |
z: 1 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
254 |
anchors.fill: parent |
10454
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
255 |
acceptedButtons: Qt.LeftButton | Qt.RightButton |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
256 |
onClicked: { |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
257 |
if (mouse.button === Qt.LeftButton) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
258 |
HWEngine.changeTeamColor(name, 1) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
259 |
else if (mouse.button === Qt.RightButton) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
260 |
HWEngine.changeTeamColor(name, -1) |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
261 |
} |
2b590e7972b1
Allow using right button or wheel to change team color
unc0rr
parents:
10452
diff
changeset
|
262 |
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
|
263 |
} |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
264 |
} |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
265 |
|
11443 | 266 |
Text { |
267 |
text: name |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
268 |
MouseArea { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
269 |
z: 1 |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
270 |
anchors.fill: parent |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
271 |
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
|
272 |
} |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
273 |
} |
11443 | 274 |
|
275 |
Text { |
|
276 |
text: hedgehogsNumber |
|
277 |
} |
|
10442 | 278 |
} |
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 |
|
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
280 |
|
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
|
281 |
} |
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 |
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
|
284 |
target: HWEngine |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
285 |
onPlayingTeamAdded: playingTeamsModel.append({ |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
286 |
"aiLevel": aiLevel |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
287 |
, "name": teamName |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
288 |
, "local": isLocal |
11443 | 289 |
, "hedgehogsNumber" : 4 |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
290 |
, "teamColor": "#000000" |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
291 |
}) |
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
|
292 |
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
|
293 |
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
|
294 |
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
|
295 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
296 |
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
|
297 |
} |
10452
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
298 |
onTeamColorChanged: { |
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
299 |
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
|
300 |
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
|
301 |
|
03519fd9f98d
Show team color in teams list widget, also allow to change it on mouse click
unc0rr
parents:
10450
diff
changeset
|
302 |
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
|
303 |
} |
11443 | 304 |
onHedgehogsNumberChanged: { |
305 |
var i = playingTeamsModel.count - 1; |
|
306 |
while ((i >= 0) && (playingTeamsModel.get(i).name !== teamName)) --i |
|
307 |
||
308 |
if(i >= 0) playingTeamsModel.setProperty(i, "hedgehogsNumber", hedgehogsNumber) |
|
309 |
} |
|
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
|
310 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
311 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
312 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
313 |
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
|
314 |
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
|
315 |
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
|
316 |
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
|
317 |
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
|
318 |
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
|
319 |
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
|
320 |
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
|
321 |
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
|
322 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
323 |
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
|
324 |
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
|
325 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
326 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
327 |
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
|
328 |
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
|
329 |
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
|
330 |
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
|
331 |
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
|
332 |
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
|
333 |
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
|
334 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
335 |
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
|
336 |
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
|
337 |
} |
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
338 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
339 |
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
|
340 |
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
|
341 |
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
|
342 |
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
|
343 |
} |
10442 | 344 |
} |
345 |
||
346 |
Connections { |
|
347 |
target: HWEngine |
|
348 |
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
|
349 |
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
|
350 |
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
|
351 |
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
|
352 |
|
47a6231f1fc1
Teams widget now allows to add and remove teams (basic implementation, no checks performed, no colors, no hedgehogs)
unc0rr
parents:
10442
diff
changeset
|
353 |
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
|
354 |
} |
10442 | 355 |
} |
356 |
} |
|
357 |
||
358 |
Component.onCompleted: { |
|
10450 | 359 |
HWEngine.resetGameConfig() |
10442 | 360 |
HWEngine.getTeamsList() |
361 |
HWEngine.getPreview() |
|
362 |
} |
|
10422 | 363 |
} |