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 <andrii-external@symless.com>
This commit is contained in:
Andrey Batyiev 2021-09-06 11:25:55 +03:00 committed by GitHub
parent d4bd004899
commit fc00ddb4c4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 30 additions and 15 deletions

View file

@ -5,6 +5,7 @@ Bug fixes:
- #7078 Fix clipboard re-enables automatically - #7078 Fix clipboard re-enables automatically
- #7077 Fix Ubuntu, CentOS and Debian build after SYNERGY-1161 - #7077 Fix Ubuntu, CentOS and Debian build after SYNERGY-1161
- #7080 Add trace if the system can't open file with trusted fingerprints - #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 - #7082 Windows client doesn't resume connection after sleep
Enhancements: Enhancements:

View file

@ -135,6 +135,11 @@ ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config) :
this, [this]() { serverConfig().setConfigFile(m_pEditConfigFile->text()); onChange();}); this, [this]() { serverConfig().setConfigFile(m_pEditConfigFile->text()); onChange();});
} }
bool ServerConfigDialog::addClient(const QString& clientName)
{
return addComputer(clientName, true);
}
void ServerConfigDialog::showEvent(QShowEvent* event) void ServerConfigDialog::showEvent(QShowEvent* event)
{ {
QDialog::show(); QDialog::show();
@ -304,15 +309,7 @@ void ServerConfigDialog::on_m_pListActions_itemSelectionChanged()
void ServerConfigDialog::on_m_pButtonAddComputer_clicked() void ServerConfigDialog::on_m_pButtonAddComputer_clicked()
{ {
Screen newScreen(""); addComputer("", false);
ScreenSettingsDialog dlg(this, &newScreen, &model().m_Screens);
if (dlg.exec() == QDialog::Accepted)
{
model().addScreen(newScreen);
}
m_pButtonAddComputer->setEnabled(!model().isFull());
} }
void ServerConfigDialog::onScreenRemoved() void ServerConfigDialog::onScreenRemoved()
@ -351,6 +348,23 @@ bool ServerConfigDialog::on_m_pButtonBrowseConfigFile_clicked()
return false; 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() void ServerConfigDialog::onChange()
{ {
bool isAppConfigDataEqual = m_OrigServerAppConfigUseExternalConfig == serverConfig().getUseExternalConfig() && bool isAppConfigDataEqual = m_OrigServerAppConfigUseExternalConfig == serverConfig().getUseExternalConfig() &&

View file

@ -33,6 +33,7 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase
public: public:
ServerConfigDialog(QWidget* parent, ServerConfig& config); ServerConfigDialog(QWidget* parent, ServerConfig& config);
bool addClient(const QString& clientName);
public slots: public slots:
void accept(); void accept();
@ -57,6 +58,7 @@ class ServerConfigDialog : public QDialog, public Ui::ServerConfigDialogBase
bool on_m_pButtonBrowseConfigFile_clicked(); bool on_m_pButtonBrowseConfigFile_clicked();
protected: protected:
bool addComputer(const QString& clientName, bool doSilent);
ServerConfig& serverConfig() { return m_ServerConfig; } ServerConfig& serverConfig() { return m_ServerConfig; }
void setOrigServerConfig(const ServerConfig& s) { m_OrigServerConfig = s; } void setOrigServerConfig(const ServerConfig& s) { m_OrigServerConfig = s; }
ScreenSetupModel& model() { return m_ScreenSetupModel; } ScreenSetupModel& model() { return m_ScreenSetupModel; }

View file

@ -81,11 +81,9 @@ void ServerConnection::addClient(const QString& clientName)
void ServerConnection::configureClient(const QString& clientName) void ServerConnection::configureClient(const QString& clientName)
{ {
auto& config = m_parent.serverConfig(); ServerConfigDialog dlg(&m_parent, m_parent.serverConfig());
config.addClient(clientName);
ServerConfigDialog dlg(&m_parent, config); if(dlg.addClient(clientName) && dlg.exec() == QDialog::Accepted) {
dlg.exec(); m_parent.restartSynergy();
}
m_parent.restartSynergy();
} }