Qt: Fix several cases where shader selections don't get saved

This commit is contained in:
Vicki Pfau 2019-12-14 13:09:09 -08:00
parent b7bbe0a207
commit 2583c5cae8
2 changed files with 4 additions and 7 deletions

View File

@ -98,6 +98,7 @@ Other fixes:
- Vita: Fix analog controls (fixes mgba.io/i/1554)
- Qt: Fix fast forward mute being reset (fixes mgba.io/i/1574)
- Qt: Fix scrollbar arrows in memory view (fixes mgba.io/i/1558)
- Qt: Fix several cases where shader selections don't get saved
Misc:
- GB Memory: Support manual SRAM editing (fixes mgba.io/i/1580)

View File

@ -33,6 +33,7 @@ ShaderSelector::ShaderSelector(Display* display, ConfigController* config, QWidg
: QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint)
, m_display(display)
, m_config(config)
, m_shaderPath(config->getOption("shader"))
{
m_ui.setupUi(this);
@ -41,9 +42,6 @@ ShaderSelector::ShaderSelector(Display* display, ConfigController* config, QWidg
connect(m_ui.load, &QAbstractButton::clicked, this, &ShaderSelector::selectShader);
connect(m_ui.unload, &QAbstractButton::clicked, this, &ShaderSelector::clearShader);
connect(m_ui.buttonBox, &QDialogButtonBox::clicked, this, &ShaderSelector::buttonPressed);
connect(this, &ShaderSelector::saved, [this]() {
m_config->setOption("shader", m_shaderPath);
});
}
ShaderSelector::~ShaderSelector() {
@ -85,12 +83,14 @@ void ShaderSelector::loadShader(const QString& path) {
m_display->setShaders(shader);
shader->close(shader);
m_shaderPath = path;
m_config->setOption("shader", m_shaderPath);
}
void ShaderSelector::clearShader() {
m_display->clearShaders();
refreshShaders();
m_shaderPath = "";
m_config->setOption("shader", m_shaderPath);
}
void ShaderSelector::refreshShaders() {
@ -119,10 +119,6 @@ void ShaderSelector::refreshShaders() {
disconnect(this, &ShaderSelector::reset, 0, 0);
disconnect(this, &ShaderSelector::resetToDefault, 0, 0);
connect(this, &ShaderSelector::saved, [this]() {
m_config->setOption("shader", m_shaderPath);
});
#if !defined(_WIN32) || defined(USE_EPOXY)
if (m_shaders->preprocessShader) {
m_ui.passes->addTab(makePage(static_cast<mGLES2Shader*>(m_shaders->preprocessShader), "default", 0), tr("Preprocessing"));