2014-05-02 16:54:28 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2014-05-02 16:54:28 +02:00
|
|
|
**
|
|
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
2014-05-02 16:54:28 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
2014-05-02 16:54:28 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2014-05-02 16:54:28 +02:00
|
|
|
|
|
|
|
|
#include "centralwidget.h"
|
|
|
|
|
#include "helpviewer.h"
|
|
|
|
|
#include "openpagesmanager.h"
|
|
|
|
|
|
|
|
|
|
#include <QTextBrowser>
|
|
|
|
|
|
|
|
|
|
namespace Help {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class TextBrowserHelpWidget;
|
|
|
|
|
|
|
|
|
|
class TextBrowserHelpViewer : public HelpViewer
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2018-04-19 10:47:13 +02:00
|
|
|
explicit TextBrowserHelpViewer(QWidget *parent = nullptr);
|
2018-05-07 15:08:20 +02:00
|
|
|
~TextBrowserHelpViewer() override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
2018-05-07 15:08:20 +02:00
|
|
|
QFont viewerFont() const override;
|
|
|
|
|
void setViewerFont(const QFont &font) override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
2018-05-07 15:08:20 +02:00
|
|
|
qreal scale() const override;
|
|
|
|
|
void setScale(qreal scale) override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
2018-05-07 15:08:20 +02:00
|
|
|
QString title() const override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
2018-05-07 15:08:20 +02:00
|
|
|
QUrl source() const override;
|
|
|
|
|
void setSource(const QUrl &url) override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
2018-05-07 15:08:20 +02:00
|
|
|
void setHtml(const QString &html) override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
2018-05-07 15:08:20 +02:00
|
|
|
QString selectedText() const override;
|
|
|
|
|
bool isForwardAvailable() const override;
|
|
|
|
|
bool isBackwardAvailable() const override;
|
|
|
|
|
void addBackHistoryItems(QMenu *backMenu) override;
|
|
|
|
|
void addForwardHistoryItems(QMenu *forwardMenu) override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
|
|
|
|
bool findText(const QString &text, Core::FindFlags flags,
|
2018-05-07 15:08:20 +02:00
|
|
|
bool incremental, bool fromSearch, bool *wrapped = nullptr) override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
2018-05-07 15:08:20 +02:00
|
|
|
void scaleUp() override;
|
|
|
|
|
void scaleDown() override;
|
|
|
|
|
void resetScale() override;
|
|
|
|
|
void copy() override;
|
|
|
|
|
void stop() override;
|
|
|
|
|
void forward() override;
|
|
|
|
|
void backward() override;
|
|
|
|
|
void print(QPrinter *printer) override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
2016-06-28 23:07:19 +03:00
|
|
|
private:
|
2014-05-06 13:37:06 +02:00
|
|
|
void goToHistoryItem();
|
|
|
|
|
|
2014-05-02 16:54:28 +02:00
|
|
|
TextBrowserHelpWidget *m_textBrowser;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class TextBrowserHelpWidget : public QTextBrowser
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2014-12-18 11:36:49 +01:00
|
|
|
TextBrowserHelpWidget(TextBrowserHelpViewer *parent);
|
2014-05-02 16:54:28 +02:00
|
|
|
|
2018-05-07 15:08:20 +02:00
|
|
|
QVariant loadResource(int type, const QUrl &name) override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
|
|
|
|
void scaleUp();
|
|
|
|
|
void scaleDown();
|
|
|
|
|
|
2018-05-07 15:08:20 +02:00
|
|
|
void setSource(const QUrl &name) override;
|
2016-04-12 15:26:53 +02:00
|
|
|
|
2014-05-02 16:54:28 +02:00
|
|
|
protected:
|
2018-05-07 15:08:20 +02:00
|
|
|
void contextMenuEvent(QContextMenuEvent *event) override;
|
|
|
|
|
bool eventFilter(QObject *obj, QEvent *event) override;
|
|
|
|
|
void mousePressEvent(QMouseEvent *e) override;
|
|
|
|
|
void mouseReleaseEvent(QMouseEvent *e) override;
|
2014-05-02 16:54:28 +02:00
|
|
|
|
2014-10-23 12:56:18 +02:00
|
|
|
private:
|
|
|
|
|
QString linkAt(const QPoint& pos);
|
|
|
|
|
|
2014-05-02 16:54:28 +02:00
|
|
|
int zoomCount;
|
|
|
|
|
bool forceFont;
|
|
|
|
|
TextBrowserHelpViewer *m_parent;
|
2016-03-22 15:16:37 +03:00
|
|
|
friend class Help::Internal::TextBrowserHelpViewer;
|
2014-05-02 16:54:28 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Help
|