Merge pull request #9473 from Noshyaar/pr-author
Authors/About: support for multiple sections
This commit is contained in:
commit
e4b42a5da0
2 changed files with 93 additions and 53 deletions
29
editor/SCsub
29
editor/SCsub
|
@ -143,6 +143,9 @@ def make_translations_header(target, source, env):
|
|||
|
||||
def make_authors_header(target, source, env):
|
||||
|
||||
sections = ["Project Founders", "Lead Developer", "Project Manager", "Developers"]
|
||||
sections_id = ["dev_founders", "dev_lead", "dev_manager", "dev_names"]
|
||||
|
||||
src = source[0].srcnode().abspath
|
||||
dst = target[0].srcnode().abspath
|
||||
f = open(src, "rb")
|
||||
|
@ -151,19 +154,35 @@ def make_authors_header(target, source, env):
|
|||
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
|
||||
g.write("#ifndef _EDITOR_AUTHORS_H\n")
|
||||
g.write("#define _EDITOR_AUTHORS_H\n")
|
||||
g.write("static const char *dev_names[] = {\n")
|
||||
|
||||
current_section = ""
|
||||
name_count = -1
|
||||
|
||||
def close_section():
|
||||
g.write("\t0\n")
|
||||
g.write("};\n")
|
||||
g.write("#define " + current_section.upper() + "_COUNT " + str(name_count) + "\n")
|
||||
|
||||
for line in f:
|
||||
if name_count >= 0:
|
||||
if line.startswith(" "):
|
||||
g.write("\t\"" + line.strip() + "\",\n")
|
||||
name_count += 1
|
||||
elif line.strip() == "## Developers":
|
||||
continue
|
||||
if line.startswith("## "):
|
||||
if name_count >= 0:
|
||||
close_section()
|
||||
name_count = -1
|
||||
for i in range(len(sections)):
|
||||
if line.strip().endswith(sections[i]):
|
||||
current_section = sections_id[i]
|
||||
name_count = 0
|
||||
g.write("\t0\n")
|
||||
g.write("};\n")
|
||||
g.write("#define AUTHORS_COUNT " + str(name_count) + "\n")
|
||||
g.write("static const char *" + current_section + "[] = {\n")
|
||||
break
|
||||
|
||||
if name_count >= 0:
|
||||
close_section()
|
||||
|
||||
g.write("#endif\n")
|
||||
|
||||
if (env["tools"] == "yes"):
|
||||
|
|
|
@ -2646,7 +2646,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) {
|
|||
OS::get_singleton()->shell_open("https://godotengine.org/community");
|
||||
} break;
|
||||
case HELP_ABOUT: {
|
||||
about->popup_centered_minsize(Size2(500, 130) * EDSCALE);
|
||||
about->popup_centered_minsize(Size2(780, 500) * EDSCALE);
|
||||
} break;
|
||||
case SOURCES_REIMPORT: {
|
||||
|
||||
|
@ -6042,52 +6042,73 @@ EditorNode::EditorNode() {
|
|||
export_template_manager = memnew(ExportTemplateManager);
|
||||
gui_base->add_child(export_template_manager);
|
||||
|
||||
{
|
||||
|
||||
about = memnew(AcceptDialog);
|
||||
about->set_title(TTR("Thanks from the Godot community!"));
|
||||
about->get_ok()->set_text(TTR("Thanks!"));
|
||||
about->set_hide_on_ok(true);
|
||||
about->set_resizable(true);
|
||||
gui_base->add_child(about);
|
||||
|
||||
VBoxContainer *vbc = memnew(VBoxContainer);
|
||||
HBoxContainer *hbc = memnew(HBoxContainer);
|
||||
hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
hbc->set_alignment(BoxContainer::ALIGN_CENTER);
|
||||
hbc->add_constant_override("separation", 30 * EDSCALE);
|
||||
about->add_child(vbc);
|
||||
vbc->add_child(hbc);
|
||||
Label *about_text = memnew(Label);
|
||||
about_text->set_text(VERSION_FULL_NAME + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") + TTR("Godot Engine contributors") + "\n");
|
||||
|
||||
TextureRect *logo = memnew(TextureRect);
|
||||
logo->set_texture(gui_base->get_icon("Logo", "EditorIcons"));
|
||||
hbc->add_child(logo);
|
||||
|
||||
Label *about_text = memnew(Label);
|
||||
about_text->set_text(VERSION_FULL_NAME + String::utf8("\n\u00A9 2007-2017 Juan Linietsky, Ariel Manzur.\n\u00A9 2014-2017 ") +
|
||||
TTR("Godot Engine contributors") + "\n");
|
||||
hbc->add_child(about_text);
|
||||
|
||||
TabContainer *tc = memnew(TabContainer);
|
||||
tc->set_custom_minimum_size(Vector2(740, 300));
|
||||
tc->set_custom_minimum_size(Size2(600, 240) * EDSCALE);
|
||||
tc->set_v_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
vbc->add_child(tc);
|
||||
|
||||
ScrollContainer *dev_base = memnew(ScrollContainer);
|
||||
dev_base->set_name(TTR("Developers"));
|
||||
dev_base->set_name(TTR("Authors"));
|
||||
dev_base->set_v_size_flags(Control::SIZE_EXPAND);
|
||||
tc->add_child(dev_base);
|
||||
HBoxContainer *dev_hbc = memnew(HBoxContainer);
|
||||
dev_hbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
dev_base->add_child(dev_hbc);
|
||||
for (int i = 0; i < 3; i++) {
|
||||
Label *dev_label = memnew(Label);
|
||||
dev_label->set_h_size_flags(Control::SIZE_EXPAND);
|
||||
dev_label->set_v_size_flags(Control::SIZE_FILL);
|
||||
dev_hbc->add_child(dev_label);
|
||||
}
|
||||
int dev_name_index = 0;
|
||||
int dev_name_column = 0;
|
||||
const int dev_index_max = AUTHORS_COUNT / 3 + (AUTHORS_COUNT % 3 == 0 ? 0 : 1);
|
||||
String dev_name = "";
|
||||
const char **dev_names_ptr = dev_names;
|
||||
while (*dev_names_ptr) {
|
||||
dev_name += String::utf8(*dev_names_ptr++);
|
||||
if (++dev_name_index == dev_index_max || !*dev_names_ptr) {
|
||||
dev_hbc->get_child(dev_name_column)->cast_to<Label>()->set_text(dev_name);
|
||||
dev_name_column++;
|
||||
dev_name = "";
|
||||
dev_name_index = 0;
|
||||
} else {
|
||||
dev_name += "\n";
|
||||
|
||||
VBoxContainer *dev_vbc = memnew(VBoxContainer);
|
||||
dev_vbc->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
dev_base->add_child(dev_vbc);
|
||||
|
||||
List<String> dev_sections;
|
||||
dev_sections.push_back(TTR("Project Founders"));
|
||||
dev_sections.push_back(TTR("Lead Developer"));
|
||||
dev_sections.push_back(TTR("Project Manager"));
|
||||
dev_sections.push_back(TTR("Developers"));
|
||||
|
||||
const char **dev_src[] = { dev_founders, dev_lead, dev_manager, dev_names };
|
||||
|
||||
for (int i = 0; i < dev_sections.size(); i++) {
|
||||
|
||||
Label *lbl = memnew(Label);
|
||||
lbl->set_text(dev_sections[i]);
|
||||
dev_vbc->add_child(lbl);
|
||||
|
||||
ItemList *il = memnew(ItemList);
|
||||
il->set_max_columns(32);
|
||||
il->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
il->set_custom_minimum_size(Size2(0, i == 3 ? DEV_NAMES_COUNT * 7.6 : 30) * EDSCALE);
|
||||
const char **dev_names_ptr = dev_src[i];
|
||||
while (*dev_names_ptr)
|
||||
il->add_item(String::utf8(*dev_names_ptr++), NULL, false);
|
||||
dev_vbc->add_child(il);
|
||||
il->set_fixed_column_width(240 * EDSCALE);
|
||||
|
||||
HSeparator *hs = memnew(HSeparator);
|
||||
hs->set_modulate(Color(0, 0, 0, 0));
|
||||
dev_vbc->add_child(hs);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue