diff --git a/ChangeLog b/ChangeLog index 67cfd0cdd..33c8ac1aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -23,7 +23,7 @@ Enhancements: - #6973 Update synergy UI. Main window - #6977 Update synergy UI. Configure server - #6978 Update synergy UI. Settings window -- #6981 | #6987 | #6988 Update synergy UI. Setup client configuration +- #6981 | #6987 | #6988 | #6996 Update synergy UI. Setup client configuration - #6984 Update synergy UI. Client error messages - #6962 | #6965 Add macOS 10.13 builder - #6990 Change VersionChecker URL and include system language in the header diff --git a/src/gui/src/ClientConnection.cpp b/src/gui/src/ClientConnection.cpp index e7e487760..530520645 100644 --- a/src/gui/src/ClientConnection.cpp +++ b/src/gui/src/ClientConnection.cpp @@ -37,7 +37,7 @@ void ClientConnection::update(const QString& line) m_checkConnection = false; if (!line.contains("server refused client with our name")) { - showMessage(); + showMessage(getMessage(line)); } } else if (line.contains("connected to server")) @@ -61,26 +61,33 @@ bool ClientConnection::checkMainWindow() return result; } -QString ClientConnection::getMessage() const +QString ClientConnection::getMessage(const QString& line) const { QString message(QObject::tr("We can’t connect to the server IP address.\nCheck your IP on your server and your firewall settings.")); - QHostAddress address(m_parent.appConfig().getServerHostname()); - if (address.isNull()) + if (line.contains("server already has a connected client with our name")) { - message = QObject::tr("We can’t connect to the server \"%1\" try to connect using the server IP address and check your firewall settings.") - .arg(m_parent.appConfig().getServerHostname()); + message = QObject::tr("Connection failed.\nYou can’t name 2 computers the same"); + } + else + { + QHostAddress address(m_parent.appConfig().getServerHostname()); + if (address.isNull()) + { + message = QObject::tr("We can’t connect to the server \"%1\" try to connect using the server IP address and check your firewall settings.") + .arg(m_parent.appConfig().getServerHostname()); + } } return message; } -void ClientConnection::showMessage() +void ClientConnection::showMessage(const QString& message) const { - QMessageBox message(&m_parent); - message.addButton(QObject::tr("Close"), QMessageBox::RejectRole); - message.setText(getMessage()); - message.exec(); + QMessageBox dialog(&m_parent); + dialog.addButton(QObject::tr("Close"), QMessageBox::RejectRole); + dialog.setText(message); + dialog.exec(); } void ClientConnection::setCheckConnection(bool checkConnection) diff --git a/src/gui/src/ClientConnection.h b/src/gui/src/ClientConnection.h index 1a2ec6252..abe5ba3a1 100644 --- a/src/gui/src/ClientConnection.h +++ b/src/gui/src/ClientConnection.h @@ -34,9 +34,9 @@ public: void setCheckConnection(bool checkConnection); private: - QString getMessage() const; + QString getMessage(const QString& line) const; bool checkMainWindow(); - void showMessage(); + void showMessage(const QString& message) const; }; #endif // CLIENTCONNECTION_H diff --git a/src/lib/client/Client.cpp b/src/lib/client/Client.cpp index 0f287125f..f4385ae04 100644 --- a/src/lib/client/Client.cpp +++ b/src/lib/client/Client.cpp @@ -534,7 +534,7 @@ Client::setupTimer() { assert(m_timer == NULL); - m_timer = m_events->newOneShotTimer(15.0, NULL); + m_timer = m_events->newOneShotTimer(2.0, NULL); m_events->adoptHandler(Event::kTimer, m_timer, new TMethodEventJob(this, &Client::handleConnectTimeout));