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)));
73 while(
_ui->spinBox_lines->value()>0 &&
_msgList.size()>
_ui->spinBox_lines->value())
79 if(
_ui->spinBox_time->value()>0 &&
_time.restart() <
_ui->spinBox_time->value())
83 QMetaObject::invokeMethod(&
_timer,
"start", Q_ARG(
int, 0));
87 QMetaObject::invokeMethod(&
_timer,
"start", Q_ARG(
int,
_ui->spinBox_time->value()));
92 QMetaObject::invokeMethod(&
_timer,
"start", Q_ARG(
int, 0));
111 _ui->textEdit->setTextColor(Qt::darkGreen);
114 _ui->textEdit->setTextColor(Qt::yellow);
118 _ui->textEdit->setTextColor(Qt::red);
121 _ui->textEdit->setTextColor(Qt::white);
124 _ui->textEdit->append(msg);
129 QTextCursor cursor =
_ui->textEdit->textCursor();
130 cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
131 _ui->textEdit->setTextCursor(cursor);
133 _errorMessage->setText(tr(
"Description:\n\n%1\n\nThe application will now exit...").arg(msg));
143 for(
int i=0; i<
_msgList.size(); ++i)
150 QTextCursor cursor =
_ui->textEdit->textCursor();
151 cursor.movePosition(QTextCursor::End, QTextCursor::MoveAnchor);
152 _ui->textEdit->setTextCursor(cursor);
157 _ui->textEdit->document()->setMaximumBlockCount(
_ui->spinBox_lines->value());
virtual std::string getClassName() const =0
static void addHandler(UEventsHandler *handler)
ULogger class and convenient macros.
const std::string & getMsg() const