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 QHELPINDEXWIDGET_H |
41 | #define QHELPINDEXWIDGET_H |
42 | |
43 | #include <QtHelp/qhelp_global.h> |
44 | |
45 | #include <QtCore/QUrl> |
46 | #include <QtCore/QStringListModel> |
47 | #include <QtWidgets/QListView> |
48 | |
49 | QT_BEGIN_NAMESPACE |
50 | |
51 | |
52 | class QHelpEnginePrivate; |
53 | class QHelpEngineCore; |
54 | class QHelpIndexModelPrivate; |
55 | struct QHelpLink; |
56 | |
57 | class QHELP_EXPORT QHelpIndexModel : public QStringListModel |
58 | { |
59 | Q_OBJECT |
60 | |
61 | public: |
62 | void createIndex(const QString &customFilterName); |
63 | QModelIndex filter(const QString &filter, |
64 | const QString &wildcard = QString()); |
65 | |
66 | #if QT_DEPRECATED_SINCE(5, 15) |
67 | QT_DEPRECATED_X("Use QHelpEngineCore::documentsForKeyword() instead" ) |
68 | QMap<QString, QUrl> linksForKeyword(const QString &keyword) const; |
69 | #endif |
70 | bool isCreatingIndex() const; |
71 | QHelpEngineCore *helpEngine() const; |
72 | |
73 | Q_SIGNALS: |
74 | void indexCreationStarted(); |
75 | void indexCreated(); |
76 | |
77 | private Q_SLOTS: |
78 | void insertIndices(); |
79 | |
80 | private: |
81 | QHelpIndexModel(QHelpEnginePrivate *helpEngine); |
82 | ~QHelpIndexModel(); |
83 | |
84 | QHelpIndexModelPrivate *d; |
85 | friend class QHelpEnginePrivate; |
86 | }; |
87 | |
88 | class QHELP_EXPORT QHelpIndexWidget : public QListView |
89 | { |
90 | Q_OBJECT |
91 | |
92 | Q_SIGNALS: |
93 | #if QT_DEPRECATED_SINCE(5, 15) |
94 | QT_DEPRECATED_X("Use documentActivated() instead" ) |
95 | void linkActivated(const QUrl &link, const QString &keyword); |
96 | QT_DEPRECATED_X("Use documentsActivated() instead" ) |
97 | void linksActivated(const QMap<QString, QUrl> &links, |
98 | const QString &keyword); |
99 | #endif |
100 | void documentActivated(const QHelpLink &document, |
101 | const QString &keyword); |
102 | void documentsActivated(const QList<QHelpLink> &documents, |
103 | const QString &keyword); |
104 | |
105 | public Q_SLOTS: |
106 | void filterIndices(const QString &filter, |
107 | const QString &wildcard = QString()); |
108 | void activateCurrentItem(); |
109 | |
110 | private Q_SLOTS: |
111 | void showLink(const QModelIndex &index); |
112 | |
113 | private: |
114 | QHelpIndexWidget(); |
115 | friend class QHelpEngine; |
116 | }; |
117 | |
118 | QT_END_NAMESPACE |
119 | |
120 | #endif |
121 | |