Changeset View
Changeset View
Standalone View
Standalone View
languages/clang/clangdebugwidget.h
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | This file is part of KDevelop | ||||
3 | | ||||
4 | Copyright 2016 Aleix Pol Gonzalez <aleixpol@kde.org> | ||||
5 | | ||||
6 | This library is free software; you can redistribute it and/or | ||||
7 | modify it under the terms of the GNU Library General Public | ||||
8 | License as published by the Free Software Foundation; either | ||||
9 | version 2 of the License, or (at your option) any later version. | ||||
10 | | ||||
11 | This library is distributed in the hope that it will be useful, | ||||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||||
14 | Library General Public License for more details. | ||||
15 | | ||||
16 | You should have received a copy of the GNU Library General Public License | ||||
17 | along with this library; see the file COPYING.LIB. If not, write to | ||||
18 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||||
19 | Boston, MA 02110-1301, USA. | ||||
20 | */ | ||||
21 | | ||||
22 | #ifndef CLANGDEBUGWIDGET_H | ||||
23 | #define CLANGDEBUGWIDGET_H | ||||
24 | | ||||
25 | #include "clangprivateexport.h" | ||||
26 | | ||||
27 | #include <QWidget> | ||||
28 | #include <QDebug> | ||||
29 | #include <util/path.h> | ||||
30 | | ||||
31 | class ClangDocumentDebugWidget; | ||||
32 | class QComboBox; | ||||
33 | class QStackedLayout; | ||||
34 | | ||||
35 | class KDEVCLANGPRIVATE_EXPORT ClangDebugWidget : public QWidget | ||||
36 | { | ||||
37 | Q_OBJECT | ||||
38 | private Q_SLOTS: | ||||
39 | void addText(const QUrl& url, const QString & t); | ||||
40 | | ||||
41 | public: | ||||
42 | static ClangDebugWidget* self(); | ||||
43 | | ||||
44 | template <typename T> | ||||
45 | static void sendDebug(const QUrl& url, const T& data) { | ||||
46 | QString string; | ||||
47 | QDebug(&string) << data; | ||||
48 | sendText(url, string); | ||||
49 | } | ||||
50 | | ||||
51 | private: | ||||
52 | static void sendText(const QUrl& url, const QString &text); | ||||
53 | ClangDebugWidget (QWidget* parent = nullptr); | ||||
54 | void switchDocument(int comboIndex); | ||||
55 | | ||||
56 | QHash<QUrl, ClangDocumentDebugWidget*> m_views; | ||||
57 | QComboBox* m_combo; | ||||
58 | QStackedLayout* m_layout; | ||||
59 | }; | ||||
60 | | ||||
61 | #endif // CLANGDEBUGWIDGET_H |