diff options
author | volzhs <volzhs@gmail.com> | 2020-02-14 01:56:02 +0900 |
---|---|---|
committer | volzhs <volzhs@gmail.com> | 2020-02-14 01:56:02 +0900 |
commit | 09b055bd3484f89289e93671388bfbf4a2484cb3 (patch) | |
tree | ecd364a155a9b8c6fce9f1ccc738576ea252f0b5 | |
parent | ef51726ff3cd60e0caf9ce55c9c85cc47bfe0420 (diff) |
Use checkbox for plugin status instead of option list
-rw-r--r-- | editor/editor_plugin_settings.cpp | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/editor/editor_plugin_settings.cpp b/editor/editor_plugin_settings.cpp index 16decf5c04..c7346cbe65 100644 --- a/editor/editor_plugin_settings.cpp +++ b/editor/editor_plugin_settings.cpp @@ -137,19 +137,12 @@ void EditorPluginSettings::update_plugins() { item->set_metadata(1, script); item->set_text(2, author); item->set_metadata(2, description); - item->set_cell_mode(3, TreeItem::CELL_MODE_RANGE); - item->set_range_config(3, 0, 1, 1); - item->set_text(3, "Inactive,Active"); + item->set_cell_mode(3, TreeItem::CELL_MODE_CHECK); + item->set_text(3, TTR("Enable")); + bool is_active = EditorNode::get_singleton()->is_addon_plugin_enabled(d2); + item->set_checked(3, is_active); item->set_editable(3, true); item->add_button(4, get_icon("Edit", "EditorIcons"), BUTTON_PLUGIN_EDIT, false, TTR("Edit Plugin")); - - if (EditorNode::get_singleton()->is_addon_plugin_enabled(d2)) { - item->set_custom_color(3, get_color("success_color", "Editor")); - item->set_range(3, 1); - } else { - item->set_custom_color(3, get_color("disabled_font_color", "Editor")); - item->set_range(3, 0); - } } } } @@ -164,7 +157,7 @@ void EditorPluginSettings::_plugin_activity_changed() { TreeItem *ti = plugin_list->get_edited(); ERR_FAIL_COND(!ti); - bool active = ti->get_range(3); + bool active = ti->is_checked(3); String name = ti->get_metadata(0); EditorNode::get_singleton()->set_addon_plugin_enabled(name, active, true); @@ -173,14 +166,9 @@ void EditorPluginSettings::_plugin_activity_changed() { if (is_active != active) { updating = true; - ti->set_range(3, is_active ? 1 : 0); + ti->set_checked(3, is_active); updating = false; } - - if (is_active) - ti->set_custom_color(3, get_color("success_color", "Editor")); - else - ti->set_custom_color(3, get_color("disabled_font_color", "Editor")); } void EditorPluginSettings::_create_clicked() { |