mirror of
https://github.com/deskflow/deskflow.git
synced 2026-07-07 21:07:23 +08:00
Merge pull request #6988 from symless/SYNERGY-694-Issues-with-client-messages
SYNERGY-694 Issues with client messages
This commit is contained in:
commit
a5d0bb12b9
@ -19,7 +19,7 @@ Enhancements:
|
||||
- #6973 Update synergy UI. Main window
|
||||
- #6977 Update synergy UI. Configure server
|
||||
- #6978 Update synergy UI. Settings window
|
||||
- #6981 | #6987 Update synergy UI. Setup client configuration
|
||||
- #6981 | #6987 | #6988 Update synergy UI. Setup client configuration
|
||||
- #6984 Update synergy UI. Client error messages
|
||||
- #6962 | #6965 Add macOS 10.13 builder
|
||||
===========
|
||||
|
||||
@ -30,15 +30,20 @@ ClientConnection::ClientConnection(MainWindow& parent) :
|
||||
|
||||
void ClientConnection::update(const QString& line)
|
||||
{
|
||||
if (line.contains("failed to connect to server") &&
|
||||
checkMainWindow())
|
||||
if (m_checkConnection && checkMainWindow())
|
||||
{
|
||||
m_parent.stopSynergy();
|
||||
|
||||
QMessageBox message(&m_parent);
|
||||
message.addButton(QObject::tr("Close"), QMessageBox::RejectRole);
|
||||
message.setText(getMessage());
|
||||
message.exec();
|
||||
if (line.contains("failed to connect to server"))
|
||||
{
|
||||
m_checkConnection = false;
|
||||
if (!line.contains("server refused client with our name"))
|
||||
{
|
||||
showMessage();
|
||||
}
|
||||
}
|
||||
else if (line.contains("connected to server"))
|
||||
{
|
||||
m_checkConnection = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -69,3 +74,16 @@ QString ClientConnection::getMessage() const
|
||||
|
||||
return message;
|
||||
}
|
||||
|
||||
void ClientConnection::showMessage()
|
||||
{
|
||||
QMessageBox message(&m_parent);
|
||||
message.addButton(QObject::tr("Close"), QMessageBox::RejectRole);
|
||||
message.setText(getMessage());
|
||||
message.exec();
|
||||
}
|
||||
|
||||
void ClientConnection::setCheckConnection(bool checkConnection)
|
||||
{
|
||||
m_checkConnection = checkConnection;
|
||||
}
|
||||
|
||||
@ -26,14 +26,17 @@ class MainWindow;
|
||||
class ClientConnection
|
||||
{
|
||||
MainWindow& m_parent;
|
||||
bool m_checkConnection = false;
|
||||
|
||||
public:
|
||||
explicit ClientConnection(MainWindow& parent);
|
||||
void update(const QString& line);
|
||||
void setCheckConnection(bool checkConnection);
|
||||
|
||||
private:
|
||||
QString getMessage() const;
|
||||
bool checkMainWindow();
|
||||
void showMessage();
|
||||
};
|
||||
|
||||
#endif // CLIENTCONNECTION_H
|
||||
|
||||
@ -310,7 +310,7 @@ void MainWindow::initConnections()
|
||||
{
|
||||
connect(m_pActionMinimize, SIGNAL(triggered()), this, SLOT(hide()));
|
||||
connect(m_pActionRestore, SIGNAL(triggered()), this, SLOT(showNormal()));
|
||||
connect(m_pActionStartSynergy, SIGNAL(triggered()), this, SLOT(startSynergy()));
|
||||
connect(m_pActionStartSynergy, SIGNAL(triggered()), this, SLOT(actionStart()));
|
||||
connect(m_pActionStopSynergy, SIGNAL(triggered()), this, SLOT(stopSynergy()));
|
||||
connect(m_pActionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||
connect(&m_VersionChecker, SIGNAL(updateFound(const QString&)), this, SLOT(updateFound(const QString&)));
|
||||
@ -714,6 +714,12 @@ void MainWindow::startSynergy()
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::actionStart()
|
||||
{
|
||||
m_clientConnection.setCheckConnection(true);
|
||||
startSynergy();
|
||||
}
|
||||
|
||||
void MainWindow::retryStart()
|
||||
{
|
||||
//This function is only called after a failed start
|
||||
@ -1284,6 +1290,7 @@ void MainWindow::on_m_pActivate_triggered()
|
||||
|
||||
void MainWindow::on_m_pButtonApply_clicked()
|
||||
{
|
||||
m_clientConnection.setCheckConnection(true);
|
||||
restartSynergy();
|
||||
}
|
||||
|
||||
@ -1425,6 +1432,6 @@ void MainWindow::on_m_pRadioGroupClient_clicked(bool)
|
||||
|
||||
void MainWindow::on_m_pButtonConnect_clicked()
|
||||
{
|
||||
restartSynergy();
|
||||
on_m_pButtonApply_clicked();
|
||||
}
|
||||
|
||||
|
||||
@ -143,6 +143,7 @@ public slots:
|
||||
void appendLogError(const QString& text);
|
||||
void startSynergy();
|
||||
void retryStart(); // If the connection failed this will retry a startSynergy
|
||||
void actionStart();
|
||||
|
||||
protected slots:
|
||||
void updateLocalFingerprint();
|
||||
|
||||
@ -412,6 +412,23 @@ bool ServerConfig::isFull() const
|
||||
return isFull;
|
||||
}
|
||||
|
||||
bool ServerConfig::isScreenExists(const QString& screenName) const
|
||||
{
|
||||
bool isExists = false;
|
||||
|
||||
for (const auto& screen : screens())
|
||||
{
|
||||
if (!screen.isNull() &&
|
||||
screen.name() == screenName)
|
||||
{
|
||||
isExists = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return isExists;
|
||||
}
|
||||
|
||||
void ServerConfig::setConfigFile(const QString& configFile)
|
||||
{
|
||||
m_pAppConfig->setConfigFile(configFile);
|
||||
|
||||
@ -85,6 +85,7 @@ class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase
|
||||
const QString& getConfigFile() const;
|
||||
bool getUseExternalConfig() const;
|
||||
bool isFull() const;
|
||||
bool isScreenExists(const QString& screenName) const;
|
||||
|
||||
protected:
|
||||
QSettings& settings();
|
||||
|
||||
@ -59,10 +59,10 @@ bool ServerConnection::checkMainWindow()
|
||||
|
||||
void ServerConnection::addClient(const QString& clientName)
|
||||
{
|
||||
if (!m_parent.serverConfig().isFull() && checkMainWindow())
|
||||
if (!m_parent.serverConfig().isFull() &&
|
||||
!m_parent.serverConfig().isScreenExists(clientName) &&
|
||||
checkMainWindow())
|
||||
{
|
||||
m_parent.stopSynergy();
|
||||
|
||||
QMessageBox message(&m_parent);
|
||||
message.addButton(QObject::tr("Ignore"), QMessageBox::RejectRole);
|
||||
message.addButton(QObject::tr("Accept and configure"), QMessageBox::AcceptRole);
|
||||
@ -76,8 +76,6 @@ void ServerConnection::addClient(const QString& clientName)
|
||||
{
|
||||
m_ignoredClients.append(clientName);
|
||||
}
|
||||
|
||||
m_parent.startSynergy();
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,4 +86,6 @@ void ServerConnection::configureClient(const QString& clientName)
|
||||
|
||||
ServerConfigDialog dlg(&m_parent, config);
|
||||
dlg.exec();
|
||||
|
||||
m_parent.restartSynergy();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user