mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-18 20:07:49 +00:00
qt: Implement Qt frontend to web browser
Using a custom reimplementation of QWebEngineView and an injector script.
This commit is contained in:
parent
0cbabc5ee6
commit
58180e39ff
2 changed files with 154 additions and 0 deletions
45
src/yuzu/applets/web_browser.h
Normal file
45
src/yuzu/applets/web_browser.h
Normal file
|
@ -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;
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue