Fix coloring and processing of console output
* Removing \r * Adding missing break statements for coloring
This commit is contained in:
parent
551e101146
commit
a2ac9c5a3a
@ -180,10 +180,12 @@ void LogPage::write(QString data, MessageLevel::Enum mode)
|
|||||||
{
|
{
|
||||||
format.setForeground(QColor("red"));
|
format.setForeground(QColor("red"));
|
||||||
format.setBackground(QColor("black"));
|
format.setBackground(QColor("black"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case MessageLevel::PrePost:
|
case MessageLevel::PrePost:
|
||||||
{
|
{
|
||||||
format.setForeground(QColor("grey"));
|
format.setForeground(QColor("grey"));
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
case MessageLevel::Info:
|
case MessageLevel::Info:
|
||||||
case MessageLevel::Message:
|
case MessageLevel::Message:
|
||||||
|
@ -177,8 +177,8 @@ MessageLevel::Enum MinecraftProcess::guessLevel(const QString &line, MessageLeve
|
|||||||
}
|
}
|
||||||
if (line.contains("overwriting existing"))
|
if (line.contains("overwriting existing"))
|
||||||
return MessageLevel::Fatal;
|
return MessageLevel::Fatal;
|
||||||
if (line.contains("Exception in thread") || line.contains(" at "))
|
if (line.contains("Exception in thread") || line.contains(QRegularExpression("\\s+at ")))
|
||||||
return MessageLevel::Fatal;
|
return MessageLevel::Error;
|
||||||
return level;
|
return level;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -237,6 +237,7 @@ void MinecraftProcess::on_stdErr()
|
|||||||
QByteArray data = readAllStandardError();
|
QByteArray data = readAllStandardError();
|
||||||
QString str = m_err_leftover + QString::fromLocal8Bit(data);
|
QString str = m_err_leftover + QString::fromLocal8Bit(data);
|
||||||
|
|
||||||
|
str.remove('\r');
|
||||||
QStringList lines = str.split("\n");
|
QStringList lines = str.split("\n");
|
||||||
m_err_leftover = lines.takeLast();
|
m_err_leftover = lines.takeLast();
|
||||||
|
|
||||||
@ -248,6 +249,7 @@ void MinecraftProcess::on_stdOut()
|
|||||||
QByteArray data = readAllStandardOutput();
|
QByteArray data = readAllStandardOutput();
|
||||||
QString str = m_out_leftover + QString::fromLocal8Bit(data);
|
QString str = m_out_leftover + QString::fromLocal8Bit(data);
|
||||||
|
|
||||||
|
str.remove('\r');
|
||||||
QStringList lines = str.split("\n");
|
QStringList lines = str.split("\n");
|
||||||
m_out_leftover = lines.takeLast();
|
m_out_leftover = lines.takeLast();
|
||||||
|
|
||||||
@ -259,6 +261,7 @@ void MinecraftProcess::on_prepost_stdErr()
|
|||||||
QByteArray data = m_prepostlaunchprocess.readAllStandardError();
|
QByteArray data = m_prepostlaunchprocess.readAllStandardError();
|
||||||
QString str = m_err_leftover + QString::fromLocal8Bit(data);
|
QString str = m_err_leftover + QString::fromLocal8Bit(data);
|
||||||
|
|
||||||
|
str.remove('\r');
|
||||||
QStringList lines = str.split("\n");
|
QStringList lines = str.split("\n");
|
||||||
m_err_leftover = lines.takeLast();
|
m_err_leftover = lines.takeLast();
|
||||||
|
|
||||||
@ -270,6 +273,7 @@ void MinecraftProcess::on_prepost_stdOut()
|
|||||||
QByteArray data = m_prepostlaunchprocess.readAllStandardOutput();
|
QByteArray data = m_prepostlaunchprocess.readAllStandardOutput();
|
||||||
QString str = m_out_leftover + QString::fromLocal8Bit(data);
|
QString str = m_out_leftover + QString::fromLocal8Bit(data);
|
||||||
|
|
||||||
|
str.remove('\r');
|
||||||
QStringList lines = str.split("\n");
|
QStringList lines = str.split("\n");
|
||||||
m_out_leftover = lines.takeLast();
|
m_out_leftover = lines.takeLast();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user