Fixed "Attach Script" dialog's file dialog labeling.

This commit is contained in:
Michael Alexsander Silva Dias 2018-01-10 00:10:55 -02:00
parent 2ac27608a6
commit 4b8387dd92
2 changed files with 14 additions and 5 deletions

View file

@ -303,11 +303,19 @@ void ScriptCreateDialog::_built_in_pressed() {
_update_dialog(); _update_dialog();
} }
void ScriptCreateDialog::_browse_path(bool browse_parent) { void ScriptCreateDialog::_browse_path(bool browse_parent, bool p_save) {
is_browsing_parent = browse_parent; is_browsing_parent = browse_parent;
if (p_save) {
file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE); file_browse->set_mode(EditorFileDialog::MODE_SAVE_FILE);
file_browse->set_title(TTR("Open Script/Choose Location"));
file_browse->get_ok()->set_text(TTR("Open"));
} else {
file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE);
file_browse->set_title(TTR("Open Script"));
}
file_browse->set_disable_overwrite_warning(true); file_browse->set_disable_overwrite_warning(true);
file_browse->clear_filters(); file_browse->clear_filters();
List<String> extensions; List<String> extensions;
@ -678,7 +686,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
hb->add_child(parent_name); hb->add_child(parent_name);
parent_browse_button = memnew(Button); parent_browse_button = memnew(Button);
parent_browse_button->set_flat(true); parent_browse_button->set_flat(true);
parent_browse_button->connect("pressed", this, "_browse_path", varray(true)); parent_browse_button->connect("pressed", this, "_browse_path", varray(true, false));
hb->add_child(parent_browse_button); hb->add_child(parent_browse_button);
l = memnew(Label); l = memnew(Label);
l->set_text(TTR("Inherits")); l->set_text(TTR("Inherits"));
@ -730,7 +738,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
hb->add_child(file_path); hb->add_child(file_path);
path_button = memnew(Button); path_button = memnew(Button);
path_button->set_flat(true); path_button->set_flat(true);
path_button->connect("pressed", this, "_browse_path", varray(false)); path_button->connect("pressed", this, "_browse_path", varray(false, true));
hb->add_child(path_button); hb->add_child(path_button);
l = memnew(Label); l = memnew(Label);
l->set_text(TTR("Path")); l->set_text(TTR("Path"));
@ -742,6 +750,7 @@ ScriptCreateDialog::ScriptCreateDialog() {
file_browse = memnew(EditorFileDialog); file_browse = memnew(EditorFileDialog);
file_browse->connect("file_selected", this, "_file_selected"); file_browse->connect("file_selected", this, "_file_selected");
file_browse->set_mode(EditorFileDialog::MODE_OPEN_FILE);
add_child(file_browse); add_child(file_browse);
get_ok()->set_text(TTR("Create")); get_ok()->set_text(TTR("Create"));
alert = memnew(AcceptDialog); alert = memnew(AcceptDialog);

View file

@ -81,7 +81,7 @@ class ScriptCreateDialog : public ConfirmationDialog {
void _class_name_changed(const String &p_name); void _class_name_changed(const String &p_name);
void _parent_name_changed(const String &p_parent); void _parent_name_changed(const String &p_parent);
void _template_changed(int p_template = 0); void _template_changed(int p_template = 0);
void _browse_path(bool browse_parent); void _browse_path(bool browse_parent, bool p_save);
void _file_selected(const String &p_file); void _file_selected(const String &p_file);
virtual void ok_pressed(); virtual void ok_pressed();
void _create_new(); void _create_new();