diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2024-02-06 21:04:05 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2024-02-09 12:41:16 +0100 |
commit | 14f26553af74fc77a1c5b3475715714f7c07def3 (patch) | |
tree | cabbf1f22e851b3e7bbd52010339d80eda96a0d5 /src/assistant/help/qhelpenginecore.cpp | |
parent | bde0f68d996a9e336a6bc6de9b58c6583f742071 (diff) |
QtHelp: Separate QHelpEnginePrivate from QHelpEngineCorePrivate
Task-number: QTBUG-122025
Change-Id: Iec252a705046d7e5fab6606210ffb29585b3019e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Diffstat (limited to 'src/assistant/help/qhelpenginecore.cpp')
-rw-r--r-- | src/assistant/help/qhelpenginecore.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/assistant/help/qhelpenginecore.cpp b/src/assistant/help/qhelpenginecore.cpp index 0f5d57c55..7cc0af3bb 100644 --- a/src/assistant/help/qhelpenginecore.cpp +++ b/src/assistant/help/qhelpenginecore.cpp @@ -14,15 +14,12 @@ QT_BEGIN_NAMESPACE -void QHelpEngineCorePrivate::init(const QString &collectionFile, - QHelpEngineCore *helpEngineCore) +QHelpEngineCorePrivate::QHelpEngineCorePrivate(const QString &collectionFile, + QHelpEngineCore *helpEngineCore) { q = helpEngineCore; - collectionHandler = new QHelpCollectionHandler(collectionFile, helpEngineCore); - connect(collectionHandler, &QHelpCollectionHandler::error, - this, &QHelpEngineCorePrivate::errorReceived); - filterEngine->setCollectionHandler(collectionHandler); - needsSetup = true; + filterEngine = new QHelpFilterEngine(q); + init(collectionFile); } QHelpEngineCorePrivate::~QHelpEngineCorePrivate() @@ -30,6 +27,17 @@ QHelpEngineCorePrivate::~QHelpEngineCorePrivate() delete collectionHandler; } +void QHelpEngineCorePrivate::init(const QString &collectionFile) +{ + if (collectionHandler) + delete collectionHandler; + collectionHandler = new QHelpCollectionHandler(collectionFile, q); + connect(collectionHandler, &QHelpCollectionHandler::error, + this, &QHelpEngineCorePrivate::errorReceived); + filterEngine->setCollectionHandler(collectionHandler); + needsSetup = true; +} + bool QHelpEngineCorePrivate::setup() { error.clear(); @@ -147,22 +155,16 @@ void QHelpEngineCorePrivate::errorReceived(const QString &msg) */ QHelpEngineCore::QHelpEngineCore(const QString &collectionFile, QObject *parent) : QObject(parent) -{ - d = new QHelpEngineCorePrivate(); - d->filterEngine = new QHelpFilterEngine(this); - d->init(collectionFile, this); -} + , d(new QHelpEngineCorePrivate(collectionFile, this)) +{} /*! \internal */ -QHelpEngineCore::QHelpEngineCore(QHelpEngineCorePrivate *helpEngineCorePrivate, - QObject *parent) +QHelpEngineCore::QHelpEngineCore(QHelpEngineCorePrivate *helpEngineCorePrivate, QObject *parent) : QObject(parent) -{ - d = helpEngineCorePrivate; - d->filterEngine = new QHelpFilterEngine(this); -} + , d(helpEngineCorePrivate) +{} /*! Destructs the help engine. @@ -195,8 +197,7 @@ void QHelpEngineCore::setCollectionFile(const QString &fileName) delete d->collectionHandler; d->collectionHandler = nullptr; } - d->init(fileName, this); - d->needsSetup = true; + d->init(fileName); } /*! |