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;
45 void sendKeyPress(
int key, Qt::KeyboardModifiers modifiers,
const QString &text = QString());
51 static bool isMusicFile(
const QString &extension,
const QString &mimetype);
52 static bool isVideoFile(
const QString &extension,
const QString &mimetype);
83 void LoadPage(
const QUrl& url);
84 void SetHtml(
const QString &html,
const QUrl &baseUrl = QUrl());
86 void LoadUserStyleSheet(
const QUrl& url,
const QString &name = QString(
"mythtv"));
87 void RemoveUserStyleSheet(
const QString &name);
89 void SetHttpUserAgent(
const QString &userAgent);
91 QWebEngineSettings *GetWebEngineSettings(
void);
92 QWebEngineProfile *GetWebEngineProfile(
void);
94 void Pulse(
void)
override;
98 QString GetTitle(
void);
100 void SetActive(
bool active);
108 float GetZoom(
void)
const;
110 bool CanGoForward(
void);
111 bool CanGoBack(
void);
113 void RunJavaScript(
const QString& scriptSource);
115 void SendStatusBarMessage(
const QString &text);
117 void SetDefaultSaveDirectory(
const QString &saveDir);
120 void SetDefaultSaveFilename(
const QString &
filename);
123 void HandleMouseAction(
const QString &
action);
125 void UpdateBuffer(
void);
134 void Reload(
bool useCache =
true);
135 void TriggerPageAction(QWebEnginePage::WebAction
action,
bool checked =
false);
149 void slotLoadFinished(
bool Ok);
150 void slotLoadProgress(
int progress);
151 void slotTitleChanged(
const QString &title);
152 void slotStatusBarMessage(
const QString &text);
153 void slotIconChanged(
const QIcon &icon);
154 void slotIconUrlChanged(
const QUrl &url);
155 void slotScrollPositionChanged(QPointF position);
156 void slotContentsSizeChanged(QSizeF size);
157 void slotLinkClicked(
const QUrl &url);
159 void slotScrollBarShowing(
void);
160 void slotScrollBarHiding(
void);
161 void slotLosingFocus();
162 void slotTakingFocus();
163 void slotRenderProcessTerminated(QWebEnginePage::RenderProcessTerminationStatus terminationStatus,
int exitCode);
164 static void slotFullScreenRequested(QWebEngineFullScreenRequest fullScreenRequest);
165 void slotWindowCloseRequested(
void);
168 void SetBackgroundColor(QColor color);
169 void ResetScrollBars(
void);
170 void UpdateScrollBars(
void);
171 bool IsOnTopScreen(
void);
181 QWebEngineView *m_webEngine {
nullptr };
187 bool m_active {
false };
188 bool m_wasActive {
false };
189 bool m_initialized {
false };
191 int m_updateInterval { 0 };
193 qreal m_zoom { 1.0 };
200 bool m_inputToggled {
false };
202 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