feat: SettingsDialog, Allow user to toggle the check for updates settings

fixes: #7890
This commit is contained in:
sithlord48 2024-11-13 10:42:08 -05:00 committed by Chris Rizzitello
parent 2990de322f
commit 7bf474a54a
3 changed files with 19 additions and 5 deletions

View file

@ -38,7 +38,7 @@
using namespace deskflow::gui;
SettingsDialog::SettingsDialog(
QWidget *parent, IAppConfig &appConfig, const IServerConfig &serverConfig, const CoreProcess &coreProcess
QWidget *parent, AppConfig &appConfig, const IServerConfig &serverConfig, const CoreProcess &coreProcess
)
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
ui{std::make_unique<Ui::SettingsDialog>()},
@ -188,6 +188,7 @@ void SettingsDialog::accept()
m_appConfig.setLogFilename(ui->m_pLineEditLogFilename->text());
m_appConfig.setElevateMode(static_cast<ElevateMode>(ui->m_pComboElevate->currentIndex()));
m_appConfig.setAutoHide(ui->m_pCheckBoxAutoHide->isChecked());
m_appConfig.setEnableUpdateCheck(ui->m_pCheckBoxAutoUpdate->isChecked());
m_appConfig.setPreventSleep(ui->m_pCheckBoxPreventSleep->isChecked());
m_appConfig.setTlsCertPath(ui->m_pLineEditTlsCertPath->text());
m_appConfig.setTlsKeyLength(ui->m_pComboBoxTlsKeyLength->currentText().toInt());
@ -228,6 +229,12 @@ void SettingsDialog::loadFromConfig()
ui->m_pCheckBoxCloseToTray->setChecked(m_appConfig.closeToTray());
ui->m_pComboElevate->setCurrentIndex(static_cast<int>(m_appConfig.elevateMode()));
if (m_appConfig.enableUpdateCheck().has_value()) {
ui->m_pCheckBoxAutoUpdate->setChecked(m_appConfig.enableUpdateCheck().value());
} else {
ui->m_pCheckBoxAutoUpdate->setChecked(false);
}
if (m_appConfig.isActiveScopeSystem()) {
ui->m_pRadioSystemScope->setChecked(true);
} else {
@ -311,6 +318,7 @@ void SettingsDialog::updateControls()
ui->m_pComboLogLevel->setEnabled(writable);
ui->m_pCheckBoxLogToFile->setEnabled(writable);
ui->m_pCheckBoxAutoHide->setEnabled(writable);
ui->m_pCheckBoxAutoUpdate->setEnabled(writable);
ui->m_pCheckBoxPreventSleep->setEnabled(writable);
ui->m_pLineEditTlsCertPath->setEnabled(writable);
ui->m_pComboBoxTlsKeyLength->setEnabled(writable);

View file

@ -19,7 +19,7 @@
#pragma once
#include <QDialog>
#include "gui/config/IAppConfig.h"
#include "gui/config/AppConfig.h"
#include "gui/config/IServerConfig.h"
#include "gui/core/CoreProcess.h"
#include "gui/tls/TlsUtility.h"
@ -31,7 +31,6 @@ class SettingsDialog;
class SettingsDialog : public QDialog
{
using IAppConfig = deskflow::gui::IAppConfig;
using IServerConfig = deskflow::gui::IServerConfig;
using CoreProcess = deskflow::gui::CoreProcess;
@ -40,7 +39,7 @@ class SettingsDialog : public QDialog
public:
void extracted();
SettingsDialog(
QWidget *parent, IAppConfig &appConfig, const IServerConfig &serverConfig, const CoreProcess &coreProcess
QWidget *parent, AppConfig &appConfig, const IServerConfig &serverConfig, const CoreProcess &coreProcess
);
~SettingsDialog() override;
@ -85,7 +84,7 @@ private:
bool m_wasOriginallySystemScope = false;
std::unique_ptr<Ui::SettingsDialog> ui;
IAppConfig &m_appConfig;
AppConfig &m_appConfig;
const IServerConfig &m_serverConfig;
const CoreProcess &m_coreProcess;
deskflow::gui::TlsUtility m_tlsUtility;

View file

@ -118,6 +118,13 @@
<string>App</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="QCheckBox" name="m_pCheckBoxAutoUpdate">
<property name="text">
<string>Check for updates on startup </string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="m_pCheckBoxCloseToTray">
<property name="text">