refactor: Add Tooltip to log levels and show a label with info about debug level affecting performance

fixes: #8889
This commit is contained in:
sithlord48
2025-08-25 10:07:42 -04:00
committed by Nick Bolton
parent cba3881f41
commit 4e8a67925f
3 changed files with 109 additions and 80 deletions

View File

@ -31,6 +31,17 @@ SettingsDialog::SettingsDialog(QWidget *parent, const IServerConfig &serverConfi
ui->setupUi(this);
// Set Tooltip for the logLevel Items
ui->comboLogLevel->setItemData(0, tr("Required messages"), Qt::ToolTipRole);
ui->comboLogLevel->setItemData(1, tr("Non-fatal errors"), Qt::ToolTipRole);
ui->comboLogLevel->setItemData(2, tr("General warnings"), Qt::ToolTipRole);
ui->comboLogLevel->setItemData(3, tr("Notable events"), Qt::ToolTipRole);
ui->comboLogLevel->setItemData(4, tr("General events [Default]"), Qt::ToolTipRole);
ui->comboLogLevel->setItemData(5, tr("Debug entries"), Qt::ToolTipRole);
ui->comboLogLevel->setItemData(6, tr("More debug output"), Qt::ToolTipRole);
ui->comboLogLevel->setItemData(7, tr("Verbose debug output"), Qt::ToolTipRole);
ui->lblDebugWarning->setVisible(false);
ui->comboTlsKeyLength->setItemIcon(0, QIcon::fromTheme(QStringLiteral("security-medium")));
ui->comboTlsKeyLength->setItemIcon(1, QIcon::fromTheme(QIcon::ThemeIcon::SecurityHigh));
ui->lblTlsCertInfo->setFixedSize(28, 28);
@ -66,6 +77,7 @@ void SettingsDialog::initConnections() const
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->comboLogLevel, &QComboBox::currentIndexChanged, this, &SettingsDialog::logLevelChanged);
}
void SettingsDialog::regenCertificates()
@ -278,4 +290,9 @@ void SettingsDialog::updateRequestedKeySize() const
Settings::setValue(Settings::Security::KeySize, ui->comboTlsKeyLength->currentText());
}
void SettingsDialog::logLevelChanged()
{
ui->lblDebugWarning->setVisible(ui->comboLogLevel->currentIndex() > 4);
}
SettingsDialog::~SettingsDialog() = default;

View File

@ -58,6 +58,9 @@ private:
/// @brief updates the setting vaule for key size.
void updateRequestedKeySize() const;
/// @brief update if the log level warning is shown
void logLevelChanged();
std::unique_ptr<Ui::SettingsDialog> ui;
const IServerConfig &m_serverConfig;
const CoreProcess &m_coreProcess;

View File

@ -394,86 +394,9 @@
</property>
<layout class="QGridLayout" name="_3">
<property name="verticalSpacing">
<number>7</number>
<number>9</number>
</property>
<item row="0" 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="0" column="0">
<widget class="QCheckBox" name="cbLogToFile">
<property name="text">
<string>Log to file</string>
</property>
</widget>
</item>
<item row="0" 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="0" 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="1" column="0" colspan="4">
<item row="7" column="0" colspan="4">
<widget class="QWidget" name="widgetLogFilename" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Maximum">
@ -561,6 +484,93 @@
</layout>
</widget>
</item>
<item row="2" 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="2" column="0">
<widget class="QCheckBox" name="cbLogToFile">
<property name="text">
<string>Log to file</string>
</property>
</widget>
</item>
<item row="2" 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="2" 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="8" 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>
</layout>
</widget>
</item>
@ -644,7 +654,6 @@
<tabstop>sbPort</tabstop>
<tabstop>lineInterface</tabstop>
<tabstop>cbLogToFile</tabstop>
<tabstop>comboLogLevel</tabstop>
<tabstop>lineLogFilename</tabstop>
<tabstop>btnBrowseLog</tabstop>
</tabstops>