diff --git a/ChangeLog b/ChangeLog
index 7bd5edc964..5ce6afcf72 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,7 @@ Enhancements:
- #6977 Update synergy UI. Configure server
- #6978 Update synergy UI. Settings window
- #6981 Update synergy UI. Setup client configuration
+- #6984 Update synergy UI. Client error messages
- #6962 | #6965 Add macOS 10.13 builder
===========
diff --git a/src/gui/src/ClientConnection.cpp b/src/gui/src/ClientConnection.cpp
new file mode 100644
index 0000000000..71207a5c44
--- /dev/null
+++ b/src/gui/src/ClientConnection.cpp
@@ -0,0 +1,71 @@
+/*
+ * synergy -- mouse and keyboard sharing utility
+ * Copyright (C) 2012-2021 Symless Ltd.
+ * Copyright (C) 2008 Volker Lanz (vl@fidra.de)
+ *
+ * This package is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * found in the file LICENSE that should have accompanied this file.
+ *
+ * This package is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#include "ClientConnection.h"
+
+#include "MainWindow.h"
+
+#include
+#include
+
+ClientConnection::ClientConnection(MainWindow& parent) :
+ m_parent(parent)
+{
+}
+
+void ClientConnection::update(const QString& line)
+{
+ if (line.contains("failed to connect to server") &&
+ checkMainWindow())
+ {
+ m_parent.stopSynergy();
+
+ QMessageBox message(&m_parent);
+ message.addButton(QObject::tr("Close"), QMessageBox::RejectRole);
+ message.setText(getMessage());
+ message.exec();
+ }
+}
+
+bool ClientConnection::checkMainWindow()
+{
+ bool result = m_parent.isActiveWindow();
+
+ if (m_parent.isMinimized() || m_parent.isHidden())
+ {
+ m_parent.showNormal();
+ m_parent.activateWindow();
+ result = true;
+ }
+
+ return result;
+}
+
+QString ClientConnection::getMessage() 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())
+ {
+ 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;
+}
diff --git a/src/gui/src/ClientConnection.h b/src/gui/src/ClientConnection.h
new file mode 100644
index 0000000000..0d52e95a7d
--- /dev/null
+++ b/src/gui/src/ClientConnection.h
@@ -0,0 +1,39 @@
+/*
+ * synergy -- mouse and keyboard sharing utility
+ * Copyright (C) 2012-2021 Symless Ltd.
+ * Copyright (C) 2008 Volker Lanz (vl@fidra.de)
+ *
+ * This package is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * found in the file LICENSE that should have accompanied this file.
+ *
+ * This package is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+
+#ifndef CLIENTCONNECTION_H
+#define CLIENTCONNECTION_H
+
+#include
+
+class MainWindow;
+
+class ClientConnection
+{
+ MainWindow& m_parent;
+
+public:
+ explicit ClientConnection(MainWindow& parent);
+ void update(const QString& line);
+
+private:
+ QString getMessage() const;
+ bool checkMainWindow();
+};
+
+#endif // CLIENTCONNECTION_H
diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp
index 423ae21141..f02ca2462a 100644
--- a/src/gui/src/MainWindow.cpp
+++ b/src/gui/src/MainWindow.cpp
@@ -113,7 +113,8 @@ MainWindow::MainWindow (AppConfig& appConfig,
m_pCancelButton(NULL),
m_ExpectedRunningState(kStopped),
m_SecureSocket(false),
- m_serverConnection(*this)
+ m_serverConnection(*this),
+ m_clientConnection(*this)
{
#if !defined(SYNERGY_ENTERPRISE) && defined(SYNERGY_AUTOCONFIG)
m_pZeroconf = new Zeroconf(this);
@@ -456,6 +457,7 @@ void MainWindow::checkConnected(const QString& line)
}
else
{
+ m_clientConnection.update(line);
m_pLabelClientState->updateClientState(line);
}
diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h
index 18e11416f2..d3a444eec8 100644
--- a/src/gui/src/MainWindow.h
+++ b/src/gui/src/MainWindow.h
@@ -29,6 +29,7 @@
#include "ServerConfig.h"
#include "ServerConnection.h"
+#include "ClientConnection.h"
#include "AppConfig.h"
#include "VersionChecker.h"
#include "IpcClient.h"
@@ -69,6 +70,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
friend class ActivationDialog;
friend class SettingsDialog;
friend class ServerConnection;
+ friend class ClientConnection;
public:
enum qSynergyState
@@ -241,6 +243,7 @@ public slots:
bool m_SecureSocket; // brief Is the program running a secure socket protocol (SSL/TLS)
QString m_SecureSocketVersion; // brief Contains the version of the Secure Socket currently active
ServerConnection m_serverConnection;
+ ClientConnection m_clientConnection;
void updateAutoConfigWidgets();
diff --git a/src/gui/src/ServerConnection.cpp b/src/gui/src/ServerConnection.cpp
index 03a2a9d0bb..fba9b62c44 100644
--- a/src/gui/src/ServerConnection.cpp
+++ b/src/gui/src/ServerConnection.cpp
@@ -45,13 +45,16 @@ void ServerConnection::update(const QString& line)
bool ServerConnection::checkMainWindow()
{
+ bool result = m_parent.isActiveWindow();
+
if (m_parent.isMinimized() || m_parent.isHidden())
{
m_parent.showNormal();
m_parent.activateWindow();
+ result = true;
}
- return m_parent.isActiveWindow();
+ return result;
}
void ServerConnection::addClient(const QString& clientName)