refactor: Move the clear settings menu action to the settings dialog Advanced tab

This commit is contained in:
sithlord48 2026-08-05 22:44:43 -04:00 committed by Nick Bolton
parent 0c902e0557
commit 7ca8157bd2
11 changed files with 37 additions and 33 deletions

View file

@ -70,7 +70,6 @@ MainWindow::MainWindow()
m_menuView{new QMenu(this)}, m_menuView{new QMenu(this)},
m_menuHelp{new QMenu(this)}, m_menuHelp{new QMenu(this)},
m_actionAbout{new QAction(this)}, m_actionAbout{new QAction(this)},
m_actionClearSettings{new QAction(this)},
m_actionMinimize{new QAction(this)}, m_actionMinimize{new QAction(this)},
m_actionQuit{new QAction(this)}, m_actionQuit{new QAction(this)},
m_actionTrayQuit{new QAction(this)}, m_actionTrayQuit{new QAction(this)},
@ -106,9 +105,6 @@ MainWindow::MainWindow()
m_actionTrayQuit->setIcon(QIcon::fromTheme("application-exit")); m_actionTrayQuit->setIcon(QIcon::fromTheme("application-exit"));
m_actionTrayQuit->setMenuRole(QAction::NoRole); m_actionTrayQuit->setMenuRole(QAction::NoRole);
m_actionClearSettings->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-all")));
m_actionClearSettings->setMenuRole(QAction::NoRole);
m_actionSettings->setIcon(QIcon::fromTheme(QStringLiteral("configure"))); m_actionSettings->setIcon(QIcon::fromTheme(QStringLiteral("configure")));
m_actionSettings->setMenuRole(QAction::PreferencesRole); m_actionSettings->setMenuRole(QAction::PreferencesRole);
@ -259,7 +255,6 @@ void MainWindow::connectSlots()
connect(&m_coreProcess, &CoreProcess::securityLevelChanged, m_statusBar, &StatusBar::setSecurityLevel); connect(&m_coreProcess, &CoreProcess::securityLevelChanged, m_statusBar, &StatusBar::setSecurityLevel);
connect(m_actionAbout, &QAction::triggered, this, &MainWindow::openAboutDialog); connect(m_actionAbout, &QAction::triggered, this, &MainWindow::openAboutDialog);
connect(m_actionClearSettings, &QAction::triggered, this, &MainWindow::clearSettings);
connect(m_actionMinimize, &QAction::triggered, this, &MainWindow::hide); connect(m_actionMinimize, &QAction::triggered, this, &MainWindow::hide);
connect(m_actionQuit, &QAction::triggered, this, &MainWindow::close); connect(m_actionQuit, &QAction::triggered, this, &MainWindow::close);
@ -476,8 +471,10 @@ void MainWindow::openSettings()
{ {
auto dialog = SettingsDialog(this, m_serverConfig); auto dialog = SettingsDialog(this, m_serverConfig);
connect(&dialog, &SettingsDialog::requestRemoveAllSettings, this, &MainWindow::clearSettings, Qt::UniqueConnection);
if (dialog.exec() == QDialog::Accepted) { if (dialog.exec() == QDialog::Accepted) {
Settings::save(); Settings::save();
disconnect(&dialog, &SettingsDialog::requestRemoveAllSettings, nullptr, nullptr);
applyConfig(); applyConfig();
@ -675,8 +672,6 @@ void MainWindow::createMenuBar()
m_menuHelp->addAction(m_actionAbout); m_menuHelp->addAction(m_actionAbout);
m_menuHelp->addAction(m_actionShowHelp); m_menuHelp->addAction(m_actionShowHelp);
m_menuHelp->addSeparator();
m_menuHelp->addAction(m_actionClearSettings);
auto menuBar = new QMenuBar(this); auto menuBar = new QMenuBar(this);
menuBar->addMenu(m_menuFile); menuBar->addMenu(m_menuFile);
@ -1060,7 +1055,6 @@ void MainWindow::updateText()
m_menuView->setTitle(tr("&View")); m_menuView->setTitle(tr("&View"));
m_menuHelp->setTitle(tr("&Help")); m_menuHelp->setTitle(tr("&Help"));
m_actionClearSettings->setText(tr("Clear settings"));
m_actionMinimize->setText(tr("&Minimize to tray")); m_actionMinimize->setText(tr("&Minimize to tray"));
m_actionQuit->setText(tr("&Quit")); m_actionQuit->setText(tr("&Quit"));
m_actionTrayQuit->setText(tr("&Quit")); m_actionTrayQuit->setText(tr("&Quit"));

View file

@ -193,7 +193,6 @@ private:
// Window Actions // Window Actions
QAction *m_actionAbout = nullptr; QAction *m_actionAbout = nullptr;
QAction *m_actionClearSettings = nullptr;
QAction *m_actionMinimize = nullptr; QAction *m_actionMinimize = nullptr;
QAction *m_actionQuit = nullptr; QAction *m_actionQuit = nullptr;
QAction *m_actionTrayQuit = nullptr; QAction *m_actionTrayQuit = nullptr;

View file

@ -44,6 +44,8 @@ SettingsDialog::SettingsDialog(QWidget *parent, const ServerConfig &serverConfig
updateText(); updateText();
ui->btnClearAllSettings->setIcon(QIcon::fromTheme(QStringLiteral("edit-clear-all")));
ui->comboTlsKeyLength->setItemIcon(0, QIcon::fromTheme(QStringLiteral("security-medium"))); ui->comboTlsKeyLength->setItemIcon(0, QIcon::fromTheme(QStringLiteral("security-medium")));
ui->comboTlsKeyLength->setItemIcon(1, QIcon::fromTheme(QIcon::ThemeIcon::SecurityHigh)); ui->comboTlsKeyLength->setItemIcon(1, QIcon::fromTheme(QIcon::ThemeIcon::SecurityHigh));
ui->lblTlsCertInfo->setFixedSize(28, 28); ui->lblTlsCertInfo->setFixedSize(28, 28);
@ -107,6 +109,7 @@ void SettingsDialog::initConnections() const
connect(ui->groupSecurity, &QGroupBox::toggled, this, &SettingsDialog::updateTlsControlsEnabled); connect(ui->groupSecurity, &QGroupBox::toggled, this, &SettingsDialog::updateTlsControlsEnabled);
connect(ui->groupService, &QGroupBox::toggled, this, &SettingsDialog::updateControls); connect(ui->groupService, &QGroupBox::toggled, this, &SettingsDialog::updateControls);
connect(ui->btnClearAllSettings, &QPushButton::clicked, this, &SettingsDialog::requestRemoveAllSettings);
connect(ui->btnTlsRegenCert, &QPushButton::clicked, this, &SettingsDialog::regenCertificates); connect(ui->btnTlsRegenCert, &QPushButton::clicked, this, &SettingsDialog::regenCertificates);
connect(ui->comboTlsKeyLength, &QComboBox::currentIndexChanged, this, &SettingsDialog::updateRequestedKeySize); connect(ui->comboTlsKeyLength, &QComboBox::currentIndexChanged, this, &SettingsDialog::updateRequestedKeySize);
connect(ui->btnTlsCertPath, &QPushButton::clicked, this, &SettingsDialog::browseCertificatePath); connect(ui->btnTlsCertPath, &QPushButton::clicked, this, &SettingsDialog::browseCertificatePath);

View file

@ -26,6 +26,7 @@ public:
Q_SIGNALS: Q_SIGNALS:
void shown(); void shown();
void requestRemoveAllSettings();
protected: protected:
void changeEvent(QEvent *e) override; void changeEvent(QEvent *e) override;

View file

@ -853,6 +853,13 @@
</property> </property>
</spacer> </spacer>
</item> </item>
<item>
<widget class="QPushButton" name="btnClearAllSettings">
<property name="text">
<string>Remove all settings</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</widget> </widget>

View file

@ -380,10 +380,6 @@ Do you want to connect to the server?
<source>Restart</source> <source>Restart</source>
<translation type="unfinished">Reanudar</translation> <translation type="unfinished">Reanudar</translation>
</message> </message>
<message>
<source>Clear settings</source>
<translation type="unfinished">Borrar configuración</translation>
</message>
<message> <message>
<source>&amp;Minimize to tray</source> <source>&amp;Minimize to tray</source>
<translation type="unfinished">&amp;Minimizar a la bandeja</translation> <translation type="unfinished">&amp;Minimizar a la bandeja</translation>
@ -1295,6 +1291,10 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU
<source>Using a log level higher than Info may affect performance.</source> <source>Using a log level higher than Info may affect performance.</source>
<translation type="unfinished">Utilizar un nivel de registro superior a Info puede afectar el rendimiento.</translation> <translation type="unfinished">Utilizar un nivel de registro superior a Info puede afectar el rendimiento.</translation>
</message> </message>
<message>
<source>Remove all settings</source>
<translation type="unfinished">Eliminar todas las configuraciones</translation>
</message>
</context> </context>
<context> <context>
<name>StatusBar</name> <name>StatusBar</name>

View file

@ -368,10 +368,6 @@ Vuoi connetterti al server?
<source>Restart</source> <source>Restart</source>
<translation>Riavvia</translation> <translation>Riavvia</translation>
</message> </message>
<message>
<source>Clear settings</source>
<translation>Cancella impostazioni</translation>
</message>
<message> <message>
<source>&amp;Minimize to tray</source> <source>&amp;Minimize to tray</source>
<translation>&amp;Minimizza a icona</translation> <translation>&amp;Minimizza a icona</translation>
@ -1295,6 +1291,10 @@ L&apos;abilitazione di questa impostazione disabiliterà l&apos;interfaccia graf
<source>Using a log level higher than Info may affect performance.</source> <source>Using a log level higher than Info may affect performance.</source>
<translation type="unfinished">L&apos;utilizzo di un livello di log superiore a Info potrebbe influire sulle prestazioni.</translation> <translation type="unfinished">L&apos;utilizzo di un livello di log superiore a Info potrebbe influire sulle prestazioni.</translation>
</message> </message>
<message>
<source>Remove all settings</source>
<translation type="unfinished">Rimuovi tutte le impostazioni</translation>
</message>
</context> </context>
<context> <context>
<name>StatusBar</name> <name>StatusBar</name>

View file

@ -482,10 +482,6 @@ A bound IP is now invalid, you may need to restart the server.</source>
<source>&amp;Help</source> <source>&amp;Help</source>
<translation>ヘルプ(&amp;H)</translation> <translation>ヘルプ(&amp;H)</translation>
</message> </message>
<message>
<source>Clear settings</source>
<translation>設定を消去</translation>
</message>
<message> <message>
<source>&amp;Minimize to tray</source> <source>&amp;Minimize to tray</source>
<translation>トレイに最小化(&amp;M)</translation> <translation>トレイに最小化(&amp;M)</translation>
@ -1297,6 +1293,10 @@ Enabling this setting will disable the server config GUI.</source>
<source>Using a log level higher than Info may affect performance.</source> <source>Using a log level higher than Info may affect performance.</source>
<translation>Infoよりも高いログレベルを使用すると、パフォーマンスに影響を及ぼす可能性があります。</translation> <translation>Infoよりも高いログレベルを使用すると、パフォーマンスに影響を及ぼす可能性があります。</translation>
</message> </message>
<message>
<source>Remove all settings</source>
<translation type="unfinished">すべての設定を削除する</translation>
</message>
</context> </context>
<context> <context>
<name>StatusBar</name> <name>StatusBar</name>

View file

@ -482,10 +482,6 @@ A bound IP is now invalid, you may need to restart the server.</source>
<source>&amp;Help</source> <source>&amp;Help</source>
<translation>도움말(&amp;H)</translation> <translation>도움말(&amp;H)</translation>
</message> </message>
<message>
<source>Clear settings</source>
<translation>설정 초기화</translation>
</message>
<message> <message>
<source>&amp;Minimize to tray</source> <source>&amp;Minimize to tray</source>
<translation>트레이로 최소화(&amp;M)</translation> <translation>트레이로 최소화(&amp;M)</translation>
@ -1295,6 +1291,10 @@ Enabling this setting will disable the server config GUI.</source>
<source>Using a log level higher than Info may affect performance.</source> <source>Using a log level higher than Info may affect performance.</source>
<translation type="unfinished">Info보다 높은 로그 레벨을 사용하면 성능에 영향을 미칠 수 있습니다.</translation> <translation type="unfinished">Info보다 높은 로그 레벨을 사용하면 성능에 영향을 미칠 수 있습니다.</translation>
</message> </message>
<message>
<source>Remove all settings</source>
<translation type="unfinished">모든 설정 제거</translation>
</message>
</context> </context>
<context> <context>
<name>StatusBar</name> <name>StatusBar</name>

View file

@ -482,10 +482,6 @@ A bound IP is now invalid, you may need to restart the server.</source>
<source>&amp;Help</source> <source>&amp;Help</source>
<translation>&amp;Справка</translation> <translation>&amp;Справка</translation>
</message> </message>
<message>
<source>Clear settings</source>
<translation>Сбросить настройки</translation>
</message>
<message> <message>
<source>&amp;Minimize to tray</source> <source>&amp;Minimize to tray</source>
<translation>&amp;Свернуть в трей</translation> <translation>&amp;Свернуть в трей</translation>
@ -1293,6 +1289,10 @@ Enabling this setting will disable the server config GUI.</source>
<source>Using a log level higher than Info may affect performance.</source> <source>Using a log level higher than Info may affect performance.</source>
<translation type="unfinished">Использование уровня логирования выше Info может повлиять на производительность.</translation> <translation type="unfinished">Использование уровня логирования выше Info может повлиять на производительность.</translation>
</message> </message>
<message>
<source>Remove all settings</source>
<translation type="unfinished">Удалить все настройки</translation>
</message>
</context> </context>
<context> <context>
<name>StatusBar</name> <name>StatusBar</name>

View file

@ -482,10 +482,6 @@ A bound IP is now invalid, you may need to restart the server.</source>
<source>&amp;Help</source> <source>&amp;Help</source>
<translation>帮助(&amp;H)</translation> <translation>帮助(&amp;H)</translation>
</message> </message>
<message>
<source>Clear settings</source>
<translation>清除设置</translation>
</message>
<message> <message>
<source>&amp;Minimize to tray</source> <source>&amp;Minimize to tray</source>
<translation>最小化到托盘(&amp;M)</translation> <translation>最小化到托盘(&amp;M)</translation>
@ -1297,6 +1293,10 @@ Enabling this setting will disable the server config GUI.</source>
<source>Using a log level higher than Info may affect performance.</source> <source>Using a log level higher than Info may affect performance.</source>
<translation type="unfinished">使用高于 Info 级别的日志级别可能会影响性能。</translation> <translation type="unfinished">使用高于 Info 级别的日志级别可能会影响性能。</translation>
</message> </message>
<message>
<source>Remove all settings</source>
<translation type="unfinished">移除所有设置</translation>
</message>
</context> </context>
<context> <context>
<name>StatusBar</name> <name>StatusBar</name>