Handle ROOM UPD qmlfrontend
authorunc0rr
Sat, 21 Nov 2015 12:40:33 +0300
branchqmlfrontend
changeset 11422 c6c6a4b32cea
parent 11421 25e0f427f57e
child 11423 e045dc60c37e
Handle ROOM UPD
qmlFrontend/hwengine.cpp
qmlFrontend/hwengine.h
qmlFrontend/qml/qmlFrontend/LobbyPage.qml
--- a/qmlFrontend/hwengine.cpp	Sat Nov 21 10:04:20 2015 +0300
+++ b/qmlFrontend/hwengine.cpp	Sat Nov 21 12:40:33 2015 +0300
@@ -205,6 +205,8 @@
         break;
     }
     case MSG_UPDATEROOM: {
+        QStringList l = QString::fromUtf8(msg).split('\n');
+        emit roomUpdated(l[0], 0, l[2], l[3].toInt(), l[4].toInt(), l[5], l[6], l[7], l[8], l[9]);
         break;
     }
     case MSG_REMOVEROOM: {
--- a/qmlFrontend/hwengine.h	Sat Nov 21 10:04:20 2015 +0300
+++ b/qmlFrontend/hwengine.h	Sat Nov 21 12:40:33 2015 +0300
@@ -64,6 +64,16 @@
                    , const QString & script
                    , const QString & scheme
                    , const QString & weapons);
+    void roomUpdated(const QString & name
+                   , quint32 flags
+                   , const QString & newName
+                   , int players
+                   , int teams
+                   , const QString & host
+                   , const QString & map
+                   , const QString & script
+                   , const QString & scheme
+                   , const QString & weapons);
     void roomRemoved(const QString & name);
 
 public slots:
--- a/qmlFrontend/qml/qmlFrontend/LobbyPage.qml	Sat Nov 21 10:04:20 2015 +0300
+++ b/qmlFrontend/qml/qmlFrontend/LobbyPage.qml	Sat Nov 21 12:40:33 2015 +0300
@@ -65,6 +65,23 @@
                                , "scheme": scheme
                                , "weapons": weapons
                            })
+            onRoomUpdated: {
+                var i = roomsListModel.count - 1;
+                while ((i >= 0) && (roomsListModel.get(i).name !== name)) --i
+
+                if(i >= 0) {
+                    roomsListModel.set(i, {
+                                           "name" : newName
+                                           , "players": players
+                                           , "teams": teams
+                                           , "host": host
+                                           , "map": map
+                                           , "script": script
+                                           , "scheme": scheme
+                                           , "weapons": weapons
+                                       })
+                }
+            }
             onRoomRemoved: {
                 var i = roomsListModel.count - 1;
                 while ((i >= 0) && (roomsListModel.get(i).name !== name)) --i
@@ -77,7 +94,7 @@
     Chat {
         id: lobbyChat;
         x: 0;
-        y: 100;
+        y: 300;
         width: parent.width;
         height: parent.height - y;
     }