DolphinQt: Add the dumping bitrate setting to the graphics config

Fixes https://bugs.dolphin-emu.org/issues/10250
This commit is contained in:
JosJuice 2019-07-17 20:15:25 +02:00
parent a6dcaed415
commit 199c565bf5
6 changed files with 82 additions and 3 deletions

View File

@ -73,6 +73,8 @@ add_executable(dolphin-emu
Config/Graphics/GraphicsBool.h Config/Graphics/GraphicsBool.h
Config/Graphics/GraphicsChoice.cpp Config/Graphics/GraphicsChoice.cpp
Config/Graphics/GraphicsChoice.h Config/Graphics/GraphicsChoice.h
Config/Graphics/GraphicsInteger.cpp
Config/Graphics/GraphicsInteger.h
Config/Graphics/GraphicsRadio.cpp Config/Graphics/GraphicsRadio.cpp
Config/Graphics/GraphicsRadio.h Config/Graphics/GraphicsRadio.h
Config/Graphics/GraphicsSlider.cpp Config/Graphics/GraphicsSlider.cpp

View File

@ -7,6 +7,8 @@
#include <QCheckBox> #include <QCheckBox>
#include <QGridLayout> #include <QGridLayout>
#include <QGroupBox> #include <QGroupBox>
#include <QLabel>
#include <QSpinBox>
#include <QVBoxLayout> #include <QVBoxLayout>
#include "Core/Config/GraphicsSettings.h" #include "Core/Config/GraphicsSettings.h"
@ -16,6 +18,7 @@
#include "DolphinQt/Config/Graphics/GraphicsBool.h" #include "DolphinQt/Config/Graphics/GraphicsBool.h"
#include "DolphinQt/Config/Graphics/GraphicsChoice.h" #include "DolphinQt/Config/Graphics/GraphicsChoice.h"
#include "DolphinQt/Config/Graphics/GraphicsInteger.h"
#include "DolphinQt/Config/Graphics/GraphicsWindow.h" #include "DolphinQt/Config/Graphics/GraphicsWindow.h"
#include "DolphinQt/Settings.h" #include "DolphinQt/Settings.h"
@ -88,10 +91,13 @@ void AdvancedWidget::CreateWidgets()
m_use_fullres_framedumps = new GraphicsBool(tr("Dump at Internal Resolution"), m_use_fullres_framedumps = new GraphicsBool(tr("Dump at Internal Resolution"),
Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS); Config::GFX_INTERNAL_RESOLUTION_FRAME_DUMPS);
m_dump_use_ffv1 = new GraphicsBool(tr("Use Lossless Codec (FFV1)"), Config::GFX_USE_FFV1); 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); dump_layout->addWidget(m_use_fullres_framedumps, 0, 0);
#if defined(HAVE_FFMPEG) #if defined(HAVE_FFMPEG)
dump_layout->addWidget(m_dump_use_ffv1, 0, 1); 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 #endif
// Misc. // Misc.
@ -137,19 +143,22 @@ void AdvancedWidget::CreateWidgets()
void AdvancedWidget::ConnectWidgets() void AdvancedWidget::ConnectWidgets()
{ {
connect(m_load_custom_textures, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings); 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); connect(m_enable_prog_scan, &QCheckBox::toggled, this, &AdvancedWidget::SaveSettings);
} }
void AdvancedWidget::LoadSettings() void AdvancedWidget::LoadSettings()
{ {
m_prefetch_custom_textures->setEnabled(Config::Get(Config::GFX_HIRES_TEXTURES)); 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)); m_enable_prog_scan->setChecked(Config::Get(Config::SYSCONF_PROGRESSIVE_SCAN));
} }
void AdvancedWidget::SaveSettings() void AdvancedWidget::SaveSettings()
{ {
const auto hires_enabled = Config::Get(Config::GFX_HIRES_TEXTURES); m_prefetch_custom_textures->setEnabled(Config::Get(Config::GFX_HIRES_TEXTURES));
m_prefetch_custom_textures->setEnabled(hires_enabled); m_dump_bitrate->setEnabled(!Config::Get(Config::GFX_USE_FFV1));
Config::SetBase(Config::SYSCONF_PROGRESSIVE_SCAN, m_enable_prog_scan->isChecked()); Config::SetBase(Config::SYSCONF_PROGRESSIVE_SCAN, m_enable_prog_scan->isChecked());
} }

View File

@ -8,6 +8,7 @@
class GraphicsWindow; class GraphicsWindow;
class QCheckBox; class QCheckBox;
class QSpinBox;
class AdvancedWidget final : public GraphicsWidget class AdvancedWidget final : public GraphicsWidget
{ {
@ -42,6 +43,7 @@ private:
// Frame dumping // Frame dumping
QCheckBox* m_dump_use_ffv1; QCheckBox* m_dump_use_ffv1;
QCheckBox* m_use_fullres_framedumps; QCheckBox* m_use_fullres_framedumps;
QSpinBox* m_dump_bitrate;
// Misc // Misc
QCheckBox* m_enable_cropping; QCheckBox* m_enable_cropping;

View File

@ -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 <QSignalBlocker>
#include "Common/Config/Config.h"
#include "DolphinQt/Settings.h"
GraphicsInteger::GraphicsInteger(int minimum, int maximum, const Config::ConfigInfo<int>& setting,
int step)
: QSpinBox(), m_setting(setting)
{
setMinimum(minimum);
setMaximum(maximum);
setSingleStep(step);
setValue(Config::Get(setting));
connect(this, static_cast<void (GraphicsInteger::*)(int)>(&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);
}

View File

@ -0,0 +1,24 @@
// Copyright 2019 Dolphin Emulator Project
// Licensed under GPLv2+
// Refer to the license.txt file included.
#pragma once
#include <QSpinBox>
namespace Config
{
template <typename T>
struct ConfigInfo;
}
class GraphicsInteger : public QSpinBox
{
Q_OBJECT
public:
GraphicsInteger(int minimum, int maximum, const Config::ConfigInfo<int>& setting, int step = 1);
void Update(int value);
private:
const Config::ConfigInfo<int>& m_setting;
};

View File

@ -97,6 +97,7 @@
<QtMoc Include="Config\Graphics\GeneralWidget.h" /> <QtMoc Include="Config\Graphics\GeneralWidget.h" />
<QtMoc Include="Config\Graphics\GraphicsBool.h" /> <QtMoc Include="Config\Graphics\GraphicsBool.h" />
<QtMoc Include="Config\Graphics\GraphicsChoice.h" /> <QtMoc Include="Config\Graphics\GraphicsChoice.h" />
<QtMoc Include="Config\Graphics\GraphicsInteger.h" />
<QtMoc Include="Config\Graphics\GraphicsRadio.h" /> <QtMoc Include="Config\Graphics\GraphicsRadio.h" />
<QtMoc Include="Config\Graphics\GraphicsSlider.h" /> <QtMoc Include="Config\Graphics\GraphicsSlider.h" />
<QtMoc Include="Config\Graphics\GraphicsWidget.h" /> <QtMoc Include="Config\Graphics\GraphicsWidget.h" />
@ -215,6 +216,7 @@
<ClCompile Include="$(QtMocOutPrefix)GeneralWidget.cpp" /> <ClCompile Include="$(QtMocOutPrefix)GeneralWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsBool.cpp" /> <ClCompile Include="$(QtMocOutPrefix)GraphicsBool.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsChoice.cpp" /> <ClCompile Include="$(QtMocOutPrefix)GraphicsChoice.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsInteger.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsRadio.cpp" /> <ClCompile Include="$(QtMocOutPrefix)GraphicsRadio.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsSlider.cpp" /> <ClCompile Include="$(QtMocOutPrefix)GraphicsSlider.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsWidget.cpp" /> <ClCompile Include="$(QtMocOutPrefix)GraphicsWidget.cpp" />
@ -299,6 +301,7 @@
<ClCompile Include="Config\Graphics\GeneralWidget.cpp" /> <ClCompile Include="Config\Graphics\GeneralWidget.cpp" />
<ClCompile Include="Config\Graphics\GraphicsBool.cpp" /> <ClCompile Include="Config\Graphics\GraphicsBool.cpp" />
<ClCompile Include="Config\Graphics\GraphicsChoice.cpp" /> <ClCompile Include="Config\Graphics\GraphicsChoice.cpp" />
<ClCompile Include="Config\Graphics\GraphicsInteger.cpp" />
<ClCompile Include="Config\Graphics\GraphicsRadio.cpp" /> <ClCompile Include="Config\Graphics\GraphicsRadio.cpp" />
<ClCompile Include="Config\Graphics\GraphicsSlider.cpp" /> <ClCompile Include="Config\Graphics\GraphicsSlider.cpp" />
<ClCompile Include="Config\Graphics\GraphicsWidget.cpp" /> <ClCompile Include="Config\Graphics\GraphicsWidget.cpp" />
@ -507,4 +510,4 @@
<Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" /> <Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" />
<Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" /> <Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" />
</Target> </Target>
</Project> </Project>