/*--- Launch thread ---*/ void Downloader::Connect() { qDebug() << "Downloader::Connect"; // Files init QFile::remove(FTP_OLD_RELEASE_NOTES_FILE); QFile::copy(FTP_RELEASE_NOTES_FILE, FTP_OLD_RELEASE_NOTES_FILE); QFile::remove(FTP_RELEASE_NOTES_FILE); QFile::remove(FTP_MANIFEST_FILE); // URL setup baseUrl = new QUrl(); baseUrl->setScheme("ftp"); baseUrl->setPort(21); baseUrl->setHost(FTP_SERVER); baseUrl->setUserName(FTP_USER); // FTP setup currentSpeed = 0.0; currentFtpFile = ""; ftp = new QNetworkAccessManager(); connect(ftp, SIGNAL(finished(QNetworkReply*)), this, SLOT(FileFinished(QNetworkReply*))); // Timers chrono = new QTime(); timeoutTimer = new QTimer(this); speedUpdateTimer = new QTimer(this); downloadUpdateTimer = new QTimer(this); connect(timeoutTimer, SIGNAL(timeout()), this, SLOT(Reconnect())); connect(speedUpdateTimer, SIGNAL(timeout()), this, SLOT(UpdateSpeedInfo())); connect(downloadUpdateTimer, SIGNAL(timeout()), this, SLOT(UpdateDownloadInfo())); // Chrono chronoSize = 0; chrono->start(); speedUpdateTimer->setSingleShot(true); speedUpdateTimer->start(FTP_SPEED_UPDATE_TIME); downloadUpdateTimer->setSingleShot(true); downloadUpdateTimer->start(FTP_DOWNLOAD_UPDATE_TIME); // Launch #if USE_PASSWORD emit AskForPassword(); #else Login(""); #endif }
void CFolderJoin::JoinCurGame(LTBOOL bPasswordSet) { // Get the currently selected game server... CGameSpyServer* pGame = GetGameSpyClientMgr()->GetServerFromHandle(m_pCurServerHandle); if (!pGame) return; if (IsCurrentGame(pGame)) { HLOCALOBJ hPlayerObj = g_pLTClient->GetClientObject(); if (g_pGameClientShell->IsInWorld() && hPlayerObj) { g_pInterfaceMgr->ChangeState(GS_PLAYING); } return; } if (pGame->GetNumPlayers() >= pGame->GetMaxPlayers()) { HSTRING hString = g_pLTClient->FormatString(IDS_SERVERFULL); g_pInterfaceMgr->ShowMessageBox(hString,LTMB_OK,LTNULL,LTNULL); g_pLTClient->FreeString(hString); return; } char sVer[16]; sprintf(sVer,"%d.%.3d",GAME_HANDSHAKE_VER_MAJOR,(GAME_HANDSHAKE_VER_MINOR-1)); char* sGameVer = pGame->GetStringValue("gamever"); if (sGameVer && stricmp(sVer,sGameVer)!=0) { HSTRING hString = g_pLTClient->FormatString(IDS_SERVER_WRONGVERSION); g_pInterfaceMgr->ShowMessageBox(hString,LTMB_OK,LTNULL,LTNULL,g_pInterfaceResMgr->IsEnglish()); g_pLTClient->FreeString(hString); return; } // Check for password protection... char* sPassword = pGame->GetStringValue("Password"); if (sPassword && sPassword[0] != '\0') { if (bPasswordSet) { if (stricmp(m_szPassword, sPassword) != 0) { HSTRING hString = g_pLTClient->FormatString(IDS_ACCESSDENIED); g_pInterfaceMgr->ShowMessageBox(hString,LTMB_OK,LTNULL,LTNULL); g_pLTClient->FreeString(hString); return; } } else { AskForPassword(); return; } } if (!DoJoinGame(pGame)) { g_pInterfaceMgr->LoadFailed(); g_pInterfaceMgr->ConnectionFailed(nConnectError); } }