Skip to content

Commit

Permalink
Qt: save shader settings when OK/Apply clicked
Browse files Browse the repository at this point in the history
  • Loading branch information
ahigerd authored and endrift committed Nov 23, 2024
1 parent cca3267 commit f930184
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/platform/qt/SettingsView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,11 @@ void SettingsView::setShaderSelector(ShaderSelector* shaderSelector) {
}
if (!m_shader) {
m_ui.stackedWidget->removeWidget(m_dummyShader);
} else {
QObject::disconnect(m_shader, nullptr, this, nullptr);
}
m_shader = shaderSelector;
QObject::connect(this, &SettingsView::saveSettingsRequested, m_shader, &ShaderSelector::saveSettings);
if (shaderSelector) {
addPage(tr("Shaders"), m_shader, Page::SHADERS);
} else {
Expand Down Expand Up @@ -683,6 +686,8 @@ void SettingsView::updateConfig() {
saveSetting("gb.colors", gbColors);
#endif

emit saveSettingsRequested();

m_controller->write();

emit pathsChanged();
Expand Down
1 change: 1 addition & 0 deletions src/platform/qt/SettingsView.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Q_OBJECT
void pathsChanged();
void languageChanged();
void libraryCleared();
void saveSettingsRequested();

public slots:
void selectPage(Page);
Expand Down
8 changes: 4 additions & 4 deletions src/platform/qt/ShaderSelector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ ShaderSelector::~ShaderSelector() {
clear();
}

void ShaderSelector::saveSettings() {
emit saved();
}

void ShaderSelector::clear() {
m_ui.shaderName->setText(tr("No shader active"));
m_ui.description->clear();
Expand Down Expand Up @@ -269,10 +273,6 @@ void ShaderSelector::buttonPressed(QAbstractButton* button) {
case QDialogButtonBox::Reset:
emit reset();
break;
case QDialogButtonBox::Ok:
emit saved();
close();
break;
case QDialogButtonBox::RestoreDefaults:
emit resetToDefault();
break;
Expand Down
1 change: 1 addition & 0 deletions src/platform/qt/ShaderSelector.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Q_OBJECT
~ShaderSelector();

public slots:
void saveSettings();
void refreshShaders();
void clear();

Expand Down

0 comments on commit f930184

Please sign in to comment.