drkonqi: highlight signals from LLDB output

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-04-15 20:46:22 +03:00
parent 6877554745
commit 422237177c
2 changed files with 14 additions and 2 deletions

View file

@ -28,6 +28,7 @@ LldbHighlighter::LldbHighlighter(QTextDocument* parent, const QList<BacktraceLin
KColorScheme kcolorscheme(QPalette::Active);
m_crapformat.setForeground(kcolorscheme.foreground(KColorScheme::InactiveText));
m_signalformat.setForeground(kcolorscheme.foreground(KColorScheme::NegativeText));
m_idformat.setForeground(kcolorscheme.foreground(KColorScheme::PositiveText));
m_hexformat.setForeground(kcolorscheme.foreground(KColorScheme::NegativeText));
m_hexformat.setFontWeight(QFont::Bold);
@ -40,11 +41,21 @@ LldbHighlighter::LldbHighlighter(QTextDocument* parent, const QList<BacktraceLin
void LldbHighlighter::highlightBlock(const QString &text)
{
// qDebug() << Q_FUNC_INFO << text << currentBlock().position() << currentBlock().length();
if (!text.contains(QLatin1String(" thread #"))
&& !text.contains(QLatin1String(" frame #"))) {
const bool hasthread = text.contains(QLatin1String(" thread #"));
if (!hasthread && !text.contains(QLatin1String(" frame #"))) {
setFormat(0, text.length(), m_crapformat);
}
if (hasthread) {
int partlength = 0;
foreach (const QString &textpart, text.split(QLatin1Char(' '))) {
if (textpart.startsWith(QLatin1String("SIG"))) {
setFormat(partlength, textpart.length(), m_signalformat);
}
partlength += (textpart.length() + 1);
}
}
int partlength = 0;
int partscounter = 0;
const QStringList textparts = text.split(QLatin1Char(' '));

View file

@ -34,6 +34,7 @@ protected:
private:
QTextCharFormat m_crapformat;
QTextCharFormat m_signalformat;
QTextCharFormat m_idformat;
QTextCharFormat m_hexformat;
QTextCharFormat m_libraryformat;