2009-12-09 17:22:50 +03:00
|
|
|
#include "printutils.h"
|
|
|
|
#include "MainWindow.h"
|
|
|
|
|
2010-01-06 13:48:51 +03:00
|
|
|
QList<QString> print_messages_stack;
|
|
|
|
|
|
|
|
void print_messages_push()
|
|
|
|
{
|
|
|
|
print_messages_stack.append(QString());
|
|
|
|
}
|
|
|
|
|
|
|
|
void print_messages_pop()
|
|
|
|
{
|
|
|
|
QString msg = print_messages_stack.last();
|
|
|
|
print_messages_stack.removeLast();
|
|
|
|
if (print_messages_stack.size() > 0 && !msg.isNull()) {
|
|
|
|
if (!print_messages_stack.last().isEmpty())
|
|
|
|
print_messages_stack.last() += "\n";
|
|
|
|
print_messages_stack.last() += msg;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-09 17:22:50 +03:00
|
|
|
void PRINT(const QString &msg)
|
|
|
|
{
|
2010-01-06 13:48:51 +03:00
|
|
|
if (msg.isNull())
|
|
|
|
return;
|
|
|
|
if (print_messages_stack.size() > 0) {
|
|
|
|
if (!print_messages_stack.last().isEmpty())
|
|
|
|
print_messages_stack.last() += "\n";
|
|
|
|
print_messages_stack.last() += msg;
|
|
|
|
}
|
|
|
|
PRINT_NOCACHE(msg);
|
2009-12-09 17:22:50 +03:00
|
|
|
}
|
2010-01-06 13:48:51 +03:00
|
|
|
|
|
|
|
void PRINT_NOCACHE(const QString &msg)
|
|
|
|
{
|
|
|
|
if (msg.isNull())
|
|
|
|
return;
|
|
|
|
if (MainWindow::current_win.isNull()) {
|
|
|
|
fprintf(stderr, "%s\n", msg.toAscii().data());
|
|
|
|
} else {
|
|
|
|
MainWindow::current_win->console->append(msg);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|