mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-09-14 23:43:49 +00:00
Another change
This commit is contained in:
@@ -126,17 +126,15 @@ ConfigurePostProcessing::ConfigurePostProcessing(QWidget* parent) : QDialog(pare
|
||||
});
|
||||
preset_row->addWidget(save_button);
|
||||
|
||||
auto* delete_button = new QPushButton(tr("Delete"), this);
|
||||
connect(delete_button, &QPushButton::clicked, this, [this]() {
|
||||
const QString name = preset_combo->currentData().toString();
|
||||
if (name.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
VideoCore::DeleteFxPreset(name.toStdString());
|
||||
PopulatePresetCombo();
|
||||
RefreshPresetStatus();
|
||||
auto* clear_button = new QPushButton(tr("Clear"), this);
|
||||
clear_button->setToolTip(tr("Remove every effect in use and deselect the preset."));
|
||||
connect(clear_button, &QPushButton::clicked, this, [this]() {
|
||||
VideoCore::FxChain::Instance().Clear();
|
||||
VideoCore::SetActiveFxPreset(std::string());
|
||||
preset_combo->setCurrentIndex(0);
|
||||
ApplyStructuralChange();
|
||||
});
|
||||
preset_row->addWidget(delete_button);
|
||||
preset_row->addWidget(clear_button);
|
||||
|
||||
root->addLayout(preset_row);
|
||||
|
||||
@@ -201,6 +199,7 @@ void ConfigurePostProcessing::ApplyStructuralChange() {
|
||||
void ConfigurePostProcessing::PopulatePresetCombo() {
|
||||
const QString previous = preset_combo->currentData().toString();
|
||||
preset_combo->clear();
|
||||
preset_combo->addItem(tr("None"), QString());
|
||||
|
||||
for (const auto& preset : VideoCore::GetFxPresetCatalog()) {
|
||||
const QString name = QString::fromStdString(preset.name);
|
||||
@@ -210,7 +209,7 @@ void ConfigurePostProcessing::PopulatePresetCombo() {
|
||||
}
|
||||
|
||||
const int restored = preset_combo->findData(previous);
|
||||
if (restored >= 0) {
|
||||
if (!previous.isEmpty() && restored >= 0) {
|
||||
preset_combo->setCurrentIndex(restored);
|
||||
return;
|
||||
}
|
||||
@@ -218,12 +217,21 @@ void ConfigurePostProcessing::PopulatePresetCombo() {
|
||||
const int active = preset_combo->findData(QString::fromStdString(VideoCore::GetActiveFxPreset()));
|
||||
if (active >= 0) {
|
||||
preset_combo->setCurrentIndex(active);
|
||||
return;
|
||||
}
|
||||
|
||||
preset_combo->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void ConfigurePostProcessing::RefreshPresetStatus() {
|
||||
const std::string active = VideoCore::GetActiveFxPreset();
|
||||
if (active.empty()) {
|
||||
if (VideoCore::FxChain::Instance().Size() == 0) {
|
||||
preset_status->setText(
|
||||
tr("No effects in use. Pick a preset and press Apply, or add effects one "
|
||||
"by one."));
|
||||
return;
|
||||
}
|
||||
preset_status->setText(tr("Custom chain. Pick a preset above and press Apply to replace it."));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -1038,6 +1039,41 @@ void MainWindow::InitializeWidgets() {
|
||||
tas_label->setFocusPolicy(Qt::NoFocus);
|
||||
statusBar()->insertPermanentWidget(0, tas_label);
|
||||
|
||||
#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
|
||||
|
||||
volume_popup = new QWidget(this);
|
||||
volume_popup->setWindowFlags(Qt::FramelessWindowHint | Qt::NoDropShadowWindowHint | Qt::Popup);
|
||||
volume_popup->setLayout(new QVBoxLayout());
|
||||
@@ -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);
|
||||
|
||||
@@ -448,6 +448,7 @@ private:
|
||||
void UpdateAPIText();
|
||||
void UpdateFilterText();
|
||||
void UpdateAAText();
|
||||
void UpdatePostShaderText();
|
||||
void UpdateVolumeUI();
|
||||
void UpdateStatusBar();
|
||||
void UpdateGPUAccuracyButton();
|
||||
@@ -524,6 +525,7 @@ private:
|
||||
QPushButton* dock_status_button = nullptr;
|
||||
QPushButton* filter_status_button = nullptr;
|
||||
QPushButton* aa_status_button = nullptr;
|
||||
QPushButton* post_shader_status_button = nullptr;
|
||||
VolumeButton* volume_button = nullptr;
|
||||
QWidget* volume_popup = nullptr;
|
||||
QSlider* volume_slider = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user