helpplugin.h 3.84 KB
Newer Older
1
/**************************************************************************
con's avatar
con committed
2
3
4
**
** This file is part of Qt Creator
**
hjk's avatar
hjk committed
5
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
con's avatar
con committed
6
**
7
** Contact: Nokia Corporation (qt-info@nokia.com)
con's avatar
con committed
8
**
9
** Commercial Usage
10
**
11
12
13
14
** 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.
15
**
16
** GNU Lesser General Public License Usage
17
**
18
19
20
21
22
23
** 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.
24
**
25
** If you are unsure which license is appropriate for your use, please
hjk's avatar
hjk committed
26
** contact the sales department at http://qt.nokia.com/contact.
con's avatar
con committed
27
**
28
**************************************************************************/
29

con's avatar
con committed
30
31
32
33
34
#ifndef HELPPLUGIN_H
#define HELPPLUGIN_H

#include <extensionsystem/iplugin.h>
#include <QtCore/QMap>
35
#include <QtCore/QStringList>
con's avatar
con committed
36

37
38
39
40
41
QT_FORWARD_DECLARE_CLASS(QAction)
QT_FORWARD_DECLARE_CLASS(QComboBox)
QT_FORWARD_DECLARE_CLASS(QToolBar)
QT_FORWARD_DECLARE_CLASS(QToolButton)
QT_FORWARD_DECLARE_CLASS(QUrl)
con's avatar
con committed
42
43
44
45

namespace Core {
class ICore;
class IMode;
46
class MiniSplitter;
con's avatar
con committed
47
48
class SideBar;
class SideBarItem;
kh1's avatar
kh1 committed
49
}   // Core
con's avatar
con committed
50
51
52

namespace Help {
namespace Internal {
kh1's avatar
kh1 committed
53
class CentralWidget;
con's avatar
con committed
54
55
class DocSettingsPage;
class FilterSettingsPage;
56
class GeneralSettingsPage;
57
58
class HelpMode;
class HelpViewer;
kh1's avatar
kh1 committed
59
class LocalHelpManager;
60
class OpenPagesManager;
con's avatar
con committed
61
62
63
64
65
66
67
68
69
70
71
72
class SearchWidget;

class HelpPlugin : public ExtensionSystem::IPlugin
{
    Q_OBJECT

public:
    HelpPlugin();
    virtual ~HelpPlugin();

    bool initialize(const QStringList &arguments, QString *error_message);
    void extensionsInitialized();
73
    ShutdownFlag aboutToShutdown();
con's avatar
con committed
74
75
76

private slots:
    void modeChanged(Core::IMode *mode);
77

con's avatar
con committed
78
79
80
81
    void activateContext();
    void activateIndex();
    void activateContents();
    void activateSearch();
82
    void activateOpenPages();
kh1's avatar
kh1 committed
83
    void activateBookmarks();
84
85

    void addBookmark();
con's avatar
con committed
86
87
88
89
90
91
92
    void updateFilterComboBox();
    void filterDocumentation(const QString &customFilter);

    void switchToHelpMode();
    void switchToHelpMode(const QUrl &source);
    void slotHideRightPane();

93
94
95
    void updateSideBarSource();
    void updateSideBarSource(const QUrl &newUrl);

96
    void fontChanged();
97
    void updateCloseButton();
98
    void setupHelpEngineIfNeeded();
99

100
    void highlightSearchTerms();
kh1's avatar
kh1 committed
101
102
    void handleHelpRequest(const QUrl &url);

103
private:
104
    void setupUi();
kh1's avatar
kh1 committed
105
    void resetFilter();
hjk's avatar
hjk committed
106
    void activateHelpMode();
107
    QToolBar *createToolBar();
108
    HelpViewer* viewerForContextMode();
109
    void createRightPaneContextViewer();
con's avatar
con committed
110

111
112
private:
    HelpMode *m_mode;
con's avatar
con committed
113
    Core::ICore *m_core;
114
    QWidget *m_mainWidget;
kh1's avatar
kh1 committed
115
    CentralWidget *m_centralWidget;
con's avatar
con committed
116
117
118
119
120
121
    HelpViewer *m_helpViewerForSideBar;

    Core::SideBarItem *m_contentItem;
    Core::SideBarItem *m_indexItem;
    Core::SideBarItem *m_searchItem;
    Core::SideBarItem *m_bookmarkItem;
122
    Core::SideBarItem *m_openPagesItem;
con's avatar
con committed
123
124
125

    DocSettingsPage *m_docSettingsPage;
    FilterSettingsPage *m_filterSettingsPage;
126
    GeneralSettingsPage *m_generalSettingsPage;
con's avatar
con committed
127
128
129

    QComboBox *m_filterComboBox;
    Core::SideBar *m_sideBar;
130

131
    bool m_firstModeChange;
kh1's avatar
kh1 committed
132
    LocalHelpManager *m_helpManager;
133
    OpenPagesManager *m_openPagesManager;
134
    Core::MiniSplitter *m_splitter;
135
136

    QToolButton *m_closeButton;
137
138
139
140

    QString m_oldAttrValue;
    QString m_styleProperty;
    QString m_idFromContext;
con's avatar
con committed
141
142
143
144
145
146
};

} // namespace Internal
} // namespace Help

#endif // HELPPLUGIN_H