From e00e1fc755501018c4106e8453045037d5b9e3ee Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Mon, 24 Dec 2018 16:22:49 -0500 Subject: qt: Implement Qt frontend to web browser Using a custom reimplementation of QWebEngineView and an injector script. --- src/yuzu/applets/web_browser.h | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 src/yuzu/applets/web_browser.h (limited to 'src/yuzu/applets/web_browser.h') diff --git a/src/yuzu/applets/web_browser.h b/src/yuzu/applets/web_browser.h new file mode 100644 index 000000000..74f6698be --- /dev/null +++ b/src/yuzu/applets/web_browser.h @@ -0,0 +1,45 @@ +// Copyright 2018 yuzu Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include +#include +#include "core/frontend/applets/web_browser.h" + +class GMainWindow; + +QString GetNXShimInjectionScript(); + +class NXInputWebEngineView : public QWebEngineView { +public: + NXInputWebEngineView(QWidget* parent = nullptr); + +protected: + void keyPressEvent(QKeyEvent* event) override; + void keyReleaseEvent(QKeyEvent* event) override; +}; + +class QtWebBrowser final : public QObject, public Core::Frontend::WebBrowserApplet { + Q_OBJECT + +public: + explicit QtWebBrowser(GMainWindow& main_window); + ~QtWebBrowser() override; + + void OpenPage(std::string_view url, std::function unpack_romfs_callback, + std::function finished_callback) const override; + +signals: + void MainWindowOpenPage(std::string_view filename, std::string_view additional_args) const; + +public slots: + void MainWindowUnpackRomFS(); + void MainWindowFinishedBrowsing(); + +private: + mutable std::function unpack_romfs_callback; + mutable std::function finished_callback; +}; -- cgit v1.2.3 From cb930c4b5a3f8f3931ba93ef35d4000558ffa79e Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Fri, 28 Dec 2018 18:20:29 -0500 Subject: web_browser: Add bounds checking to applet interface --- src/yuzu/applets/web_browser.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/yuzu/applets/web_browser.h') diff --git a/src/yuzu/applets/web_browser.h b/src/yuzu/applets/web_browser.h index 74f6698be..bba273767 100644 --- a/src/yuzu/applets/web_browser.h +++ b/src/yuzu/applets/web_browser.h @@ -6,22 +6,30 @@ #include #include + +#ifdef YUZU_USE_QT_WEB_ENGINE #include +#endif + #include "core/frontend/applets/web_browser.h" class GMainWindow; +#ifdef YUZU_USE_QT_WEB_ENGINE + QString GetNXShimInjectionScript(); class NXInputWebEngineView : public QWebEngineView { public: - NXInputWebEngineView(QWidget* parent = nullptr); + explicit NXInputWebEngineView(QWidget* parent = nullptr); protected: void keyPressEvent(QKeyEvent* event) override; void keyReleaseEvent(QKeyEvent* event) override; }; +#endif + class QtWebBrowser final : public QObject, public Core::Frontend::WebBrowserApplet { Q_OBJECT -- cgit v1.2.3