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:LGPL$ |
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 Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #ifndef QHELPENGINECORE_H |
41 | #define QHELPENGINECORE_H |
42 | |
43 | #include <QtHelp/qhelp_global.h> |
44 | |
45 | #include <QtCore/QUrl> |
46 | #include <QtCore/QMap> |
47 | #include <QtCore/QObject> |
48 | #include <QtCore/QVariant> |
49 | |
50 | QT_BEGIN_NAMESPACE |
51 | |
52 | class QHelpEngineCorePrivate; |
53 | class QHelpFilterEngine; |
54 | struct QHelpLink; |
55 | |
56 | class QHELP_EXPORT QHelpEngineCore : public QObject |
57 | { |
58 | Q_OBJECT |
59 | Q_PROPERTY(bool autoSaveFilter READ autoSaveFilter WRITE setAutoSaveFilter) |
60 | Q_PROPERTY(QString collectionFile READ collectionFile WRITE setCollectionFile) |
61 | #if QT_DEPRECATED_SINCE(5, 15) |
62 | Q_PROPERTY(QString currentFilter READ currentFilter WRITE setCurrentFilter) |
63 | #endif |
64 | |
65 | public: |
66 | explicit QHelpEngineCore(const QString &collectionFile, QObject *parent = nullptr); |
67 | virtual ~QHelpEngineCore(); |
68 | |
69 | QHelpFilterEngine *filterEngine() const; |
70 | |
71 | bool setupData(); |
72 | |
73 | QString collectionFile() const; |
74 | void setCollectionFile(const QString &fileName); |
75 | |
76 | bool copyCollectionFile(const QString &fileName); |
77 | |
78 | static QString namespaceName(const QString &documentationFileName); |
79 | bool registerDocumentation(const QString &documentationFileName); |
80 | bool unregisterDocumentation(const QString &namespaceName); |
81 | QString documentationFileName(const QString &namespaceName); |
82 | QStringList registeredDocumentations() const; |
83 | QByteArray fileData(const QUrl &url) const; |
84 | |
85 | #if QT_DEPRECATED_SINCE(5,13) |
86 | QStringList customFilters() const; |
87 | bool removeCustomFilter(const QString &filterName); |
88 | bool addCustomFilter(const QString &filterName, |
89 | const QStringList &attributes); |
90 | |
91 | QStringList filterAttributes() const; |
92 | QStringList filterAttributes(const QString &filterName) const; |
93 | |
94 | QString currentFilter() const; |
95 | void setCurrentFilter(const QString &filterName); |
96 | |
97 | QList<QStringList> filterAttributeSets(const QString &namespaceName) const; |
98 | QList<QUrl> files(const QString namespaceName, |
99 | const QStringList &filterAttributes, |
100 | const QString &extensionFilter = QString()); |
101 | #endif |
102 | |
103 | QList<QUrl> files(const QString namespaceName, |
104 | const QString &filterName, |
105 | const QString &extensionFilter = QString()); |
106 | QUrl findFile(const QUrl &url) const; |
107 | |
108 | #if QT_DEPRECATED_SINCE(5, 15) |
109 | QT_DEPRECATED_X("Use documentsForIdentifier() instead" ) |
110 | QMap<QString, QUrl> linksForIdentifier(const QString &id) const; |
111 | QT_DEPRECATED_X("Use documentsForKeyword() instead" ) |
112 | QMap<QString, QUrl> linksForKeyword(const QString &keyword) const; |
113 | #endif |
114 | |
115 | QList<QHelpLink> documentsForIdentifier(const QString &id) const; |
116 | QList<QHelpLink> documentsForIdentifier(const QString &id, const QString &filterName) const; |
117 | QList<QHelpLink> documentsForKeyword(const QString &keyword) const; |
118 | QList<QHelpLink> documentsForKeyword(const QString &keyword, const QString &filterName) const; |
119 | |
120 | bool removeCustomValue(const QString &key); |
121 | QVariant customValue(const QString &key, |
122 | const QVariant &defaultValue = QVariant()) const; |
123 | bool setCustomValue(const QString &key, const QVariant &value); |
124 | |
125 | static QVariant metaData(const QString &documentationFileName, |
126 | const QString &name); |
127 | |
128 | QString error() const; |
129 | |
130 | void setAutoSaveFilter(bool save); |
131 | bool autoSaveFilter() const; |
132 | |
133 | void setUsesFilterEngine(bool uses); |
134 | bool usesFilterEngine() const; |
135 | |
136 | Q_SIGNALS: |
137 | void setupStarted(); |
138 | void setupFinished(); |
139 | void warning(const QString &msg); |
140 | |
141 | #if QT_DEPRECATED_SINCE(5,13) |
142 | void currentFilterChanged(const QString &newFilter); |
143 | void readersAboutToBeInvalidated(); |
144 | #endif |
145 | |
146 | protected: |
147 | QHelpEngineCore(QHelpEngineCorePrivate *helpEngineCorePrivate, |
148 | QObject *parent); |
149 | |
150 | private: |
151 | QHelpEngineCorePrivate *d; |
152 | friend class QHelpEngineCorePrivate; |
153 | }; |
154 | |
155 | QT_END_NAMESPACE |
156 | |
157 | #endif // QHELPENGINECORE_H |
158 | |