29 #include "ui_consoleWidget.h"
32 #include <QMessageBox>
33 #include <QtGui/QTextCursor>
34 #include <QtCore/QTimer>
41 _ui =
new Ui_consoleWidget();
44 _ui->textEdit->document()->setMaximumBlockCount(
_ui->spinBox_lines->value());
46 _ui->textEdit->setFontPointSize(10);
47 QPalette
p(
_ui->textEdit->palette());
48 p.setColor(QPalette::Base, Qt::black);
49 _ui->textEdit->setPalette(
p);
50 _errorMessage =
new QMessageBox(QMessageBox::Critical, tr(
"Fatal error occurred"),
"", QMessageBox::Ok,
this);
53 _timer.setSingleShot(
true);
54 connect(
_ui->pushButton_clear, SIGNAL(clicked()),
_ui->textEdit, SLOT(clear()));
56 connect(
this, SIGNAL(
msgReceived(
const QString &,
int)),
this, SLOT(
appendMsg(
const QString &,
int)));
74 while(
_ui->spinBox_lines->value()>0 &&
_msgList.size()>
_ui->spinBox_lines->value())
80 if(
_ui->spinBox_time->value()>0 &&
_time.restart() <
_ui->spinBox_time->value())
84 QMetaObject::invokeMethod(&
_timer,
"start", Q_ARG(
int, 0));
88 QMetaObject::invokeMethod(&
_timer,
"start", Q_ARG(
int,
_ui->spinBox_time->value()));
93 QMetaObject::invokeMethod(&
_timer,
"start", Q_ARG(
int, 0));
112 _ui->textEdit->setTextColor(Qt::darkGreen);
115 _ui->textEdit->setTextColor(Qt::yellow);
119 _ui->textEdit->setTextColor(Qt::red);
122 _ui->textEdit->setTextColor(Qt::white);
125 _ui->textEdit->append(
msg);
130 QTextCursor cursor =
_ui->textEdit->textCursor();
131 cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
132 _ui->textEdit->setTextCursor(cursor);
134 _errorMessage->setText(tr(
"Description:\n\n%1\n\nThe application will now exit...").
arg(
msg));
151 QTextCursor cursor =
_ui->textEdit->textCursor();
152 cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
153 _ui->textEdit->setTextCursor(cursor);
158 _ui->textEdit->document()->setMaximumBlockCount(
_ui->spinBox_lines->value());