aboutsummaryrefslogtreecommitdiff
path: root/src/widgets/server_editor_dialog.cpp
diff options
context:
space:
mode:
authorLeifa <26681464+TrickyLeifa@users.noreply.github.com>2024-07-09 13:07:30 +0200
committerGitHub <noreply@github.com>2024-07-09 13:07:30 +0200
commitefd2571459924f40718130f7edd28a72a76b12d7 (patch)
tree91751194abb0bfe1306976d676740b43a53dd81b /src/widgets/server_editor_dialog.cpp
parent662d4781d2653e02b9f3727a9299ded8c7b1eaa2 (diff)
Remove TCP entry point (#1007)
* Remove TCP entry point Resolve #987 * Remove TCP entry point * Servers that do not support WebSocket will be marked as `Legacy` * Removal of TCP connection from the master will follow later. * Tweaked error message
Diffstat (limited to 'src/widgets/server_editor_dialog.cpp')
-rw-r--r--src/widgets/server_editor_dialog.cpp49
1 files changed, 16 insertions, 33 deletions
diff --git a/src/widgets/server_editor_dialog.cpp b/src/widgets/server_editor_dialog.cpp
index 386950e3..150a4357 100644
--- a/src/widgets/server_editor_dialog.cpp
+++ b/src/widgets/server_editor_dialog.cpp
@@ -1,6 +1,7 @@
#include "server_editor_dialog.h"
#include "datatypes.h"
+#include "debug_functions.h"
#include "gui_utils.h"
#include "options.h"
@@ -30,7 +31,6 @@ ServerEditorDialog::ServerEditorDialog(QWidget *parent)
FROM_UI(QLineEdit, name);
FROM_UI(QLineEdit, hostname);
FROM_UI(QSpinBox, port);
- FROM_UI(QComboBox, protocol);
FROM_UI(QPlainTextEdit, description);
FROM_UI(QDialogButtonBox, button_box);
@@ -43,52 +43,35 @@ ServerEditorDialog::ServerEditorDialog(QWidget *parent)
connect(ui_button_box, &QDialogButtonBox::rejected, this, &ServerEditorDialog::reject);
}
+ServerEditorDialog::ServerEditorDialog(const ServerInfo &server, QWidget *parent)
+ : ServerEditorDialog(parent)
+{
+ ui_name->setText(server.name);
+ ui_hostname->setText(server.address);
+ ui_port->setValue(server.port);
+ ui_description->setPlainText(server.description);
+}
+
ServerInfo ServerEditorDialog::currentServerInfo() const
{
ServerInfo server;
server.name = ui_name->text();
- server.ip = ui_hostname->text();
+ server.address = ui_hostname->text();
server.port = ui_port->value();
server.description = ui_description->toPlainText();
- server.socket_type = ServerConnectionType(ui_protocol->currentIndex());
return server;
}
-void ServerEditorDialog::loadServerInfo(ServerInfo server)
-{
- ui_name->setText(server.name);
- ui_hostname->setText(server.ip);
- ui_port->setValue(server.port);
- ui_description->setPlainText(server.description);
- ui_protocol->setCurrentIndex(server.socket_type);
-}
-
void ServerEditorDialog::parseLegacyEntry()
{
QStringList entry = ui_legacy_edit->text().split(":");
- ServerInfo l_server_entry;
- if (entry.isEmpty())
+ if (entry.size() < 3)
{
- qDebug() << "Legacy entry empty.";
+ call_error("Invalid legacy server entry");
return;
}
- int item_count = entry.size();
- if (item_count >= 3)
- {
- ui_hostname->setText(entry.at(0));
- ui_port->setValue(entry.at(1).toInt());
- ui_name->setText(entry.at(2));
- if (item_count >= 4)
- {
- if (entry.at(3) == "ws")
- {
- ui_protocol->setCurrentIndex(1);
- }
- else
- {
- ui_protocol->setCurrentIndex(0);
- }
- }
- }
+ ui_hostname->setText(entry.at(0));
+ ui_port->setValue(entry.at(1).toInt());
+ ui_name->setText(entry.at(2));
}