From b8835a8a5a36e1b8574c1d5b18a68a872f4d529d Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Fri, 6 Jun 2025 22:44:30 -0400 Subject: [PATCH] refactor: Messages::showClientConnectError slight reword for Already Connected error use QString::append to add to the message create a QMessageBox::warning style box for these errors enable translations --- src/lib/gui/Messages.cpp | 37 ++++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/src/lib/gui/Messages.cpp b/src/lib/gui/Messages.cpp index ab4cc380e..c9dfb4912 100644 --- a/src/lib/gui/Messages.cpp +++ b/src/lib/gui/Messages.cpp @@ -185,31 +185,34 @@ void showClientConnectError(QWidget *parent, ClientError error, const QString &a { using enum ClientError; - auto message = QString("

The connection to server '%1' didn't work.

").arg(address); + auto message = QObject::tr("

Failed to connect to the server '%1'.

").arg(address); if (error == AlreadyConnected) { - message += // - "

Two of your client computers have the same name or there are " - "two instances of the client process running.

" - "

Please ensure that you're using a unique name and that only a " - "single client process is running.

"; + message.append( + QObject::tr( // + "

A Client with your name is already connected to the server.

" + "Please ensure that you're using a unique name and that only a " + "single instance of the client process is running.

" + ) + ); } else if (error == HostnameError) { - message += // - "

Please try to connect to the server using the server IP address " - "instead of the hostname.

" - "

If that doesn't work, please check your TLS and " - "firewall settings.

"; + message.append( + QObject::tr( // + "

Please try to connect to the server using the server IP address " + "instead of the hostname.

" + "

If that doesn't work, please check your TLS and " + "firewall settings.

" + ) + ); } else if (error == GenericError) { - message += // - "

Please check your TLS and firewall settings.

"; + message.append(QObject::tr("

Please check your TLS and firewall settings.

")); } else { qFatal("unknown client error"); } - QMessageBox dialog(parent); - dialog.addButton(QObject::tr("Close"), QMessageBox::RejectRole); - dialog.setText(message); - dialog.exec(); + auto title = QObject::tr("%1 Connection Error").arg(kAppName); + + QMessageBox::warning(parent, title, message); } NewClientPromptResult showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth)