branch | qmlfrontend |
changeset 11429 | 86c13e5662f1 |
parent 11428 | e045dc60c37e |
child 11435 | f88b3948adf3 |
11428:e045dc60c37e | 11429:86c13e5662f1 |
---|---|
36 |
36 |
37 connectOfficialServer_t * flibConnectOfficialServer; |
37 connectOfficialServer_t * flibConnectOfficialServer; |
38 passNetData_t * flibPassNetData; |
38 passNetData_t * flibPassNetData; |
39 sendChatLine_t * flibSendChatLine; |
39 sendChatLine_t * flibSendChatLine; |
40 joinRoom_t * flibJoinRoom; |
40 joinRoom_t * flibJoinRoom; |
41 } |
41 partRoom_t * flibPartRoom; |
42 |
42 } |
43 Q_DECLARE_METATYPE(MessageType); |
43 |
44 Q_DECLARE_METATYPE(MessageType) |
|
44 |
45 |
45 HWEngine::HWEngine(QQmlEngine *engine, QObject *parent) : |
46 HWEngine::HWEngine(QQmlEngine *engine, QObject *parent) : |
46 QObject(parent), |
47 QObject(parent), |
47 m_engine(engine) |
48 m_engine(engine) |
48 { |
49 { |
84 |
85 |
85 flibConnectOfficialServer = (connectOfficialServer_t*) hwlib.resolve("connectOfficialServer"); |
86 flibConnectOfficialServer = (connectOfficialServer_t*) hwlib.resolve("connectOfficialServer"); |
86 flibPassNetData = (passNetData_t*) hwlib.resolve("passNetData"); |
87 flibPassNetData = (passNetData_t*) hwlib.resolve("passNetData"); |
87 flibSendChatLine = (sendChatLine_t*) hwlib.resolve("sendChatLine"); |
88 flibSendChatLine = (sendChatLine_t*) hwlib.resolve("sendChatLine"); |
88 flibJoinRoom = (joinRoom_t*) hwlib.resolve("joinRoom"); |
89 flibJoinRoom = (joinRoom_t*) hwlib.resolve("joinRoom"); |
90 flibPartRoom = (partRoom_t*) hwlib.resolve("partRoom"); |
|
89 |
91 |
90 flibInit("/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GC/share/hedgewars/Data", "/usr/home/unC0Rr/.hedgewars"); |
92 flibInit("/usr/home/unC0Rr/Sources/Hedgewars/Hedgewars-GC/share/hedgewars/Data", "/usr/home/unC0Rr/.hedgewars"); |
91 flibRegisterUIMessagesCallback(this, &guiMessagesCallback); |
93 flibRegisterUIMessagesCallback(this, &guiMessagesCallback); |
92 |
94 |
93 ThemeIconProvider * themeIcon = (ThemeIconProvider *)m_engine->imageProvider(QLatin1String("theme")); |
95 ThemeIconProvider * themeIcon = (ThemeIconProvider *)m_engine->imageProvider(QLatin1String("theme")); |
200 case MSG_LOBBYCHATLINE: { |
202 case MSG_LOBBYCHATLINE: { |
201 QStringList l = QString::fromUtf8(msg).split('\n'); |
203 QStringList l = QString::fromUtf8(msg).split('\n'); |
202 emit lobbyChatLine(l[0], l[1]); |
204 emit lobbyChatLine(l[0], l[1]); |
203 break; |
205 break; |
204 } |
206 } |
207 case MSG_ADDROOMCLIENT: { |
|
208 emit roomClientAdded(QString::fromUtf8(msg)); |
|
209 break; |
|
210 } |
|
211 case MSG_REMOVEROOMCLIENT: { |
|
212 QStringList l = QString::fromUtf8(msg).split('\n'); |
|
213 emit roomClientRemoved(l[0], l[1]); |
|
214 break; |
|
215 } |
|
216 case MSG_ROOMCHATLINE: { |
|
217 QStringList l = QString::fromUtf8(msg).split('\n'); |
|
218 emit roomChatLine(l[0], l[1]); |
|
219 break; |
|
220 } |
|
205 case MSG_ADDROOM: { |
221 case MSG_ADDROOM: { |
206 QStringList l = QString::fromUtf8(msg).split('\n'); |
222 QStringList l = QString::fromUtf8(msg).split('\n'); |
207 emit roomAdded(0, l[1], l[2].toInt(), l[3].toInt(), l[4], l[5], l[6], l[7], l[8]); |
223 emit roomAdded(0, l[1], l[2].toInt(), l[3].toInt(), l[4], l[5], l[6], l[7], l[8]); |
208 break; |
224 break; |
209 } |
225 } |
220 emit errorMessage(QString::fromUtf8(msg)); |
236 emit errorMessage(QString::fromUtf8(msg)); |
221 break; |
237 break; |
222 } |
238 } |
223 case MSG_WARNING: { |
239 case MSG_WARNING: { |
224 emit warningMessage(QString::fromUtf8(msg)); |
240 emit warningMessage(QString::fromUtf8(msg)); |
241 break; |
|
242 } |
|
243 case MSG_MOVETOLOBBY: { |
|
244 emit movedToLobby(); |
|
245 break; |
|
246 } |
|
247 case MSG_MOVETOROOM: { |
|
248 emit movedToRoom(); |
|
225 break; |
249 break; |
226 } |
250 } |
227 } |
251 } |
228 } |
252 } |
229 |
253 |
308 void HWEngine::joinRoom(const QString &roomName) |
332 void HWEngine::joinRoom(const QString &roomName) |
309 { |
333 { |
310 flibJoinRoom(roomName.toUtf8().constData()); |
334 flibJoinRoom(roomName.toUtf8().constData()); |
311 } |
335 } |
312 |
336 |
337 void HWEngine::partRoom(const QString &message) |
|
338 { |
|
339 flibPartRoom(message.toUtf8().constData()); |
|
340 } |
|
341 |
|
313 void HWEngine::setTheme(const QString &theme) |
342 void HWEngine::setTheme(const QString &theme) |
314 { |
343 { |
315 flibSetTheme(theme.toUtf8().constData()); |
344 flibSetTheme(theme.toUtf8().constData()); |
316 } |
345 } |
317 |
346 |