From e94ff514ed950be1dad25dda415085743678d102 Mon Sep 17 00:00:00 2001
From: kh1 <qt-info@nokia.com>
Date: Tue, 2 Feb 2010 14:25:22 +0100
Subject: [PATCH] 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 +-
 .../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

diff --git a/src/plugins/help/help.pro b/src/plugins/help/help.pro
index 525be8b2943..0356e5e3e7f 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 00000000000..ab14db978cd
--- /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 <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();
+    }
+}
diff --git a/src/plugins/help/helpmanager.h b/src/plugins/help/helpmanager.h
new file mode 100644
index 00000000000..81cebe66ab7
--- /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 <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
diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp
index 20651039cd3..bba6b55ffd0 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 <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 <welcome/welcomemode.h>
-
+#include <extensionsystem/pluginmanager.h>
 #include <texteditor/texteditorconstants.h>
-
 #include <utils/styledbar.h>
+#include <welcome/welcomemode.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() +
diff --git a/src/plugins/help/helpplugin.h b/src/plugins/help/helpplugin.h
index 90f3d87f1c9..645dd08a9c9 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 <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;
diff --git a/src/plugins/qmljseditor/qmljseditorplugin.cpp b/src/plugins/qmljseditor/qmljseditorplugin.cpp
index 60df578b86b..894c5745073 100644
--- a/src/plugins/qmljseditor/qmljseditorplugin.cpp
+++ b/src/plugins/qmljseditor/qmljseditorplugin.cpp
@@ -51,7 +51,7 @@
 #include <texteditor/textfilewizard.h>
 #include <texteditor/texteditoractionhandler.h>
 #include <texteditor/completionsupport.h>
-#include <help/helpplugin.h>
+#include <help/helpmanager.h>
 #include <utils/qtcassert.h>
 
 #include <QtCore/QtPlugin>
diff --git a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
index f00bf51afc8..1182a79a443 100644
--- a/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
+++ b/src/plugins/qt4projectmanager/gettingstartedwelcomepagewidget.cpp
@@ -37,7 +37,7 @@
 
 #include <extensionsystem/pluginmanager.h>
 
-#include <help/helpplugin.h>
+#include <help/helpmanager.h>
 
 #include <QtCore/QDateTime>
 #include <QtCore/QDir>
diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp
index 2cb443efb0d..172c5166aa4 100644
--- a/src/plugins/qt4projectmanager/qtversionmanager.cpp
+++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp
@@ -44,7 +44,7 @@
 #include <coreplugin/icore.h>
 #include <coreplugin/modemanager.h>
 #include <extensionsystem/pluginmanager.h>
-#include <help/helpplugin.h>
+#include <help/helpmanager.h>
 #include <utils/qtcassert.h>
 
 #include <QtCore/QProcess>
-- 
GitLab