2014-05-14 13:15:01 +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-14 13:15:01 +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-14 13:15:01 +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-14 13:15:01 +02:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2014-05-14 13:15:01 +02:00
|
|
|
|
|
|
|
|
#include "helpviewer.h"
|
|
|
|
|
|
|
|
|
|
Q_FORWARD_DECLARE_OBJC_CLASS(DOMNode);
|
|
|
|
|
Q_FORWARD_DECLARE_OBJC_CLASS(DOMRange);
|
|
|
|
|
Q_FORWARD_DECLARE_OBJC_CLASS(NSString);
|
|
|
|
|
Q_FORWARD_DECLARE_OBJC_CLASS(WebView);
|
|
|
|
|
|
|
|
|
|
namespace Help {
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
|
|
class MacWebKitHelpViewer;
|
|
|
|
|
class MacWebKitHelpWidgetPrivate;
|
|
|
|
|
|
2022-07-13 16:05:03 +02:00
|
|
|
class MacWebKitHelpWidget : public QWidget
|
2014-05-14 13:15:01 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
MacWebKitHelpWidget(MacWebKitHelpViewer *parent);
|
2018-11-11 10:08:29 +01:00
|
|
|
~MacWebKitHelpWidget() override;
|
2014-05-14 13:15:01 +02:00
|
|
|
|
|
|
|
|
WebView *webView() const;
|
2014-12-17 16:28:30 +03:00
|
|
|
void startToolTipTimer(const QPoint &pos, const QString &text);
|
|
|
|
|
void hideToolTip();
|
2016-09-09 15:37:01 +02:00
|
|
|
MacWebKitHelpViewer *viewer() const;
|
2014-05-14 13:15:01 +02:00
|
|
|
|
|
|
|
|
protected:
|
2018-11-11 10:08:29 +01:00
|
|
|
void hideEvent(QHideEvent *) override;
|
|
|
|
|
void showEvent(QShowEvent *) override;
|
2014-05-14 13:15:01 +02:00
|
|
|
|
|
|
|
|
private:
|
2014-12-17 16:28:30 +03:00
|
|
|
void showToolTip();
|
2014-05-14 13:15:01 +02:00
|
|
|
MacWebKitHelpWidgetPrivate *d;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class MacWebKitHelpViewer : public HelpViewer
|
|
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2018-04-19 10:47:13 +02:00
|
|
|
explicit MacWebKitHelpViewer(QWidget *parent = nullptr);
|
2018-11-11 10:08:29 +01:00
|
|
|
~MacWebKitHelpViewer() override;
|
2014-05-14 13:15:01 +02:00
|
|
|
|
2018-11-11 10:08:29 +01:00
|
|
|
void setViewerFont(const QFont &font) override;
|
2014-05-14 13:15:01 +02:00
|
|
|
|
2018-11-11 10:08:29 +01:00
|
|
|
void setScale(qreal scale) override;
|
2014-05-14 13:15:01 +02:00
|
|
|
|
2018-11-11 10:08:29 +01:00
|
|
|
QString title() const override;
|
2014-05-14 13:15:01 +02:00
|
|
|
|
2018-11-11 10:08:29 +01:00
|
|
|
QUrl source() const override;
|
|
|
|
|
void setSource(const QUrl &url) override;
|
2014-05-14 13:15:01 +02:00
|
|
|
void scrollToAnchor(const QString &anchor);
|
|
|
|
|
|
2018-11-11 10:08:29 +01:00
|
|
|
void setHtml(const QString &html) override;
|
2014-05-14 13:15:01 +02:00
|
|
|
|
2018-11-11 10:08:29 +01:00
|
|
|
QString selectedText() const override;
|
|
|
|
|
bool isForwardAvailable() const override;
|
|
|
|
|
bool isBackwardAvailable() const override;
|
|
|
|
|
void addBackHistoryItems(QMenu *backMenu) override;
|
|
|
|
|
void addForwardHistoryItems(QMenu *forwardMenu) override;
|
2016-09-09 15:37:01 +02:00
|
|
|
void setActionVisible(bool visible);
|
2014-05-14 13:15:01 +02:00
|
|
|
|
|
|
|
|
bool findText(const QString &text, Core::FindFlags flags,
|
2018-11-11 10:08:29 +01:00
|
|
|
bool incremental, bool fromSearch, bool *wrapped = nullptr) override;
|
2014-05-14 13:15:01 +02:00
|
|
|
|
|
|
|
|
MacWebKitHelpWidget *widget() const { return m_widget; }
|
|
|
|
|
|
2016-06-28 23:07:19 +03:00
|
|
|
public:
|
2018-11-11 10:08:29 +01:00
|
|
|
void copy() override;
|
|
|
|
|
void stop() override;
|
|
|
|
|
void forward() override;
|
|
|
|
|
void backward() override;
|
|
|
|
|
void print(QPrinter *printer) override;
|
2014-05-14 13:15:01 +02:00
|
|
|
|
|
|
|
|
void slotLoadStarted();
|
|
|
|
|
void slotLoadFinished();
|
|
|
|
|
|
2016-06-28 23:07:19 +03:00
|
|
|
private:
|
2014-05-14 13:15:01 +02:00
|
|
|
void goToHistoryItem();
|
|
|
|
|
|
|
|
|
|
DOMRange *findText(NSString *text, bool forward, bool caseSensitive, DOMNode *startNode,
|
|
|
|
|
int startOffset);
|
|
|
|
|
MacWebKitHelpWidget *m_widget;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
|
} // namespace Help
|