diff options
author | ck <qt-info@nokia.com> | 2009-07-27 15:41:41 (GMT) |
---|---|---|
committer | ck <qt-info@nokia.com> | 2009-07-27 15:41:41 (GMT) |
commit | 2ab5c57b593cb6874c035cb3abee574464ea8f30 (patch) | |
tree | 085d55247fe777fd40f895610a49c6a1531bd38f /tools/assistant/lib/qhelpsearchindexreader_default.cpp | |
parent | e5ef272382b124cf5d051ed7f25324fc804d97f6 (diff) | |
download | Qt-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
Diffstat (limited to 'tools/assistant/lib/qhelpsearchindexreader_default.cpp')
-rw-r--r-- | tools/assistant/lib/qhelpsearchindexreader_default.cpp | 49 |
1 files changed, 5 insertions, 44 deletions
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); |