Browse Source

Better approach to enabling and disabling the Web Applet

pull/2729/head
MaranBr 5 months ago
committed by crueter
parent
commit
b669f92df5
  1. 1
      src/common/settings.h
  2. 11
      src/core/hle/service/am/frontend/applet_web_browser.cpp
  3. 2
      src/qt_common/uisettings.h
  4. 4
      src/yuzu/configuration/configure_debug.cpp
  5. 4
      src/yuzu/main.cpp

1
src/common/settings.h

@ -735,6 +735,7 @@ struct Values {
Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers", Setting<bool> enable_all_controllers{linkage, false, "enable_all_controllers",
Category::Debugging}; Category::Debugging};
Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging}; Setting<bool> perform_vulkan_check{linkage, true, "perform_vulkan_check", Category::Debugging};
Setting<bool> disable_web_applet{linkage, true, "disable_web_applet", Category::Debugging};
// Miscellaneous // Miscellaneous
Setting<std::string> log_filter{linkage, "*:Info", "log_filter", Category::Miscellaneous}; Setting<std::string> log_filter{linkage, "*:Info", "log_filter", Category::Miscellaneous};

11
src/core/hle/service/am/frontend/applet_web_browser.cpp

@ -6,6 +6,7 @@
#include "common/fs/fs.h" #include "common/fs/fs.h"
#include "common/fs/path_util.h" #include "common/fs/path_util.h"
#include "common/logging/log.h" #include "common/logging/log.h"
#include "common/settings.h"
#include "common/string_util.h" #include "common/string_util.h"
#include "core/core.h" #include "core/core.h"
#include "core/file_sys/content_archive.h" #include "core/file_sys/content_archive.h"
@ -232,6 +233,11 @@ WebBrowser::WebBrowser(Core::System& system_, std::shared_ptr<Applet> applet_,
WebBrowser::~WebBrowser() = default; WebBrowser::~WebBrowser() = default;
void WebBrowser::Initialize() { void WebBrowser::Initialize() {
if (Settings::values.disable_web_applet) {
LOG_INFO(Service_AM, "Web Browser Applet disabled, skipping.");
return;
}
FrontendApplet::Initialize(); FrontendApplet::Initialize();
LOG_INFO(Service_AM, "Initializing Web Browser Applet."); LOG_INFO(Service_AM, "Initializing Web Browser Applet.");
@ -295,6 +301,11 @@ void WebBrowser::ExecuteInteractive() {
} }
void WebBrowser::Execute() { void WebBrowser::Execute() {
if (Settings::values.disable_web_applet) {
WebBrowserExit(WebExitReason::EndButtonPressed);
return;
}
switch (web_arg_header.shim_kind) { switch (web_arg_header.shim_kind) {
case ShimKind::Shop: case ShimKind::Shop:
ExecuteShop(); ExecuteShop();

2
src/qt_common/uisettings.h

@ -139,7 +139,7 @@ struct Values {
Settings::Specialization::Default, Settings::Specialization::Default,
true, true,
true}; true};
Setting<bool> disable_web_applet{linkage, true, "disable_web_applet", Category::Ui};
Setting<bool> check_for_updates{linkage, true, "check_for_updates", Category::UiGeneral}; Setting<bool> check_for_updates{linkage, true, "check_for_updates", Category::UiGeneral};
// Discord RPC // Discord RPC

4
src/yuzu/configuration/configure_debug.cpp

@ -81,7 +81,7 @@ void ConfigureDebug::SetConfiguration() {
ui->perform_vulkan_check->setChecked(Settings::values.perform_vulkan_check.GetValue()); ui->perform_vulkan_check->setChecked(Settings::values.perform_vulkan_check.GetValue());
#ifdef YUZU_USE_QT_WEB_ENGINE #ifdef YUZU_USE_QT_WEB_ENGINE
ui->disable_web_applet->setChecked(UISettings::values.disable_web_applet.GetValue());
ui->disable_web_applet->setChecked(Settings::values.disable_web_applet.GetValue());
#else #else
ui->disable_web_applet->setVisible(false); ui->disable_web_applet->setVisible(false);
#endif #endif
@ -116,7 +116,7 @@ void ConfigureDebug::ApplyConfiguration() {
Settings::values.disable_macro_hle = ui->disable_macro_hle->isChecked(); Settings::values.disable_macro_hle = ui->disable_macro_hle->isChecked();
Settings::values.extended_logging = ui->extended_logging->isChecked(); Settings::values.extended_logging = ui->extended_logging->isChecked();
Settings::values.perform_vulkan_check = ui->perform_vulkan_check->isChecked(); Settings::values.perform_vulkan_check = ui->perform_vulkan_check->isChecked();
UISettings::values.disable_web_applet = ui->disable_web_applet->isChecked();
Settings::values.disable_web_applet = ui->disable_web_applet->isChecked();
Debugger::ToggleConsole(); Debugger::ToggleConsole();
Common::Log::Filter filter; Common::Log::Filter filter;
filter.ParseFilterString(Settings::values.log_filter.GetValue()); filter.ParseFilterString(Settings::values.log_filter.GetValue());

4
src/yuzu/main.cpp

@ -934,7 +934,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
#ifdef YUZU_USE_QT_WEB_ENGINE #ifdef YUZU_USE_QT_WEB_ENGINE
// Raw input breaks with the web applet, Disable web applets if enabled // Raw input breaks with the web applet, Disable web applets if enabled
if (UISettings::values.disable_web_applet || Settings::values.enable_raw_input) {
if (Settings::values.disable_web_applet || Settings::values.enable_raw_input) {
emit WebBrowserClosed(Service::AM::Frontend::WebExitReason::WindowClosed, emit WebBrowserClosed(Service::AM::Frontend::WebExitReason::WindowClosed,
"http://localhost/"); "http://localhost/");
return; return;
@ -1007,7 +1007,7 @@ void GMainWindow::WebBrowserOpenWebPage(const std::string& main_url,
"applet?\n(This can be re-enabled in the Debug settings.)"), "applet?\n(This can be re-enabled in the Debug settings.)"),
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
if (result == QMessageBox::Yes) { if (result == QMessageBox::Yes) {
UISettings::values.disable_web_applet = true;
Settings::values.disable_web_applet = true;
web_applet->SetFinished(true); web_applet->SetFinished(true);
} }
}); });

Loading…
Cancel
Save