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
This commit is contained in:
@ -185,31 +185,34 @@ void showClientConnectError(QWidget *parent, ClientError error, const QString &a
|
||||
{
|
||||
using enum ClientError;
|
||||
|
||||
auto message = QString("<p>The connection to server '%1' didn't work.</p>").arg(address);
|
||||
auto message = QObject::tr("<p>Failed to connect to the server '%1'.</p>").arg(address);
|
||||
|
||||
if (error == AlreadyConnected) {
|
||||
message += //
|
||||
"<p>Two of your client computers have the same name or there are "
|
||||
"two instances of the client process running.</p>"
|
||||
"<p>Please ensure that you're using a unique name and that only a "
|
||||
"single client process is running.</p>";
|
||||
message.append(
|
||||
QObject::tr( //
|
||||
"<p>A Client with your name is already connected to the server.</p>"
|
||||
"Please ensure that you're using a unique name and that only a "
|
||||
"single instance of the client process is running.</p>"
|
||||
)
|
||||
);
|
||||
} else if (error == HostnameError) {
|
||||
message += //
|
||||
"<p>Please try to connect to the server using the server IP address "
|
||||
"instead of the hostname. </p>"
|
||||
"<p>If that doesn't work, please check your TLS and "
|
||||
"firewall settings.</p>";
|
||||
message.append(
|
||||
QObject::tr( //
|
||||
"<p>Please try to connect to the server using the server IP address "
|
||||
"instead of the hostname. </p>"
|
||||
"<p>If that doesn't work, please check your TLS and "
|
||||
"firewall settings.</p>"
|
||||
)
|
||||
);
|
||||
} else if (error == GenericError) {
|
||||
message += //
|
||||
"<p>Please check your TLS and firewall settings.</p>";
|
||||
message.append(QObject::tr("<p>Please check your TLS and firewall settings.</p>"));
|
||||
} 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)
|
||||
|
||||
Reference in New Issue
Block a user