From fc00ddb4c4fa62f3fc75bb582e97a79cf6912815 Mon Sep 17 00:00:00 2001 From: Andrey Batyiev Date: Mon, 6 Sep 2021 11:25:55 +0300 Subject: [PATCH] Synergy 1161 when clicking on save preferences on configure server window, automatically apply all the new settings (#7081) * SYNERGY-1161 When clicking on "Save" preferences on "Configure server" window, automatically apply all the new settings *Added comparison for all classes which used in server config * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Added server config changes checking logic * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings * Update ChangeLog * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Fix code style * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings * Fix Linux build * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Fix Sonar code smells * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Fix Ubuntu, CentOS and Debian build * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Fix merge conflicts * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Update ChangeLog * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Fix server config OK button behaviour on autoconfig * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Update changelog * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Fix sonar codesmell * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Fix build * SYNERGY-1161 When clicking on Save preferences on Configure server window, automatically apply all the new settings *Adding client on autoconfig silently Co-authored-by: Andrii Batyiev --- ChangeLog | 1 + src/gui/src/ServerConfigDialog.cpp | 32 +++++++++++++++++++++--------- src/gui/src/ServerConfigDialog.h | 2 ++ src/gui/src/ServerConnection.cpp | 10 ++++------ 4 files changed, 30 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index 74378dba6..2ddd9a837 100644 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,7 @@ Bug fixes: - #7078 Fix clipboard re-enables automatically - #7077 Fix Ubuntu, CentOS and Debian build after SYNERGY-1161 - #7080 Add trace if the system can't open file with trusted fingerprints +- #7081 Fix autoconfig after SYNERGY-1161 - #7082 Windows client doesn't resume connection after sleep Enhancements: diff --git a/src/gui/src/ServerConfigDialog.cpp b/src/gui/src/ServerConfigDialog.cpp index 4c73d6e67..d05bd6d18 100644 --- a/src/gui/src/ServerConfigDialog.cpp +++ b/src/gui/src/ServerConfigDialog.cpp @@ -135,6 +135,11 @@ ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) : this, [this]() { serverConfig().setConfigFile(m_pEditConfigFile->text()); onChange();}); } +bool ServerConfigDialog::addClient(const QString& clientName) +{ + return addComputer(clientName, true); +} + void ServerConfigDialog::showEvent(QShowEvent* event) { QDialog::show(); @@ -304,15 +309,7 @@ void ServerConfigDialog::on_m_pListActions_itemSelectionChanged() void ServerConfigDialog::on_m_pButtonAddComputer_clicked() { - Screen newScreen(""); - - ScreenSettingsDialog dlg(this, &newScreen, &model().m_Screens); - if (dlg.exec() == QDialog::Accepted) - { - model().addScreen(newScreen); - } - - m_pButtonAddComputer->setEnabled(!model().isFull()); + addComputer("", false); } void ServerConfigDialog::onScreenRemoved() @@ -351,6 +348,23 @@ bool ServerConfigDialog::on_m_pButtonBrowseConfigFile_clicked() return false; } +bool ServerConfigDialog::addComputer(const QString& clientName, bool doSilent) +{ + bool isAccepted = false; + Screen newScreen(clientName); + + + ScreenSettingsDialog dlg(this, &newScreen, &model().m_Screens); + if (doSilent || dlg.exec() == QDialog::Accepted) + { + model().addScreen(newScreen); + isAccepted = true; + } + + m_pButtonAddComputer->setEnabled(!model().isFull()); + return isAccepted; +} + void ServerConfigDialog::onChange() { bool isAppConfigDataEqual = m_OrigServerAppConfigUseExternalConfig == serverConfig().getUseExternalConfig() && diff --git a/src/gui/src/ServerConfigDialog.h b/src/gui/src/ServerConfigDialog.h index e57c6c166..0d880e815 100644 --- a/src/gui/src/ServerConfigDialog.h +++ b/src/gui/src/ServerConfigDialog.h @@ -33,6 +33,7 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase public: ServerConfigDialog(QWidget* parent, ServerConfig& config); + bool addClient(const QString& clientName); public slots: void accept(); @@ -57,6 +58,7 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase bool on_m_pButtonBrowseConfigFile_clicked(); protected: + bool addComputer(const QString& clientName, bool doSilent); ServerConfig& serverConfig() { return m_ServerConfig; } void setOrigServerConfig(const ServerConfig& s) { m_OrigServerConfig = s; } ScreenSetupModel& model() { return m_ScreenSetupModel; } diff --git a/src/gui/src/ServerConnection.cpp b/src/gui/src/ServerConnection.cpp index e82596102..769a6d55b 100644 --- a/src/gui/src/ServerConnection.cpp +++ b/src/gui/src/ServerConnection.cpp @@ -81,11 +81,9 @@ void ServerConnection::addClient(const QString& clientName) void ServerConnection::configureClient(const QString& clientName) { - auto& config = m_parent.serverConfig(); - config.addClient(clientName); + ServerConfigDialog dlg(&m_parent, m_parent.serverConfig()); - ServerConfigDialog dlg(&m_parent, config); - dlg.exec(); - - m_parent.restartSynergy(); + if(dlg.addClient(clientName) && dlg.exec() == QDialog::Accepted) { + m_parent.restartSynergy(); + } }