--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/qmlFrontend/qml/qmlFrontend/Chat.qml Thu Nov 19 23:04:53 2015 +0300
@@ -0,0 +1,117 @@
+import QtQuick 2.0
+import Hedgewars.Engine 1.0
+
+Rectangle {
+ id: chat
+ color: "#15193a"
+ radius: 8
+ border.width: 4
+ opacity: 1
+ border.color: "#ea761d"
+
+ ListView {
+ id: chatLines
+ x: 0
+ y: 0
+ width: parent.width - clientsList.width
+ height: parent.height
+ focus: true
+ clip: true
+ highlightFollowsCurrentItem: true
+
+ model: ListModel {
+ id: chatLinesModel
+ }
+
+ delegate: Rectangle {
+ id: chatLinesDelegate
+ height: 24
+ width: parent.width
+ color: "transparent"
+
+ Row {
+ spacing: 8;
+ Text {
+ color: "#ffffa0"
+ text: nick
+
+ MouseArea {
+ z: 1
+ anchors.fill: parent
+ onClicked: ;
+ }
+ }
+ Text {
+ color: "#ffffff"
+ text: name
+
+ MouseArea {
+ z: 1
+ anchors.fill: parent
+ onClicked: ;
+ }
+ }
+ }
+
+ }
+
+ Connections {
+ target: HWEngine
+ onLobbyChatLine: {
+ chatLinesModel.append({"nick" : nickname, "name": line})
+ if(chatLinesModel.count > 200)
+ chatLinesModel.remove(0)
+ chatLines.currentIndex = chatLinesModel.count - 1
+ }
+ }
+ }
+
+ ListView {
+ id: clientsList
+ x: parent.width - width
+ width: 100
+ height: parent.height
+ focus: true
+ clip: true
+
+ model: ListModel {
+ id: chatClientsModel
+ }
+
+ delegate: Rectangle {
+ id: chatClientDelegate
+ height: 24
+ width: parent.width
+ color: "transparent"
+
+ Row {
+ Text {
+ color: "#ffffff"
+ text: name
+
+ MouseArea {
+ z: 1
+ anchors.fill: parent
+ onClicked: ;
+ }
+ }
+ }
+
+ }
+
+ Connections {
+ target: HWEngine
+ onLobbyClientAdded: {
+ chatClientsModel.append({"isAdmin": false, "name": clientName})
+ }
+ onLobbyClientRemoved: {
+ var i = chatClientsModel.count - 1;
+ while ((i >= 0) && (chatClientsModel.get(i).name !== clientName)) --i;
+
+ if(i >= 0) chatClientsModel.remove(i, 1);
+ }
+ }
+ }
+}
+
+