diff --git a/Source/Core/DolphinQt/CMakeLists.txt b/Source/Core/DolphinQt/CMakeLists.txt index 1275e0adae..1bf9844ff6 100644 --- a/Source/Core/DolphinQt/CMakeLists.txt +++ b/Source/Core/DolphinQt/CMakeLists.txt @@ -73,6 +73,8 @@ add_executable(dolphin-emu Config/Graphics/GraphicsBool.h Config/Graphics/GraphicsChoice.cpp Config/Graphics/GraphicsChoice.h + Config/Graphics/GraphicsInteger.cpp + Config/Graphics/GraphicsInteger.h Config/Graphics/GraphicsRadio.cpp Config/Graphics/GraphicsRadio.h Config/Graphics/GraphicsSlider.cpp diff --git a/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp b/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp index 7ff340d8b2..f84885798f 100644 --- a/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp +++ b/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include "Core/Config/GraphicsSettings.h" @@ -16,6 +18,7 @@ #include "DolphinQt/Config/Graphics/GraphicsBool.h" #include "DolphinQt/Config/Graphics/GraphicsChoice.h" +#include "DolphinQt/Config/Graphics/GraphicsInteger.h" #include "DolphinQt/Config/Graphics/GraphicsWindow.h" #include "DolphinQt/Settings.h" @@ -88,10 +91,13 @@ void AdvancedWidget::CreateWidgets() m_use_fullres_framedumps = new GraphicsBool(tr("Dump at Internal Resolution"), Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS); m_dump_use_ffv1 = new GraphicsBool(tr("Use Lossless Codec (FFV1)"), Config::GFX_USE_FFV1); + m_dump_bitrate = new GraphicsInteger(0, 1000000, Config::GFX_BITRATE_KBPS, 1000); dump_layout->addWidget(m_use_fullres_framedumps, 0, 0); #if defined(HAVE_FFMPEG) dump_layout->addWidget(m_dump_use_ffv1, 0, 1); + dump_layout->addWidget(new QLabel(tr("Bitrate (kbps):")), 1, 0); + dump_layout->addWidget(m_dump_bitrate, 1, 1); #endif // Misc. @@ -137,19 +143,22 @@ void AdvancedWidget::CreateWidgets() void AdvancedWidget::ConnectWidgets() { connect(m_load_custom_textures, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings); + connect(m_dump_use_ffv1, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings); connect(m_enable_prog_scan, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings); } void AdvancedWidget::LoadSettings() { m_prefetch_custom_textures->setEnabled(Config::Get(Config::GFX_HIRES_TEXTURES)); + m_dump_bitrate->setEnabled(!Config::Get(Config::GFX_USE_FFV1)); + m_enable_prog_scan->setChecked(Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN)); } void AdvancedWidget::SaveSettings() { - const auto hires_enabled = Config::Get(Config::GFX_HIRES_TEXTURES); - m_prefetch_custom_textures->setEnabled(hires_enabled); + m_prefetch_custom_textures->setEnabled(Config::Get(Config::GFX_HIRES_TEXTURES)); + m_dump_bitrate->setEnabled(!Config::Get(Config::GFX_USE_FFV1)); Config::SetBase(Config::SYSCONF_PROGRESSIVE_SCAN, m_enable_prog_scan->isChecked()); } diff --git a/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.h b/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.h index 9c2c88bce1..1c973c58ed 100644 --- a/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.h +++ b/Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.h @@ -8,6 +8,7 @@ class GraphicsWindow; class QCheckBox; +class QSpinBox; class AdvancedWidget final : public GraphicsWidget { @@ -42,6 +43,7 @@ private: // Frame dumping QCheckBox* m_dump_use_ffv1; QCheckBox* m_use_fullres_framedumps; + QSpinBox* m_dump_bitrate; // Misc QCheckBox* m_enable_cropping; diff --git a/Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.cpp b/Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.cpp new file mode 100644 index 0000000000..cabca80d52 --- /dev/null +++ b/Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.cpp @@ -0,0 +1,39 @@ +// Copyright 2019 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#include "DolphinQt/Config/Graphics/GraphicsInteger.h" + +#include + +#include "Common/Config/Config.h" + +#include "DolphinQt/Settings.h" + +GraphicsInteger::GraphicsInteger(int minimum, int maximum, const Config::ConfigInfo& setting, + int step) + : QSpinBox(), m_setting(setting) +{ + setMinimum(minimum); + setMaximum(maximum); + setSingleStep(step); + + setValue(Config::Get(setting)); + + connect(this, static_cast(&GraphicsInteger::valueChanged), this, + &GraphicsInteger::Update); + + connect(&Settings::Instance(), &Settings::ConfigChanged, [this] { + QFont bf = font(); + bf.setBold(Config::GetActiveLayerForConfig(m_setting) != Config::LayerType::Base); + setFont(bf); + + const QSignalBlocker blocker(this); + setValue(Config::Get(m_setting)); + }); +} + +void GraphicsInteger::Update(int value) +{ + Config::SetBaseOrCurrent(m_setting, value); +} diff --git a/Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.h b/Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.h new file mode 100644 index 0000000000..84de36d406 --- /dev/null +++ b/Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.h @@ -0,0 +1,24 @@ +// Copyright 2019 Dolphin Emulator Project +// Licensed under GPLv2+ +// Refer to the license.txt file included. + +#pragma once + +#include + +namespace Config +{ +template +struct ConfigInfo; +} + +class GraphicsInteger : public QSpinBox +{ + Q_OBJECT +public: + GraphicsInteger(int minimum, int maximum, const Config::ConfigInfo& setting, int step = 1); + void Update(int value); + +private: + const Config::ConfigInfo& m_setting; +}; diff --git a/Source/Core/DolphinQt/DolphinQt.vcxproj b/Source/Core/DolphinQt/DolphinQt.vcxproj index 151c4032c7..2deb34cffc 100644 --- a/Source/Core/DolphinQt/DolphinQt.vcxproj +++ b/Source/Core/DolphinQt/DolphinQt.vcxproj @@ -97,6 +97,7 @@ + @@ -215,6 +216,7 @@ + @@ -299,6 +301,7 @@ + @@ -507,4 +510,4 @@ - + \ No newline at end of file