diff options
| author | CamilleLaVey <camillelavey99@gmail.com> | 2026-09-15 07:23:12 +0200 |
|---|---|---|
| committer | crueter <crueter@eden-emu.dev> | 2026-09-15 07:23:12 +0200 |
| commit | c5405250d179824cdcd55d2dbd0a484f516490af (patch) | |
| tree | 8ebf2da460cde4bf584c64de712e3b48bf6d7fcf /src/yuzu/main_window.cpp | |
| parent | 10c07d700c33fa1ff78d5f616c2da2872fc5d43f (diff) | |
[common, ui] Refining UI for FX shaders for PC (#4426)
Self-explanatory refinements on the already existing access/usage of post-processing shaders on Eden for PC UI.
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/4426
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Reviewed-by: lizzie <lizzie@eden-emu.dev>
Diffstat (limited to 'src/yuzu/main_window.cpp')
| -rw-r--r-- | src/yuzu/main_window.cpp | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/src/yuzu/main_window.cpp b/src/yuzu/main_window.cpp index 95b91a4f38..1d579239a1 100644 --- a/src/yuzu/main_window.cpp +++ b/src/yuzu/main_window.cpp @@ -15,6 +15,7 @@ #include "render/performance_overlay.h" #ifdef HAS_RESHADE #include "configuration/configure_post_processing.h" +#include "video_core/post_processing/fx_preset.h" #endif #include "updater/update_dialog.h" @@ -1090,6 +1091,41 @@ void MainWindow::InitializeWidgets() { statusBar()->insertPermanentWidget(0, volume_button); +#ifdef HAS_RESHADE + post_shader_status_button = new QPushButton(); + post_shader_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); + post_shader_status_button->setFocusPolicy(Qt::NoFocus); + post_shader_status_button->setCheckable(true); + connect(post_shader_status_button, &QPushButton::clicked, this, [this] { + const bool enabled = Settings::values.post_shader_enabled.GetValue(); + Settings::values.post_shader_enabled.SetValue(!enabled); + UpdatePostShaderText(); + }); + UpdatePostShaderText(); + post_shader_status_button->setContextMenuPolicy(Qt::CustomContextMenu); + connect(post_shader_status_button, &QPushButton::customContextMenuRequested, + [this](const QPoint& menu_location) { + QMenu context_menu; + + for (auto const& preset : VideoCore::GetFxPresetCatalog()) { + context_menu.addAction(QString::fromStdString(preset.name), + [this, name = preset.name] { + VideoCore::ApplyFxPreset(name); + Settings::values.post_shader_enabled.SetValue(true); + UpdatePostShaderText(); + }); + } + + context_menu.addSeparator(); + context_menu.addAction(tr("Configure Effects..."), this, + &MainWindow::OnPostProcessingShaders); + + context_menu.exec(post_shader_status_button->mapToGlobal(menu_location)); + post_shader_status_button->repaint(); + }); + statusBar()->insertPermanentWidget(0, post_shader_status_button); +#endif + // setup AA button aa_status_button = new QPushButton(); aa_status_button->setObjectName(QStringLiteral("TogglableStatusBarButton")); @@ -3908,6 +3944,7 @@ void MainWindow::OnPostProcessingShaders() { connect(post_processing_dialog, &QDialog::finished, post_processing_dialog, [this]() { post_processing_dialog->deleteLater(); post_processing_dialog = nullptr; + UpdatePostShaderText(); }); } @@ -4262,6 +4299,26 @@ void MainWindow::UpdateAAText() { : aa_text.toUpper()); } +#ifdef HAS_RESHADE +void MainWindow::UpdatePostShaderText() { + const bool enabled = Settings::values.post_shader_enabled.GetValue(); + post_shader_status_button->setChecked(enabled); + + if (!enabled) { + post_shader_status_button->setText(tr("NO FX")); + return; + } + + const std::string preset = VideoCore::GetActiveFxPreset(); + if (preset.empty()) { + post_shader_status_button->setText(tr("FX")); + return; + } + + post_shader_status_button->setText(QString::fromStdString(preset).toUpper()); +} +#endif + void MainWindow::UpdateVolumeUI() { const auto volume_value = static_cast<int>(Settings::values.volume.GetValue()); volume_slider->setValue(volume_value); |
