From a46d71930a238ced3f26d7ae17c0dffb7eb0dff1 Mon Sep 17 00:00:00 2001 From: James Turner Date: Tue, 7 Jun 2022 23:17:13 +0100 Subject: [PATCH] Launcher: add settings for TerraSync DNS Add advanced settings to speciofy the TerraSync DNS server. This shoud allow some work-around of problems with some ISP DNS. --- src/GUI/qml/Settings.qml | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/GUI/qml/Settings.qml b/src/GUI/qml/Settings.qml index 5fa42fdb2..3d6376831 100644 --- a/src/GUI/qml/Settings.qml +++ b/src/GUI/qml/Settings.qml @@ -348,6 +348,29 @@ Item { setIfDefault: true }, + SettingsComboBox { + id: terraSyncDnsMode + label: qsTr("TerraSync DNS Server") + description: qsTr("Select the DNS server used for TerraSync lookup.") + advanced: true + choices: [qsTr("Default"), qsTr("Google"), qsTr("Custom DNS Server") ] + defaultIndex: 0 + readonly property bool isGoogle: selectedIndex == 1 + readonly property bool isCustom: selectedIndex == 2 + keywords: ["terrasync", "dns", "network", "download", "scenery"] + setting: "terrasync-dns-mode" + }, + + SettingLineEdit { + id: terraSyncCustomDns + hidden: !terraSyncDnsMode.isCustom + label: qsTr("Custom DNS Server") + advanced: true + description: qsTr("Enter a custom DNS server IP address, for example '8.8.8.8'") + // validation: RegExpValidator { regExp: /[\d]{1,7}[\s]*x[\s]*[\d]{1,7}$/ } + suggestedWidthString: "255.255.255.255" + setting: "terrasync-dns-custom-server" + }, SettingPathChooser { id: downloadDir @@ -387,6 +410,13 @@ Item { // only permitted to occurr once, and we set it via other means; // on startup via runLauncherDialog, and if it changes, via // LauncherMainWindow::downloadDirChanged + + if (terraSyncDnsMode.isCustom) { + _config.setProperty("/sim/terrasync/dns-server", terraSyncCustomDns.value); + } else if (terraSyncDnsMode.isGoogle) { + // DNSClient.cxx handles this as a special value + _config.setProperty("/sim/terrasync/dns-server", "google"); + } } summary: terrasync.checked ? "scenery downloads;" : ""