Files
seer/src/SeerGdbLogWidget.cpp
T

79 lines
1.4 KiB
C++
Raw Normal View History

2022-02-14 20:44:54 -06:00
#include "SeerGdbLogWidget.h"
2021-09-01 14:01:00 -05:00
#include "SeerUtl.h"
#include <QtWidgets/QScrollBar>
#include <QtCore/QDebug>
2022-02-14 20:44:54 -06:00
SeerGdbLogWidget::SeerGdbLogWidget (QWidget* parent) : SeerLogWidget(parent) {
2021-09-01 14:01:00 -05:00
}
2022-02-14 20:44:54 -06:00
SeerGdbLogWidget::~SeerGdbLogWidget () {
2021-09-01 14:01:00 -05:00
}
2022-02-14 20:44:54 -06:00
void SeerGdbLogWidget::processText (const QString& text) {
2021-09-01 14:01:00 -05:00
QString str;
// Remove leading "~"
// ~"For help, type "help".
// "
if (text.front() == '~') {
str = text.mid(1);
// Remove leading """
if (str.front() == '"') {
str = str.mid(1);
}
// Remove trailing """
if (str.back() == '"') {
str.chop(1);
}
// Remove trailing "\n"
if (str.back() == '\n') {
str.chop(1);
}
// Remove leading "&"
// &"p name
// "
}else if (text.front() == '&') {
str = text.mid(1);
// Remove leading """
if (str.front() == '"') {
str = str.mid(1);
}
// Remove trailing """
if (str.back() == '"') {
str.chop(1);
}
// Remove trailing "\n"
if (str.back() == '\n') {
str.chop(1);
}
// Use string as it is.
}else{
str = text;
}
// Filter escape characters.
str = Seer::filterEscapes(str);
// Remove trailing "\n"
while (str.back() == '\n') {
str.chop(1);
break;
}
// Write the string to the log.
textEdit->append(str);
}