qmlFrontend/qml/qmlFrontend/LobbyPage.qml
author unc0rr
Fri, 20 Nov 2015 23:56:13 +0300
branchqmlfrontend
changeset 11418 091149424aa4
parent 11415 05cf35103206
child 11419 8a5cc31483c6
permissions -rw-r--r--
Handle ROOMS and ROOM ADD protocol commands
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
11415
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
     1
import QtQuick 2.0
11418
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
     2
import Hedgewars.Engine 1.0
11415
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
     3
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
     4
Rectangle {
11418
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
     5
    ListView {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
     6
        id: roomsList
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
     7
        x: 20
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
     8
        y: 0
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
     9
        width: parent.width
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    10
        height: parent.height - x
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    11
        focus: true
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    12
        clip: true
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    13
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    14
        model: ListModel {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    15
            id: roomsListModel
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    16
        }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    17
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    18
        delegate: Rectangle {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    19
            id: roomDelegate
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    20
            height: 24
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    21
            width: parent.width
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    22
            color: "transparent"
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    23
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    24
            Row {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    25
                spacing: 8;
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    26
                Text {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    27
                    text: name
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    28
                }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    29
                Text {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    30
                    text: players + " / " + teams
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    31
                }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    32
                Text {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    33
                    text: host
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    34
                }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    35
                Text {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    36
                    text: map
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    37
                }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    38
                Text {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    39
                    text: script
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    40
                }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    41
                Text {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    42
                    text: scheme
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    43
                }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    44
                Text {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    45
                    text: weapons
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    46
                }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    47
            }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    48
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    49
            MouseArea {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    50
                 z: 1
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    51
                 anchors.fill: parent
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    52
                 onClicked: ;
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    53
            }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    54
        }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    55
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    56
        Connections {
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    57
            target: HWEngine
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    58
            onRoomAdded: roomsListModel.append({
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    59
                               "name" : name
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    60
                               , "players": players
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    61
                               , "teams": teams
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    62
                               , "host": host
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    63
                               , "map": map
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    64
                               , "script": script
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    65
                               , "scheme": scheme
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    66
                               , "weapons": weapons
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    67
                           })
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    68
        }
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    69
    }
11415
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
    70
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
    71
    Chat {
11418
091149424aa4 Handle ROOMS and ROOM ADD protocol commands
unc0rr
parents: 11415
diff changeset
    72
        id: lobbyChat;
11415
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
    73
        x: 0;
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
    74
        y: 100;
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
    75
        width: parent.width;
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
    76
        height: parent.height - y;
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
    77
    }
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
    78
}
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
    79
05cf35103206 Lobby page with chat widget(readonly)
unc0rr
parents:
diff changeset
    80