forked from qt-creator/qt-creator
Move HelpManager it's own source files.
Reviewed-by: ck
This commit is contained in:
@@ -19,7 +19,8 @@ HEADERS += helpplugin.h \
|
||||
help_global.h \
|
||||
helpindexfilter.h \
|
||||
generalsettingspage.h \
|
||||
xbelsupport.h
|
||||
xbelsupport.h \
|
||||
helpmanager.h
|
||||
|
||||
SOURCES += helpplugin.cpp \
|
||||
docsettingspage.cpp \
|
||||
@@ -30,7 +31,8 @@ SOURCES += helpplugin.cpp \
|
||||
helpfindsupport.cpp \
|
||||
helpindexfilter.cpp \
|
||||
generalsettingspage.cpp \
|
||||
xbelsupport.cpp
|
||||
xbelsupport.cpp \
|
||||
helpmanager.cpp
|
||||
|
||||
FORMS += docsettingspage.ui \
|
||||
filtersettingspage.ui \
|
||||
|
||||
60
src/plugins/help/helpmanager.cpp
Normal file
60
src/plugins/help/helpmanager.cpp
Normal file
@@ -0,0 +1,60 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
#include "helpmanager.h"
|
||||
|
||||
#include "helpplugin.h"
|
||||
|
||||
#include <QtCore/QUrl>
|
||||
#include <QtCore/QString>
|
||||
|
||||
using namespace Help;
|
||||
using namespace Help::Internal;
|
||||
|
||||
HelpManager::HelpManager(HelpPlugin* plugin)
|
||||
: m_plugin(plugin)
|
||||
{
|
||||
}
|
||||
|
||||
void HelpManager::openHelpPage(const QString& url)
|
||||
{
|
||||
m_plugin->handleHelpRequest(url);
|
||||
}
|
||||
|
||||
void HelpManager::openContextHelpPage(const QString& url)
|
||||
{
|
||||
m_plugin->openContextHelpPage(url);
|
||||
}
|
||||
|
||||
void HelpManager::registerDocumentation(const QStringList &fileNames)
|
||||
{
|
||||
if (m_plugin) {
|
||||
m_plugin->setFilesToRegister(fileNames);
|
||||
emit helpPluginUpdateDocumentation();
|
||||
}
|
||||
}
|
||||
63
src/plugins/help/helpmanager.h
Normal file
63
src/plugins/help/helpmanager.h
Normal file
@@ -0,0 +1,63 @@
|
||||
/**************************************************************************
|
||||
**
|
||||
** This file is part of Qt Creator
|
||||
**
|
||||
** Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
||||
**
|
||||
** Contact: Nokia Corporation (qt-info@nokia.com)
|
||||
**
|
||||
** Commercial Usage
|
||||
**
|
||||
** Licensees holding valid Qt Commercial licenses may use this file in
|
||||
** accordance with the Qt Commercial License Agreement provided with the
|
||||
** Software or, alternatively, in accordance with the terms contained in
|
||||
** a written agreement between you and Nokia.
|
||||
**
|
||||
** GNU Lesser General Public License Usage
|
||||
**
|
||||
** Alternatively, this file may be used under the terms of the GNU Lesser
|
||||
** General Public License version 2.1 as published by the Free Software
|
||||
** Foundation and appearing in the file LICENSE.LGPL included in the
|
||||
** packaging of this file. Please review the following information to
|
||||
** ensure the GNU Lesser General Public License version 2.1 requirements
|
||||
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
||||
**
|
||||
** If you are unsure which license is appropriate for your use, please
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
#ifndef HELPMANAGER_H
|
||||
#define HELPMANAGER_H
|
||||
|
||||
#include "help_global.h"
|
||||
|
||||
#include <QtCore/QObject>
|
||||
|
||||
QT_FORWARD_DECLARE_CLASS(QString)
|
||||
QT_FORWARD_DECLARE_CLASS(QStringList)
|
||||
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
class HelpPlugin;
|
||||
} // Internal
|
||||
|
||||
class HELP_EXPORT HelpManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HelpManager(Internal::HelpPlugin*);
|
||||
|
||||
void openHelpPage(const QString& url);
|
||||
void openContextHelpPage(const QString &url);
|
||||
void registerDocumentation(const QStringList &fileNames);
|
||||
|
||||
signals:
|
||||
void helpPluginUpdateDocumentation();
|
||||
|
||||
private:
|
||||
Internal::HelpPlugin *m_plugin;
|
||||
};
|
||||
|
||||
} // Help
|
||||
|
||||
#endif // HELPMANAGER_H
|
||||
@@ -26,7 +26,6 @@
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#include "helpplugin.h"
|
||||
|
||||
#include "bookmarkmanager.h"
|
||||
@@ -37,13 +36,12 @@
|
||||
#include "generalsettingspage.h"
|
||||
#include "helpfindsupport.h"
|
||||
#include "helpindexfilter.h"
|
||||
#include "helpmanager.h"
|
||||
#include "helpmode.h"
|
||||
#include "helpviewer.h"
|
||||
#include "indexwindow.h"
|
||||
#include "searchwidget.h"
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
#include <coreplugin/coreconstants.h>
|
||||
#include <coreplugin/editormanager/editormanager.h>
|
||||
@@ -55,65 +53,38 @@
|
||||
#include <coreplugin/rightpane.h>
|
||||
#include <coreplugin/sidebar.h>
|
||||
#include <coreplugin/uniqueidmanager.h>
|
||||
|
||||
#include <extensionsystem/pluginmanager.h>
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
#include <utils/styledbar.h>
|
||||
#include <welcome/welcomemode.h>
|
||||
|
||||
#include <texteditor/texteditorconstants.h>
|
||||
|
||||
#include <utils/styledbar.h>
|
||||
|
||||
#include <QtCore/QDebug>
|
||||
#include <QtCore/qplugin.h>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QSettings>
|
||||
#include <QtCore/QDir>
|
||||
#include <QtCore/QResource>
|
||||
#include <QtCore/QFileInfo>
|
||||
#include <QtCore/QLibraryInfo>
|
||||
#include <QtCore/QTranslator>
|
||||
#include <QtCore/qplugin.h>
|
||||
|
||||
#include <QtGui/QAction>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QMessageBox>
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QtGui/QShortcut>
|
||||
#include <QtGui/QSplitter>
|
||||
#include <QtGui/QStyle>
|
||||
#include <QtGui/QToolBar>
|
||||
#include <QtGui/QComboBox>
|
||||
#include <QtGui/QDesktopServices>
|
||||
#include <QtGui/QMessageBox>
|
||||
|
||||
#include <QtHelp/QHelpEngine>
|
||||
|
||||
#ifndef QT_NO_WEBKIT
|
||||
#include <QtGui/QApplication>
|
||||
#if defined(QT_NO_WEBKIT)
|
||||
# include <QtGui/QApplication>
|
||||
#else
|
||||
#include <QtWebKit/QWebSettings>
|
||||
# include <QtWebKit/QWebSettings>
|
||||
#endif
|
||||
|
||||
using namespace Help;
|
||||
using namespace Help::Internal;
|
||||
|
||||
HelpManager::HelpManager(Internal::HelpPlugin* plugin)
|
||||
: m_plugin(plugin)
|
||||
{
|
||||
}
|
||||
|
||||
void HelpManager::registerDocumentation(const QStringList &fileNames)
|
||||
{
|
||||
if (m_plugin) {
|
||||
m_plugin->setFilesToRegister(fileNames);
|
||||
emit helpPluginUpdateDocumentation();
|
||||
}
|
||||
}
|
||||
|
||||
void HelpManager::openHelpPage(const QString& url)
|
||||
{
|
||||
m_plugin->handleHelpRequest(url);
|
||||
}
|
||||
|
||||
void HelpManager::openContextHelpPage(const QString& url)
|
||||
{
|
||||
m_plugin->openContextHelpPage(url);
|
||||
}
|
||||
|
||||
HelpPlugin::HelpPlugin() :
|
||||
m_core(0),
|
||||
HelpPlugin::HelpPlugin()
|
||||
: m_core(0),
|
||||
m_helpEngine(0),
|
||||
m_contextHelpEngine(0),
|
||||
m_contentWidget(0),
|
||||
@@ -167,8 +138,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
||||
#endif
|
||||
|
||||
// FIXME shouldn't the help engine create the directory if it doesn't exist?
|
||||
QFileInfo fi(m_core->settings()->fileName());
|
||||
QDir directory(fi.absolutePath()+"/qtcreator");
|
||||
const QFileInfo &fi(m_core->settings()->fileName());
|
||||
const QDir &directory(fi.absolutePath()+"/qtcreator");
|
||||
if (!directory.exists())
|
||||
directory.mkpath(directory.absolutePath());
|
||||
m_helpEngine = new QHelpEngine(directory.absolutePath() +
|
||||
|
||||
@@ -26,12 +26,9 @@
|
||||
** contact the sales department at http://qt.nokia.com/contact.
|
||||
**
|
||||
**************************************************************************/
|
||||
|
||||
#ifndef HELPPLUGIN_H
|
||||
#define HELPPLUGIN_H
|
||||
|
||||
#include "help_global.h"
|
||||
|
||||
#include <extensionsystem/iplugin.h>
|
||||
|
||||
#include <QtCore/QMap>
|
||||
@@ -40,9 +37,8 @@
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QComboBox;
|
||||
class QHelpEngineCore;
|
||||
class QHelpEngine;
|
||||
class QShortcut;
|
||||
class QHelpEngineCore;
|
||||
class QToolBar;
|
||||
class QUrl;
|
||||
QT_END_NAMESPACE
|
||||
@@ -53,50 +49,28 @@ class BookmarkManager;
|
||||
class BookmarkWidget;
|
||||
class HelpViewer;
|
||||
|
||||
|
||||
namespace Core {
|
||||
class ICore;
|
||||
class IMode;
|
||||
class SideBar;
|
||||
class SideBarItem;
|
||||
}
|
||||
} // Core
|
||||
|
||||
namespace Help {
|
||||
namespace Internal {
|
||||
class CentralWidget;
|
||||
class HelpPlugin;
|
||||
}
|
||||
class HelpManager;
|
||||
|
||||
namespace Constants {
|
||||
const char * const C_MODE_HELP = "Help Mode";
|
||||
const char * const C_HELP_SIDEBAR = "Help Sidebar";
|
||||
const int P_MODE_HELP = 70;
|
||||
const char * const ID_MODE_HELP = "Help";
|
||||
}
|
||||
|
||||
class HELP_EXPORT HelpManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
HelpManager(Internal::HelpPlugin*);
|
||||
|
||||
void registerDocumentation(const QStringList &fileNames);
|
||||
void openHelpPage(const QString& url);
|
||||
void openContextHelpPage(const QString &url);
|
||||
|
||||
signals:
|
||||
void helpPluginUpdateDocumentation();
|
||||
|
||||
private:
|
||||
Internal::HelpPlugin *m_plugin;
|
||||
};
|
||||
const char * const C_MODE_HELP = "Help Mode";
|
||||
const char * const C_HELP_SIDEBAR = "Help Sidebar";
|
||||
const int P_MODE_HELP = 70;
|
||||
const char * const ID_MODE_HELP = "Help";
|
||||
} // Constants
|
||||
|
||||
namespace Internal {
|
||||
|
||||
class HelpMode;
|
||||
class HelpPluginEditorFactory;
|
||||
class CentralWidget;
|
||||
class DocSettingsPage;
|
||||
class FilterSettingsPage;
|
||||
class HelpMode;
|
||||
class SearchWidget;
|
||||
|
||||
class HelpPlugin : public ExtensionSystem::IPlugin
|
||||
@@ -124,7 +98,7 @@ public:
|
||||
|
||||
public slots:
|
||||
void pluginUpdateDocumentation();
|
||||
void handleHelpRequest(const QUrl& url);
|
||||
void handleHelpRequest(const QUrl &url);
|
||||
|
||||
private slots:
|
||||
void modeChanged(Core::IMode *mode);
|
||||
@@ -172,7 +146,7 @@ private:
|
||||
BookmarkWidget *m_bookmarkWidget;
|
||||
BookmarkManager *m_bookmarkManager;
|
||||
SearchWidget *m_searchWidget;
|
||||
Help::Internal::CentralWidget *m_centralWidget;
|
||||
CentralWidget *m_centralWidget;
|
||||
HelpViewer *m_helpViewerForSideBar;
|
||||
HelpMode *m_mode;
|
||||
bool m_shownLastPages;
|
||||
|
||||
Reference in New Issue
Block a user