diff options
| author | Zach Hilman <zachhilman@gmail.com> | 2018-12-24 16:22:49 -0500 |
|---|---|---|
| committer | Zach Hilman <zachhilman@gmail.com> | 2018-12-28 15:32:39 -0500 |
| commit | e00e1fc755501018c4106e8453045037d5b9e3ee (patch) | |
| tree | e2d19db87e63e2e873a492f5b35f0b6db15933e6 /src/yuzu/applets/web_browser.h | |
| parent | 32bfa92c7137d20f2c105595831b3c8cefe40326 (diff) | |
qt: Implement Qt frontend to web browser
Using a custom reimplementation of QWebEngineView and an injector script.
Diffstat (limited to 'src/yuzu/applets/web_browser.h')
| -rw-r--r-- | src/yuzu/applets/web_browser.h | 45 |
1 files changed, 45 insertions, 0 deletions
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 <functional> +#include <QObject> +#include <QWebEngineView> +#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<void()> unpack_romfs_callback, + std::function<void()> 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<void()> unpack_romfs_callback; + mutable std::function<void()> finished_callback; +}; |
