summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorck <qt-info@nokia.com>2009-07-27 15:41:41 (GMT)
committerck <qt-info@nokia.com>2009-07-27 15:41:41 (GMT)
commit2ab5c57b593cb6874c035cb3abee574464ea8f30 (patch)
tree085d55247fe777fd40f895610a49c6a1531bd38f
parente5ef272382b124cf5d051ed7f25324fc804d97f6 (diff)
downloadQt-2ab5c57b593cb6874c035cb3abee574464ea8f30.zip
Qt-2ab5c57b593cb6874c035cb3abee574464ea8f30.tar.gz
Qt-2ab5c57b593cb6874c035cb3abee574464ea8f30.tar.bz2
Assistant: Removed redundancy in index reader classes.
Moved common parts of QHelpSearchIndexReader{Default,Clucene} into a new common base class QHelpSearchIndexReader. Reviewed-by: kh
-rw-r--r--tools/assistant/lib/lib.pro96
-rw-r--r--tools/assistant/lib/qhelpsearchengine.cpp14
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader.cpp106
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene.cpp60
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene_p.h36
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_default.cpp49
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_default_p.h37
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_p.h108
8 files changed, 296 insertions, 210 deletions
diff --git a/tools/assistant/lib/lib.pro b/tools/assistant/lib/lib.pro
index bd9ed53..5d6d436 100644
--- a/tools/assistant/lib/lib.pro
+++ b/tools/assistant/lib/lib.pro
@@ -1,65 +1,71 @@
-QT += sql xml network
+QT += sql \
+ xml \
+ network
TEMPLATE = lib
TARGET = QtHelp
-DEFINES += QHELP_LIB QT_CLUCENE_SUPPORT
-CONFIG += qt warn_on
-
+DEFINES += QHELP_LIB \
+ QT_CLUCENE_SUPPORT
+CONFIG += qt \
+ warn_on
include(../../../src/qbase.pri)
-
QMAKE_TARGET_PRODUCT = Help
-QMAKE_TARGET_DESCRIPTION = Help application framework.
+QMAKE_TARGET_DESCRIPTION = Help \
+ application \
+ framework.
DEFINES -= QT_ASCII_CAST_WARNINGS
-
qclucene = QtCLucene$${QT_LIBINFIX}
-if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
+if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
mac:qclucene = $${qclucene}_debug
win32:qclucene = $${qclucene}d
}
linux-lsb-g++:LIBS += --lsb-shared-libs=$$qclucene
-unix:QMAKE_PKGCONFIG_REQUIRES += QtNetwork QtSql QtXml
+unix:QMAKE_PKGCONFIG_REQUIRES += QtNetwork \
+ QtSql \
+ QtXml
LIBS += -l$$qclucene
-unix:QMAKE_PKGCONFIG_REQUIRES += QtNetwork QtSql QtXml
-
+unix:QMAKE_PKGCONFIG_REQUIRES += QtNetwork \
+ QtSql \
+ QtXml
RESOURCES += helpsystem.qrc
-
SOURCES += qhelpenginecore.cpp \
- qhelpengine.cpp \
- qhelpdbreader.cpp \
- qhelpcontentwidget.cpp \
- qhelpindexwidget.cpp \
- qhelpgenerator.cpp \
- qhelpdatainterface.cpp \
- qhelpprojectdata.cpp \
- qhelpcollectionhandler.cpp \
- qhelpsearchengine.cpp \
- qhelpsearchquerywidget.cpp \
- qhelpsearchresultwidget.cpp \
- qhelpsearchindex_default.cpp \
- qhelpsearchindexwriter_default.cpp \
- qhelpsearchindexreader_default.cpp
+ qhelpengine.cpp \
+ qhelpdbreader.cpp \
+ qhelpcontentwidget.cpp \
+ qhelpindexwidget.cpp \
+ qhelpgenerator.cpp \
+ qhelpdatainterface.cpp \
+ qhelpprojectdata.cpp \
+ qhelpcollectionhandler.cpp \
+ qhelpsearchengine.cpp \
+ qhelpsearchquerywidget.cpp \
+ qhelpsearchresultwidget.cpp \
+ qhelpsearchindex_default.cpp \
+ qhelpsearchindexwriter_default.cpp \
+ qhelpsearchindexreader_default.cpp \
+ qhelpsearchindexreader.cpp
# access to clucene
SOURCES += qhelpsearchindexwriter_clucene.cpp \
- qhelpsearchindexreader_clucene.cpp
-
+ qhelpsearchindexreader_clucene.cpp
HEADERS += qhelpenginecore.h \
- qhelpengine.h \
- qhelpengine_p.h \
- qhelp_global.h \
- qhelpdbreader_p.h \
- qhelpcontentwidget.h \
- qhelpindexwidget.h \
- qhelpgenerator_p.h \
- qhelpdatainterface_p.h \
- qhelpprojectdata_p.h \
- qhelpcollectionhandler_p.h \
- qhelpsearchengine.h \
- qhelpsearchquerywidget.h \
- qhelpsearchresultwidget.h \
- qhelpsearchindex_default_p.h \
- qhelpsearchindexwriter_default_p.h \
- qhelpsearchindexreader_default_p.h
+ qhelpengine.h \
+ qhelpengine_p.h \
+ qhelp_global.h \
+ qhelpdbreader_p.h \
+ qhelpcontentwidget.h \
+ qhelpindexwidget.h \
+ qhelpgenerator_p.h \
+ qhelpdatainterface_p.h \
+ qhelpprojectdata_p.h \
+ qhelpcollectionhandler_p.h \
+ qhelpsearchengine.h \
+ qhelpsearchquerywidget.h \
+ qhelpsearchresultwidget.h \
+ qhelpsearchindex_default_p.h \
+ qhelpsearchindexwriter_default_p.h \
+ qhelpsearchindexreader_default_p.h \
+ qhelpsearchindexreader_p.h
# access to clucene
HEADERS += qhelpsearchindexwriter_clucene_p.h \
- qhelpsearchindexreader_clucene_p.h
+ qhelpsearchindexreader_clucene_p.h
diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp
index 2a41d04..94c5f7e 100644
--- a/tools/assistant/lib/qhelpsearchengine.cpp
+++ b/tools/assistant/lib/qhelpsearchengine.cpp
@@ -44,6 +44,7 @@
#include "qhelpsearchquerywidget.h"
#include "qhelpsearchresultwidget.h"
+#include "qhelpsearchindexreader_p.h"
#if defined(QT_CLUCENE_SUPPORT)
# include "qhelpsearchindexreader_clucene_p.h"
# include "qhelpsearchindexwriter_clucene_p.h"
@@ -147,8 +148,11 @@ private:
return;
if (!indexReader) {
- indexReader = new QHelpSearchIndexReader();
-
+#if defined(QT_CLUCENE_SUPPORT)
+ indexReader = new QHelpSearchIndexReaderClucene();
+#else
+ indexReader = new QHelpSearchIndexReaderDefault();
+#endif // QT_CLUCENE_SUPPORT
connect(indexReader, SIGNAL(searchingStarted()), this, SIGNAL(searchingStarted()));
connect(indexReader, SIGNAL(searchingFinished(int)), this, SIGNAL(searchingFinished(int)));
}
@@ -181,7 +185,7 @@ private slots:
{
#if defined(QT_CLUCENE_SUPPORT)
if (indexWriter && !helpEngine.isNull()) {
- indexWriter->optimizeIndex();
+ indexWriter->optimizeIndex();
}
#endif
}
@@ -192,7 +196,7 @@ private:
QHelpSearchQueryWidget *queryWidget;
QHelpSearchResultWidget *resultWidget;
- QHelpSearchIndexReader *indexReader;
+ qt::fulltextsearch::QHelpSearchIndexReader *indexReader;
QHelpSearchIndexWriter *indexWriter;
QPointer<QHelpEngineCore> helpEngine;
@@ -321,7 +325,7 @@ QHelpSearchEngine::QHelpSearchEngine(QHelpEngineCore *helpEngine, QObject *paren
: QObject(parent)
{
d = new QHelpSearchEnginePrivate(helpEngine);
-
+
connect(helpEngine, SIGNAL(setupFinished()), this, SLOT(indexDocumentation()));
connect(d, SIGNAL(indexingStarted()), this, SIGNAL(indexingStarted()));
diff --git a/tools/assistant/lib/qhelpsearchindexreader.cpp b/tools/assistant/lib/qhelpsearchindexreader.cpp
new file mode 100644
index 0000000..a0fcbe5
--- /dev/null
+++ b/tools/assistant/lib/qhelpsearchindexreader.cpp
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qhelpsearchindexreader_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace qt {
+ namespace fulltextsearch {
+
+QHelpSearchIndexReader::QHelpSearchIndexReader()
+ : QThread()
+ , m_cancel(false)
+{
+ // nothing todo
+}
+
+QHelpSearchIndexReader::~QHelpSearchIndexReader()
+{
+ mutex.lock();
+ this->m_cancel = true;
+ mutex.unlock();
+
+ wait();
+}
+
+void QHelpSearchIndexReader::cancelSearching()
+{
+ mutex.lock();
+ this->m_cancel = true;
+ mutex.unlock();
+}
+
+void QHelpSearchIndexReader::search(const QString &collectionFile, const QString &indexFilesFolder,
+ const QList<QHelpSearchQuery> &queryList)
+{
+ wait();
+
+ this->hitList.clear();
+ this->m_cancel = false;
+ this->m_query = queryList;
+ this->m_collectionFile = collectionFile;
+ this->m_indexFilesFolder = indexFilesFolder;
+
+ start(QThread::NormalPriority);
+}
+
+int QHelpSearchIndexReader::hitsCount() const
+{
+ QMutexLocker lock(&mutex);
+ return hitList.count();
+}
+
+QList<QHelpSearchEngine::SearchHit> QHelpSearchIndexReader::hits(int start,
+ int end) const
+{
+ QList<QHelpSearchEngine::SearchHit> hits;
+ QMutexLocker lock(&mutex);
+ for (int i = start; i < end && i < hitList.count(); ++i)
+ hits.append(hitList.at(i));
+ return hits;
+}
+
+
+ } // namespace fulltextsearch
+} // namespace qt
+
+QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
index 89d6040..b417078 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
@@ -59,60 +59,18 @@ namespace qt {
namespace fulltextsearch {
namespace clucene {
-QHelpSearchIndexReader::QHelpSearchIndexReader()
- : QThread()
- , m_cancel(false)
+QHelpSearchIndexReaderClucene::QHelpSearchIndexReaderClucene()
+ : QHelpSearchIndexReader()
{
// nothing todo
}
-QHelpSearchIndexReader::~QHelpSearchIndexReader()
+QHelpSearchIndexReaderClucene::~QHelpSearchIndexReaderClucene()
{
- mutex.lock();
- this->m_cancel = true;
- mutex.unlock();
-
- wait();
}
-void QHelpSearchIndexReader::cancelSearching()
-{
- mutex.lock();
- this->m_cancel = true;
- mutex.unlock();
-}
-void QHelpSearchIndexReader::search(const QString &collectionFile, const QString &indexFilesFolder,
- const QList<QHelpSearchQuery> &queryList)
-{
- wait();
-
- this->hitList.clear();
- this->m_cancel = false;
- this->m_query = queryList;
- this->m_collectionFile = collectionFile;
- this->m_indexFilesFolder = indexFilesFolder;
-
- start(QThread::NormalPriority);
-}
-
-int QHelpSearchIndexReader::hitsCount() const
-{
- QMutexLocker lock(&mutex);
- return hitList.count();
-}
-
-QList<QHelpSearchEngine::SearchHit> QHelpSearchIndexReader::hits(int start,
- int end) const
-{
- QList<QHelpSearchEngine::SearchHit> hits;
- QMutexLocker lock(&mutex);
- for (int i = start; i < end && i < hitList.count(); ++i)
- hits.append(hitList.at(i));
- return hits;
-}
-
-void QHelpSearchIndexReader::run()
+void QHelpSearchIndexReaderClucene::run()
{
mutex.lock();
@@ -140,7 +98,7 @@ void QHelpSearchIndexReader::run()
if(QCLuceneIndexReader::indexExists(indexPath)) {
mutex.lock();
if (m_cancel) {
- mutex.unlock();
+ mutex.unlock();
return;
}
mutex.unlock();
@@ -227,7 +185,7 @@ void QHelpSearchIndexReader::run()
}
}
-bool QHelpSearchIndexReader::defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery,
+bool QHelpSearchIndexReaderClucene::defaultQuery(const QString &term, QCLuceneBooleanQuery &booleanQuery,
QCLuceneStandardAnalyzer &analyzer)
{
const QLatin1String c("content");
@@ -244,7 +202,7 @@ bool QHelpSearchIndexReader::defaultQuery(const QString &term, QCLuceneBooleanQu
return false;
}
-bool QHelpSearchIndexReader::buildQuery(QCLuceneBooleanQuery &booleanQuery,
+bool QHelpSearchIndexReaderClucene::buildQuery(QCLuceneBooleanQuery &booleanQuery,
const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer)
{
foreach (const QHelpSearchQuery query, queryList) {
@@ -344,7 +302,7 @@ bool QHelpSearchIndexReader::buildQuery(QCLuceneBooleanQuery &booleanQuery,
return true;
}
-bool QHelpSearchIndexReader::buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery,
+bool QHelpSearchIndexReaderClucene::buildTryHarderQuery(QCLuceneBooleanQuery &booleanQuery,
const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer)
{
bool retVal = false;
@@ -367,7 +325,7 @@ bool QHelpSearchIndexReader::buildTryHarderQuery(QCLuceneBooleanQuery &booleanQu
return retVal;
}
-void QHelpSearchIndexReader::boostSearchHits(const QHelpEngineCore &engine,
+void QHelpSearchIndexReaderClucene::boostSearchHits(const QHelpEngineCore &engine,
QList<QHelpSearchEngine::SearchHit> &hitList, const QList<QHelpSearchQuery> &queryList)
{
foreach (const QHelpSearchQuery query, queryList) {
diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
index 8876d80..93ac6a8 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
@@ -53,44 +53,24 @@
// We mean it.
//
-#include "qhelpsearchengine.h"
+#include "qhelpsearchindexreader_p.h"
#include "fulltextsearch/qanalyzer_p.h"
#include "fulltextsearch/qquery_p.h"
-#include <QtCore/QList>
-#include <QtCore/QMutex>
-#include <QtCore/QObject>
-#include <QtCore/QString>
-#include <QtCore/QThread>
-#include <QtCore/QWaitCondition>
-
-class QHelpEngineCore;
-
QT_BEGIN_NAMESPACE
namespace qt {
namespace fulltextsearch {
namespace clucene {
-class QHelpSearchIndexReader : public QThread
+class QHelpSearchIndexReaderClucene : public QHelpSearchIndexReader
{
Q_OBJECT
public:
- QHelpSearchIndexReader();
- ~QHelpSearchIndexReader();
-
- void cancelSearching();
- void search(const QString &collectionFile,
- const QString &indexFilesFolder,
- const QList<QHelpSearchQuery> &queryList);
- int hitsCount() const;
- QList<QHelpSearchEngine::SearchHit> hits(int start, int end) const;
-
-signals:
- void searchingStarted();
- void searchingFinished(int hits);
+ QHelpSearchIndexReaderClucene();
+ ~QHelpSearchIndexReaderClucene();
private:
void run();
@@ -102,14 +82,6 @@ private:
const QList<QHelpSearchQuery> &queryList, QCLuceneStandardAnalyzer &analyzer);
void boostSearchHits(const QHelpEngineCore &engine, QList<QHelpSearchEngine::SearchHit> &hitList,
const QList<QHelpSearchQuery> &queryList);
-
-private:
- mutable QMutex mutex;
- QList<QHelpSearchEngine::SearchHit> hitList;
- bool m_cancel;
- QString m_collectionFile;
- QList<QHelpSearchQuery> m_query;
- QString m_indexFilesFolder;
};
} // namespace clucene
diff --git a/tools/assistant/lib/qhelpsearchindexreader_default.cpp b/tools/assistant/lib/qhelpsearchindexreader_default.cpp
index 91af925..fbf8a09 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_default.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader_default.cpp
@@ -492,56 +492,17 @@ void Reader::cleanupIndex(EntryTable &entryTable)
}
-QHelpSearchIndexReader::QHelpSearchIndexReader()
- : QThread()
- , m_cancel(false)
+QHelpSearchIndexReaderDefault::QHelpSearchIndexReaderDefault()
+ : QHelpSearchIndexReader()
{
// nothing todo
}
-QHelpSearchIndexReader::~QHelpSearchIndexReader()
+QHelpSearchIndexReaderDefault::~QHelpSearchIndexReaderDefault()
{
- mutex.lock();
- this->m_cancel = true;
- waitCondition.wakeOne();
- mutex.unlock();
-
- wait();
-}
-
-void QHelpSearchIndexReader::cancelSearching()
-{
- mutex.lock();
- this->m_cancel = true;
- mutex.unlock();
-}
-
-void QHelpSearchIndexReader::search(const QString &collectionFile,
- const QString &indexFilesFolder,
- const QList<QHelpSearchQuery> &queryList)
-{
- QMutexLocker lock(&mutex);
-
- this->hitList.clear();
- this->m_cancel = false;
- this->m_query = queryList;
- this->m_collectionFile = collectionFile;
- this->m_indexFilesFolder = indexFilesFolder;
-
- start(QThread::NormalPriority);
-}
-
-int QHelpSearchIndexReader::hitsCount() const
-{
- return hitList.count();
}
-QHelpSearchEngine::SearchHit QHelpSearchIndexReader::hit(int index) const
-{
- return hitList.at(index);
-}
-
-void QHelpSearchIndexReader::run()
+void QHelpSearchIndexReaderDefault::run()
{
mutex.lock();
@@ -571,7 +532,7 @@ void QHelpSearchIndexReader::run()
QHelpEngineCore engine(collectionFile, 0);
if (!engine.setupData())
return;
-
+
const QStringList registeredDocs = engine.registeredDocumentations();
const QStringList indexedNamespaces = engine.customValue(key).toString().
split(QLatin1String("|"), QString::SkipEmptyParts);
diff --git a/tools/assistant/lib/qhelpsearchindexreader_default_p.h b/tools/assistant/lib/qhelpsearchindexreader_default_p.h
index f0e59b4..d21fc08 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_default_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_default_p.h
@@ -54,19 +54,10 @@
//
#include "qhelpsearchindex_default_p.h"
-#include "qhelpsearchengine.h"
+#include "qhelpsearchindexreader_p.h"
#include <QtCore/QHash>
#include <QtCore/QPair>
-#include <QtCore/QList>
-#include <QtCore/QMutex>
-#include <QtCore/QString>
-#include <QtCore/QThread>
-#include <QtCore/QObject>
-#include <QtCore/QVector>
-#include <QtCore/QByteArray>
-#include <QtCore/QStringList>
-#include <QtCore/QWaitCondition>
QT_BEGIN_NAMESPACE
@@ -121,39 +112,19 @@ private:
};
-class QHelpSearchIndexReader : public QThread
+class QHelpSearchIndexReaderDefault : public QHelpSearchIndexReader
{
Q_OBJECT
public:
- QHelpSearchIndexReader();
- ~QHelpSearchIndexReader();
-
- void cancelSearching();
- void search(const QString &collectionFile,
- const QString &indexFilesFolder,
- const QList<QHelpSearchQuery> &queryList);
-
- int hitsCount() const;
- QHelpSearchEngine::SearchHit hit(int index) const;
-
-signals:
- void searchingStarted();
- void searchingFinished(int hits);
+ QHelpSearchIndexReaderDefault();
+ ~QHelpSearchIndexReaderDefault();
private:
void run();
private:
- QMutex mutex;
Reader m_reader;
- QWaitCondition waitCondition;
- QList<QHelpSearchEngine::SearchHit> hitList;
-
- bool m_cancel;
- QList<QHelpSearchQuery> m_query;
- QString m_collectionFile;
- QString m_indexFilesFolder;
};
} // namespace std
diff --git a/tools/assistant/lib/qhelpsearchindexreader_p.h b/tools/assistant/lib/qhelpsearchindexreader_p.h
new file mode 100644
index 0000000..c8f2b44
--- /dev/null
+++ b/tools/assistant/lib/qhelpsearchindexreader_p.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the Qt Assistant of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain
+** additional rights. These rights are described in the Nokia Qt LGPL
+** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at http://www.qtsoftware.com/contact.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QHELPSEARCHINDEXREADER_H
+#define QHELPSEARCHINDEXREADER_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists for the convenience
+// of the help generator tools. This header file may change from version
+// to version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "qhelpsearchengine.h"
+
+#include <QtCore/QList>
+#include <QtCore/QMutex>
+#include <QtCore/QObject>
+#include <QtCore/QString>
+#include <QtCore/QThread>
+#include <QtCore/QWaitCondition>
+
+QT_BEGIN_NAMESPACE
+
+class QHelpEngineCore;
+
+namespace qt {
+ namespace fulltextsearch {
+
+class QHelpSearchIndexReader : public QThread
+{
+ Q_OBJECT
+
+public:
+ QHelpSearchIndexReader();
+ ~QHelpSearchIndexReader();
+
+ void cancelSearching();
+ void search(const QString &collectionFile,
+ const QString &indexFilesFolder,
+ const QList<QHelpSearchQuery> &queryList);
+ int hitsCount() const;
+ QList<QHelpSearchEngine::SearchHit> hits(int start, int end) const;
+
+signals:
+ void searchingStarted();
+ void searchingFinished(int hits);
+
+protected:
+ mutable QMutex mutex;
+ QList<QHelpSearchEngine::SearchHit> hitList;
+ bool m_cancel;
+ QString m_collectionFile;
+ QList<QHelpSearchQuery> m_query;
+ QString m_indexFilesFolder;
+
+private:
+ virtual void run()=0;
+};
+
+ } // namespace fulltextsearch
+} // namespace qt
+
+QT_END_NAMESPACE
+
+#endif // QHELPSEARCHINDEXREADER_H