aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/help/localhelpmanager.cpp
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@digia.com>2014-05-14 13:15:01 +0200
committerEike Ziller <eike.ziller@digia.com>2014-05-30 09:37:04 +0200
commitc5be32fae7ac528f4d0c1aa89d2845fb49335141 (patch)
tree117ad4adaefb4cfaadb6dead7009aaf46d086ad5 /src/plugins/help/localhelpmanager.cpp
parent62a83b2b3fb2201a72b5d7501a9ad1ea0440a794 (diff)
Help: Provide native WebView backend on Mac
Run Qt Creator with environment variable QTC_HELPVIEWER_BACKEND to * 'native' to get the WebView based one on Mac * 'textbrowser' to get the QTextBrowser based one Defaults to use QWebView if QtWebKit is available, or QTextBrowser if not, like before. Change-Id: If0660782b18ff3d89301fa7bcaf4e2e2fb69627d Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Diffstat (limited to 'src/plugins/help/localhelpmanager.cpp')
-rw-r--r--src/plugins/help/localhelpmanager.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/plugins/help/localhelpmanager.cpp b/src/plugins/help/localhelpmanager.cpp
index 9bce86ce87d..424bdbe52f4 100644
--- a/src/plugins/help/localhelpmanager.cpp
+++ b/src/plugins/help/localhelpmanager.cpp
@@ -29,7 +29,8 @@
#include "localhelpmanager.h"
-#include <bookmarkmanager.h>
+#include "bookmarkmanager.h"
+#include "helpconstants.h"
#include <app/app_version.h>
#include <coreplugin/helpmanager.h>
@@ -40,6 +41,8 @@
using namespace Help::Internal;
+static LocalHelpManager *m_instance = 0;
+
QMutex LocalHelpManager::m_guiMutex;
QHelpEngine* LocalHelpManager::m_guiEngine = 0;
@@ -51,6 +54,7 @@ LocalHelpManager::LocalHelpManager(QObject *parent)
, m_guiNeedsSetup(true)
, m_needsCollectionFile(true)
{
+ m_instance = this;
}
LocalHelpManager::~LocalHelpManager()
@@ -65,6 +69,11 @@ LocalHelpManager::~LocalHelpManager()
m_guiEngine = 0;
}
+LocalHelpManager *LocalHelpManager::instance()
+{
+ return m_instance;
+}
+
void LocalHelpManager::setupGuiHelpEngine()
{
if (m_needsCollectionFile) {
@@ -110,3 +119,16 @@ BookmarkManager& LocalHelpManager::bookmarkManager()
}
return *m_bookmarkManager;
}
+
+QVariant LocalHelpManager::engineFontSettings()
+{
+ return helpEngine().customValue(Constants::FontKey, QVariant());
+}
+
+QByteArray LocalHelpManager::helpData(const QUrl &url)
+{
+ const QHelpEngineCore &engine = helpEngine();
+
+ return engine.findFile(url).isValid() ? engine.fileData(url)
+ : tr("Could not load \"%1\".").arg(url.toString()).toUtf8();
+}