fix: set new options before reading old ones

This commit is contained in:
sithlord48 2026-06-19 17:51:29 -04:00 committed by Nick Bolton
parent 9b44f58e21
commit 95ffe1ba03

View file

@ -614,6 +614,25 @@ void Config::readSection(ConfigReadContext &s)
void Config::readSectionOptions(ConfigReadContext &s) void Config::readSectionOptions(ConfigReadContext &s)
{ {
if (Settings::value(Settings::Server::EnableHeatbeat).toBool()) {
addOption("", kOptionHeartbeat, Settings::value(Settings::Server::Heartbeat).toInt());
}
if (Settings::value(Settings::Server::EnableSwitchDelay).toBool()) {
addOption("", kOptionScreenSwitchDelay, Settings::value(Settings::Server::SwitchDelay).toInt());
}
if (Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool()) {
addOption("", kOptionScreenSwitchTwoTap, Settings::value(Settings::Server::SwitchDoubleTap).toInt());
}
addOption("", kOptionDefaultLockToScreenState, Settings::value(Settings::Server::DefaultLockToComputerState).toInt());
addOption("", kOptionDisableLockToScreen, Settings::value(Settings::Server::DisableLockToComputer).toInt());
addOption("", kOptionRelativeMouseMoves, Settings::value(Settings::Server::RelativeMouseMoves).toInt());
addOption("", kOptionWin32KeepForeground, Settings::value(Settings::Server::Win32KeepForeground).toInt());
addOption("", kOptionClipboardSharing, Settings::value(Settings::Server::EnableClipboard).toBool());
addOption("", kOptionClipboardSharingSize, Settings::value(Settings::Server::ClipboardSize).toUInt() * 1024);
std::string line; std::string line;
while (s.readLine(line)) { while (s.readLine(line)) {
// check for end of section // check for end of section
@ -704,25 +723,6 @@ void Config::readSectionOptions(ConfigReadContext &s)
} }
} }
if (Settings::value(Settings::Server::EnableHeatbeat).toBool()) {
addOption("", kOptionHeartbeat, Settings::value(Settings::Server::Heartbeat).toInt());
}
if (Settings::value(Settings::Server::EnableSwitchDelay).toBool()) {
addOption("", kOptionScreenSwitchDelay, Settings::value(Settings::Server::SwitchDelay).toInt());
}
if (Settings::value(Settings::Server::EnableSwitchDoubleTap).toBool()) {
addOption("", kOptionScreenSwitchTwoTap, Settings::value(Settings::Server::SwitchDoubleTap).toInt());
}
addOption("", kOptionDefaultLockToScreenState, Settings::value(Settings::Server::DefaultLockToComputerState).toInt());
addOption("", kOptionDisableLockToScreen, Settings::value(Settings::Server::DisableLockToComputer).toInt());
addOption("", kOptionRelativeMouseMoves, Settings::value(Settings::Server::RelativeMouseMoves).toInt());
addOption("", kOptionWin32KeepForeground, Settings::value(Settings::Server::Win32KeepForeground).toInt());
addOption("", kOptionClipboardSharing, Settings::value(Settings::Server::EnableClipboard).toBool());
addOption("", kOptionClipboardSharingSize, Settings::value(Settings::Server::ClipboardSize).toUInt() * 1024);
throw ServerConfigReadException(s, "unexpected end of options section"); throw ServerConfigReadException(s, "unexpected end of options section");
} }