From 7c365c4dac15cd401182f49dd014464ed2c7d729 Mon Sep 17 00:00:00 2001 From: SerhiiGadzhilov <71632867+SerhiiGadzhilov@users.noreply.github.com> Date: Wed, 28 Apr 2021 10:06:56 +0300 Subject: [PATCH] SYNERGY-694 Setup client configuration issues (#6987) * SYNERGY-694 Fix compilation for old platforms * SYNERGY-694 Add server screen if it hasn't been added. * SYNERGY-694 Fix issue with repeat popups * Update ChangeLog --- ChangeLog | 2 +- src/gui/src/MainWindow.cpp | 5 ++--- src/gui/src/ServerConfigDialog.cpp | 12 +++++------- src/gui/src/ServerConnection.cpp | 6 ++++-- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6654157dc..09f29fd59 100644 --- a/ChangeLog +++ b/ChangeLog @@ -19,7 +19,7 @@ Enhancements: - #6973 Update synergy UI. Main window - #6977 Update synergy UI. Configure server - #6978 Update synergy UI. Settings window -- #6981 Update synergy UI. Setup client configuration +- #6981 | #6987 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/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 2e4494705..29568f159 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -461,8 +461,7 @@ void MainWindow::checkConnected(const QString& line) m_pLabelClientState->updateClientState(line); } - if (line.contains("connected to server") || - line.contains("accepted client connection")) + if (line.contains("connected to server") || line.contains("has connected")) { setSynergyState(synergyConnected); @@ -1062,7 +1061,7 @@ QString MainWindow::getIPAddresses() for (const auto& address : addresses) { if (address.protocol() == QAbstractSocket::IPv4Protocol && address != QHostAddress(QHostAddress::LocalHost) && - !address.isLinkLocal()) { + !address.isInSubnet(QHostAddress::parseSubnet("169.254.0.0/16"))) { // usually 192.168.x.x is a useful ip for the user, so indicate // this by making it bold. diff --git a/src/gui/src/ServerConfigDialog.cpp b/src/gui/src/ServerConfigDialog.cpp index bf004dfd4..266838b7b 100644 --- a/src/gui/src/ServerConfigDialog.cpp +++ b/src/gui/src/ServerConfigDialog.cpp @@ -70,18 +70,16 @@ ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) : m_pScreenSetupView->setModel(&m_ScreenSetupModel); - if (serverConfig().numScreens() == 0) { + auto& screens = serverConfig().screens(); + auto server = std::find_if(screens.begin(), screens.end(), [this](const Screen& screen){ return (screen.name() == serverConfig().getServerName());}); + + if (server == screens.end()) { Screen serverScreen(serverConfig().getServerName()); serverScreen.markAsServer(); model().screen(serverConfig().numColumns() / 2, serverConfig().numRows() / 2) = serverScreen; } else { - for (auto& screen : serverConfig().screens()) { - if (screen.name() == serverConfig().getServerName()) { - screen.markAsServer(); - break; - } - } + server->markAsServer(); } m_pButtonAddComputer->setEnabled(!model().isFull()); diff --git a/src/gui/src/ServerConnection.cpp b/src/gui/src/ServerConnection.cpp index fba9b62c4..30ad1d361 100644 --- a/src/gui/src/ServerConnection.cpp +++ b/src/gui/src/ServerConnection.cpp @@ -61,6 +61,8 @@ void ServerConnection::addClient(const QString& clientName) { if (!m_parent.serverConfig().isFull() && checkMainWindow()) { + m_parent.stopSynergy(); + QMessageBox message(&m_parent); message.addButton(QObject::tr("Ignore"), QMessageBox::RejectRole); message.addButton(QObject::tr("Accept and configure"), QMessageBox::AcceptRole); @@ -74,6 +76,8 @@ void ServerConnection::addClient(const QString& clientName) { m_ignoredClients.append(clientName); } + + m_parent.startSynergy(); } } @@ -84,6 +88,4 @@ void ServerConnection::configureClient(const QString& clientName) ServerConfigDialog dlg(&m_parent, config); dlg.exec(); - - m_parent.restartSynergy(); }