From 5642879a21dfbd29c2da83ffd54bc560524b0b88 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Thu, 6 Mar 2025 19:26:17 -0500 Subject: [PATCH] chore: connect up Settings changed signal to mainwindow --- src/apps/deskflow-gui/MainWindow.cpp | 24 ++++++++++++++---------- src/apps/deskflow-gui/MainWindow.h | 2 +- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/apps/deskflow-gui/MainWindow.cpp b/src/apps/deskflow-gui/MainWindow.cpp index 5f4a0b00a..f55dc310e 100644 --- a/src/apps/deskflow-gui/MainWindow.cpp +++ b/src/apps/deskflow-gui/MainWindow.cpp @@ -291,7 +291,8 @@ void MainWindow::connectSlots() connect(&m_configScopes, &ConfigScopes::saving, this, &MainWindow::configScopesSaving, Qt::DirectConnection); - connect(&m_appConfig, &AppConfig::tlsChanged, this, &MainWindow::appConfigTlsChanged); + connect(Settings::instance(), &Settings::settingsChanged, this, &MainWindow::settingsChanged); + connect(&m_appConfig, &AppConfig::screenNameChanged, this, &MainWindow::updateScreenName); connect(&m_appConfig, &AppConfig::logLevelChanged, &m_coreProcess, &CoreProcess::applyLogLevel); @@ -381,20 +382,23 @@ void MainWindow::firstShown() QTimer::singleShot(kCriticalDialogDelay, this, &messages::raiseCriticalDialog); } +void MainWindow::settingsChanged(const QString &key) +{ + if ((key == Settings::Security::Certificate) || (key == Settings::Security::KeySize) || + (key == Settings::Security::TlsEnabled)) { + const auto certificate = Settings::value(Settings::Security::Certificate).toString(); + if (m_tlsUtility.isEnabled() && !QFile::exists(certificate)) { + m_tlsUtility.generateCertificate(); + } + updateSecurityIcon(m_lblSecurityStatus->isVisible()); + } +} + void MainWindow::configScopesSaving() { m_serverConfig.commit(); } -void MainWindow::appConfigTlsChanged() -{ - const auto certificate = Settings::value(Settings::Security::Certificate).toString(); - if (m_tlsUtility.isEnabled() && !QFile::exists(certificate)) { - m_tlsUtility.generateCertificate(); - } - updateSecurityIcon(m_lblSecurityStatus->isVisible()); -} - void MainWindow::trayIconActivated(QSystemTrayIcon::ActivationReason reason) { if (reason != QSystemTrayIcon::Trigger) diff --git a/src/apps/deskflow-gui/MainWindow.h b/src/apps/deskflow-gui/MainWindow.h index bff501dce..4eebe21a8 100644 --- a/src/apps/deskflow-gui/MainWindow.h +++ b/src/apps/deskflow-gui/MainWindow.h @@ -100,8 +100,8 @@ private: void firstShown(); + void settingsChanged(const QString &key = QString()); void configScopesSaving(); - void appConfigTlsChanged(); void coreProcessStarting(); void coreProcessError(CoreProcess::Error error); void coreConnectionStateChanged(CoreProcess::ConnectionState state);