1#ifndef MYTHUI_WEBBROWSER_H_
2#define MYTHUI_WEBBROWSER_H_
8#include <QElapsedTimer>
11#include <QWebEngineView>
12#include <QWebEnginePage>
13#include <QWebEngineProfile>
14#include <QNetworkRequest>
15#include <QNetworkReply>
16#include <QWebEngineFullScreenRequest>
37 bool eventFilter(QObject *obj, QEvent *event)
override;
46 void sendKeyPress(
int key, Qt::KeyboardModifiers modifiers,
const QString &text = QString());
52 static bool isMusicFile(
const QString &extension,
const QString &mimetype);
53 static bool isVideoFile(
const QString &extension,
const QString &mimetype);
84 void LoadPage(
const QUrl& url);
85 void SetHtml(
const QString &html,
const QUrl &baseUrl = QUrl());
87 void LoadUserStyleSheet(
const QUrl& url,
const QString &name = QString(
"mythtv"));
88 void RemoveUserStyleSheet(
const QString &name);
90 void SetHttpUserAgent(
const QString &userAgent);
92 QWebEngineSettings *GetWebEngineSettings(
void);
93 QWebEngineProfile *GetWebEngineProfile(
void);
95 void Pulse(
void)
override;
99 QString GetTitle(
void);
101 void SetActive(
bool active);
109 float GetZoom(
void)
const;
111 bool CanGoForward(
void);
112 bool CanGoBack(
void);
114 void RunJavaScript(
const QString& scriptSource);
116 void SendStatusBarMessage(
const QString &text);
118 void SetDefaultSaveDirectory(
const QString &saveDir);
121 void SetDefaultSaveFilename(
const QString &
filename);
124 void HandleMouseAction(
const QString &
action);
126 void UpdateBuffer(
void);
135 void Reload(
bool useCache =
true);
136 void TriggerPageAction(QWebEnginePage::WebAction
action,
bool checked =
false);
150 void slotLoadFinished(
bool Ok);
151 void slotLoadProgress(
int progress);
152 void slotTitleChanged(
const QString &title);
153 void slotStatusBarMessage(
const QString &text);
154 void slotIconChanged(
const QIcon &icon);
155 void slotIconUrlChanged(
const QUrl &url);
156 void slotScrollPositionChanged(QPointF position);
157 void slotContentsSizeChanged(QSizeF size);
158 void slotLinkClicked(
const QUrl &url);
160 void slotScrollBarShowing(
void);
161 void slotScrollBarHiding(
void);
162 void slotLosingFocus();
163 void slotTakingFocus();
164 void slotRenderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus,
int exitCode);
165 static void slotFullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
166 void slotWindowCloseRequested(
void);
169 void SetBackgroundColor(QColor color);
170 void ResetScrollBars(
void);
171 void UpdateScrollBars(
void);
172 bool IsOnTopScreen(
void);
182 QWebEngineView *m_webEngine {
nullptr };
188 bool m_active {
false };
189 bool m_wasActive {
false };
190 bool m_initialized {
false };
192 int m_updateInterval { 0 };
194 qreal m_zoom { 1.0 };
201 bool m_inputToggled {
false };
203 int m_mouseKeyCount { 0 };
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Screen in which all other widgets are contained and rendered.
The base class on which all widgets and screens are based.
virtual void DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect)
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
virtual void Pulse(void)
Pulse is called 70 times a second to trigger a single frame of an animation.
virtual void CreateCopy(MythUIType *parent)
Copy the state of this widget to the one given, it must be of the same type.
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
MythRect m_actualBrowserArea
void iconUrlChanged(const QUrl &url)
a pages fav icon has changed
void iconChanged(const QIcon &icon)
link hit test messages
MythScreenType * GetParentScreen(void)
bool IsInputToggled(void) const
returns true if all keypresses are to be passed to the web page
void titleChanged(const QString &title)
% of page loaded
void fileDownloaded(QString filename)
a pages fav icon has changed
QString GetDefaultSaveFilename(void)
QElapsedTimer m_lastUpdateTime
void SetInputToggled(bool inputToggled)
void statusBarMessage(const QString &text)
a pages title has changed
void loadProgress(int progress)
a page has finished loading
QString m_defaultSaveFilename
QString GetDefaultSaveDirectory(void)
void slotLoadStarted(void)
a file has been downloaded
QString m_lastMouseAction
QElapsedTimer m_lastMouseActionTime
bool IsActive(void) const
void loadFinished(bool ok)
a page is starting to load
Subclass of QWebEngineView.
void sendKeyPress(int key, Qt::KeyboardModifiers modifiers, const QString &text=QString())
QString getReplyMimetype(void)
MythWebEngineView(QWidget *parent, MythUIWebBrowser *parentBrowser)
QWebEngineView * createWindow(QWebEnginePage::WebWindowType type) override
QWebEngineProfile * m_profile
QNetworkRequest m_downloadRequest
MythUIWebBrowser * m_parentBrowser
static bool isMusicFile(const QString &extension, const QString &mimetype)
QWebEnginePage * m_webpage
static bool isVideoFile(const QString &extension, const QString &mimetype)
void showDownloadMenu(void)
void openBusyPopup(const QString &message)
~MythWebEngineView(void) override
void closeBusyPopup(void)
void customEvent(QEvent *e) override
bool eventFilter(QObject *obj, QEvent *event) override
static QString getExtensionForMimetype(const QString &mimetype)
bool handleKeyPress(QKeyEvent *event)
QNetworkReply * m_downloadReply
MythUIBusyDialog * m_busyPopup