diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-02-17 14:46:01 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-02-17 14:46:01 (GMT) |
commit | 60f3e3abbb9bfd61448a761701159cf880e66c19 (patch) | |
tree | fabe4b9f586d17f6ecc097599d841148e0a71894 /tools/assistant | |
parent | e43cf7a591fc98c544c620e0722bdd1201feaea9 (diff) | |
parent | a7ef2d899d711d750238a8d69284da808188b407 (diff) | |
download | Qt-60f3e3abbb9bfd61448a761701159cf880e66c19.zip Qt-60f3e3abbb9bfd61448a761701159cf880e66c19.tar.gz Qt-60f3e3abbb9bfd61448a761701159cf880e66c19.tar.bz2 |
Merge branch 'master' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2
Diffstat (limited to 'tools/assistant')
-rw-r--r-- | tools/assistant/tools/assistant/helpenginewrapper.cpp | 28 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/helpenginewrapper.h | 6 | ||||
-rw-r--r-- | tools/assistant/tools/assistant/mainwindow.cpp | 3 |
3 files changed, 34 insertions, 3 deletions
diff --git a/tools/assistant/tools/assistant/helpenginewrapper.cpp b/tools/assistant/tools/assistant/helpenginewrapper.cpp index 76211c5..a181c71 100644 --- a/tools/assistant/tools/assistant/helpenginewrapper.cpp +++ b/tools/assistant/tools/assistant/helpenginewrapper.cpp @@ -112,6 +112,7 @@ private: QFileSystemWatcher * const m_qchWatcher; typedef QPair<QDateTime, QSharedPointer<TimeoutForwarder> > RecentSignal; QMap<QString, RecentSignal> m_recentQchUpdates; + bool m_initialReindexingNeeded; }; const QString HelpEngineWrapper::TrUnfiltered = tr("Unfiltered"); @@ -141,6 +142,18 @@ HelpEngineWrapper::HelpEngineWrapper(const QString &collectionFile) : d(new HelpEngineWrapperPrivate(collectionFile)) { TRACE_OBJ + + /* + * Otherwise we will waste time if several new docs are found, + * because we will start to index them, only to be interupted + * by the next request. Also, there is a nasty SQLITE bug that will + * cause the application to hang for minutes in that case. + * This call is reverted by initalDocSetupDone(), which must be + * called after the new docs have been installed. + */ + disconnect(d->m_helpEngine, SIGNAL(setupFinished()), + searchEngine(), SLOT(indexDocumentation())); + connect(d, SIGNAL(documentationRemoved(QString)), this, SIGNAL(documentationRemoved(QString))); connect(d, SIGNAL(documentationUpdated(QString)), @@ -157,6 +170,15 @@ HelpEngineWrapper::~HelpEngineWrapper() delete d; } +void HelpEngineWrapper::initialDocSetupDone() +{ + TRACE_OBJ + connect(d->m_helpEngine, SIGNAL(setupFinished()), + searchEngine(), SLOT(indexDocumentation())); + if (d->m_initialReindexingNeeded) + setupData(); +} + QHelpSearchEngine *HelpEngineWrapper::searchEngine() const { TRACE_OBJ @@ -207,6 +229,7 @@ bool HelpEngineWrapper::registerDocumentation(const QString &docFile) return false; d->m_qchWatcher->addPath(docFile); d->checkDocFilesWatched(); + d->m_initialReindexingNeeded = true; return true; } @@ -219,6 +242,7 @@ bool HelpEngineWrapper::unregisterDocumentation(const QString &namespaceName) return false; d->m_qchWatcher->removePath(file); d->checkDocFilesWatched(); + d->m_initialReindexingNeeded = true; return true; } @@ -698,7 +722,8 @@ void TimeoutForwarder::forward() HelpEngineWrapperPrivate::HelpEngineWrapperPrivate(const QString &collectionFile) : m_helpEngine(new QHelpEngine(collectionFile, this)), - m_qchWatcher(new QFileSystemWatcher(this)) + m_qchWatcher(new QFileSystemWatcher(this)), + m_initialReindexingNeeded(false) { TRACE_OBJ if (!m_helpEngine->customFilters().contains(Unfiltered)) @@ -797,6 +822,7 @@ void HelpEngineWrapperPrivate::qchFileChanged(const QString &fileName, } else { emit documentationUpdated(ns); } + m_initialReindexingNeeded = true; m_helpEngine->setupData(); } m_recentQchUpdates.erase(it); diff --git a/tools/assistant/tools/assistant/helpenginewrapper.h b/tools/assistant/tools/assistant/helpenginewrapper.h index a30fab8..8d95273 100644 --- a/tools/assistant/tools/assistant/helpenginewrapper.h +++ b/tools/assistant/tools/assistant/helpenginewrapper.h @@ -101,6 +101,12 @@ public: const QStringList filterAttributes(const QString &filterName) const; QString error() const; + /* + * To be called after assistant has finished looking for new documentation. + * This will mainly cause the search index to be updated, if necessary. + */ + void initialDocSetupDone(); + const QStringList qtDocInfo(const QString &component) const; void setQtDocInfo(const QString &component, const QStringList &doc); diff --git a/tools/assistant/tools/assistant/mainwindow.cpp b/tools/assistant/tools/assistant/mainwindow.cpp index 4115d39..8096218 100644 --- a/tools/assistant/tools/assistant/mainwindow.cpp +++ b/tools/assistant/tools/assistant/mainwindow.cpp @@ -354,8 +354,6 @@ void MainWindow::lookForNewQtDocumentation() void MainWindow::qtDocumentationInstalled(bool newDocsInstalled) { TRACE_OBJ - if (newDocsInstalled) - HelpEngineWrapper::instance().setupData(); statusBar()->clearMessage(); checkInitState(); } @@ -383,6 +381,7 @@ void MainWindow::checkInitState() } emit initDone(); } + HelpEngineWrapper::instance().initialDocSetupDone(); } void MainWindow::insertLastPages() |