Changeset View
Changeset View
Standalone View
Standalone View
documentation/standarddocumentationview.h
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * This file is part of KDevelop | 2 | * This file is part of KDevelop | ||
3 | * Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org> | 3 | * Copyright 2010 Aleix Pol Gonzalez <aleixpol@kde.org> | ||
4 | * Copyright 2016 Igor Kushnir <igorkuo@gmail.com> | ||||
4 | * | 5 | * | ||
5 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify | ||
6 | * it under the terms of the GNU Library General Public License as | 7 | * it under the terms of the GNU Library General Public License as | ||
7 | * published by the Free Software Foundation; either version 2 of the | 8 | * published by the Free Software Foundation; either version 2 of the | ||
8 | * License, or (at your option) any later version. | 9 | * License, or (at your option) any later version. | ||
9 | * | 10 | * | ||
10 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | 14 | * GNU General Public License for more details. | ||
14 | * | 15 | * | ||
15 | * You should have received a copy of the GNU General Public | 16 | * You should have received a copy of the GNU General Public | ||
16 | * License along with this program; if not, write to the | 17 | * License along with this program; if not, write to the | ||
17 | * Free Software Foundation, Inc., | 18 | * Free Software Foundation, Inc., | ||
18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
19 | */ | 20 | */ | ||
20 | 21 | | |||
21 | #ifndef KDEVPLATFORM_STANDARDDOCUMENTATIONVIEW_H | 22 | #ifndef KDEVPLATFORM_STANDARDDOCUMENTATIONVIEW_H | ||
22 | #define KDEVPLATFORM_STANDARDDOCUMENTATIONVIEW_H | 23 | #define KDEVPLATFORM_STANDARDDOCUMENTATIONVIEW_H | ||
23 | 24 | | |||
24 | #include <QWebView> | | |||
25 | #include "documentationexport.h" | 25 | #include "documentationexport.h" | ||
26 | #include "documentationfindwidget.h" | 26 | #include "documentationfindwidget.h" | ||
27 | #include <interfaces/idocumentation.h> | 27 | #include <interfaces/idocumentation.h> | ||
28 | 28 | | |||
29 | namespace KDevelop | 29 | #include <QScopedPointer> | ||
30 | { | 30 | #include <QWebView> | ||
31 | | ||||
32 | namespace KDevelop { | ||||
33 | | ||||
34 | class StandardDocumentationViewPrivate; | ||||
31 | 35 | | |||
32 | /** | 36 | /** | ||
33 | * The standard documentation view, based on QWebView. | 37 | * The standard documentation view, based on QWebView. | ||
34 | */ | 38 | */ | ||
35 | class KDEVPLATFORMDOCUMENTATION_EXPORT StandardDocumentationView : public QWebView | 39 | class KDEVPLATFORMDOCUMENTATION_EXPORT StandardDocumentationView : public QWebView | ||
36 | { | 40 | { | ||
37 | Q_OBJECT | 41 | Q_OBJECT | ||
38 | public: | 42 | public: | ||
39 | explicit StandardDocumentationView(DocumentationFindWidget* findWidget, QWidget* parent = nullptr ); | 43 | explicit StandardDocumentationView(DocumentationFindWidget* findWidget, QWidget* parent = nullptr ); | ||
44 | ~StandardDocumentationView(); | ||||
45 | | ||||
46 | /** | ||||
47 | * @brief Enables zoom functionality | ||||
48 | * | ||||
49 | * @param configSubGroup KConfigGroup nested group name used to store zoom factor. | ||||
50 | * Should uniquely describe current documentation provider. | ||||
51 | * | ||||
52 | * @warning Calling this function a second time has no effect | ||||
53 | */ | ||||
54 | void initZoom(const QString& configSubGroup); | ||||
55 | | ||||
40 | void setDocumentation(const IDocumentation::Ptr& doc); | 56 | void setDocumentation(const IDocumentation::Ptr& doc); | ||
41 | 57 | | |||
42 | public slots: | 58 | public slots: | ||
43 | /** | 59 | /** | ||
44 | * Search for @p text in the documentation view. | 60 | * Search for @p text in the documentation view. | ||
45 | */ | 61 | */ | ||
46 | void search(const QString& text, KDevelop::DocumentationFindWidget::FindOptions options); | 62 | void search(const QString& text, KDevelop::DocumentationFindWidget::FindOptions options); | ||
47 | 63 | | |||
48 | /** | 64 | /** | ||
49 | * Updates the contents, in case it was initialized with a documentation instance, | 65 | * Updates the contents, in case it was initialized with a documentation instance, | ||
50 | * doesn't change anything otherwise | 66 | * doesn't change anything otherwise | ||
51 | * | 67 | * | ||
52 | * @sa setDocumentation(IDocumentation::Ptr) | 68 | * @sa setDocumentation(IDocumentation::Ptr) | ||
53 | */ | 69 | */ | ||
54 | void update(); | 70 | void update(); | ||
55 | 71 | | |||
72 | private slots: | ||||
73 | void updateZoomFactor(double zoomFactor); | ||||
74 | | ||||
56 | private: | 75 | private: | ||
57 | IDocumentation::Ptr m_doc; | 76 | void keyPressEvent(QKeyEvent* event) override; | ||
77 | void wheelEvent(QWheelEvent* event) override; | ||||
78 | | ||||
79 | QScopedPointer<StandardDocumentationViewPrivate> const d; | ||||
58 | }; | 80 | }; | ||
59 | 81 | | |||
60 | } | 82 | } | ||
61 | #endif // KDEVPLATFORM_STANDARDDOCUMENTATIONVIEW_H | 83 | #endif // KDEVPLATFORM_STANDARDDOCUMENTATIONVIEW_H |