1 /* Copyright (c) 2013-2015 Jeffrey Pfau
2  *
3  * This Source Code Form is subject to the terms of the Mozilla Public
4  * License, v. 2.0. If a copy of the MPL was not distributed with this
5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #pragma once
7 
8 #if defined(BUILD_GL) || defined(BUILD_GLES2)
9 
10 #include <QDialog>
11 
12 #include "ui_ShaderSelector.h"
13 
14 struct mGLES2Shader;
15 class QGridLayout;
16 struct VideoShader;
17 
18 namespace QGBA {
19 
20 class ConfigController;
21 class Display;
22 
23 class ShaderSelector : public QDialog {
24 Q_OBJECT
25 
26 public:
27 	ShaderSelector(Display* display, ConfigController* config, QWidget* parent = nullptr);
28 	~ShaderSelector();
29 
30 public slots:
31 	void refreshShaders();
32 	void clear();
33 
34 private slots:
35 	void selectShader();
36 	void loadShader(const QString& path);
37 	void clearShader();
38 	void buttonPressed(QAbstractButton*);
39 
40 signals:
41 	void saved();
42 	void reset();
43 	void resetToDefault();
44 
45 private:
46 	void addUniform(QGridLayout*, const QString& section, const QString& name, float* value, float min, float max, int y, int x);
47 	void addUniform(QGridLayout*, const QString& section, const QString& name, int* value, int min, int max, int y, int x);
48 	QWidget* makePage(mGLES2Shader*, const QString& name, int pass);
49 
50 	Ui::ShaderSelector m_ui;
51 	Display* m_display;
52 	ConfigController* m_config;
53 	VideoShader* m_shaders;
54 	QString m_shaderPath;
55 };
56 
57 }
58 
59 #endif
60