1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** Contact: Qt Software Information ([email protected])
|
---|
5 | **
|
---|
6 | ** This file is part of the Qt Assistant of the Qt Toolkit.
|
---|
7 | **
|
---|
8 | ** $QT_BEGIN_LICENSE:LGPL$
|
---|
9 | ** Commercial Usage
|
---|
10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
11 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
12 | ** Software or, alternatively, in accordance with the terms contained in
|
---|
13 | ** a written agreement between you and Nokia.
|
---|
14 | **
|
---|
15 | ** GNU Lesser General Public License Usage
|
---|
16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
---|
17 | ** General Public License version 2.1 as published by the Free Software
|
---|
18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
---|
19 | ** packaging of this file. Please review the following information to
|
---|
20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
---|
21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
---|
22 | **
|
---|
23 | ** In addition, as a special exception, Nokia gives you certain
|
---|
24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
---|
25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
---|
26 | ** package.
|
---|
27 | **
|
---|
28 | ** GNU General Public License Usage
|
---|
29 | ** Alternatively, this file may be used under the terms of the GNU
|
---|
30 | ** General Public License version 3.0 as published by the Free Software
|
---|
31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
---|
32 | ** packaging of this file. Please review the following information to
|
---|
33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
---|
34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
---|
35 | **
|
---|
36 | ** If you are unsure which license is appropriate for your use, please
|
---|
37 | ** contact the sales department at [email protected].
|
---|
38 | ** $QT_END_LICENSE$
|
---|
39 | **
|
---|
40 | ****************************************************************************/
|
---|
41 |
|
---|
42 | #include "qhelpdatainterface_p.h"
|
---|
43 |
|
---|
44 | QT_BEGIN_NAMESPACE
|
---|
45 |
|
---|
46 | /*!
|
---|
47 | \internal
|
---|
48 | \class QHelpDataContentItem
|
---|
49 | \since 4.4
|
---|
50 | \brief The QHelpDataContentItem class provides an item which represents
|
---|
51 | a topic or section of the contents.
|
---|
52 |
|
---|
53 | Every item holds several pieces of information, most notably the title
|
---|
54 | which can later be displayed in a contents overview. The reference is used
|
---|
55 | to store a relative file link to the corresponding section in the
|
---|
56 | documentation.
|
---|
57 | */
|
---|
58 |
|
---|
59 | /*!
|
---|
60 | Constructs a new content item with \a parent as parent item.
|
---|
61 | The constucted item has the title \a title and links to the
|
---|
62 | location specified by \a reference.
|
---|
63 | */
|
---|
64 | QHelpDataContentItem::QHelpDataContentItem(QHelpDataContentItem *parent,
|
---|
65 | const QString &title, const QString &reference)
|
---|
66 | : m_title(title), m_reference(reference)
|
---|
67 | {
|
---|
68 | if (parent)
|
---|
69 | parent->m_children.append(this);
|
---|
70 | }
|
---|
71 |
|
---|
72 | /*!
|
---|
73 | Destructs the item and its children.
|
---|
74 | */
|
---|
75 | QHelpDataContentItem::~QHelpDataContentItem()
|
---|
76 | {
|
---|
77 | qDeleteAll(m_children);
|
---|
78 | }
|
---|
79 |
|
---|
80 | /*!
|
---|
81 | Returns the title of the item.
|
---|
82 | */
|
---|
83 | QString QHelpDataContentItem::title() const
|
---|
84 | {
|
---|
85 | return m_title;
|
---|
86 | }
|
---|
87 |
|
---|
88 | /*!
|
---|
89 | Returns the file reference of the item.
|
---|
90 | */
|
---|
91 | QString QHelpDataContentItem::reference() const
|
---|
92 | {
|
---|
93 | return m_reference;
|
---|
94 | }
|
---|
95 |
|
---|
96 | /*!
|
---|
97 | Returns a list of all its child items.
|
---|
98 | */
|
---|
99 | QList<QHelpDataContentItem*> QHelpDataContentItem::children() const
|
---|
100 | {
|
---|
101 | return m_children;
|
---|
102 | }
|
---|
103 |
|
---|
104 | bool QHelpDataIndexItem::operator==(const QHelpDataIndexItem & other) const
|
---|
105 | {
|
---|
106 | return (other.name == name)
|
---|
107 | && (other.reference == reference);
|
---|
108 | }
|
---|
109 |
|
---|
110 |
|
---|
111 |
|
---|
112 | /*!
|
---|
113 | \internal
|
---|
114 | \class QHelpDataFilterSection
|
---|
115 | \since 4.4
|
---|
116 | */
|
---|
117 |
|
---|
118 | /*!
|
---|
119 | Constructs a help data filter section.
|
---|
120 | */
|
---|
121 | QHelpDataFilterSection::QHelpDataFilterSection()
|
---|
122 | {
|
---|
123 | d = new QHelpDataFilterSectionData();
|
---|
124 | }
|
---|
125 |
|
---|
126 | /*!
|
---|
127 | Adds the filter attribute \a filter to the filter attributes of
|
---|
128 | this section.
|
---|
129 | */
|
---|
130 | void QHelpDataFilterSection::addFilterAttribute(const QString &filter)
|
---|
131 | {
|
---|
132 | d->filterAttributes.append(filter);
|
---|
133 | }
|
---|
134 |
|
---|
135 | /*!
|
---|
136 | Returns a list of all filter attributes defined for this section.
|
---|
137 | */
|
---|
138 | QStringList QHelpDataFilterSection::filterAttributes() const
|
---|
139 | {
|
---|
140 | return d->filterAttributes;
|
---|
141 | }
|
---|
142 |
|
---|
143 | /*!
|
---|
144 | Adds the index item \a index to the list of indices.
|
---|
145 | */
|
---|
146 | void QHelpDataFilterSection::addIndex(const QHelpDataIndexItem &index)
|
---|
147 | {
|
---|
148 | d->indices.append(index);
|
---|
149 | }
|
---|
150 |
|
---|
151 | /*!
|
---|
152 | Sets the filter sections list of indices to \a indices.
|
---|
153 | */
|
---|
154 | void QHelpDataFilterSection::setIndices(const QList<QHelpDataIndexItem> &indices)
|
---|
155 | {
|
---|
156 | d->indices = indices;
|
---|
157 | }
|
---|
158 |
|
---|
159 | /*!
|
---|
160 | Returns the list of indices.
|
---|
161 | */
|
---|
162 | QList<QHelpDataIndexItem> QHelpDataFilterSection::indices() const
|
---|
163 | {
|
---|
164 | return d->indices;
|
---|
165 | }
|
---|
166 |
|
---|
167 | /*!
|
---|
168 | Adds the top level content item \a content to the filter section.
|
---|
169 | */
|
---|
170 | void QHelpDataFilterSection::addContent(QHelpDataContentItem *content)
|
---|
171 | {
|
---|
172 | d->contents.append(content);
|
---|
173 | }
|
---|
174 |
|
---|
175 | /*!
|
---|
176 | Sets the list of top level content items of the filter section to
|
---|
177 | \a contents.
|
---|
178 | */
|
---|
179 | void QHelpDataFilterSection::setContents(const QList<QHelpDataContentItem*> &contents)
|
---|
180 | {
|
---|
181 | qDeleteAll(d->contents);
|
---|
182 | d->contents = contents;
|
---|
183 | }
|
---|
184 |
|
---|
185 | /*!
|
---|
186 | Returns a list of top level content items.
|
---|
187 | */
|
---|
188 | QList<QHelpDataContentItem*> QHelpDataFilterSection::contents() const
|
---|
189 | {
|
---|
190 | return d->contents;
|
---|
191 | }
|
---|
192 |
|
---|
193 | /*!
|
---|
194 | Adds the file \a file to the filter section.
|
---|
195 | */
|
---|
196 | void QHelpDataFilterSection::addFile(const QString &file)
|
---|
197 | {
|
---|
198 | d->files.append(file);
|
---|
199 | }
|
---|
200 |
|
---|
201 | /*!
|
---|
202 | Set the list of files to \a files.
|
---|
203 | */
|
---|
204 | void QHelpDataFilterSection::setFiles(const QStringList &files)
|
---|
205 | {
|
---|
206 | d->files = files;
|
---|
207 | }
|
---|
208 |
|
---|
209 | /*!
|
---|
210 | Returns the list of files.
|
---|
211 | */
|
---|
212 | QStringList QHelpDataFilterSection::files() const
|
---|
213 | {
|
---|
214 | return d->files;
|
---|
215 | }
|
---|
216 |
|
---|
217 | /*!
|
---|
218 | \internal
|
---|
219 | \class QHelpDataInterface
|
---|
220 | \since 4.4
|
---|
221 | */
|
---|
222 |
|
---|
223 | /*!
|
---|
224 | \fn QHelpDataInterface::QHelpDataInterface()
|
---|
225 |
|
---|
226 | Constructs a new help data interface.
|
---|
227 | */
|
---|
228 |
|
---|
229 | /*!
|
---|
230 | \fn QHelpDataInterface::~QHelpDataInterface()
|
---|
231 |
|
---|
232 | Destroys the help data interface.
|
---|
233 | */
|
---|
234 |
|
---|
235 | /*!
|
---|
236 | \fn QString QHelpDataInterface::namespaceName() const = 0
|
---|
237 |
|
---|
238 | Returns the namespace name of the help data set.
|
---|
239 | */
|
---|
240 |
|
---|
241 | /*!
|
---|
242 | \fn QString QHelpDataInterface::virtualFolder() const = 0
|
---|
243 |
|
---|
244 | Returns the virtual folder of the help data set.
|
---|
245 | */
|
---|
246 |
|
---|
247 | /*!
|
---|
248 | \fn QList<QHelpDataCustomFilter> QHelpDataInterface::customFilters () const = 0
|
---|
249 |
|
---|
250 | Returns a list of custom filters. Defining custom filters is optional.
|
---|
251 | */
|
---|
252 |
|
---|
253 | /*!
|
---|
254 | \fn QList<QHelpDataFilterSection> QHelpDataInterface::filterSections() const = 0
|
---|
255 |
|
---|
256 | Returns a list of filter sections.
|
---|
257 | */
|
---|
258 |
|
---|
259 | /*!
|
---|
260 | \fn QMap<QString, QVariant> QHelpDataInterface::metaData() const = 0
|
---|
261 |
|
---|
262 | Returns a map of meta data. A meta data item can hold almost any data
|
---|
263 | and is identified by its name.
|
---|
264 | */
|
---|
265 |
|
---|
266 | /*!
|
---|
267 | \fn QString QHelpDataInterface::rootPath() const = 0
|
---|
268 |
|
---|
269 | Returns the root file path of the documentation data. All referenced file
|
---|
270 | path or links of content items are relative to this path.
|
---|
271 | */
|
---|
272 |
|
---|
273 | QT_END_NAMESPACE
|
---|