qmlFrontend/hwengine.cpp
branchqmlfrontend
changeset 10452 03519fd9f98d
parent 10450 bf9e30b4ef9b
child 10456 6fd99bb73524
--- a/qmlFrontend/hwengine.cpp	Sat Nov 01 22:51:07 2014 +0300
+++ b/qmlFrontend/hwengine.cpp	Mon Nov 03 00:01:02 2014 +0300
@@ -25,6 +25,7 @@
     getTeamsList_t *flibGetTeamsList;
     tryAddTeam_t * flibTryAddTeam;
     tryRemoveTeam_t * flibTryRemoveTeam;
+    changeTeamColor_t * flibChangeTeamColor;
 }
 
 Q_DECLARE_METATYPE(MessageType);
@@ -58,6 +59,7 @@
     flibGetTeamsList = (getTeamsList_t*) hwlib.resolve("getTeamsList");
     flibTryAddTeam = (tryAddTeam_t*) hwlib.resolve("tryAddTeam");
     flibTryRemoveTeam = (tryRemoveTeam_t*) hwlib.resolve("tryRemoveTeam");
+    flibChangeTeamColor = (changeTeamColor_t*) hwlib.resolve("changeTeamColor");
 
     flibInit("/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GC/share/hedgewars/Data", "/usr/home/unC0Rr/.hedgewars");
     flibRegisterGUIMessagesCallback(this, &guiMessagesCallback);
@@ -143,6 +145,11 @@
         emit localTeamRemoved(msg);
         break;
     }
+    case MSG_TEAMCOLOR: {
+        QStringList l = QString::fromUtf8(msg).split('\n');
+        emit teamColorChanged(l[0], QColor::fromRgba(l[1].toInt()).name());
+        break;
+    }
     }
 }
 
@@ -190,3 +197,8 @@
 {
     flibResetGameConfig();
 }
+
+void HWEngine::changeTeamColor(const QString &teamName, int dir)
+{
+    flibChangeTeamColor(teamName.toUtf8().constData(), dir);
+}