From 62fa6f942e600b69a98b35fe1afcbc03139e8c47 Mon Sep 17 00:00:00 2001 From: Aaron Seigo Date: Tue, 2 Dec 2014 13:49:30 +0100 Subject: timestamp messages and use a fixed font for the output --- common/console.cpp | 8 ++++++-- common/console.h | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/common/console.cpp b/common/console.cpp index 4ed7960..183ce42 100644 --- a/common/console.cpp +++ b/common/console.cpp @@ -1,5 +1,6 @@ #include "console.h" +#include #include #include #include @@ -29,12 +30,15 @@ Console::Console(const QString &title) titleLabel->setFont(font); titleLabel->setAlignment(Qt::AlignCenter); + QFont consoleFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); + consoleFont.setPointSize(7); m_textDisplay = new QTextBrowser(this); - + m_textDisplay->document()->setDefaultFont(consoleFont); topLayout->addWidget(titleLabel); topLayout->addWidget(m_textDisplay, 10); show(); + m_timestamper.start(); } Console::~Console() @@ -44,5 +48,5 @@ Console::~Console() void Console::log(const QString &message) { - m_textDisplay->append(message); + m_textDisplay->append(QString::number(m_timestamper.elapsed()).rightJustified(6) + ": " + message); } diff --git a/common/console.h b/common/console.h index d504fb1..d36ce05 100644 --- a/common/console.h +++ b/common/console.h @@ -1,5 +1,6 @@ #pragma once +#include #include class QTextBrowser; @@ -16,5 +17,6 @@ public: private: QTextBrowser *m_textDisplay; + QTime m_timestamper; static Console *s_output; -}; \ No newline at end of file +}; -- cgit v1.2.3