| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <memory> |
| 7 |
#include <string> |
| 8 |
#include <unordered_map> |
| 9 |
#include <vector> |
| 10 |
|
| 11 |
#include <QDialog> |
| 12 |
|
| 13 |
#include "Common/CommonTypes.h" |
| 14 |
#include "VideoCommon/PostProcessing.h" |
| 15 |
|
| 16 |
class EnhancementsWidget; |
| 17 |
class QCheckBox; |
| 18 |
class QDialogButtonBox; |
| 19 |
class QGridLayout; |
| 20 |
class QLineEdit; |
| 21 |
class QSlider; |
| 22 |
class QTabWidget; |
| 23 |
class QWidget; |
| 24 |
|
| 25 |
class PostProcessingConfigWindow final : public QDialog |
| 26 |
{ |
| 27 |
Q_OBJECT |
| 28 |
public: |
| 29 |
explicit PostProcessingConfigWindow(EnhancementsWidget* parent, const std::string& shader); |
| 30 |
~PostProcessingConfigWindow() override; |
| 31 |
|
| 32 |
private: |
| 33 |
class ConfigGroup final |
| 34 |
{ |
| 35 |
public: |
| 36 |
explicit ConfigGroup( |
| 37 |
const VideoCommon::PostProcessingConfiguration::ConfigurationOption* config_option); |
| 38 |
|
| 39 |
const std::string& GetGUIName() const noexcept; |
| 40 |
const std::string& GetParent() const noexcept; |
| 41 |
const std::string& GetOptionName() const noexcept; |
| 42 |
void AddSubGroup(std::unique_ptr<ConfigGroup>&& subgroup); |
| 43 |
bool HasSubGroups() const noexcept; |
| 44 |
const VideoCommon::PostProcessingConfiguration::ConfigurationOption* |
| 45 |
GetConfigurationOption() const noexcept; |
| 46 |
const std::vector<std::unique_ptr<ConfigGroup>>& GetSubGroups() const noexcept; |
| 47 |
u32 AddWidgets(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row); |
| 48 |
void EnableSuboptions(bool state); |
| 49 |
int GetCheckboxValue() const; |
| 50 |
int GetSliderValue(size_t index) const; |
| 51 |
void SetSliderText(size_t index, const QString& text); |
| 52 |
|
| 53 |
private: |
| 54 |
u32 AddBool(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row); |
| 55 |
u32 AddInteger(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row); |
| 56 |
u32 AddFloat(PostProcessingConfigWindow* parent, QGridLayout* grid, u32 row); |
| 57 |
|
| 58 |
QCheckBox* m_checkbox = nullptr; |
| 59 |
std::vector<QSlider*> m_sliders; |
| 60 |
std::vector<QLineEdit*> m_value_boxes; |
| 61 |
|
| 62 |
const VideoCommon::PostProcessingConfiguration::ConfigurationOption* m_config_option; |
| 63 |
std::vector<std::unique_ptr<ConfigGroup>> m_subgroups; |
| 64 |
}; |
| 65 |
void Create(); |
| 66 |
void ConnectWidgets(); |
| 67 |
QWidget* CreateDependentTab(const std::unique_ptr<ConfigGroup>& config_group); |
| 68 |
void PopulateGroups(); |
| 69 |
void UpdateBool(ConfigGroup* config_group, bool state); |
| 70 |
void UpdateInteger(ConfigGroup* config_group, int value); |
| 71 |
void UpdateFloat(ConfigGroup* config_group, int value); |
| 72 |
|
| 73 |
QTabWidget* m_tabs; |
| 74 |
QDialogButtonBox* m_buttons; |
| 75 |
|
| 76 |
const std::string& m_shader; |
| 77 |
VideoCommon::PostProcessingConfiguration* m_post_processor; |
| 78 |
std::unordered_map<std::string, ConfigGroup*> m_config_map; |
| 79 |
std::vector<std::unique_ptr<ConfigGroup>> m_config_groups; |
| 80 |
}; |