diff options
Diffstat (limited to 'src/widgets/direct_connect_dialog.cpp')
| -rw-r--r-- | src/widgets/direct_connect_dialog.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/widgets/direct_connect_dialog.cpp b/src/widgets/direct_connect_dialog.cpp index db4cde62..6a09b77b 100644 --- a/src/widgets/direct_connect_dialog.cpp +++ b/src/widgets/direct_connect_dialog.cpp @@ -50,27 +50,29 @@ void DirectConnectDialog::onConnectPressed() QString l_hostname = ui_direct_hostname_edit->text(); if (!SCHEME_PATTERN.match(l_hostname).hasMatch()) { - l_hostname = "tcp://" % l_hostname; + l_hostname = "ws://" % l_hostname; } + QUrl l_url(l_hostname); if (!l_url.isValid()) { call_error(tr("Invalid URL.")); return; } - if (!SERVER_CONNECTION_TYPE_STRING_MAP.contains(l_url.scheme())) + + if (l_url.scheme() != "ws") { - call_error(tr("Scheme not recognized. Must be either of the following: ") % QStringList::fromVector(SERVER_CONNECTION_TYPE_STRING_MAP.keys().toVector()).join(", ")); + call_error(tr("Invalid URL scheme. Only ws:// is supported.")); return; } + if (l_url.port() == -1) { call_error(tr("Invalid server port.")); return; } ServerInfo l_server; - l_server.socket_type = SERVER_CONNECTION_TYPE_STRING_MAP[l_url.scheme()]; - l_server.ip = l_url.host(); + l_server.address = l_url.host(); l_server.port = l_url.port(); l_server.name = "Direct Connection"; |
