summaryrefslogtreecommitdiffstats
path: root/common/console.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2015-04-21 15:44:54 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2015-04-21 15:44:54 +0200
commit2998d9d3d5dfc825904b53393e9ae12e7cd5b72b (patch)
tree40b4508a4b5ec7d66609634f025a72d756df738c /common/console.cpp
parent47f105febcd17d6db1f998a99c6c6c423851573a (diff)
downloadsink-2998d9d3d5dfc825904b53393e9ae12e7cd5b72b.tar.gz
sink-2998d9d3d5dfc825904b53393e9ae12e7cd5b72b.zip
Moved Console to client.
It's part of the demo application.
Diffstat (limited to 'common/console.cpp')
-rw-r--r--common/console.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/common/console.cpp b/common/console.cpp
deleted file mode 100644
index 97a6e88..0000000
--- a/common/console.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * Copyright (C) 2014 Aaron Seigo <aseigo@kde.org>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) version 3, or any
8 * later version accepted by the membership of KDE e.V. (or its
9 * successor approved by the membership of KDE e.V.), which shall
10 * act as a proxy defined in Section 6 of version 3 of the license.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include "console.h"
22
23#include <QFontDatabase>
24#include <QLabel>
25#include <QTextBrowser>
26#include <QVBoxLayout>
27
28namespace Akonadi2
29{
30
31static Console *s_console = 0;
32
33Console *Console::main()
34{
35 if (!s_console) {
36 s_console = new Console(QString());
37 }
38 return s_console;
39}
40
41Console::Console(const QString &title)
42 : QWidget(0)
43{
44 if (!s_console) {
45 s_console = this;
46 }
47
48 resize(1000, 1500);
49
50 QVBoxLayout *topLayout = new QVBoxLayout(this);
51
52 QLabel *titleLabel = new QLabel(this);
53 titleLabel->setText(title);
54 QFont font = titleLabel->font();
55 font.setWeight(QFont::Bold);
56 titleLabel->setFont(font);
57 titleLabel->setAlignment(Qt::AlignCenter);
58
59 QFont consoleFont = QFontDatabase::systemFont(QFontDatabase::FixedFont);
60 consoleFont.setPointSize(7);
61 m_textDisplay = new QTextBrowser(this);
62 m_textDisplay->document()->setDefaultFont(consoleFont);
63 topLayout->addWidget(titleLabel);
64 topLayout->addWidget(m_textDisplay, 10);
65
66 show();
67 m_timestamper.start();
68}
69
70Console::~Console()
71{
72
73}
74
75void Console::log(const QString &message)
76{
77 m_textDisplay->append(QString::number(m_timestamper.elapsed()).rightJustified(6) + ": " + message);
78}
79
80} // namespace Akonadi2