Simplify MessageLevel::Enum -> MessageLevel

Signed-off-by: TheKodeToad <TheKodeToad@proton.me>
This commit is contained in:
TheKodeToad
2025-12-07 12:56:30 +00:00
parent 0fd945b3db
commit fd3ae85d45
20 changed files with 62 additions and 64 deletions

View File

@@ -60,7 +60,7 @@ QVariant LogFormatProxyModel::data(const QModelIndex& index, int role) const
case Qt::FontRole:
return m_font;
case Qt::ForegroundRole: {
auto level = static_cast<MessageLevel::Enum>(QIdentityProxyModel::data(index, LogModel::LevelRole).toInt());
auto level = static_cast<MessageLevel>(QIdentityProxyModel::data(index, LogModel::LevelRole).toInt());
QColor result = colors.foreground.value(level);
if (result.isValid())
@@ -69,7 +69,7 @@ QVariant LogFormatProxyModel::data(const QModelIndex& index, int role) const
break;
}
case Qt::BackgroundRole: {
auto level = static_cast<MessageLevel::Enum>(QIdentityProxyModel::data(index, LogModel::LevelRole).toInt());
auto level = static_cast<MessageLevel>(QIdentityProxyModel::data(index, LogModel::LevelRole).toInt());
QColor result = colors.background.value(level);
if (result.isValid())

View File

@@ -274,18 +274,18 @@ void OtherLogsPage::reload()
showTooBig();
return;
}
MessageLevel::Enum last = MessageLevel::Unknown;
MessageLevel last = MessageLevel::Unknown;
auto handleLine = [this, &last](QString line) {
if (line.isEmpty())
return false;
if (line.back() == '\n')
line = line.remove(line.size() - 1, 1);
MessageLevel::Enum level = MessageLevel::Unknown;
MessageLevel level = MessageLevel::Unknown;
QString lineTemp = line; // don't edit out the time and level for clarity
if (!m_instance) {
level = MessageLevel::fromLauncherLine(lineTemp);
level = messageLevelFromLauncherLine(lineTemp);
} else {
level = LogParser::guessLevel(line);

View File

@@ -229,7 +229,7 @@ bool CustomTheme::read(const QString& path, bool& hasCustomLogColors)
hasCustomLogColors = true;
auto logColorsRoot = Json::requireObject(root, "logColors");
auto readAndSetLogColor = [this, readColor, logColorsRoot](MessageLevel::Enum level, bool fg, const QString& colorName) {
auto readAndSetLogColor = [this, readColor, logColorsRoot](MessageLevel level, bool fg, const QString& colorName) {
auto color = readColor(logColorsRoot, colorName);
if (color.isValid()) {
if (fg)

View File

@@ -42,8 +42,8 @@
class QStyle;
struct LogColors {
QMap<MessageLevel::Enum, QColor> background;
QMap<MessageLevel::Enum, QColor> foreground;
QMap<MessageLevel, QColor> background;
QMap<MessageLevel, QColor> foreground;
};
// TODO: rename to Theme; this is not an interface as it contains method implementations

View File

@@ -232,7 +232,7 @@ void AppearanceWidget::updateConsolePreview()
m_ui->consolePreview->clear();
m_defaultFormat.setFont(QFont(fontFamily, fontSize));
auto print = [this, colors](const QString& message, MessageLevel::Enum level) {
auto print = [this, colors](const QString& message, MessageLevel level) {
QTextCharFormat format(m_defaultFormat);
QColor bg = colors.background.value(level);