11415
|
1 |
import QtQuick 2.0
|
11418
|
2 |
import Hedgewars.Engine 1.0
|
11415
|
3 |
|
|
4 |
Rectangle {
|
11418
|
5 |
ListView {
|
|
6 |
id: roomsList
|
11454
|
7 |
anchors.top: parent.top
|
|
8 |
anchors.left: parent.left
|
|
9 |
anchors.right: parent.right
|
|
10 |
anchors.bottom: lobbyChat.top
|
11418
|
11 |
focus: true
|
|
12 |
clip: true
|
|
13 |
|
|
14 |
model: ListModel {
|
|
15 |
id: roomsListModel
|
|
16 |
}
|
|
17 |
|
|
18 |
delegate: Rectangle {
|
|
19 |
id: roomDelegate
|
|
20 |
height: 24
|
|
21 |
width: parent.width
|
|
22 |
color: "transparent"
|
|
23 |
|
|
24 |
Row {
|
|
25 |
spacing: 8;
|
|
26 |
Text {
|
|
27 |
text: name
|
|
28 |
}
|
|
29 |
Text {
|
|
30 |
text: players + " / " + teams
|
|
31 |
}
|
|
32 |
Text {
|
|
33 |
text: host
|
|
34 |
}
|
|
35 |
Text {
|
|
36 |
text: map
|
|
37 |
}
|
|
38 |
Text {
|
|
39 |
text: script
|
|
40 |
}
|
|
41 |
Text {
|
|
42 |
text: scheme
|
|
43 |
}
|
|
44 |
Text {
|
|
45 |
text: weapons
|
|
46 |
}
|
|
47 |
}
|
|
48 |
|
|
49 |
MouseArea {
|
|
50 |
z: 1
|
|
51 |
anchors.fill: parent
|
11423
|
52 |
onDoubleClicked: HWEngine.joinRoom(name);
|
11418
|
53 |
}
|
|
54 |
}
|
|
55 |
|
|
56 |
Connections {
|
|
57 |
target: HWEngine
|
|
58 |
onRoomAdded: roomsListModel.append({
|
|
59 |
"name" : name
|
|
60 |
, "players": players
|
|
61 |
, "teams": teams
|
|
62 |
, "host": host
|
|
63 |
, "map": map
|
|
64 |
, "script": script
|
|
65 |
, "scheme": scheme
|
|
66 |
, "weapons": weapons
|
|
67 |
})
|
11422
|
68 |
onRoomUpdated: {
|
|
69 |
var i = roomsListModel.count - 1;
|
|
70 |
while ((i >= 0) && (roomsListModel.get(i).name !== name)) --i
|
|
71 |
|
|
72 |
if(i >= 0) {
|
|
73 |
roomsListModel.set(i, {
|
|
74 |
"name" : newName
|
|
75 |
, "players": players
|
|
76 |
, "teams": teams
|
|
77 |
, "host": host
|
|
78 |
, "map": map
|
|
79 |
, "script": script
|
|
80 |
, "scheme": scheme
|
|
81 |
, "weapons": weapons
|
|
82 |
})
|
|
83 |
}
|
|
84 |
}
|
11419
|
85 |
onRoomRemoved: {
|
|
86 |
var i = roomsListModel.count - 1;
|
|
87 |
while ((i >= 0) && (roomsListModel.get(i).name !== name)) --i
|
|
88 |
|
|
89 |
if(i >= 0) roomsListModel.remove(i, 1)
|
|
90 |
}
|
11418
|
91 |
}
|
|
92 |
}
|
11415
|
93 |
|
|
94 |
Chat {
|
11418
|
95 |
id: lobbyChat;
|
11454
|
96 |
height: 300
|
|
97 |
anchors.top: undefined
|
|
98 |
anchors.left: parent.left
|
|
99 |
anchors.right: parent.right
|
|
100 |
anchors.bottom: parent.bottom
|
11424
|
101 |
|
|
102 |
Connections {
|
|
103 |
target: HWEngine
|
11434
|
104 |
onNetConnected: lobbyChat.clear()
|
11424
|
105 |
onLobbyChatLine: lobbyChat.addChatLine(nickname, line)
|
|
106 |
onLobbyClientAdded: lobbyChat.addClient(clientName)
|
|
107 |
onLobbyClientRemoved: lobbyChat.removeClient(clientName, reason)
|
|
108 |
}
|
11415
|
109 |
}
|
|
110 |
}
|
|
111 |
|
|
112 |
|