OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / help / helpplugin.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef HELPPLUGIN_H
35 #define HELPPLUGIN_H
36
37 #include <extensionsystem/iplugin.h>
38 #include <QtCore/QMap>
39 #include <QtCore/QStringList>
40
41 QT_FORWARD_DECLARE_CLASS(QAction)
42 QT_FORWARD_DECLARE_CLASS(QComboBox)
43 QT_FORWARD_DECLARE_CLASS(QMenu)
44 QT_FORWARD_DECLARE_CLASS(QToolButton)
45 QT_FORWARD_DECLARE_CLASS(QUrl)
46
47 namespace Core {
48 class ICore;
49 class IMode;
50 class MiniSplitter;
51 class SideBar;
52 class SideBarItem;
53 }   // Core
54
55 namespace Utils {
56 class StyledBar;
57 }   // Utils
58
59 namespace Help {
60 namespace Internal {
61 class CentralWidget;
62 class DocSettingsPage;
63 class ExternalHelpWindow;
64 class FilterSettingsPage;
65 class GeneralSettingsPage;
66 class HelpMode;
67 class HelpViewer;
68 class LocalHelpManager;
69 class OpenPagesManager;
70 class SearchWidget;
71
72 class HelpPlugin : public ExtensionSystem::IPlugin
73 {
74     Q_OBJECT
75
76 public:
77     HelpPlugin();
78     virtual ~HelpPlugin();
79
80     bool initialize(const QStringList &arguments, QString *error_message);
81     void extensionsInitialized();
82     ShutdownFlag aboutToShutdown();
83
84 private slots:
85     void showExternalWindow();
86     void modeChanged(Core::IMode *mode, Core::IMode *old);
87
88     void activateContext();
89     void activateIndex();
90     void activateContents();
91     void activateSearch();
92     void activateOpenPages();
93     void activateBookmarks();
94
95     void addBookmark();
96     void updateFilterComboBox();
97     void filterDocumentation(const QString &customFilter);
98
99     void switchToHelpMode();
100     void switchToHelpMode(const QUrl &source);
101     void slotHideRightPane();
102     void showHideSidebar();
103
104     void updateSideBarSource();
105     void updateSideBarSource(const QUrl &newUrl);
106
107     void fontChanged();
108     void contextHelpOptionChanged();
109
110     void updateCloseButton();
111     void setupHelpEngineIfNeeded();
112
113     void highlightSearchTerms();
114     void handleHelpRequest(const QUrl &url);
115
116     void slotAboutToShowBackMenu();
117     void slotAboutToShowNextMenu();
118     void slotOpenActionUrl(QAction *action);
119
120     void openFindToolBar();
121
122     void scaleRightPaneUp();
123     void scaleRightPaneDown();
124     void resetRightPaneScale();
125
126 private:
127     void setupUi();
128     void resetFilter();
129     void activateHelpMode();
130     Utils::StyledBar *createWidgetToolBar();
131     Utils::StyledBar *createIconToolBar(bool external);
132     HelpViewer* viewerForContextMode();
133     void createRightPaneContextViewer();
134
135     void doSetupIfNeeded();
136     int contextHelpOption() const;
137     void connectExternalHelpWindow();
138     void setupNavigationMenus(QAction *back, QAction *next, QWidget *parent);
139
140 private:
141     HelpMode *m_mode;
142     Core::ICore *m_core;
143     CentralWidget *m_centralWidget;
144     HelpViewer *m_helpViewerForSideBar;
145
146     Core::SideBarItem *m_contentItem;
147     Core::SideBarItem *m_indexItem;
148     Core::SideBarItem *m_searchItem;
149     Core::SideBarItem *m_bookmarkItem;
150     Core::SideBarItem *m_openPagesItem;
151
152     DocSettingsPage *m_docSettingsPage;
153     FilterSettingsPage *m_filterSettingsPage;
154     GeneralSettingsPage *m_generalSettingsPage;
155
156     QComboBox *m_filterComboBox;
157     Core::SideBar *m_sideBar;
158
159     bool m_firstModeChange;
160     LocalHelpManager *m_helpManager;
161     OpenPagesManager *m_openPagesManager;
162     Core::MiniSplitter *m_splitter;
163
164     QToolButton *m_closeButton;
165
166     QString m_oldAttrValue;
167     QString m_styleProperty;
168     QString m_idFromContext;
169
170     Core::IMode* m_oldMode;
171     bool m_connectWindow;
172     ExternalHelpWindow *m_externalWindow;
173
174     QMenu *m_backMenu;
175     QMenu *m_nextMenu;
176     Utils::StyledBar *m_internalHelpBar;
177     Utils::StyledBar *m_externalHelpBar;
178 };
179
180 } // namespace Internal
181 } // namespace Help
182
183 #endif // HELPPLUGIN_H