2026-03-10 06:51:08 +01:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2026 Eden Emulator Project
|
2025-09-15 17:21:18 +02:00
|
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
|
|
2022-04-23 04:59:50 -04:00
|
|
|
// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project
|
|
|
|
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
2020-02-23 19:01:17 -05:00
|
|
|
|
2023-07-21 23:09:09 -04:00
|
|
|
#include <vector>
|
2023-05-07 09:48:26 -04:00
|
|
|
#include <QLabel>
|
|
|
|
|
#include <qnamespace.h>
|
2021-04-14 16:07:40 -07:00
|
|
|
#include "common/settings.h"
|
2020-02-23 19:01:17 -05:00
|
|
|
#include "core/core.h"
|
2026-03-10 06:51:08 +01:00
|
|
|
#include "qt_common/config/shared_translation.h"
|
2020-02-23 19:01:17 -05:00
|
|
|
#include "ui_configure_graphics_advanced.h"
|
2020-07-09 22:42:09 -04:00
|
|
|
#include "yuzu/configuration/configuration_shared.h"
|
2020-02-23 19:01:17 -05:00
|
|
|
#include "yuzu/configuration/configure_graphics_advanced.h"
|
2023-05-08 22:37:03 -04:00
|
|
|
#include "yuzu/configuration/shared_widget.h"
|
2020-02-23 19:01:17 -05:00
|
|
|
|
2023-05-05 23:30:59 -04:00
|
|
|
ConfigureGraphicsAdvanced::ConfigureGraphicsAdvanced(
|
2023-07-21 23:09:09 -04:00
|
|
|
const Core::System& system_, std::shared_ptr<std::vector<ConfigurationShared::Tab*>> group_,
|
2023-06-21 01:42:42 -04:00
|
|
|
const ConfigurationShared::Builder& builder, QWidget* parent)
|
|
|
|
|
: Tab(group_, parent), ui{std::make_unique<Ui::ConfigureGraphicsAdvanced>()}, system{system_} {
|
2020-02-23 19:01:17 -05:00
|
|
|
|
|
|
|
|
ui->setupUi(this);
|
|
|
|
|
|
2023-06-21 01:42:42 -04:00
|
|
|
Setup(builder);
|
|
|
|
|
|
2020-02-23 19:01:17 -05:00
|
|
|
SetConfiguration();
|
2023-05-08 12:32:41 -04:00
|
|
|
|
2023-05-07 09:48:26 -04:00
|
|
|
checkbox_enable_compute_pipelines->setVisible(false);
|
2020-02-23 19:01:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ConfigureGraphicsAdvanced::~ConfigureGraphicsAdvanced() = default;
|
|
|
|
|
|
2023-06-21 01:42:42 -04:00
|
|
|
void ConfigureGraphicsAdvanced::SetConfiguration() {}
|
|
|
|
|
|
|
|
|
|
void ConfigureGraphicsAdvanced::Setup(const ConfigurationShared::Builder& builder) {
|
2025-12-30 18:03:09 +01:00
|
|
|
auto& normal_layout = *ui->normal_target->layout();
|
|
|
|
|
|
|
|
|
|
// A map will sort the data for us
|
|
|
|
|
std::map<u32, QWidget*> normal_hold{};
|
2023-05-07 09:48:26 -04:00
|
|
|
|
|
|
|
|
for (auto setting :
|
2023-05-07 10:35:28 -04:00
|
|
|
Settings::values.linkage.by_category[Settings::Category::RendererAdvanced]) {
|
2023-06-21 01:42:42 -04:00
|
|
|
ConfigurationShared::Widget* widget = builder.BuildWidget(setting, apply_funcs);
|
|
|
|
|
|
|
|
|
|
if (widget == nullptr) {
|
2023-06-10 16:40:38 -04:00
|
|
|
continue;
|
|
|
|
|
}
|
2023-05-08 22:37:03 -04:00
|
|
|
if (!widget->Valid()) {
|
2023-07-21 23:25:22 -04:00
|
|
|
widget->deleteLater();
|
2023-05-07 09:48:26 -04:00
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-30 18:03:09 +01:00
|
|
|
const auto id = setting->Id();
|
|
|
|
|
|
2025-12-31 23:45:58 +01:00
|
|
|
normal_hold.emplace(id, widget);
|
2023-05-07 09:48:26 -04:00
|
|
|
|
2023-06-09 17:40:25 -04:00
|
|
|
// Keep track of enable_compute_pipelines so we can display it when needed
|
2023-05-07 13:28:52 -04:00
|
|
|
if (setting->Id() == Settings::values.enable_compute_pipelines.Id()) {
|
2023-05-07 09:48:26 -04:00
|
|
|
checkbox_enable_compute_pipelines = widget;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-12-30 18:03:09 +01:00
|
|
|
|
|
|
|
|
for (const auto& [id, widget] : normal_hold) {
|
|
|
|
|
normal_layout.addWidget(widget);
|
|
|
|
|
}
|
2020-02-23 19:01:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ConfigureGraphicsAdvanced::ApplyConfiguration() {
|
2023-05-07 09:48:26 -04:00
|
|
|
const bool is_powered_on = system.IsPoweredOn();
|
|
|
|
|
for (const auto& func : apply_funcs) {
|
|
|
|
|
func(is_powered_on);
|
|
|
|
|
}
|
2020-02-23 19:01:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ConfigureGraphicsAdvanced::changeEvent(QEvent* event) {
|
|
|
|
|
if (event->type() == QEvent::LanguageChange) {
|
|
|
|
|
RetranslateUI();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget::changeEvent(event);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ConfigureGraphicsAdvanced::RetranslateUI() {
|
|
|
|
|
ui->retranslateUi(this);
|
|
|
|
|
}
|
2020-07-09 22:42:09 -04:00
|
|
|
|
2023-05-02 16:48:45 -07:00
|
|
|
void ConfigureGraphicsAdvanced::ExposeComputeOption() {
|
2023-05-07 09:48:26 -04:00
|
|
|
checkbox_enable_compute_pipelines->setVisible(true);
|
2023-05-02 16:48:45 -07:00
|
|
|
}
|