refactor: SettingsDialog adjust wording of close to tray option

This commit is contained in:
sithlord48
2026-03-04 16:07:22 -05:00
committed by Nick Bolton
parent 3d67865ffc
commit 8f8874370e
8 changed files with 120 additions and 44 deletions

View File

@ -117,7 +117,7 @@ void SettingsDialog::initConnections() const
connect(ui->comboLanguage, &QComboBox::currentIndexChanged, this, &SettingsDialog::setButtonBoxEnabledButtons);
connect(ui->cbAutoHide, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons);
connect(ui->cbPreventSleep, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons);
connect(ui->cbCloseToTray, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons);
connect(ui->rbCloseToTray, &QCheckBox::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);
@ -217,7 +217,7 @@ void SettingsDialog::accept()
Settings::setValue(Settings::Security::Certificate, ui->lineTlsCertPath->text());
Settings::setValue(Settings::Security::KeySize, ui->comboTlsKeyLength->currentText().toInt());
Settings::setValue(Settings::Security::TlsEnabled, ui->groupSecurity->isChecked());
Settings::setValue(Settings::Gui::CloseToTray, ui->cbCloseToTray->isChecked());
Settings::setValue(Settings::Gui::CloseToTray, ui->rbCloseToTray->isChecked());
Settings::setValue(Settings::Gui::SymbolicTrayIcon, ui->rbIconMono->isChecked());
Settings::setValue(Settings::Security::CheckPeers, ui->cbRequireClientCert->isChecked());
Settings::setValue(Settings::Core::Language, I18N::nativeTo639Name(ui->comboLanguage->currentText()));
@ -243,7 +243,6 @@ void SettingsDialog::loadFromConfig()
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->cbCloseToTray->setChecked(Settings::value(Settings::Gui::CloseToTray).toBool());
ui->cbElevateDaemon->setChecked(Settings::value(Settings::Daemon::Elevate).toBool());
ui->cbAutoUpdate->setChecked(Settings::value(Settings::Gui::AutoUpdateCheck).toBool());
ui->cbGuiDebug->setChecked(Settings::value(Settings::Log::GuiDebug).toBool());
@ -261,6 +260,10 @@ void SettingsDialog::loadFromConfig()
else
ui->rbIconColorful->setChecked(true);
const auto closeToTray = Settings::value(Settings::Gui::CloseToTray).toBool();
ui->rbCloseToTray->setChecked(closeToTray);
ui->rbExitOnClose->setChecked(!closeToTray);
ui->lblDebugWarning->setVisible(Settings::value(Settings::Log::Level).toInt() > 4);
ui->comboInterface->setCurrentText(Settings::value(Settings::Core::Interface).toString());
@ -347,7 +350,8 @@ void SettingsDialog::updateControls()
ui->cbPreventSleep->setEnabled(writable);
ui->lineTlsCertPath->setEnabled(writable);
ui->comboTlsKeyLength->setEnabled(writable);
ui->cbCloseToTray->setEnabled(writable);
ui->rbCloseToTray->setEnabled(writable);
ui->rbExitOnClose->setEnabled(writable);
// Portable mode only ever applies to Windows.
// Daemon options should only be available on Windows when *not* in portable mode.
@ -395,7 +399,7 @@ bool SettingsDialog::isModified() const
(ui->lineLogFilename->text() != Settings::value(Settings::Log::File).toString()) ||
(ui->cbAutoHide->isChecked() != Settings::value(Settings::Gui::Autohide).toBool()) ||
(ui->cbPreventSleep->isChecked() != Settings::value(Settings::Core::PreventSleep).toBool()) ||
(ui->cbCloseToTray->isChecked() != Settings::value(Settings::Gui::CloseToTray).toBool()) ||
(ui->rbCloseToTray->isChecked() != Settings::value(Settings::Gui::CloseToTray).toBool()) ||
(ui->cbElevateDaemon->isChecked() != Settings::value(Settings::Daemon::Elevate).toBool()) ||
(ui->cbAutoUpdate->isChecked() != Settings::value(Settings::Gui::AutoUpdateCheck).toBool()) ||
(ui->cbGuiDebug->isChecked() != Settings::value(Settings::Log::GuiDebug).toBool()) ||
@ -425,7 +429,7 @@ bool SettingsDialog::isDefault() const
(ui->lineLogFilename->text() == Settings::defaultValue(Settings::Log::File).toString()) &&
(ui->cbAutoHide->isChecked() == Settings::defaultValue(Settings::Gui::Autohide).toBool()) &&
(ui->cbPreventSleep->isChecked() == Settings::defaultValue(Settings::Core::PreventSleep).toBool()) &&
(ui->cbCloseToTray->isChecked() == Settings::defaultValue(Settings::Gui::CloseToTray).toBool()) &&
(ui->rbCloseToTray->isChecked() == Settings::defaultValue(Settings::Gui::CloseToTray).toBool()) &&
(ui->cbElevateDaemon->isChecked() == Settings::defaultValue(Settings::Daemon::Elevate).toBool()) &&
(ui->cbAutoUpdate->isChecked() == Settings::defaultValue(Settings::Gui::AutoUpdateCheck).toBool()) &&
(ui->cbGuiDebug->isChecked() == Settings::defaultValue(Settings::Log::GuiDebug).toBool()) &&
@ -450,13 +454,16 @@ void SettingsDialog::resetToDefault()
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->cbCloseToTray->setChecked(Settings::defaultValue(Settings::Gui::CloseToTray).toBool());
ui->cbElevateDaemon->setChecked(Settings::defaultValue(Settings::Daemon::Elevate).toBool());
ui->cbAutoUpdate->setChecked(Settings::defaultValue(Settings::Gui::AutoUpdateCheck).toBool());
ui->cbGuiDebug->setChecked(Settings::defaultValue(Settings::Log::GuiDebug).toBool());
ui->cbUseWlClipboard->setChecked(Settings::defaultValue(Settings::Core::UseWlClipboard).toBool());
ui->cbShowVersion->setChecked(Settings::defaultValue(Settings::Gui::ShowVersionInTitle).toBool());
const auto closeToTray = Settings::defaultValue(Settings::Gui::CloseToTray).toBool();
ui->rbCloseToTray->setChecked(closeToTray);
ui->rbExitOnClose->setChecked(!closeToTray);
const auto processMode = Settings::defaultValue(Settings::Core::ProcessMode).value<Settings::ProcessMode>();
ui->groupService->setChecked(processMode == Settings::ProcessMode::Service);

View File

@ -141,7 +141,7 @@
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>9</number>
<number>20</number>
</property>
<property name="leftMargin">
<number>12</number>
@ -168,6 +168,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QCheckBox" name="cbShowVersion">
<property name="text">
<string>Include version in the window title</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbAutoHide">
<property name="text">
@ -176,19 +183,33 @@
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbCloseToTray">
<layout class="QFormLayout" name="formLayout_2">
<item row="0" column="0">
<widget class="QLabel" name="label">
<property name="text">
<string>Leave app running in notification area when the window is closed</string>
<string>When the main window is closed</string>
</property>
<property name="alignment">
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbShowVersion">
<item row="0" column="1">
<widget class="QRadioButton" name="rbExitOnClose">
<property name="text">
<string>Include version in the window title</string>
<string>Exit</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QRadioButton" name="rbCloseToTray">
<property name="text">
<string>Send to background</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_11">
<property name="orientation">

View File

@ -1089,10 +1089,6 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU
<source>Prevent this computer from going to sleep</source>
<translation type="unfinished">Evitar que esta computadora entre en modo de suspensión</translation>
</message>
<message>
<source>Leave app running in notification area when the window is closed</source>
<translation type="unfinished">Dejar la aplicación ejecutándose en el área de notificación cuando la ventana esté cerrada</translation>
</message>
<message>
<source>Tray icon style</source>
<translation type="unfinished">Estilo de icono de bandeja</translation>
@ -1297,6 +1293,18 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU
<source>&amp;Window</source>
<translation type="unfinished">&amp;Ventana</translation>
</message>
<message>
<source>When the main window is closed</source>
<translation type="unfinished">Cuando la ventana principal está cerrada</translation>
</message>
<message>
<source>Exit</source>
<translation type="unfinished">Salir</translation>
</message>
<message>
<source>Send to background</source>
<translation type="unfinished">Enviar a segundo plano</translation>
</message>
</context>
<context>
<name>StatusBar</name>

View File

@ -1089,10 +1089,6 @@ L&apos;abilitazione di questa impostazione disabiliterà l&apos;interfaccia graf
<source>Prevent this computer from going to sleep</source>
<translation>Impedisci a questo computer di andare in sospensione</translation>
</message>
<message>
<source>Leave app running in notification area when the window is closed</source>
<translation>Lascia l&apos;app in esecuzione nell&apos;area di notifica quando la finestra viene chiusa</translation>
</message>
<message>
<source>Tray icon style</source>
<translation>Stile icona di notifica</translation>
@ -1297,6 +1293,18 @@ L&apos;abilitazione di questa impostazione disabiliterà l&apos;interfaccia graf
<source>&amp;Window</source>
<translation type="unfinished">&amp;Finestra</translation>
</message>
<message>
<source>When the main window is closed</source>
<translation type="unfinished">Quando la finestra principale è chiusa</translation>
</message>
<message>
<source>Exit</source>
<translation type="unfinished">Esci</translation>
</message>
<message>
<source>Send to background</source>
<translation type="unfinished">Invia in background</translation>
</message>
</context>
<context>
<name>StatusBar</name>

View File

@ -1091,10 +1091,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Prevent this computer from going to sleep</source>
<translation></translation>
</message>
<message>
<source>Leave app running in notification area when the window is closed</source>
<translation></translation>
</message>
<message>
<source>Tray icon style</source>
<translation></translation>
@ -1299,6 +1295,18 @@ Enabling this setting will disable the server config GUI.</source>
<source>&amp;Window</source>
<translation type="unfinished">(&amp;W)</translation>
</message>
<message>
<source>When the main window is closed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Exit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Send to background</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StatusBar</name>

View File

@ -1089,10 +1089,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Prevent this computer from going to sleep</source>
<translation> </translation>
</message>
<message>
<source>Leave app running in notification area when the window is closed</source>
<translation> </translation>
</message>
<message>
<source>Tray icon style</source>
<translation> </translation>
@ -1297,6 +1293,18 @@ Enabling this setting will disable the server config GUI.</source>
<source>&amp;Window</source>
<translation type="unfinished">(&amp;W)</translation>
</message>
<message>
<source>When the main window is closed</source>
<translation type="unfinished"> </translation>
</message>
<message>
<source>Exit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Send to background</source>
<translation type="unfinished"> </translation>
</message>
</context>
<context>
<name>StatusBar</name>

View File

@ -1087,10 +1087,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Prevent this computer from going to sleep</source>
<translation>Запретить компьютеру переходить в спящий режим</translation>
</message>
<message>
<source>Leave app running in notification area when the window is closed</source>
<translation>Оставлять приложение в области уведомлений при закрытии окна</translation>
</message>
<message>
<source>Tray icon style</source>
<translation>Стиль иконки трея</translation>
@ -1295,6 +1291,18 @@ Enabling this setting will disable the server config GUI.</source>
<source>&amp;Window</source>
<translation type="unfinished">&amp;Окно</translation>
</message>
<message>
<source>When the main window is closed</source>
<translation type="unfinished">Когда главное окно закрыто</translation>
</message>
<message>
<source>Exit</source>
<translation type="unfinished">Выход</translation>
</message>
<message>
<source>Send to background</source>
<translation type="unfinished">Отправить в фоновый режим</translation>
</message>
</context>
<context>
<name>StatusBar</name>

View File

@ -1091,10 +1091,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Prevent this computer from going to sleep</source>
<translation></translation>
</message>
<message>
<source>Leave app running in notification area when the window is closed</source>
<translation></translation>
</message>
<message>
<source>Tray icon style</source>
<translation></translation>
@ -1299,6 +1295,18 @@ Enabling this setting will disable the server config GUI.</source>
<source>&amp;Window</source>
<translation type="unfinished">(&amp;W)</translation>
</message>
<message>
<source>When the main window is closed</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Exit</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Send to background</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>StatusBar</name>