1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QHELPENGINECORE_H
5#define QHELPENGINECORE_H
6
7#include <QtHelp/qhelp_global.h>
8
9#include <QtCore/QUrl>
10#include <QtCore/QMap>
11#include <QtCore/QObject>
12#include <QtCore/QVariant>
13
14QT_BEGIN_NAMESPACE
15
16class QHelpEngineCorePrivate;
17class QHelpFilterEngine;
18struct QHelpLink;
19
20class QHELP_EXPORT QHelpEngineCore : public QObject
21{
22 Q_OBJECT
23 Q_PROPERTY(bool autoSaveFilter READ autoSaveFilter WRITE setAutoSaveFilter)
24 Q_PROPERTY(QString collectionFile READ collectionFile WRITE setCollectionFile)
25 Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly)
26#if QT_DEPRECATED_SINCE(5, 15)
27 Q_PROPERTY(QString currentFilter READ currentFilter WRITE setCurrentFilter)
28#endif
29
30public:
31 explicit QHelpEngineCore(const QString &collectionFile, QObject *parent = nullptr);
32 virtual ~QHelpEngineCore();
33
34 bool isReadOnly() const;
35 void setReadOnly(bool enable);
36
37 QHelpFilterEngine *filterEngine() const;
38
39 bool setupData();
40
41 QString collectionFile() const;
42 void setCollectionFile(const QString &fileName);
43
44 bool copyCollectionFile(const QString &fileName);
45
46 static QString namespaceName(const QString &documentationFileName);
47 bool registerDocumentation(const QString &documentationFileName);
48 bool unregisterDocumentation(const QString &namespaceName);
49 QString documentationFileName(const QString &namespaceName);
50 QStringList registeredDocumentations() const;
51 QByteArray fileData(const QUrl &url) const;
52
53// #if QT_DEPRECATED_SINCE(5,13)
54 QStringList customFilters() const;
55 bool removeCustomFilter(const QString &filterName);
56 bool addCustomFilter(const QString &filterName,
57 const QStringList &attributes);
58
59 QStringList filterAttributes() const;
60 QStringList filterAttributes(const QString &filterName) const;
61
62 QString currentFilter() const;
63 void setCurrentFilter(const QString &filterName);
64
65 QList<QStringList> filterAttributeSets(const QString &namespaceName) const;
66 QList<QUrl> files(const QString namespaceName,
67 const QStringList &filterAttributes,
68 const QString &extensionFilter = QString());
69// #endif
70
71 QList<QUrl> files(const QString namespaceName,
72 const QString &filterName,
73 const QString &extensionFilter = QString());
74 QUrl findFile(const QUrl &url) const;
75
76 QList<QHelpLink> documentsForIdentifier(const QString &id) const;
77 QList<QHelpLink> documentsForIdentifier(const QString &id, const QString &filterName) const;
78 QList<QHelpLink> documentsForKeyword(const QString &keyword) const;
79 QList<QHelpLink> documentsForKeyword(const QString &keyword, const QString &filterName) const;
80
81 bool removeCustomValue(const QString &key);
82 QVariant customValue(const QString &key,
83 const QVariant &defaultValue = QVariant()) const;
84 bool setCustomValue(const QString &key, const QVariant &value);
85
86 static QVariant metaData(const QString &documentationFileName,
87 const QString &name);
88
89 QString error() const;
90
91 void setAutoSaveFilter(bool save);
92 bool autoSaveFilter() const;
93
94 void setUsesFilterEngine(bool uses);
95 bool usesFilterEngine() const;
96
97Q_SIGNALS:
98 void setupStarted();
99 void setupFinished();
100 void warning(const QString &msg);
101
102// #if QT_DEPRECATED_SINCE(5,13)
103 void currentFilterChanged(const QString &newFilter);
104 void readersAboutToBeInvalidated();
105// #endif
106
107protected:
108 QHelpEngineCore(QHelpEngineCorePrivate *helpEngineCorePrivate,
109 QObject *parent);
110
111private:
112 QHelpEngineCorePrivate *d;
113 friend class QHelpEngineCorePrivate;
114};
115
116QT_END_NAMESPACE
117
118#endif // QHELPENGINECORE_H
119

source code of qttools/src/assistant/help/qhelpenginecore.h