1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2025-05-28 21:12:26 -04:00

KiwiSDR: analyze address on input to accept fully formed urls like http://host:port/ found on the web directory

This commit is contained in:
f4exb 2022-10-08 12:45:37 +02:00
parent 79b7e16c29
commit edab4f0b33
2 changed files with 12 additions and 2 deletions

View File

@ -150,7 +150,15 @@ void KiwiSDRGui::on_serverAddress_returnPressed()
void KiwiSDRGui::on_serverAddressApplyButton_clicked() void KiwiSDRGui::on_serverAddressApplyButton_clicked()
{ {
m_settings.m_serverAddress = ui->serverAddress->text(); QString serverAddress = ui->serverAddress->text();
QUrl url(serverAddress);
if (QStringList{"ws", "wss", "http", "https"}.contains(url.scheme())) {
m_settings.m_serverAddress = QString("%1:%2").arg(url.host()).arg(url.port());
} else {
m_settings.m_serverAddress = serverAddress;
}
sendSettings(); sendSettings();
} }

View File

@ -139,8 +139,10 @@ void KiwiSDRWorker::onGainChanged(quint32 gain, bool useAGC)
void KiwiSDRWorker::onServerAddressChanged(QString serverAddress) void KiwiSDRWorker::onServerAddressChanged(QString serverAddress)
{ {
if (m_serverAddress == serverAddress) if (m_serverAddress == serverAddress) {
return; return;
}
m_serverAddress = serverAddress; m_serverAddress = serverAddress;
m_status = 1; m_status = 1;