2014-06-17 18:14:37 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
|
|
|
|
** Contact: http://www.qt-project.org/legal
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
2014-10-01 13:21:18 +02:00
|
|
|
** conditions see http://www.qt.io/licensing. For further information
|
|
|
|
|
** use the contact form at http://www.qt.io/contact-us.
|
2014-06-17 18:14:37 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
2014-10-01 13:21:18 +02:00
|
|
|
** General Public License version 2.1 or version 3 as published by the Free
|
|
|
|
|
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
|
|
|
|
|
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
|
|
|
|
|
** following information to ensure the GNU Lesser General Public License
|
|
|
|
|
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
|
|
|
|
|
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
2014-06-17 18:14:37 +02:00
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
|
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#ifndef HELPWIDGET_H
|
|
|
|
|
#define HELPWIDGET_H
|
|
|
|
|
|
|
|
|
|
#include <coreplugin/icontext.h>
|
|
|
|
|
|
|
|
|
|
#include <qglobal.h>
|
|
|
|
|
#include <QWidget>
|
|
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
2014-06-18 17:42:01 +02:00
|
|
|
class QAction;
|
2014-09-25 16:29:56 +02:00
|
|
|
class QComboBox;
|
|
|
|
|
class QFont;
|
2014-06-17 18:14:37 +02:00
|
|
|
class QMenu;
|
2014-09-25 16:29:56 +02:00
|
|
|
class QPrinter;
|
|
|
|
|
class QStackedWidget;
|
2014-06-17 18:14:37 +02:00
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
2014-10-01 17:52:57 +02:00
|
|
|
namespace Core {
|
|
|
|
|
class MiniSplitter;
|
|
|
|
|
class SideBar;
|
|
|
|
|
}
|
|
|
|
|
|
2014-06-17 18:14:37 +02:00
|
|
|
namespace Help {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class HelpViewer;
|
|
|
|
|
|
|
|
|
|
class HelpWidget : public QWidget
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
public:
|
2014-06-18 17:42:01 +02:00
|
|
|
enum WidgetStyle {
|
2014-09-25 16:29:56 +02:00
|
|
|
ModeWidget,
|
2014-06-18 17:42:01 +02:00
|
|
|
SideBarWidget,
|
|
|
|
|
ExternalWindow
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
HelpWidget(const Core::Context &context, WidgetStyle style, QWidget *parent = 0);
|
|
|
|
|
~HelpWidget();
|
2014-06-17 18:14:37 +02:00
|
|
|
|
|
|
|
|
HelpViewer *currentViewer() const;
|
2014-09-25 16:29:56 +02:00
|
|
|
void setCurrentViewer(HelpViewer *viewer);
|
|
|
|
|
int currentIndex() const;
|
|
|
|
|
void addViewer(HelpViewer *viewer, bool highlightSearchTerms = false);
|
|
|
|
|
void removeViewerAt(int index);
|
|
|
|
|
|
|
|
|
|
void setViewerFont(const QFont &font);
|
|
|
|
|
|
|
|
|
|
// so central widget can save the state
|
|
|
|
|
int viewerCount() const;
|
|
|
|
|
HelpViewer *viewerAt(int index) const;
|
|
|
|
|
|
2014-10-01 17:52:57 +02:00
|
|
|
void open(const QUrl &url, bool newPage = false);
|
2014-10-10 15:32:46 +02:00
|
|
|
void openFromSearch(const QUrl &url, bool newPage = false);
|
2014-10-01 17:52:57 +02:00
|
|
|
void showTopicChooser(const QMap<QString, QUrl> &links, const QString &key,
|
|
|
|
|
bool newPage = false);
|
|
|
|
|
|
2014-09-25 16:29:56 +02:00
|
|
|
public slots:
|
|
|
|
|
void setSource(const QUrl &url);
|
|
|
|
|
void updateCloseButton();
|
2014-06-17 18:14:37 +02:00
|
|
|
|
2014-06-18 17:42:01 +02:00
|
|
|
protected:
|
|
|
|
|
void closeEvent(QCloseEvent *);
|
|
|
|
|
|
2014-06-17 18:14:37 +02:00
|
|
|
signals:
|
|
|
|
|
void openHelpMode(const QUrl &url);
|
2014-06-18 17:42:01 +02:00
|
|
|
void closeButtonClicked();
|
|
|
|
|
void aboutToClose();
|
2014-09-25 16:29:56 +02:00
|
|
|
void sourceChanged(const QUrl &url);
|
|
|
|
|
void filterActivated(const QString &name);
|
2014-06-17 18:14:37 +02:00
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
|
void updateBackMenu();
|
|
|
|
|
void updateForwardMenu();
|
2014-06-18 17:42:01 +02:00
|
|
|
void updateWindowTitle();
|
2014-06-23 12:30:54 +02:00
|
|
|
void helpModeButtonClicked();
|
2014-09-25 16:29:56 +02:00
|
|
|
|
|
|
|
|
private:
|
2014-09-24 12:29:23 +02:00
|
|
|
void goHome();
|
|
|
|
|
void addBookmark();
|
2014-09-25 16:29:56 +02:00
|
|
|
void copy();
|
|
|
|
|
void forward();
|
|
|
|
|
void backward();
|
|
|
|
|
void scaleUp();
|
|
|
|
|
void scaleDown();
|
|
|
|
|
void resetScale();
|
|
|
|
|
void print(HelpViewer *viewer);
|
|
|
|
|
void highlightSearchTerms();
|
2014-10-01 17:52:57 +02:00
|
|
|
void addSideBar();
|
2014-06-17 18:14:37 +02:00
|
|
|
|
2014-07-24 14:48:36 +02:00
|
|
|
Core::IContext *m_context;
|
2014-09-25 16:29:56 +02:00
|
|
|
WidgetStyle m_style;
|
2014-10-01 17:52:57 +02:00
|
|
|
QAction *m_toggleSideBarAction;
|
2014-07-01 10:33:20 +02:00
|
|
|
QAction *m_switchToHelp;
|
2014-09-24 12:29:23 +02:00
|
|
|
QAction *m_homeAction;
|
2014-06-17 18:14:37 +02:00
|
|
|
QMenu *m_backMenu;
|
|
|
|
|
QMenu *m_forwardMenu;
|
2014-09-23 19:16:17 +02:00
|
|
|
QAction *m_backAction;
|
|
|
|
|
QAction *m_forwardAction;
|
2014-09-24 12:29:23 +02:00
|
|
|
QAction *m_addBookmarkAction;
|
2014-09-25 16:29:56 +02:00
|
|
|
QComboBox *m_filterComboBox;
|
|
|
|
|
QAction *m_closeAction;
|
2014-06-18 17:42:01 +02:00
|
|
|
QAction *m_scaleUp;
|
|
|
|
|
QAction *m_scaleDown;
|
|
|
|
|
QAction *m_resetScale;
|
2014-09-25 16:29:56 +02:00
|
|
|
QAction *m_printAction;
|
2014-06-18 17:42:01 +02:00
|
|
|
QAction *m_copy;
|
2014-06-17 18:14:37 +02:00
|
|
|
|
2014-09-25 16:29:56 +02:00
|
|
|
QStackedWidget *m_viewerStack;
|
|
|
|
|
QPrinter *m_printer;
|
2014-10-01 17:52:57 +02:00
|
|
|
|
|
|
|
|
Core::MiniSplitter *m_sideBarSplitter;
|
|
|
|
|
Core::SideBar *m_sideBar;
|
2014-10-10 11:01:21 +02:00
|
|
|
QAction *m_contentsAction;
|
2014-10-01 17:52:57 +02:00
|
|
|
QAction *m_indexAction;
|
2014-10-09 16:42:12 +02:00
|
|
|
QAction *m_bookmarkAction;
|
2014-06-17 18:14:37 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // Internal
|
|
|
|
|
} // Help
|
|
|
|
|
|
|
|
|
|
#endif // HELPWIDGET_H
|