summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2022-01-16 10:59:02 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2022-01-16 14:49:03 +0300
commit5003d4351ef8a059da0358a5205ca1fc608fd4ff (patch)
tree02a4e5efead339bdb43862362664bd980360ab00 /editor
parent1cff9a2e49d42187d4e3729cddbaf7fdbcced0bd (diff)
Fix theming update in several editor classes
Diffstat (limited to 'editor')
-rw-r--r--editor/connections_dialog.cpp11
-rw-r--r--editor/create_dialog.cpp13
-rw-r--r--editor/create_dialog.h2
-rw-r--r--editor/editor_log.cpp2
-rw-r--r--editor/groups_editor.cpp3
-rw-r--r--editor/plugins/asset_library_editor_plugin.cpp26
-rw-r--r--editor/project_settings_editor.cpp26
-rw-r--r--editor/project_settings_editor.h1
-rw-r--r--editor/scene_tree_editor.cpp11
-rw-r--r--editor/scene_tree_editor.h1
10 files changed, 59 insertions, 37 deletions
diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp
index 0edbb182e1..c23fd6a943 100644
--- a/editor/connections_dialog.cpp
+++ b/editor/connections_dialog.cpp
@@ -922,8 +922,14 @@ void ConnectionsDock::_connect_pressed() {
}
void ConnectionsDock::_notification(int p_what) {
- if (p_what == EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED) {
- update_tree();
+ switch (p_what) {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
+ search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
+ } break;
+ case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
+ update_tree();
+ } break;
}
}
@@ -1135,7 +1141,6 @@ ConnectionsDock::ConnectionsDock(EditorNode *p_editor) {
search_box = memnew(LineEdit);
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
search_box->set_placeholder(TTR("Filter signals"));
- search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
search_box->set_clear_button_enabled(true);
search_box->connect("text_changed", callable_mp(this, &ConnectionsDock::_filter_changed));
vbc->add_child(search_box);
diff --git a/editor/create_dialog.cpp b/editor/create_dialog.cpp
index 608eab9a9f..f6b073da3e 100644
--- a/editor/create_dialog.cpp
+++ b/editor/create_dialog.cpp
@@ -367,13 +367,16 @@ void CreateDialog::_sbox_input(const Ref<InputEvent> &p_ie) {
}
}
+void CreateDialog::_update_theme() {
+ search_box->set_right_icon(search_options->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
+ favorite->set_icon(search_options->get_theme_icon(SNAME("Favorites"), SNAME("EditorIcons")));
+}
+
void CreateDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
connect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
- search_box->set_right_icon(search_options->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
- search_box->set_clear_button_enabled(true);
- favorite->set_icon(search_options->get_theme_icon(SNAME("Favorites"), SNAME("EditorIcons")));
+ _update_theme();
} break;
case NOTIFICATION_EXIT_TREE: {
disconnect("confirmed", callable_mp(this, &CreateDialog::_confirmed));
@@ -386,6 +389,9 @@ void CreateDialog::_notification(int p_what) {
EditorSettings::get_singleton()->get_project_metadata("dialog_bounds", "create_new_node", Rect2(get_position(), get_size()));
}
} break;
+ case NOTIFICATION_THEME_CHANGED: {
+ _update_theme();
+ } break;
}
}
@@ -711,6 +717,7 @@ CreateDialog::CreateDialog() {
hsc->add_child(vbc);
search_box = memnew(LineEdit);
+ search_box->set_clear_button_enabled(true);
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
search_box->connect("text_changed", callable_mp(this, &CreateDialog::_text_changed));
search_box->connect("gui_input", callable_mp(this, &CreateDialog::_sbox_input));
diff --git a/editor/create_dialog.h b/editor/create_dialog.h
index c36730c4f0..a22906c5f0 100644
--- a/editor/create_dialog.h
+++ b/editor/create_dialog.h
@@ -95,6 +95,8 @@ class CreateDialog : public ConfirmationDialog {
bool _is_class_disabled_by_feature_profile(const StringName &p_class) const;
void _load_favorites_and_history();
+ void _update_theme();
+
protected:
void _notification(int p_what);
static void _bind_methods();
diff --git a/editor/editor_log.cpp b/editor/editor_log.cpp
index 04bfcfac95..db4de3bed0 100644
--- a/editor/editor_log.cpp
+++ b/editor/editor_log.cpp
@@ -84,6 +84,7 @@ void EditorLog::_update_theme() {
copy_button->set_icon(get_theme_icon(SNAME("ActionCopy"), SNAME("EditorIcons")));
collapse_button->set_icon(get_theme_icon(SNAME("CombineLines"), SNAME("EditorIcons")));
show_search_button->set_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
+ search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
}
void EditorLog::_notification(int p_what) {
@@ -348,7 +349,6 @@ EditorLog::EditorLog() {
search_box = memnew(LineEdit);
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
search_box->set_placeholder(TTR("Filter messages"));
- search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
search_box->set_clear_button_enabled(true);
search_box->set_visible(true);
search_box->connect("text_changed", callable_mp(this, &EditorLog::_search_changed));
diff --git a/editor/groups_editor.cpp b/editor/groups_editor.cpp
index c65d4e9e3b..ff24339f9f 100644
--- a/editor/groups_editor.cpp
+++ b/editor/groups_editor.cpp
@@ -370,7 +370,8 @@ void GroupDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_TRANSLATION_CHANGED:
case Control::NOTIFICATION_LAYOUT_DIRECTION_CHANGED:
- case NOTIFICATION_ENTER_TREE: {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
if (is_layout_rtl()) {
add_button->set_icon(groups->get_theme_icon(SNAME("Back"), SNAME("EditorIcons")));
remove_button->set_icon(groups->get_theme_icon(SNAME("Forward"), SNAME("EditorIcons")));
diff --git a/editor/plugins/asset_library_editor_plugin.cpp b/editor/plugins/asset_library_editor_plugin.cpp
index 49bef4acd5..e6ca8e2401 100644
--- a/editor/plugins/asset_library_editor_plugin.cpp
+++ b/editor/plugins/asset_library_editor_plugin.cpp
@@ -193,7 +193,8 @@ void EditorAssetLibraryItemDescription::set_image(int p_type, int p_index, const
void EditorAssetLibraryItemDescription::_notification(int p_what) {
switch (p_what) {
- case NOTIFICATION_ENTER_TREE: {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
previews_bg->add_theme_style_override("panel", previews->get_theme_stylebox(SNAME("normal"), SNAME("TextEdit")));
} break;
}
@@ -398,7 +399,8 @@ void EditorAssetLibraryItemDownload::configure(const String &p_title, int p_asse
void EditorAssetLibraryItemDownload::_notification(int p_what) {
switch (p_what) {
// FIXME: The editor crashes if 'NOTICATION_THEME_CHANGED' is used.
- case NOTIFICATION_ENTER_TREE: {
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
add_theme_style_override("panel", get_theme_stylebox(SNAME("panel"), SNAME("TabContainer")));
dismiss->set_normal_texture(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
} break;
@@ -562,11 +564,15 @@ EditorAssetLibraryItemDownload::EditorAssetLibraryItemDownload() {
void EditorAssetLibrary::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_READY: {
+ error_label->raise();
+ } break;
+ case NOTIFICATION_ENTER_TREE:
+ case NOTIFICATION_THEME_CHANGED: {
error_tr->set_texture(get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
filter->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
- filter->set_clear_button_enabled(true);
-
- error_label->raise();
+ library_scroll_bg->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
+ downloads_scroll->add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
+ error_label->add_theme_color_override("color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
if (is_visible()) {
@@ -596,14 +602,6 @@ void EditorAssetLibrary::_notification(int p_what) {
}
} break;
- case NOTIFICATION_THEME_CHANGED: {
- library_scroll_bg->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
- downloads_scroll->add_theme_style_override("bg", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
- error_tr->set_texture(get_theme_icon(SNAME("Error"), SNAME("EditorIcons")));
- filter->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
- filter->set_clear_button_enabled(true);
- } break;
-
case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
_update_repository_options();
} break;
@@ -1354,6 +1352,7 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
} else {
filter->set_placeholder(TTR("Search assets (excluding templates, projects, and demos)"));
}
+ filter->set_clear_button_enabled(true);
search_hb->add_child(filter);
filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
filter->connect("text_changed", callable_mp(this, &EditorAssetLibrary::_search_text_changed));
@@ -1495,7 +1494,6 @@ EditorAssetLibrary::EditorAssetLibrary(bool p_templates_only) {
error_hb = memnew(HBoxContainer);
library_main->add_child(error_hb);
error_label = memnew(Label);
- error_label->add_theme_color_override("color", get_theme_color(SNAME("error_color"), SNAME("Editor")));
error_hb->add_child(error_label);
error_tr = memnew(TextureRect);
error_tr->set_v_size_flags(Control::SIZE_SHRINK_CENTER);
diff --git a/editor/project_settings_editor.cpp b/editor/project_settings_editor.cpp
index 1bf6243bcc..769e5cce89 100644
--- a/editor/project_settings_editor.cpp
+++ b/editor/project_settings_editor.cpp
@@ -467,6 +467,14 @@ void ProjectSettingsEditor::_update_action_map_editor() {
action_map->update_action_list(actions);
}
+void ProjectSettingsEditor::_update_theme() {
+ search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
+ restart_close_button->set_icon(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
+ restart_container->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
+ restart_icon->set_texture(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
+ restart_label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
+}
+
void ProjectSettingsEditor::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_VISIBILITY_CHANGED: {
@@ -476,21 +484,12 @@ void ProjectSettingsEditor::_notification(int p_what) {
} break;
case NOTIFICATION_ENTER_TREE: {
inspector->edit(ps);
-
- search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
- search_box->set_clear_button_enabled(true);
-
- restart_close_button->set_icon(get_theme_icon(SNAME("Close"), SNAME("EditorIcons")));
- restart_container->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
- restart_icon->set_texture(get_theme_icon(SNAME("StatusWarning"), SNAME("EditorIcons")));
- restart_label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
-
_update_action_map_editor();
+ _update_theme();
} break;
- case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: {
- search_box->set_right_icon(get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
- search_box->set_clear_button_enabled(true);
- } break;
+ case NOTIFICATION_THEME_CHANGED:
+ _update_theme();
+ break;
}
}
@@ -524,6 +523,7 @@ ProjectSettingsEditor::ProjectSettingsEditor(EditorData *p_data) {
search_box = memnew(LineEdit);
search_box->set_placeholder(TTR("Filter Settings"));
+ search_box->set_clear_button_enabled(true);
search_box->set_h_size_flags(Control::SIZE_EXPAND_FILL);
search_bar->add_child(search_box);
diff --git a/editor/project_settings_editor.h b/editor/project_settings_editor.h
index 26af73c54e..a8eed0093f 100644
--- a/editor/project_settings_editor.h
+++ b/editor/project_settings_editor.h
@@ -99,6 +99,7 @@ class ProjectSettingsEditor : public AcceptDialog {
void _action_renamed(const String &p_old_name, const String &p_new_name);
void _action_reordered(const String &p_action_name, const String &p_relative_to, bool p_before);
void _update_action_map_editor();
+ void _update_theme();
protected:
void _notification(int p_what);
diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp
index c1ceba27b3..dc95b73569 100644
--- a/editor/scene_tree_editor.cpp
+++ b/editor/scene_tree_editor.cpp
@@ -1256,6 +1256,10 @@ void SceneTreeDialog::popup_scenetree_dialog() {
popup_centered_clamped(Size2(350, 700) * EDSCALE);
}
+void SceneTreeDialog::_update_theme() {
+ filter->set_right_icon(tree->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
+}
+
void SceneTreeDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_VISIBILITY_CHANGED: {
@@ -1265,8 +1269,10 @@ void SceneTreeDialog::_notification(int p_what) {
} break;
case NOTIFICATION_ENTER_TREE: {
connect("confirmed", callable_mp(this, &SceneTreeDialog::_select));
- filter->set_right_icon(tree->get_theme_icon(SNAME("Search"), SNAME("EditorIcons")));
- filter->set_clear_button_enabled(true);
+ _update_theme();
+ } break;
+ case NOTIFICATION_THEME_CHANGED: {
+ _update_theme();
} break;
case NOTIFICATION_EXIT_TREE: {
disconnect("confirmed", callable_mp(this, &SceneTreeDialog::_select));
@@ -1303,6 +1309,7 @@ SceneTreeDialog::SceneTreeDialog() {
filter = memnew(LineEdit);
filter->set_h_size_flags(Control::SIZE_EXPAND_FILL);
filter->set_placeholder(TTR("Filter nodes"));
+ filter->set_clear_button_enabled(true);
filter->add_theme_constant_override("minimum_character_width", 0);
filter->connect("text_changed", callable_mp(this, &SceneTreeDialog::_filter_changed));
vbc->add_child(filter);
diff --git a/editor/scene_tree_editor.h b/editor/scene_tree_editor.h
index 7fb1451934..39fe64b828 100644
--- a/editor/scene_tree_editor.h
+++ b/editor/scene_tree_editor.h
@@ -174,6 +174,7 @@ class SceneTreeDialog : public ConfirmationDialog {
void _select();
void _cancel();
void _filter_changed(const String &p_filter);
+ void _update_theme();
protected:
void _notification(int p_what);