diff options
author | FireForge <67974470+fire-forge@users.noreply.github.com> | 2022-07-07 19:31:19 -0500 |
---|---|---|
committer | FireForge <67974470+fire-forge@users.noreply.github.com> | 2022-07-09 10:47:08 -0500 |
commit | e4067064cecd71914691580447d77de9bbc3d0b6 (patch) | |
tree | 289f4a4df4c171a27f7e37addd1bf3641c55ec94 /editor/editor_node.cpp | |
parent | 5268efdcd9b8e07ed8363f6f32a343392ab4acdf (diff) |
Add ok_button_text to AcceptDialog and cancel_button_text to ConfirmationDialog
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r-- | editor/editor_node.cpp | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index eafbf11df0..d123c8286c 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -2541,10 +2541,10 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { if (scene_root) { String scene_filename = scene_root->get_scene_file_path(); if (p_option == FILE_CLOSE_ALL_AND_RELOAD_CURRENT_PROJECT) { - save_confirmation->get_ok_button()->set_text(TTR("Save & Reload")); + save_confirmation->set_ok_button_text(TTR("Save & Reload")); save_confirmation->set_text(vformat(TTR("Save changes to '%s' before reloading?"), !scene_filename.is_empty() ? scene_filename : "unsaved scene")); } else { - save_confirmation->get_ok_button()->set_text(TTR("Save & Quit")); + save_confirmation->set_ok_button_text(TTR("Save & Quit")); save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), !scene_filename.is_empty() ? scene_filename : "unsaved scene")); } save_confirmation->popup_centered(); @@ -2660,7 +2660,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { case FILE_EXTERNAL_OPEN_SCENE: { if (unsaved_cache && !p_confirmed) { - confirmation->get_ok_button()->set_text(TTR("Open")); + confirmation->set_ok_button_text(TTR("Open")); confirmation->set_text(TTR("Current scene not saved. Open anyway?")); confirmation->popup_centered(); break; @@ -2716,7 +2716,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } if (unsaved_cache && !p_confirmed) { - confirmation->get_ok_button()->set_text(TTR("Reload Saved Scene")); + confirmation->set_ok_button_text(TTR("Reload Saved Scene")); confirmation->set_text( TTR("The current scene has unsaved changes.\nReload the saved scene anyway? This action cannot be undone.")); confirmation->popup_centered(); @@ -2841,10 +2841,10 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { i = _next_unsaved_scene(true, ++i); } if (p_option == RELOAD_CURRENT_PROJECT) { - save_confirmation->get_ok_button()->set_text(TTR("Save & Reload")); + save_confirmation->set_ok_button_text(TTR("Save & Reload")); save_confirmation->set_text(TTR("Save changes to the following scene(s) before reloading?") + unsaved_scenes); } else { - save_confirmation->get_ok_button()->set_text(TTR("Save & Quit")); + save_confirmation->set_ok_button_text(TTR("Save & Quit")); save_confirmation->set_text((p_option == FILE_QUIT ? TTR("Save changes to the following scene(s) before quitting?") : TTR("Save changes to the following scene(s) before opening Project Manager?")) + unsaved_scenes); } save_confirmation->popup_centered(); @@ -4277,14 +4277,14 @@ Error EditorNode::export_preset(const String &p_preset, const String &p_path, bo void EditorNode::show_accept(const String &p_text, const String &p_title) { current_menu_option = -1; - accept->get_ok_button()->set_text(p_title); + accept->set_ok_button_text(p_title); accept->set_text(p_text); accept->popup_centered(); } void EditorNode::show_save_accept(const String &p_text, const String &p_title) { current_menu_option = -1; - save_accept->get_ok_button()->set_text(p_title); + save_accept->set_ok_button_text(p_title); save_accept->set_text(p_text); save_accept->popup_centered(); } @@ -4970,8 +4970,8 @@ void EditorNode::_immediate_dialog_confirmed() { bool EditorNode::immediate_confirmation_dialog(const String &p_text, const String &p_ok_text, const String &p_cancel_text) { ConfirmationDialog *cd = memnew(ConfirmationDialog); cd->set_text(p_text); - cd->get_ok_button()->set_text(p_ok_text); - cd->get_cancel_button()->set_text(p_cancel_text); + cd->set_ok_button_text(p_ok_text); + cd->set_cancel_button_text(p_cancel_text); cd->connect("confirmed", callable_mp(singleton, &EditorNode::_immediate_dialog_confirmed)); singleton->gui_base->add_child(cd); @@ -5033,14 +5033,14 @@ void EditorNode::_layout_menu_option(int p_id) { case SETTINGS_LAYOUT_SAVE: { current_menu_option = p_id; layout_dialog->set_title(TTR("Save Layout")); - layout_dialog->get_ok_button()->set_text(TTR("Save")); + layout_dialog->set_ok_button_text(TTR("Save")); layout_dialog->popup_centered(); layout_dialog->set_name_line_enabled(true); } break; case SETTINGS_LAYOUT_DELETE: { current_menu_option = p_id; layout_dialog->set_title(TTR("Delete Layout")); - layout_dialog->get_ok_button()->set_text(TTR("Delete")); + layout_dialog->set_ok_button_text(TTR("Delete")); layout_dialog->popup_centered(); layout_dialog->set_name_line_enabled(false); } break; @@ -5082,7 +5082,7 @@ void EditorNode::_scene_tab_closed(int p_tab, int option) { ? saved_version != editor_data.get_undo_redo().get_version() : editor_data.get_scene_version(p_tab) != 0; if (unsaved) { - save_confirmation->get_ok_button()->set_text(TTR("Save & Close")); + save_confirmation->set_ok_button_text(TTR("Save & Close")); save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), !scene->get_scene_file_path().is_empty() ? scene->get_scene_file_path() : "unsaved scene")); save_confirmation->popup_centered(); } else { @@ -6787,7 +6787,7 @@ EditorNode::EditorNode() { video_restart_dialog = memnew(ConfirmationDialog); video_restart_dialog->set_text(TTR("Changing the video driver requires restarting the editor.")); - video_restart_dialog->get_ok_button()->set_text(TTR("Save & Restart")); + video_restart_dialog->set_ok_button_text(TTR("Save & Restart")); video_restart_dialog->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SET_RENDERING_DRIVER_SAVE_AND_RESTART)); gui_base->add_child(video_restart_dialog); @@ -6956,7 +6956,7 @@ EditorNode::EditorNode() { custom_build_manage_templates = memnew(ConfirmationDialog); custom_build_manage_templates->set_text(TTR("Android build template is missing, please install relevant templates.")); - custom_build_manage_templates->get_ok_button()->set_text(TTR("Manage Templates")); + custom_build_manage_templates->set_ok_button_text(TTR("Manage Templates")); custom_build_manage_templates->add_button(TTR("Install from file"))->connect("pressed", callable_mp(this, &EditorNode::_menu_option), varray(SETTINGS_INSTALL_ANDROID_BUILD_TEMPLATE)); custom_build_manage_templates->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SETTINGS_MANAGE_EXPORT_TEMPLATES)); gui_base->add_child(custom_build_manage_templates); @@ -6971,13 +6971,13 @@ EditorNode::EditorNode() { install_android_build_template = memnew(ConfirmationDialog); install_android_build_template->set_text(TTR("This will set up your project for custom Android builds by installing the source template to \"res://android/build\".\nYou can then apply modifications and build your own custom APK on export (adding modules, changing the AndroidManifest.xml, etc.).\nNote that in order to make custom builds instead of using pre-built APKs, the \"Use Custom Build\" option should be enabled in the Android export preset.")); - install_android_build_template->get_ok_button()->set_text(TTR("Install")); + install_android_build_template->set_ok_button_text(TTR("Install")); install_android_build_template->connect("confirmed", callable_mp(this, &EditorNode::_menu_confirm_current)); gui_base->add_child(install_android_build_template); remove_android_build_template = memnew(ConfirmationDialog); remove_android_build_template->set_text(TTR("The Android build template is already installed in this project and it won't be overwritten.\nRemove the \"res://android/build\" directory manually before attempting this operation again.")); - remove_android_build_template->get_ok_button()->set_text(TTR("Show in File Manager")); + remove_android_build_template->set_ok_button_text(TTR("Show in File Manager")); remove_android_build_template->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(FILE_EXPLORE_ANDROID_BUILD_TEMPLATES)); gui_base->add_child(remove_android_build_template); @@ -7052,7 +7052,7 @@ EditorNode::EditorNode() { disk_changed->connect("confirmed", callable_mp(this, &EditorNode::_reload_modified_scenes)); disk_changed->connect("confirmed", callable_mp(this, &EditorNode::_reload_project_settings)); - disk_changed->get_ok_button()->set_text(TTR("Reload")); + disk_changed->set_ok_button_text(TTR("Reload")); disk_changed->add_button(TTR("Resave"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "resave"); disk_changed->connect("custom_action", callable_mp(this, &EditorNode::_resave_scenes)); @@ -7228,7 +7228,7 @@ EditorNode::EditorNode() { set_process(true); open_imported = memnew(ConfirmationDialog); - open_imported->get_ok_button()->set_text(TTR("Open Anyway")); + open_imported->set_ok_button_text(TTR("Open Anyway")); new_inherited_button = open_imported->add_button(TTR("New Inherited"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "inherit"); open_imported->connect("confirmed", callable_mp(this, &EditorNode::_open_imported)); open_imported->connect("custom_action", callable_mp(this, &EditorNode::_inherit_imported)); @@ -7269,7 +7269,7 @@ EditorNode::EditorNode() { pick_main_scene = memnew(ConfirmationDialog); gui_base->add_child(pick_main_scene); - pick_main_scene->get_ok_button()->set_text(TTR("Select")); + pick_main_scene->set_ok_button_text(TTR("Select")); pick_main_scene->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SETTINGS_PICK_MAIN_SCENE)); select_current_scene_button = pick_main_scene->add_button(TTR("Select Current"), true, "select_current"); pick_main_scene->connect("custom_action", callable_mp(this, &EditorNode::_pick_main_scene_custom_action)); |