From e94ff514ed950be1dad25dda415085743678d102 Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 2 Feb 2010 14:25:22 +0100 Subject: Move HelpManager it's own source files. Reviewed-by: ck --- src/plugins/help/help.pro | 6 ++- src/plugins/help/helpmanager.cpp | 60 +++++++++++++++++++++ src/plugins/help/helpmanager.h | 63 ++++++++++++++++++++++ src/plugins/help/helpplugin.cpp | 63 ++++++---------------- src/plugins/help/helpplugin.h | 50 +++++------------ src/plugins/qmljseditor/qmljseditorplugin.cpp | 2 +- .../gettingstartedwelcomepagewidget.cpp | 2 +- src/plugins/qt4projectmanager/qtversionmanager.cpp | 2 +- 8 files changed, 159 insertions(+), 89 deletions(-) create mode 100644 src/plugins/help/helpmanager.cpp create mode 100644 src/plugins/help/helpmanager.h (limited to 'src') diff --git a/src/plugins/help/help.pro b/src/plugins/help/help.pro index 525be8b294..0356e5e3e7 100644 --- a/src/plugins/help/help.pro +++ b/src/plugins/help/help.pro @@ -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 \ diff --git a/src/plugins/help/helpmanager.cpp b/src/plugins/help/helpmanager.cpp new file mode 100644 index 0000000000..ab14db978c --- /dev/null +++ b/src/plugins/help/helpmanager.cpp @@ -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 +#include + +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(); + } +} diff --git a/src/plugins/help/helpmanager.h b/src/plugins/help/helpmanager.h new file mode 100644 index 0000000000..81cebe66ab --- /dev/null +++ b/src/plugins/help/helpmanager.h @@ -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 + +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 diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 20651039cd..bba6b55ffd 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -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 - #include #include #include @@ -55,65 +53,38 @@ #include #include #include - -#include - +#include #include - #include +#include -#include -#include -#include -#include #include -#include +#include #include #include +#include + #include +#include +#include +#include #include #include -#include #include -#include -#include -#include + #include -#ifndef QT_NO_WEBKIT -#include +#if defined(QT_NO_WEBKIT) +# include #else -#include +# include #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() + diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h index 90f3d87f1c..645dd08a9c 100644 --- a/src/plugins/help/helpplugin.h +++ b/src/plugins/help/helpplugin.h @@ -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 #include @@ -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; diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp index 60df578b86..894c574507 100644 --- a/src/plugins/qmljseditor/qmljseditorplugin.cpp +++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp @@ -51,7 +51,7 @@ #include #include #include -#include +#include #include #include diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp index f00bf51afc..1182a79a44 100644 --- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp +++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp @@ -37,7 +37,7 @@ #include -#include +#include #include #include diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp index 2cb443efb0..172c5166aa 100644 --- a/src/plugins/qt4projectmanager/qtversionmanager.cpp +++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp @@ -44,7 +44,7 @@ #include #include #include -#include +#include #include #include -- cgit v1.2.1