8000 Merge pull request #12449 from Noshyaar/ab · cooperra/godot@8f2a4cc · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 8f2a4cc

Browse files
author
Andreas Haas
authored
Merge pull request godotengine#12449 from Noshyaar/ab
ProjectSettings: show error msg in a label instead
2 parents 0c043bc + 9449a34 commit 8f2a4cc

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

editor/project_settings_editor.cpp

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,8 @@ void ProjectSettingsEditor::_notification(int p_what) {
8181
search_button->set_icon(get_icon("Search", "EditorIcons"));
8282
clear_button->set_icon(get_icon("Close", "EditorIcons"));
8383

84+
action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
85+
8486
translation_list->connect("button_pressed", this, "_translation_delete");
8587
_update_actions();
8688
popup_add->add_icon_item(get_icon("Keyboard", "EditorIcons"), TTR("Key "), INPUT_KEY); //"Key " - because the word 'key' has already been used as a key animation
@@ -819,20 +821,24 @@ void ProjectSettingsEditor::_action_check(String p_action) {
819821
} else {
820822

821823
if (p_action.find("/") != -1 || p_action.find(":") != -1) {
822-
action_add->set_text(TTR("Can't contain '/' or ':'"));
824+
825+
action_add_error->set_text(TTR("Can't contain '/' or ':'"));
826+
action_add_error->show();
823827
action_add->set_disabled(true);
824828
return;
825829
}
826830
if (ProjectSettings::get_singleton()->has_setting("input/" + p_action)) {
827-
action_add->set_text(TTR("Already existing"));
831+
832+
action_add_error->set_text(TTR("Already existing"));
833+
action_add_error->show();
828834
action_add->set_disabled(true);
829835
return;
830836
}
831837

832838
action_add->set_disabled(false);
833839
}
834840

835-
action_add->set_text(TTR("Add"));
841+
action_add_error->hide();
836842
}
837843

838844
void ProjectSettingsEditor::_action_adds(String) {
@@ -869,7 +875,7 @@ void ProjectSettingsEditor::_action_add() {
869875
return;
870876
r->select(0);
871877
input_editor->ensure_cursor_is_visible();
872-
action_add->set_text(TTR("Add"));
878+
action_add_error->hide();
873879
}
874880

875881
void ProjectSettingsEditor::_item_checked(const String &p_item, bool p_check) {
@@ -1696,6 +1702,10 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
CA9B
16961702
action_name->connect("text_entered", this, "_action_adds");
16971703
action_name->connect("text_changed", this, "_action_check");
16981704

1705+
action_add_error = memnew(Label);
1706+
hbc->add_child(action_add_error);
1707+
action_add_error->hide();
1708+
16991709
add = memnew(Button);
17001710
hbc->add_child(add);
17011711
add->set_custom_minimum_size(Size2(150, 0) * EDSCALE);

editor/project_settings_editor.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ class ProjectSettingsEditor : public AcceptDialog {
8686

8787
LineEdit *action_name;
8888
Button *action_add;
89+
Label *action_add_error;
8990
Tree *input_editor;
9091
bool setting;
9192
bool updating_translations;

0 commit comments

Comments
 (0)
0