diff --git a/src/lib/gui/dialogs/SettingsDialog.cpp b/src/lib/gui/dialogs/SettingsDialog.cpp index 4518e5899..b3afc7e27 100644 --- a/src/lib/gui/dialogs/SettingsDialog.cpp +++ b/src/lib/gui/dialogs/SettingsDialog.cpp @@ -200,13 +200,22 @@ void SettingsDialog::showReadOnlyMessage() void SettingsDialog::updateText() { - // 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("General events [Default]"), Qt::ToolTipRole); - ui->comboLogLevel->setItemData(4, tr("Debug entries"), Qt::ToolTipRole); - ui->comboLogLevel->setItemData(5, tr("Verbose debug output"), Qt::ToolTipRole); + const auto logLevelNames = LogLevel::logLevelNames(); + const QStringList toolTips = {tr("Required messages"), tr("Non-fatal errors"), tr("General warnings"), + tr("General events [Default]"), tr("Debug entries"), tr("Verbose debug output")}; + if (ui->comboLogLevel->count() == 0) { + const auto logLevelOptions = LogLevel::logLevelOptions(); + for (int i = 0; i < logLevelNames.count(); i++) { + ui->comboLogLevel->addItem(logLevelNames.at(i)); + ui->comboLogLevel->setItemData(i, logLevelOptions.at(i), Qt::UserRole); + ui->comboLogLevel->setItemData(i, toolTips.at(i), Qt::ToolTipRole); + } + } else { + for (int i = 0; i < logLevelNames.count(); i++) { + ui->comboLogLevel->setItemData(i, logLevelNames.at(i), Qt::DisplayRole); + ui->comboLogLevel->setItemData(i, toolTips.at(i), Qt::ToolTipRole); + } + } ui->buttonBox->button(QDialogButtonBox::Save)->setToolTip(tr("Close and save changes")); ui->buttonBox->button(QDialogButtonBox::Cancel)->setToolTip(tr("Close and forget changes")); ui->buttonBox->button(QDialogButtonBox::Reset)->setToolTip(tr("Reset to stored values")); @@ -217,9 +226,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, LogLevel::toOption(static_cast(ui->comboLogLevel->currentIndex())) - ); + Settings::setValue(Settings::Log::Level, ui->comboLogLevel->currentData()); Settings::setValue(Settings::Log::ToFile, ui->groupLogToFile->isChecked()); Settings::setValue(Settings::Log::File, ui->lineLogFilename->text()); Settings::setValue(Settings::Daemon::Elevate, ui->cbElevateDaemon->isChecked()); @@ -254,7 +261,9 @@ void SettingsDialog::accept() void SettingsDialog::loadFromConfig() { ui->sbPort->setValue(Settings::value(Settings::Core::Port).toInt()); - ui->comboLogLevel->setCurrentIndex(static_cast(LogLevel::fromOption(Settings::logLevelText()))); + ui->comboLogLevel->setCurrentIndex( + ui->comboLogLevel->findData(Settings::logLevelText(), Qt::UserRole, Qt::MatchFixedString) + ); ui->groupLogToFile->setChecked(Settings::value(Settings::Log::ToFile).toBool()); ui->lineLogFilename->setText(Settings::value(Settings::Log::File).toString()); ui->cbPreventSleep->setChecked(Settings::value(Settings::Core::PreventSleep).toBool()); @@ -424,7 +433,7 @@ bool SettingsDialog::isModified() const bool modified = (ui->sbPort->value() != Settings::value(Settings::Core::Port).toInt()) || - (ui->comboLogLevel->currentIndex() != static_cast(LogLevel::fromOption(Settings::logLevelText()))) || + (ui->comboLogLevel->currentData() != Settings::logLevelText()) || (ui->groupLogToFile->isChecked() != Settings::value(Settings::Log::ToFile).toBool()) || (ui->lineLogFilename->text() != Settings::value(Settings::Log::File).toString()) || (ui->rbAutoHide->isChecked() != Settings::value(Settings::Gui::Autohide).toBool()) || diff --git a/src/lib/gui/dialogs/SettingsDialog.ui b/src/lib/gui/dialogs/SettingsDialog.ui index f15554cf5..ae33488fc 100644 --- a/src/lib/gui/dialogs/SettingsDialog.ui +++ b/src/lib/gui/dialogs/SettingsDialog.ui @@ -25,6 +25,9 @@ + + 2 + &General @@ -300,38 +303,7 @@ - - - - Fatal - - - - - Error - - - - - Warning - - - - - Info - - - - - Debug - - - - - Trace - - - + diff --git a/translations/deskflow_es.ts b/translations/deskflow_es.ts index 1884479fb..7499eaa6e 100644 --- a/translations/deskflow_es.ts +++ b/translations/deskflow_es.ts @@ -1176,26 +1176,6 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU Log path Ruta de registro - - Fatal - Fatal - - - Error - Error - - - Warning - Advertencia - - - Info - Información - - - Debug - Depurar - Level Nivel @@ -1336,10 +1316,6 @@ Al habilitar esta opción, se deshabilitará la interfaz gráfica de usuario (GU Run command on exit Ejecutar comando al salir - - Trace - Rastro - Using a log level higher than Info may affect performance. Utilizar un nivel de registro superior a Info puede afectar el rendimiento. diff --git a/translations/deskflow_it.ts b/translations/deskflow_it.ts index ee1877cd9..2590bf2ec 100644 --- a/translations/deskflow_it.ts +++ b/translations/deskflow_it.ts @@ -1176,26 +1176,6 @@ L'abilitazione di questa impostazione disabiliterà l'interfaccia graf Log path Percorso log - - Fatal - Fatale - - - Error - Errore - - - Warning - Avviso - - - Info - Informazioni - - - Debug - Debug - Level Livello @@ -1336,10 +1316,6 @@ L'abilitazione di questa impostazione disabiliterà l'interfaccia graf Run command on exit Esegui comando all'uscita - - Trace - Traccia - Using a log level higher than Info may affect performance. L'utilizzo di un livello di log superiore a Info potrebbe influire sulle prestazioni. diff --git a/translations/deskflow_ja.ts b/translations/deskflow_ja.ts index c68e23dea..e5d5ead80 100644 --- a/translations/deskflow_ja.ts +++ b/translations/deskflow_ja.ts @@ -1178,26 +1178,6 @@ Enabling this setting will disable the server config GUI. Level レベル - - Fatal - 重大 - - - Error - エラー - - - Warning - 警告 - - - Info - 情報 - - - Debug - デバッグ - Log path ログファイルのパス @@ -1338,10 +1318,6 @@ Enabling this setting will disable the server config GUI. Run command on exit 終了時にコマンドを実行 - - Trace - トレース - Using a log level higher than Info may affect performance. Infoよりも高いログレベルを使用すると、パフォーマンスに影響を及ぼす可能性があります。 diff --git a/translations/deskflow_ko.ts b/translations/deskflow_ko.ts index 3c3b0708a..b4b4e31de 100644 --- a/translations/deskflow_ko.ts +++ b/translations/deskflow_ko.ts @@ -1176,26 +1176,6 @@ Enabling this setting will disable the server config GUI. Level 레벨 - - Fatal - 치명적 오류 - - - Error - 오류 - - - Warning - 경고 - - - Info - 정보 - - - Debug - 디버그 - Log path 로그 경로 @@ -1336,10 +1316,6 @@ Enabling this setting will disable the server config GUI. Run command on exit 종료 시 명령 실행 - - Trace - 추적하다 - Using a log level higher than Info may affect performance. Info보다 높은 로그 레벨을 사용하면 성능에 영향을 미칠 수 있습니다. diff --git a/translations/deskflow_ru.ts b/translations/deskflow_ru.ts index 62b29d24f..1259b71e6 100644 --- a/translations/deskflow_ru.ts +++ b/translations/deskflow_ru.ts @@ -1174,26 +1174,6 @@ Enabling this setting will disable the server config GUI. Level Уровень - - Fatal - Критический - - - Error - Ошибка - - - Warning - Предупреждение - - - Info - Инфо - - - Debug - Отладка - Log path Путь к журналам @@ -1334,10 +1314,6 @@ Enabling this setting will disable the server config GUI. Run command on exit Выполнить команду при выходе - - Trace - След - Using a log level higher than Info may affect performance. Использование уровня логирования выше Info может повлиять на производительность. diff --git a/translations/deskflow_zh_CN.ts b/translations/deskflow_zh_CN.ts index 9d818c250..67cdd78ae 100644 --- a/translations/deskflow_zh_CN.ts +++ b/translations/deskflow_zh_CN.ts @@ -1178,26 +1178,6 @@ Enabling this setting will disable the server config GUI. Level 级别 - - Fatal - 致命 - - - Error - 错误 - - - Warning - 警告 - - - Info - 信息 - - - Debug - 调试 - Log path 日志路径 @@ -1338,10 +1318,6 @@ Enabling this setting will disable the server config GUI. Run command on exit 退出时运行命令 - - Trace - 痕迹 - Using a log level higher than Info may affect performance. 使用高于 Info 级别的日志级别可能会影响性能。