Skip to content

Commit

Permalink
DolphinQt: Add the dumping bitrate setting to the graphics config
Browse files Browse the repository at this point in the history
  • Loading branch information
JosJuice committed Jul 18, 2019
1 parent a6dcaed commit 199c565
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 3 deletions.
2 changes: 2 additions & 0 deletions Source/Core/DolphinQt/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 11 additions & 2 deletions Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
#include <QCheckBox>
#include <QGridLayout>
#include <QGroupBox>
#include <QLabel>
#include <QSpinBox>
#include <QVBoxLayout>

#include "Core/Config/GraphicsSettings.h"
Expand All @@ -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"

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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());
}
Expand Down
2 changes: 2 additions & 0 deletions Source/Core/DolphinQt/Config/Graphics/AdvancedWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

class GraphicsWindow;
class QCheckBox;
class QSpinBox;

class AdvancedWidget final : public GraphicsWidget
{
Expand Down Expand Up @@ -42,6 +43,7 @@ class AdvancedWidget final : public GraphicsWidget
// Frame dumping
QCheckBox* m_dump_use_ffv1;
QCheckBox* m_use_fullres_framedumps;
QSpinBox* m_dump_bitrate;

// Misc
QCheckBox* m_enable_cropping;
Expand Down
39 changes: 39 additions & 0 deletions Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.cpp
Original file line number Diff line number Diff line change
@@ -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);
}
24 changes: 24 additions & 0 deletions Source/Core/DolphinQt/Config/Graphics/GraphicsInteger.h
Original file line number Diff line number Diff line change
@@ -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;
};
5 changes: 4 additions & 1 deletion Source/Core/DolphinQt/DolphinQt.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<QtMoc Include="Config\Graphics\GeneralWidget.h" />
<QtMoc Include="Config\Graphics\GraphicsBool.h" />
<QtMoc Include="Config\Graphics\GraphicsChoice.h" />
<QtMoc Include="Config\Graphics\GraphicsInteger.h" />
<QtMoc Include="Config\Graphics\GraphicsRadio.h" />
<QtMoc Include="Config\Graphics\GraphicsSlider.h" />
<QtMoc Include="Config\Graphics\GraphicsWidget.h" />
Expand Down Expand Up @@ -215,6 +216,7 @@
<ClCompile Include="$(QtMocOutPrefix)GeneralWidget.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsBool.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsChoice.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsInteger.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsRadio.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsSlider.cpp" />
<ClCompile Include="$(QtMocOutPrefix)GraphicsWidget.cpp" />
Expand Down Expand Up @@ -299,6 +301,7 @@
<ClCompile Include="Config\Graphics\GeneralWidget.cpp" />
<ClCompile Include="Config\Graphics\GraphicsBool.cpp" />
<ClCompile Include="Config\Graphics\GraphicsChoice.cpp" />
<ClCompile Include="Config\Graphics\GraphicsInteger.cpp" />
<ClCompile Include="Config\Graphics\GraphicsRadio.cpp" />
<ClCompile Include="Config\Graphics\GraphicsSlider.cpp" />
<ClCompile Include="Config\Graphics\GraphicsWidget.cpp" />
Expand Down Expand Up @@ -507,4 +510,4 @@
<Message Text="Copy: @(BinaryFiles) -&gt; $(BinaryOutputDir)" Importance="High" />
<Copy SourceFiles="@(BinaryFiles)" DestinationFolder="$(BinaryOutputDir)" />
</Target>
</Project>
</Project>

0 comments on commit 199c565

Please sign in to comment.