1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
|
/****************************************************************************
**
** This file is a part of QtChickenWranglers.
**
** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).*
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** You may use this file under the terms of the BSD license as follows:
**
** "Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions
** are met:
**
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
**
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
**
** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor
** the names of its contributors may be used to endorse or promote
** products derived from this software without specific prior written
** permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
** FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
** COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
** BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
** LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
** ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
** POSSIBILITY OF SUCH DAMAGE."
**
****************************************************************************/
import Qt 4.7
import game.types 1.0
import "common.js" as Common
import "widgets"
Screen {
id: screen
signal back
signal matchStarted
Keys.onReturnPressed: {
if (buttonStart.enabled)
matchStarted()
}
Image {
id: background
smooth: true
anchors.fill: parent
source: {
if (game.environment() == Global.Symbian)
"qrc:/images/general/symbian/bg_640x360.png"
else if (game.environment() == Global.Maemo)
"qrc:/images/general/bg_800x480.png"
else
"qrc:/images/general/bg_1280x768.png"
}
}
ImageButton {
anchors {
left: screen.left
top: screen.top
margins: 15
}
name: "back"
onClicked: back()
}
Button {
id: buttonStart
anchors {
top: screen.top
right: screen.right
margins: 15
}
width: 160
text: "Start"
sourceName: "bt_start"
rightBorder: 35
horizontalCenterOffset: -6
italic: true
enabled: playerListModel.playersReady;
onClicked: matchStarted()
}
ListView {
id: playerListView
anchors {
centerIn: parent
horizontalCenterOffset: 30
verticalCenterOffset: 130
}
height: 400
width: 400
model: playerListModel
delegate: playerListDelegate
interactive: false
}
Component {
id: playerListDelegate
Item {
id: delegatePlayer
scale: {
if (game.environment() == Global.Symbian)
0.7
else
1
}
width: 400
height: 80
property bool isReady: status == PlayerModel.Ready
states {
State {
name: "playerReady"; when: isReady
PropertyChanges { target: playerInfo; opacity: 1 }
PropertyChanges { target: playerInfoUnknown; opacity: 0 }
}
}
Image {
id: listItemBg
anchors {
top: playerInfoUnknown.top
topMargin: 32
}
source: "qrc:/images/general/list_name_bg.png"
}
Item {
id: playerInfoUnknown
Image {
id: listItemIconUnknown
smooth: true
anchors {
top: parent.top
left: parent.left
leftMargin: 25
}
source: "qrc:/images/general/list_unknown_character.png"
fillMode: Image.PreserveAspectFit
}
Loading {
id: listItemLoading
anchors {
left: listItemIconUnknown.right
leftMargin: 40
bottom: listItemIconUnknown.bottom
bottomMargin: 20
}
}
}
Item {
id: playerInfo
opacity: 0
Image {
id: listItemIcon
smooth: true
anchors {
top: parent.top
left: parent.left
leftMargin: 25
}
source: Common.getImagePath(characterPath, "waitinglist.png")
fillMode: Image.PreserveAspectFit
}
Item {
id: listItemNameOk
anchors {
left: listItemIcon.right
leftMargin: 15
bottom: listItemIcon.bottom
bottomMargin: 12
}
Image {
id: listItemName
smooth: true
anchors {
left: listItemNameOk.left
bottom: listItemNameOk.bottom
}
source: Common.getImagePath(characterPath, "name.png")
fillMode: Image.PreserveAspectFit
}
Image {
id: listItemOk
smooth: true
anchors {
left: listItemName.right
leftMargin: 30
verticalCenter: listItemName.verticalCenter
}
source: "qrc:/images/general/list_status_ok.png"
fillMode: Image.PreserveAspectFit
}
}
ParallelAnimation {
id: anim
SequentialAnimation {
PropertyAnimation {
target: listItemIcon
property: "scale"
duration: 300
easing.type: Easing.InOutBack
to: 2
}
PropertyAnimation {
target: listItemIcon
property: "scale"
duration: 200
to: 1
}
}
}
onOpacityChanged: {
anim.running = true
}
}
ListView.onAdd: SequentialAnimation {
PropertyAction { target: delegatePlayer; property: "scale"; value: 0 }
NumberAnimation { target: delegatePlayer; property: "scale"; to: 1; duration: 250; easing.type: Easing.InOutQuad }
}
ListView.onRemove: SequentialAnimation {
PropertyAction { target: delegatePlayer; property: "ListView.delayRemove"; value: true }
NumberAnimation { target: delegatePlayer; property: "scale"; to: 0; duration: 250; easing.type: Easing.InOutQuad }
PropertyAction { target: delegatePlayer; property: "ListView.delayRemove"; value: false }
}
}
}
}
|