fix(ServerConfigDialog): adjust external file line so it saves when edited via typed entry
This commit is contained in:
parent
0d72bf131f
commit
aaa08da6f8
2 changed files with 17 additions and 6 deletions
|
|
@ -41,7 +41,6 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config)
|
||||||
|
|
||||||
m_buttonBox->enableRestoreDefaults(false);
|
m_buttonBox->enableRestoreDefaults(false);
|
||||||
|
|
||||||
setOriginalServerConfig(serverConfig());
|
|
||||||
loadFromConfig();
|
loadFromConfig();
|
||||||
|
|
||||||
ui->lblRemoveScreen->setPixmap(QIcon::fromTheme("user-trash").pixmap(QSize(64, 64)));
|
ui->lblRemoveScreen->setPixmap(QIcon::fromTheme("user-trash").pixmap(QSize(64, 64)));
|
||||||
|
|
@ -52,7 +51,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget *parent, ServerConfig &config)
|
||||||
if (!deskflow::platform::isWindows())
|
if (!deskflow::platform::isWindows())
|
||||||
ui->cbWin32KeepForeground->setVisible(false);
|
ui->cbWin32KeepForeground->setVisible(false);
|
||||||
initConnections();
|
initConnections();
|
||||||
setButtonBoxEnabledButtons();
|
updateControls();
|
||||||
}
|
}
|
||||||
|
|
||||||
ServerConfigDialog::~ServerConfigDialog() = default;
|
ServerConfigDialog::~ServerConfigDialog() = default;
|
||||||
|
|
@ -74,7 +73,6 @@ void ServerConfigDialog::save()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// now that the dialog has been accepted, copy the new server config to the
|
// now that the dialog has been accepted, copy the new server config to the
|
||||||
// original one, which is a reference to the one in MainWindow.
|
// original one, which is a reference to the one in MainWindow.
|
||||||
setOriginalServerConfig(serverConfig());
|
setOriginalServerConfig(serverConfig());
|
||||||
|
|
@ -91,6 +89,8 @@ void ServerConfigDialog::save()
|
||||||
Settings::setValue(Settings::Server::SwitchDoubleTap, m_switchDoubleTap);
|
Settings::setValue(Settings::Server::SwitchDoubleTap, m_switchDoubleTap);
|
||||||
Settings::setValue(Settings::Server::RelativeMouseMoves, m_relativeMouseMoves);
|
Settings::setValue(Settings::Server::RelativeMouseMoves, m_relativeMouseMoves);
|
||||||
Settings::setValue(Settings::Server::Win32KeepForeground, m_win32keepForeground);
|
Settings::setValue(Settings::Server::Win32KeepForeground, m_win32keepForeground);
|
||||||
|
Settings::setValue(Settings::Server::ExternalConfig, ui->groupExternalConfig->isChecked());
|
||||||
|
Settings::setValue(Settings::Server::ExternalConfigFile, ui->lineConfigFile->text());
|
||||||
|
|
||||||
QStringList screenNames;
|
QStringList screenNames;
|
||||||
const auto screenList = m_screenSetupModel.m_Screens;
|
const auto screenList = m_screenSetupModel.m_Screens;
|
||||||
|
|
@ -109,7 +109,6 @@ void ServerConfigDialog::cancel()
|
||||||
{
|
{
|
||||||
serverConfig().setUseExternalConfig(m_originalServerConfigIsExternal);
|
serverConfig().setUseExternalConfig(m_originalServerConfigIsExternal);
|
||||||
serverConfig().setConfigFile(m_originalServerConfigUsesExternalFile);
|
serverConfig().setConfigFile(m_originalServerConfigUsesExternalFile);
|
||||||
|
|
||||||
QDialog::reject();
|
QDialog::reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -375,8 +374,7 @@ bool ServerConfigDialog::browseConfigFile()
|
||||||
|
|
||||||
if (!fileName.isEmpty()) {
|
if (!fileName.isEmpty()) {
|
||||||
ui->lineConfigFile->setText(fileName);
|
ui->lineConfigFile->setText(fileName);
|
||||||
serverConfig().setConfigFile(ui->lineConfigFile->text());
|
setServerConfig();
|
||||||
setButtonBoxEnabledButtons();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -508,6 +506,7 @@ void ServerConfigDialog::initConnections() const
|
||||||
connect(ui->cbEnableClipboard, &QCheckBox::toggled, this, &ServerConfigDialog::toggleClipboard);
|
connect(ui->cbEnableClipboard, &QCheckBox::toggled, this, &ServerConfigDialog::toggleClipboard);
|
||||||
connect(ui->btnBrowseConfigFile, &QPushButton::clicked, this, &ServerConfigDialog::browseConfigFile);
|
connect(ui->btnBrowseConfigFile, &QPushButton::clicked, this, &ServerConfigDialog::browseConfigFile);
|
||||||
connect(ui->groupExternalConfig, &QGroupBox::toggled, this, &ServerConfigDialog::toggleExternalConfig);
|
connect(ui->groupExternalConfig, &QGroupBox::toggled, this, &ServerConfigDialog::toggleExternalConfig);
|
||||||
|
connect(ui->lineConfigFile, &QLineEdit::textChanged, this, &ServerConfigDialog::setServerConfig);
|
||||||
|
|
||||||
connect(
|
connect(
|
||||||
ui->sbClipboardSizeLimit, QOverload<int>::of(&QSpinBox::valueChanged), this,
|
ui->sbClipboardSizeLimit, QOverload<int>::of(&QSpinBox::valueChanged), this,
|
||||||
|
|
@ -543,6 +542,17 @@ void ServerConfigDialog::updateControls() const
|
||||||
setButtonBoxEnabledButtons();
|
setButtonBoxEnabledButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ServerConfigDialog::setServerConfig()
|
||||||
|
{
|
||||||
|
const auto configFile = ui->lineConfigFile->text();
|
||||||
|
if (!QFile::exists(configFile)) {
|
||||||
|
m_buttonBox->enableSave(false);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
serverConfig().setConfigFile(configFile);
|
||||||
|
setButtonBoxEnabledButtons();
|
||||||
|
}
|
||||||
|
|
||||||
bool ServerConfigDialog::addComputer(const QString &clientName, bool doSilent)
|
bool ServerConfigDialog::addComputer(const QString &clientName, bool doSilent)
|
||||||
{
|
{
|
||||||
bool isAccepted = false;
|
bool isAccepted = false;
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,7 @@ private:
|
||||||
void resetFromSettings();
|
void resetFromSettings();
|
||||||
void initConnections() const;
|
void initConnections() const;
|
||||||
void updateControls() const;
|
void updateControls() const;
|
||||||
|
void setServerConfig();
|
||||||
bool isGeneralConfigModified() const;
|
bool isGeneralConfigModified() const;
|
||||||
void setButtonBoxEnabledButtons() const;
|
void setButtonBoxEnabledButtons() const;
|
||||||
std::unique_ptr<Ui::ServerConfigDialog> ui;
|
std::unique_ptr<Ui::ServerConfigDialog> ui;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue