#6538 Added event to live swap configs as soon as the scope is changed in settings
This commit is contained in:
parent
70f50a655b
commit
a2009d0aa0
2 changed files with 73 additions and 54 deletions
|
|
@ -49,60 +49,7 @@ SettingsDialog::SettingsDialog(QWidget* parent, AppConfig& config) :
|
|||
|
||||
m_Locale.fillLanguageComboBox(m_pComboLanguage);
|
||||
|
||||
m_pLineEditScreenName->setText(appConfig().screenName());
|
||||
m_pSpinBoxPort->setValue(appConfig().port());
|
||||
m_pLineEditInterface->setText(appConfig().networkInterface());
|
||||
m_pComboLogLevel->setCurrentIndex(appConfig().logLevel());
|
||||
m_pCheckBoxLogToFile->setChecked(appConfig().logToFile());
|
||||
m_pLineEditLogFilename->setText(appConfig().logFilename());
|
||||
setIndexFromItemData(m_pComboLanguage, appConfig().language());
|
||||
m_pCheckBoxAutoHide->setChecked(appConfig().getAutoHide());
|
||||
m_pCheckBoxMinimizeToTray->setChecked(appConfig().getMinimizeToTray());
|
||||
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||
|
||||
if (m_appConfig.isSystemScoped()) {
|
||||
m_pRadioSystemScope->setChecked(true);
|
||||
}
|
||||
else {
|
||||
m_pRadioUserScope->setChecked(true);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
m_pBonjourWindows = new BonjourWindows(this, m_pMainWindow, m_appConfig);
|
||||
if (m_pBonjourWindows->isRunning()) {
|
||||
allowAutoConfig();
|
||||
}
|
||||
|
||||
m_pComboElevate->setCurrentIndex(static_cast<int>(appConfig().elevateMode()));
|
||||
|
||||
#else
|
||||
// elevate checkbox is only useful on ms windows.
|
||||
m_pLabelElevate->hide();
|
||||
m_pComboElevate->hide();
|
||||
|
||||
// for linux and mac, allow auto config by default
|
||||
allowAutoConfig();
|
||||
#endif
|
||||
|
||||
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||
|
||||
#ifdef SYNERGY_ENTERPRISE
|
||||
|
||||
m_pCheckBoxEnableCrypto->setEnabled(true);
|
||||
m_pLabelProUpgrade->hide();
|
||||
|
||||
m_pCheckBoxAutoConfig->hide();
|
||||
m_pLabelInstallBonjour->hide();
|
||||
|
||||
#else
|
||||
|
||||
bool isPro = m_appConfig.edition() == kPro;
|
||||
m_pCheckBoxEnableCrypto->setEnabled(isPro);
|
||||
m_pLabelProUpgrade->setVisible(!isPro);
|
||||
|
||||
m_pCheckBoxAutoConfig->setChecked(appConfig().autoConfig());
|
||||
|
||||
#endif
|
||||
loadFromConfig();
|
||||
}
|
||||
|
||||
void SettingsDialog::accept()
|
||||
|
|
@ -158,6 +105,65 @@ void SettingsDialog::changeEvent(QEvent* event)
|
|||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::loadFromConfig() {
|
||||
|
||||
m_pLineEditScreenName->setText(appConfig().screenName());
|
||||
m_pSpinBoxPort->setValue(appConfig().port());
|
||||
m_pLineEditInterface->setText(appConfig().networkInterface());
|
||||
m_pComboLogLevel->setCurrentIndex(appConfig().logLevel());
|
||||
m_pCheckBoxLogToFile->setChecked(appConfig().logToFile());
|
||||
m_pLineEditLogFilename->setText(appConfig().logFilename());
|
||||
setIndexFromItemData(m_pComboLanguage, appConfig().language());
|
||||
m_pCheckBoxAutoHide->setChecked(appConfig().getAutoHide());
|
||||
m_pCheckBoxMinimizeToTray->setChecked(appConfig().getMinimizeToTray());
|
||||
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||
|
||||
if (m_appConfig.isSystemScoped()) {
|
||||
m_pRadioSystemScope->setChecked(true);
|
||||
}
|
||||
else {
|
||||
m_pRadioUserScope->setChecked(true);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_WIN)
|
||||
m_pBonjourWindows = new BonjourWindows(this, m_pMainWindow, m_appConfig);
|
||||
if (m_pBonjourWindows->isRunning()) {
|
||||
allowAutoConfig();
|
||||
}
|
||||
|
||||
m_pComboElevate->setCurrentIndex(static_cast<int>(appConfig().elevateMode()));
|
||||
|
||||
#else
|
||||
// elevate checkbox is only useful on ms windows.
|
||||
m_pLabelElevate->hide();
|
||||
m_pComboElevate->hide();
|
||||
|
||||
// for linux and mac, allow auto config by default
|
||||
allowAutoConfig();
|
||||
#endif
|
||||
|
||||
m_pCheckBoxEnableCrypto->setChecked(m_appConfig.getCryptoEnabled());
|
||||
|
||||
#ifdef SYNERGY_ENTERPRISE
|
||||
|
||||
m_pCheckBoxEnableCrypto->setEnabled(true);
|
||||
m_pLabelProUpgrade->hide();
|
||||
|
||||
m_pCheckBoxAutoConfig->hide();
|
||||
m_pLabelInstallBonjour->hide();
|
||||
|
||||
#else
|
||||
|
||||
bool isPro = m_appConfig.edition() == kPro;
|
||||
m_pCheckBoxEnableCrypto->setEnabled(isPro);
|
||||
m_pLabelProUpgrade->setVisible(!isPro);
|
||||
|
||||
m_pCheckBoxAutoConfig->setChecked(appConfig().autoConfig());
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
void SettingsDialog::allowAutoConfig()
|
||||
{
|
||||
m_pLabelInstallBonjour->hide();
|
||||
|
|
@ -209,3 +215,9 @@ void SettingsDialog::on_m_pLabelInstallBonjour_linkActivated(const QString&)
|
|||
m_pBonjourWindows->downloadAndInstall();
|
||||
#endif
|
||||
}
|
||||
|
||||
void SettingsDialog::on_m_pRadioSystemScope_toggled(bool checked)
|
||||
{
|
||||
appConfig().setLoadFromSystemScope(checked);
|
||||
loadFromConfig();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,6 +45,9 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase
|
|||
void changeEvent(QEvent* event);
|
||||
AppConfig& appConfig() { return m_appConfig; }
|
||||
|
||||
/// @brief Causes the dialog to load all the settings from m_appConfig
|
||||
void loadFromConfig();
|
||||
|
||||
private:
|
||||
MainWindow* m_pMainWindow;
|
||||
AppConfig& m_appConfig;
|
||||
|
|
@ -58,6 +61,10 @@ class SettingsDialog : public QDialog, public Ui::SettingsDialogBase
|
|||
void on_m_pCheckBoxLogToFile_stateChanged(int );
|
||||
void on_m_pButtonBrowseLog_clicked();
|
||||
void on_m_pLabelInstallBonjour_linkActivated(const QString &link);
|
||||
|
||||
/// @brief Handles the toggling of the system scoped radio button
|
||||
/// As the user scope radio is connected this will fire for either radio button
|
||||
void on_m_pRadioSystemScope_toggled(bool checked);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue