From 90e79dad75c6c558b5b780f82bd584fda0b78db2 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Wed, 4 Mar 2026 16:54:49 -0500 Subject: [PATCH] refactor: SettingsDialog update ux for initial window state --- src/lib/gui/dialogs/SettingsDialog.cpp | 23 ++++--- src/lib/gui/dialogs/SettingsDialog.ui | 87 +++++++++++++++++--------- translations/deskflow_es.ts | 12 ++-- translations/deskflow_it.ts | 12 ++-- translations/deskflow_ja.ts | 12 ++-- translations/deskflow_ko.ts | 12 ++-- translations/deskflow_ru.ts | 12 ++-- translations/deskflow_zh_CN.ts | 12 ++-- 8 files changed, 121 insertions(+), 61 deletions(-) diff --git a/src/lib/gui/dialogs/SettingsDialog.cpp b/src/lib/gui/dialogs/SettingsDialog.cpp index 8ecfd3189..e1c265a45 100644 --- a/src/lib/gui/dialogs/SettingsDialog.cpp +++ b/src/lib/gui/dialogs/SettingsDialog.cpp @@ -115,9 +115,9 @@ void SettingsDialog::initConnections() const connect(ui->comboInterface, &QComboBox::currentIndexChanged, this, &SettingsDialog::setButtonBoxEnabledButtons); connect(ui->comboTlsKeyLength, &QComboBox::currentIndexChanged, this, &SettingsDialog::setButtonBoxEnabledButtons); connect(ui->comboLanguage, &QComboBox::currentIndexChanged, this, &SettingsDialog::setButtonBoxEnabledButtons); - connect(ui->cbAutoHide, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons); + connect(ui->rbAutoHide, &QRadioButton::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons); connect(ui->cbPreventSleep, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons); - connect(ui->rbCloseToTray, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons); + connect(ui->rbCloseToTray, &QRadioButton::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons); connect(ui->cbElevateDaemon, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons); connect(ui->cbAutoUpdate, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons); connect(ui->cbGuiDebug, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons); @@ -211,7 +211,7 @@ void SettingsDialog::accept() Settings::setValue(Settings::Log::ToFile, ui->groupLogToFile->isChecked()); Settings::setValue(Settings::Log::File, ui->lineLogFilename->text()); Settings::setValue(Settings::Daemon::Elevate, ui->cbElevateDaemon->isChecked()); - Settings::setValue(Settings::Gui::Autohide, ui->cbAutoHide->isChecked()); + Settings::setValue(Settings::Gui::Autohide, ui->rbAutoHide->isChecked()); Settings::setValue(Settings::Gui::AutoUpdateCheck, ui->cbAutoUpdate->isChecked()); Settings::setValue(Settings::Core::PreventSleep, ui->cbPreventSleep->isChecked()); Settings::setValue(Settings::Security::Certificate, ui->lineTlsCertPath->text()); @@ -241,7 +241,6 @@ void SettingsDialog::loadFromConfig() ui->comboLogLevel->setCurrentIndex(Settings::value(Settings::Log::Level).toInt()); ui->groupLogToFile->setChecked(Settings::value(Settings::Log::ToFile).toBool()); ui->lineLogFilename->setText(Settings::value(Settings::Log::File).toString()); - ui->cbAutoHide->setChecked(Settings::value(Settings::Gui::Autohide).toBool()); ui->cbPreventSleep->setChecked(Settings::value(Settings::Core::PreventSleep).toBool()); ui->cbElevateDaemon->setChecked(Settings::value(Settings::Daemon::Elevate).toBool()); ui->cbAutoUpdate->setChecked(Settings::value(Settings::Gui::AutoUpdateCheck).toBool()); @@ -260,6 +259,10 @@ void SettingsDialog::loadFromConfig() else ui->rbIconColorful->setChecked(true); + const auto autoHide = Settings::value(Settings::Gui::Autohide).toBool(); + ui->rbAutoHide->setChecked(autoHide); + ui->rbShowOnStart->setChecked(!autoHide); + const auto closeToTray = Settings::value(Settings::Gui::CloseToTray).toBool(); ui->rbCloseToTray->setChecked(closeToTray); ui->rbExitOnClose->setChecked(!closeToTray); @@ -345,7 +348,8 @@ void SettingsDialog::updateControls() ui->comboInterface->setEnabled(writable); ui->comboLogLevel->setEnabled(writable); ui->groupLogToFile->setEnabled(writable); - ui->cbAutoHide->setEnabled(writable); + ui->rbAutoHide->setEnabled(writable); + ui->rbShowOnStart->setEnabled(writable); ui->cbAutoUpdate->setEnabled(writable); ui->cbPreventSleep->setEnabled(writable); ui->lineTlsCertPath->setEnabled(writable); @@ -397,7 +401,7 @@ bool SettingsDialog::isModified() const (ui->comboLogLevel->currentIndex() != Settings::value(Settings::Log::Level).toInt()) || (ui->groupLogToFile->isChecked() != Settings::value(Settings::Log::ToFile).toBool()) || (ui->lineLogFilename->text() != Settings::value(Settings::Log::File).toString()) || - (ui->cbAutoHide->isChecked() != Settings::value(Settings::Gui::Autohide).toBool()) || + (ui->rbAutoHide->isChecked() != Settings::value(Settings::Gui::Autohide).toBool()) || (ui->cbPreventSleep->isChecked() != Settings::value(Settings::Core::PreventSleep).toBool()) || (ui->rbCloseToTray->isChecked() != Settings::value(Settings::Gui::CloseToTray).toBool()) || (ui->cbElevateDaemon->isChecked() != Settings::value(Settings::Daemon::Elevate).toBool()) || @@ -427,7 +431,7 @@ bool SettingsDialog::isDefault() const (ui->comboLogLevel->currentIndex() == Settings::defaultValue(Settings::Log::Level).toInt()) && (ui->groupLogToFile->isChecked() == Settings::defaultValue(Settings::Log::ToFile).toBool()) && (ui->lineLogFilename->text() == Settings::defaultValue(Settings::Log::File).toString()) && - (ui->cbAutoHide->isChecked() == Settings::defaultValue(Settings::Gui::Autohide).toBool()) && + (ui->rbAutoHide->isChecked() == Settings::defaultValue(Settings::Gui::Autohide).toBool()) && (ui->cbPreventSleep->isChecked() == Settings::defaultValue(Settings::Core::PreventSleep).toBool()) && (ui->rbCloseToTray->isChecked() == Settings::defaultValue(Settings::Gui::CloseToTray).toBool()) && (ui->cbElevateDaemon->isChecked() == Settings::defaultValue(Settings::Daemon::Elevate).toBool()) && @@ -452,7 +456,6 @@ void SettingsDialog::resetToDefault() ui->comboLogLevel->setCurrentIndex(Settings::defaultValue(Settings::Log::Level).toInt()); ui->groupLogToFile->setChecked(Settings::defaultValue(Settings::Log::ToFile).toBool()); ui->lineLogFilename->setText(Settings::defaultValue(Settings::Log::File).toString()); - ui->cbAutoHide->setChecked(Settings::defaultValue(Settings::Gui::Autohide).toBool()); ui->cbPreventSleep->setChecked(Settings::defaultValue(Settings::Core::PreventSleep).toBool()); ui->cbElevateDaemon->setChecked(Settings::defaultValue(Settings::Daemon::Elevate).toBool()); ui->cbAutoUpdate->setChecked(Settings::defaultValue(Settings::Gui::AutoUpdateCheck).toBool()); @@ -460,6 +463,10 @@ void SettingsDialog::resetToDefault() ui->cbUseWlClipboard->setChecked(Settings::defaultValue(Settings::Core::UseWlClipboard).toBool()); ui->cbShowVersion->setChecked(Settings::defaultValue(Settings::Gui::ShowVersionInTitle).toBool()); + const auto autoHide = Settings::defaultValue(Settings::Gui::Autohide).toBool(); + ui->rbCloseToTray->setChecked(autoHide); + ui->rbExitOnClose->setChecked(!autoHide); + const auto closeToTray = Settings::defaultValue(Settings::Gui::CloseToTray).toBool(); ui->rbCloseToTray->setChecked(closeToTray); ui->rbExitOnClose->setChecked(!closeToTray); diff --git a/src/lib/gui/dialogs/SettingsDialog.ui b/src/lib/gui/dialogs/SettingsDialog.ui index 00a2d907a..96c5f7c2c 100644 --- a/src/lib/gui/dialogs/SettingsDialog.ui +++ b/src/lib/gui/dialogs/SettingsDialog.ui @@ -6,8 +6,8 @@ 0 0 - 554 - 447 + 564 + 431 @@ -139,9 +139,9 @@ &Window - + - 20 + 9 12 @@ -168,23 +168,39 @@ - - - - Include version in the window title - - - - - - - Hide the window when the app starts - - - + + Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter + + + + When the application starts + + + + + + + + + + Show the main window + + + + + + + Send to background + + + + + + + When the main window is closed @@ -194,22 +210,35 @@ - - - - Exit - - - - - - Send to background - + + + + + + Exit + + + + + + + Send to background + + + + + + + + Include version in the window title + + + diff --git a/translations/deskflow_es.ts b/translations/deskflow_es.ts index 6ed5a2cf7..582831702 100644 --- a/translations/deskflow_es.ts +++ b/translations/deskflow_es.ts @@ -1081,10 +1081,6 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU Check for updates on startup Buscar actualizaciones al iniciar - - Hide the window when the app starts - Ocultar la ventana cuando se inicia la aplicación - Prevent this computer from going to sleep Evitar que esta computadora entre en modo de suspensión @@ -1305,6 +1301,14 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU Send to background Enviar a segundo plano + + When the application starts + Cuando se inicia la aplicación + + + Show the main window + Mostrar la ventana principal + StatusBar diff --git a/translations/deskflow_it.ts b/translations/deskflow_it.ts index edea25228..260221a93 100644 --- a/translations/deskflow_it.ts +++ b/translations/deskflow_it.ts @@ -1081,10 +1081,6 @@ L'abilitazione di questa impostazione disabiliterà l'interfaccia graf Check for updates on startup Controlla aggiornamenti all'avvio - - Hide the window when the app starts - Nascondi la finestra all'avvio dell'app - Prevent this computer from going to sleep Impedisci a questo computer di andare in sospensione @@ -1305,6 +1301,14 @@ L'abilitazione di questa impostazione disabiliterà l'interfaccia graf Send to background Invia in background + + When the application starts + Quando l'applicazione si avvia + + + Show the main window + Mostra la finestra principale + StatusBar diff --git a/translations/deskflow_ja.ts b/translations/deskflow_ja.ts index f2f6ebeee..0d972d5f1 100644 --- a/translations/deskflow_ja.ts +++ b/translations/deskflow_ja.ts @@ -1083,10 +1083,6 @@ Enabling this setting will disable the server config GUI. Check for updates on startup 起動時にソフトウェア更新を確認する - - Hide the window when the app starts - アプリの起動時にウィンドウを隠す - Prevent this computer from going to sleep このコンピューターがスリープしないようにする @@ -1307,6 +1303,14 @@ Enabling this setting will disable the server config GUI. Send to background バックグラウンドに送信 + + When the application starts + アプリケーションが起動すると + + + Show the main window + メインウィンドウを表示する + StatusBar diff --git a/translations/deskflow_ko.ts b/translations/deskflow_ko.ts index 063c8a240..c64a78986 100644 --- a/translations/deskflow_ko.ts +++ b/translations/deskflow_ko.ts @@ -1081,10 +1081,6 @@ Enabling this setting will disable the server config GUI. Check for updates on startup 시작 시 업데이트 확인 - - Hide the window when the app starts - 앱 시작 시 창 숨기기 - Prevent this computer from going to sleep 이 컴퓨터를 절전 모드로 전환하지 않음 @@ -1305,6 +1301,14 @@ Enabling this setting will disable the server config GUI. Send to background 백그라운드로 보내기 + + When the application starts + 애플리케이션이 시작될 때 + + + Show the main window + 메인 창을 표시합니다 + StatusBar diff --git a/translations/deskflow_ru.ts b/translations/deskflow_ru.ts index 9cba1e2cc..ba03bef50 100644 --- a/translations/deskflow_ru.ts +++ b/translations/deskflow_ru.ts @@ -1079,10 +1079,6 @@ Enabling this setting will disable the server config GUI. Check for updates on startup Проверять обновления при запуске - - Hide the window when the app starts - Скрывать окно при запуске - Prevent this computer from going to sleep Запретить компьютеру переходить в спящий режим @@ -1303,6 +1299,14 @@ Enabling this setting will disable the server config GUI. Send to background Отправить в фоновый режим + + When the application starts + Когда приложение запускается + + + Show the main window + Показать главное окно + StatusBar diff --git a/translations/deskflow_zh_CN.ts b/translations/deskflow_zh_CN.ts index 2022a66dd..745cfddfe 100644 --- a/translations/deskflow_zh_CN.ts +++ b/translations/deskflow_zh_CN.ts @@ -1083,10 +1083,6 @@ Enabling this setting will disable the server config GUI. Check for updates on startup 启动时检查更新 - - Hide the window when the app starts - 应用启动时隐藏窗口 - Prevent this computer from going to sleep 防止此计算机进入睡眠状态 @@ -1307,6 +1303,14 @@ Enabling this setting will disable the server config GUI. Send to background 发送到后台 + + When the application starts + 应用程序启动时 + + + Show the main window + 显示主窗口 + StatusBar