mirror of
https://github.com/deskflow/deskflow.git
synced 2026-07-07 21:07:23 +08:00
Merge pull request #6984 from symless/SYNERGY-799-Connect-dialogs
SYNERGY-799 Client connection errors
This commit is contained in:
commit
850fd20ff1
@ -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
|
||||
===========
|
||||
|
||||
|
||||
71
src/gui/src/ClientConnection.cpp
Normal file
71
src/gui/src/ClientConnection.cpp
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ClientConnection.h"
|
||||
|
||||
#include "MainWindow.h"
|
||||
|
||||
#include <QMessageBox>
|
||||
#include <QHostAddress>
|
||||
|
||||
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;
|
||||
}
|
||||
39
src/gui/src/ClientConnection.h
Normal file
39
src/gui/src/ClientConnection.h
Normal file
@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef CLIENTCONNECTION_H
|
||||
#define CLIENTCONNECTION_H
|
||||
|
||||
#include <QString>
|
||||
|
||||
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
|
||||
@ -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);
|
||||
}
|
||||
|
||||
|
||||
@ -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();
|
||||
|
||||
|
||||
@ -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)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user