diff options
| author | Rémi Verschelde <rverschelde@gmail.com> | 2019-06-13 12:10:05 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-06-13 12:10:05 +0200 |
| commit | 8c11f883d9c96b08d2dd4b6bc72caf0c9d9543c5 (patch) | |
| tree | 74540bc739c42fea9406b4ffe9239b2ee9f9e903 /editor/plugins/script_editor_plugin.cpp | |
| parent | 41a62f3ac3e45eaa1dc5f6de7b72040eda983070 (diff) | |
| parent | 0823d783745994b9a03d21762a9d532a55d00b86 (diff) | |
| download | redot-engine-8c11f883d9c96b08d2dd4b6bc72caf0c9d9543c5.tar.gz | |
Merge pull request #29129 from kis3lori/remove-save-theme-for-default
Created a fallback from the "Save Theme" button to "Save Theme As" when a default theme is in use.
Diffstat (limited to 'editor/plugins/script_editor_plugin.cpp')
| -rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 6bf916cdfc..7456c5d016 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -1311,23 +1311,29 @@ void ScriptEditor::_theme_option(int p_option) { EditorSettings::get_singleton()->load_text_editor_theme(); } break; case THEME_SAVE: { - if (!EditorSettings::get_singleton()->save_text_editor_theme()) { + if (EditorSettings::get_singleton()->is_default_text_editor_theme()) { + ScriptEditor::_show_save_theme_as_dialog(); + } else if (!EditorSettings::get_singleton()->save_text_editor_theme()) { editor->show_warning(TTR("Error while saving theme"), TTR("Error saving")); } } break; case THEME_SAVE_AS: { - file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); - file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); - file_dialog_option = THEME_SAVE_AS; - file_dialog->clear_filters(); - file_dialog->add_filter("*.tet"); - file_dialog->set_current_path(EditorSettings::get_singleton()->get_text_editor_themes_dir().plus_file(EditorSettings::get_singleton()->get("text_editor/theme/color_theme"))); - file_dialog->popup_centered_ratio(); - file_dialog->set_title(TTR("Save Theme As...")); + ScriptEditor::_show_save_theme_as_dialog(); } break; } } +void ScriptEditor::_show_save_theme_as_dialog() { + file_dialog->set_mode(EditorFileDialog::MODE_SAVE_FILE); + file_dialog->set_access(EditorFileDialog::ACCESS_FILESYSTEM); + file_dialog_option = THEME_SAVE_AS; + file_dialog->clear_filters(); + file_dialog->add_filter("*.tet"); + file_dialog->set_current_path(EditorSettings::get_singleton()->get_text_editor_themes_dir().plus_file(EditorSettings::get_singleton()->get("text_editor/theme/color_theme"))); + file_dialog->popup_centered_ratio(); + file_dialog->set_title(TTR("Save Theme As...")); +} + void ScriptEditor::_tab_changed(int p_which) { ensure_select_current(); |
