refactor: remove messages::showClientError, fix mainwindow calling showandactive for non error messages
This commit is contained in:
@ -1165,12 +1165,22 @@ void MainWindow::remoteHostChanged(const QString &newRemoteHost)
|
|||||||
|
|
||||||
void MainWindow::showClientError(deskflow::client::ErrorType error, const QString &address)
|
void MainWindow::showClientError(deskflow::client::ErrorType error, const QString &address)
|
||||||
{
|
{
|
||||||
if (!isVisible() || m_clientErrorVisible)
|
if (!isVisible() || m_clientErrorVisible || error != deskflow::client::ErrorType::AlreadyConnected)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_clientErrorVisible = true;
|
m_clientErrorVisible = true;
|
||||||
|
|
||||||
showAndActivate();
|
showAndActivate();
|
||||||
deskflow::gui::messages::showClientConnectError(this, error, address);
|
|
||||||
|
QMessageBox::warning(
|
||||||
|
this, tr("%1 Connection Error").arg(kAppName),
|
||||||
|
tr("<p>Failed to connect to the server '%1'.</p>"
|
||||||
|
"<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>")
|
||||||
|
.arg(address)
|
||||||
|
);
|
||||||
|
|
||||||
m_clientErrorVisible = false;
|
m_clientErrorVisible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -183,43 +183,6 @@ void showFirstConnectedMessage(QWidget *parent, bool closeToTray, bool enableSer
|
|||||||
QMessageBox::information(parent, title, message);
|
QMessageBox::information(parent, title, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void showClientConnectError(QWidget *parent, deskflow::client::ErrorType error, const QString &address)
|
|
||||||
{
|
|
||||||
using enum deskflow::client::ErrorType;
|
|
||||||
|
|
||||||
if (error == NoError || error == GenericError || error == HostnameError)
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto message = QObject::tr("<p>Failed to connect to the server '%1'.</p>").arg(address);
|
|
||||||
|
|
||||||
if (error == AlreadyConnected) {
|
|
||||||
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 {
|
|
||||||
qFatal("unknown client error");
|
|
||||||
}
|
|
||||||
|
|
||||||
auto title = QObject::tr("%1 Connection Error").arg(kAppName);
|
|
||||||
|
|
||||||
if (error != HostnameError) {
|
|
||||||
QMessageBox::warning(parent, title, message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto dialog = QMessageBox(parent);
|
|
||||||
dialog.setWindowTitle(title);
|
|
||||||
dialog.setText(message);
|
|
||||||
dialog.setWindowModality(Qt::ApplicationModal);
|
|
||||||
dialog.setIcon(QMessageBox::Information);
|
|
||||||
dialog.setDefaultButton(QMessageBox::Ok);
|
|
||||||
dialog.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth)
|
bool showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth)
|
||||||
{
|
{
|
||||||
if (serverRequiresPeerAuth) {
|
if (serverRequiresPeerAuth) {
|
||||||
|
|||||||
@ -25,8 +25,6 @@ void showFirstConnectedMessage(QWidget *parent, bool closeToTray, bool enableSer
|
|||||||
|
|
||||||
void showCloseReminder(QWidget *parent);
|
void showCloseReminder(QWidget *parent);
|
||||||
|
|
||||||
void showClientConnectError(QWidget *parent, deskflow::client::ErrorType error, const QString &address);
|
|
||||||
|
|
||||||
bool showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth = false);
|
bool showNewClientPrompt(QWidget *parent, const QString &clientName, bool serverRequiresPeerAuth = false);
|
||||||
|
|
||||||
bool showClearSettings(QWidget *parent);
|
bool showClearSettings(QWidget *parent);
|
||||||
|
|||||||
@ -386,6 +386,10 @@ Do you want to connect to the server?
|
|||||||
<extracomment>stop core shortcut</extracomment>
|
<extracomment>stop core shortcut</extracomment>
|
||||||
<translation type="unfinished">Ctrl+T</translation>
|
<translation type="unfinished">Ctrl+T</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source><p>Failed to connect to the server '%1'.</p><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></source>
|
||||||
|
<translation><p>Error al conectar con el servidor '%1'.</p><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></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Your current TLS key is smaller than the minimum allowed size, A new key 2048-bit key will be generated.</source>
|
<source>Your current TLS key is smaller than the minimum allowed size, A new key 2048-bit key will be generated.</source>
|
||||||
<translation type="unfinished">Su clave TLS actual es más pequeña que el tamaño mínimo permitido. Se generará una nueva clave de 2048 bits.</translation>
|
<translation type="unfinished">Su clave TLS actual es más pequeña que el tamaño mínimo permitido. Se generará una nueva clave de 2048 bits.</translation>
|
||||||
@ -430,6 +434,10 @@ Do you want to connect to the server?
|
|||||||
<source>Disconnect</source>
|
<source>Disconnect</source>
|
||||||
<translation type="unfinished">Desconectar</translation>
|
<translation type="unfinished">Desconectar</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>%1 Connection Error</source>
|
||||||
|
<translation>%1 Error de conexión</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>No IP Detected</source>
|
<source>No IP Detected</source>
|
||||||
<translation type="unfinished">No se detectó ninguna IP</translation>
|
<translation type="unfinished">No se detectó ninguna IP</translation>
|
||||||
@ -610,18 +618,6 @@ Nombres válidos:
|
|||||||
<source>%1 Connected</source>
|
<source>%1 Connected</source>
|
||||||
<translation type="unfinished">%1 Conectado</translation>
|
<translation type="unfinished">%1 Conectado</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source><p>Failed to connect to the server '%1'.</p></source>
|
|
||||||
<translation type="unfinished"><p>Error al conectar con el servidor '%1'.</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source><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></source>
|
|
||||||
<translation type="unfinished"><p>Ya hay un cliente conectado al servidor con su nombre.</p>Asegúrese de utilizar un nombre único y de que solo se esté ejecutando una única instancia del proceso del cliente.</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>%1 Connection Error</source>
|
|
||||||
<translation type="unfinished">%1 Error de conexión</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>%1 - New Client</source>
|
<source>%1 - New Client</source>
|
||||||
<translation type="unfinished">%1 - Nuevo cliente</translation>
|
<translation type="unfinished">%1 - Nuevo cliente</translation>
|
||||||
|
|||||||
@ -374,6 +374,10 @@ Vuoi connetterti al server?
|
|||||||
<extracomment>stop core shortcut</extracomment>
|
<extracomment>stop core shortcut</extracomment>
|
||||||
<translation>Ctrl+F</translation>
|
<translation>Ctrl+F</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source><p>Failed to connect to the server '%1'.</p><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></source>
|
||||||
|
<translation><p>Impossibile connettersi al server "%1".</p><p>Un client con il tuo nome è già connesso al server.</p>Assicurati di utilizzare un nome univoco e che sia in esecuzione una sola istanza del processo client.</p></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Your current TLS key is smaller than the minimum allowed size, A new key 2048-bit key will be generated.</source>
|
<source>Your current TLS key is smaller than the minimum allowed size, A new key 2048-bit key will be generated.</source>
|
||||||
<translation>La tua chiave TLS attuale è più piccola della dimensione minima consentita. Verrà generata una nuova chiave a 2048 bit.</translation>
|
<translation>La tua chiave TLS attuale è più piccola della dimensione minima consentita. Verrà generata una nuova chiave a 2048 bit.</translation>
|
||||||
@ -418,6 +422,10 @@ Vuoi connetterti al server?
|
|||||||
<source>Disconnect</source>
|
<source>Disconnect</source>
|
||||||
<translation>Disconnetti</translation>
|
<translation>Disconnetti</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>%1 Connection Error</source>
|
||||||
|
<translation>Errore di connessione %1</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>No IP Detected</source>
|
<source>No IP Detected</source>
|
||||||
<translation>Nessun IP rilevato</translation>
|
<translation>Nessun IP rilevato</translation>
|
||||||
@ -610,18 +618,6 @@ Nomi validi:
|
|||||||
<source>%1 Connected</source>
|
<source>%1 Connected</source>
|
||||||
<translation>%1 Connesso</translation>
|
<translation>%1 Connesso</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source><p>Failed to connect to the server '%1'.</p></source>
|
|
||||||
<translation><p>Impossibile connettersi al server "%1".</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source><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></source>
|
|
||||||
<translation><p>Un client con il tuo nome è già connesso al server.</p>Assicurati di utilizzare un nome univoco e che sia in esecuzione una sola istanza del processo client.</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>%1 Connection Error</source>
|
|
||||||
<translation>Errore di connessione %1</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>%1 - New Client</source>
|
<source>%1 - New Client</source>
|
||||||
<translation>%1 - Nuovo Client</translation>
|
<translation>%1 - Nuovo Client</translation>
|
||||||
|
|||||||
@ -390,6 +390,10 @@ Do you want to connect to the server?
|
|||||||
<source>Disconnect</source>
|
<source>Disconnect</source>
|
||||||
<translation>切断</translation>
|
<translation>切断</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source><p>Failed to connect to the server '%1'.</p><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></source>
|
||||||
|
<translation><p>サーバー '%1' への接続に失敗しました。</p><p>同じ名前のクライアントがサーバーに接続済です。</p><p>名前の重複がないことと、クライアントプロセスが多重起動していない事を確認してください。</p></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>No IP Detected</source>
|
<source>No IP Detected</source>
|
||||||
<translation>IPアドレスが見つかりません</translation>
|
<translation>IPアドレスが見つかりません</translation>
|
||||||
@ -511,6 +515,10 @@ Valid names:
|
|||||||
・_ と -
|
・_ と -
|
||||||
・1から255文字まで</translation>
|
・1から255文字まで</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>%1 Connection Error</source>
|
||||||
|
<translation>%1 接続エラー</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Suggested IP: </source>
|
<source>Suggested IP: </source>
|
||||||
<translation>推奨IPアドレス: </translation>
|
<translation>推奨IPアドレス: </translation>
|
||||||
@ -612,18 +620,6 @@ Valid names:
|
|||||||
<source>%1 Connected</source>
|
<source>%1 Connected</source>
|
||||||
<translation>%1 接続完了</translation>
|
<translation>%1 接続完了</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source><p>Failed to connect to the server '%1'.</p></source>
|
|
||||||
<translation><p>サーバー '%1' への接続に失敗しました。</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source><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></source>
|
|
||||||
<translation><p>同じ名前のクライアントがサーバーに接続済です。</p><p>名前の重複がないことと、クライアントプロセスが多重起動していない事を確認してください。</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>%1 Connection Error</source>
|
|
||||||
<translation>%1 接続エラー</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>%1 - New Client</source>
|
<source>%1 - New Client</source>
|
||||||
<translation>%1 - 新しいクライアント</translation>
|
<translation>%1 - 新しいクライアント</translation>
|
||||||
|
|||||||
@ -390,6 +390,10 @@ Do you want to connect to the server?
|
|||||||
<source>Disconnect</source>
|
<source>Disconnect</source>
|
||||||
<translation>연결 해제</translation>
|
<translation>연결 해제</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source><p>Failed to connect to the server '%1'.</p><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></source>
|
||||||
|
<translation><p>서버 '%1'에 연결하지 못했습니다.</p><p>같은 이름의 클라이언트가 이미 서버에 연결되어 있습니다.</p><p>고유한 이름을 사용하고, 클라이언트 프로세스가 하나만 실행 중인지 확인하세요.</p></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>No IP Detected</source>
|
<source>No IP Detected</source>
|
||||||
<translation>IP를 감지하지 못했습니다</translation>
|
<translation>IP를 감지하지 못했습니다</translation>
|
||||||
@ -511,6 +515,10 @@ Valid names:
|
|||||||
• _ 또는 - 사용 가능
|
• _ 또는 - 사용 가능
|
||||||
• 1~255자</translation>
|
• 1~255자</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>%1 Connection Error</source>
|
||||||
|
<translation>%1 연결 오류</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Suggested IP: </source>
|
<source>Suggested IP: </source>
|
||||||
<translation type="unfinished">추천 IP: </translation>
|
<translation type="unfinished">추천 IP: </translation>
|
||||||
@ -610,18 +618,6 @@ Valid names:
|
|||||||
<source>%1 Connected</source>
|
<source>%1 Connected</source>
|
||||||
<translation>%1 연결됨</translation>
|
<translation>%1 연결됨</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source><p>Failed to connect to the server '%1'.</p></source>
|
|
||||||
<translation><p>서버 '%1'에 연결하지 못했습니다.</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source><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></source>
|
|
||||||
<translation><p>같은 이름의 클라이언트가 이미 서버에 연결되어 있습니다.</p><p>고유한 이름을 사용하고, 클라이언트 프로세스가 하나만 실행 중인지 확인하세요.</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>%1 Connection Error</source>
|
|
||||||
<translation>%1 연결 오류</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>%1 - New Client</source>
|
<source>%1 - New Client</source>
|
||||||
<translation>%1 - 새 클라이언트</translation>
|
<translation>%1 - 새 클라이언트</translation>
|
||||||
|
|||||||
@ -390,6 +390,10 @@ Do you want to connect to the server?
|
|||||||
<source>Disconnect</source>
|
<source>Disconnect</source>
|
||||||
<translation>Отключиться</translation>
|
<translation>Отключиться</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source><p>Failed to connect to the server '%1'.</p><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></source>
|
||||||
|
<translation><p>Не удалось подключиться к серверу '%1'.</p><p>Клиент с таким именем уже подключен к серверу.</p>Убедитесь, что вы используете уникальное имя и запущен только один процесс клиента.</p></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>No IP Detected</source>
|
<source>No IP Detected</source>
|
||||||
<translation>IP-адрес не обнаружен</translation>
|
<translation>IP-адрес не обнаружен</translation>
|
||||||
@ -511,6 +515,10 @@ Valid names:
|
|||||||
• Можно использовать _ или -
|
• Можно использовать _ или -
|
||||||
• Длина от 1 до 255 символов</translation>
|
• Длина от 1 до 255 символов</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>%1 Connection Error</source>
|
||||||
|
<translation>Ошибка соединения %1</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Suggested IP: </source>
|
<source>Suggested IP: </source>
|
||||||
<translation>Рекомендуемый IP-адрес: </translation>
|
<translation>Рекомендуемый IP-адрес: </translation>
|
||||||
@ -610,18 +618,6 @@ Valid names:
|
|||||||
<source>%1 Connected</source>
|
<source>%1 Connected</source>
|
||||||
<translation>%1 подключено</translation>
|
<translation>%1 подключено</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source><p>Failed to connect to the server '%1'.</p></source>
|
|
||||||
<translation><p>Не удалось подключиться к серверу '%1'.</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source><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></source>
|
|
||||||
<translation><p>Клиент с таким именем уже подключен к серверу.</p>Убедитесь, что вы используете уникальное имя и запущен только один процесс клиента.</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>%1 Connection Error</source>
|
|
||||||
<translation>Ошибка соединения %1</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>%1 - New Client</source>
|
<source>%1 - New Client</source>
|
||||||
<translation>%1 - Новый клиент</translation>
|
<translation>%1 - Новый клиент</translation>
|
||||||
|
|||||||
@ -390,6 +390,10 @@ Do you want to connect to the server?
|
|||||||
<source>Disconnect</source>
|
<source>Disconnect</source>
|
||||||
<translation>断开</translation>
|
<translation>断开</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source><p>Failed to connect to the server '%1'.</p><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></source>
|
||||||
|
<translation><p>连接到服务器“%1”失败。</p><p>一个同名的客户端已连接到服务器。</p>请确保您使用的名称唯一,且只有一个客户端进程实例在运行。</p></translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>No IP Detected</source>
|
<source>No IP Detected</source>
|
||||||
<translation>未检测到 IP</translation>
|
<translation>未检测到 IP</translation>
|
||||||
@ -511,6 +515,10 @@ Valid names:
|
|||||||
• 可以使用 _ 或 -
|
• 可以使用 _ 或 -
|
||||||
• 长度在 1 到 255 个字符之间</translation>
|
• 长度在 1 到 255 个字符之间</translation>
|
||||||
</message>
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>%1 Connection Error</source>
|
||||||
|
<translation>%1 连接错误</translation>
|
||||||
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<source>Suggested IP: </source>
|
<source>Suggested IP: </source>
|
||||||
<translation type="unfinished">建议 IP: </translation>
|
<translation type="unfinished">建议 IP: </translation>
|
||||||
@ -612,18 +620,6 @@ Valid names:
|
|||||||
<source>%1 Connected</source>
|
<source>%1 Connected</source>
|
||||||
<translation>%1 已连接</translation>
|
<translation>%1 已连接</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
|
||||||
<source><p>Failed to connect to the server '%1'.</p></source>
|
|
||||||
<translation><p>连接到服务器“%1”失败。</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source><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></source>
|
|
||||||
<translation type="unfinished"><p>一个同名的客户端已连接到服务器。</p>请确保您使用的名称唯一,且只有一个客户端进程实例在运行。</p></translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
|
||||||
<source>%1 Connection Error</source>
|
|
||||||
<translation>%1 连接错误</translation>
|
|
||||||
</message>
|
|
||||||
<message>
|
<message>
|
||||||
<source>%1 - New Client</source>
|
<source>%1 - New Client</source>
|
||||||
<translation>%1 - 新客户端</translation>
|
<translation>%1 - 新客户端</translation>
|
||||||
|
|||||||
Reference in New Issue
Block a user