1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Save queued ProjectSettings changes immediately when settings dialog is closed.

This commit is contained in:
Pāvels Nadtočajevs
2025-03-08 16:26:52 +02:00
parent b5bdb88062
commit 9363433458
2 changed files with 16 additions and 1 deletions

View File

@@ -76,9 +76,17 @@ void ProjectSettingsEditor::popup_project_settings(bool p_clear_filter) {
} }
void ProjectSettingsEditor::queue_save() { void ProjectSettingsEditor::queue_save() {
settings_changed = true;
timer->start(); timer->start();
} }
void ProjectSettingsEditor::_save() {
settings_changed = false;
if (ps) {
ps->save();
}
}
void ProjectSettingsEditor::set_plugins_page() { void ProjectSettingsEditor::set_plugins_page() {
tab_container->set_current_tab(tab_container->get_tab_idx_from_control(plugin_settings)); tab_container->set_current_tab(tab_container->get_tab_idx_from_control(plugin_settings));
} }
@@ -601,6 +609,10 @@ void ProjectSettingsEditor::_notification(int p_what) {
case NOTIFICATION_VISIBILITY_CHANGED: { case NOTIFICATION_VISIBILITY_CHANGED: {
if (!is_visible()) { if (!is_visible()) {
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "project_settings", Rect2(get_position(), get_size())); EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "project_settings", Rect2(get_position(), get_size()));
if (settings_changed) {
timer->stop();
_save();
}
} }
} break; } break;
@@ -763,7 +775,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
timer = memnew(Timer); timer = memnew(Timer);
timer->set_wait_time(1.5); timer->set_wait_time(1.5);
timer->connect("timeout", callable_mp(ps, &ProjectSettings::save)); timer->connect("timeout", callable_mp(this, &ProjectSettingsEditor::_save));
timer->set_one_shot(true); timer->set_one_shot(true);
add_child(timer); add_child(timer);

View File

@@ -81,6 +81,8 @@ class ProjectSettingsEditor : public AcceptDialog {
ImportDefaultsEditor *import_defaults_editor = nullptr; ImportDefaultsEditor *import_defaults_editor = nullptr;
EditorData *data = nullptr; EditorData *data = nullptr;
bool settings_changed = false;
void _advanced_toggled(bool p_button_pressed); void _advanced_toggled(bool p_button_pressed);
void _update_advanced(bool p_is_advanced); void _update_advanced(bool p_is_advanced);
void _property_box_changed(const String &p_text); void _property_box_changed(const String &p_text);
@@ -113,6 +115,7 @@ class ProjectSettingsEditor : public AcceptDialog {
void _action_reordered(const String &p_action_name, const String &p_relative_to, bool p_before); void _action_reordered(const String &p_action_name, const String &p_relative_to, bool p_before);
void _update_action_map_editor(); void _update_action_map_editor();
void _update_theme(); void _update_theme();
void _save();
protected: protected:
void _notification(int p_what); void _notification(int p_what);