diff options
author | Aaron Seigo <aseigo@kde.org> | 2014-12-02 13:49:30 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2014-12-02 13:54:04 +0100 |
commit | 62fa6f942e600b69a98b35fe1afcbc03139e8c47 (patch) | |
tree | 02a2c155190184875783679d747b44d1beb0b4de /common/console.cpp | |
parent | cd99c2a9649d1e1639dfa9fc7590f2e5af89335a (diff) | |
download | sink-62fa6f942e600b69a98b35fe1afcbc03139e8c47.tar.gz sink-62fa6f942e600b69a98b35fe1afcbc03139e8c47.zip |
timestamp messages and use a fixed font for the output
Diffstat (limited to 'common/console.cpp')
-rw-r--r-- | common/console.cpp | 8 |
1 files changed, 6 insertions, 2 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 @@ | |||
1 | #include "console.h" | 1 | #include "console.h" |
2 | 2 | ||
3 | #include <QFontDatabase> | ||
3 | #include <QLabel> | 4 | #include <QLabel> |
4 | #include <QTextBrowser> | 5 | #include <QTextBrowser> |
5 | #include <QVBoxLayout> | 6 | #include <QVBoxLayout> |
@@ -29,12 +30,15 @@ Console::Console(const QString &title) | |||
29 | titleLabel->setFont(font); | 30 | titleLabel->setFont(font); |
30 | titleLabel->setAlignment(Qt::AlignCenter); | 31 | titleLabel->setAlignment(Qt::AlignCenter); |
31 | 32 | ||
33 | QFont consoleFont = QFontDatabase::systemFont(QFontDatabase::FixedFont); | ||
34 | consoleFont.setPointSize(7); | ||
32 | m_textDisplay = new QTextBrowser(this); | 35 | m_textDisplay = new QTextBrowser(this); |
33 | 36 | m_textDisplay->document()->setDefaultFont(consoleFont); | |
34 | topLayout->addWidget(titleLabel); | 37 | topLayout->addWidget(titleLabel); |
35 | topLayout->addWidget(m_textDisplay, 10); | 38 | topLayout->addWidget(m_textDisplay, 10); |
36 | 39 | ||
37 | show(); | 40 | show(); |
41 | m_timestamper.start(); | ||
38 | } | 42 | } |
39 | 43 | ||
40 | Console::~Console() | 44 | Console::~Console() |
@@ -44,5 +48,5 @@ Console::~Console() | |||
44 | 48 | ||
45 | void Console::log(const QString &message) | 49 | void Console::log(const QString &message) |
46 | { | 50 | { |
47 | m_textDisplay->append(message); | 51 | m_textDisplay->append(QString::number(m_timestamper.elapsed()).rightJustified(6) + ": " + message); |
48 | } | 52 | } |