diff options
author | kh1 <qt-info@nokia.com> | 2010-06-11 13:11:37 +0200 |
---|---|---|
committer | kh1 <qt-info@nokia.com> | 2010-06-11 13:11:37 +0200 |
commit | 1b6ad087950ca0753f9e17016b618bc6656004af (patch) | |
tree | 3f04a59717d3f5ab80e4c6fd74a71d8d29e8e693 /src/plugins/cppeditor/cpphoverhandler.cpp | |
parent | 40b983a91b306c3f21e2b973b8b63f1b913e26c2 (diff) | |
download | qt-creator-1b6ad087950ca0753f9e17016b618bc6656004af.tar.gz |
Move help manager into core.
- lessens open file handles
- improves help plugin startup further
Task-number: QTCREATORBUG-337
Reviewed-by: ck
Diffstat (limited to 'src/plugins/cppeditor/cpphoverhandler.cpp')
-rw-r--r-- | src/plugins/cppeditor/cpphoverhandler.cpp | 30 |
1 files changed, 4 insertions, 26 deletions
diff --git a/src/plugins/cppeditor/cpphoverhandler.cpp b/src/plugins/cppeditor/cpphoverhandler.cpp index dabf25c791..2b691e6be9 100644 --- a/src/plugins/cppeditor/cpphoverhandler.cpp +++ b/src/plugins/cppeditor/cpphoverhandler.cpp @@ -32,6 +32,7 @@ #include "cppplugin.h" #include <coreplugin/icore.h> +#include <coreplugin/helpmanager.h> #include <coreplugin/uniqueidmanager.h> #include <coreplugin/editormanager/editormanager.h> #include <cpptools/cppmodelmanagerinterface.h> @@ -60,7 +61,6 @@ #include <QtGui/QToolTip> #include <QtGui/QTextCursor> #include <QtGui/QTextBlock> -#include <QtHelp/QHelpEngineCore> using namespace CppEditor::Internal; using namespace CPlusPlus; @@ -68,27 +68,11 @@ using namespace Core; CppHoverHandler::CppHoverHandler(QObject *parent) : QObject(parent) - , m_helpEngineNeedsSetup(false) { m_modelManager = ExtensionSystem::PluginManager::instance()->getObject<CppTools::CppModelManagerInterface>(); - ICore *core = ICore::instance(); - QFileInfo fi(core->settings()->fileName()); - // FIXME shouldn't the help engine create the directory if it doesn't exist? - QDir directory(fi.absolutePath()+"/qtcreator"); - if (!directory.exists()) - directory.mkpath(directory.absolutePath()); - - m_helpEngine = new QHelpEngineCore(directory.absolutePath() - + QLatin1String("/helpcollection.qhc"), this); - if (!m_helpEngine->setupData()) - qWarning() << "Could not initialize help engine:" << m_helpEngine->error(); - m_helpEngine->setAutoSaveFilter(false); - m_helpEngine->setCurrentFilter(tr("Unfiltered")); - m_helpEngineNeedsSetup = m_helpEngine->registeredDocumentations().count() == 0; - // Listen for editor opened events in order to connect to tooltip/helpid requests - connect(core->editorManager(), SIGNAL(editorOpened(Core::IEditor *)), + connect(ICore::instance()->editorManager(), SIGNAL(editorOpened(Core::IEditor *)), this, SLOT(editorOpened(Core::IEditor *))); } @@ -297,19 +281,13 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in } } - if (m_helpEngineNeedsSetup - && m_helpEngine->registeredDocumentations().count() > 0) { - m_helpEngine->setupData(); - m_helpEngineNeedsSetup = false; - } QMap<QString, QUrl> helpLinks; - if (m_toolTip.isEmpty()) { foreach (const Document::Include &incl, doc->includes()) { if (incl.line() == lineNumber) { m_toolTip = QDir::toNativeSeparators(incl.fileName()); m_helpId = QFileInfo(incl.fileName()).fileName(); - helpLinks = m_helpEngine->linksForIdentifier(m_helpId); + helpLinks = Core::HelpManager::instance()->linksForIdentifier(m_helpId); break; } } @@ -388,7 +366,7 @@ void CppHoverHandler::updateHelpIdAndTooltip(TextEditor::ITextEditor *editor, in // To show their help anyway, try stripping scopes until we find something. const QString startHelpId = m_helpId; while (!m_helpId.isEmpty()) { - helpLinks = m_helpEngine->linksForIdentifier(m_helpId); + helpLinks = Core::HelpManager::instance()->linksForIdentifier(m_helpId); if (!helpLinks.isEmpty()) break; |