133 void HWEngine::guiMessagesCallback(void *context, MessageType mt, const char * msg, uint32_t len) |
133 void HWEngine::guiMessagesCallback(void *context, MessageType mt, const char * msg, uint32_t len) |
134 { |
134 { |
135 HWEngine * obj = (HWEngine *)context; |
135 HWEngine * obj = (HWEngine *)context; |
136 QByteArray b = QByteArray(msg, len); |
136 QByteArray b = QByteArray(msg, len); |
137 |
137 |
138 qDebug() << "FLIPC in" << b.size() << b; |
138 //qDebug() << "FLIPC in" << b.size() << b; |
139 |
139 |
140 QMetaObject::invokeMethod(obj, "engineMessageHandler", Qt::QueuedConnection, Q_ARG(MessageType, mt), Q_ARG(QByteArray, b)); |
140 QMetaObject::invokeMethod(obj, "engineMessageHandler", Qt::QueuedConnection, Q_ARG(MessageType, mt), Q_ARG(QByteArray, b)); |
141 } |
141 } |
142 |
142 |
143 void HWEngine::engineMessageHandler(MessageType mt, const QByteArray &msg) |
143 void HWEngine::engineMessageHandler(MessageType mt, const QByteArray &msg) |
154 QStringList l = QString::fromUtf8(msg).split('\n'); |
154 QStringList l = QString::fromUtf8(msg).split('\n'); |
155 emit playingTeamAdded(l[1], l[0].toInt(), true); |
155 emit playingTeamAdded(l[1], l[0].toInt(), true); |
156 break; |
156 break; |
157 } |
157 } |
158 case MSG_REMOVEPLAYINGTEAM: { |
158 case MSG_REMOVEPLAYINGTEAM: { |
159 emit playingTeamRemoved(msg); |
159 emit playingTeamRemoved(QString::fromUtf8(msg)); |
160 break; |
160 break; |
161 } |
161 } |
162 case MSG_ADDTEAM: { |
162 case MSG_ADDTEAM: { |
163 emit localTeamAdded(msg, 0); |
163 emit localTeamAdded(QString::fromUtf8(msg), 0); |
164 break; |
164 break; |
165 } |
165 } |
166 case MSG_REMOVETEAM: { |
166 case MSG_REMOVETEAM: { |
167 emit localTeamRemoved(msg); |
167 emit localTeamRemoved(QString::fromUtf8(msg)); |
168 break; |
168 break; |
169 } |
169 } |
170 case MSG_TEAMCOLOR: { |
170 case MSG_TEAMCOLOR: { |
171 QStringList l = QString::fromUtf8(msg).split('\n'); |
171 QStringList l = QString::fromUtf8(msg).split('\n'); |
172 emit teamColorChanged(l[0], QColor::fromRgba(l[1].toInt()).name()); |
172 emit teamColorChanged(l[0], QColor::fromRgba(l[1].toInt()).name()); |
173 break; |
173 break; |
174 } |
174 } |
175 case MSG_NETDATA: { |
175 case MSG_NETDATA: { |
176 flibPassNetData(msg.constData()); |
176 flibPassNetData(msg.constData()); |
|
177 break; |
|
178 } |
|
179 case MSG_CONNECTED: { |
|
180 emit netConnected(); |
|
181 break; |
|
182 } |
|
183 case MSG_DISCONNECTED: { |
|
184 emit netDisconnected(QString::fromUtf8(msg)); |
|
185 break; |
|
186 } |
|
187 case MSG_ADDLOBBYCLIENT: { |
|
188 emit lobbyClientAdded(QString::fromUtf8(msg)); |
|
189 break; |
|
190 } |
|
191 case MSG_REMOVELOBBYCLIENT: { |
|
192 emit lobbyClientRemoved(QString::fromUtf8(msg)); |
|
193 break; |
|
194 } |
|
195 case MSG_LOBBYCHATLINE: { |
|
196 QStringList l = QString::fromUtf8(msg).split('\n'); |
|
197 emit lobbyChatLine(l[0], l[1]); |
|
198 break; |
177 } |
199 } |
178 } |
200 } |
179 } |
201 } |
180 |
202 |
181 QString HWEngine::currentSeed() |
203 QString HWEngine::currentSeed() |