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 QHELPSEARCHINDEXREADER_H |
5 | #define QHELPSEARCHINDEXREADER_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists for the convenience |
12 | // of the help generator tools. This header file may change from version |
13 | // to version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "qhelpsearchengine.h" |
19 | |
20 | #include <QtCore/QList> |
21 | #include <QtCore/QMutex> |
22 | #include <QtCore/QThread> |
23 | |
24 | QT_BEGIN_NAMESPACE |
25 | |
26 | class QHelpEngineCore; |
27 | |
28 | namespace fulltextsearch { |
29 | |
30 | class QHelpSearchIndexReader : public QThread |
31 | { |
32 | Q_OBJECT |
33 | |
34 | public: |
35 | ~QHelpSearchIndexReader() override; |
36 | |
37 | void cancelSearching(); |
38 | void search(const QString &collectionFile, |
39 | const QString &indexFilesFolder, |
40 | const QString &searchInput, |
41 | bool usesFilterEngine = false); |
42 | int searchResultCount() const; |
43 | QList<QHelpSearchResult> searchResults(int start, int end) const; |
44 | |
45 | signals: |
46 | void searchingStarted(); |
47 | void searchingFinished(int searchResultCount); |
48 | |
49 | protected: |
50 | mutable QMutex m_mutex; |
51 | QList<QHelpSearchResult> m_searchResults; |
52 | bool m_cancel = false; |
53 | QString m_collectionFile; |
54 | QString m_searchInput; |
55 | QString m_indexFilesFolder; |
56 | bool m_usesFilterEngine = false; |
57 | |
58 | private: |
59 | void run() override = 0; |
60 | }; |
61 | |
62 | } // namespace fulltextsearch |
63 | |
64 | QT_END_NAMESPACE |
65 | |
66 | #endif // QHELPSEARCHINDEXREADER_H |
67 | |