refactor: SettingsDialog, move Log settings to own tab

This commit is contained in:
sithlord48
2026-02-16 16:29:08 -05:00
committed by Chris Rizzitello
parent 208556b5aa
commit f6348736e8
8 changed files with 266 additions and 259 deletions

View File

@ -96,7 +96,7 @@ void SettingsDialog::initConnections() const
connect(ui->comboTlsKeyLength, &QComboBox::currentIndexChanged, this, &SettingsDialog::updateRequestedKeySize);
connect(ui->btnTlsCertPath, &QPushButton::clicked, this, &SettingsDialog::browseCertificatePath);
connect(ui->btnBrowseLog, &QPushButton::clicked, this, &SettingsDialog::browseLogPath);
connect(ui->cbLogToFile, &QCheckBox::toggled, this, &SettingsDialog::setLogToFile);
connect(ui->groupLogToFile, &QGroupBox::toggled, this, &SettingsDialog::setLogToFile);
connect(ui->comboLogLevel, &QComboBox::currentIndexChanged, this, &SettingsDialog::logLevelChanged);
connect(ui->comboLanguage, &QComboBox::currentTextChanged, this, [](const QString &lang) {
const auto shortName = I18N::nativeTo639Name(lang);
@ -110,7 +110,6 @@ 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->cbLogToFile, &QCheckBox::toggled, 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);
@ -120,6 +119,7 @@ void SettingsDialog::initConnections() const
connect(ui->cbUseWlClipboard, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons);
connect(ui->cbShowVersion, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons);
connect(ui->cbRequireClientCert, &QCheckBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons);
connect(ui->groupLogToFile, &QGroupBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons);
connect(ui->groupService, &QGroupBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons);
connect(ui->groupSecurity, &QGroupBox::toggled, this, &SettingsDialog::setButtonBoxEnabledButtons);
connect(ui->lineLogFilename, &QLineEdit::textChanged, this, &SettingsDialog::setButtonBoxEnabledButtons);
@ -203,7 +203,7 @@ void SettingsDialog::accept()
Settings::setValue(Settings::Core::Port, ui->sbPort->value());
Settings::setValue(Settings::Core::Interface, ui->comboInterface->currentData());
Settings::setValue(Settings::Log::Level, ui->comboLogLevel->currentIndex());
Settings::setValue(Settings::Log::ToFile, ui->cbLogToFile->isChecked());
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());
@ -234,7 +234,7 @@ void SettingsDialog::loadFromConfig()
{
ui->sbPort->setValue(Settings::value(Settings::Core::Port).toInt());
ui->comboLogLevel->setCurrentIndex(Settings::value(Settings::Log::Level).toInt());
ui->cbLogToFile->setChecked(Settings::value(Settings::Log::ToFile).toBool());
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());
@ -324,14 +324,14 @@ void SettingsDialog::updateControls()
{
const bool writable = Settings::isWritable();
const bool serviceChecked = ui->groupService->isChecked();
const bool logToFile = ui->cbLogToFile->isChecked();
const bool logToFile = ui->groupLogToFile->isChecked();
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(writable);
ui->sbPort->setEnabled(writable);
ui->comboInterface->setEnabled(writable);
ui->comboLogLevel->setEnabled(writable);
ui->cbLogToFile->setEnabled(writable);
ui->groupLogToFile->setEnabled(writable);
ui->cbAutoHide->setEnabled(writable);
ui->cbAutoUpdate->setEnabled(writable);
ui->cbPreventSleep->setEnabled(writable);
@ -381,7 +381,7 @@ bool SettingsDialog::isModified() const
return (
(ui->sbPort->value() != Settings::value(Settings::Core::Port).toInt()) ||
(ui->comboLogLevel->currentIndex() != Settings::value(Settings::Log::Level).toInt()) ||
(ui->cbLogToFile->isChecked() != Settings::value(Settings::Log::ToFile).toBool()) ||
(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->cbPreventSleep->isChecked() != Settings::value(Settings::Core::PreventSleep).toBool()) ||
@ -409,7 +409,7 @@ bool SettingsDialog::isDefault() const
return (
(ui->sbPort->value() == Settings::defaultValue(Settings::Core::Port).toInt()) &&
(ui->comboLogLevel->currentIndex() == Settings::defaultValue(Settings::Log::Level).toInt()) &&
(ui->cbLogToFile->isChecked() == Settings::defaultValue(Settings::Log::ToFile).toBool()) &&
(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->cbPreventSleep->isChecked() == Settings::defaultValue(Settings::Core::PreventSleep).toBool()) &&
@ -434,7 +434,7 @@ void SettingsDialog::resetToDefault()
{
ui->sbPort->setValue(Settings::defaultValue(Settings::Core::Port).toInt());
ui->comboLogLevel->setCurrentIndex(Settings::defaultValue(Settings::Log::Level).toInt());
ui->cbLogToFile->setChecked(Settings::defaultValue(Settings::Log::ToFile).toBool());
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());

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>549</width>
<height>755</height>
<height>529</height>
</rect>
</property>
<property name="windowTitle">
@ -278,7 +278,214 @@
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
<height>0</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<widget class="QWidget" name="tabLog">
<attribute name="title">
<string>&amp;Logs</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>12</number>
</property>
<property name="topMargin">
<number>25</number>
</property>
<property name="rightMargin">
<number>12</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="lblLogLevel">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Level</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboLogLevel">
<item>
<property name="text">
<string>Fatal</string>
</property>
</item>
<item>
<property name="text">
<string>Error</string>
</property>
</item>
<item>
<property name="text">
<string>Warning</string>
</property>
</item>
<item>
<property name="text">
<string>Note</string>
</property>
</item>
<item>
<property name="text">
<string>Info</string>
</property>
</item>
<item>
<property name="text">
<string>Debug</string>
</property>
</item>
<item>
<property name="text">
<string>Debug1</string>
</property>
</item>
<item>
<property name="text">
<string>Debug2</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QGroupBox" name="groupLogToFile">
<property name="title">
<string>Log to file</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QWidget" name="widgetLogFilename" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="_4">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labelLogPath">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Log path</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>17</width>
<height>25</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="lineLogFilename">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBrowseLog">
<property name="enabled">
<bool>true</bool>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="QIcon::ThemeIcon::DocumentOpen"/>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QCheckBox" name="cbGuiDebug">
<property name="text">
<string>Enable GUI debug messages</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lblDebugWarning">
<property name="text">
<string>Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_4">
<property name="orientation">
<enum>Qt::Orientation::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>0</height>
</size>
</property>
</spacer>
@ -400,206 +607,6 @@
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupLogs">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="title">
<string>Logs</string>
</property>
<layout class="QGridLayout" name="_3">
<property name="verticalSpacing">
<number>9</number>
</property>
<item row="3" column="2">
<widget class="QLabel" name="lblLogLevel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Level</string>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QComboBox" name="comboLogLevel">
<item>
<property name="text">
<string>Fatal</string>
</property>
</item>
<item>
<property name="text">
<string>Error</string>
</property>
</item>
<item>
<property name="text">
<string>Warning</string>
</property>
</item>
<item>
<property name="text">
<string>Note</string>
</property>
</item>
<item>
<property name="text">
<string>Info</string>
</property>
</item>
<item>
<property name="text">
<string>Debug</string>
</property>
</item>
<item>
<property name="text">
<string>Debug1</string>
</property>
</item>
<item>
<property name="text">
<string>Debug2</string>
</property>
</item>
</widget>
</item>
<item row="8" column="0" colspan="4">
<widget class="QWidget" name="widgetLogFilename" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<layout class="QHBoxLayout" name="_4">
<property name="spacing">
<number>3</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labelLogPath">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>Log path</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_7">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Policy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLineEdit" name="lineLogFilename">
<property name="enabled">
<bool>true</bool>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btnBrowseLog">
<property name="enabled">
<bool>true</bool>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="text">
<string/>
</property>
<property name="icon">
<iconset theme="QIcon::ThemeIcon::DocumentOpen"/>
</property>
<property name="flat">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="cbLogToFile">
<property name="text">
<string>Log to file</string>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="horizontalSpacer_5">
<property name="orientation">
<enum>Qt::Orientation::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="9" column="0" colspan="4">
<widget class="QLabel" name="lblDebugWarning">
<property name="text">
<string>Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="4">
<widget class="QCheckBox" name="cbGuiDebug">
<property name="text">
<string>Enable GUI debug messages</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupService">
<property name="enabled">

View File

@ -1223,18 +1223,10 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU
<source>Network IP</source>
<translation type="unfinished">IP de red</translation>
</message>
<message>
<source>Logs</source>
<translation type="unfinished">Registros</translation>
</message>
<message>
<source>Log path</source>
<translation type="unfinished">Ruta de registro</translation>
</message>
<message>
<source>Log to file</source>
<translation type="unfinished">Registrar en archivo</translation>
</message>
<message>
<source>Fatal</source>
<translation type="unfinished">Fatal</translation>
@ -1375,6 +1367,14 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU
<source>Include version in the window title</source>
<translation type="unfinished">Incluir la versión en el título de la ventana</translation>
</message>
<message>
<source>Log to file</source>
<translation>Registrar en archivo</translation>
</message>
<message>
<source>&amp;Logs</source>
<translation>&amp;Registro</translation>
</message>
</context>
<context>
<name>i18n</name>

View File

@ -1223,18 +1223,10 @@ L&apos;abilitazione di questa impostazione disabiliterà l&apos;interfaccia graf
<source>Network IP</source>
<translation>IP di rete</translation>
</message>
<message>
<source>Logs</source>
<translation>Log</translation>
</message>
<message>
<source>Log path</source>
<translation>Percorso log</translation>
</message>
<message>
<source>Log to file</source>
<translation>Salva log su file</translation>
</message>
<message>
<source>Fatal</source>
<translation>Fatale</translation>
@ -1375,6 +1367,14 @@ L&apos;abilitazione di questa impostazione disabiliterà l&apos;interfaccia graf
<source>Include version in the window title</source>
<translation type="unfinished">Includi la versione nel titolo della finestra</translation>
</message>
<message>
<source>Log to file</source>
<translation>Salva log su file</translation>
</message>
<message>
<source>&amp;Logs</source>
<translation>&amp;Logs</translation>
</message>
</context>
<context>
<name>i18n</name>

View File

@ -1224,10 +1224,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Network IP</source>
<translation>IPアドレス</translation>
</message>
<message>
<source>Logs</source>
<translation></translation>
</message>
<message>
<source>Level</source>
<translation></translation>
@ -1268,10 +1264,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Log path</source>
<translation></translation>
</message>
<message>
<source>Log to file</source>
<translation></translation>
</message>
<message>
<source>Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report.</source>
<translation>使</translation>
@ -1376,6 +1368,14 @@ Enabling this setting will disable the server config GUI.</source>
<source>Include version in the window title</source>
<translation></translation>
</message>
<message>
<source>Log to file</source>
<translation></translation>
</message>
<message>
<source>&amp;Logs</source>
<translation>(&amp;L)</translation>
</message>
</context>
<context>
<name>i18n</name>

View File

@ -1222,10 +1222,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Network IP</source>
<translation> IP</translation>
</message>
<message>
<source>Logs</source>
<translation></translation>
</message>
<message>
<source>Level</source>
<translation></translation>
@ -1266,10 +1262,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Log path</source>
<translation> </translation>
</message>
<message>
<source>Log to file</source>
<translation> </translation>
</message>
<message>
<source>Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report.</source>
<translation> . .</translation>
@ -1374,6 +1366,14 @@ Enabling this setting will disable the server config GUI.</source>
<source>Include version in the window title</source>
<translation type="unfinished"> </translation>
</message>
<message>
<source>Log to file</source>
<translation> </translation>
</message>
<message>
<source>&amp;Logs</source>
<translation> (&amp;L)</translation>
</message>
</context>
<context>
<name>i18n</name>

View File

@ -1222,10 +1222,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Network IP</source>
<translation>Сетевой IP-адрес</translation>
</message>
<message>
<source>Logs</source>
<translation>Журналы</translation>
</message>
<message>
<source>Level</source>
<translation>Уровень</translation>
@ -1266,10 +1262,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Log path</source>
<translation>Путь к журналам</translation>
</message>
<message>
<source>Log to file</source>
<translation>Записывать в файл</translation>
</message>
<message>
<source>Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report.</source>
<translation>Уровень отладки может повлиять на производительность. Используйте его только для поиска неисправностей.</translation>
@ -1374,6 +1366,14 @@ Enabling this setting will disable the server config GUI.</source>
<source>Include version in the window title</source>
<translation type="unfinished">Включить номер версии в заголовок окна</translation>
</message>
<message>
<source>Log to file</source>
<translation>Записывать в файл</translation>
</message>
<message>
<source>&amp;Logs</source>
<translation>&amp;Журнал</translation>
</message>
</context>
<context>
<name>i18n</name>

View File

@ -1224,10 +1224,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Network IP</source>
<translation> IP</translation>
</message>
<message>
<source>Logs</source>
<translation></translation>
</message>
<message>
<source>Level</source>
<translation></translation>
@ -1268,10 +1264,6 @@ Enabling this setting will disable the server config GUI.</source>
<source>Log path</source>
<translation></translation>
</message>
<message>
<source>Log to file</source>
<translation></translation>
</message>
<message>
<source>Using a Debug log level may affect performance. Only use a Debug level if you are attempting to debug an issue or are gathering logs to submit with a bug report.</source>
<translation>使 Bug 使</translation>
@ -1376,6 +1368,14 @@ Enabling this setting will disable the server config GUI.</source>
<source>Include version in the window title</source>
<translation type="unfinished"></translation>
</message>
<message>
<source>Log to file</source>
<translation></translation>
</message>
<message>
<source>&amp;Logs</source>
<translation type="unfinished">(&amp;L)</translation>
</message>
</context>
<context>
<name>i18n</name>