1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Assistant of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef HELPENGINEWRAPPER_H |
30 | #define HELPENGINEWRAPPER_H |
31 | |
32 | #include <QtCore/QMap> |
33 | #include <QtCore/QObject> |
34 | #include <QtCore/QString> |
35 | #include <QtCore/QStringList> |
36 | #include <QtCore/QUrl> |
37 | #include <QtGui/QFont> |
38 | #include <QtGui/QFontDatabase> |
39 | |
40 | QT_BEGIN_NAMESPACE |
41 | |
42 | class QFileSystemWatcher; |
43 | class QHelpContentModel; |
44 | class QHelpContentWidget; |
45 | class QHelpIndexModel; |
46 | class QHelpIndexWidget; |
47 | class QHelpSearchEngine; |
48 | class QHelpFilterEngine; |
49 | class QHelpEngineCore; |
50 | struct QHelpLink; |
51 | |
52 | enum { |
53 | ShowHomePage = 0, |
54 | ShowBlankPage = 1, |
55 | ShowLastPages = 2 |
56 | }; |
57 | |
58 | class HelpEngineWrapperPrivate; |
59 | class TimeoutForwarder; |
60 | |
61 | class HelpEngineWrapper : public QObject |
62 | { |
63 | Q_OBJECT |
64 | Q_DISABLE_COPY(HelpEngineWrapper) |
65 | friend class TimeoutForwarder; |
66 | public: |
67 | static HelpEngineWrapper &instance(const QString &collectionFile = QString()); |
68 | static void removeInstance(); |
69 | |
70 | // Forwarded help engine member functions, possibly enriched. |
71 | QHelpSearchEngine *searchEngine() const; |
72 | QHelpContentModel *contentModel() const; |
73 | QHelpIndexModel *indexModel() const; |
74 | QHelpContentWidget *contentWidget(); |
75 | QHelpIndexWidget *indexWidget(); |
76 | bool setupData(); |
77 | const QStringList registeredDocumentations() const; |
78 | QString documentationFileName(const QString &namespaceName) const; |
79 | const QString collectionFile() const; |
80 | bool registerDocumentation(const QString &docFile); |
81 | bool unregisterDocumentation(const QString &namespaceName); |
82 | QUrl findFile(const QUrl &url) const; |
83 | QByteArray fileData(const QUrl &url) const; |
84 | QList<QHelpLink> documentsForIdentifier(const QString &id) const; |
85 | QString error() const; |
86 | |
87 | QHelpFilterEngine *filterEngine() const; |
88 | |
89 | /* |
90 | * To be called after assistant has finished looking for new documentation. |
91 | * This will mainly cause the search index to be updated, if necessary. |
92 | */ |
93 | void initialDocSetupDone(); |
94 | |
95 | const QStringList qtDocInfo(const QString &component) const; |
96 | void setQtDocInfo(const QString &component, const QStringList &doc); |
97 | |
98 | const QString homePage() const; |
99 | void setHomePage(const QString &page); |
100 | const QString defaultHomePage() const; |
101 | void setDefaultHomePage(const QString &page); |
102 | |
103 | int lastTabPage() const; |
104 | void setLastTabPage(int lastPage); |
105 | |
106 | // TODO: Don't allow last pages and zoom factors to be set in isolation |
107 | // Perhaps also fill up missing elements automatically or assert. |
108 | const QStringList lastShownPages() const; |
109 | void setLastShownPages(const QStringList &lastShownPages); |
110 | const QStringList lastZoomFactors() const; |
111 | void setLastZoomFactors(const QStringList &lastZoomFactors); |
112 | |
113 | const QString cacheDir() const; |
114 | bool cacheDirIsRelativeToCollection() const; |
115 | void setCacheDir(const QString &cacheDir, bool relativeToCollection); |
116 | |
117 | bool filterFunctionalityEnabled() const; |
118 | void setFilterFunctionalityEnabled(bool enabled); |
119 | |
120 | bool filterToolbarVisible() const; |
121 | void setFilterToolbarVisible(bool visible); |
122 | |
123 | bool addressBarEnabled() const; |
124 | void setAddressBarEnabled(bool enabled); |
125 | |
126 | bool addressBarVisible() const; |
127 | void setAddressBarVisible(bool visible); |
128 | |
129 | bool documentationManagerEnabled() const; |
130 | void setDocumentationManagerEnabled(bool enabled); |
131 | |
132 | const QByteArray () const; |
133 | void (const QByteArray &texts); |
134 | const QByteArray aboutTexts() const; |
135 | void setAboutTexts(const QByteArray &texts); |
136 | const QByteArray aboutIcon() const; |
137 | void setAboutIcon(const QByteArray &icon); |
138 | const QByteArray aboutImages() const; |
139 | void setAboutImages(const QByteArray &images); |
140 | |
141 | const QString windowTitle() const; |
142 | void setWindowTitle(const QString &windowTitle); |
143 | |
144 | const QByteArray applicationIcon() const; |
145 | void setApplicationIcon(const QByteArray &icon); |
146 | |
147 | const QByteArray mainWindow() const; |
148 | void setMainWindow(const QByteArray &mainWindow); |
149 | const QByteArray mainWindowGeometry() const; |
150 | void setMainWindowGeometry(const QByteArray &geometry); |
151 | |
152 | const QByteArray bookmarks() const; |
153 | void setBookmarks(const QByteArray &bookmarks); |
154 | |
155 | int startOption() const; |
156 | void setStartOption(int option); |
157 | |
158 | bool hasFontSettings() const; |
159 | bool usesAppFont() const; |
160 | void setUseAppFont(bool useAppFont); |
161 | bool usesBrowserFont() const; |
162 | void setUseBrowserFont(bool useBrowserFont); |
163 | const QFont appFont() const; |
164 | void setAppFont(const QFont &font); |
165 | QFontDatabase::WritingSystem appWritingSystem() const; |
166 | void setAppWritingSystem(QFontDatabase::WritingSystem system); |
167 | const QFont browserFont() const; |
168 | void setBrowserFont(const QFont &font); |
169 | QFontDatabase::WritingSystem browserWritingSystem() const; |
170 | void setBrowserWritingSystem(QFontDatabase::WritingSystem system); |
171 | |
172 | bool showTabs() const; |
173 | void setShowTabs(bool show); |
174 | |
175 | bool fullTextSearchFallbackEnabled() const; |
176 | |
177 | const QByteArray topicChooserGeometry() const; |
178 | void setTopicChooserGeometry(const QByteArray &geometry); |
179 | |
180 | QHelpEngineCore *helpEngine() const; |
181 | |
182 | signals: |
183 | |
184 | // For asynchronous doc updates triggered by external actions. |
185 | void documentationRemoved(const QString &namespaceName); |
186 | void documentationUpdated(const QString &namespaceName); |
187 | |
188 | // Forwarded from QHelpEngineCore. |
189 | void setupFinished(); |
190 | |
191 | private: |
192 | HelpEngineWrapper(const QString &collectionFile); |
193 | ~HelpEngineWrapper(); |
194 | |
195 | static HelpEngineWrapper *helpEngineWrapper; |
196 | |
197 | HelpEngineWrapperPrivate *d; |
198 | }; |
199 | |
200 | QT_END_NAMESPACE |
201 | |
202 | #endif // HELPENGINEWRAPPER_H |
203 | |