Minor visual improvements to the "Batch Rename" dialog

(cherry picked from commit 25d18e3491)
This commit is contained in:
Michael Alexsander 2020-08-14 15:57:07 -03:00 committed by Rémi Verschelde
parent 8bdfba790b
commit 5f430b4fb1
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -62,18 +62,16 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
// ---- 1st & 2nd row // ---- 1st & 2nd row
Label *lbl_search = memnew(Label); Label *lbl_search = memnew(Label);
lbl_search->set_text(TTR("Search")); lbl_search->set_text(TTR("Search:"));
lne_search = memnew(LineEdit); lne_search = memnew(LineEdit);
lne_search->set_placeholder(TTR("Search"));
lne_search->set_name("lne_search"); lne_search->set_name("lne_search");
lne_search->set_h_size_flags(SIZE_EXPAND_FILL); lne_search->set_h_size_flags(SIZE_EXPAND_FILL);
Label *lbl_replace = memnew(Label); Label *lbl_replace = memnew(Label);
lbl_replace->set_text(TTR("Replace")); lbl_replace->set_text(TTR("Replace:"));
lne_replace = memnew(LineEdit); lne_replace = memnew(LineEdit);
lne_replace->set_placeholder(TTR("Replace"));
lne_replace->set_name("lne_replace"); lne_replace->set_name("lne_replace");
lne_replace->set_h_size_flags(SIZE_EXPAND_FILL); lne_replace->set_h_size_flags(SIZE_EXPAND_FILL);
@ -85,18 +83,16 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
// ---- 3rd & 4th row // ---- 3rd & 4th row
Label *lbl_prefix = memnew(Label); Label *lbl_prefix = memnew(Label);
lbl_prefix->set_text(TTR("Prefix")); lbl_prefix->set_text(TTR("Prefix:"));
lne_prefix = memnew(LineEdit); lne_prefix = memnew(LineEdit);
lne_prefix->set_placeholder(TTR("Prefix"));
lne_prefix->set_name("lne_prefix"); lne_prefix->set_name("lne_prefix");
lne_prefix->set_h_size_flags(SIZE_EXPAND_FILL); lne_prefix->set_h_size_flags(SIZE_EXPAND_FILL);
Label *lbl_suffix = memnew(Label); Label *lbl_suffix = memnew(Label);
lbl_suffix->set_text(TTR("Suffix")); lbl_suffix->set_text(TTR("Suffix:"));
lne_suffix = memnew(LineEdit); lne_suffix = memnew(LineEdit);
lne_suffix->set_placeholder(TTR("Suffix"));
lne_suffix->set_name("lne_suffix"); lne_suffix->set_name("lne_suffix");
lne_suffix->set_h_size_flags(SIZE_EXPAND_FILL); lne_suffix->set_h_size_flags(SIZE_EXPAND_FILL);
@ -107,8 +103,6 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
// -- Feature Tabs // -- Feature Tabs
const int feature_min_height = 160 * EDSCALE;
cbut_regex = memnew(CheckButton); cbut_regex = memnew(CheckButton);
cbut_regex->set_text(TTR("Use Regular Expressions")); cbut_regex->set_text(TTR("Use Regular Expressions"));
vbc->add_child(cbut_regex); vbc->add_child(cbut_regex);
@ -119,13 +113,13 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
tabc_features = memnew(TabContainer); tabc_features = memnew(TabContainer);
tabc_features->set_tab_align(TabContainer::ALIGN_LEFT); tabc_features->set_tab_align(TabContainer::ALIGN_LEFT);
tabc_features->set_use_hidden_tabs_for_min_size(true);
vbc->add_child(tabc_features); vbc->add_child(tabc_features);
// ---- Tab Substitute // ---- Tab Substitute
VBoxContainer *vbc_substitute = memnew(VBoxContainer); VBoxContainer *vbc_substitute = memnew(VBoxContainer);
vbc_substitute->set_h_size_flags(SIZE_EXPAND_FILL); vbc_substitute->set_h_size_flags(SIZE_EXPAND_FILL);
vbc_substitute->set_custom_minimum_size(Size2(0, feature_min_height));
vbc_substitute->set_name(TTR("Substitute")); vbc_substitute->set_name(TTR("Substitute"));
tabc_features->add_child(vbc_substitute); tabc_features->add_child(vbc_substitute);
@ -200,7 +194,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
chk_per_level_counter = memnew(CheckBox); chk_per_level_counter = memnew(CheckBox);
chk_per_level_counter->set_text(TTR("Per-level Counter")); chk_per_level_counter->set_text(TTR("Per-level Counter"));
chk_per_level_counter->set_tooltip(TTR("If set the counter restarts for each group of child nodes")); chk_per_level_counter->set_tooltip(TTR("If set, the counter restarts for each group of child nodes."));
vbc_substitute->add_child(chk_per_level_counter); vbc_substitute->add_child(chk_per_level_counter);
HBoxContainer *hbc_count_options = memnew(HBoxContainer); HBoxContainer *hbc_count_options = memnew(HBoxContainer);
@ -242,7 +236,6 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
VBoxContainer *vbc_process = memnew(VBoxContainer); VBoxContainer *vbc_process = memnew(VBoxContainer);
vbc_process->set_h_size_flags(SIZE_EXPAND_FILL); vbc_process->set_h_size_flags(SIZE_EXPAND_FILL);
vbc_process->set_name(TTR("Post-Process")); vbc_process->set_name(TTR("Post-Process"));
vbc_process->set_custom_minimum_size(Size2(0, feature_min_height));
tabc_features->add_child(vbc_process); tabc_features->add_child(vbc_process);
cbut_process = memnew(CheckBox); cbut_process = memnew(CheckBox);
@ -286,12 +279,9 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
vbc->add_child(sep_preview); vbc->add_child(sep_preview);
lbl_preview_title = memnew(Label); lbl_preview_title = memnew(Label);
lbl_preview_title->set_text(TTR("Preview"));
vbc->add_child(lbl_preview_title); vbc->add_child(lbl_preview_title);
lbl_preview = memnew(Label); lbl_preview = memnew(Label);
lbl_preview->set_text("");
lbl_preview->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
vbc->add_child(lbl_preview); vbc->add_child(lbl_preview);
// ---- Dialog related // ---- Dialog related
@ -308,7 +298,7 @@ RenameDialog::RenameDialog(SceneTreeEditor *p_scene_tree_editor, UndoRedo *p_und
cbut_collapse_features->connect("toggled", this, "_features_toggled"); cbut_collapse_features->connect("toggled", this, "_features_toggled");
// Substitite Buttons // Substitute Buttons
lne_search->connect("focus_entered", this, "_update_substitute"); lne_search->connect("focus_entered", this, "_update_substitute");
lne_search->connect("focus_exited", this, "_update_substitute"); lne_search->connect("focus_exited", this, "_update_substitute");
@ -402,7 +392,7 @@ void RenameDialog::_update_preview(String new_text) {
if (!has_errors) { if (!has_errors) {
lbl_preview_title->set_text(TTR("Preview")); lbl_preview_title->set_text(TTR("Preview:"));
lbl_preview->set_text(new_name); lbl_preview->set_text(new_name);
if (new_name == preview_node->get_name()) { if (new_name == preview_node->get_name()) {
@ -496,7 +486,7 @@ void RenameDialog::_error_handler(void *p_self, const char *p_func, const char *
} }
self->has_errors = true; self->has_errors = true;
self->lbl_preview_title->set_text(TTR("Regular Expression Error")); self->lbl_preview_title->set_text(TTR("Regular Expression Error:"));
self->lbl_preview->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor")); self->lbl_preview->add_color_override("font_color", EditorNode::get_singleton()->get_gui_base()->get_color("error_color", "Editor"));
self->lbl_preview->set_text(vformat(TTR("At character %s"), err_str)); self->lbl_preview->set_text(vformat(TTR("At character %s"), err_str));
} }