1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Display disabled connect button on server autojoin

This commit is contained in:
Dydzio 2023-11-26 18:39:51 +01:00
parent aed0f09a7d
commit 4b57b9f9a9

View File

@ -528,9 +528,11 @@ CSimpleJoinScreen::CSimpleJoinScreen(bool host)
textTitle = std::make_shared<CTextBox>("", Rect(20, 20, 205, 50), 0, FONT_BIG, ETextAlignment::CENTER, Colors::WHITE);
inputAddress = std::make_shared<CTextInput>(Rect(25, 68, 175, 16), background->getSurface());
inputPort = std::make_shared<CTextInput>(Rect(25, 115, 175, 16), background->getSurface());
buttonOk = std::make_shared<CButton>(Point(26, 142), AnimationPath::builtin("MUBCHCK.DEF"), CGI->generaltexth->zelp[560], std::bind(&CSimpleJoinScreen::connectToServer, this), EShortcut::GLOBAL_ACCEPT);
if(host && !settings["session"]["donotstartserver"].Bool())
{
textTitle->setText(CGI->generaltexth->translate("vcmi.mainMenu.serverConnecting"));
buttonOk->block(true);
startConnectThread();
}
else
@ -539,8 +541,6 @@ CSimpleJoinScreen::CSimpleJoinScreen(bool host)
inputAddress->cb += std::bind(&CSimpleJoinScreen::onChange, this, _1);
inputPort->cb += std::bind(&CSimpleJoinScreen::onChange, this, _1);
inputPort->filters += std::bind(&CTextInput::numberFilter, _1, _2, 0, 65535);
buttonOk = std::make_shared<CButton>(Point(26, 142), AnimationPath::builtin("MUBCHCK.DEF"), CGI->generaltexth->zelp[560], std::bind(&CSimpleJoinScreen::connectToServer, this), EShortcut::GLOBAL_ACCEPT);
inputAddress->giveFocus();
}
inputAddress->setText(host ? CServerHandler::localhostAddress : CSH->getHostAddress(), true);