diff options
Diffstat (limited to 'editor/editor_plugin_settings.cpp')
-rw-r--r-- | editor/editor_plugin_settings.cpp | 59 |
1 files changed, 34 insertions, 25 deletions
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index e5b62513ff..b6f48c7536 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ @@ -32,18 +32,22 @@ #include "core/config/project_settings.h" #include "core/io/config_file.h" -#include "core/os/file_access.h" +#include "core/io/file_access.h" #include "core/os/main_loop.h" -#include "editor_node.h" -#include "editor_scale.h" +#include "editor/editor_node.h" +#include "editor/editor_scale.h" #include "scene/gui/margin_container.h" void EditorPluginSettings::_notification(int p_what) { - if (p_what == NOTIFICATION_WM_WINDOW_FOCUS_IN) { - update_plugins(); - } else if (p_what == Node::NOTIFICATION_READY) { - plugin_config_dialog->connect("plugin_ready", Callable(EditorNode::get_singleton(), "_on_plugin_ready")); - plugin_list->connect("button_pressed", callable_mp(this, &EditorPluginSettings::_cell_button_pressed)); + switch (p_what) { + case NOTIFICATION_WM_WINDOW_FOCUS_IN: { + update_plugins(); + } break; + + case Node::NOTIFICATION_READY: { + plugin_config_dialog->connect("plugin_ready", Callable(EditorNode::get_singleton(), "_on_plugin_ready")); + plugin_list->connect("button_pressed", callable_mp(this, &EditorPluginSettings::_cell_button_pressed)); + } break; } } @@ -57,7 +61,7 @@ void EditorPluginSettings::update_plugins() { for (int i = 0; i < plugins.size(); i++) { Ref<ConfigFile> cf; - cf.instance(); + cf.instantiate(); const String path = plugins[i]; Error err2 = cf->load(path); @@ -108,7 +112,7 @@ void EditorPluginSettings::update_plugins() { bool is_active = EditorNode::get_singleton()->is_addon_plugin_enabled(path); item->set_checked(3, is_active); item->set_editable(3, true); - item->add_button(4, get_theme_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin")); + item->add_button(4, get_theme_icon(SNAME("Edit"), SNAME("EditorIcons")), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin")); } } } @@ -165,7 +169,7 @@ Vector<String> EditorPluginSettings::_get_plugins(const String &p_dir) { Vector<String> plugins; da->list_dir_begin(); - for (String path = da->get_next(); path != String(); path = da->get_next()) { + for (String path = da->get_next(); !path.is_empty(); path = da->get_next()) { if (path[0] == '.' || !da->current_is_dir()) { continue; } @@ -192,7 +196,9 @@ EditorPluginSettings::EditorPluginSettings() { add_child(plugin_config_dialog); HBoxContainer *title_hb = memnew(HBoxContainer); - title_hb->add_child(memnew(Label(TTR("Installed Plugins:")))); + Label *l = memnew(Label(TTR("Installed Plugins:"))); + l->set_theme_type_variation("HeaderSmall"); + title_hb->add_child(l); title_hb->add_spacer(); create_plugin = memnew(Button(TTR("Create"))); create_plugin->connect("pressed", callable_mp(this, &EditorPluginSettings::_create_clicked)); @@ -206,20 +212,25 @@ EditorPluginSettings::EditorPluginSettings() { plugin_list->set_v_size_flags(SIZE_EXPAND_FILL); plugin_list->set_columns(5); plugin_list->set_column_titles_visible(true); - plugin_list->set_column_title(0, TTR("Name:")); - plugin_list->set_column_title(1, TTR("Version:")); - plugin_list->set_column_title(2, TTR("Author:")); - plugin_list->set_column_title(3, TTR("Status:")); - plugin_list->set_column_title(4, TTR("Edit:")); + plugin_list->set_column_title(0, TTR("Name")); + plugin_list->set_column_title(1, TTR("Version")); + plugin_list->set_column_title(2, TTR("Author")); + plugin_list->set_column_title(3, TTR("Status")); + plugin_list->set_column_title(4, TTR("Edit")); plugin_list->set_column_expand(0, true); + plugin_list->set_column_clip_content(0, true); plugin_list->set_column_expand(1, false); + plugin_list->set_column_clip_content(1, true); plugin_list->set_column_expand(2, false); + plugin_list->set_column_clip_content(2, true); plugin_list->set_column_expand(3, false); + plugin_list->set_column_clip_content(3, true); plugin_list->set_column_expand(4, false); - plugin_list->set_column_min_width(1, 100 * EDSCALE); - plugin_list->set_column_min_width(2, 250 * EDSCALE); - plugin_list->set_column_min_width(3, 80 * EDSCALE); - plugin_list->set_column_min_width(4, 40 * EDSCALE); + plugin_list->set_column_clip_content(4, true); + plugin_list->set_column_custom_minimum_width(1, 100 * EDSCALE); + plugin_list->set_column_custom_minimum_width(2, 250 * EDSCALE); + plugin_list->set_column_custom_minimum_width(3, 80 * EDSCALE); + plugin_list->set_column_custom_minimum_width(4, 40 * EDSCALE); plugin_list->set_hide_root(true); plugin_list->connect("item_edited", callable_mp(this, &EditorPluginSettings::_plugin_activity_changed)); @@ -229,6 +240,4 @@ EditorPluginSettings::EditorPluginSettings() { mc->set_h_size_flags(SIZE_EXPAND_FILL); add_child(mc); - - updating = false; } |