diff options
Diffstat (limited to 'common')
-rw-r--r-- | common/CMakeLists.txt | 3 | ||||
-rw-r--r-- | common/console.cpp | 80 | ||||
-rw-r--r-- | common/console.h | 49 |
3 files changed, 1 insertions, 131 deletions
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index c18d98a..f6847a7 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt | |||
@@ -28,7 +28,6 @@ set(command_SRCS | |||
28 | entitybuffer.cpp | 28 | entitybuffer.cpp |
29 | clientapi.cpp | 29 | clientapi.cpp |
30 | commands.cpp | 30 | commands.cpp |
31 | console.cpp | ||
32 | facade.cpp | 31 | facade.cpp |
33 | pipeline.cpp | 32 | pipeline.cpp |
34 | domainadaptor.cpp | 33 | domainadaptor.cpp |
@@ -44,6 +43,6 @@ set(command_SRCS | |||
44 | add_library(${PROJECT_NAME} SHARED ${command_SRCS}) | 43 | add_library(${PROJECT_NAME} SHARED ${command_SRCS}) |
45 | generate_export_header(${PROJECT_NAME} BASE_NAME Akonadi2Common EXPORT_FILE_NAME akonadi2common_export.h) | 44 | generate_export_header(${PROJECT_NAME} BASE_NAME Akonadi2Common EXPORT_FILE_NAME akonadi2common_export.h) |
46 | SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) | 45 | SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) |
47 | qt5_use_modules(${PROJECT_NAME} Widgets Network) | 46 | qt5_use_modules(${PROJECT_NAME} Network) |
48 | target_link_libraries(${PROJECT_NAME} ${storage_LIBS} akonadi2async) | 47 | target_link_libraries(${PROJECT_NAME} ${storage_LIBS} akonadi2async) |
49 | install(TARGETS ${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) | 48 | install(TARGETS ${PROJECT_NAME} ${KDE_INSTALL_TARGETS_DEFAULT_ARGS}) |
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 | |||
28 | namespace Akonadi2 | ||
29 | { | ||
30 | |||
31 | static Console *s_console = 0; | ||
32 | |||
33 | Console *Console::main() | ||
34 | { | ||
35 | if (!s_console) { | ||
36 | s_console = new Console(QString()); | ||
37 | } | ||
38 | return s_console; | ||
39 | } | ||
40 | |||
41 | Console::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 | |||
70 | Console::~Console() | ||
71 | { | ||
72 | |||
73 | } | ||
74 | |||
75 | void Console::log(const QString &message) | ||
76 | { | ||
77 | m_textDisplay->append(QString::number(m_timestamper.elapsed()).rightJustified(6) + ": " + message); | ||
78 | } | ||
79 | |||
80 | } // namespace Akonadi2 | ||
diff --git a/common/console.h b/common/console.h deleted file mode 100644 index edfc8e5..0000000 --- a/common/console.h +++ /dev/null | |||
@@ -1,49 +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 | #pragma once | ||
22 | |||
23 | #include <akonadi2common_export.h> | ||
24 | |||
25 | #include <QTime> | ||
26 | #include <QWidget> | ||
27 | |||
28 | class QTextBrowser; | ||
29 | |||
30 | namespace Akonadi2 | ||
31 | { | ||
32 | |||
33 | class AKONADI2COMMON_EXPORT Console : public QWidget | ||
34 | { | ||
35 | Q_OBJECT | ||
36 | public: | ||
37 | static Console *main(); | ||
38 | Console(const QString &title); | ||
39 | ~Console(); | ||
40 | |||
41 | void log(const QString &message); | ||
42 | |||
43 | private: | ||
44 | QTextBrowser *m_textDisplay; | ||
45 | QTime m_timestamper; | ||
46 | static Console *s_output; | ||
47 | }; | ||
48 | |||
49 | } // namespace Akonadi2 | ||