2020-01-03 07:51:58 +00:00
|
|
|
#include "gpusettingswidget.h"
|
|
|
|
#include "core/gpu.h"
|
|
|
|
#include "core/settings.h"
|
|
|
|
#include "settingwidgetbinder.h"
|
|
|
|
|
|
|
|
GPUSettingsWidget::GPUSettingsWidget(QtHostInterface* host_interface, QWidget* parent /* = nullptr */)
|
|
|
|
: QWidget(parent), m_host_interface(host_interface)
|
|
|
|
{
|
|
|
|
m_ui.setupUi(this);
|
|
|
|
setupAdditionalUi();
|
|
|
|
|
2020-01-24 04:49:49 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.renderer, "GPU/Renderer",
|
|
|
|
&Settings::ParseRendererName, &Settings::GetRendererName);
|
2020-02-28 07:01:01 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.useDebugDevice, "GPU/UseDebugDevice");
|
2020-04-10 05:12:16 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.displayAspectRatio, "Display/AspectRatio",
|
|
|
|
&Settings::ParseDisplayAspectRatio,
|
|
|
|
&Settings::GetDisplayAspectRatioName);
|
|
|
|
SettingWidgetBinder::BindWidgetToEnumSetting(m_host_interface, m_ui.displayCropMode, "Display/CropMode",
|
2020-02-28 07:01:01 +00:00
|
|
|
&Settings::ParseDisplayCropMode, &Settings::GetDisplayCropModeName);
|
2020-01-24 04:49:49 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.displayLinearFiltering,
|
|
|
|
"Display/LinearFiltering");
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.vsync, "Display/VSync");
|
|
|
|
SettingWidgetBinder::BindWidgetToIntSetting(m_host_interface, m_ui.resolutionScale, "GPU/ResolutionScale");
|
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.trueColor, "GPU/TrueColor");
|
2020-02-29 14:05:31 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.scaledDithering, "GPU/ScaledDithering");
|
2020-04-11 06:37:51 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.disableInterlacing, "GPU/DisableInterlacing");
|
2020-04-10 03:34:12 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.forceNTSCTimings, "GPU/ForceNTSCTimings");
|
2020-01-24 04:49:49 +00:00
|
|
|
SettingWidgetBinder::BindWidgetToBoolSetting(m_host_interface, m_ui.linearTextureFiltering, "GPU/TextureFiltering");
|
2020-02-29 14:05:31 +00:00
|
|
|
|
|
|
|
connect(m_ui.resolutionScale, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
|
|
|
|
&GPUSettingsWidget::updateScaledDitheringEnabled);
|
|
|
|
connect(m_ui.trueColor, &QCheckBox::stateChanged, this, &GPUSettingsWidget::updateScaledDitheringEnabled);
|
|
|
|
updateScaledDitheringEnabled();
|
2020-01-03 07:51:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
GPUSettingsWidget::~GPUSettingsWidget() = default;
|
|
|
|
|
2020-02-29 14:05:31 +00:00
|
|
|
void GPUSettingsWidget::updateScaledDitheringEnabled()
|
|
|
|
{
|
|
|
|
const int resolution_scale = m_ui.resolutionScale->currentIndex();
|
|
|
|
const bool true_color = m_ui.trueColor->isChecked();
|
|
|
|
const bool allow_scaled_dithering = (resolution_scale != 1 && !true_color);
|
|
|
|
m_ui.scaledDithering->setEnabled(allow_scaled_dithering);
|
|
|
|
}
|
|
|
|
|
2020-01-03 07:51:58 +00:00
|
|
|
void GPUSettingsWidget::setupAdditionalUi()
|
|
|
|
{
|
|
|
|
for (u32 i = 0; i < static_cast<u32>(GPURenderer::Count); i++)
|
|
|
|
m_ui.renderer->addItem(QString::fromLocal8Bit(Settings::GetRendererDisplayName(static_cast<GPURenderer>(i))));
|
|
|
|
|
2020-04-10 05:12:16 +00:00
|
|
|
for (u32 i = 0; i < static_cast<u32>(DisplayAspectRatio::Count); i++)
|
|
|
|
{
|
|
|
|
m_ui.displayAspectRatio->addItem(
|
|
|
|
QString::fromLocal8Bit(Settings::GetDisplayAspectRatioName(static_cast<DisplayAspectRatio>(i))));
|
|
|
|
}
|
|
|
|
|
2020-02-28 07:01:01 +00:00
|
|
|
for (u32 i = 0; i < static_cast<u32>(DisplayCropMode::Count); i++)
|
|
|
|
{
|
2020-04-10 05:12:16 +00:00
|
|
|
m_ui.displayCropMode->addItem(
|
2020-02-28 07:01:01 +00:00
|
|
|
QString::fromLocal8Bit(Settings::GetDisplayCropModeDisplayName(static_cast<DisplayCropMode>(i))));
|
|
|
|
}
|
|
|
|
|
2020-01-03 07:51:58 +00:00
|
|
|
m_ui.resolutionScale->addItem(tr("Automatic based on window size"));
|
2020-02-28 06:59:55 +00:00
|
|
|
for (u32 i = 1; i <= GPU::MAX_RESOLUTION_SCALE; i++)
|
2020-01-03 07:51:58 +00:00
|
|
|
m_ui.resolutionScale->addItem(tr("%1x (%2x%3)").arg(i).arg(GPU::VRAM_WIDTH * i).arg(GPU::VRAM_HEIGHT * i));
|
|
|
|
}
|