summaryrefslogtreecommitdiff
path: root/printutils.cc
diff options
context:
space:
mode:
Diffstat (limited to 'printutils.cc')
-rw-r--r--printutils.cc46
1 files changed, 38 insertions, 8 deletions
diff --git a/printutils.cc b/printutils.cc
index 8f53cd3..a75cf14 100644
--- a/printutils.cc
+++ b/printutils.cc
@@ -1,14 +1,44 @@
#include "printutils.h"
#include "MainWindow.h"
+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;
+ }
+}
+
void PRINT(const QString &msg)
{
- do {
- if (MainWindow::current_win.isNull()) {
- fprintf(stderr, "%s\n", msg.toAscii().data());
- }
- else {
- MainWindow::current_win->console->append(msg);
- }
- } while (0);
+ 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);
}
+
+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);
+ }
+}
+
contact: Jan Huwald // Impressum