Merge pull request #44389 from madmiraal/rename-get_ok

Rename AcceptDialog get_ok() to get_ok_button()
This commit is contained in:
Rémi Verschelde 2020-12-15 12:51:06 +01:00 committed by GitHub
commit 93dbee9a15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
51 changed files with 231 additions and 231 deletions

View File

@ -23,7 +23,7 @@
If [code]true[/code], [code]right[/code] will place the button to the right of any sibling buttons.
</description>
</method>
<method name="add_cancel">
<method name="add_cancel_button">
<return type="Button">
</return>
<argument index="0" name="name" type="String">
@ -39,7 +39,7 @@
Returns the label used for built-in text.
</description>
</method>
<method name="get_ok">
<method name="get_ok_button">
<return type="Button">
</return>
<description>
@ -76,7 +76,7 @@
<signals>
<signal name="cancelled">
<description>
Emitted when the dialog is closed or the button created with [method add_cancel] is pressed.
Emitted when the dialog is closed or the button created with [method add_cancel_button] is pressed.
</description>
</signal>
<signal name="confirmed">

View File

@ -18,7 +18,7 @@
<tutorials>
</tutorials>
<methods>
<method name="get_cancel">
<method name="get_cancel_button">
<return type="Button">
</return>
<description>

View File

@ -3360,7 +3360,7 @@ void AnimationTrackEditor::_query_insert(const InsertData &p_id) {
}
insert_confirm_bezier->set_visible(all_bezier);
insert_confirm->get_ok()->set_text(TTR("Create"));
insert_confirm->get_ok_button()->set_text(TTR("Create"));
insert_confirm->popup_centered();
insert_query = true;
} else {
@ -5789,7 +5789,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
optimize_max_angle->set_step(0.1);
optimize_max_angle->set_value(22);
optimize_dialog->get_ok()->set_text(TTR("Optimize"));
optimize_dialog->get_ok_button()->set_text(TTR("Optimize"));
optimize_dialog->connect("confirmed", callable_mp(this, &AnimationTrackEditor::_edit_menu_pressed), varray(EDIT_CLEAN_UP_ANIMATION_CONFIRM));
//
@ -5814,7 +5814,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
cleanup_vb->add_child(cleanup_all);
cleanup_dialog->set_title(TTR("Clean-Up Animation(s) (NO UNDO!)"));
cleanup_dialog->get_ok()->set_text(TTR("Clean-Up"));
cleanup_dialog->get_ok_button()->set_text(TTR("Clean-Up"));
cleanup_dialog->connect("confirmed", callable_mp(this, &AnimationTrackEditor::_edit_menu_pressed), varray(EDIT_CLEAN_UP_ANIMATION_CONFIRM));
@ -5834,7 +5834,7 @@ AnimationTrackEditor::AnimationTrackEditor() {
track_copy_dialog = memnew(ConfirmationDialog);
add_child(track_copy_dialog);
track_copy_dialog->set_title(TTR("Select Tracks to Copy"));
track_copy_dialog->get_ok()->set_text(TTR("Copy"));
track_copy_dialog->get_ok_button()->set_text(TTR("Copy"));
VBoxContainer *track_vbox = memnew(VBoxContainer);
track_copy_dialog->add_child(track_vbox);

View File

@ -252,16 +252,16 @@ void ConnectDialog::_update_ok_enabled() {
Node *target = tree->get_selected();
if (target == nullptr) {
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
return;
}
if (!advanced->is_pressed() && target->get_script().is_null()) {
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
return;
}
get_ok()->set_disabled(false);
get_ok_button()->set_disabled(false);
}
void ConnectDialog::_notification(int p_what) {
@ -496,8 +496,8 @@ ConnectDialog::ConnectDialog() {
error = memnew(AcceptDialog);
add_child(error);
error->set_title(TTR("Cannot connect signal"));
error->get_ok()->set_text(TTR("Close"));
get_ok()->set_text(TTR("Connect"));
error->get_ok_button()->set_text(TTR("Close"));
get_ok_button()->set_text(TTR("Connect"));
}
ConnectDialog::~ConnectDialog() {

View File

@ -57,10 +57,10 @@ void CreateDialog::popup_create(bool p_dont_clear, bool p_replace_mode, const St
if (p_replace_mode) {
set_title(vformat(TTR("Change %s Type"), base_type));
get_ok()->set_text(TTR("Change"));
get_ok_button()->set_text(TTR("Change"));
} else {
set_title(vformat(TTR("Create New %s"), base_type));
get_ok()->set_text(TTR("Create"));
get_ok_button()->set_text(TTR("Create"));
}
_load_favorites_and_history();
@ -195,7 +195,7 @@ void CreateDialog::_update_search() {
} else {
favorite->set_disabled(true);
help_bit->set_text("");
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
search_options->deselect_all();
}
}
@ -396,7 +396,7 @@ void CreateDialog::select_type(const String &p_type) {
favorite->set_disabled(false);
favorite->set_pressed(favorite_list.find(p_type) != -1);
get_ok()->set_disabled(false);
get_ok_button()->set_disabled(false);
}
String CreateDialog::get_selected_type() {

View File

@ -553,7 +553,7 @@ void DependencyRemoveDialog::_bind_methods() {
}
DependencyRemoveDialog::DependencyRemoveDialog() {
get_ok()->set_text(TTR("Remove"));
get_ok_button()->set_text(TTR("Remove"));
VBoxContainer *vb = memnew(VBoxContainer);
add_child(vb);
@ -619,8 +619,8 @@ DependencyErrorDialog::DependencyErrorDialog() {
files->set_v_size_flags(Control::SIZE_EXPAND_FILL);
set_min_size(Size2(500, 220) * EDSCALE);
get_ok()->set_text(TTR("Open Anyway"));
get_cancel()->set_text(TTR("Close"));
get_ok_button()->set_text(TTR("Open Anyway"));
get_cancel_button()->set_text(TTR("Close"));
text = memnew(Label);
vb->add_child(text);
@ -756,7 +756,7 @@ void OrphanResourcesDialog::_bind_methods() {
OrphanResourcesDialog::OrphanResourcesDialog() {
set_title(TTR("Orphan Resource Explorer"));
delete_confirm = memnew(ConfirmationDialog);
get_ok()->set_text(TTR("Delete"));
get_ok_button()->set_text(TTR("Delete"));
add_child(delete_confirm);
dep_edit = memnew(DependencyEditor);
add_child(dep_edit);

View File

@ -335,7 +335,7 @@ EditorAssetInstaller::EditorAssetInstaller() {
error = memnew(AcceptDialog);
add_child(error);
get_ok()->set_text(TTR("Install"));
get_ok_button()->set_text(TTR("Install"));
set_title(TTR("Package Installer"));
updating = false;

View File

@ -202,7 +202,7 @@ EditorDirDialog::EditorDirDialog() {
mkdirerr->set_text(TTR("Could not create folder."));
add_child(mkdirerr);
get_ok()->set_text(TTR("Choose"));
get_ok_button()->set_text(TTR("Choose"));
must_reload = false;
}

View File

@ -890,7 +890,7 @@ EditorFeatureProfileManager::EditorFeatureProfileManager() {
add_child(new_profile_dialog);
new_profile_dialog->connect("confirmed", callable_mp(this, &EditorFeatureProfileManager::_create_new_profile));
new_profile_dialog->register_text_enter(new_profile_name);
new_profile_dialog->get_ok()->set_text(TTR("Create"));
new_profile_dialog->get_ok_button()->set_text(TTR("Create"));
erase_profile_dialog = memnew(ConfirmationDialog);
add_child(erase_profile_dialog);

View File

@ -212,14 +212,14 @@ void EditorFileDialog::update_dir() {
dir->set_text(dir_access->get_current_dir(false));
// Disable "Open" button only when selecting file(s) mode.
get_ok()->set_disabled(_is_open_should_be_disabled());
get_ok_button()->set_disabled(_is_open_should_be_disabled());
switch (mode) {
case FILE_MODE_OPEN_FILE:
case FILE_MODE_OPEN_FILES:
get_ok()->set_text(TTR("Open"));
get_ok_button()->set_text(TTR("Open"));
break;
case FILE_MODE_OPEN_DIR:
get_ok()->set_text(TTR("Select Current Folder"));
get_ok_button()->set_text(TTR("Select Current Folder"));
break;
case FILE_MODE_OPEN_ANY:
case FILE_MODE_SAVE_FILE:
@ -476,10 +476,10 @@ void EditorFileDialog::_item_selected(int p_item) {
file->set_text(d["name"]);
_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
} else if (mode == FILE_MODE_OPEN_DIR) {
get_ok()->set_text(TTR("Select This Folder"));
get_ok_button()->set_text(TTR("Select This Folder"));
}
get_ok()->set_disabled(_is_open_should_be_disabled());
get_ok_button()->set_disabled(_is_open_should_be_disabled());
}
void EditorFileDialog::_multi_selected(int p_item, bool p_selected) {
@ -495,7 +495,7 @@ void EditorFileDialog::_multi_selected(int p_item, bool p_selected) {
_request_single_thumbnail(get_current_dir().plus_file(get_current_file()));
}
get_ok()->set_disabled(_is_open_should_be_disabled());
get_ok_button()->set_disabled(_is_open_should_be_disabled());
}
void EditorFileDialog::_items_clear_selection() {
@ -505,13 +505,13 @@ void EditorFileDialog::_items_clear_selection() {
switch (mode) {
case FILE_MODE_OPEN_FILE:
case FILE_MODE_OPEN_FILES:
get_ok()->set_text(TTR("Open"));
get_ok()->set_disabled(!item_list->is_anything_selected());
get_ok_button()->set_text(TTR("Open"));
get_ok_button()->set_disabled(!item_list->is_anything_selected());
break;
case FILE_MODE_OPEN_DIR:
get_ok()->set_disabled(false);
get_ok()->set_text(TTR("Select Current Folder"));
get_ok_button()->set_disabled(false);
get_ok_button()->set_text(TTR("Select Current Folder"));
break;
case FILE_MODE_OPEN_ANY:
@ -855,7 +855,7 @@ void EditorFileDialog::update_file_list() {
favorite->set_pressed(false);
fav_up->set_disabled(true);
fav_down->set_disabled(true);
get_ok()->set_disabled(_is_open_should_be_disabled());
get_ok_button()->set_disabled(_is_open_should_be_disabled());
for (int i = 0; i < favorites->get_item_count(); i++) {
if (favorites->get_item_metadata(i) == cdir || favorites->get_item_metadata(i) == cdir + "/") {
favorites->select(i);
@ -978,27 +978,27 @@ void EditorFileDialog::set_file_mode(FileMode p_mode) {
mode = p_mode;
switch (mode) {
case FILE_MODE_OPEN_FILE:
get_ok()->set_text(TTR("Open"));
get_ok_button()->set_text(TTR("Open"));
set_title(TTR("Open a File"));
can_create_dir = false;
break;
case FILE_MODE_OPEN_FILES:
get_ok()->set_text(TTR("Open"));
get_ok_button()->set_text(TTR("Open"));
set_title(TTR("Open File(s)"));
can_create_dir = false;
break;
case FILE_MODE_OPEN_DIR:
get_ok()->set_text(TTR("Open"));
get_ok_button()->set_text(TTR("Open"));
set_title(TTR("Open a Directory"));
can_create_dir = true;
break;
case FILE_MODE_OPEN_ANY:
get_ok()->set_text(TTR("Open"));
get_ok_button()->set_text(TTR("Open"));
set_title(TTR("Open a File or Directory"));
can_create_dir = true;
break;
case FILE_MODE_SAVE_FILE:
get_ok()->set_text(TTR("Save"));
get_ok_button()->set_text(TTR("Save"));
set_title(TTR("Save a File"));
can_create_dir = true;
break;

View File

@ -105,7 +105,7 @@ void EditorHelpSearch::_notification(int p_what) {
case NOTIFICATION_VISIBILITY_CHANGED: {
if (!is_visible()) {
results_tree->call_deferred("clear"); // Wait for the Tree's mouse event propagation.
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
EditorSettings::get_singleton()->set_project_metadata("dialog_bounds", "search_help", Rect2(get_position(), get_size()));
}
} break;
@ -130,7 +130,7 @@ void EditorHelpSearch::_notification(int p_what) {
old_search = false;
}
get_ok()->set_disabled(!results_tree->get_selected());
get_ok_button()->set_disabled(!results_tree->get_selected());
search = Ref<Runner>();
set_process(false);
@ -182,8 +182,8 @@ EditorHelpSearch::EditorHelpSearch() {
set_title(TTR("Search Help"));
get_ok()->set_disabled(true);
get_ok()->set_text(TTR("Open"));
get_ok_button()->set_disabled(true);
get_ok_button()->set_text(TTR("Open"));
// Split search and results area.
VBoxContainer *vbox = memnew(VBoxContainer);
@ -244,7 +244,7 @@ EditorHelpSearch::EditorHelpSearch() {
results_tree->set_hide_root(true);
results_tree->set_select_mode(Tree::SELECT_ROW);
results_tree->connect("item_activated", callable_mp(this, &EditorHelpSearch::_confirmed));
results_tree->connect("item_selected", callable_mp((BaseButton *)get_ok(), &BaseButton::set_disabled), varray(false));
results_tree->connect("item_selected", callable_mp((BaseButton *)get_ok_button(), &BaseButton::set_disabled), varray(false));
vbox->add_child(results_tree, true);
}

View File

@ -2271,7 +2271,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) {
String scene_filename = editor_data.get_edited_scene_root(tab_closing)->get_filename();
save_confirmation->get_ok()->set_text(TTR("Save & Close"));
save_confirmation->get_ok_button()->set_text(TTR("Save & Close"));
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene"));
save_confirmation->popup_centered();
break;
@ -2362,8 +2362,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
} break;
case FILE_SAVE_BEFORE_RUN: {
if (!p_confirmed) {
confirmation->get_cancel()->set_text(TTR("No"));
confirmation->get_ok()->set_text(TTR("Yes"));
confirmation->get_cancel_button()->set_text(TTR("No"));
confirmation->get_ok_button()->set_text(TTR("Yes"));
confirmation->set_text(TTR("This scene has never been saved. Save before running?"));
confirmation->popup_centered();
break;
@ -2427,7 +2427,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()->set_text(TTR("Open"));
confirmation->get_ok_button()->set_text(TTR("Open"));
confirmation->set_text(TTR("Current scene not saved. Open anyway?"));
confirmation->popup_centered();
break;
@ -2483,7 +2483,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
}
if (unsaved_cache && !p_confirmed) {
confirmation->get_ok()->set_text(TTR("Reload Saved Scene"));
confirmation->get_ok_button()->set_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();
@ -2587,7 +2587,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
if (_next_unsaved_scene(!save_each) == -1) {
bool confirm = EDITOR_GET("interface/editor/quit_confirmation");
if (confirm) {
confirmation->get_ok()->set_text(p_option == FILE_QUIT ? TTR("Quit") : TTR("Yes"));
confirmation->get_ok_button()->set_text(p_option == FILE_QUIT ? TTR("Quit") : TTR("Yes"));
confirmation->set_text(p_option == FILE_QUIT ? TTR("Exit the editor?") : TTR("Open Project Manager?"));
confirmation->popup_centered();
} else {
@ -2605,7 +2605,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
i = _next_unsaved_scene(true, ++i);
}
save_confirmation->get_ok()->set_text(TTR("Save & Quit"));
save_confirmation->get_ok_button()->set_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 the following scene(s) before opening Project Manager?")) + unsaved_scenes);
save_confirmation->popup_centered();
}
@ -3948,7 +3948,7 @@ 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_option = -1;
accept->get_ok()->set_text(p_title);
accept->get_ok_button()->set_text(p_title);
accept->set_text(p_text);
accept->popup_centered();
}
@ -4647,14 +4647,14 @@ void EditorNode::_layout_menu_option(int p_id) {
case SETTINGS_LAYOUT_SAVE: {
current_option = p_id;
layout_dialog->set_title(TTR("Save Layout"));
layout_dialog->get_ok()->set_text(TTR("Save"));
layout_dialog->get_ok_button()->set_text(TTR("Save"));
layout_dialog->popup_centered();
layout_dialog->set_name_line_enabled(true);
} break;
case SETTINGS_LAYOUT_DELETE: {
current_option = p_id;
layout_dialog->set_title(TTR("Delete Layout"));
layout_dialog->get_ok()->set_text(TTR("Delete"));
layout_dialog->get_ok_button()->set_text(TTR("Delete"));
layout_dialog->popup_centered();
layout_dialog->set_name_line_enabled(false);
} break;
@ -4696,7 +4696,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()->set_text(TTR("Save & Close"));
save_confirmation->get_ok_button()->set_text(TTR("Save & Close"));
save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene->get_filename() != "" ? scene->get_filename() : "unsaved scene"));
save_confirmation->popup_centered();
} else {
@ -5475,7 +5475,7 @@ static void _execute_thread(void *p_ud) {
int EditorNode::execute_and_show_output(const String &p_title, const String &p_path, const List<String> &p_arguments, bool p_close_on_ok, bool p_close_on_errors) {
execute_output_dialog->set_title(p_title);
execute_output_dialog->get_ok()->set_disabled(true);
execute_output_dialog->get_ok_button()->set_disabled(true);
execute_outputs->clear();
execute_outputs->set_scroll_follow(true);
execute_output_dialog->popup_centered_ratio();
@ -5516,7 +5516,7 @@ int EditorNode::execute_and_show_output(const String &p_title, const String &p_p
execute_output_dialog->hide();
}
execute_output_dialog->get_ok()->set_disabled(false);
execute_output_dialog->get_ok_button()->set_disabled(false);
return eta.exitcode;
}
@ -6388,7 +6388,7 @@ EditorNode::EditorNode() {
#endif
video_restart_dialog = memnew(ConfirmationDialog);
video_restart_dialog->set_text(TTR("Changing the video driver requires restarting the editor."));
video_restart_dialog->get_ok()->set_text(TTR("Save & Restart"));
video_restart_dialog->get_ok_button()->set_text(TTR("Save & Restart"));
video_restart_dialog->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SET_VIDEO_DRIVER_SAVE_AND_RESTART));
gui_base->add_child(video_restart_dialog);
@ -6535,19 +6535,19 @@ 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()->set_text(TTR("Manage Templates"));
custom_build_manage_templates->get_ok_button()->set_text(TTR("Manage Templates"));
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);
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()->set_text(TTR("Install"));
install_android_build_template->get_ok_button()->set_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()->set_text(TTR("Show in File Manager"));
remove_android_build_template->get_ok_button()->set_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);
@ -6750,7 +6750,7 @@ EditorNode::EditorNode() {
set_process(true);
open_imported = memnew(ConfirmationDialog);
open_imported->get_ok()->set_text(TTR("Open Anyway"));
open_imported->get_ok_button()->set_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));
@ -6800,7 +6800,7 @@ EditorNode::EditorNode() {
pick_main_scene = memnew(ConfirmationDialog);
gui_base->add_child(pick_main_scene);
pick_main_scene->get_ok()->set_text(TTR("Select"));
pick_main_scene->get_ok_button()->set_text(TTR("Select"));
pick_main_scene->connect("confirmed", callable_mp(this, &EditorNode::_menu_option), varray(SETTINGS_PICK_MAIN_SCENE));
for (int i = 0; i < _init_callbacks.size(); i++) {

View File

@ -661,8 +661,8 @@ ExportTemplateManager::ExportTemplateManager() {
installed_scroll->set_enable_h_scroll(false);
installed_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
get_cancel()->set_text(TTR("Close"));
get_ok()->set_text(TTR("Install From File"));
get_cancel_button()->set_text(TTR("Close"));
get_ok_button()->set_text(TTR("Install From File"));
remove_confirm = memnew(ConfirmationDialog);
remove_confirm->set_title(TTR("Remove Template"));
@ -690,7 +690,7 @@ ExportTemplateManager::ExportTemplateManager() {
template_downloader = memnew(AcceptDialog);
template_downloader->set_title(TTR("Download Templates"));
template_downloader->get_ok()->set_text(TTR("Close"));
template_downloader->get_ok_button()->set_text(TTR("Close"));
template_downloader->set_exclusive(true);
add_child(template_downloader);
template_downloader->connect("cancelled", callable_mp(this, &ExportTemplateManager::_window_template_downloader_closed));

View File

@ -2837,7 +2837,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
add_child(remove_dialog);
move_dialog = memnew(EditorDirDialog);
move_dialog->get_ok()->set_text(TTR("Move"));
move_dialog->get_ok_button()->set_text(TTR("Move"));
add_child(move_dialog);
move_dialog->connect("dir_selected", callable_mp(this, &FileSystemDock::_move_operation_confirm), make_binds(false));
@ -2847,13 +2847,13 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
rename_dialog_text = memnew(LineEdit);
rename_dialog_vb->add_margin_child(TTR("Name:"), rename_dialog_text);
rename_dialog->get_ok()->set_text(TTR("Rename"));
rename_dialog->get_ok_button()->set_text(TTR("Rename"));
add_child(rename_dialog);
rename_dialog->register_text_enter(rename_dialog_text);
rename_dialog->connect("confirmed", callable_mp(this, &FileSystemDock::_rename_operation_confirm));
overwrite_dialog = memnew(ConfirmationDialog);
overwrite_dialog->get_ok()->set_text(TTR("Overwrite"));
overwrite_dialog->get_ok_button()->set_text(TTR("Overwrite"));
add_child(overwrite_dialog);
overwrite_dialog->connect("confirmed", callable_mp(this, &FileSystemDock::_move_with_overwrite));
@ -2863,7 +2863,7 @@ FileSystemDock::FileSystemDock(EditorNode *p_editor) {
duplicate_dialog_text = memnew(LineEdit);
duplicate_dialog_vb->add_margin_child(TTR("Name:"), duplicate_dialog_text);
duplicate_dialog->get_ok()->set_text(TTR("Duplicate"));
duplicate_dialog->get_ok_button()->set_text(TTR("Duplicate"));
add_child(duplicate_dialog);
duplicate_dialog->register_text_enter(duplicate_dialog_text);
duplicate_dialog->connect("confirmed", callable_mp(this, &FileSystemDock::_duplicate_operation_confirm));

View File

@ -383,7 +383,7 @@ FindInFilesDialog::FindInFilesDialog() {
_replace_button = add_button(TTR("Replace..."), false, "replace");
_replace_button->set_disabled(true);
Button *cancel_button = get_ok();
Button *cancel_button = get_ok_button();
cancel_button->set_text(TTR("Cancel"));
_mode = SEARCH_MODE;

View File

@ -540,7 +540,7 @@ GroupDialog::GroupDialog() {
error = memnew(ConfirmationDialog);
add_child(error);
error->get_ok()->set_text(TTR("Close"));
error->get_ok_button()->set_text(TTR("Close"));
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -536,7 +536,7 @@ ImportDock::ImportDock() {
hb->add_spacer();
reimport_confirm = memnew(ConfirmationDialog);
reimport_confirm->get_ok()->set_text(TTR("Save Scenes, Re-Import, and Restart"));
reimport_confirm->get_ok_button()->set_text(TTR("Save Scenes, Re-Import, and Restart"));
add_child(reimport_confirm);
reimport_confirm->connect("confirmed", callable_mp(this, &ImportDock::_reimport_and_restart));

View File

@ -398,7 +398,7 @@ void InputMapEditor::_wait_for_key(const Ref<InputEvent> &p_event) {
const String str = (press_a_key_physical) ? keycode_get_string(k->get_physical_keycode_with_modifiers()) + TTR(" (Physical)") : keycode_get_string(k->get_keycode_with_modifiers());
press_a_key_label->set_text(str);
press_a_key->get_ok()->set_disabled(false);
press_a_key->get_ok_button()->set_disabled(false);
press_a_key->set_input_as_handled();
}
}
@ -432,7 +432,7 @@ void InputMapEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_event) {
case INPUT_KEY: {
press_a_key_physical = false;
press_a_key_label->set_text(TTR("Press a Key..."));
press_a_key->get_ok()->set_disabled(true);
press_a_key->get_ok_button()->set_disabled(true);
last_wait_for_key = Ref<InputEvent>();
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
//press_a_key->grab_focus();
@ -465,10 +465,10 @@ void InputMapEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_event) {
if (mb.is_valid()) {
device_index->select(mb->get_button_index() - 1);
_set_current_device(mb->get_device());
device_input->get_ok()->set_text(TTR("Change"));
device_input->get_ok_button()->set_text(TTR("Change"));
} else {
_set_current_device(0);
device_input->get_ok()->set_text(TTR("Add"));
device_input->get_ok_button()->set_text(TTR("Add"));
}
} break;
@ -488,10 +488,10 @@ void InputMapEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_event) {
if (jm.is_valid()) {
device_index->select(jm->get_axis() * 2 + (jm->get_axis_value() > 0 ? 1 : 0));
_set_current_device(jm->get_device());
device_input->get_ok()->set_text(TTR("Change"));
device_input->get_ok_button()->set_text(TTR("Change"));
} else {
_set_current_device(0);
device_input->get_ok()->set_text(TTR("Add"));
device_input->get_ok_button()->set_text(TTR("Add"));
}
} break;
@ -510,10 +510,10 @@ void InputMapEditor::_add_item(int p_item, Ref<InputEvent> p_exiting_event) {
if (jb.is_valid()) {
device_index->select(jb->get_button_index());
_set_current_device(jb->get_device());
device_input->get_ok()->set_text(TTR("Change"));
device_input->get_ok_button()->set_text(TTR("Change"));
} else {
_set_current_device(0);
device_input->get_ok()->set_text(TTR("Add"));
device_input->get_ok_button()->set_text(TTR("Add"));
}
} break;
@ -978,7 +978,7 @@ InputMapEditor::InputMapEditor() {
add_child(popup_add);
press_a_key = memnew(ConfirmationDialog);
press_a_key->get_ok()->set_disabled(true);
press_a_key->get_ok_button()->set_disabled(true);
//press_a_key->set_focus_mode(Control::FOCUS_ALL);
press_a_key->connect("window_input", callable_mp(this, &InputMapEditor::_wait_for_key));
press_a_key->connect("confirmed", callable_mp(this, &InputMapEditor::_press_a_key_confirm));
@ -994,7 +994,7 @@ InputMapEditor::InputMapEditor() {
press_a_key_label = l;
device_input = memnew(ConfirmationDialog);
device_input->get_ok()->set_text(TTR("Add"));
device_input->get_ok_button()->set_text(TTR("Add"));
device_input->connect("confirmed", callable_mp(this, &InputMapEditor::_device_input_add));
add_child(device_input);

View File

@ -126,7 +126,7 @@ void PluginConfigDialog::_on_cancelled() {
void PluginConfigDialog::_on_required_text_changed(const String &) {
int lang_idx = script_option_edit->get_selected();
String ext = ScriptServer::get_language(lang_idx)->get_extension();
get_ok()->set_disabled(script_edit->get_text().get_basename().empty() || script_edit->get_text().get_extension() != ext || name_edit->get_text().empty());
get_ok_button()->set_disabled(script_edit->get_text().get_basename().empty() || script_edit->get_text().get_extension() != ext || name_edit->get_text().empty());
}
void PluginConfigDialog::_notification(int p_what) {
@ -138,7 +138,7 @@ void PluginConfigDialog::_notification(int p_what) {
} break;
case NOTIFICATION_READY: {
connect("confirmed", callable_mp(this, &PluginConfigDialog::_on_confirmed));
get_cancel()->connect("pressed", callable_mp(this, &PluginConfigDialog::_on_cancelled));
get_cancel_button()->connect("pressed", callable_mp(this, &PluginConfigDialog::_on_cancelled));
} break;
}
}
@ -171,8 +171,8 @@ void PluginConfigDialog::config(const String &p_config_path) {
Object::cast_to<Label>(subfolder_edit->get_parent()->get_child(subfolder_edit->get_index() - 1))->show();
set_title(TTR("Create a Plugin"));
}
get_ok()->set_disabled(!_edit_mode);
get_ok()->set_text(_edit_mode ? TTR("Update") : TTR("Create"));
get_ok_button()->set_disabled(!_edit_mode);
get_ok_button()->set_text(_edit_mode ? TTR("Update") : TTR("Create"));
}
void PluginConfigDialog::_bind_methods() {
@ -180,7 +180,7 @@ void PluginConfigDialog::_bind_methods() {
}
PluginConfigDialog::PluginConfigDialog() {
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
set_hide_on_ok(true);
GridContainer *grid = memnew(GridContainer);

View File

@ -724,7 +724,7 @@ AbstractPolygon2DEditor::AbstractPolygon2DEditor(EditorNode *p_editor, bool p_wi
create_resource = memnew(ConfirmationDialog);
add_child(create_resource);
create_resource->get_ok()->set_text(TTR("Create"));
create_resource->get_ok_button()->set_text(TTR("Create"));
mode = MODE_EDIT;
}

View File

@ -1642,7 +1642,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
name_dialog->register_text_enter(name);
error_dialog = memnew(ConfirmationDialog);
error_dialog->get_ok()->set_text(TTR("Close"));
error_dialog->get_ok_button()->set_text(TTR("Close"));
error_dialog->set_title(TTR("Error!"));
add_child(error_dialog);
@ -1650,7 +1650,7 @@ AnimationPlayerEditor::AnimationPlayerEditor(EditorNode *p_editor, AnimationPlay
blend_editor.dialog = memnew(AcceptDialog);
add_child(blend_editor.dialog);
blend_editor.dialog->get_ok()->set_text(TTR("Close"));
blend_editor.dialog->get_ok_button()->set_text(TTR("Close"));
blend_editor.dialog->set_hide_on_ok(true);
VBoxContainer *blend_vb = memnew(VBoxContainer);
blend_editor.dialog->add_child(blend_vb);

View File

@ -295,8 +295,8 @@ EditorAssetLibraryItemDescription::EditorAssetLibraryItemDescription() {
preview_hb->set_v_size_flags(Control::SIZE_EXPAND_FILL);
previews->add_child(preview_hb);
get_ok()->set_text(TTR("Download"));
get_cancel()->set_text(TTR("Close"));
get_ok_button()->set_text(TTR("Download"));
get_cancel_button()->set_text(TTR("Close"));
}
///////////////////////////////////////////////////////////////////////////////////

View File

@ -213,7 +213,7 @@ GPUParticles3DEditorBase::GPUParticles3DEditorBase() {
emission_fill->add_item(TTR("Volume"));
emd_vb->add_margin_child(TTR("Emission Source: "), emission_fill);
emission_dialog->get_ok()->set_text(TTR("Create"));
emission_dialog->get_ok_button()->set_text(TTR("Create"));
emission_dialog->connect("confirmed", callable_mp(this, &GPUParticles3DEditorBase::_generate_emission_points));
emission_tree_dialog = memnew(SceneTreeDialog);

View File

@ -457,7 +457,7 @@ MeshInstance3DEditor::MeshInstance3DEditor() {
outline_dialog = memnew(ConfirmationDialog);
outline_dialog->set_title(TTR("Create Outline Mesh"));
outline_dialog->get_ok()->set_text(TTR("Create"));
outline_dialog->get_ok_button()->set_text(TTR("Create"));
VBoxContainer *outline_dialog_vbc = memnew(VBoxContainer);
outline_dialog->add_child(outline_dialog_vbc);

View File

@ -267,7 +267,7 @@ MeshLibraryEditor::MeshLibraryEditor(EditorNode *p_editor) {
editor = p_editor;
cd = memnew(ConfirmationDialog);
add_child(cd);
cd->get_ok()->connect("pressed", callable_mp(this, &MeshLibraryEditor::_menu_confirm));
cd->get_ok_button()->connect("pressed", callable_mp(this, &MeshLibraryEditor::_menu_confirm));
}
void MeshLibraryEditorPlugin::edit(Object *p_node) {

View File

@ -345,9 +345,9 @@ MultiMeshEditor::MultiMeshEditor() {
populate_amount->set_value(128);
vbc->add_margin_child(TTR("Amount:"), populate_amount);
populate_dialog->get_ok()->set_text(TTR("Populate"));
populate_dialog->get_ok_button()->set_text(TTR("Populate"));
populate_dialog->get_ok()->connect("pressed", callable_mp(this, &MultiMeshEditor::_populate));
populate_dialog->get_ok_button()->connect("pressed", callable_mp(this, &MultiMeshEditor::_populate));
std = memnew(SceneTreeDialog);
populate_dialog->add_child(std);
std->connect("selected", callable_mp(this, &MultiMeshEditor::_browsed));

View File

@ -6423,7 +6423,7 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) {
snap_dialog->set_title(TTR("Snap Settings"));
add_child(snap_dialog);
snap_dialog->connect("confirmed", callable_mp(this, &Node3DEditor::_snap_changed));
snap_dialog->get_cancel()->connect("pressed", callable_mp(this, &Node3DEditor::_snap_update));
snap_dialog->get_cancel_button()->connect("pressed", callable_mp(this, &Node3DEditor::_snap_update));
VBoxContainer *snap_dialog_vbc = memnew(VBoxContainer);
snap_dialog->add_child(snap_dialog_vbc);

View File

@ -62,7 +62,7 @@ void ResourcePreloaderEditor::_files_load_request(const Vector<String> &p_paths)
dialog->set_text(TTR("ERROR: Couldn't load resource!"));
dialog->set_title(TTR("Error!"));
//dialog->get_cancel()->set_text("Close");
dialog->get_ok()->set_text(TTR("Close"));
dialog->get_ok_button()->set_text(TTR("Close"));
dialog->popup_centered();
return; ///beh should show an error i guess
}
@ -144,7 +144,7 @@ void ResourcePreloaderEditor::_paste_pressed() {
if (!r.is_valid()) {
dialog->set_text(TTR("Resource clipboard is empty!"));
dialog->set_title(TTR("Error!"));
dialog->get_ok()->set_text(TTR("Close"));
dialog->get_ok_button()->set_text(TTR("Close"));
dialog->popup_centered();
return; ///beh should show an error i guess
}

View File

@ -338,7 +338,7 @@ void ScriptEditorQuickOpen::_update_search() {
}
}
get_ok()->set_disabled(root->get_children() == nullptr);
get_ok_button()->set_disabled(root->get_children() == nullptr);
}
void ScriptEditorQuickOpen::_confirmed() {
@ -382,8 +382,8 @@ ScriptEditorQuickOpen::ScriptEditorQuickOpen() {
search_box->connect("gui_input", callable_mp(this, &ScriptEditorQuickOpen::_sbox_input));
search_options = memnew(Tree);
vbc->add_margin_child(TTR("Matches:"), search_options, true);
get_ok()->set_text(TTR("Open"));
get_ok()->set_disabled(true);
get_ok_button()->set_text(TTR("Open"));
get_ok_button()->set_disabled(true);
register_text_enter(search_box);
set_hide_on_ok(false);
search_options->connect("item_activated", callable_mp(this, &ScriptEditorQuickOpen::_confirmed));
@ -3482,7 +3482,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
tab_container->connect("tab_changed", callable_mp(this, &ScriptEditor::_tab_changed));
erase_tab_confirm = memnew(ConfirmationDialog);
erase_tab_confirm->get_ok()->set_text(TTR("Save"));
erase_tab_confirm->get_ok_button()->set_text(TTR("Save"));
erase_tab_confirm->add_button(TTR("Discard"), DisplayServer::get_singleton()->get_swap_cancel_ok(), "discard");
erase_tab_confirm->connect("confirmed", callable_mp(this, &ScriptEditor::_close_current_tab));
erase_tab_confirm->connect("custom_action", callable_mp(this, &ScriptEditor::_close_discard_current_tab));
@ -3515,7 +3515,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
disk_changed_list->set_v_size_flags(SIZE_EXPAND_FILL);
disk_changed->connect("confirmed", callable_mp(this, &ScriptEditor::_reload_scripts));
disk_changed->get_ok()->set_text(TTR("Reload"));
disk_changed->get_ok_button()->set_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, &ScriptEditor::_resave_scripts));

View File

@ -661,7 +661,7 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
vbc->add_child(dl);
disk_changed->connect("confirmed", callable_mp(this, &ShaderEditor::_reload_shader_from_disk));
disk_changed->get_ok()->set_text(TTR("Reload"));
disk_changed->get_ok_button()->set_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, &ShaderEditor::save_external_data));

View File

@ -120,7 +120,7 @@ void Sprite2DEditor::_menu_option(int p_option) {
switch (p_option) {
case MENU_OPTION_CONVERT_TO_MESH_2D: {
debug_uv_dialog->get_ok()->set_text(TTR("Create Mesh2D"));
debug_uv_dialog->get_ok_button()->set_text(TTR("Create Mesh2D"));
debug_uv_dialog->set_title(TTR("Mesh2D Preview"));
_update_mesh_data();
@ -129,7 +129,7 @@ void Sprite2DEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_CONVERT_TO_POLYGON_2D: {
debug_uv_dialog->get_ok()->set_text(TTR("Create Polygon2D"));
debug_uv_dialog->get_ok_button()->set_text(TTR("Create Polygon2D"));
debug_uv_dialog->set_title(TTR("Polygon2D Preview"));
_update_mesh_data();
@ -137,7 +137,7 @@ void Sprite2DEditor::_menu_option(int p_option) {
debug_uv->update();
} break;
case MENU_OPTION_CREATE_COLLISION_POLY_2D: {
debug_uv_dialog->get_ok()->set_text(TTR("Create CollisionPolygon2D"));
debug_uv_dialog->get_ok_button()->set_text(TTR("Create CollisionPolygon2D"));
debug_uv_dialog->set_title(TTR("CollisionPolygon2D Preview"));
_update_mesh_data();
@ -146,7 +146,7 @@ void Sprite2DEditor::_menu_option(int p_option) {
} break;
case MENU_OPTION_CREATE_LIGHT_OCCLUDER_2D: {
debug_uv_dialog->get_ok()->set_text(TTR("Create LightOccluder2D"));
debug_uv_dialog->get_ok_button()->set_text(TTR("Create LightOccluder2D"));
debug_uv_dialog->set_title(TTR("LightOccluder2D Preview"));
_update_mesh_data();
@ -515,7 +515,7 @@ Sprite2DEditor::Sprite2DEditor() {
add_child(err_dialog);
debug_uv_dialog = memnew(ConfirmationDialog);
debug_uv_dialog->get_ok()->set_text(TTR("Create Mesh2D"));
debug_uv_dialog->get_ok_button()->set_text(TTR("Create Mesh2D"));
debug_uv_dialog->set_title("Mesh 2D Preview");
VBoxContainer *vb = memnew(VBoxContainer);
debug_uv_dialog->add_child(vb);

View File

@ -74,8 +74,8 @@ void SpriteFramesEditor::_sheet_preview_draw() {
}
if (frames_selected.size() == 0) {
split_sheet_dialog->get_ok()->set_disabled(true);
split_sheet_dialog->get_ok()->set_text(TTR("No Frames Selected"));
split_sheet_dialog->get_ok_button()->set_disabled(true);
split_sheet_dialog->get_ok_button()->set_text(TTR("No Frames Selected"));
return;
}
@ -97,8 +97,8 @@ void SpriteFramesEditor::_sheet_preview_draw() {
split_sheet_preview->draw_rect(Rect2(x + 5, y + 5, width - 10, height - 10), Color(0, 0, 0, 1), false);
}
split_sheet_dialog->get_ok()->set_disabled(false);
split_sheet_dialog->get_ok()->set_text(vformat(TTR("Add %d Frame(s)"), frames_selected.size()));
split_sheet_dialog->get_ok_button()->set_disabled(false);
split_sheet_dialog->get_ok_button()->set_text(vformat(TTR("Add %d Frame(s)"), frames_selected.size()));
}
void SpriteFramesEditor::_sheet_preview_input(const Ref<InputEvent> &p_event) {
@ -310,7 +310,7 @@ void SpriteFramesEditor::_file_load_request(const Vector<String> &p_path, int p_
dialog->set_title(TTR("Error!"));
//dialog->get_cancel()->set_text("Close");
dialog->get_ok()->set_text(TTR("Close"));
dialog->get_ok_button()->set_text(TTR("Close"));
dialog->popup_centered();
return; ///beh should show an error i guess
}
@ -361,7 +361,7 @@ void SpriteFramesEditor::_paste_pressed() {
dialog->set_text(TTR("Resource clipboard is empty or not a texture!"));
dialog->set_title(TTR("Error!"));
//dialog->get_cancel()->set_text("Close");
dialog->get_ok()->set_text(TTR("Close"));
dialog->get_ok_button()->set_text(TTR("Close"));
dialog->popup_centered();
return; ///beh should show an error i guess
}

View File

@ -556,7 +556,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
if (p_option == POPUP_ADD) { // Add.
add_del_dialog->set_title(TTR("Add Item"));
add_del_dialog->get_ok()->set_text(TTR("Add"));
add_del_dialog->get_ok_button()->set_text(TTR("Add"));
add_del_dialog->popup_centered(Size2(490, 85) * EDSCALE);
base_theme = Theme::get_default();
@ -564,7 +564,7 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
} else if (p_option == POPUP_CLASS_ADD) { // Add.
add_del_dialog->set_title(TTR("Add All Items"));
add_del_dialog->get_ok()->set_text(TTR("Add All"));
add_del_dialog->get_ok_button()->set_text(TTR("Add All"));
add_del_dialog->popup_centered(Size2(240, 85) * EDSCALE);
base_theme = Theme::get_default();
@ -576,14 +576,14 @@ void ThemeEditor::_theme_menu_cbk(int p_option) {
} else if (p_option == POPUP_REMOVE) {
add_del_dialog->set_title(TTR("Remove Item"));
add_del_dialog->get_ok()->set_text(TTR("Remove"));
add_del_dialog->get_ok_button()->set_text(TTR("Remove"));
add_del_dialog->popup_centered(Size2(490, 85) * EDSCALE);
base_theme = theme;
} else if (p_option == POPUP_CLASS_REMOVE) {
add_del_dialog->set_title(TTR("Remove All Items"));
add_del_dialog->get_ok()->set_text(TTR("Remove All"));
add_del_dialog->get_ok_button()->set_text(TTR("Remove All"));
add_del_dialog->popup_centered(Size2(240, 85) * EDSCALE);
base_theme = Theme::get_default();
@ -908,7 +908,7 @@ ThemeEditor::ThemeEditor() {
dialog_vbc->add_child(type_select);
add_del_dialog->get_ok()->connect("pressed", callable_mp(this, &ThemeEditor::_dialog_cbk));
add_del_dialog->get_ok_button()->connect("pressed", callable_mp(this, &ThemeEditor::_dialog_cbk));
file_dialog = memnew(EditorFileDialog);
file_dialog->add_filter("*.theme ; " + TTR("Theme File"));

View File

@ -357,7 +357,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
set_up_dialog->set_min_size(Size2(400, 100));
version_control_actions->add_child(set_up_dialog);
set_up_ok_button = set_up_dialog->get_ok();
set_up_ok_button = set_up_dialog->get_ok_button();
set_up_ok_button->set_text(TTR("Close"));
set_up_vbc = memnew(VBoxContainer);

View File

@ -1009,7 +1009,7 @@ String VisualShaderEditor::_get_description(int p_idx) {
void VisualShaderEditor::_update_options_menu() {
node_desc->set_text("");
members_dialog->get_ok()->set_disabled(true);
members_dialog->get_ok_button()->set_disabled(true);
members->clear();
TreeItem *root = members->create_item();
@ -2613,12 +2613,12 @@ void VisualShaderEditor::_member_selected() {
TreeItem *item = members->get_selected();
if (item != nullptr && item->has_meta("id")) {
members_dialog->get_ok()->set_disabled(false);
members_dialog->get_ok_button()->set_disabled(false);
highend_label->set_visible(add_options[item->get_meta("id")].highend);
node_desc->set_text(_get_description(item->get_meta("id")));
} else {
highend_label->set_visible(false);
members_dialog->get_ok()->set_disabled(true);
members_dialog->get_ok_button()->set_disabled(true);
node_desc->set_text("");
}
}
@ -3068,9 +3068,9 @@ VisualShaderEditor::VisualShaderEditor() {
members_dialog->set_title(TTR("Create Shader Node"));
members_dialog->set_exclusive(false);
members_dialog->add_child(members_vb);
members_dialog->get_ok()->set_text(TTR("Create"));
members_dialog->get_ok()->connect("pressed", callable_mp(this, &VisualShaderEditor::_member_create));
members_dialog->get_ok()->set_disabled(true);
members_dialog->get_ok_button()->set_text(TTR("Create"));
members_dialog->get_ok_button()->connect("pressed", callable_mp(this, &VisualShaderEditor::_member_create));
members_dialog->get_ok_button()->set_disabled(true);
members_dialog->connect("cancelled", callable_mp(this, &VisualShaderEditor::_member_cancel));
add_child(members_dialog);

View File

@ -262,13 +262,13 @@ void ProjectExportDialog::_edit_preset(int p_index) {
}
export_button->set_disabled(true);
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
} else {
export_error->hide();
export_templates_error->hide();
export_button->set_disabled(false);
get_ok()->set_disabled(false);
get_ok_button()->set_disabled(false);
}
custom_features->set_text(current->get_custom_features());
@ -586,7 +586,7 @@ void ProjectExportDialog::_delete_preset_confirm() {
int idx = presets->get_current();
_edit_preset(-1);
export_button->set_disabled(true);
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
EditorExport::get_singleton()->remove_export_preset(idx);
_update_presets();
}
@ -856,18 +856,18 @@ void ProjectExportDialog::_validate_export_path(const String &p_path) {
bool invalid_path = (p_path.get_file().get_basename() == "");
// Check if state change before needlessly messing with signals
if (invalid_path && export_project->get_ok()->is_disabled()) {
if (invalid_path && export_project->get_ok_button()->is_disabled()) {
return;
}
if (!invalid_path && !export_project->get_ok()->is_disabled()) {
if (!invalid_path && !export_project->get_ok_button()->is_disabled()) {
return;
}
if (invalid_path) {
export_project->get_ok()->set_disabled(true);
export_project->get_ok_button()->set_disabled(true);
export_project->get_line_edit()->disconnect("text_entered", Callable(export_project, "_file_entered"));
} else {
export_project->get_ok()->set_disabled(false);
export_project->get_ok_button()->set_disabled(false);
export_project->get_line_edit()->connect("text_entered", Callable(export_project, "_file_entered"));
}
}
@ -901,7 +901,7 @@ void ProjectExportDialog::_export_project() {
// FIXME: This is a hack, we should instead change EditorFileDialog to allow
// disabling validation by the "text_entered" signal.
if (!export_project->get_line_edit()->is_connected("text_entered", Callable(export_project, "_file_entered"))) {
export_project->get_ok()->set_disabled(false);
export_project->get_ok_button()->set_disabled(false);
export_project->get_line_edit()->connect("text_entered", Callable(export_project, "_file_entered"));
}
@ -1184,26 +1184,26 @@ ProjectExportDialog::ProjectExportDialog() {
delete_confirm = memnew(ConfirmationDialog);
add_child(delete_confirm);
delete_confirm->get_ok()->set_text(TTR("Delete"));
delete_confirm->get_ok_button()->set_text(TTR("Delete"));
delete_confirm->connect("confirmed", callable_mp(this, &ProjectExportDialog::_delete_preset_confirm));
// Export buttons, dialogs and errors.
updating = false;
get_cancel()->set_text(TTR("Close"));
get_ok()->set_text(TTR("Export PCK/Zip"));
get_cancel_button()->set_text(TTR("Close"));
get_ok_button()->set_text(TTR("Export PCK/Zip"));
export_button = add_button(TTR("Export Project"), !DisplayServer::get_singleton()->get_swap_cancel_ok(), "export");
export_button->connect("pressed", callable_mp(this, &ProjectExportDialog::_export_project));
// Disable initially before we select a valid preset
export_button->set_disabled(true);
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
export_all_dialog = memnew(ConfirmationDialog);
add_child(export_all_dialog);
export_all_dialog->set_title("Export All");
export_all_dialog->set_text(TTR("Export mode?"));
export_all_dialog->get_ok()->hide();
export_all_dialog->get_ok_button()->hide();
export_all_dialog->add_button(TTR("Debug"), true, "debug");
export_all_dialog->add_button(TTR("Release"), true, "release");
export_all_dialog->connect("custom_action", callable_mp(this, &ProjectExportDialog::_export_all_dialog_action));

View File

@ -160,7 +160,7 @@ private:
if (valid_path == "") {
set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
return "";
}
@ -174,7 +174,7 @@ private:
if (valid_install_path == "") {
set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR, INSTALL_PATH);
memdelete(d);
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
return "";
}
}
@ -189,7 +189,7 @@ private:
if (!pkg) {
set_message(TTR("Error opening package file (it's not in ZIP format)."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
unzClose(pkg);
return "";
}
@ -210,7 +210,7 @@ private:
if (ret == UNZ_END_OF_LIST_OF_FILE) {
set_message(TTR("Invalid \".zip\" project file; it doesn't contain a \"project.godot\" file."), MESSAGE_ERROR);
memdelete(d);
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
unzClose(pkg);
return "";
}
@ -237,7 +237,7 @@ private:
if (!is_folder_empty) {
set_message(TTR("Please choose an empty folder."), MESSAGE_WARNING, INSTALL_PATH);
memdelete(d);
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
return "";
}
@ -245,14 +245,14 @@ private:
set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR);
memdelete(d);
install_path_container->hide();
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
return "";
}
} else if (valid_path.ends_with("zip")) {
set_message(TTR("This directory already contains a Godot project."), MESSAGE_ERROR, INSTALL_PATH);
memdelete(d);
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
return "";
}
@ -277,7 +277,7 @@ private:
if (!is_folder_empty) {
set_message(TTR("The selected path is not empty. Choosing an empty folder is highly recommended."), MESSAGE_WARNING);
memdelete(d);
get_ok()->set_disabled(false);
get_ok_button()->set_disabled(false);
return valid_path;
}
}
@ -285,7 +285,7 @@ private:
set_message("");
set_message("", MESSAGE_SUCCESS, INSTALL_PATH);
memdelete(d);
get_ok()->set_disabled(false);
get_ok_button()->set_disabled(false);
return valid_path;
}
@ -320,14 +320,14 @@ private:
if (p.ends_with("project.godot")) {
p = p.get_base_dir();
install_path_container->hide();
get_ok()->set_disabled(false);
get_ok_button()->set_disabled(false);
} else if (p.ends_with(".zip")) {
install_path->set_text(p.get_base_dir());
install_path_container->show();
get_ok()->set_disabled(false);
get_ok_button()->set_disabled(false);
} else {
set_message(TTR("Please choose a \"project.godot\" or \".zip\" file."), MESSAGE_ERROR);
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
return;
}
}
@ -338,7 +338,7 @@ private:
if (p.ends_with(".zip")) {
install_path->call_deferred("grab_focus");
} else {
get_ok()->call_deferred("grab_focus");
get_ok_button()->call_deferred("grab_focus");
}
}
@ -346,14 +346,14 @@ private:
String sp = p_path.simplify_path();
project_path->set_text(sp);
_path_text_changed(sp);
get_ok()->call_deferred("grab_focus");
get_ok_button()->call_deferred("grab_focus");
}
void _install_path_selected(const String &p_path) {
String sp = p_path.simplify_path();
install_path->set_text(sp);
_path_text_changed(sp);
get_ok()->call_deferred("grab_focus");
get_ok_button()->call_deferred("grab_focus");
}
void _browse_path() {
@ -466,7 +466,7 @@ private:
ConfirmationDialog *cd = memnew(ConfirmationDialog);
cd->set_title(TTR("Warning: This folder is not empty"));
cd->set_text(TTR("You are about to create a Godot project in a non-empty folder.\nThe entire contents of this folder will be imported as project resources!\n\nAre you sure you wish to continue?"));
cd->get_ok()->connect("pressed", callable_mp(this, &ProjectDialog::_nonempty_confirmation_ok_pressed));
cd->get_ok_button()->connect("pressed", callable_mp(this, &ProjectDialog::_nonempty_confirmation_ok_pressed));
get_parent()->add_child(cd);
cd->popup_centered();
cd->grab_focus();
@ -684,14 +684,14 @@ public:
install_browse->hide();
set_title(TTR("Rename Project"));
get_ok()->set_text(TTR("Rename"));
get_ok_button()->set_text(TTR("Rename"));
name_container->show();
status_rect->hide();
msg->hide();
install_path_container->hide();
install_status_rect->hide();
rasterizer_container->hide();
get_ok()->set_disabled(false);
get_ok_button()->set_disabled(false);
ProjectSettings *current = memnew(ProjectSettings);
@ -700,7 +700,7 @@ public:
set_message(vformat(TTR("Couldn't load project.godot in project path (error %d). It may be missing or corrupted."), err), MESSAGE_ERROR);
status_rect->show();
msg->show();
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
} else if (current->has_setting("application/config/name")) {
String proj = current->get("application/config/name");
project_name->set_text(proj);
@ -738,7 +738,7 @@ public:
if (mode == MODE_IMPORT) {
set_title(TTR("Import Existing Project"));
get_ok()->set_text(TTR("Import & Edit"));
get_ok_button()->set_text(TTR("Import & Edit"));
name_container->hide();
install_path_container->hide();
rasterizer_container->hide();
@ -746,7 +746,7 @@ public:
} else if (mode == MODE_NEW) {
set_title(TTR("Create New Project"));
get_ok()->set_text(TTR("Create & Edit"));
get_ok_button()->set_text(TTR("Create & Edit"));
name_container->show();
install_path_container->hide();
rasterizer_container->show();
@ -755,7 +755,7 @@ public:
} else if (mode == MODE_INSTALL) {
set_title(TTR("Install Project:") + " " + zip_title);
get_ok()->set_text(TTR("Install & Edit"));
get_ok_button()->set_text(TTR("Install & Edit"));
project_name->set_text(zip_title);
name_container->show();
install_path_container->hide();
@ -2321,8 +2321,8 @@ void ProjectManager::_files_dropped(PackedStringArray p_files, int p_screen) {
memdelete(dir);
}
if (confirm) {
multi_scan_ask->get_ok()->disconnect("pressed", callable_mp(this, &ProjectManager::_scan_multiple_folders));
multi_scan_ask->get_ok()->connect("pressed", callable_mp(this, &ProjectManager::_scan_multiple_folders), varray(folders));
multi_scan_ask->get_ok_button()->disconnect("pressed", callable_mp(this, &ProjectManager::_scan_multiple_folders));
multi_scan_ask->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_scan_multiple_folders), varray(folders));
multi_scan_ask->set_text(
vformat(TTR("Are you sure to scan %s folders for existing Godot projects?\nThis could take a while."), folders.size()));
multi_scan_ask->popup_centered();
@ -2629,9 +2629,9 @@ ProjectManager::ProjectManager() {
{
// Dialogs
language_restart_ask = memnew(ConfirmationDialog);
language_restart_ask->get_ok()->set_text(TTR("Restart Now"));
language_restart_ask->get_ok()->connect("pressed", callable_mp(this, &ProjectManager::_restart_confirm));
language_restart_ask->get_cancel()->set_text(TTR("Continue"));
language_restart_ask->get_ok_button()->set_text(TTR("Restart Now"));
language_restart_ask->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_restart_confirm));
language_restart_ask->get_cancel_button()->set_text(TTR("Continue"));
add_child(language_restart_ask);
scan_dir = memnew(FileDialog);
@ -2643,31 +2643,31 @@ ProjectManager::ProjectManager() {
scan_dir->connect("dir_selected", callable_mp(this, &ProjectManager::_scan_begin));
erase_missing_ask = memnew(ConfirmationDialog);
erase_missing_ask->get_ok()->set_text(TTR("Remove All"));
erase_missing_ask->get_ok()->connect("pressed", callable_mp(this, &ProjectManager::_erase_missing_projects_confirm));
erase_missing_ask->get_ok_button()->set_text(TTR("Remove All"));
erase_missing_ask->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_erase_missing_projects_confirm));
add_child(erase_missing_ask);
erase_ask = memnew(ConfirmationDialog);
erase_ask->get_ok()->set_text(TTR("Remove"));
erase_ask->get_ok()->connect("pressed", callable_mp(this, &ProjectManager::_erase_project_confirm));
erase_ask->get_ok_button()->set_text(TTR("Remove"));
erase_ask->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_erase_project_confirm));
add_child(erase_ask);
multi_open_ask = memnew(ConfirmationDialog);
multi_open_ask->get_ok()->set_text(TTR("Edit"));
multi_open_ask->get_ok()->connect("pressed", callable_mp(this, &ProjectManager::_open_selected_projects));
multi_open_ask->get_ok_button()->set_text(TTR("Edit"));
multi_open_ask->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_open_selected_projects));
add_child(multi_open_ask);
multi_run_ask = memnew(ConfirmationDialog);
multi_run_ask->get_ok()->set_text(TTR("Run"));
multi_run_ask->get_ok()->connect("pressed", callable_mp(this, &ProjectManager::_run_project_confirm));
multi_run_ask->get_ok_button()->set_text(TTR("Run"));
multi_run_ask->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_run_project_confirm));
add_child(multi_run_ask);
multi_scan_ask = memnew(ConfirmationDialog);
multi_scan_ask->get_ok()->set_text(TTR("Scan"));
multi_scan_ask->get_ok_button()->set_text(TTR("Scan"));
add_child(multi_scan_ask);
ask_update_settings = memnew(ConfirmationDialog);
ask_update_settings->get_ok()->connect("pressed", callable_mp(this, &ProjectManager::_confirm_update_settings));
ask_update_settings->get_ok_button()->connect("pressed", callable_mp(this, &ProjectManager::_confirm_update_settings));
add_child(ask_update_settings);
npdialog = memnew(ProjectDialog);
@ -2684,7 +2684,7 @@ ProjectManager::ProjectManager() {
open_templates = memnew(ConfirmationDialog);
open_templates->set_text(TTR("You currently don't have any projects.\nWould you like to explore official example projects in the Asset Library?"));
open_templates->get_ok()->set_text(TTR("Open Asset Library"));
open_templates->get_ok_button()->set_text(TTR("Open Asset Library"));
open_templates->connect("confirmed", callable_mp(this, &ProjectManager::_open_asset_library));
add_child(open_templates);
}

View File

@ -478,6 +478,6 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
del_confirmation->connect("confirmed", callable_mp(this, &ProjectSettingsEditor::_delete_setting), varray(true));
add_child(del_confirmation);
get_ok()->set_text(TTR("Close"));
get_ok_button()->set_text(TTR("Close"));
set_hide_on_ok(true);
}

View File

@ -321,7 +321,7 @@ void PropertySelector::_update_search() {
}
}
get_ok()->set_disabled(root->get_children() == nullptr);
get_ok_button()->set_disabled(root->get_children() == nullptr);
}
void PropertySelector::_confirmed() {
@ -553,8 +553,8 @@ PropertySelector::PropertySelector() {
search_box->connect("gui_input", callable_mp(this, &PropertySelector::_sbox_input));
search_options = memnew(Tree);
vbc->add_margin_child(TTR("Matches:"), search_options, true);
get_ok()->set_text(TTR("Open"));
get_ok()->set_disabled(true);
get_ok_button()->set_text(TTR("Open"));
get_ok_button()->set_disabled(true);
register_text_enter(search_box);
set_hide_on_ok(false);
search_options->connect("item_activated", callable_mp(this, &PropertySelector::_confirmed));

View File

@ -107,11 +107,11 @@ void EditorQuickOpen::_update_search() {
to_select->set_as_cursor(0);
search_options->scroll_to_item(to_select);
get_ok()->set_disabled(false);
get_ok_button()->set_disabled(false);
} else {
search_options->deselect_all();
get_ok()->set_disabled(true);
get_ok_button()->set_disabled(true);
}
}
@ -256,6 +256,6 @@ EditorQuickOpen::EditorQuickOpen() {
search_options->add_theme_constant_override("draw_guides", 1);
vbc->add_margin_child(TTR("Matches:"), search_options, true);
get_ok()->set_text(TTR("Open"));
get_ok_button()->set_text(TTR("Open"));
set_hide_on_ok(false);
}

View File

@ -286,7 +286,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
// ---- Dialog related
set_min_size(Size2(383, 0));
get_ok()->set_text(TTR("Rename"));
get_ok_button()->set_text(TTR("Rename"));
Button *but_reset = add_button(TTR("Reset"));
eh.errfunc = _error_handler;

View File

@ -87,7 +87,7 @@ ReparentDialog::ReparentDialog() {
//cancel->connect("pressed", this,"_cancel");
get_ok()->set_text(TTR("Reparent"));
get_ok_button()->set_text(TTR("Reparent"));
}
ReparentDialog::~ReparentDialog() {

View File

@ -2982,7 +2982,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel
clear_inherit_confirm = memnew(ConfirmationDialog);
clear_inherit_confirm->set_text(TTR("Clear Inheritance? (No Undo!)"));
clear_inherit_confirm->get_ok()->set_text(TTR("Clear"));
clear_inherit_confirm->get_ok_button()->set_text(TTR("Clear"));
add_child(clear_inherit_confirm);
set_process_input(true);

View File

@ -522,7 +522,7 @@ void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) {
if (p_save) {
file_browse->set_file_mode(EditorFileDialog::FILE_MODE_SAVE_FILE);
file_browse->set_title(TTR("Open Script / Choose Location"));
file_browse->get_ok()->set_text(TTR("Open"));
file_browse->get_ok_button()->set_text(TTR("Open"));
} else {
file_browse->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
file_browse->set_title(TTR("Open Script"));
@ -686,7 +686,7 @@ void ScriptCreateDialog::_update_dialog() {
builtin_warning_label->set_visible(is_built_in);
if (is_built_in) {
get_ok()->set_text(TTR("Create"));
get_ok_button()->set_text(TTR("Create"));
parent_name->set_editable(true);
parent_search_button->set_disabled(false);
parent_browse_button->set_disabled(!can_inherit_from_file);
@ -694,7 +694,7 @@ void ScriptCreateDialog::_update_dialog() {
} else if (is_new_script_created) {
// New script created.
get_ok()->set_text(TTR("Create"));
get_ok_button()->set_text(TTR("Create"));
parent_name->set_editable(true);
parent_search_button->set_disabled(false);
parent_browse_button->set_disabled(!can_inherit_from_file);
@ -704,7 +704,7 @@ void ScriptCreateDialog::_update_dialog() {
} else if (load_enabled) {
// Script loaded.
get_ok()->set_text(TTR("Load"));
get_ok_button()->set_text(TTR("Load"));
parent_name->set_editable(false);
parent_search_button->set_disabled(true);
parent_browse_button->set_disabled(true);
@ -712,7 +712,7 @@ void ScriptCreateDialog::_update_dialog() {
_msg_path_valid(true, TTR("Will load an existing script file."));
}
} else {
get_ok()->set_text(TTR("Create"));
get_ok_button()->set_text(TTR("Create"));
parent_name->set_editable(true);
parent_search_button->set_disabled(false);
parent_browse_button->set_disabled(!can_inherit_from_file);
@ -721,7 +721,7 @@ void ScriptCreateDialog::_update_dialog() {
script_ok = false;
}
get_ok()->set_disabled(!script_ok);
get_ok_button()->set_disabled(!script_ok);
Callable entered_call = callable_mp(this, &ScriptCreateDialog::_path_entered);
if (script_ok) {
@ -878,7 +878,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
file_browse->connect("file_selected", callable_mp(this, &ScriptCreateDialog::_file_selected));
file_browse->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_FILE);
add_child(file_browse);
get_ok()->set_text(TTR("Create"));
get_ok_button()->set_text(TTR("Create"));
alert = memnew(AcceptDialog);
alert->get_label()->set_autowrap(true);
alert->get_label()->set_align(Label::ALIGN_CENTER);

View File

@ -275,8 +275,8 @@ void EditorSettingsDialog::_shortcut_button_pressed(Object *p_item, int p_column
last_wait_for_key = Ref<InputEventKey>();
press_a_key->popup_centered(Size2(250, 80) * EDSCALE);
//press_a_key->grab_focus();
press_a_key->get_ok()->set_focus_mode(Control::FOCUS_NONE);
press_a_key->get_cancel()->set_focus_mode(Control::FOCUS_NONE);
press_a_key->get_ok_button()->set_focus_mode(Control::FOCUS_NONE);
press_a_key->get_cancel_button()->set_focus_mode(Control::FOCUS_NONE);
shortcut_configured = item;
} else if (p_idx == 1) { //erase
@ -488,7 +488,7 @@ EditorSettingsDialog::EditorSettingsDialog() {
timer->set_one_shot(true);
add_child(timer);
EditorSettings::get_singleton()->connect("settings_changed", callable_mp(this, &EditorSettingsDialog::_settings_changed));
get_ok()->set_text(TTR("Close"));
get_ok_button()->set_text(TTR("Close"));
updating = false;
}

View File

@ -382,7 +382,7 @@ GDNativeLibraryEditor::GDNativeLibraryEditor() {
new_architecture_dialog->add_child(new_architecture_input);
// new_architecture_dialog->set_custom_minimum_size(Vector2(300, 80) * EDSCALE);
new_architecture_input->set_anchors_and_margins_preset(PRESET_HCENTER_WIDE, PRESET_MODE_MINSIZE, 5 * EDSCALE);
new_architecture_dialog->get_ok()->connect("pressed", callable_mp(this, &GDNativeLibraryEditor::_on_create_new_entry));
new_architecture_dialog->get_ok_button()->connect("pressed", callable_mp(this, &GDNativeLibraryEditor::_on_create_new_entry));
}
void GDNativeLibraryEditorPlugin::edit(Object *p_node) {

View File

@ -4858,8 +4858,8 @@ VisualScriptEditor::VisualScriptEditor() {
function_create_dialog = memnew(ConfirmationDialog);
function_create_dialog->set_title(TTR("Create Function"));
function_create_dialog->add_child(function_vb);
function_create_dialog->get_ok()->set_text(TTR("Create"));
function_create_dialog->get_ok()->connect("pressed", callable_mp(this, &VisualScriptEditor::_create_function));
function_create_dialog->get_ok_button()->set_text(TTR("Create"));
function_create_dialog->get_ok_button()->connect("pressed", callable_mp(this, &VisualScriptEditor::_create_function));
add_child(function_create_dialog);
select_func_text = memnew(Label);
@ -4902,7 +4902,7 @@ VisualScriptEditor::VisualScriptEditor() {
graph->connect("connection_to_empty", callable_mp(this, &VisualScriptEditor::_graph_connect_to_empty));
edit_signal_dialog = memnew(AcceptDialog);
edit_signal_dialog->get_ok()->set_text(TTR("Close"));
edit_signal_dialog->get_ok_button()->set_text(TTR("Close"));
add_child(edit_signal_dialog);
signal_editor = memnew(VisualScriptEditorSignalEdit);
@ -4912,7 +4912,7 @@ VisualScriptEditor::VisualScriptEditor() {
edit_signal_edit->edit(signal_editor);
edit_variable_dialog = memnew(AcceptDialog);
edit_variable_dialog->get_ok()->set_text(TTR("Close"));
edit_variable_dialog->get_ok_button()->set_text(TTR("Close"));
add_child(edit_variable_dialog);
variable_editor = memnew(VisualScriptEditorVariableEdit);
@ -4944,7 +4944,7 @@ VisualScriptEditor::VisualScriptEditor() {
new_connect_node_select = memnew(VisualScriptPropertySelector);
add_child(new_connect_node_select);
new_connect_node_select->connect("selected", callable_mp(this, &VisualScriptEditor::_selected_connect_node));
new_connect_node_select->get_cancel()->connect("pressed", callable_mp(this, &VisualScriptEditor::_cancel_connect_node));
new_connect_node_select->get_cancel_button()->connect("pressed", callable_mp(this, &VisualScriptEditor::_cancel_connect_node));
new_virtual_method_select = memnew(VisualScriptPropertySelector);
add_child(new_virtual_method_select);

View File

@ -310,7 +310,7 @@ void VisualScriptPropertySelector::_update_search() {
found = true;
}
get_ok()->set_disabled(root->get_children() == nullptr);
get_ok_button()->set_disabled(root->get_children() == nullptr);
}
void VisualScriptPropertySelector::create_visualscript_item(const String &name, TreeItem *const root, const String &search_input, const String &text) {
@ -705,8 +705,8 @@ VisualScriptPropertySelector::VisualScriptPropertySelector() {
search_box->connect("gui_input", callable_mp(this, &VisualScriptPropertySelector::_sbox_input));
search_options = memnew(Tree);
vbc->add_margin_child(TTR("Matches:"), search_options, true);
get_ok()->set_text(TTR("Open"));
get_ok()->set_disabled(true);
get_ok_button()->set_text(TTR("Open"));
get_ok_button()->set_disabled(true);
register_text_enter(search_box);
set_hide_on_ok(false);
search_options->connect("item_activated", callable_mp(this, &VisualScriptPropertySelector::_confirmed));

View File

@ -60,7 +60,7 @@ void AcceptDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_VISIBILITY_CHANGED: {
if (is_visible()) {
get_ok()->grab_focus();
get_ok_button()->grab_focus();
_update_child_rects();
parent_visible = get_parent_visible_window();
if (parent_visible) {
@ -253,7 +253,7 @@ Button *AcceptDialog::add_button(const String &p_text, bool p_right, const Strin
return button;
}
Button *AcceptDialog::add_cancel(const String &p_cancel) {
Button *AcceptDialog::add_cancel_button(const String &p_cancel) {
String c = p_cancel;
if (p_cancel == "") {
c = RTR("Cancel");
@ -264,12 +264,12 @@ Button *AcceptDialog::add_cancel(const String &p_cancel) {
}
void AcceptDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_ok"), &AcceptDialog::get_ok);
ClassDB::bind_method(D_METHOD("get_ok_button"), &AcceptDialog::get_ok_button);
ClassDB::bind_method(D_METHOD("get_label"), &AcceptDialog::get_label);
ClassDB::bind_method(D_METHOD("set_hide_on_ok", "enabled"), &AcceptDialog::set_hide_on_ok);
ClassDB::bind_method(D_METHOD("get_hide_on_ok"), &AcceptDialog::get_hide_on_ok);
ClassDB::bind_method(D_METHOD("add_button", "text", "right", "action"), &AcceptDialog::add_button, DEFVAL(false), DEFVAL(""));
ClassDB::bind_method(D_METHOD("add_cancel", "name"), &AcceptDialog::add_cancel);
ClassDB::bind_method(D_METHOD("add_cancel_button", "name"), &AcceptDialog::add_cancel_button);
ClassDB::bind_method(D_METHOD("register_text_enter", "line_edit"), &AcceptDialog::register_text_enter);
ClassDB::bind_method(D_METHOD("set_text", "text"), &AcceptDialog::set_text);
ClassDB::bind_method(D_METHOD("get_text"), &AcceptDialog::get_text);
@ -337,10 +337,10 @@ AcceptDialog::~AcceptDialog() {
// ConfirmationDialog
void ConfirmationDialog::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_cancel"), &ConfirmationDialog::get_cancel);
ClassDB::bind_method(D_METHOD("get_cancel_button"), &ConfirmationDialog::get_cancel_button);
}
Button *ConfirmationDialog::get_cancel() {
Button *ConfirmationDialog::get_cancel_button() {
return cancel;
}
@ -349,5 +349,5 @@ ConfirmationDialog::ConfirmationDialog() {
#ifdef TOOLS_ENABLED
set_min_size(Size2(200, 70) * EDSCALE);
#endif
cancel = add_cancel();
cancel = add_cancel_button();
}

View File

@ -79,9 +79,9 @@ public:
void register_text_enter(Node *p_line_edit);
Button *get_ok() { return ok; }
Button *get_ok_button() { return ok; }
Button *add_button(const String &p_text, bool p_right = false, const String &p_action = "");
Button *add_cancel(const String &p_cancel = "");
Button *add_cancel_button(const String &p_cancel = "");
void set_hide_on_ok(bool p_hide);
bool get_hide_on_ok() const;
@ -104,7 +104,7 @@ protected:
static void _bind_methods();
public:
Button *get_cancel();
Button *get_cancel_button();
ConfirmationDialog();
};

View File

@ -324,15 +324,15 @@ void FileDialog::deselect_items() {
// And change get_ok title.
if (!tree->is_anything_selected()) {
get_ok()->set_disabled(_is_open_should_be_disabled());
get_ok_button()->set_disabled(_is_open_should_be_disabled());
switch (mode) {
case FILE_MODE_OPEN_FILE:
case FILE_MODE_OPEN_FILES:
get_ok()->set_text(RTR("Open"));
get_ok_button()->set_text(RTR("Open"));
break;
case FILE_MODE_OPEN_DIR:
get_ok()->set_text(RTR("Select Current Folder"));
get_ok_button()->set_text(RTR("Select Current Folder"));
break;
case FILE_MODE_OPEN_ANY:
case FILE_MODE_SAVE_FILE:
@ -356,10 +356,10 @@ void FileDialog::_tree_selected() {
if (!d["dir"]) {
file->set_text(d["name"]);
} else if (mode == FILE_MODE_OPEN_DIR) {
get_ok()->set_text(RTR("Select This Folder"));
get_ok_button()->set_text(RTR("Select This Folder"));
}
get_ok()->set_disabled(_is_open_should_be_disabled());
get_ok_button()->set_disabled(_is_open_should_be_disabled());
}
void FileDialog::_tree_item_activated() {
@ -646,35 +646,35 @@ void FileDialog::set_file_mode(FileMode p_mode) {
mode = p_mode;
switch (mode) {
case FILE_MODE_OPEN_FILE:
get_ok()->set_text(RTR("Open"));
get_ok_button()->set_text(RTR("Open"));
if (mode_overrides_title) {
set_title(RTR("Open a File"));
}
makedir->hide();
break;
case FILE_MODE_OPEN_FILES:
get_ok()->set_text(RTR("Open"));
get_ok_button()->set_text(RTR("Open"));
if (mode_overrides_title) {
set_title(RTR("Open File(s)"));
}
makedir->hide();
break;
case FILE_MODE_OPEN_DIR:
get_ok()->set_text(RTR("Select Current Folder"));
get_ok_button()->set_text(RTR("Select Current Folder"));
if (mode_overrides_title) {
set_title(RTR("Open a Directory"));
}
makedir->show();
break;
case FILE_MODE_OPEN_ANY:
get_ok()->set_text(RTR("Open"));
get_ok_button()->set_text(RTR("Open"));
if (mode_overrides_title) {
set_title(RTR("Open a File or Directory"));
}
makedir->show();
break;
case FILE_MODE_SAVE_FILE:
get_ok()->set_text(RTR("Save"));
get_ok_button()->set_text(RTR("Save"));
if (mode_overrides_title) {
set_title(RTR("Save a File"));
}