forked from qt-creator/qt-creator
Merge remote branch 'origin/2.0'
Conflicts: doc/qtcreator.qdoc src/plugins/projectexplorer/taskwindow.h src/plugins/qmldesigner/designercore/model/modelmerger.cpp src/plugins/qmljseditor/qmljshoverhandler.h src/plugins/qt4projectmanager/Qt4ProjectManager.pluginspec src/plugins/qt4projectmanager/qt-maemo/maemopackagecreationwidget.cpp src/plugins/subversion/subversionplugin.cpp
This commit is contained in:
@@ -45,7 +45,6 @@
|
||||
#include <QtGui/QStackedWidget>
|
||||
|
||||
#include <QtHelp/QHelpEngine>
|
||||
#include <QtHelp/QHelpEngineCore>
|
||||
#include <QtHelp/QHelpSearchEngine>
|
||||
|
||||
using namespace Help::Internal;
|
||||
@@ -85,7 +84,7 @@ CentralWidget::~CentralWidget()
|
||||
}
|
||||
}
|
||||
|
||||
QHelpEngineCore *engine = &HelpManager::helpEngineCore();
|
||||
QHelpEngineCore *engine = &LocalHelpManager::helpEngine();
|
||||
engine->setCustomValue(QLatin1String("LastShownPages"), currentPages);
|
||||
engine->setCustomValue(QLatin1String("LastShownPagesZoom"), zoomFactors);
|
||||
engine->setCustomValue(QLatin1String("LastTabPage"), currentIndex());
|
||||
@@ -313,7 +312,7 @@ void CentralWidget::highlightSearchTerms()
|
||||
{
|
||||
if (HelpViewer *viewer = currentHelpViewer()) {
|
||||
QHelpSearchEngine *searchEngine =
|
||||
HelpManager::instance().helpEngine().searchEngine();
|
||||
LocalHelpManager::helpEngine().searchEngine();
|
||||
QList<QHelpSearchQuery> queryList = searchEngine->query();
|
||||
|
||||
QStringList terms;
|
||||
|
||||
@@ -29,7 +29,8 @@
|
||||
|
||||
#include "docsettingspage.h"
|
||||
#include "helpconstants.h"
|
||||
#include "helpmanager.h"
|
||||
|
||||
#include <coreplugin/helpmanager.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
@@ -37,8 +38,6 @@
|
||||
#include <QtGui/QKeyEvent>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
#include <QtHelp/QHelpEngineCore>
|
||||
|
||||
using namespace Help::Internal;
|
||||
|
||||
DocSettingsPage::DocSettingsPage()
|
||||
@@ -80,10 +79,10 @@ QWidget *DocSettingsPage::createPage(QWidget *parent)
|
||||
|
||||
m_ui.docsListWidget->installEventFilter(this);
|
||||
|
||||
QHelpEngineCore *engine = &HelpManager::helpEngineCore();
|
||||
const QStringList &nameSpaces = engine->registeredDocumentations();
|
||||
Core::HelpManager *manager = Core::HelpManager::instance();
|
||||
const QStringList &nameSpaces = manager->registeredNamespaces();
|
||||
foreach (const QString &nameSpace, nameSpaces)
|
||||
addItem(nameSpace, engine->documentationFileName(nameSpace));
|
||||
addItem(nameSpace, manager->fileFromNamespace(nameSpace));
|
||||
|
||||
m_filesToRegister.clear();
|
||||
m_filesToUnregister.clear();
|
||||
@@ -103,11 +102,11 @@ void DocSettingsPage::addDocumentation()
|
||||
return;
|
||||
m_recentDialogPath = QFileInfo(files.first()).canonicalPath();
|
||||
|
||||
const QHelpEngineCore &engine = HelpManager::helpEngineCore();
|
||||
const QStringList &nameSpaces = engine.registeredDocumentations();
|
||||
Core::HelpManager *manager = Core::HelpManager::instance();
|
||||
const QStringList &nameSpaces = manager->registeredNamespaces();
|
||||
|
||||
foreach (const QString &file, files) {
|
||||
const QString &nameSpace = engine.namespaceName(file);
|
||||
const QString &nameSpace = manager->namespaceFromFile(file);
|
||||
if (nameSpace.isEmpty())
|
||||
continue;
|
||||
|
||||
@@ -130,14 +129,10 @@ void DocSettingsPage::removeDocumentation()
|
||||
|
||||
void DocSettingsPage::apply()
|
||||
{
|
||||
HelpManager* manager = &HelpManager::instance();
|
||||
Core::HelpManager *manager = Core::HelpManager::instance();
|
||||
|
||||
manager->unregisterDocumentation(m_filesToUnregister.keys());
|
||||
manager->registerDocumentation(m_filesToRegister.values());
|
||||
if (manager->guiEngineNeedsUpdate()) {
|
||||
// emit this signal to the help plugin, since we don't want
|
||||
// to force gui help engine setup if we are not in help mode
|
||||
emit documentationChanged();
|
||||
}
|
||||
|
||||
m_filesToRegister.clear();
|
||||
m_filesToUnregister.clear();
|
||||
@@ -172,10 +167,10 @@ void DocSettingsPage::removeDocumentation(const QList<QListWidgetItem*> items)
|
||||
return;
|
||||
|
||||
int row = 0;
|
||||
QHelpEngineCore *engine = &HelpManager::helpEngineCore();
|
||||
Core::HelpManager *manager = Core::HelpManager::instance();
|
||||
foreach (QListWidgetItem* item, items) {
|
||||
const QString &nameSpace = item->text();
|
||||
const QString &docPath = engine->documentationFileName(nameSpace);
|
||||
const QString &docPath = manager->fileFromNamespace(nameSpace);
|
||||
|
||||
if (m_filesToRegister.value(nameSpace) != docPath) {
|
||||
if (!m_filesToUnregister.contains(nameSpace))
|
||||
|
||||
@@ -55,9 +55,6 @@ public:
|
||||
void finish() {}
|
||||
virtual bool matches(const QString &s) const;
|
||||
|
||||
signals:
|
||||
void documentationChanged();
|
||||
|
||||
private slots:
|
||||
void addDocumentation();
|
||||
void removeDocumentation();
|
||||
|
||||
@@ -33,16 +33,19 @@
|
||||
#include "helpconstants.h"
|
||||
#include "helpmanager.h"
|
||||
|
||||
#include <coreplugin/helpmanager.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
|
||||
#include <QtGui/QFileDialog>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
#include <QtHelp/QHelpEngineCore>
|
||||
#include <QtHelp/QHelpEngine>
|
||||
|
||||
using namespace Help::Internal;
|
||||
|
||||
FilterSettingsPage::FilterSettingsPage()
|
||||
: m_helpManager(0)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -76,6 +79,7 @@ QWidget *FilterSettingsPage::createPage(QWidget *parent)
|
||||
QWidget *widget = new QWidget(parent);
|
||||
m_ui.setupUi(widget);
|
||||
|
||||
m_helpManager->setupGuiHelpEngine();
|
||||
updateFilterPage(); // does call setupData on the engine
|
||||
|
||||
connect(m_ui.attributeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
|
||||
@@ -86,6 +90,8 @@ QWidget *FilterSettingsPage::createPage(QWidget *parent)
|
||||
connect(m_ui.filterAddButton, SIGNAL(clicked()), this, SLOT(addFilter()));
|
||||
connect(m_ui.filterRemoveButton, SIGNAL(clicked()), this,
|
||||
SLOT(removeFilter()));
|
||||
connect(Core::HelpManager::instance(), SIGNAL(documentationChanged()),
|
||||
this, SLOT(updateFilterPage()));
|
||||
|
||||
if (m_searchKeywords.isEmpty()) {
|
||||
m_searchKeywords = m_ui.filterGroupBox->title() + QLatin1Char(' ')
|
||||
@@ -100,7 +106,7 @@ void FilterSettingsPage::updateFilterPage()
|
||||
m_ui.attributeWidget->clear();
|
||||
|
||||
m_filterMapBackup.clear();
|
||||
const QHelpEngineCore &engine = HelpManager::helpEngineCore();
|
||||
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
|
||||
const QStringList &filters = engine.customFilters();
|
||||
foreach (const QString &filter, filters) {
|
||||
const QStringList &attributes = engine.filterAttributes(filter);
|
||||
@@ -114,8 +120,10 @@ void FilterSettingsPage::updateFilterPage()
|
||||
foreach (const QString &attribute, attributes)
|
||||
new QTreeWidgetItem(m_ui.attributeWidget, QStringList(attribute));
|
||||
|
||||
if (m_filterMap.keys().count())
|
||||
if (m_filterMap.keys().isEmpty()) {
|
||||
m_ui.filterWidget->setCurrentRow(0);
|
||||
updateAttributes(m_ui.filterWidget->currentItem());
|
||||
}
|
||||
}
|
||||
|
||||
void FilterSettingsPage::updateAttributes(QListWidgetItem *item)
|
||||
@@ -208,7 +216,7 @@ void FilterSettingsPage::apply()
|
||||
}
|
||||
|
||||
if (changed) {
|
||||
QHelpEngineCore *engine = &HelpManager::helpEngineCore();
|
||||
QHelpEngineCore *engine = &LocalHelpManager::helpEngine();
|
||||
foreach (const QString &filter, m_removedFilters)
|
||||
engine->removeCustomFilter(filter);
|
||||
|
||||
@@ -226,3 +234,8 @@ bool FilterSettingsPage::matches(const QString &s) const
|
||||
{
|
||||
return m_searchKeywords.contains(s, Qt::CaseInsensitive);
|
||||
}
|
||||
|
||||
void FilterSettingsPage::setHelpManager(LocalHelpManager *manager)
|
||||
{
|
||||
m_helpManager = manager;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
|
||||
class LocalHelpManager;
|
||||
|
||||
class FilterSettingsPage : public Core::IOptionsPage
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -55,6 +57,8 @@ public:
|
||||
void finish() {}
|
||||
virtual bool matches(const QString &s) const;
|
||||
|
||||
void setHelpManager(LocalHelpManager *manager);
|
||||
|
||||
signals:
|
||||
void filtersChanged();
|
||||
|
||||
@@ -73,6 +77,8 @@ private:
|
||||
|
||||
QString m_searchKeywords;
|
||||
QStringList m_removedFilters;
|
||||
|
||||
LocalHelpManager *m_helpManager;
|
||||
};
|
||||
|
||||
} // namespace Help
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QFileDialog>
|
||||
|
||||
#include <QtHelp/QHelpEngineCore>
|
||||
#include <QtHelp/QHelpEngine>
|
||||
|
||||
#if !defined(QT_NO_WEBKIT)
|
||||
#include <QtWebKit/QWebSettings>
|
||||
@@ -94,7 +94,7 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent)
|
||||
m_ui.sizeComboBox->setEditable(false);
|
||||
m_ui.styleComboBox->setEditable(false);
|
||||
|
||||
const QHelpEngineCore &engine = HelpManager::helpEngineCore();
|
||||
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
|
||||
m_font = qVariantValue<QFont>(engine.customValue(QLatin1String("font"), m_font));
|
||||
|
||||
updateFontSize();
|
||||
@@ -163,7 +163,7 @@ void GeneralSettingsPage::apply()
|
||||
if (weight >= 0) // Weight < 0 asserts...
|
||||
newFont.setWeight(weight);
|
||||
|
||||
QHelpEngineCore *engine = &HelpManager::helpEngineCore();
|
||||
QHelpEngineCore *engine = &LocalHelpManager::helpEngine();
|
||||
engine->setCustomValue(QLatin1String("font"), newFont);
|
||||
|
||||
if (newFont != m_font)
|
||||
@@ -197,7 +197,7 @@ void GeneralSettingsPage::setBlankPage()
|
||||
|
||||
void GeneralSettingsPage::setDefaultPage()
|
||||
{
|
||||
const QString &defaultHomePage = HelpManager::helpEngineCore()
|
||||
const QString &defaultHomePage = LocalHelpManager::helpEngine()
|
||||
.customValue(QLatin1String("DefaultHomePage"), QString()).toString();
|
||||
m_ui.homePageLineEdit->setText(defaultHomePage);
|
||||
}
|
||||
@@ -214,7 +214,7 @@ void GeneralSettingsPage::importBookmarks()
|
||||
|
||||
QFile file(fileName);
|
||||
if (file.open(QIODevice::ReadOnly)) {
|
||||
const BookmarkManager &manager = HelpManager::bookmarkManager();
|
||||
const BookmarkManager &manager = LocalHelpManager::bookmarkManager();
|
||||
XbelReader reader(manager.treeBookmarkModel(), manager.listBookmarkModel());
|
||||
if (reader.readFromFile(&file))
|
||||
return;
|
||||
@@ -237,7 +237,7 @@ void GeneralSettingsPage::exportBookmarks()
|
||||
|
||||
QFile file(fileName);
|
||||
if (file.open(QIODevice::WriteOnly)) {
|
||||
XbelWriter writer(HelpManager::bookmarkManager().treeBookmarkModel());
|
||||
XbelWriter writer(LocalHelpManager::bookmarkManager().treeBookmarkModel());
|
||||
writer.writeToFile(&file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,197 +28,28 @@
|
||||
**************************************************************************/
|
||||
|
||||
#include "helpindexfilter.h"
|
||||
#include "helpmanager.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/helpmanager.h>
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
#include <QtHelp/QHelpEngine>
|
||||
#include <QtHelp/QHelpIndexModel>
|
||||
|
||||
#include <QtSql/QSqlDatabase>
|
||||
#include <QtSql/QSqlDriver>
|
||||
#include <QtSql/QSqlError>
|
||||
#include <QtSql/QSqlQuery>
|
||||
|
||||
using namespace Locator;
|
||||
using namespace Help;
|
||||
using namespace Help::Internal;
|
||||
|
||||
Q_DECLARE_METATYPE(ILocatorFilter*);
|
||||
|
||||
static const char linksForKeyQuery[] = "SELECT d.Title, f.Name, e.Name, "
|
||||
"d.Name, a.Anchor FROM IndexTable a, FileNameTable d, FolderTable e, "
|
||||
"NamespaceTable f WHERE a.FileId=d.FileId AND d.FolderId=e.Id AND "
|
||||
"a.NamespaceId=f.Id AND a.Name='%1'";
|
||||
|
||||
// -- HelpIndexFilter::HelpFileReader
|
||||
|
||||
class HelpIndexFilter::HelpFileReader
|
||||
{
|
||||
struct dbCleaner {
|
||||
dbCleaner(const QString &dbName)
|
||||
: name(dbName) {}
|
||||
~dbCleaner() {
|
||||
QSqlDatabase::removeDatabase(name);
|
||||
}
|
||||
QString name;
|
||||
};
|
||||
|
||||
public:
|
||||
HelpFileReader();
|
||||
~HelpFileReader();
|
||||
|
||||
public:
|
||||
void updateHelpFiles();
|
||||
QMap<QString, QUrl> linksForKey(const QString &key);
|
||||
QList<FilterEntry> matchesFor(const QString &entry, ILocatorFilter *locator,
|
||||
int maxHits = INT_MAX);
|
||||
|
||||
private:
|
||||
QIcon m_icon;
|
||||
bool m_initialized;
|
||||
QStringList m_helpFiles;
|
||||
};
|
||||
|
||||
HelpIndexFilter::HelpFileReader::HelpFileReader()
|
||||
: m_initialized(false)
|
||||
{
|
||||
m_icon = QIcon(QLatin1String(":/help/images/bookmark.png"));
|
||||
}
|
||||
|
||||
HelpIndexFilter::HelpFileReader::~HelpFileReader()
|
||||
{
|
||||
}
|
||||
|
||||
void HelpIndexFilter::HelpFileReader::updateHelpFiles()
|
||||
{
|
||||
m_helpFiles.clear();
|
||||
const QLatin1String id("HelpIndexFilter::HelpFileReader::helpFiles");
|
||||
{
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase(QLatin1String("QSQLITE"), id);
|
||||
if (db.driver()
|
||||
&& db.driver()->lastError().type() == QSqlError::NoError) {
|
||||
db.setDatabaseName(HelpManager::collectionFilePath());
|
||||
if (db.open()) {
|
||||
QSqlQuery query = QSqlQuery(db);
|
||||
query.exec(QLatin1String("SELECT a.FilePath FROM NamespaceTable a"));
|
||||
while (query.next())
|
||||
m_helpFiles.append(query.value(0).toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
QSqlDatabase::removeDatabase(id);
|
||||
}
|
||||
|
||||
QUrl buildQUrl(const QString &nameSpace, const QString &folder,
|
||||
const QString &relFileName, const QString &anchor)
|
||||
{
|
||||
QUrl url;
|
||||
url.setScheme(QLatin1String("qthelp"));
|
||||
url.setAuthority(nameSpace);
|
||||
url.setPath(folder + QLatin1Char('/') + relFileName);
|
||||
url.setFragment(anchor);
|
||||
return url;
|
||||
}
|
||||
|
||||
QMap<QString, QUrl>HelpIndexFilter::HelpFileReader::linksForKey(const QString &key)
|
||||
{
|
||||
if (!m_initialized) {
|
||||
updateHelpFiles();
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
QMap<QString, QUrl> links;
|
||||
const QLatin1String sqlite("QSQLITE");
|
||||
const QLatin1String name("HelpIndexFilter::HelpFileReader::linksForKey");
|
||||
|
||||
dbCleaner cleaner(name);
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase(sqlite, name);
|
||||
if (db.driver() && db.driver()->lastError().type() == QSqlError::NoError) {
|
||||
foreach(const QString &file, m_helpFiles) {
|
||||
if (!QFile::exists(file))
|
||||
continue;
|
||||
db.setDatabaseName(file);
|
||||
if (db.open()) {
|
||||
QSqlQuery query = QSqlQuery(db);
|
||||
query.setForwardOnly(true);
|
||||
query.exec(QString::fromLatin1(linksForKeyQuery).arg(key));
|
||||
while (query.next()) {
|
||||
QString title = query.value(0).toString();
|
||||
if (title.isEmpty()) // generate a title + corresponding path
|
||||
title = key + QLatin1String(" : ") + query.value(3).toString();
|
||||
links.insertMulti(title, buildQUrl(query.value(1).toString(),
|
||||
query.value(2).toString(), query.value(3).toString(),
|
||||
query.value(4).toString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return links;
|
||||
}
|
||||
|
||||
QList<FilterEntry> HelpIndexFilter::HelpFileReader::matchesFor(const QString &id,
|
||||
ILocatorFilter *locator, int maxHits)
|
||||
{
|
||||
if (!m_initialized) {
|
||||
updateHelpFiles();
|
||||
m_initialized = true;
|
||||
}
|
||||
|
||||
QList<FilterEntry> entries;
|
||||
const QLatin1String sqlite("QSQLITE");
|
||||
const QLatin1String name("HelpIndexFilter::HelpFileReader::matchesFor");
|
||||
|
||||
dbCleaner cleaner(name);
|
||||
QSqlDatabase db = QSqlDatabase::addDatabase(sqlite, name);
|
||||
if (db.driver() && db.driver()->lastError().type() == QSqlError::NoError) {
|
||||
foreach(const QString &file, m_helpFiles) {
|
||||
if (!QFile::exists(file))
|
||||
continue;
|
||||
db.setDatabaseName(file);
|
||||
if (db.open()) {
|
||||
QSqlQuery query = QSqlQuery(db);
|
||||
query.setForwardOnly(true);
|
||||
query.exec(QString::fromLatin1("SELECT DISTINCT Name FROM "
|
||||
"IndexTable WHERE Name LIKE '%%1%'").arg(id));
|
||||
while (query.next()) {
|
||||
const QString &key = query.value(0).toString();
|
||||
if (!key.isEmpty()) {
|
||||
entries.append(FilterEntry(locator, key, QVariant(),
|
||||
m_icon));
|
||||
if (entries.count() == maxHits)
|
||||
return entries;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return entries;
|
||||
}
|
||||
|
||||
// -- HelpIndexFilter
|
||||
|
||||
HelpIndexFilter::HelpIndexFilter()
|
||||
: m_fileReader(new HelpFileReader)
|
||||
{
|
||||
setIncludedByDefault(false);
|
||||
setShortcutString(QString(QLatin1Char('?')));
|
||||
|
||||
connect(&HelpManager::helpEngineCore(), SIGNAL(setupFinished()), this,
|
||||
SLOT(updateHelpFiles()));
|
||||
m_icon = QIcon(QLatin1String(":/help/images/bookmark.png"));
|
||||
}
|
||||
|
||||
HelpIndexFilter::~HelpIndexFilter()
|
||||
{
|
||||
delete m_fileReader;
|
||||
}
|
||||
|
||||
void HelpIndexFilter::updateHelpFiles()
|
||||
{
|
||||
m_fileReader->updateHelpFiles();
|
||||
}
|
||||
|
||||
QString HelpIndexFilter::displayName() const
|
||||
@@ -238,15 +69,23 @@ ILocatorFilter::Priority HelpIndexFilter::priority() const
|
||||
|
||||
QList<FilterEntry> HelpIndexFilter::matchesFor(const QString &entry)
|
||||
{
|
||||
QStringList keywords;
|
||||
if (entry.length() < 2)
|
||||
return m_fileReader->matchesFor(entry, this, 300);
|
||||
return m_fileReader->matchesFor(entry, this);
|
||||
keywords = Core::HelpManager::instance()->findKeywords(entry, 300);
|
||||
else
|
||||
keywords = Core::HelpManager::instance()->findKeywords(entry);
|
||||
|
||||
QList<FilterEntry> entries;
|
||||
foreach (const QString &keyword, keywords)
|
||||
entries.append(FilterEntry(this, keyword, QVariant(), m_icon));
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
void HelpIndexFilter::accept(FilterEntry selection) const
|
||||
{
|
||||
const QString &key = selection.displayName;
|
||||
const QMap<QString, QUrl> &links = m_fileReader->linksForKey(key);
|
||||
const QMap<QString, QUrl> &links = Core::HelpManager::instance()->linksForKeyword(key);
|
||||
if (links.size() == 1) {
|
||||
emit linkActivated(links.begin().value());
|
||||
} else if (!links.isEmpty()) {
|
||||
|
||||
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <locator/ilocatorfilter.h>
|
||||
|
||||
#include <QtGui/QIcon>
|
||||
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
|
||||
@@ -40,7 +42,6 @@ class HelpPlugin;
|
||||
class HelpIndexFilter : public Locator::ILocatorFilter
|
||||
{
|
||||
Q_OBJECT
|
||||
class HelpFileReader;
|
||||
|
||||
public:
|
||||
HelpIndexFilter();
|
||||
@@ -58,11 +59,8 @@ signals:
|
||||
void linkActivated(const QUrl &link) const;
|
||||
void linksActivated(const QMap<QString, QUrl> &urls, const QString &keyword) const;
|
||||
|
||||
private slots:
|
||||
void updateHelpFiles();
|
||||
|
||||
private:
|
||||
HelpFileReader *m_fileReader;
|
||||
QIcon m_icon;
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -30,38 +30,29 @@
|
||||
#include "helpmanager.h"
|
||||
#include "bookmarkmanager.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/helpmanager.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QMutexLocker>
|
||||
|
||||
#include <QtHelp/QHelpEngine>
|
||||
#include <QtHelp/QHelpEngineCore>
|
||||
|
||||
using namespace Help;
|
||||
using namespace Help::Internal;
|
||||
|
||||
bool HelpManager::m_guiNeedsSetup = true;
|
||||
bool HelpManager::m_needsCollectionFile = true;
|
||||
QMutex LocalHelpManager::m_guiMutex;
|
||||
QHelpEngine* LocalHelpManager::m_guiEngine = 0;
|
||||
|
||||
QMutex HelpManager::m_guiMutex;
|
||||
QHelpEngine* HelpManager::m_guiEngine = 0;
|
||||
QMutex LocalHelpManager::m_bkmarkMutex;
|
||||
BookmarkManager* LocalHelpManager::m_bookmarkManager = 0;
|
||||
|
||||
QMutex HelpManager::m_coreMutex;
|
||||
QHelpEngineCore* HelpManager::m_coreEngine = 0;
|
||||
|
||||
HelpManager* HelpManager::m_helpManager = 0;
|
||||
BookmarkManager* HelpManager::m_bookmarkManager = 0;
|
||||
|
||||
HelpManager::HelpManager(QObject *parent)
|
||||
LocalHelpManager::LocalHelpManager(QObject *parent)
|
||||
: QObject(parent)
|
||||
, m_guiNeedsSetup(true)
|
||||
, m_needsCollectionFile(true)
|
||||
{
|
||||
Q_ASSERT(!m_helpManager);
|
||||
m_helpManager = this;
|
||||
}
|
||||
|
||||
HelpManager::~HelpManager()
|
||||
LocalHelpManager::~LocalHelpManager()
|
||||
{
|
||||
if (m_bookmarkManager) {
|
||||
m_bookmarkManager->saveBookmarks();
|
||||
@@ -71,88 +62,27 @@ HelpManager::~HelpManager()
|
||||
|
||||
delete m_guiEngine;
|
||||
m_guiEngine = 0;
|
||||
|
||||
delete m_coreEngine;
|
||||
m_coreEngine = 0;
|
||||
}
|
||||
|
||||
HelpManager& HelpManager::instance()
|
||||
{
|
||||
Q_ASSERT(m_helpManager);
|
||||
return *m_helpManager;
|
||||
}
|
||||
|
||||
void HelpManager::setupGuiHelpEngine()
|
||||
void LocalHelpManager::setupGuiHelpEngine()
|
||||
{
|
||||
if (m_needsCollectionFile) {
|
||||
m_needsCollectionFile = false;
|
||||
(&helpEngine())->setCollectionFile(collectionFilePath());
|
||||
helpEngine().setCollectionFile(Core::HelpManager::collectionFilePath());
|
||||
}
|
||||
|
||||
if (m_guiNeedsSetup) {
|
||||
m_guiNeedsSetup = false;
|
||||
(&helpEngine())->setupData();
|
||||
helpEngine().setupData();
|
||||
}
|
||||
}
|
||||
|
||||
bool HelpManager::guiEngineNeedsUpdate() const
|
||||
void LocalHelpManager::setEngineNeedsUpdate()
|
||||
{
|
||||
return m_guiNeedsSetup;
|
||||
m_guiNeedsSetup = true;
|
||||
}
|
||||
|
||||
void HelpManager::handleHelpRequest(const QString &url)
|
||||
{
|
||||
emit helpRequested(QUrl(url));
|
||||
}
|
||||
|
||||
void HelpManager::verifyDocumenation()
|
||||
{
|
||||
QStringList nameSpacesToUnregister;
|
||||
QHelpEngineCore *engine = &helpEngineCore();
|
||||
const QStringList ®isteredDocs = engine->registeredDocumentations();
|
||||
foreach (const QString &nameSpace, registeredDocs) {
|
||||
const QString &file = engine->documentationFileName(nameSpace);
|
||||
if (!QFileInfo(file).exists())
|
||||
nameSpacesToUnregister.append(nameSpace);
|
||||
}
|
||||
|
||||
if (!nameSpacesToUnregister.isEmpty())
|
||||
unregisterDocumentation(nameSpacesToUnregister);
|
||||
}
|
||||
|
||||
void HelpManager::registerDocumentation(const QStringList &files)
|
||||
{
|
||||
QHelpEngineCore *engine = &helpEngineCore();
|
||||
foreach (const QString &file, files) {
|
||||
const QString &nameSpace = engine->namespaceName(file);
|
||||
if (nameSpace.isEmpty())
|
||||
continue;
|
||||
if (!engine->registeredDocumentations().contains(nameSpace)) {
|
||||
if (engine->registerDocumentation(file)) {
|
||||
m_guiNeedsSetup = true;
|
||||
} else {
|
||||
qWarning() << "Error registering namespace '" << nameSpace
|
||||
<< "' from file '" << file << "':" << engine->error();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void HelpManager::unregisterDocumentation(const QStringList &nameSpaces)
|
||||
{
|
||||
QHelpEngineCore *engine = &helpEngineCore();
|
||||
foreach (const QString &nameSpace, nameSpaces) {
|
||||
const QString &file = engine->documentationFileName(nameSpace);
|
||||
if (engine->unregisterDocumentation(nameSpace)) {
|
||||
m_guiNeedsSetup = true;
|
||||
} else {
|
||||
qWarning() << "Error unregistering namespace '" << nameSpace
|
||||
<< "' from file '" << file << "': " << engine->error();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QHelpEngine &HelpManager::helpEngine()
|
||||
QHelpEngine &LocalHelpManager::helpEngine()
|
||||
{
|
||||
if (!m_guiEngine) {
|
||||
QMutexLocker _(&m_guiMutex);
|
||||
@@ -164,34 +94,18 @@ QHelpEngine &HelpManager::helpEngine()
|
||||
return *m_guiEngine;
|
||||
}
|
||||
|
||||
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 QDir::cleanPath(directory.absolutePath() + QLatin1String("/helpcollection.qhc"));
|
||||
}
|
||||
|
||||
QHelpEngineCore& HelpManager::helpEngineCore()
|
||||
{
|
||||
if (!m_coreEngine) {
|
||||
QMutexLocker _(&m_coreMutex);
|
||||
if (!m_coreEngine) {
|
||||
m_coreEngine = new QHelpEngineCore(collectionFilePath());
|
||||
m_coreEngine->setAutoSaveFilter(false);
|
||||
m_coreEngine->setCurrentFilter(tr("Unfiltered"));
|
||||
m_coreEngine->setupData();
|
||||
}
|
||||
}
|
||||
return *m_coreEngine;
|
||||
}
|
||||
|
||||
BookmarkManager& HelpManager::bookmarkManager()
|
||||
BookmarkManager& LocalHelpManager::bookmarkManager()
|
||||
{
|
||||
if (!m_bookmarkManager) {
|
||||
m_bookmarkManager = new BookmarkManager;
|
||||
m_bookmarkManager->setupBookmarkModels();
|
||||
QMutexLocker _(&m_bkmarkMutex);
|
||||
if (!m_bookmarkManager) {
|
||||
m_bookmarkManager = new BookmarkManager;
|
||||
m_bookmarkManager->setupBookmarkModels();
|
||||
const QString &url = QString::fromLatin1("qthelp://com.nokia.qtcreator."
|
||||
"%1%2%3/doc/index.html").arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR)
|
||||
.arg(IDE_VERSION_RELEASE);
|
||||
helpEngine().setCustomValue(QLatin1String("DefaultHomePage"), url);
|
||||
}
|
||||
}
|
||||
return *m_bookmarkManager;
|
||||
}
|
||||
|
||||
@@ -27,66 +27,44 @@
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef HELPMANAGER_H
|
||||
#define HELPMANAGER_H
|
||||
|
||||
#include "help_global.h"
|
||||
#ifndef LOCALHELPMANAGER_H
|
||||
#define LOCALHELPMANAGER_H
|
||||
|
||||
#include <QtCore/QMutex>
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QHelpEngine)
|
||||
QT_FORWARD_DECLARE_CLASS(QHelpEngineCore)
|
||||
QT_FORWARD_DECLARE_CLASS(QString)
|
||||
QT_FORWARD_DECLARE_CLASS(QStringList)
|
||||
QT_FORWARD_DECLARE_CLASS(QUrl)
|
||||
|
||||
class BookmarkManager;
|
||||
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
|
||||
class HELP_EXPORT HelpManager : public QObject
|
||||
class LocalHelpManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HelpManager(QObject *parent = 0);
|
||||
~HelpManager();
|
||||
|
||||
static HelpManager& instance();
|
||||
public:
|
||||
LocalHelpManager(QObject *parent = 0);
|
||||
~LocalHelpManager();
|
||||
|
||||
void setupGuiHelpEngine();
|
||||
bool guiEngineNeedsUpdate() const;
|
||||
|
||||
void verifyDocumenation();
|
||||
void registerDocumentation(const QStringList &fileNames);
|
||||
void unregisterDocumentation(const QStringList &nameSpaces);
|
||||
void setEngineNeedsUpdate();
|
||||
|
||||
static QHelpEngine& helpEngine();
|
||||
static QString collectionFilePath();
|
||||
static QHelpEngineCore& helpEngineCore();
|
||||
|
||||
static BookmarkManager& bookmarkManager();
|
||||
|
||||
public slots:
|
||||
void handleHelpRequest(const QString &url);
|
||||
|
||||
signals:
|
||||
void helpRequested(const QUrl &url);
|
||||
|
||||
private:
|
||||
static bool m_guiNeedsSetup;
|
||||
static bool m_needsCollectionFile;
|
||||
bool m_guiNeedsSetup;
|
||||
bool m_needsCollectionFile;
|
||||
|
||||
static QMutex m_guiMutex;
|
||||
static QHelpEngine *m_guiEngine;
|
||||
|
||||
static QMutex m_coreMutex;
|
||||
static QHelpEngineCore *m_coreEngine;
|
||||
|
||||
static HelpManager *m_helpManager;
|
||||
static QMutex m_bkmarkMutex;
|
||||
static BookmarkManager *m_bookmarkManager;
|
||||
};
|
||||
|
||||
} // Internal
|
||||
} // Help
|
||||
|
||||
#endif // HELPMANAGER_H
|
||||
#endif // LOCALHELPMANAGER_H
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
#include <coreplugin/editormanager/ieditor.h>
|
||||
#include <coreplugin/findplaceholder.h>
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/helpmanager.h>
|
||||
#include <coreplugin/minisplitter.h>
|
||||
#include <coreplugin/modemanager.h>
|
||||
#include <coreplugin/rightpane.h>
|
||||
@@ -78,10 +79,8 @@
|
||||
#include <QtGui/QToolBar>
|
||||
|
||||
#include <QtHelp/QHelpEngine>
|
||||
#include <QtHelp/QHelpEngineCore>
|
||||
|
||||
using namespace Core::Constants;
|
||||
using namespace Help;
|
||||
using namespace Help::Internal;
|
||||
|
||||
const char * const SB_INDEX = QT_TRANSLATE_NOOP("Help::Internal::HelpPlugin", "Index");
|
||||
@@ -141,22 +140,20 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
qApp->installTranslator(qhelptr);
|
||||
}
|
||||
|
||||
addAutoReleasedObject(m_helpManager = new HelpManager(this));
|
||||
addAutoReleasedObject(m_helpManager = new LocalHelpManager(this));
|
||||
addAutoReleasedObject(m_openPagesManager = new OpenPagesManager(this));
|
||||
|
||||
addAutoReleasedObject(m_docSettingsPage = new DocSettingsPage());
|
||||
addAutoReleasedObject(m_filterSettingsPage = new FilterSettingsPage());
|
||||
addAutoReleasedObject(m_generalSettingsPage = new GeneralSettingsPage());
|
||||
|
||||
connect(m_docSettingsPage, SIGNAL(documentationChanged()), m_filterSettingsPage,
|
||||
SLOT(updateFilterPage()));
|
||||
connect(m_generalSettingsPage, SIGNAL(fontChanged()), this,
|
||||
SLOT(fontChanged()));
|
||||
connect(m_helpManager, SIGNAL(helpRequested(QUrl)), this,
|
||||
connect(Core::HelpManager::instance(), SIGNAL(helpRequested(QUrl)), this,
|
||||
SLOT(handleHelpRequest(QUrl)));
|
||||
m_filterSettingsPage->setHelpManager(m_helpManager);
|
||||
connect(m_filterSettingsPage, SIGNAL(filtersChanged()), this,
|
||||
SLOT(setupHelpEngineIfNeeded()));
|
||||
connect(m_docSettingsPage, SIGNAL(documentationChanged()), this,
|
||||
connect(Core::HelpManager::instance(), SIGNAL(documentationChanged()), this,
|
||||
SLOT(setupHelpEngineIfNeeded()));
|
||||
|
||||
m_splitter = new Core::MiniSplitter;
|
||||
@@ -314,30 +311,20 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
|
||||
void HelpPlugin::extensionsInitialized()
|
||||
{
|
||||
const QString &filterInternal = QString::fromLatin1("Qt Creator %1.%2.%3")
|
||||
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE);
|
||||
const QRegExp filterRegExp(QLatin1String("Qt Creator \\d*\\.\\d*\\.\\d*"));
|
||||
|
||||
QHelpEngineCore *engine = &m_helpManager->helpEngineCore();
|
||||
const QStringList &filters = engine->customFilters();
|
||||
foreach (const QString &filter, filters) {
|
||||
if (filterRegExp.exactMatch(filter) && filter != filterInternal)
|
||||
engine->removeCustomFilter(filter);
|
||||
}
|
||||
|
||||
const QString &docInternal = QString::fromLatin1("com.nokia.qtcreator.%1%2%3")
|
||||
const QString &nsInternal = QString::fromLatin1("com.nokia.qtcreator.%1%2%3")
|
||||
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE);
|
||||
|
||||
foreach (const QString &ns, engine->registeredDocumentations()) {
|
||||
Core::HelpManager *helpManager = Core::HelpManager::instance();
|
||||
foreach (const QString &ns, helpManager->registeredNamespaces()) {
|
||||
if (ns.startsWith(QLatin1String("com.nokia.qtcreator."))
|
||||
&& ns != docInternal)
|
||||
m_helpManager->unregisterDocumentation(QStringList() << ns);
|
||||
&& ns != nsInternal)
|
||||
helpManager->unregisterDocumentation(QStringList() << ns);
|
||||
}
|
||||
|
||||
QStringList filesToRegister;
|
||||
// Explicitly register qml.qch if located in creator directory. This is only
|
||||
// needed for the creator-qml package, were we want to ship the documentation
|
||||
// without a qt development version.
|
||||
// without a qt development version. TODO: is this still really needed, remove
|
||||
const QString &appPath = QCoreApplication::applicationDirPath();
|
||||
filesToRegister.append(QDir::cleanPath(QDir::cleanPath(appPath
|
||||
+ QLatin1String(DOCPATH "qml.qch"))));
|
||||
@@ -345,24 +332,6 @@ void HelpPlugin::extensionsInitialized()
|
||||
// we might need to register creators inbuild help
|
||||
filesToRegister.append(QDir::cleanPath(appPath
|
||||
+ QLatin1String(DOCPATH "qtcreator.qch")));
|
||||
|
||||
// this comes from the installer
|
||||
const QLatin1String key("AddedDocs");
|
||||
const QString &addedDocs = engine->customValue(key).toString();
|
||||
if (!addedDocs.isEmpty()) {
|
||||
engine->removeCustomValue(key);
|
||||
filesToRegister += addedDocs.split(QLatin1Char(';'));
|
||||
}
|
||||
|
||||
updateFilterComboBox();
|
||||
m_helpManager->verifyDocumenation();
|
||||
m_helpManager->registerDocumentation(filesToRegister);
|
||||
|
||||
const QString &url = QString::fromLatin1("qthelp://com.nokia.qtcreator."
|
||||
"%1%2%3/doc/index.html").arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR)
|
||||
.arg(IDE_VERSION_RELEASE);
|
||||
engine->setCustomValue(QLatin1String("DefaultHomePage"), url);
|
||||
connect(engine, SIGNAL(setupFinished()), this, SLOT(updateFilterComboBox()));
|
||||
}
|
||||
|
||||
void HelpPlugin::aboutToShutdown()
|
||||
@@ -425,7 +394,7 @@ void HelpPlugin::setupUi()
|
||||
// connect(shortcut, SIGNAL(activated()), this, SLOT(activateSearch()));
|
||||
// shortcutMap.insert(QLatin1String(SB_SEARCH), cmd);
|
||||
|
||||
BookmarkManager *manager = &HelpManager::bookmarkManager();
|
||||
BookmarkManager *manager = &LocalHelpManager::bookmarkManager();
|
||||
BookmarkWidget *bookmarkWidget = new BookmarkWidget(manager, 0, false);
|
||||
bookmarkWidget->setWindowTitle(tr(SB_BOOKMARKS));
|
||||
m_bookmarkItem = new Core::SideBarItem(bookmarkWidget, QLatin1String(SB_BOOKMARKS));
|
||||
@@ -470,24 +439,36 @@ void HelpPlugin::setupUi()
|
||||
|
||||
void HelpPlugin::resetFilter()
|
||||
{
|
||||
const QString &filterInternal = QString::fromLatin1("Qt Creator %1.%2.%3")
|
||||
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR).arg(IDE_VERSION_RELEASE);
|
||||
const QRegExp filterRegExp(QLatin1String("Qt Creator \\d*\\.\\d*\\.\\d*"));
|
||||
|
||||
QHelpEngineCore *engine = &LocalHelpManager::helpEngine();
|
||||
const QStringList &filters = engine->customFilters();
|
||||
foreach (const QString &filter, filters) {
|
||||
if (filterRegExp.exactMatch(filter) && filter != filterInternal)
|
||||
engine->removeCustomFilter(filter);
|
||||
}
|
||||
|
||||
const QLatin1String weAddedFilterKey("UnfilteredFilterInserted");
|
||||
const QLatin1String previousFilterNameKey("UnfilteredFilterName");
|
||||
|
||||
QHelpEngineCore *core = &m_helpManager->helpEngineCore();
|
||||
if (core->customValue(weAddedFilterKey).toInt() == 1) {
|
||||
if (engine->customValue(weAddedFilterKey).toInt() == 1) {
|
||||
// we added a filter at some point, remove previously added filter
|
||||
const QString &filter = core->customValue(previousFilterNameKey).toString();
|
||||
const QString &filter = engine->customValue(previousFilterNameKey).toString();
|
||||
if (!filter.isEmpty())
|
||||
core->removeCustomFilter(filter);
|
||||
engine->removeCustomFilter(filter);
|
||||
}
|
||||
|
||||
// potentially remove a filter with new name
|
||||
const QString filterName = tr("Unfiltered");
|
||||
core->removeCustomFilter(filterName);
|
||||
core->addCustomFilter(filterName, QStringList());
|
||||
core->setCustomValue(weAddedFilterKey, 1);
|
||||
core->setCustomValue(previousFilterNameKey, filterName);
|
||||
(&m_helpManager->helpEngine())->setCurrentFilter(filterName);
|
||||
engine->removeCustomFilter(filterName);
|
||||
engine->addCustomFilter(filterName, QStringList());
|
||||
engine->setCustomValue(weAddedFilterKey, 1);
|
||||
engine->setCustomValue(previousFilterNameKey, filterName);
|
||||
engine->setCurrentFilter(filterName);
|
||||
|
||||
updateFilterComboBox();
|
||||
connect(engine, SIGNAL(setupFinished()), this, SLOT(updateFilterComboBox()));
|
||||
}
|
||||
|
||||
void HelpPlugin::createRightPaneContextViewer()
|
||||
@@ -595,9 +576,9 @@ void HelpPlugin::modeChanged(Core::IMode *mode)
|
||||
qApp->processEvents();
|
||||
qApp->setOverrideCursor(Qt::WaitCursor);
|
||||
|
||||
m_helpManager->setupGuiHelpEngine();
|
||||
setupUi();
|
||||
resetFilter();
|
||||
m_helpManager->setupGuiHelpEngine();
|
||||
OpenPagesManager::instance().setupInitialPages();
|
||||
|
||||
qApp->restoreOverrideCursor();
|
||||
@@ -633,7 +614,7 @@ void HelpPlugin::fontChanged()
|
||||
if (!m_helpViewerForSideBar)
|
||||
createRightPaneContextViewer();
|
||||
|
||||
const QHelpEngineCore &engine = m_helpManager->helpEngineCore();
|
||||
const QHelpEngine &engine = LocalHelpManager::helpEngine();
|
||||
QFont font = qVariantValue<QFont>(engine.customValue(QLatin1String("font"),
|
||||
m_helpViewerForSideBar->viewerFont()));
|
||||
|
||||
@@ -647,7 +628,8 @@ void HelpPlugin::fontChanged()
|
||||
|
||||
void HelpPlugin::setupHelpEngineIfNeeded()
|
||||
{
|
||||
if (Core::ICore::instance()->modeManager()->currentMode() == m_mode)
|
||||
m_helpManager->setEngineNeedsUpdate();
|
||||
if (Core::ModeManager::instance()->currentMode() == m_mode)
|
||||
m_helpManager->setupGuiHelpEngine();
|
||||
}
|
||||
|
||||
@@ -656,7 +638,7 @@ HelpViewer* HelpPlugin::viewerForContextMode()
|
||||
using namespace Core;
|
||||
|
||||
bool showSideBySide = false;
|
||||
const QHelpEngineCore &engine = m_helpManager->helpEngineCore();
|
||||
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
|
||||
RightPanePlaceHolder *placeHolder = RightPanePlaceHolder::current();
|
||||
switch (engine.customValue(QLatin1String("ContextHelpOption"), 0).toInt()) {
|
||||
case 0: {
|
||||
@@ -713,7 +695,7 @@ void HelpPlugin::activateContext()
|
||||
// Find out what to show
|
||||
if (IContext *context = m_core->currentContextObject()) {
|
||||
id = context->contextHelpId();
|
||||
links = m_helpManager->helpEngineCore().linksForIdentifier(id);
|
||||
links = Core::HelpManager::instance()->linksForIdentifier(id);
|
||||
}
|
||||
|
||||
if (HelpViewer* viewer = viewerForContextMode()) {
|
||||
@@ -803,7 +785,7 @@ QToolBar *HelpPlugin::createToolBar()
|
||||
|
||||
void HelpPlugin::updateFilterComboBox()
|
||||
{
|
||||
const QHelpEngine &engine = m_helpManager->helpEngine();
|
||||
const QHelpEngine &engine = LocalHelpManager::helpEngine();
|
||||
QString curFilter = m_filterComboBox->currentText();
|
||||
if (curFilter.isEmpty())
|
||||
curFilter = engine.currentFilter();
|
||||
@@ -817,7 +799,7 @@ void HelpPlugin::updateFilterComboBox()
|
||||
|
||||
void HelpPlugin::filterDocumentation(const QString &customFilter)
|
||||
{
|
||||
(&m_helpManager->helpEngine())->setCurrentFilter(customFilter);
|
||||
LocalHelpManager::helpEngine().setCurrentFilter(customFilter);
|
||||
}
|
||||
|
||||
void HelpPlugin::addBookmark()
|
||||
@@ -828,7 +810,7 @@ void HelpPlugin::addBookmark()
|
||||
if (url.isEmpty() || url == Help::Constants::AboutBlank)
|
||||
return;
|
||||
|
||||
BookmarkManager *manager = &HelpManager::bookmarkManager();
|
||||
BookmarkManager *manager = &LocalHelpManager::bookmarkManager();
|
||||
manager->showBookmarkDialog(m_centralWidget, viewer->title(), url);
|
||||
}
|
||||
|
||||
@@ -837,7 +819,7 @@ void HelpPlugin::handleHelpRequest(const QUrl &url)
|
||||
if (HelpViewer::launchWithExternalApp(url))
|
||||
return;
|
||||
|
||||
if (m_helpManager->helpEngineCore().findFile(url).isValid()) {
|
||||
if (Core::HelpManager::instance()->findFile(url).isValid()) {
|
||||
if (url.queryItemValue(QLatin1String("view")) == QLatin1String("split")) {
|
||||
if (HelpViewer* viewer = viewerForContextMode())
|
||||
viewer->setSource(url);
|
||||
|
||||
@@ -49,8 +49,6 @@ class SideBarItem;
|
||||
} // Core
|
||||
|
||||
namespace Help {
|
||||
class HelpManager;
|
||||
|
||||
namespace Internal {
|
||||
class CentralWidget;
|
||||
class DocSettingsPage;
|
||||
@@ -58,6 +56,7 @@ class FilterSettingsPage;
|
||||
class GeneralSettingsPage;
|
||||
class HelpMode;
|
||||
class HelpViewer;
|
||||
class LocalHelpManager;
|
||||
class OpenPagesManager;
|
||||
class SearchWidget;
|
||||
|
||||
@@ -129,7 +128,7 @@ private:
|
||||
Core::SideBar *m_sideBar;
|
||||
|
||||
bool m_firstModeChange;
|
||||
HelpManager *m_helpManager;
|
||||
LocalHelpManager *m_helpManager;
|
||||
OpenPagesManager *m_openPagesManager;
|
||||
Core::MiniSplitter *m_splitter;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QtGui/QMouseEvent>
|
||||
|
||||
#include <QtHelp/QHelpEngineCore>
|
||||
#include <QtHelp/QHelpEngine>
|
||||
|
||||
using namespace Help::Internal;
|
||||
|
||||
@@ -126,7 +126,7 @@ QString HelpViewer::mimeFromUrl(const QUrl &url)
|
||||
bool HelpViewer::launchWithExternalApp(const QUrl &url)
|
||||
{
|
||||
if (isLocalUrl(url)) {
|
||||
const QHelpEngineCore &helpEngine = Help::HelpManager::helpEngineCore();
|
||||
const QHelpEngineCore &helpEngine = LocalHelpManager::helpEngine();
|
||||
const QUrl &resolvedUrl = helpEngine.findFile(url);
|
||||
if (!resolvedUrl.isValid())
|
||||
return false;
|
||||
@@ -155,7 +155,7 @@ bool HelpViewer::launchWithExternalApp(const QUrl &url)
|
||||
|
||||
void HelpViewer::home()
|
||||
{
|
||||
const QHelpEngineCore &engine = Help::HelpManager::helpEngineCore();
|
||||
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
|
||||
QString homepage = engine.customValue(QLatin1String("HomePage"),
|
||||
QLatin1String("")).toString();
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
#include <QtGui/QApplication>
|
||||
#include <QtGui/QWheelEvent>
|
||||
|
||||
#include <QtHelp/QHelpEngineCore>
|
||||
#include <QtHelp/QHelpEngine>
|
||||
|
||||
#include <QtNetwork/QNetworkAccessManager>
|
||||
#include <QtNetwork/QNetworkReply>
|
||||
@@ -125,7 +125,7 @@ QNetworkReply *HelpNetworkAccessManager::createRequest(Operation /*op*/,
|
||||
const QNetworkRequest &request, QIODevice* /*outgoingData*/)
|
||||
{
|
||||
QString url = request.url().toString();
|
||||
const QHelpEngineCore &engine = HelpManager::helpEngineCore();
|
||||
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
|
||||
// TODO: For some reason the url to load is already wrong (passed from webkit)
|
||||
// though the css file and the references inside should work that way. One
|
||||
// possible problem might be that the css is loaded at the same level as the
|
||||
@@ -266,7 +266,7 @@ QFont HelpViewer::viewerFont() const
|
||||
QWebSettings* webSettings = QWebSettings::globalSettings();
|
||||
QFont font(QApplication::font().family(),
|
||||
webSettings->fontSize(QWebSettings::DefaultFontSize));
|
||||
const QHelpEngineCore &engine = HelpManager::helpEngineCore();
|
||||
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
|
||||
return qVariantValue<QFont>(engine.customValue(QLatin1String("font"),
|
||||
font));
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QTreeView>
|
||||
|
||||
#include <QtHelp/QHelpEngineCore>
|
||||
#include <QtHelp/QHelpEngine>
|
||||
|
||||
using namespace Help::Internal;
|
||||
|
||||
@@ -118,7 +118,7 @@ QStringList splitString(const QVariant &value)
|
||||
|
||||
void OpenPagesManager::setupInitialPages()
|
||||
{
|
||||
const QHelpEngineCore &engine = HelpManager::helpEngineCore();
|
||||
const QHelpEngineCore &engine = LocalHelpManager::helpEngine();
|
||||
const int option = engine.customValue(QLatin1String("StartOption"),
|
||||
Help::Constants::ShowLastPages).toInt();
|
||||
QString homePage = engine.customValue(QLatin1String("DefaultHomePage"),
|
||||
|
||||
@@ -100,7 +100,7 @@ void SearchWidget::showEvent(QShowEvent *event)
|
||||
QVBoxLayout *vLayout = new QVBoxLayout(this);
|
||||
vLayout->setMargin(4);
|
||||
|
||||
searchEngine = (&HelpManager::helpEngine())->searchEngine();
|
||||
searchEngine = (&LocalHelpManager::helpEngine())->searchEngine();
|
||||
resultWidget = searchEngine->resultWidget();
|
||||
QHelpSearchQueryWidget *queryWidget = searchEngine->queryWidget();
|
||||
|
||||
@@ -126,7 +126,7 @@ void SearchWidget::showEvent(QShowEvent *event)
|
||||
connect(searchEngine, SIGNAL(indexingFinished()), this,
|
||||
SLOT(indexingFinished()));
|
||||
|
||||
QMetaObject::invokeMethod(&HelpManager::helpEngine(), "setupFinished",
|
||||
QMetaObject::invokeMethod(&LocalHelpManager::helpEngine(), "setupFinished",
|
||||
Qt::QueuedConnection);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user