2018-12-24 13:22:49 -08:00
|
|
|
// 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>
|
2018-12-28 15:20:29 -08:00
|
|
|
|
|
|
|
#ifdef YUZU_USE_QT_WEB_ENGINE
|
2018-12-24 13:22:49 -08:00
|
|
|
#include <QWebEngineView>
|
2018-12-28 15:20:29 -08:00
|
|
|
#endif
|
|
|
|
|
2018-12-24 13:22:49 -08:00
|
|
|
#include "core/frontend/applets/web_browser.h"
|
|
|
|
|
|
|
|
class GMainWindow;
|
|
|
|
|
2018-12-28 15:20:29 -08:00
|
|
|
#ifdef YUZU_USE_QT_WEB_ENGINE
|
|
|
|
|
2018-12-24 13:22:49 -08:00
|
|
|
QString GetNXShimInjectionScript();
|
|
|
|
|
|
|
|
class NXInputWebEngineView : public QWebEngineView {
|
|
|
|
public:
|
2018-12-28 15:20:29 -08:00
|
|
|
explicit NXInputWebEngineView(QWidget* parent = nullptr);
|
2018-12-24 13:22:49 -08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void keyPressEvent(QKeyEvent* event) override;
|
|
|
|
void keyReleaseEvent(QKeyEvent* event) override;
|
|
|
|
};
|
|
|
|
|
2018-12-28 15:20:29 -08:00
|
|
|
#endif
|
|
|
|
|
2018-12-24 13:22:49 -08:00
|
|
|
class QtWebBrowser final : public QObject, public Core::Frontend::WebBrowserApplet {
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit QtWebBrowser(GMainWindow& main_window);
|
|
|
|
~QtWebBrowser() override;
|
|
|
|
|
2020-12-05 05:37:13 -08:00
|
|
|
void OpenPageLocal(std::string_view url, std::function<void()> unpack_romfs_callback_,
|
|
|
|
std::function<void()> finished_callback_) override;
|
2018-12-24 13:22:49 -08:00
|
|
|
|
|
|
|
signals:
|
|
|
|
void MainWindowOpenPage(std::string_view filename, std::string_view additional_args) const;
|
|
|
|
|
2019-01-17 08:08:02 -08:00
|
|
|
private:
|
2018-12-24 13:22:49 -08:00
|
|
|
void MainWindowUnpackRomFS();
|
|
|
|
void MainWindowFinishedBrowsing();
|
|
|
|
|
2019-01-17 08:19:44 -08:00
|
|
|
std::function<void()> unpack_romfs_callback;
|
|
|
|
std::function<void()> finished_callback;
|
2018-12-24 13:22:49 -08:00
|
|
|
};
|