From 9f851608e093bfb22de012542adab0b87ed68ea8 Mon Sep 17 00:00:00 2001 From: Alex Spataru Date: Tue, 16 Feb 2021 00:28:13 -0500 Subject: [PATCH] Remove spaces from DNS queries --- assets/qml/SetupPanes/Network.qml | 11 ++++++++++- assets/qml/Windows/Setup.qml | 3 ++- src/IO/DataSources/Network.cpp | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/assets/qml/SetupPanes/Network.qml b/assets/qml/SetupPanes/Network.qml index 9f4eec9a..922abc6e 100644 --- a/assets/qml/SetupPanes/Network.qml +++ b/assets/qml/SetupPanes/Network.qml @@ -134,6 +134,9 @@ Control { // Label { text: qsTr("DNS lookup") + ": " + opacity: enabled ? 1 : 0.5 + enabled: !Cpp_IO_Manager.connected + Behavior on opacity {NumberAnimation{}} } RowLayout { Layout.fillWidth: true spacing: app.spacing / 2 @@ -141,9 +144,13 @@ Control { TextField { id: _addrLookup Layout.fillWidth: true + opacity: enabled ? 1 : 0.5 Layout.alignment: Qt.AlignVCenter + enabled: !Cpp_IO_Manager.connected onAccepted: Cpp_IO_Network.findIp(text) placeholderText: qsTr("Enter address (e.g. google.com)") + + Behavior on opacity {NumberAnimation{}} } Button { @@ -152,8 +159,10 @@ Control { Layout.maximumWidth: height Layout.alignment: Qt.AlignVCenter icon.source: "qrc:/icons/search.svg" - enabled: _addrLookup.text.length > 0 onClicked: Cpp_IO_Network.findIp(_addrLookup.text) + enabled: _addrLookup.text.length > 0 && !Cpp_IO_Manager.connected + + Behavior on opacity {NumberAnimation{}} } } diff --git a/assets/qml/Windows/Setup.qml b/assets/qml/Windows/Setup.qml index c484bdcf..7ecf8af9 100644 --- a/assets/qml/Windows/Setup.qml +++ b/assets/qml/Windows/Setup.qml @@ -214,9 +214,10 @@ Control { clip: true Layout.fillWidth: true Layout.fillHeight: true + Layout.minimumHeight: 218 + Layout.maximumHeight: 218 currentIndex: tab.currentIndex Layout.topMargin: -parent.spacing - 1 - Layout.minimumHeight: serial.implicitHeight + 14 SetupPanes.Serial { id: serial diff --git a/src/IO/DataSources/Network.cpp b/src/IO/DataSources/Network.cpp index a66f1fed..5b22f099 100644 --- a/src/IO/DataSources/Network.cpp +++ b/src/IO/DataSources/Network.cpp @@ -101,7 +101,7 @@ int Network::socketTypeIndex() const bool Network::configurationOk() const { return true; - // return port() > 0 && !QHostAddress(host()).isNull(); + return port() > 0 && !QHostAddress(host()).isNull(); } /** @@ -210,7 +210,7 @@ void Network::setHost(const QString &host) */ void Network::findIp(const QString &host) { - QHostInfo::lookupHost(host, this, &Network::lookupFinished); + QHostInfo::lookupHost(host.simplified(), this, &Network::lookupFinished); } /**