forked from qt-creator/qt-creator
Add some statics to retrieve a core help engine and the collection path.
Reviewed-by: ck
This commit is contained in:
@@ -26,21 +26,35 @@
|
|||||||
** contact the sales department at http://qt.nokia.com/contact.
|
** contact the sales department at http://qt.nokia.com/contact.
|
||||||
**
|
**
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
#include "helpmanager.h"
|
|
||||||
|
|
||||||
|
#include "helpmanager.h"
|
||||||
#include "helpplugin.h"
|
#include "helpplugin.h"
|
||||||
|
|
||||||
#include <QtCore/QUrl>
|
#include <coreplugin/icore.h>
|
||||||
|
|
||||||
|
#include <QtCore/QDir>
|
||||||
|
#include <QtCore/QFileInfo>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
|
#include <QtCore/QUrl>
|
||||||
|
|
||||||
|
#include <QtHelp/QHelpEngineCore>
|
||||||
|
|
||||||
using namespace Help;
|
using namespace Help;
|
||||||
using namespace Help::Internal;
|
using namespace Help::Internal;
|
||||||
|
|
||||||
|
QHelpEngineCore* HelpManager::m_coreEngine = 0;
|
||||||
|
|
||||||
HelpManager::HelpManager(HelpPlugin* plugin)
|
HelpManager::HelpManager(HelpPlugin* plugin)
|
||||||
: m_plugin(plugin)
|
: m_plugin(plugin)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HelpManager::~HelpManager()
|
||||||
|
{
|
||||||
|
delete m_coreEngine;
|
||||||
|
m_coreEngine = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void HelpManager::handleHelpRequest(const QString &url)
|
void HelpManager::handleHelpRequest(const QString &url)
|
||||||
{
|
{
|
||||||
m_plugin->handleHelpRequest(url);
|
m_plugin->handleHelpRequest(url);
|
||||||
@@ -53,3 +67,21 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
|
|||||||
emit registerDocumentation();
|
emit registerDocumentation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString HelpManager::collectionFilePath()
|
||||||
|
{
|
||||||
|
const QFileInfo fi(Core::ICore::instance()->settings()->fileName());
|
||||||
|
const QDir directory(fi.absolutePath() + QLatin1String("/qtcreator"));
|
||||||
|
if (!directory.exists())
|
||||||
|
directory.mkpath(directory.absolutePath());
|
||||||
|
return directory.absolutePath() + QLatin1String("/helpcollection.qhc");
|
||||||
|
}
|
||||||
|
|
||||||
|
QHelpEngineCore& HelpManager::helpEngineCore()
|
||||||
|
{
|
||||||
|
if (!m_coreEngine) {
|
||||||
|
m_coreEngine = new QHelpEngineCore(collectionFilePath());
|
||||||
|
m_coreEngine->setupData();
|
||||||
|
}
|
||||||
|
return *m_coreEngine;
|
||||||
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
|
|
||||||
|
QT_FORWARD_DECLARE_CLASS(QHelpEngineCore)
|
||||||
QT_FORWARD_DECLARE_CLASS(QString)
|
QT_FORWARD_DECLARE_CLASS(QString)
|
||||||
QT_FORWARD_DECLARE_CLASS(QStringList)
|
QT_FORWARD_DECLARE_CLASS(QStringList)
|
||||||
|
|
||||||
@@ -45,16 +46,22 @@ class HELP_EXPORT HelpManager : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
HelpManager(Internal::HelpPlugin*);
|
HelpManager(Internal::HelpPlugin *plugin);
|
||||||
|
~HelpManager();
|
||||||
|
|
||||||
void handleHelpRequest(const QString &url);
|
void handleHelpRequest(const QString &url);
|
||||||
void registerDocumentation(const QStringList &fileNames);
|
void registerDocumentation(const QStringList &fileNames);
|
||||||
|
|
||||||
|
static QString collectionFilePath();
|
||||||
|
static QHelpEngineCore& helpEngineCore();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void registerDocumentation();
|
void registerDocumentation();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Internal::HelpPlugin *m_plugin;
|
Internal::HelpPlugin *m_plugin;
|
||||||
|
|
||||||
|
static QHelpEngineCore* m_coreEngine;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // Help
|
} // Help
|
||||||
|
|||||||
Reference in New Issue
Block a user