qmlFrontend/hwengine.cpp
branchqmlfrontend
changeset 11424 86c13e5662f1
parent 11423 e045dc60c37e
child 11430 f88b3948adf3
--- a/qmlFrontend/hwengine.cpp	Sat Nov 21 17:07:06 2015 +0300
+++ b/qmlFrontend/hwengine.cpp	Sat Nov 21 23:56:41 2015 +0300
@@ -38,9 +38,10 @@
     passNetData_t * flibPassNetData;
     sendChatLine_t * flibSendChatLine;
     joinRoom_t * flibJoinRoom;
+    partRoom_t * flibPartRoom;
 }
 
-Q_DECLARE_METATYPE(MessageType);
+Q_DECLARE_METATYPE(MessageType)
 
 HWEngine::HWEngine(QQmlEngine *engine, QObject *parent) :
     QObject(parent),
@@ -86,6 +87,7 @@
     flibPassNetData = (passNetData_t*) hwlib.resolve("passNetData");
     flibSendChatLine = (sendChatLine_t*) hwlib.resolve("sendChatLine");
     flibJoinRoom = (joinRoom_t*) hwlib.resolve("joinRoom");
+    flibPartRoom = (partRoom_t*) hwlib.resolve("partRoom");
 
     flibInit("/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GC/share/hedgewars/Data", "/usr/home/unC0Rr/.hedgewars");
     flibRegisterUIMessagesCallback(this, &guiMessagesCallback);
@@ -202,6 +204,20 @@
         emit lobbyChatLine(l[0], l[1]);
         break;
     }
+    case MSG_ADDROOMCLIENT: {
+        emit roomClientAdded(QString::fromUtf8(msg));
+        break;
+    }
+    case MSG_REMOVEROOMCLIENT: {
+        QStringList l = QString::fromUtf8(msg).split('\n');
+        emit roomClientRemoved(l[0], l[1]);
+        break;
+    }
+    case MSG_ROOMCHATLINE: {
+        QStringList l = QString::fromUtf8(msg).split('\n');
+        emit roomChatLine(l[0], l[1]);
+        break;
+    }
     case MSG_ADDROOM: {
         QStringList l = QString::fromUtf8(msg).split('\n');
         emit roomAdded(0, l[1], l[2].toInt(), l[3].toInt(), l[4], l[5], l[6], l[7], l[8]);
@@ -224,6 +240,14 @@
         emit warningMessage(QString::fromUtf8(msg));
         break;
     }
+    case MSG_MOVETOLOBBY: {
+        emit movedToLobby();
+        break;
+    }
+    case MSG_MOVETOROOM: {
+        emit movedToRoom();
+        break;
+    }
     }
 }
 
@@ -310,6 +334,11 @@
     flibJoinRoom(roomName.toUtf8().constData());
 }
 
+void HWEngine::partRoom(const QString &message)
+{
+    flibPartRoom(message.toUtf8().constData());
+}
+
 void HWEngine::setTheme(const QString &theme)
 {
     flibSetTheme(theme.toUtf8().constData());