SYNERGY-694 Issues with clients messages
This commit is contained in:
parent
7c365c4dac
commit
7fa08c51e3
4 changed files with 40 additions and 10 deletions
|
|
@ -30,15 +30,20 @@ ClientConnection::ClientConnection(MainWindow& parent) :
|
||||||
|
|
||||||
void ClientConnection::update(const QString& line)
|
void ClientConnection::update(const QString& line)
|
||||||
{
|
{
|
||||||
if (line.contains("failed to connect to server") &&
|
if (m_checkConnection && checkMainWindow())
|
||||||
checkMainWindow())
|
|
||||||
{
|
{
|
||||||
m_parent.stopSynergy();
|
if (line.contains("failed to connect to server"))
|
||||||
|
{
|
||||||
QMessageBox message(&m_parent);
|
m_checkConnection = false;
|
||||||
message.addButton(QObject::tr("Close"), QMessageBox::RejectRole);
|
if (!line.contains("server refused client with our name"))
|
||||||
message.setText(getMessage());
|
{
|
||||||
message.exec();
|
showMessage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (line.contains("connected to server"))
|
||||||
|
{
|
||||||
|
m_checkConnection = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -69,3 +74,16 @@ QString ClientConnection::getMessage() const
|
||||||
|
|
||||||
return message;
|
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
|
class ClientConnection
|
||||||
{
|
{
|
||||||
MainWindow& m_parent;
|
MainWindow& m_parent;
|
||||||
|
bool m_checkConnection = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ClientConnection(MainWindow& parent);
|
explicit ClientConnection(MainWindow& parent);
|
||||||
void update(const QString& line);
|
void update(const QString& line);
|
||||||
|
void setCheckConnection(bool checkConnection);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString getMessage() const;
|
QString getMessage() const;
|
||||||
bool checkMainWindow();
|
bool checkMainWindow();
|
||||||
|
void showMessage();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CLIENTCONNECTION_H
|
#endif // CLIENTCONNECTION_H
|
||||||
|
|
|
||||||
|
|
@ -310,7 +310,7 @@ void MainWindow::initConnections()
|
||||||
{
|
{
|
||||||
connect(m_pActionMinimize, SIGNAL(triggered()), this, SLOT(hide()));
|
connect(m_pActionMinimize, SIGNAL(triggered()), this, SLOT(hide()));
|
||||||
connect(m_pActionRestore, SIGNAL(triggered()), this, SLOT(showNormal()));
|
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_pActionStopSynergy, SIGNAL(triggered()), this, SLOT(stopSynergy()));
|
||||||
connect(m_pActionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
|
connect(m_pActionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||||
connect(&m_VersionChecker, SIGNAL(updateFound(const QString&)), this, SLOT(updateFound(const QString&)));
|
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()
|
void MainWindow::retryStart()
|
||||||
{
|
{
|
||||||
//This function is only called after a failed start
|
//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()
|
void MainWindow::on_m_pButtonApply_clicked()
|
||||||
{
|
{
|
||||||
|
m_clientConnection.setCheckConnection(true);
|
||||||
restartSynergy();
|
restartSynergy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1425,6 +1432,7 @@ void MainWindow::on_m_pRadioGroupClient_clicked(bool)
|
||||||
|
|
||||||
void MainWindow::on_m_pButtonConnect_clicked()
|
void MainWindow::on_m_pButtonConnect_clicked()
|
||||||
{
|
{
|
||||||
restartSynergy();
|
m_clientConnection.setCheckConnection(true);
|
||||||
|
restartSynergy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,7 @@ public slots:
|
||||||
void appendLogError(const QString& text);
|
void appendLogError(const QString& text);
|
||||||
void startSynergy();
|
void startSynergy();
|
||||||
void retryStart(); // If the connection failed this will retry a startSynergy
|
void retryStart(); // If the connection failed this will retry a startSynergy
|
||||||
|
void actionStart();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void updateLocalFingerprint();
|
void updateLocalFingerprint();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue