Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename AcceptDialog get_ok() to get_ok_button() #44389

Merged
merged 1 commit into from
Dec 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions doc/classes/AcceptDialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand All @@ -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>
Expand Down Expand Up @@ -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">
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/ConfirmationDialog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<tutorials>
</tutorials>
<methods>
<method name="get_cancel">
<method name="get_cancel_button">
<return type="Button">
</return>
<description>
Expand Down
8 changes: 4 additions & 4 deletions editor/animation_track_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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));

//
Expand All @@ -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));

Expand All @@ -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);
Expand Down
10 changes: 5 additions & 5 deletions editor/connections_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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() {
Expand Down
8 changes: 4 additions & 4 deletions editor/create_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
}
Expand Down Expand Up @@ -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() {
Expand Down
8 changes: 4 additions & 4 deletions editor/dependency_editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_asset_installer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion editor/editor_dir_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 1 addition & 1 deletion editor/editor_feature_profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
32 changes: 16 additions & 16 deletions editor/editor_file_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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) {
Expand All @@ -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() {
Expand All @@ -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:
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down
10 changes: 5 additions & 5 deletions editor/editor_help_search.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
}

Expand Down
Loading