mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-23 06:09:50 -06:00
Convert LOG_TYPE and LOG_LEVELS to enum class
This commit is contained in:
@ -62,9 +62,9 @@ void LogConfigWidget::CreateWidgets()
|
||||
m_types_list = new QListWidget;
|
||||
|
||||
const auto* const log_manager = Common::Log::LogManager::GetInstance();
|
||||
for (int i = 0; i < Common::Log::NUMBER_OF_LOGS; i++)
|
||||
for (int i = 0; i < static_cast<int>(Common::Log::LogType::NUMBER_OF_LOGS); i++)
|
||||
{
|
||||
const auto log_type = static_cast<Common::Log::LOG_TYPE>(i);
|
||||
const auto log_type = static_cast<Common::Log::LogType>(i);
|
||||
const QString full_name = QString::fromUtf8(log_manager->GetFullName(log_type));
|
||||
const QString short_name = QString::fromUtf8(log_manager->GetShortName(log_type));
|
||||
auto* widget = new QListWidgetItem(QStringLiteral("%1 (%2)").arg(full_name, short_name));
|
||||
@ -77,7 +77,7 @@ void LogConfigWidget::CreateWidgets()
|
||||
verbosity_layout->addWidget(m_verbosity_error);
|
||||
verbosity_layout->addWidget(m_verbosity_warning);
|
||||
verbosity_layout->addWidget(m_verbosity_info);
|
||||
if constexpr (Common::Log::MAX_LOGLEVEL == Common::Log::LOG_LEVELS::LDEBUG)
|
||||
if constexpr (Common::Log::MAX_LOGLEVEL == Common::Log::LogLevel::LDEBUG)
|
||||
{
|
||||
verbosity_layout->addWidget(m_verbosity_debug);
|
||||
}
|
||||
@ -139,12 +139,12 @@ void LogConfigWidget::LoadSettings()
|
||||
setFloating(settings.value(QStringLiteral("logconfigwidget/floating")).toBool());
|
||||
|
||||
// Config - Verbosity
|
||||
const Common::Log::LOG_LEVELS verbosity = log_manager->GetLogLevel();
|
||||
m_verbosity_notice->setChecked(verbosity == Common::Log::LOG_LEVELS::LNOTICE);
|
||||
m_verbosity_error->setChecked(verbosity == Common::Log::LOG_LEVELS::LERROR);
|
||||
m_verbosity_warning->setChecked(verbosity == Common::Log::LOG_LEVELS::LWARNING);
|
||||
m_verbosity_info->setChecked(verbosity == Common::Log::LOG_LEVELS::LINFO);
|
||||
m_verbosity_debug->setChecked(verbosity == Common::Log::LOG_LEVELS::LDEBUG);
|
||||
const Common::Log::LogLevel verbosity = log_manager->GetLogLevel();
|
||||
m_verbosity_notice->setChecked(verbosity == Common::Log::LogLevel::LNOTICE);
|
||||
m_verbosity_error->setChecked(verbosity == Common::Log::LogLevel::LERROR);
|
||||
m_verbosity_warning->setChecked(verbosity == Common::Log::LogLevel::LWARNING);
|
||||
m_verbosity_info->setChecked(verbosity == Common::Log::LogLevel::LINFO);
|
||||
m_verbosity_debug->setChecked(verbosity == Common::Log::LogLevel::LDEBUG);
|
||||
|
||||
// Config - Outputs
|
||||
m_out_file->setChecked(log_manager->IsListenerEnabled(Common::Log::LogListener::FILE_LISTENER));
|
||||
@ -154,9 +154,9 @@ void LogConfigWidget::LoadSettings()
|
||||
log_manager->IsListenerEnabled(Common::Log::LogListener::LOG_WINDOW_LISTENER));
|
||||
|
||||
// Config - Log Types
|
||||
for (int i = 0; i < Common::Log::NUMBER_OF_LOGS; ++i)
|
||||
for (int i = 0; i < static_cast<int>(Common::Log::LogType::NUMBER_OF_LOGS); ++i)
|
||||
{
|
||||
const auto log_type = static_cast<Common::Log::LOG_TYPE>(i);
|
||||
const auto log_type = static_cast<Common::Log::LogType>(i);
|
||||
const bool log_enabled = log_manager->IsEnabled(log_type);
|
||||
|
||||
if (!log_enabled)
|
||||
@ -177,22 +177,22 @@ void LogConfigWidget::SaveSettings()
|
||||
settings.setValue(QStringLiteral("logconfigwidget/floating"), isFloating());
|
||||
|
||||
// Config - Verbosity
|
||||
auto verbosity = Common::Log::LOG_LEVELS::LNOTICE;
|
||||
auto verbosity = Common::Log::LogLevel::LNOTICE;
|
||||
|
||||
if (m_verbosity_notice->isChecked())
|
||||
verbosity = Common::Log::LOG_LEVELS::LNOTICE;
|
||||
verbosity = Common::Log::LogLevel::LNOTICE;
|
||||
|
||||
if (m_verbosity_error->isChecked())
|
||||
verbosity = Common::Log::LOG_LEVELS::LERROR;
|
||||
verbosity = Common::Log::LogLevel::LERROR;
|
||||
|
||||
if (m_verbosity_warning->isChecked())
|
||||
verbosity = Common::Log::LOG_LEVELS::LWARNING;
|
||||
verbosity = Common::Log::LogLevel::LWARNING;
|
||||
|
||||
if (m_verbosity_info->isChecked())
|
||||
verbosity = Common::Log::LOG_LEVELS::LINFO;
|
||||
verbosity = Common::Log::LogLevel::LINFO;
|
||||
|
||||
if (m_verbosity_debug->isChecked())
|
||||
verbosity = Common::Log::LOG_LEVELS::LDEBUG;
|
||||
verbosity = Common::Log::LogLevel::LDEBUG;
|
||||
|
||||
auto* const log_manager = Common::Log::LogManager::GetInstance();
|
||||
|
||||
@ -206,9 +206,9 @@ void LogConfigWidget::SaveSettings()
|
||||
log_manager->EnableListener(Common::Log::LogListener::LOG_WINDOW_LISTENER,
|
||||
m_out_window->isChecked());
|
||||
// Config - Log Types
|
||||
for (int i = 0; i < Common::Log::NUMBER_OF_LOGS; ++i)
|
||||
for (int i = 0; i < static_cast<int>(Common::Log::LogType::NUMBER_OF_LOGS); ++i)
|
||||
{
|
||||
const auto type = static_cast<Common::Log::LOG_TYPE>(i);
|
||||
const auto type = static_cast<Common::Log::LogType>(i);
|
||||
const bool enabled = m_types_list->item(i)->checkState() == Qt::Checked;
|
||||
const bool was_enabled = log_manager->IsEnabled(type);
|
||||
|
||||
|
@ -80,21 +80,21 @@ void LogWidget::UpdateLog()
|
||||
for (auto& line : elements_to_push)
|
||||
{
|
||||
const char* color = "white";
|
||||
switch (std::get<Common::Log::LOG_LEVELS>(line))
|
||||
switch (std::get<Common::Log::LogLevel>(line))
|
||||
{
|
||||
case Common::Log::LOG_LEVELS::LERROR:
|
||||
case Common::Log::LogLevel::LERROR:
|
||||
color = "red";
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LWARNING:
|
||||
case Common::Log::LogLevel::LWARNING:
|
||||
color = "yellow";
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LNOTICE:
|
||||
case Common::Log::LogLevel::LNOTICE:
|
||||
color = "lime";
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LINFO:
|
||||
case Common::Log::LogLevel::LINFO:
|
||||
color = "cyan";
|
||||
break;
|
||||
case Common::Log::LOG_LEVELS::LDEBUG:
|
||||
case Common::Log::LogLevel::LDEBUG:
|
||||
color = "lightgrey";
|
||||
break;
|
||||
}
|
||||
@ -210,7 +210,7 @@ void LogWidget::SaveSettings()
|
||||
UpdateFont();
|
||||
}
|
||||
|
||||
void LogWidget::Log(Common::Log::LOG_LEVELS level, const char* text)
|
||||
void LogWidget::Log(Common::Log::LogLevel level, const char* text)
|
||||
{
|
||||
size_t text_length = strlen(text);
|
||||
while (text_length > 0 && text[text_length - 1] == '\n')
|
||||
|
@ -36,7 +36,7 @@ private:
|
||||
void LoadSettings();
|
||||
void SaveSettings();
|
||||
|
||||
void Log(Common::Log::LOG_LEVELS level, const char* text) override;
|
||||
void Log(Common::Log::LogLevel level, const char* text) override;
|
||||
|
||||
// Log
|
||||
QCheckBox* m_log_wrap;
|
||||
@ -46,7 +46,7 @@ private:
|
||||
|
||||
QTimer* m_timer;
|
||||
|
||||
using LogEntry = std::pair<std::string, Common::Log::LOG_LEVELS>;
|
||||
using LogEntry = std::pair<std::string, Common::Log::LogLevel>;
|
||||
|
||||
// Maximum number of lines to show in log viewer
|
||||
static constexpr int MAX_LOG_LINES = 5000;
|
||||
|
Reference in New Issue
Block a user