Qt: Add log level SWI

This commit is contained in:
Jeffrey Pfau 2014-11-06 00:30:35 -08:00
parent d75042ea38
commit 0efe988161
3 changed files with 20 additions and 0 deletions

View File

@ -16,6 +16,7 @@ LogView::LogView(QWidget* parent)
connect(m_ui.levelError, SIGNAL(toggled(bool)), this, SLOT(setLevelError(bool))); connect(m_ui.levelError, SIGNAL(toggled(bool)), this, SLOT(setLevelError(bool)));
connect(m_ui.levelFatal, SIGNAL(toggled(bool)), this, SLOT(setLevelFatal(bool))); connect(m_ui.levelFatal, SIGNAL(toggled(bool)), this, SLOT(setLevelFatal(bool)));
connect(m_ui.levelGameError, SIGNAL(toggled(bool)), this, SLOT(setLevelGameError(bool))); connect(m_ui.levelGameError, SIGNAL(toggled(bool)), this, SLOT(setLevelGameError(bool)));
connect(m_ui.levelSWI, SIGNAL(toggled(bool)), this, SLOT(setLevelSWI(bool)));
connect(m_ui.clear, SIGNAL(clicked()), this, SLOT(clear())); connect(m_ui.clear, SIGNAL(clicked()), this, SLOT(clear()));
connect(m_ui.maxLines, SIGNAL(valueChanged(int)), this, SLOT(setMaxLines(int))); connect(m_ui.maxLines, SIGNAL(valueChanged(int)), this, SLOT(setMaxLines(int)));
m_logLevel = GBA_LOG_WARN | GBA_LOG_ERROR | GBA_LOG_FATAL; m_logLevel = GBA_LOG_WARN | GBA_LOG_ERROR | GBA_LOG_FATAL;
@ -49,6 +50,7 @@ void LogView::setLevels(int levels) {
m_ui.levelError->setCheckState(levels & GBA_LOG_ERROR ? Qt::Checked : Qt::Unchecked); m_ui.levelError->setCheckState(levels & GBA_LOG_ERROR ? Qt::Checked : Qt::Unchecked);
m_ui.levelFatal->setCheckState(levels & GBA_LOG_FATAL ? Qt::Checked : Qt::Unchecked); m_ui.levelFatal->setCheckState(levels & GBA_LOG_FATAL ? Qt::Checked : Qt::Unchecked);
m_ui.levelGameError->setCheckState(levels & GBA_LOG_GAME_ERROR ? Qt::Checked : Qt::Unchecked); m_ui.levelGameError->setCheckState(levels & GBA_LOG_GAME_ERROR ? Qt::Checked : Qt::Unchecked);
m_ui.levelSWI->setCheckState(levels & GBA_LOG_SWI ? Qt::Checked : Qt::Unchecked);
} }
void LogView::setLevelDebug(bool set) { void LogView::setLevelDebug(bool set) {
@ -107,6 +109,14 @@ void LogView::setLevelGameError(bool set) {
} }
} }
void LogView::setLevelSWI(bool set) {
if (set) {
setLevel(GBA_LOG_SWI);
} else {
clearLevel(GBA_LOG_SWI);
}
}
void LogView::setMaxLines(int limit) { void LogView::setMaxLines(int limit) {
m_lineLimit = limit; m_lineLimit = limit;
while (m_lines > m_lineLimit) { while (m_lines > m_lineLimit) {
@ -130,6 +140,8 @@ QString LogView::toString(int level) {
return tr("FATAL"); return tr("FATAL");
case GBA_LOG_GAME_ERROR: case GBA_LOG_GAME_ERROR:
return tr("GAME ERROR"); return tr("GAME ERROR");
case GBA_LOG_SWI:
return tr("SWI");
} }
return QString(); return QString();
} }

View File

@ -29,6 +29,7 @@ public slots:
void setLevelError(bool); void setLevelError(bool);
void setLevelFatal(bool); void setLevelFatal(bool);
void setLevelGameError(bool); void setLevelGameError(bool);
void setLevelSWI(bool);
void setMaxLines(int); void setMaxLines(int);

View File

@ -99,6 +99,13 @@
</property> </property>
</widget> </widget>
</item> </item>
<item>
<widget class="QCheckBox" name="levelSWI">
<property name="text">
<string>SW Interrupt</string>
</property>
</widget>
</item>
</layout> </layout>
</widget> </widget>
</item> </item>