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