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>
This commit is contained in:
Eike Ziller
2014-05-14 13:15:01 +02:00
parent 62a83b2b3f
commit c5be32fae7
15 changed files with 1032 additions and 49 deletions

View File

@@ -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();
}