17#include <QApplication>
22#include <QLatin1String>
24#include <QStandardPaths>
26#include <QTemporaryFile>
30#include <boost/lexical_cast.hpp>
50const QString
BASE_URL(
"qthelp://org.mantidproject/doc/");
78 Poco::Path direcPath = Poco::Path(
m_cacheFile).parent();
79 Poco::File direcFile(direcPath.absolute().toString());
80 if (!direcFile.exists()) {
81 direcFile.createDirectories();
89 QObject::connect(helpEngine, SIGNAL(
warning(QString)),
this, SLOT(
warning(QString)));
92 if (helpEngine->copyCollectionFile(QString(
m_cacheFile.c_str()))) {
93 helpEngine->setCollectionFile(QString(
m_cacheFile.c_str()));
96 g_log.
debug(helpEngine->error().toStdString());
98 g_log.
debug() <<
"helpengine.setupData() returned " << helpEngine->setupData() <<
"\n";
103 g_helpWindow->setWindowIcon(QIcon(
":/images/MantidIcon.ico"));
106 auto registeredDocs = helpEngine->registeredDocumentations();
107 if (registeredDocs.size() > 0) {
116 g_log.
debug() <<
"open help window for \"" << url.toStdString() <<
"\"\n";
120 if (!url.isEmpty()) {
126 g_log.
debug() <<
"open url \"" << url.toString().toStdString() <<
"\"\n";
181 auto versionStr(
"-v" + boost::lexical_cast<string>(version));
186 QString help_url(
"");
189 help_url = QString::fromStdString(alg->helpURL());
192 if (help_url.isEmpty()) {
194 url +=
"algorithms/";
198 url += QString(name.c_str()) + QString(versionStr.c_str()) +
".html";
205 if (help_url.isEmpty()) {
243 url += QString(name.c_str()) +
".html";
272 url +=
"fitting/fitfunctions/";
273 auto functionUrl = url + QString(name.c_str()) +
".html";
274 if (name.empty() || !
g_helpWindow->isExistingPage(functionUrl))
283 this->
showWikiPage(std::string(
"Category:Fit_functions"));
317 const std::string §ion) {
320 url +=
"interfaces/";
322 url += QString::fromStdString(area) +
"/";
327 url += QString::fromStdString(name) +
".html";
328 if (!section.empty()) {
329 url +=
"#" + QString::fromStdString(section);
360 QDir searchDir(QString::fromStdString(binDir));
364 g_log.
debug() <<
"Trying \"" << path.toStdString() <<
"\"\n";
369 g_log.
debug() <<
"QHelp Collection file " << path.toStdString() <<
" not found\n";
374 if (searchDir.cd(
"docs")) {
375 searchDir.cd(
"qthelp");
377 g_log.
debug() <<
"Trying \"" << path.toStdString() <<
"\"\n";
385 if (searchDir.cd(
"docs")) {
386 searchDir.cd(
"qthelp");
388 g_log.
debug() <<
"Trying \"" << path.toStdString() <<
"\"\n";
396 searchDir = QDir(QString::fromStdString(binDir));
398 searchDir.cd(
"share");
401 g_log.
debug() <<
"Trying \"" << path.toStdString() <<
"\"\n";
408 searchDir = QDir(QString::fromStdString(binDir));
411 searchDir.cd(
"share");
414 g_log.
debug() <<
"Trying \"" << path.toStdString() <<
"\"\n";
442 QString dataLoc = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation) +
"/data";
444 if (dataLoc.endsWith(
"mantidproject")) {
445 Poco::Path path(dataLoc.toStdString(),
m_cacheFile);
447 }
else if (dataLoc.endsWith(
"MantidPlot"))
449 Poco::Path path(dataLoc.toStdString());
450 path = path.parent();
451 path = path.parent();
452 path = Poco::Path(path,
"mantidproject");
456 g_log.
debug() <<
"Failed to determine help cache file location\n";
457 Poco::Path path(dataLoc.toStdString(),
"mantidproject");
#define REGISTER_HELPWINDOW(TYPE)
Used to register help window.
static bool openUrl(const QUrl &url)
Opens a url in the appropriate web browser.
The Logger class is in charge of the publishing messages from the framework through various channels.
void debug(const std::string &msg)
Logs at debug level.
void warning(const std::string &msg)
Logs at warning level.
void information(const std::string &msg)
Logs at information level.
static T & Instance()
Return a reference to the Singleton instance, creating it if it does not already exist Creation is do...
pqHelpWindow provides an assistant-like window for showing help provided by a QHelpEngine.
Kernel::Logger g_log("ExperimentInfo")
static logger object