fix: MainWindow::setHostName only check if the screen is existing when in server mode, In severmode update the serverConfig serverName to prevent a case where the server screen is on the grid with the old name breaking the layout

This commit is contained in:
sithlord48 2025-08-07 19:25:41 -04:00 committed by Nick Bolton
parent a4c0e30bb8
commit 906c07e4fd

View file

@ -1106,7 +1106,14 @@ void MainWindow::setHostName()
QString text = ui->lineEditName->text();
const auto screenName = Settings::value(Settings::Core::ScreenName).toString();
bool existingScreen = serverConfig().screenExists(text) && (text != screenName);
if (text == screenName)
return;
const bool isServer = ui->rbModeServer->isChecked();
bool existingScreen = false;
if (isServer)
existingScreen = serverConfig().screenExists(text);
if (!ui->lineEditName->hasAcceptableInput() || text.isEmpty() || existingScreen) {
blockSignals(true);
@ -1131,6 +1138,8 @@ void MainWindow::setHostName()
ui->lblComputerName->setText(ui->lineEditName->text());
Settings::setValue(Settings::Core::ScreenName, ui->lineEditName->text());
if (isServer)
serverConfig().updateServerName();
applyConfig();
}