summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-02-18 20:21:35 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-02-18 20:21:35 (GMT)
commit14866f7fd79f39c2f20f5e0149fe6e11d7121d70 (patch)
treebd6ec2bdb8e9f2656a409aacf215e2a2d08345a8
parent52e517b50aafd6cc0bec597abd50d8b3f7e982dd (diff)
parent4f4cc6e0ea79e1c363fd6f62de16c96f9c82b375 (diff)
downloadQt-14866f7fd79f39c2f20f5e0149fe6e11d7121d70.zip
Qt-14866f7fd79f39c2f20f5e0149fe6e11d7121d70.tar.gz
Qt-14866f7fd79f39c2f20f5e0149fe6e11d7121d70.tar.bz2
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/berlin-staging-1 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/berlin-staging-1: Help system: Remove hard-coded qt namespace. Help system: Handle all Clucene exceptions.
-rw-r--r--tools/assistant/lib/qhelpsearchengine.cpp6
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader.cpp6
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene.cpp10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_clucene_p.h10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_default.cpp10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_default_p.h10
-rw-r--r--tools/assistant/lib/qhelpsearchindexreader_p.h6
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp240
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h9
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_default.cpp10
-rw-r--r--tools/assistant/lib/qhelpsearchindexwriter_default_p.h10
11 files changed, 151 insertions, 176 deletions
diff --git a/tools/assistant/lib/qhelpsearchengine.cpp b/tools/assistant/lib/qhelpsearchengine.cpp
index 7c2635d..9914efa 100644
--- a/tools/assistant/lib/qhelpsearchengine.cpp
+++ b/tools/assistant/lib/qhelpsearchengine.cpp
@@ -63,9 +63,9 @@
QT_BEGIN_NAMESPACE
#if defined(QT_CLUCENE_SUPPORT)
- using namespace qt::fulltextsearch::clucene;
+ using namespace fulltextsearch::clucene;
#else
- using namespace qt::fulltextsearch::std;
+ using namespace fulltextsearch::std;
#endif
class QHelpSearchEnginePrivate : public QObject
@@ -195,7 +195,7 @@ private:
QHelpSearchQueryWidget *queryWidget;
QHelpSearchResultWidget *resultWidget;
- qt::fulltextsearch::QHelpSearchIndexReader *indexReader;
+ fulltextsearch::QHelpSearchIndexReader *indexReader;
QHelpSearchIndexWriter *indexWriter;
QPointer<QHelpEngineCore> helpEngine;
diff --git a/tools/assistant/lib/qhelpsearchindexreader.cpp b/tools/assistant/lib/qhelpsearchindexreader.cpp
index 92d7658..e79fca6 100644
--- a/tools/assistant/lib/qhelpsearchindexreader.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader.cpp
@@ -43,8 +43,7 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
+namespace fulltextsearch {
QHelpSearchIndexReader::QHelpSearchIndexReader()
: QThread()
@@ -100,7 +99,6 @@ QList<QHelpSearchEngine::SearchHit> QHelpSearchIndexReader::hits(int start,
}
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
index b5bec44..b050361 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader_clucene.cpp
@@ -55,9 +55,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
QHelpSearchIndexReaderClucene::QHelpSearchIndexReaderClucene()
: QHelpSearchIndexReader()
@@ -387,8 +386,7 @@ void QHelpSearchIndexReaderClucene::boostSearchHits(const QHelpEngineCore &engin
}
}
- } // namespace clucene
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace clucene
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
index 3e3b9dd..8f51cb1 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
@@ -60,9 +60,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
class QHelpSearchIndexReaderClucene : public QHelpSearchIndexReader
{
@@ -84,9 +83,8 @@ private:
const QList<QHelpSearchQuery> &queryList);
};
- } // namespace clucene
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace clucene
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_default.cpp b/tools/assistant/lib/qhelpsearchindexreader_default.cpp
index d2241a5..11a50d9 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_default.cpp
+++ b/tools/assistant/lib/qhelpsearchindexreader_default.cpp
@@ -52,9 +52,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
namespace {
QStringList split( const QString &str )
@@ -607,8 +606,7 @@ void QHelpSearchIndexReaderDefault::run()
emit searchingFinished(hitList.count());
}
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_default_p.h b/tools/assistant/lib/qhelpsearchindexreader_default_p.h
index 8c80608..b30fa4b 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_default_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_default_p.h
@@ -64,9 +64,8 @@ QT_BEGIN_NAMESPACE
struct Entry;
struct PosEntry;
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
class Reader
{
@@ -127,9 +126,8 @@ private:
Reader m_reader;
};
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexreader_p.h b/tools/assistant/lib/qhelpsearchindexreader_p.h
index b309f46..4d27c0f 100644
--- a/tools/assistant/lib/qhelpsearchindexreader_p.h
+++ b/tools/assistant/lib/qhelpsearchindexreader_p.h
@@ -66,8 +66,7 @@ QT_BEGIN_NAMESPACE
class QHelpEngineCore;
-namespace qt {
- namespace fulltextsearch {
+namespace fulltextsearch {
class QHelpSearchIndexReader : public QThread
{
@@ -100,8 +99,7 @@ private:
virtual void run()=0;
};
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
index e3cc2b0..59067cf 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
+++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene.cpp
@@ -63,9 +63,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
// taken from qtexthtmlparser
static const struct QTextHtmlEntity
@@ -613,67 +612,69 @@ void QHelpSearchIndexWriter::optimizeIndex()
void QHelpSearchIndexWriter::run()
{
- QMutexLocker mutexLocker(&mutex);
+#if !defined(QT_NO_EXCEPTIONS)
+ try {
+#endif
+ QMutexLocker mutexLocker(&mutex);
- if (m_cancel)
- return;
+ if (m_cancel)
+ return;
- const bool reindex = this->m_reindex;
- const QString collectionFile(this->m_collectionFile);
+ const bool reindex = this->m_reindex;
+ const QString collectionFile(this->m_collectionFile);
- mutexLocker.unlock();
+ mutexLocker.unlock();
- QHelpEngineCore engine(collectionFile, 0);
- if (!engine.setupData())
- return;
+ QHelpEngineCore engine(collectionFile, 0);
+ if (!engine.setupData())
+ return;
- const QLatin1String key("CluceneIndexedNamespaces");
- if (reindex)
- engine.setCustomValue(key, QLatin1String(""));
-
- QMap<QString, QDateTime> indexMap;
- const QLatin1String oldKey("CluceneSearchNamespaces");
- if (!engine.customValue(oldKey, QString()).isNull()) {
- // old style qhc file < 4.4.2, need to convert...
- const QStringList indexedNamespaces = engine.customValue(oldKey).
- toString().split(QLatin1String("|"), QString::SkipEmptyParts);
- foreach (const QString &nameSpace, indexedNamespaces)
- indexMap.insert(nameSpace, QDateTime());
- engine.removeCustomValue(oldKey);
- } else {
- QDataStream dataStream(engine.customValue(key).toByteArray());
- dataStream >> indexMap;
- }
+ const QLatin1String key("CluceneIndexedNamespaces");
+ if (reindex)
+ engine.setCustomValue(key, QLatin1String(""));
+
+ QMap<QString, QDateTime> indexMap;
+ const QLatin1String oldKey("CluceneSearchNamespaces");
+ if (!engine.customValue(oldKey, QString()).isNull()) {
+ // old style qhc file < 4.4.2, need to convert...
+ const QStringList indexedNamespaces
+ = engine.customValue(oldKey).toString()
+ .split(QLatin1String("|"), QString::SkipEmptyParts);
+ foreach (const QString &nameSpace, indexedNamespaces)
+ indexMap.insert(nameSpace, QDateTime());
+ engine.removeCustomValue(oldKey);
+ } else {
+ QDataStream dataStream(engine.customValue(key).toByteArray());
+ dataStream >> indexMap;
+ }
- QString indexPath = m_indexFilesFolder;
+ QString indexPath = m_indexFilesFolder;
- QFileInfo fInfo(indexPath);
- if (fInfo.exists() && !fInfo.isWritable()) {
- qWarning("Full Text Search, could not create index (missing permissions for '%s').", qPrintable(indexPath));
- return;
- }
+ QFileInfo fInfo(indexPath);
+ if (fInfo.exists() && !fInfo.isWritable()) {
+ qWarning("Full Text Search, could not create index (missing permissions for '%s').",
+ qPrintable(indexPath));
+ return;
+ }
- emit indexingStarted();
+ emit indexingStarted();
- QCLuceneIndexWriter *writer = 0;
- QCLuceneStandardAnalyzer analyzer;
- const QStringList registeredDocs = engine.registeredDocumentations();
+ QCLuceneIndexWriter *writer = 0;
+ QCLuceneStandardAnalyzer analyzer;
+ const QStringList registeredDocs = engine.registeredDocumentations();
- QLocalSocket localSocket;
- localSocket.connectToServer(QString(QLatin1String("QtAssistant%1"))
- .arg(QLatin1String(QT_VERSION_STR)));
+ QLocalSocket localSocket;
+ localSocket.connectToServer(QString(QLatin1String("QtAssistant%1"))
+ .arg(QLatin1String(QT_VERSION_STR)));
- QLocalServer localServer;
- bool otherInstancesRunning = true;
- if (!localSocket.waitForConnected()) {
- otherInstancesRunning = false;
- localServer.listen(QString(QLatin1String("QtAssistant%1"))
- .arg(QLatin1String(QT_VERSION_STR)));
- }
+ QLocalServer localServer;
+ bool otherInstancesRunning = true;
+ if (!localSocket.waitForConnected()) {
+ otherInstancesRunning = false;
+ localServer.listen(QString(QLatin1String("QtAssistant%1"))
+ .arg(QLatin1String(QT_VERSION_STR)));
+ }
-#if !defined(QT_NO_EXCEPTIONS)
- try {
-#endif
// check if it's locked, and if the other instance is running
if (!otherInstancesRunning && QCLuceneIndexReader::isLocked(indexPath))
QCLuceneIndexReader::unlock(indexPath);
@@ -705,7 +706,8 @@ void QHelpSearchIndexWriter::run()
removeDocuments(indexPath, namespaceName);
} else {
QString path = engine.documentationFileName(namespaceName);
- if (indexMap.value(namespaceName) < QFileInfo(path).lastModified()) {
+ if (indexMap.value(namespaceName)
+ < QFileInfo(path).lastModified()) {
// make sure we remove some outdated indexed stuff
indexMap.remove(namespaceName);
removeDocuments(indexPath, namespaceName);
@@ -728,94 +730,85 @@ void QHelpSearchIndexWriter::run()
indexMap.clear();
writer = new QCLuceneIndexWriter(indexPath, analyzer, true);
}
-#if !defined(QT_NO_EXCEPTIONS)
- } catch (...) {
- qWarning("Full Text Search, could not create index writer in '%s'.",
- qPrintable(indexPath));
- return;
- }
-#endif
-#if !defined(QT_NO_EXCEPTIONS)
- try {
-#endif
writer->setMergeFactor(100);
writer->setMinMergeDocs(1000);
writer->setMaxFieldLength(QCLuceneIndexWriter::DEFAULT_MAX_FIELD_LENGTH);
-#if !defined(QT_NO_EXCEPTIONS)
- } catch (...) {
- qWarning("Full Text Search, could not set writer properties.");
- return;
- }
-#endif
- QStringList namespaces;
- foreach(const QString &namespaceName, registeredDocs) {
- mutexLocker.relock();
- if (m_cancel) {
- closeIndexWriter(writer);
- emit indexingFinished();
- return;
- }
- mutexLocker.unlock();
+ QStringList namespaces;
+ foreach(const QString &namespaceName, registeredDocs) {
+ mutexLocker.relock();
+ if (m_cancel) {
+ closeIndexWriter(writer);
+ emit indexingFinished();
+ return;
+ }
+ mutexLocker.unlock();
- namespaces.append(namespaceName);
- if (indexMap.contains(namespaceName))
- continue;
+ namespaces.append(namespaceName);
+ if (indexMap.contains(namespaceName))
+ continue;
- const QList<QStringList> attributeSets =
- engine.filterAttributeSets(namespaceName);
+ const QList<QStringList> attributeSets =
+ engine.filterAttributeSets(namespaceName);
- if (attributeSets.isEmpty()) {
- const QList<QUrl> docFiles = indexableFiles(&engine, namespaceName,
- QStringList());
- if (!addDocuments(docFiles, engine, QStringList(), namespaceName,
- writer, analyzer))
- break;
- } else {
- bool bail = false;
- foreach (const QStringList &attributes, attributeSets) {
- const QList<QUrl> docFiles = indexableFiles(&engine,
- namespaceName, attributes);
- if (!addDocuments(docFiles, engine, attributes, namespaceName,
- writer, analyzer)) {
- bail = true;
+ if (attributeSets.isEmpty()) {
+ const QList<QUrl> docFiles = indexableFiles(&engine, namespaceName,
+ QStringList());
+ if (!addDocuments(docFiles, engine, QStringList(), namespaceName,
+ writer, analyzer))
break;
+ } else {
+ bool bail = false;
+ foreach (const QStringList &attributes, attributeSets) {
+ const QList<QUrl> docFiles = indexableFiles(&engine,
+ namespaceName, attributes);
+ if (!addDocuments(docFiles, engine, attributes, namespaceName,
+ writer, analyzer)) {
+ bail = true;
+ break;
+ }
}
+ if (bail)
+ break;
}
- if (bail)
- break;
- }
- mutexLocker.relock();
- if (!m_cancel) {
- QString path(engine.documentationFileName(namespaceName));
- indexMap.insert(namespaceName, QFileInfo(path).lastModified());
- writeIndexMap(engine, indexMap);
+ mutexLocker.relock();
+ if (!m_cancel) {
+ QString path(engine.documentationFileName(namespaceName));
+ indexMap.insert(namespaceName, QFileInfo(path).lastModified());
+ writeIndexMap(engine, indexMap);
+ }
+ mutexLocker.unlock();
}
- mutexLocker.unlock();
- }
- closeIndexWriter(writer);
+ closeIndexWriter(writer);
- mutexLocker.relock();
- if (!m_cancel) {
- mutexLocker.unlock();
-
- QStringList indexedNamespaces = indexMap.keys();
- foreach(const QString &namespaceName, indexedNamespaces) {
- mutexLocker.relock();
- if (m_cancel)
- break;
+ mutexLocker.relock();
+ if (!m_cancel) {
mutexLocker.unlock();
- if (!namespaces.contains(namespaceName)) {
- indexMap.remove(namespaceName);
- writeIndexMap(engine, indexMap);
- removeDocuments(indexPath, namespaceName);
+ QStringList indexedNamespaces = indexMap.keys();
+ foreach(const QString &namespaceName, indexedNamespaces) {
+ mutexLocker.relock();
+ if (m_cancel)
+ break;
+ mutexLocker.unlock();
+
+ if (!namespaces.contains(namespaceName)) {
+ indexMap.remove(namespaceName);
+ writeIndexMap(engine, indexMap);
+ removeDocuments(indexPath, namespaceName);
+ }
}
}
+
+#if !defined(QT_NO_EXCEPTIONS)
+ } catch (...) {
+ qWarning("%s: Failed because of CLucene exception.", Q_FUNC_INFO);
}
+#endif
+
emit indexingFinished();
}
@@ -901,8 +894,7 @@ void QHelpSearchIndexWriter::closeIndexWriter(QCLuceneIndexWriter *writer)
#endif
}
- } // namespace clucene
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace clucene
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h b/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h
index 91b8abd..db1e533 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h
+++ b/tools/assistant/lib/qhelpsearchindexwriter_clucene_p.h
@@ -69,9 +69,8 @@ QT_BEGIN_NAMESPACE
class QCLuceneIndexWriter;
-namespace qt {
- namespace fulltextsearch {
- namespace clucene {
+namespace fulltextsearch {
+namespace clucene {
class QHelpSearchIndexWriter : public QThread
{
@@ -116,9 +115,9 @@ private:
QString m_indexFilesFolder;
};
- } // namespace clucene
- } // namespace fulltextsearch
} // namespace clucene
+} // namespace fulltextsearch
+
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp
index 6d09fb8..cb3e49c 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_default.cpp
+++ b/tools/assistant/lib/qhelpsearchindexwriter_default.cpp
@@ -55,9 +55,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
Writer::Writer(const QString &path)
: indexPath(path)
@@ -379,8 +378,7 @@ QString QHelpSearchIndexWriter::removeNamespace(const QString namespaces,
return value;
}
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE
diff --git a/tools/assistant/lib/qhelpsearchindexwriter_default_p.h b/tools/assistant/lib/qhelpsearchindexwriter_default_p.h
index b222203..625cb84 100644
--- a/tools/assistant/lib/qhelpsearchindexwriter_default_p.h
+++ b/tools/assistant/lib/qhelpsearchindexwriter_default_p.h
@@ -65,9 +65,8 @@
QT_BEGIN_NAMESPACE
-namespace qt {
- namespace fulltextsearch {
- namespace std {
+namespace fulltextsearch {
+namespace std {
class Writer
{
@@ -123,9 +122,8 @@ private:
QString m_indexFilesFolder;
};
- } // namespace std
- } // namespace fulltextsearch
-} // namespace qt
+} // namespace std
+} // namespace fulltextsearch
QT_END_NAMESPACE