diff options
author | Aaron Seigo <aseigo@kde.org> | 2014-11-20 16:28:31 +0100 |
---|---|---|
committer | Aaron Seigo <aseigo@kde.org> | 2014-11-20 16:28:31 +0100 |
commit | ed20c3082d4fd5e90703e4d6c37093dcecb5cfd1 (patch) | |
tree | c4ad96fde99c38ee66c0ba7d0f8231bc5326b3d6 /common/console.cpp | |
download | sink-ed20c3082d4fd5e90703e4d6c37093dcecb5cfd1.tar.gz sink-ed20c3082d4fd5e90703e4d6c37093dcecb5cfd1.zip |
sketch in the client/resource model
Diffstat (limited to 'common/console.cpp')
-rw-r--r-- | common/console.cpp | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/common/console.cpp b/common/console.cpp new file mode 100644 index 0000000..4ed7960 --- /dev/null +++ b/common/console.cpp | |||
@@ -0,0 +1,48 @@ | |||
1 | #include "console.h" | ||
2 | |||
3 | #include <QLabel> | ||
4 | #include <QTextBrowser> | ||
5 | #include <QVBoxLayout> | ||
6 | |||
7 | static Console *s_console = 0; | ||
8 | |||
9 | Console *Console::main() | ||
10 | { | ||
11 | if (!s_console) { | ||
12 | s_console = new Console("Stupido!"); | ||
13 | } | ||
14 | return s_console; | ||
15 | } | ||
16 | |||
17 | Console::Console(const QString &title) | ||
18 | : QWidget(0) | ||
19 | { | ||
20 | s_console = this; | ||
21 | resize(1000, 1500); | ||
22 | |||
23 | QVBoxLayout *topLayout = new QVBoxLayout(this); | ||
24 | |||
25 | QLabel *titleLabel = new QLabel(this); | ||
26 | titleLabel->setText(title); | ||
27 | QFont font = titleLabel->font(); | ||
28 | font.setWeight(QFont::Bold); | ||
29 | titleLabel->setFont(font); | ||
30 | titleLabel->setAlignment(Qt::AlignCenter); | ||
31 | |||
32 | m_textDisplay = new QTextBrowser(this); | ||
33 | |||
34 | topLayout->addWidget(titleLabel); | ||
35 | topLayout->addWidget(m_textDisplay, 10); | ||
36 | |||
37 | show(); | ||
38 | } | ||
39 | |||
40 | Console::~Console() | ||
41 | { | ||
42 | |||
43 | } | ||
44 | |||
45 | void Console::log(const QString &message) | ||
46 | { | ||
47 | m_textDisplay->append(message); | ||
48 | } | ||