summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Haas <Hinsbart@users.noreply.github.com>2017-10-28 10:42:59 +0200
committerGitHub <noreply@github.com>2017-10-28 10:42:59 +0200
commit8f2a4cc6a722d99e36dccca528e9dac8c65b3ac3 (patch)
tree4c54db24f578096fc414de4cf5ed792e98e01031
parent0c043bc25785f4f9988033848a282ba17afe5b22 (diff)
parent9449a34f4f7bf94576778bb29eb19af73f80b3c5 (diff)
Merge pull request #12449 from Noshyaar/ab
ProjectSettings: show error msg in a label instead
-rw-r--r--editor/project_settings_editor.cpp18
-rw-r--r--editor/project_settings_editor.h1
2 files changed, 15 insertions, 4 deletions
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 1284788425..3f79d00f80 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -81,6 +81,8 @@ void ProjectSettingsEditor::_notification(int p_what) {
search_button->set_icon(get_icon("Search", "EditorIcons"));
clear_button->set_icon(get_icon("Close", "EditorIcons"));
+ action_add_error->add_color_override("font_color", get_color("error_color", "Editor"));
+
translation_list->connect("button_pressed", this, "_translation_delete");
_update_actions();
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,12 +821,16 @@ void ProjectSettingsEditor::_action_check(String p_action) {
} else {
if (p_action.find("/") != -1 || p_action.find(":") != -1) {
- action_add->set_text(TTR("Can't contain '/' or ':'"));
+
+ action_add_error->set_text(TTR("Can't contain '/' or ':'"));
+ action_add_error->show();
action_add->set_disabled(true);
return;
}
if (ProjectSettings::get_singleton()->has_setting("input/" + p_action)) {
- action_add->set_text(TTR("Already existing"));
+
+ action_add_error->set_text(TTR("Already existing"));
+ action_add_error->show();
action_add->set_disabled(true);
return;
}
@@ -832,7 +838,7 @@ void ProjectSettingsEditor::_action_check(String p_action) {
action_add->set_disabled(false);
}
- action_add->set_text(TTR("Add"));
+ action_add_error->hide();
}
void ProjectSettingsEditor::_action_adds(String) {
@@ -869,7 +875,7 @@ void ProjectSettingsEditor::_action_add() {
return;
r->select(0);
input_editor->ensure_cursor_is_visible();
- action_add->set_text(TTR("Add"));
+ action_add_error->hide();
}
void ProjectSettingsEditor::_item_checked(const String &p_item, bool p_check) {
@@ -1696,6 +1702,10 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
action_name->connect("text_entered", this, "_action_adds");
action_name->connect("text_changed", this, "_action_check");
+ action_add_error = memnew(Label);
+ hbc->add_child(action_add_error);
+ action_add_error->hide();
+
add = memnew(Button);
hbc->add_child(add);
add->set_custom_minimum_size(Size2(150, 0) * EDSCALE);
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index a86cfee813..dbca158133 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -86,6 +86,7 @@ class ProjectSettingsEditor : public AcceptDialog {
LineEdit *action_name;
Button *action_add;
+ Label *action_add_error;
Tree *input_editor;
bool setting;
bool updating_translations;