summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJarek Kobus <jaroslaw.kobus@qt.io>2018-10-16 15:09:19 +0200
committerJarek Kobus <jaroslaw.kobus@qt.io>2018-10-17 13:51:11 +0000
commit7c39470f174a3ab64c5425d9e349b3fe9f1be7cd (patch)
tree885709e79718373323bb3291026a7b5725d387c1
parent757f77ac748f63e9e4e445b50fa286561e71c044 (diff)
Introduce QHelpCollectionDetails class
Which describes the details of the qch file. Change-Id: Iffb74fcbab7990f9d61e423129cc8e92ba149106 Reviewed-by: Kai Koehne <kai.koehne@qt.io>
-rw-r--r--src/assistant/help/help.pro2
-rw-r--r--src/assistant/help/qhelpcollectiondetails.cpp130
-rw-r--r--src/assistant/help/qhelpcollectiondetails.h76
3 files changed, 208 insertions, 0 deletions
diff --git a/src/assistant/help/help.pro b/src/assistant/help/help.pro
index ac747a4b5..5bdc501fc 100644
--- a/src/assistant/help/help.pro
+++ b/src/assistant/help/help.pro
@@ -12,6 +12,7 @@ DEFINES -= QT_ASCII_CAST_WARNINGS
RESOURCES += helpsystem.qrc
SOURCES += qhelpenginecore.cpp \
qhelpengine.cpp \
+ qhelpcollectiondetails.cpp \
qhelpfilterdata.cpp \
qhelpdbreader.cpp \
qhelpcontentwidget.cpp \
@@ -28,6 +29,7 @@ SOURCES += qhelpenginecore.cpp \
HEADERS += qhelpenginecore.h \
qhelpengine.h \
qhelpengine_p.h \
+ qhelpcollectiondetails.h \
qhelpfilterdata.h \
qhelp_global.h \
qhelpdbreader_p.h \
diff --git a/src/assistant/help/qhelpcollectiondetails.cpp b/src/assistant/help/qhelpcollectiondetails.cpp
new file mode 100644
index 000000000..f36512b3e
--- /dev/null
+++ b/src/assistant/help/qhelpcollectiondetails.cpp
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qhelpcollectiondetails.h"
+
+#include "qhelpdbreader_p.h"
+
+#include <QtCore/QThread>
+
+QT_BEGIN_NAMESPACE
+
+class QHelpCollectionDetailsPrivate : public QSharedData
+{
+public:
+ QHelpCollectionDetailsPrivate() = default;
+ QHelpCollectionDetailsPrivate(const QHelpCollectionDetailsPrivate &other)
+ : QSharedData(other)
+ , m_namespaceName(other.m_namespaceName)
+ , m_component(other.m_component)
+ , m_version(other.m_version)
+ { }
+ ~QHelpCollectionDetailsPrivate() = default;
+
+ QString m_namespaceName;
+ QString m_component;
+ QString m_version;
+};
+
+QHelpCollectionDetails::QHelpCollectionDetails()
+ : d(new QHelpCollectionDetailsPrivate)
+{
+}
+
+QHelpCollectionDetails::QHelpCollectionDetails(const QHelpCollectionDetails &other)
+ : d(other.d)
+{
+}
+
+QHelpCollectionDetails::~QHelpCollectionDetails()
+{
+}
+
+QHelpCollectionDetails &QHelpCollectionDetails::operator=(const QHelpCollectionDetails &other)
+{
+ d = other.d;
+ return *this;
+}
+
+void QHelpCollectionDetails::setNamespaceName(const QString &namespaceName)
+{
+ d->m_namespaceName = namespaceName;
+}
+
+void QHelpCollectionDetails::setComponent(const QString &component)
+{
+ d->m_component = component;
+}
+
+void QHelpCollectionDetails::setVersion(const QString &version)
+{
+ d->m_version = version;
+}
+
+QString QHelpCollectionDetails::namespaceName() const
+{
+ return d->m_namespaceName;
+}
+
+QString QHelpCollectionDetails::component() const
+{
+ return d->m_component;
+}
+
+QString QHelpCollectionDetails::version() const
+{
+ return d->m_version;
+}
+
+QHelpCollectionDetails QHelpCollectionDetails::helpDetails(const QString &documentationFileName)
+{
+ QHelpDBReader reader(documentationFileName,
+ QHelpGlobal::uniquifyConnectionName(QLatin1String("GetHelpDetails"),
+ QThread::currentThread()), nullptr);
+ if (reader.init()) {
+ QHelpCollectionDetails details;
+ details.setNamespaceName(reader.namespaceName());
+ details.setComponent(reader.virtualFolder());
+ details.setVersion(reader.version());
+ return details;
+ }
+ return QHelpCollectionDetails();
+}
+
+QT_END_NAMESPACE
diff --git a/src/assistant/help/qhelpcollectiondetails.h b/src/assistant/help/qhelpcollectiondetails.h
new file mode 100644
index 000000000..a4114658b
--- /dev/null
+++ b/src/assistant/help/qhelpcollectiondetails.h
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QHELPCOLLECTIONDETAILS_H
+#define QHELPCOLLECTIONDETAILS_H
+
+#include <QtHelp/qhelp_global.h>
+
+#include <QtCore/QSharedDataPointer>
+
+QT_BEGIN_NAMESPACE
+
+class QHelpCollectionDetailsPrivate;
+
+class QHELP_EXPORT QHelpCollectionDetails
+{
+public:
+ QHelpCollectionDetails();
+ QHelpCollectionDetails(const QHelpCollectionDetails &other);
+ ~QHelpCollectionDetails();
+
+ QHelpCollectionDetails &operator=(const QHelpCollectionDetails &other);
+
+ void setNamespaceName(const QString &ns);
+ void setComponent(const QString &component);
+ void setVersion(const QString &version);
+
+ QString namespaceName() const;
+ QString component() const;
+ QString version() const;
+
+ static QHelpCollectionDetails helpDetails(const QString &documentationFileName);
+
+private:
+ QSharedDataPointer<QHelpCollectionDetailsPrivate> d;
+};
+
+QT_END_NAMESPACE
+
+#endif // QHELPCOLLECTIONDETAILS_H