QTfrontend/hwform.cpp
changeset 6036 727d13409891
parent 6030 2577028cba07
child 6042 8b5345758f62
equal deleted inserted replaced
6034:8cdfac630261 6036:727d13409891
   273 }
   273 }
   274 
   274 
   275 #ifdef USE_XFIRE
   275 #ifdef USE_XFIRE
   276 void HWForm::updateXfire(void)
   276 void HWForm::updateXfire(void)
   277 {
   277 {
   278     if(hwnet)
   278     if(hwnet && (hwnet->clientState() != HWNewNet::Disconnected))
   279     {
   279     {
   280         xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare("netserver.hedgewars.org:46631") ? "Official server" : hwnet->getHost().toAscii());
   280         xfire_setvalue(XFIRE_SERVER, !hwnet->getHost().compare("netserver.hedgewars.org:46631") ? "Official server" : hwnet->getHost().toAscii());
   281         switch(hwnet->getClientState())
   281         switch(hwnet->clientState())
   282         {
   282         {
   283             case 1: // Connecting
   283             case HWNewNet::Connecting: // Connecting
       
   284             case HWNewNet::Connected:
   284             xfire_setvalue(XFIRE_STATUS, "Connecting");
   285             xfire_setvalue(XFIRE_STATUS, "Connecting");
   285             xfire_setvalue(XFIRE_NICKNAME, "-");
   286             xfire_setvalue(XFIRE_NICKNAME, "-");
   286             xfire_setvalue(XFIRE_ROOM, "-");
   287             xfire_setvalue(XFIRE_ROOM, "-");
   287             case 2: // In lobby
   288             case HWNewNet::InLobby: // In lobby
   288             xfire_setvalue(XFIRE_STATUS, "Online");
   289             xfire_setvalue(XFIRE_STATUS, "Online");
   289             xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii());
   290             xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii());
   290             xfire_setvalue(XFIRE_ROOM, "In game lobby");
   291             xfire_setvalue(XFIRE_ROOM, "In game lobby");
   291             break;
   292             break;
   292             case 3: // In room
   293             case HWNewNet::InRoom: // In room
   293             xfire_setvalue(XFIRE_STATUS, "Online");
   294             xfire_setvalue(XFIRE_STATUS, "Online");
   294             xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii());
   295             xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii());
   295             xfire_setvalue(XFIRE_ROOM, (hwnet->getRoom() + " (waiting for players)").toAscii());
   296             xfire_setvalue(XFIRE_ROOM, (hwnet->getRoom() + " (waiting for players)").toAscii());
   296             break;
   297             break;
   297             case 5: // In game
   298             case HWNewNet::InGame: // In game
   298             xfire_setvalue(XFIRE_STATUS, "Online");
   299             xfire_setvalue(XFIRE_STATUS, "Online");
   299             xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii());
   300             xfire_setvalue(XFIRE_NICKNAME, hwnet->getNick().toAscii());
   300             xfire_setvalue(XFIRE_ROOM, (hwnet->getRoom() + " (playing or spectating)").toAscii());
   301             xfire_setvalue(XFIRE_ROOM, (hwnet->getRoom() + " (playing or spectating)").toAscii());
   301             break;
   302             break;
   302             default:
   303             default:
   781     hwnet = new HWNewNet();
   782     hwnet = new HWNewNet();
   782 
   783 
   783     GoToPage(ID_PAGE_CONNECTING);
   784     GoToPage(ID_PAGE_CONNECTING);
   784 
   785 
   785     connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame()));
   786     connect(hwnet, SIGNAL(AskForRunGame()), this, SLOT(CreateNetGame()));
   786     connect(hwnet, SIGNAL(Connected()), this, SLOT(NetConnected()));
   787     connect(hwnet, SIGNAL(connected()), this, SLOT(NetConnected()));
   787     connect(hwnet, SIGNAL(Error(const QString&)), this, SLOT(NetError(const QString&)));
   788     connect(hwnet, SIGNAL(Error(const QString&)), this, SLOT(NetError(const QString&)));
   788     connect(hwnet, SIGNAL(Warning(const QString&)), this, SLOT(NetWarning(const QString&)));
   789     connect(hwnet, SIGNAL(Warning(const QString&)), this, SLOT(NetWarning(const QString&)));
   789     connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
   790     connect(hwnet, SIGNAL(EnteredGame()), this, SLOT(NetGameEnter()));
   790     connect(hwnet, SIGNAL(LeftRoom(const QString&)), this, SLOT(NetLeftRoom(const QString&)));
   791     connect(hwnet, SIGNAL(LeftRoom(const QString&)), this, SLOT(NetLeftRoom(const QString&)));
   791     connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
   792     connect(hwnet, SIGNAL(AddNetTeam(const HWTeam&)), this, SLOT(AddNetTeam(const HWTeam&)));
   897     connect(ui.pageAdmin, SIGNAL(setProtocol(int)), hwnet, SLOT(setLatestProtocolVar(int)));
   898     connect(ui.pageAdmin, SIGNAL(setProtocol(int)), hwnet, SLOT(setLatestProtocolVar(int)));
   898     connect(ui.pageAdmin, SIGNAL(askServerVars()), hwnet, SLOT(askServerVars()));
   899     connect(ui.pageAdmin, SIGNAL(askServerVars()), hwnet, SLOT(askServerVars()));
   899     connect(ui.pageAdmin, SIGNAL(clearAccountsCache()), hwnet, SLOT(clearAccountsCache()));
   900     connect(ui.pageAdmin, SIGNAL(clearAccountsCache()), hwnet, SLOT(clearAccountsCache()));
   900 
   901 
   901 // disconnect
   902 // disconnect
   902     connect(hwnet, SIGNAL(Disconnected(const QString&)), this, SLOT(ForcedDisconnect(const QString&)), Qt::QueuedConnection);
   903     connect(hwnet, SIGNAL(disconnected(const QString&)), this, SLOT(ForcedDisconnect(const QString&)), Qt::QueuedConnection);
   903 
   904 
   904 // config stuff
   905 // config stuff
   905     connect(hwnet, SIGNAL(paramChanged(const QString &, const QStringList &)), ui.pageNetGame->pGameCFG, SLOT(setParam(const QString &, const QStringList &)));
   906     connect(hwnet, SIGNAL(paramChanged(const QString &, const QStringList &)), ui.pageNetGame->pGameCFG, SLOT(setParam(const QString &, const QStringList &)));
   906     connect(ui.pageNetGame->pGameCFG, SIGNAL(paramChanged(const QString &, const QStringList &)), hwnet, SLOT(onParamChanged(const QString &, const QStringList &)));
   907     connect(ui.pageNetGame->pGameCFG, SIGNAL(paramChanged(const QString &, const QStringList &)), hwnet, SLOT(onParamChanged(const QString &, const QStringList &)));
   907     connect(hwnet, SIGNAL(configAsked()), ui.pageNetGame->pGameCFG, SLOT(fullNetConfig()));
   908     connect(hwnet, SIGNAL(configAsked()), ui.pageNetGame->pGameCFG, SLOT(fullNetConfig()));