Go to the documentation of this file. 1 #ifndef MYTHUI_WEBBROWSER_H_
2 #define MYTHUI_WEBBROWSER_H_
10 #include <QElapsedTimer>
16 #include <QNetworkReply>
33 static void Play(
void);
34 static void Stop(
void);
35 static void Pause(
void);
42 static void PlayURL(
const QString& url);
65 QNetworkReply*
createRequest(Operation op,
const QNetworkRequest & req,
66 QIODevice * outgoingData =
nullptr)
override;
78 ExtensionReturn *
output =
nullptr)
override;
111 static bool isMusicFile(
const QString &extension,
const QString &mimetype);
112 static bool isVideoFile(
const QString &extension,
const QString &mimetype);
142 void LoadPage(
const QUrl& url);
143 void SetHtml(
const QString &html,
const QUrl &baseUrl = QUrl());
145 void LoadUserStyleSheet(
const QUrl& url);
148 void Pulse(
void)
override;
149 void Scroll(
int dx,
int dy);
153 QString GetTitle(
void);
155 void SetActive(
bool active);
163 float GetZoom(
void)
const;
165 bool CanGoForward(
void);
166 bool CanGoBack(
void);
168 QVariant evaluateJavaScript(
const QString& scriptSource);
170 void SetDefaultSaveDirectory(
const QString &saveDir);
173 void SetDefaultSaveFilename(
const QString &
filename);
183 void loadStarted(
void);
184 void loadFinished(
bool ok);
186 void titleChanged(
const QString &title);
187 void statusBarMessage(
const QString &text);
188 void iconChanged(
void);
189 void fileDownloaded(QString
filename);
192 void slotLoadStarted(
void);
193 void slotLoadFinished(
bool Ok);
194 void slotLoadProgress(
int progress);
195 void slotTitleChanged(
const QString &title);
196 void slotStatusBarMessage(
const QString &text);
197 void slotIconChanged(
void);
198 void slotLinkClicked(
const QUrl &url);
200 void slotScrollBarShowing(
void);
201 void slotScrollBarHiding(
void);
205 void UpdateBuffer(
void);
206 void HandleMouseAction(
const QString &
action);
207 void SetBackgroundColor(QColor color);
208 void ResetScrollBars(
void);
209 void UpdateScrollBars(
void);
210 bool IsOnTopScreen(
void);
213 int alphaMod, QRect clipRect)
override;
216 bool showWarnings)
override;
228 bool m_active {
false };
229 bool m_wasActive {
false };
230 bool m_initialized {
false };
232 int m_updateInterval { 0 };
234 float m_zoom { 1.0 };
241 bool m_inputToggled {
false };
243 int m_mouseKeyCount { 0 };
virtual bool keyPressEvent(QKeyEvent *event)
Key event handler.
bool extension(Extension extension, const ExtensionOption *option=nullptr, ExtensionReturn *output=nullptr) override
QString getReplyMimetype(void)
QString GetDefaultSaveDirectory(void)
QString userAgentForUrl(const QUrl &url) const override
void closeBusyPopup(void)
bool IsInputToggled(void) const
returns true if all keypresses are to be passed to the web page
MythNetworkAccessManager()=default
void handleUnsupportedContent(QNetworkReply *reply)
MythUIWebBrowser * m_parentBrowser
void openBusyPopup(const QString &message)
void SetInputToggled(bool inputToggled)
void showDownloadMenu(void)
Screen in which all other widgets are contained and rendered.
void doDownload(const QString &saveFilename)
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
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 void DrawSelf(MythPainter *p, int xoffset, int yoffset, int alphaMod, QRect clipRect)
static void SetVolume(int volumn)
void setWebView(QWebView *view)
Adds a JavaScript object.
QElapsedTimer m_lastUpdateTime
QWebView * createWindow(QWebPage::WebWindowType type) override
bool IsActive(void) const
static bool isMusicFile(const QString &extension, const QString &mimetype)
static bool isVideoFile(const QString &extension, const QString &mimetype)
QPoint m_destinationScrollPos
static QString getExtensionForMimetype(const QString &mimetype)
static void PlayTrack(int trackID)
BrowserApi(QObject *parent)
virtual void CopyFrom(MythUIType *base)
Copy this widgets state from another.
QString GetMetadata(void)
MythWebPage(QObject *parent=nullptr)
bool supportsExtension(Extension extension) const override
QNetworkReply * m_downloadReply
~BrowserApi(void) override
QString m_defaultSaveFilename
The base class on which all widgets and screens are based.
QString GetDefaultSaveFilename(void)
MythRect m_actualBrowserArea
void doDownloadRequested(const QNetworkRequest &request)
void customEvent(QEvent *e) override
static void PlayURL(const QString &url)
QNetworkReply * createRequest(Operation op, const QNetworkRequest &req, QIODevice *outgoingData=nullptr) override
MythUIAnimation m_scrollAnimation
~MythWebView(void) override
MythUIBusyDialog * m_busyPopup
void customEvent(QEvent *e) override
QElapsedTimer m_lastMouseActionTime
MythWebView(QWidget *parent, MythUIWebBrowser *parentBrowser)
void keyPressEvent(QKeyEvent *event) override
virtual bool ParseElement(const QString &filename, QDomElement &element, bool showWarnings)
Parse the xml definition of this widget setting the state of the object accordingly.
void handleDownloadRequested(const QNetworkRequest &request)
QNetworkRequest m_downloadRequest
virtual void Finalize(void)
Perform any post-xml parsing initialisation tasks.
QString m_lastMouseAction
static void PlayFile(const QString &filename)