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"
|
|
|
|
|
#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-18 23:05:21 -04:00
|
|
|
#include "yuzu/configuration/shared_translation.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) {
|
2023-05-07 09:48:26 -04:00
|
|
|
auto& layout = *ui->populate_target->layout();
|
2023-06-06 22:30:02 -04:00
|
|
|
std::map<u32, QWidget*> hold{}; // A map will sort the data for us
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-06 22:30:02 -04:00
|
|
|
hold.emplace(setting->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;
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-06-06 22:30:02 -04:00
|
|
|
for (const auto& [id, widget] : hold) {
|
2023-05-07 09:48:26 -04:00
|
|
|
layout.addWidget(widget);
|
2020-07-09 22:42:09 -04:00
|
|
|
}
|
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
|
|
|
}
|