Merge yuzu-emu#12756

This commit is contained in:
yuzubot
2024-02-05 01:00:43 +00:00
parent 9b9634454a
commit 78ce7f00f9
75 changed files with 1140 additions and 248 deletions

View File

@ -41,6 +41,9 @@ add_executable(yuzu
configuration/configuration_shared.cpp
configuration/configuration_shared.h
configuration/configure.ui
configuration/configure_applets.cpp
configuration/configure_applets.h
configuration/configure_applets.ui
configuration/configure_audio.cpp
configuration/configure_audio.h
configuration/configure_audio.ui

View File

@ -0,0 +1,86 @@
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/settings.h"
#include "core/core.h"
#include "ui_configure_applets.h"
#include "yuzu/configuration/configuration_shared.h"
#include "yuzu/configuration/configure_applets.h"
#include "yuzu/configuration/shared_widget.h"
ConfigureApplets::ConfigureApplets(Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_,
const ConfigurationShared::Builder& builder, QWidget* parent)
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureApplets>()}, system{system_} {
ui->setupUi(this);
Setup(builder);
SetConfiguration();
}
ConfigureApplets::~ConfigureApplets() = default;
void ConfigureApplets::changeEvent(QEvent* event) {
if (event->type() == QEvent::LanguageChange) {
RetranslateUI();
}
QWidget::changeEvent(event);
}
void ConfigureApplets::RetranslateUI() {
ui->retranslateUi(this);
}
void ConfigureApplets::Setup(const ConfigurationShared::Builder& builder) {
auto& library_applets_layout = *ui->group_library_applet_modes->layout();
std::map<u32, QWidget*> applets_hold{};
std::vector<Settings::BasicSetting*> settings;
auto push = [&settings](auto& list) {
for (auto setting : list) {
settings.push_back(setting);
}
};
push(Settings::values.linkage.by_category[Settings::Category::LibraryApplet]);
for (auto setting : settings) {
ConfigurationShared::Widget* widget = builder.BuildWidget(setting, apply_funcs);
if (widget == nullptr) {
continue;
}
if (!widget->Valid()) {
widget->deleteLater();
continue;
}
// Untested applets
if (setting->Id() == Settings::values.data_erase_applet_mode.Id() ||
setting->Id() == Settings::values.error_applet_mode.Id() ||
setting->Id() == Settings::values.net_connect_applet_mode.Id() ||
setting->Id() == Settings::values.web_applet_mode.Id() ||
setting->Id() == Settings::values.shop_applet_mode.Id() ||
setting->Id() == Settings::values.login_share_applet_mode.Id() ||
setting->Id() == Settings::values.wifi_web_auth_applet_mode.Id() ||
setting->Id() == Settings::values.my_page_applet_mode.Id()) {
widget->setHidden(true);
}
applets_hold.emplace(setting->Id(), widget);
}
for (const auto& [label, widget] : applets_hold) {
library_applets_layout.addWidget(widget);
}
}
void ConfigureApplets::SetConfiguration() {}
void ConfigureApplets::ApplyConfiguration() {
const bool powered_on = system.IsPoweredOn();
for (const auto& func : apply_funcs) {
func(powered_on);
}
}

View File

@ -0,0 +1,48 @@
// SPDX-FileCopyrightText: 2024 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
#pragma once
#include <QWidget>
#include "yuzu/configuration/configuration_shared.h"
class QCheckBox;
class QLineEdit;
class QComboBox;
class QDateTimeEdit;
namespace Core {
class System;
}
namespace Ui {
class ConfigureApplets;
}
namespace ConfigurationShared {
class Builder;
}
class ConfigureApplets : public ConfigurationShared::Tab {
public:
explicit ConfigureApplets(Core::System& system_,
std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group,
const ConfigurationShared::Builder& builder,
QWidget* parent = nullptr);
~ConfigureApplets() override;
void ApplyConfiguration() override;
void SetConfiguration() override;
private:
void changeEvent(QEvent* event) override;
void RetranslateUI();
void Setup(const ConfigurationShared::Builder& builder);
std::vector<std::function<void(bool)>> apply_funcs{};
std::unique_ptr<Ui::ConfigureApplets> ui;
bool enabled = false;
Core::System& system;
};

View File

@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ConfigureApplets</class>
<widget class="QWidget" name="ConfigureApplets">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>605</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="accessibleName">
<string>Applets</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_1">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="group_library_applet_modes">
<property name="title">
<string>Applet mode preference</string>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QWidget" name="applets_widget" native="true">
<layout class="QVBoxLayout" name="verticalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -8,6 +8,7 @@
#include "core/core.h"
#include "ui_configure.h"
#include "vk_device_info.h"
#include "yuzu/configuration/configure_applets.h"
#include "yuzu/configuration/configure_audio.h"
#include "yuzu/configuration/configure_cpu.h"
#include "yuzu/configuration/configure_debug_tab.h"
@ -34,6 +35,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_,
: QDialog(parent), ui{std::make_unique<Ui::ConfigureDialog>()},
registry(registry_), system{system_}, builder{std::make_unique<ConfigurationShared::Builder>(
this, !system_.IsPoweredOn())},
applets_tab{std::make_unique<ConfigureApplets>(system_, nullptr, *builder, this)},
audio_tab{std::make_unique<ConfigureAudio>(system_, nullptr, *builder, this)},
cpu_tab{std::make_unique<ConfigureCpu>(system_, nullptr, *builder, this)},
debug_tab_tab{std::make_unique<ConfigureDebugTab>(system_, this)},
@ -58,6 +60,7 @@ ConfigureDialog::ConfigureDialog(QWidget* parent, HotkeyRegistry& registry_,
ui->setupUi(this);
ui->tabWidget->addTab(applets_tab.get(), tr("Applets"));
ui->tabWidget->addTab(audio_tab.get(), tr("Audio"));
ui->tabWidget->addTab(cpu_tab.get(), tr("CPU"));
ui->tabWidget->addTab(debug_tab_tab.get(), tr("Debug"));
@ -124,6 +127,7 @@ void ConfigureDialog::ApplyConfiguration() {
debug_tab_tab->ApplyConfiguration();
web_tab->ApplyConfiguration();
network_tab->ApplyConfiguration();
applets_tab->ApplyConfiguration();
system.ApplySettings();
Settings::LogSettings();
}
@ -161,7 +165,8 @@ void ConfigureDialog::PopulateSelectionList() {
{{tr("General"),
{general_tab.get(), hotkeys_tab.get(), ui_tab.get(), web_tab.get(), debug_tab_tab.get()}},
{tr("System"),
{system_tab.get(), profile_tab.get(), network_tab.get(), filesystem_tab.get()}},
{system_tab.get(), profile_tab.get(), network_tab.get(), filesystem_tab.get(),
applets_tab.get()}},
{tr("CPU"), {cpu_tab.get()}},
{tr("Graphics"), {graphics_tab.get(), graphics_advanced_tab.get()}},
{tr("Audio"), {audio_tab.get()}},

View File

@ -15,6 +15,7 @@ namespace Core {
class System;
}
class ConfigureApplets;
class ConfigureAudio;
class ConfigureCpu;
class ConfigureDebugTab;
@ -75,6 +76,7 @@ private:
std::unique_ptr<ConfigurationShared::Builder> builder;
std::vector<ConfigurationShared::Tab*> tab_group;
std::unique_ptr<ConfigureApplets> applets_tab;
std::unique_ptr<ConfigureAudio> audio_tab;
std::unique_ptr<ConfigureCpu> cpu_tab;
std::unique_ptr<ConfigureDebugTab> debug_tab_tab;

View File

@ -26,6 +26,23 @@ std::unique_ptr<TranslationMap> InitializeTranslations(QWidget* parent) {
// A setting can be ignored by giving it a blank name
// Applets
INSERT(Settings, cabinet_applet_mode, tr("Amiibo editor"), QStringLiteral());
INSERT(Settings, controller_applet_mode, tr("Controller configuration"), QStringLiteral());
INSERT(Settings, data_erase_applet_mode, tr("Data erase"), QStringLiteral());
INSERT(Settings, error_applet_mode, tr("Error"), QStringLiteral());
INSERT(Settings, net_connect_applet_mode, tr("Net connect"), QStringLiteral());
INSERT(Settings, player_select_applet_mode, tr("Player select"), QStringLiteral());
INSERT(Settings, swkbd_applet_mode, tr("Software keyboard"), QStringLiteral());
INSERT(Settings, mii_edit_applet_mode, tr("Mii Edit"), QStringLiteral());
INSERT(Settings, web_applet_mode, tr("Online web"), QStringLiteral());
INSERT(Settings, shop_applet_mode, tr("Shop"), QStringLiteral());
INSERT(Settings, photo_viewer_applet_mode, tr("Photo viewer"), QStringLiteral());
INSERT(Settings, offline_web_applet_mode, tr("Offline web"), QStringLiteral());
INSERT(Settings, login_share_applet_mode, tr("Login share"), QStringLiteral());
INSERT(Settings, wifi_web_auth_applet_mode, tr("Wifi web auth"), QStringLiteral());
INSERT(Settings, my_page_applet_mode, tr("My page"), QStringLiteral());
// Audio
INSERT(Settings, sink_id, tr("Output Engine:"), QStringLiteral());
INSERT(Settings, audio_output_device_id, tr("Output Device:"), QStringLiteral());
@ -203,6 +220,11 @@ std::unique_ptr<ComboboxTranslationMap> ComboboxEnumeration(QWidget* parent) {
#define PAIR(ENUM, VALUE, TRANSLATION) {static_cast<u32>(Settings::ENUM::VALUE), (TRANSLATION)}
// Intentionally skipping VSyncMode to let the UI fill that one out
translations->insert({Settings::EnumMetadata<Settings::AppletMode>::Index(),
{
PAIR(AppletMode, HLE, tr("Custom frontend")),
PAIR(AppletMode, LLE, tr("Real applet")),
}});
translations->insert({Settings::EnumMetadata<Settings::AstcDecodeMode>::Index(),
{