Changeset View
Standalone View
kdevplatform/documentation/standarddocumentationview.h
Show All 17 Lines | |||||
18 | * Free Software Foundation, Inc., | 18 | * Free Software Foundation, Inc., | ||
19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #ifndef KDEVPLATFORM_STANDARDDOCUMENTATIONVIEW_H | 22 | #ifndef KDEVPLATFORM_STANDARDDOCUMENTATIONVIEW_H | ||
23 | #define KDEVPLATFORM_STANDARDDOCUMENTATIONVIEW_H | 23 | #define KDEVPLATFORM_STANDARDDOCUMENTATIONVIEW_H | ||
24 | 24 | | |||
25 | #include <QWidget> | 25 | #include <QWidget> | ||
26 | #include <QPointer> | ||||
26 | #include "documentationexport.h" | 27 | #include "documentationexport.h" | ||
27 | #include "documentationfindwidget.h" | 28 | #include "documentationfindwidget.h" | ||
28 | #include <interfaces/idocumentation.h> | 29 | #include <interfaces/idocumentation.h> | ||
29 | 30 | | |||
30 | class QNetworkAccessManager; | 31 | class QNetworkAccessManager; | ||
31 | class QMenu; | 32 | class QMenu; | ||
32 | 33 | | |||
33 | namespace KDevelop | 34 | namespace KDevelop | ||
Show All 20 Lines | 44 | public: | |||
54 | */ | 55 | */ | ||
55 | void initZoom(const QString& configSubGroup); | 56 | void initZoom(const QString& configSubGroup); | ||
56 | 57 | | |||
57 | void setDocumentation(const IDocumentation::Ptr& doc); | 58 | void setDocumentation(const IDocumentation::Ptr& doc); | ||
58 | 59 | | |||
59 | void setOverrideCss(const QUrl &url); | 60 | void setOverrideCss(const QUrl &url); | ||
60 | 61 | | |||
61 | void load(const QUrl &url); | 62 | void load(const QUrl &url); | ||
63 | #ifdef USE_QTEXTBROWSER | ||||
64 | /** | ||||
65 | * @brief callback method for QTextBrowser::loadResource(type,url) | ||||
66 | * | ||||
67 | * @param that an instance of the class handling the request | ||||
68 | * @param type the QTextDocument::ResourceType type of the address to load | ||||
69 | * @param url the address to be loaded; can be rewritten (resolved) | ||||
70 | * @param content return variable for the loaded content. @p content is | ||||
71 | * guaranteed to be invalid upon entry. | ||||
72 | * | ||||
73 | * The function should return true if content was loaded successfully. | ||||
74 | */ | ||||
75 | typedef bool (*LoadResourceCallback)(QPointer<QObject> that, int type, QUrl& url, QVariant& content); | ||||
kossebau: Why is this method not in #ifdef USE_QTEXTBROWSER? | |||||
I've hesitated about that. It can be of course. I've left it here for now, in case anyone wants to extends the QWE or QWK backends in a similar way with a callback into the QtHelp (or other) plugin. rjvbb: I've hesitated about that. It can be of course. I've left it here for now, in case anyone wants… | |||||
Given we are flexible with the API per minor kdevelop/kdevplatform version, there is no need to prepare already for possible future extensions. So let's keep the API as minimal as needed. kossebau: Given we are flexible with the API per minor kdevelop/kdevplatform version, there is no need to… | |||||
76 | /** | ||||
77 | * @brief register a @p callback for QTextBrowser::loadResource(type,url) | ||||
KDevelop::StandardDocumentationView is part of the public KDevPlatformDocumentation API, standarddocumentationview.h is an installed header. Having a part of the public API only created depending on build-time config settings needs this settings also be deployed with the installed headers. kossebau: KDevelop::StandardDocumentationView is part of the public KDevPlatformDocumentation API… | |||||
You're saying I have 2 simple choices here:
Come to think of it, the 2nd option is probably the way to go in case there are contributed documentation plugins (are there?). Do we agree on the name or should I use something else? rjvbb: You're saying I have 2 simple choices here:
- remove #ifdef in the headerfile and provide… | |||||
I tried to stay abstract with "deployed with the installed headers"as myself I don't know best practices from the top of my head. Needs others to comment on. kossebau: I tried to stay abstract with "deployed with the installed headers"as myself I don't know best… | |||||
78 | * and the @p instance that will be handling the request. | ||||
79 | */ | ||||
80 | void registerLoadResourceCallback(QPointer<QObject> instance, const LoadResourceCallback callback); | ||||
81 | | ||||
82 | /** | ||||
83 | * @brief load a page with the given content | ||||
84 | * | ||||
85 | * @param url the address with a scheme QTextBrowser doesn't support | ||||
86 | * @param content content that QTextBrowser cannot obtain itself. | ||||
87 | * | ||||
88 | * Url and content are cached internally. | ||||
89 | */ | ||||
90 | void load(const QUrl &url, const QByteArray& content); | ||||
This name is too generic and needs to be more explicit, add to it what it restores. kossebau: This name is too generic and needs to be more explicit, add to it what it restores. | |||||
91 | /** | ||||
92 | * @brief restore the cached url and content information | ||||
93 | */ | ||||
94 | void restore(); | ||||
95 | #endif | ||||
62 | void setHtml(const QString &html); | 96 | void setHtml(const QString &html); | ||
63 | void setNetworkAccessManager(QNetworkAccessManager* manager); | 97 | void setNetworkAccessManager(QNetworkAccessManager* manager); | ||
64 | 98 | | |||
65 | /** | 99 | /** | ||
66 | * | 100 | * | ||
67 | */ | 101 | */ | ||
68 | void setDelegateLinks(bool delegate); | 102 | void setDelegateLinks(bool delegate); | ||
69 | 103 | | |||
70 | QMenu* createStandardContextMenu(); | 104 | QMenu* createStandardContextMenu(); | ||
71 | 105 | | |||
106 | /** | ||||
107 | * is @param url one using a supported scheme? | ||||
What is the requirement to be a supported scheme? The current hard-coded implementation seems rather made-up. What does "supported" mean? By whom? So "man", "help", "about", why are they supported? Why are others like "https" not? kossebau: What is the requirement to be a supported scheme? The current hard-coded implementation seems… | |||||
108 | */ | ||||
109 | static bool isUrlSchemeSupported(const QUrl& url); | ||||
110 | | ||||
72 | Q_SIGNALS: | 111 | Q_SIGNALS: | ||
73 | void linkClicked(const QUrl &link); | 112 | void linkClicked(const QUrl &link); | ||
74 | 113 | | |||
75 | public Q_SLOTS: | 114 | public Q_SLOTS: | ||
76 | /** | 115 | /** | ||
77 | * Search for @p text in the documentation view. | 116 | * Search for @p text in the documentation view. | ||
78 | */ | 117 | */ | ||
79 | void search(const QString& text, KDevelop::DocumentationFindWidget::FindOptions options); | 118 | void search(const QString& text, KDevelop::DocumentationFindWidget::FindOptions options); | ||
Show All 27 Lines |
Why is this method not in #ifdef USE_QTEXTBROWSER?