1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Merge pull request #3230 from dydzio0614/connection-button-fix

Display disabled connect button on server autojoin
This commit is contained in:
Ivan Savenko 2023-11-28 12:37:18 +02:00 committed by GitHub
commit 42ad860850
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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);