1 | // Copyright (C) 2016 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 |
3 | |
4 | #ifndef HELPENGINEWRAPPER_H |
5 | #define HELPENGINEWRAPPER_H |
6 | |
7 | #include <QtCore/QMap> |
8 | #include <QtCore/QObject> |
9 | #include <QtCore/QString> |
10 | #include <QtCore/QStringList> |
11 | #include <QtCore/QUrl> |
12 | #include <QtGui/QFont> |
13 | #include <QtGui/QFontDatabase> |
14 | |
15 | #include "qhelplink.h" |
16 | |
17 | QT_BEGIN_NAMESPACE |
18 | |
19 | class QFileSystemWatcher; |
20 | class QHelpContentModel; |
21 | class QHelpContentWidget; |
22 | class QHelpIndexModel; |
23 | class QHelpIndexWidget; |
24 | class QHelpSearchEngine; |
25 | class QHelpFilterEngine; |
26 | class QHelpEngineCore; |
27 | |
28 | enum { |
29 | ShowHomePage = 0, |
30 | ShowBlankPage = 1, |
31 | ShowLastPages = 2 |
32 | }; |
33 | |
34 | class HelpEngineWrapperPrivate; |
35 | class TimeoutForwarder; |
36 | |
37 | class HelpEngineWrapper : public QObject |
38 | { |
39 | Q_OBJECT |
40 | Q_DISABLE_COPY(HelpEngineWrapper) |
41 | friend class TimeoutForwarder; |
42 | public: |
43 | static HelpEngineWrapper &instance(); |
44 | static HelpEngineWrapper &instance(const QString &collectionFile); |
45 | static void removeInstance(); |
46 | |
47 | // Forwarded help engine member functions, possibly enriched. |
48 | QHelpSearchEngine *searchEngine() const; |
49 | QHelpContentModel *contentModel() const; |
50 | QHelpIndexModel *indexModel() const; |
51 | QHelpContentWidget *contentWidget(); |
52 | QHelpIndexWidget *indexWidget(); |
53 | bool setupData(); |
54 | const QStringList registeredDocumentations() const; |
55 | QString documentationFileName(const QString &namespaceName) const; |
56 | const QString collectionFile() const; |
57 | bool registerDocumentation(const QString &docFile); |
58 | bool unregisterDocumentation(const QString &namespaceName); |
59 | QUrl findFile(const QUrl &url) const; |
60 | QByteArray fileData(const QUrl &url) const; |
61 | QList<QHelpLink> documentsForIdentifier(const QString &id) const; |
62 | QString error() const; |
63 | |
64 | QHelpFilterEngine *filterEngine() const; |
65 | |
66 | /* |
67 | * To be called after assistant has finished looking for new documentation. |
68 | * This will mainly cause the search index to be updated, if necessary. |
69 | */ |
70 | void initialDocSetupDone(); |
71 | |
72 | const QStringList qtDocInfo(const QString &component) const; |
73 | void setQtDocInfo(const QString &component, const QStringList &doc); |
74 | |
75 | const QString homePage() const; |
76 | void setHomePage(const QString &page); |
77 | const QString defaultHomePage() const; |
78 | void setDefaultHomePage(const QString &page); |
79 | |
80 | int lastTabPage() const; |
81 | void setLastTabPage(int lastPage); |
82 | |
83 | // TODO: Don't allow last pages and zoom factors to be set in isolation |
84 | // Perhaps also fill up missing elements automatically or assert. |
85 | const QStringList lastShownPages() const; |
86 | void setLastShownPages(const QStringList &lastShownPages); |
87 | const QStringList lastZoomFactors() const; |
88 | void setLastZoomFactors(const QStringList &lastZoomFactors); |
89 | |
90 | const QString cacheDir() const; |
91 | bool cacheDirIsRelativeToCollection() const; |
92 | void setCacheDir(const QString &cacheDir, bool relativeToCollection); |
93 | |
94 | bool filterFunctionalityEnabled() const; |
95 | void setFilterFunctionalityEnabled(bool enabled); |
96 | |
97 | bool filterToolbarVisible() const; |
98 | void setFilterToolbarVisible(bool visible); |
99 | |
100 | bool addressBarEnabled() const; |
101 | void setAddressBarEnabled(bool enabled); |
102 | |
103 | bool addressBarVisible() const; |
104 | void setAddressBarVisible(bool visible); |
105 | |
106 | bool documentationManagerEnabled() const; |
107 | void setDocumentationManagerEnabled(bool enabled); |
108 | |
109 | const QByteArray () const; |
110 | void (const QByteArray &texts); |
111 | const QByteArray aboutTexts() const; |
112 | void setAboutTexts(const QByteArray &texts); |
113 | const QByteArray aboutIcon() const; |
114 | void setAboutIcon(const QByteArray &icon); |
115 | const QByteArray aboutImages() const; |
116 | void setAboutImages(const QByteArray &images); |
117 | |
118 | const QString windowTitle() const; |
119 | void setWindowTitle(const QString &windowTitle); |
120 | |
121 | const QByteArray applicationIcon() const; |
122 | void setApplicationIcon(const QByteArray &icon); |
123 | |
124 | const QByteArray mainWindow() const; |
125 | void setMainWindow(const QByteArray &mainWindow); |
126 | const QByteArray mainWindowGeometry() const; |
127 | void setMainWindowGeometry(const QByteArray &geometry); |
128 | |
129 | const QByteArray bookmarks() const; |
130 | void setBookmarks(const QByteArray &bookmarks); |
131 | |
132 | int startOption() const; |
133 | void setStartOption(int option); |
134 | |
135 | bool hasFontSettings() const; |
136 | bool usesAppFont() const; |
137 | void setUseAppFont(bool useAppFont); |
138 | bool usesBrowserFont() const; |
139 | void setUseBrowserFont(bool useBrowserFont); |
140 | const QFont appFont() const; |
141 | void setAppFont(const QFont &font); |
142 | QFontDatabase::WritingSystem appWritingSystem() const; |
143 | void setAppWritingSystem(QFontDatabase::WritingSystem system); |
144 | const QFont browserFont() const; |
145 | void setBrowserFont(const QFont &font); |
146 | QFontDatabase::WritingSystem browserWritingSystem() const; |
147 | void setBrowserWritingSystem(QFontDatabase::WritingSystem system); |
148 | |
149 | bool showTabs() const; |
150 | void setShowTabs(bool show); |
151 | |
152 | bool fullTextSearchFallbackEnabled() const; |
153 | |
154 | const QByteArray topicChooserGeometry() const; |
155 | void setTopicChooserGeometry(const QByteArray &geometry); |
156 | |
157 | QHelpEngineCore *helpEngine() const; |
158 | |
159 | signals: |
160 | |
161 | // For asynchronous doc updates triggered by external actions. |
162 | void documentationRemoved(const QString &namespaceName); |
163 | void documentationUpdated(const QString &namespaceName); |
164 | |
165 | // Forwarded from QHelpEngineCore. |
166 | void setupFinished(); |
167 | |
168 | private: |
169 | HelpEngineWrapper(const QString &collectionFile); |
170 | ~HelpEngineWrapper(); |
171 | |
172 | static HelpEngineWrapper *helpEngineWrapper; |
173 | |
174 | HelpEngineWrapperPrivate *d; |
175 | }; |
176 | |
177 | QT_END_NAMESPACE |
178 | |
179 | #endif // HELPENGINEWRAPPER_H |
180 | |