| 
									
										
										
										
											2022-12-04 11:03:45 +00:00
										 |  |  | // SPDX-FileCopyrightText: 2019-2022 Connor McLaughlin <stenzek@gmail.com>
 | 
					
						
							|  |  |  | // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-13 12:24:20 +00:00
										 |  |  | #pragma once
 | 
					
						
							| 
									
										
										
										
											2023-08-27 12:48:40 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-13 12:24:20 +00:00
										 |  |  | #include "ui_postprocessingsettingswidget.h"
 | 
					
						
							| 
									
										
										
										
											2023-08-27 12:48:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #include "util/postprocessing.h"
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-13 12:24:20 +00:00
										 |  |  | #include <QtWidgets/QWidget>
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-06 13:01:38 +00:00
										 |  |  | class SettingsWindow; | 
					
						
							| 
									
										
										
										
											2023-08-27 12:48:40 +00:00
										 |  |  | class PostProcessingShaderConfigWidget; | 
					
						
							| 
									
										
										
										
											2020-09-13 12:24:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | class PostProcessingSettingsWidget : public QWidget | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-27 12:48:40 +00:00
										 |  |  |   friend PostProcessingShaderConfigWidget; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-13 12:24:20 +00:00
										 |  |  | public: | 
					
						
							| 
									
										
										
										
											2023-11-06 13:01:38 +00:00
										 |  |  |   PostProcessingSettingsWidget(SettingsWindow* dialog, QWidget* parent); | 
					
						
							| 
									
										
										
										
											2020-09-13 12:24:20 +00:00
										 |  |  |   ~PostProcessingSettingsWidget(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private Q_SLOTS: | 
					
						
							| 
									
										
										
										
											2023-08-27 12:48:40 +00:00
										 |  |  |   void onAddButtonClicked(); | 
					
						
							|  |  |  |   void onRemoveButtonClicked(); | 
					
						
							|  |  |  |   void onClearButtonClicked(); | 
					
						
							|  |  |  |   void onMoveUpButtonClicked(); | 
					
						
							|  |  |  |   void onMoveDownButtonClicked(); | 
					
						
							|  |  |  |   void onReloadButtonClicked(); | 
					
						
							|  |  |  |   void onSelectedShaderChanged(); | 
					
						
							| 
									
										
										
										
											2020-09-13 12:24:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | private: | 
					
						
							| 
									
										
										
										
											2023-08-27 12:48:40 +00:00
										 |  |  |   SettingsInterface& getSettingsInterfaceToUpdate(); | 
					
						
							|  |  |  |   void commitSettingsUpdate(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-09-13 12:24:20 +00:00
										 |  |  |   void connectUi(); | 
					
						
							| 
									
										
										
										
											2023-08-27 12:48:40 +00:00
										 |  |  |   void updateButtonsAndConfigPane(std::optional<u32> index); | 
					
						
							|  |  |  |   std::optional<u32> getSelectedIndex() const; | 
					
						
							|  |  |  |   void selectIndex(s32 index); | 
					
						
							|  |  |  |   void updateList(const SettingsInterface& si); | 
					
						
							|  |  |  |   void updateList(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-11-06 13:01:38 +00:00
										 |  |  |   SettingsWindow* m_dialog; | 
					
						
							| 
									
										
										
										
											2020-09-13 12:24:20 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  |   Ui::PostProcessingSettingsWidget m_ui; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   PostProcessingShaderConfigWidget* m_shader_config = nullptr; | 
					
						
							|  |  |  | }; | 
					
						
							| 
									
										
										
										
											2023-08-27 12:48:40 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | class PostProcessingShaderConfigWidget : public QWidget | 
					
						
							|  |  |  | { | 
					
						
							|  |  |  |   Q_OBJECT | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | public: | 
					
						
							|  |  |  |   PostProcessingShaderConfigWidget(QWidget* parent, PostProcessingSettingsWidget* widget, u32 stage_index, | 
					
						
							|  |  |  |                                    std::vector<PostProcessing::ShaderOption> options); | 
					
						
							|  |  |  |   ~PostProcessingShaderConfigWidget(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | private Q_SLOTS: | 
					
						
							|  |  |  |   void onResetDefaultsClicked(); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | protected: | 
					
						
							|  |  |  |   void createUi(); | 
					
						
							|  |  |  |   void updateConfigForOption(const PostProcessing::ShaderOption& option); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   QGridLayout* m_layout; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   PostProcessingSettingsWidget* m_widget; | 
					
						
							|  |  |  |   std::vector<QWidget*> m_widgets; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   u32 m_stage_index; | 
					
						
							|  |  |  |   std::vector<PostProcessing::ShaderOption> m_options; | 
					
						
							|  |  |  | }; |