mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 06:01:14 +00:00
Fix accessing editor theme items throughout the UI
This also exposes `EditorInterface::get_editor_theme`.
This commit is contained in:
parent
6e11fcb92c
commit
8ecc0c4f47
55 changed files with 227 additions and 190 deletions
|
|
@ -174,7 +174,7 @@ void VersionControlEditorPlugin::_update_set_up_warning(String p_new_text) {
|
|||
set_up_ssh_passphrase->get_text().is_empty();
|
||||
|
||||
if (empty_settings) {
|
||||
set_up_warning_text->add_theme_color_override(SNAME("font_color"), EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
|
||||
set_up_warning_text->add_theme_color_override(SNAME("font_color"), EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor)));
|
||||
set_up_warning_text->set_text(TTR("Remote settings are empty. VCS features that use the network may not work."));
|
||||
} else {
|
||||
set_up_warning_text->set_text("");
|
||||
|
|
@ -192,7 +192,7 @@ void VersionControlEditorPlugin::_refresh_branch_list() {
|
|||
String current_branch = EditorVCSInterface::get_singleton()->get_current_branch_name();
|
||||
|
||||
for (int i = 0; i < branch_list.size(); i++) {
|
||||
branch_select->add_icon_item(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("VcsBranches")), branch_list[i], i);
|
||||
branch_select->add_icon_item(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("VcsBranches"), EditorStringName(EditorIcons)), branch_list[i], i);
|
||||
|
||||
if (branch_list[i] == current_branch) {
|
||||
branch_select->select(i);
|
||||
|
|
@ -252,7 +252,7 @@ void VersionControlEditorPlugin::_refresh_remote_list() {
|
|||
remote_select->set_disabled(remotes.is_empty());
|
||||
|
||||
for (int i = 0; i < remotes.size(); i++) {
|
||||
remote_select->add_icon_item(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("ArrowUp")), remotes[i], i);
|
||||
remote_select->add_icon_item(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("ArrowUp"), EditorStringName(EditorIcons)), remotes[i], i);
|
||||
remote_select->set_item_metadata(i, remotes[i]);
|
||||
|
||||
if (remotes[i] == current_remote) {
|
||||
|
|
@ -422,9 +422,9 @@ void VersionControlEditorPlugin::_add_new_item(Tree *p_tree, String p_file_path,
|
|||
new_item->set_meta(SNAME("change_type"), p_change);
|
||||
new_item->set_custom_color(0, change_type_to_color[p_change]);
|
||||
|
||||
new_item->add_button(0, EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("File")), BUTTON_TYPE_OPEN, false, TTR("Open in editor"));
|
||||
new_item->add_button(0, EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("File"), EditorStringName(EditorIcons)), BUTTON_TYPE_OPEN, false, TTR("Open in editor"));
|
||||
if (p_tree == unstaged_files) {
|
||||
new_item->add_button(0, EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("Close")), BUTTON_TYPE_DISCARD, false, TTR("Discard changes"));
|
||||
new_item->add_button(0, EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Close"), EditorStringName(EditorIcons)), BUTTON_TYPE_DISCARD, false, TTR("Discard changes"));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -570,8 +570,8 @@ void VersionControlEditorPlugin::_display_diff(int p_idx) {
|
|||
String commit_author = meta_data[SNAME("commit_author")];
|
||||
String commit_date_string = meta_data[SNAME("commit_date_string")];
|
||||
|
||||
diff->push_font(EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("doc_bold"), EditorStringName(EditorFonts)));
|
||||
diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("accent_color"), EditorStringName(Editor)));
|
||||
diff->push_font(EditorNode::get_singleton()->get_editor_theme()->get_font(SNAME("doc_bold"), EditorStringName(EditorFonts)));
|
||||
diff->push_color(EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("accent_color"), EditorStringName(Editor)));
|
||||
diff->add_text(TTR("Commit:") + " " + commit_id);
|
||||
diff->add_newline();
|
||||
diff->add_text(TTR("Author:") + " " + commit_author);
|
||||
|
|
@ -590,13 +590,13 @@ void VersionControlEditorPlugin::_display_diff(int p_idx) {
|
|||
for (int i = 0; i < diff_content.size(); i++) {
|
||||
EditorVCSInterface::DiffFile diff_file = diff_content[i];
|
||||
|
||||
diff->push_font(EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("doc_bold"), EditorStringName(EditorFonts)));
|
||||
diff->push_color(EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("accent_color"), EditorStringName(Editor)));
|
||||
diff->push_font(EditorNode::get_singleton()->get_editor_theme()->get_font(SNAME("doc_bold"), EditorStringName(EditorFonts)));
|
||||
diff->push_color(EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("accent_color"), EditorStringName(Editor)));
|
||||
diff->add_text(TTR("File:") + " " + diff_file.new_file);
|
||||
diff->pop();
|
||||
diff->pop();
|
||||
|
||||
diff->push_font(EditorNode::get_singleton()->get_gui_base()->get_theme_font(SNAME("status_source"), EditorStringName(EditorFonts)));
|
||||
diff->push_font(EditorNode::get_singleton()->get_editor_theme()->get_font(SNAME("status_source"), EditorStringName(EditorFonts)));
|
||||
for (int j = 0; j < diff_file.diff_hunks.size(); j++) {
|
||||
EditorVCSInterface::DiffHunk hunk = diff_file.diff_hunks[j];
|
||||
|
||||
|
|
@ -679,9 +679,9 @@ void VersionControlEditorPlugin::_display_diff_split_view(List<EditorVCSInterfac
|
|||
EditorVCSInterface::DiffLine diff_line = parsed_diff[i];
|
||||
|
||||
bool has_change = diff_line.status != " ";
|
||||
static const Color red = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("error_color"), EditorStringName(Editor));
|
||||
static const Color green = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("success_color"), EditorStringName(Editor));
|
||||
static const Color white = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("font_color"), SNAME("Label")) * Color(1, 1, 1, 0.6);
|
||||
static const Color red = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor));
|
||||
static const Color green = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("success_color"), EditorStringName(Editor));
|
||||
static const Color white = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("font_color"), SNAME("Label")) * Color(1, 1, 1, 0.6);
|
||||
|
||||
if (diff_line.old_line_no >= 0) {
|
||||
diff->push_cell();
|
||||
|
|
@ -761,11 +761,11 @@ void VersionControlEditorPlugin::_display_diff_unified_view(List<EditorVCSInterf
|
|||
|
||||
Color color;
|
||||
if (diff_line.status == "+") {
|
||||
color = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("success_color"), EditorStringName(Editor));
|
||||
color = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("success_color"), EditorStringName(Editor));
|
||||
} else if (diff_line.status == "-") {
|
||||
color = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("error_color"), EditorStringName(Editor));
|
||||
color = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor));
|
||||
} else {
|
||||
color = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("font_color"), SNAME("Label"));
|
||||
color = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("font_color"), SNAME("Label"));
|
||||
color *= Color(1, 1, 1, 0.6);
|
||||
}
|
||||
|
||||
|
|
@ -856,13 +856,13 @@ void VersionControlEditorPlugin::_popup_remote_remove_confirm(int p_index) {
|
|||
void VersionControlEditorPlugin::_update_extra_options() {
|
||||
extra_options_remove_branch_list->clear();
|
||||
for (int i = 0; i < branch_select->get_item_count(); i++) {
|
||||
extra_options_remove_branch_list->add_icon_item(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("VcsBranches")), branch_select->get_item_text(branch_select->get_item_id(i)));
|
||||
extra_options_remove_branch_list->add_icon_item(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("VcsBranches"), EditorStringName(EditorIcons)), branch_select->get_item_text(branch_select->get_item_id(i)));
|
||||
}
|
||||
extra_options_remove_branch_list->update_canvas_items();
|
||||
|
||||
extra_options_remove_remote_list->clear();
|
||||
for (int i = 0; i < remote_select->get_item_count(); i++) {
|
||||
extra_options_remove_remote_list->add_icon_item(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("ArrowUp")), remote_select->get_item_text(remote_select->get_item_id(i)));
|
||||
extra_options_remove_remote_list->add_icon_item(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("ArrowUp"), EditorStringName(EditorIcons)), remote_select->get_item_text(remote_select->get_item_id(i)));
|
||||
}
|
||||
extra_options_remove_remote_list->update_canvas_items();
|
||||
}
|
||||
|
|
@ -1161,7 +1161,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
|
|||
refresh_button = memnew(Button);
|
||||
refresh_button->set_tooltip_text(TTR("Detect new changes"));
|
||||
refresh_button->set_flat(true);
|
||||
refresh_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("Reload")));
|
||||
refresh_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Reload"), EditorStringName(EditorIcons)));
|
||||
refresh_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_refresh_stage_area));
|
||||
refresh_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_refresh_commit_list));
|
||||
refresh_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_refresh_branch_list));
|
||||
|
|
@ -1181,14 +1181,14 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
|
|||
|
||||
discard_all_button = memnew(Button);
|
||||
discard_all_button->set_tooltip_text(TTR("Discard all changes"));
|
||||
discard_all_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("Close")));
|
||||
discard_all_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Close"), EditorStringName(EditorIcons)));
|
||||
discard_all_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_confirm_discard_all));
|
||||
discard_all_button->set_flat(true);
|
||||
unstage_title->add_child(discard_all_button);
|
||||
|
||||
stage_all_button = memnew(Button);
|
||||
stage_all_button->set_flat(true);
|
||||
stage_all_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("MoveDown")));
|
||||
stage_all_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveDown"), EditorStringName(EditorIcons)));
|
||||
stage_all_button->set_tooltip_text(TTR("Stage all changes"));
|
||||
unstage_title->add_child(stage_all_button);
|
||||
|
||||
|
|
@ -1218,7 +1218,7 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
|
|||
|
||||
unstage_all_button = memnew(Button);
|
||||
unstage_all_button->set_flat(true);
|
||||
unstage_all_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("MoveUp")));
|
||||
unstage_all_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveUp"), EditorStringName(EditorIcons)));
|
||||
unstage_all_button->set_tooltip_text(TTR("Unstage all changes"));
|
||||
stage_title->add_child(unstage_all_button);
|
||||
|
||||
|
|
@ -1413,26 +1413,26 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
|
|||
fetch_button = memnew(Button);
|
||||
fetch_button->set_flat(true);
|
||||
fetch_button->set_tooltip_text(TTR("Fetch"));
|
||||
fetch_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("Reload")));
|
||||
fetch_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("Reload"), EditorStringName(EditorIcons)));
|
||||
fetch_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_fetch));
|
||||
menu_bar->add_child(fetch_button);
|
||||
|
||||
pull_button = memnew(Button);
|
||||
pull_button->set_flat(true);
|
||||
pull_button->set_tooltip_text(TTR("Pull"));
|
||||
pull_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("MoveDown")));
|
||||
pull_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveDown"), EditorStringName(EditorIcons)));
|
||||
pull_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_pull));
|
||||
menu_bar->add_child(pull_button);
|
||||
|
||||
push_button = memnew(Button);
|
||||
push_button->set_flat(true);
|
||||
push_button->set_tooltip_text(TTR("Push"));
|
||||
push_button->set_icon(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("MoveUp")));
|
||||
push_button->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("MoveUp"), EditorStringName(EditorIcons)));
|
||||
push_button->connect(SNAME("pressed"), callable_mp(this, &VersionControlEditorPlugin::_push));
|
||||
menu_bar->add_child(push_button);
|
||||
|
||||
extra_options = memnew(MenuButton);
|
||||
extra_options->set_icon(EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("GuiTabMenuHl")));
|
||||
extra_options->set_icon(EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("GuiTabMenuHl"), EditorStringName(EditorIcons)));
|
||||
extra_options->get_popup()->connect(SNAME("about_to_popup"), callable_mp(this, &VersionControlEditorPlugin::_update_extra_options));
|
||||
extra_options->get_popup()->connect(SNAME("id_pressed"), callable_mp(this, &VersionControlEditorPlugin::_extra_option_selected));
|
||||
menu_bar->add_child(extra_options);
|
||||
|
|
@ -1463,19 +1463,19 @@ VersionControlEditorPlugin::VersionControlEditorPlugin() {
|
|||
change_type_to_strings[EditorVCSInterface::CHANGE_TYPE_TYPECHANGE] = TTR("Typechange");
|
||||
change_type_to_strings[EditorVCSInterface::CHANGE_TYPE_UNMERGED] = TTR("Unmerged");
|
||||
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_NEW] = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("success_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_MODIFIED] = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("warning_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_RENAMED] = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("warning_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_DELETED] = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("error_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_TYPECHANGE] = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("font_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_UNMERGED] = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("warning_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_NEW] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("success_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_MODIFIED] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_RENAMED] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_DELETED] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("error_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_TYPECHANGE] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("font_color"), EditorStringName(Editor));
|
||||
change_type_to_color[EditorVCSInterface::CHANGE_TYPE_UNMERGED] = EditorNode::get_singleton()->get_editor_theme()->get_color(SNAME("warning_color"), EditorStringName(Editor));
|
||||
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_NEW] = EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("StatusSuccess"));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_MODIFIED] = EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("StatusWarning"));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_RENAMED] = EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("StatusWarning"));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_TYPECHANGE] = EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("StatusWarning"));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_DELETED] = EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("StatusError"));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_UNMERGED] = EditorNode::get_singleton()->get_gui_base()->get_editor_theme_icon(SNAME("StatusWarning"));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_NEW] = EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("StatusSuccess"), EditorStringName(EditorIcons));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_MODIFIED] = EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("StatusWarning"), EditorStringName(EditorIcons));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_RENAMED] = EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("StatusWarning"), EditorStringName(EditorIcons));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_TYPECHANGE] = EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("StatusWarning"), EditorStringName(EditorIcons));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_DELETED] = EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("StatusError"), EditorStringName(EditorIcons));
|
||||
change_type_to_icon[EditorVCSInterface::CHANGE_TYPE_UNMERGED] = EditorNode::get_singleton()->get_editor_theme()->get_icon(SNAME("StatusWarning"), EditorStringName(EditorIcons));
|
||||
|
||||
version_control_dock = memnew(VBoxContainer);
|
||||
version_control_dock->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue