diff options
author | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-04-08 01:05:47 +0200 |
---|---|---|
committer | Hugo Locurcio <hugo.locurcio@hugo.pro> | 2021-04-16 17:14:05 +0200 |
commit | 76722b510812f5f4bbda087cbdf92dd5d27bbf1b (patch) | |
tree | 23006121de1d077e205cb049040ff1c9c5db58bd | |
parent | 2e87857d758efb69989bc8c1cc5693f86df55d87 (diff) |
Add the About dialog to the project manager
The About button is located in the bottom-right corner of the
project manager.
This allows removing the copyright notice from the window title
(which looked a bit ugly in comparison to other applications).
-rw-r--r-- | editor/editor_about.cpp | 7 | ||||
-rw-r--r-- | editor/editor_about.h | 4 | ||||
-rw-r--r-- | editor/project_manager.cpp | 24 | ||||
-rw-r--r-- | editor/project_manager.h | 4 |
4 files changed, 29 insertions, 10 deletions
diff --git a/editor/editor_about.cpp b/editor/editor_about.cpp index 2ed937b6ff..d962658484 100644 --- a/editor/editor_about.cpp +++ b/editor/editor_about.cpp @@ -38,16 +38,15 @@ #include "core/version_hash.gen.h" void EditorAbout::_theme_changed() { - Control *base = EditorNode::get_singleton()->get_gui_base(); - Ref<Font> font = base->get_theme_font("source", "EditorFonts"); - int font_size = base->get_theme_font_size("source_size", "EditorFonts"); + const Ref<Font> font = get_theme_font("source", "EditorFonts"); + const int font_size = get_theme_font_size("source_size", "EditorFonts"); _tpl_text->add_theme_font_override("normal_font", font); _tpl_text->add_theme_font_size_override("normal_font_size", font_size); _tpl_text->add_theme_constant_override("line_separation", 6 * EDSCALE); _license_text->add_theme_font_override("normal_font", font); _license_text->add_theme_font_size_override("normal_font_size", font_size); _license_text->add_theme_constant_override("line_separation", 6 * EDSCALE); - _logo->set_texture(base->get_theme_icon("Logo", "EditorIcons")); + _logo->set_texture(get_theme_icon("Logo", "EditorIcons")); } void EditorAbout::_notification(int p_what) { diff --git a/editor/editor_about.h b/editor/editor_about.h index efb7245e78..2823220a8a 100644 --- a/editor/editor_about.h +++ b/editor/editor_about.h @@ -44,6 +44,10 @@ #include "editor_scale.h" +/** + * NOTE: Do not assume the EditorNode singleton to be available in this class' methods. + * EditorAbout is also used from the project manager where EditorNode isn't initialized. + */ class EditorAbout : public AcceptDialog { GDCLASS(EditorAbout, AcceptDialog); diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp index 1e79bb81d1..e51e8ee82e 100644 --- a/editor/project_manager.cpp +++ b/editor/project_manager.cpp @@ -1852,6 +1852,9 @@ void ProjectManager::_notification(int p_what) { case NOTIFICATION_WM_CLOSE_REQUEST: { _dim_window(); } break; + case NOTIFICATION_WM_ABOUT: { + _show_about(); + } break; } } @@ -2255,6 +2258,10 @@ void ProjectManager::_erase_missing_projects() { erase_missing_ask->popup_centered(); } +void ProjectManager::_show_about() { + about->popup_centered(Size2(780, 500) * EDSCALE); +} + void ProjectManager::_language_selected(int p_id) { String lang = language_btn->get_item_metadata(p_id); EditorSettings::get_singleton()->set("interface/editor/editor_language", lang); @@ -2444,12 +2451,7 @@ ProjectManager::ProjectManager() { } // TRANSLATORS: This refers to the application where users manage their Godot projects. - if (TS->is_locale_right_to_left(TranslationServer::get_singleton()->get_tool_locale())) { - // For RTL languages, embed translated part of the title (using control characters) to ensure correct order. - DisplayServer::get_singleton()->window_set_title(VERSION_NAME + String(" - ") + String::chr(0x202B) + TTR("Project Manager") + String::chr(0x202C) + String::chr(0x200E) + " - " + String::chr(0xA9) + " 2007-2021 Juan Linietsky, Ariel Manzur & Godot Contributors"); - } else { - DisplayServer::get_singleton()->window_set_title(VERSION_NAME + String(" - ") + TTR("Project Manager") + " - " + String::chr(0xA9) + " 2007-2021 Juan Linietsky, Ariel Manzur & Godot Contributors"); - } + DisplayServer::get_singleton()->window_set_title(VERSION_NAME + String(" - ") + TTR("Project Manager")); FileDialog::set_default_show_hidden_files(EditorSettings::get_singleton()->get("filesystem/file_dialog/show_hidden_files")); @@ -2583,6 +2585,13 @@ ProjectManager::ProjectManager() { erase_missing_btn->set_text(TTR("Remove Missing")); erase_missing_btn->connect("pressed", callable_mp(this, &ProjectManager::_erase_missing_projects)); tree_vb->add_child(erase_missing_btn); + + tree_vb->add_spacer(); + + about_btn = memnew(Button); + about_btn->set_text(TTR("About")); + about_btn->connect("pressed", callable_mp(this, &ProjectManager::_show_about)); + tree_vb->add_child(about_btn); } { @@ -2716,6 +2725,9 @@ ProjectManager::ProjectManager() { open_templates->get_ok_button()->set_text(TTR("Open Asset Library")); open_templates->connect("confirmed", callable_mp(this, &ProjectManager::_open_asset_library)); add_child(open_templates); + + about = memnew(EditorAbout); + add_child(about); } _load_recent_projects(); diff --git a/editor/project_manager.h b/editor/project_manager.h index d13315c022..a66b7c4ab6 100644 --- a/editor/project_manager.h +++ b/editor/project_manager.h @@ -31,6 +31,7 @@ #ifndef PROJECT_MANAGER_H #define PROJECT_MANAGER_H +#include "editor/editor_about.h" #include "editor/plugins/asset_library_editor_plugin.h" #include "scene/gui/dialogs.h" #include "scene/gui/file_dialog.h" @@ -62,6 +63,7 @@ class ProjectManager : public Control { Button *rename_btn; Button *erase_btn; Button *erase_missing_btn; + Button *about_btn; EditorAssetLibrary *asset_library; @@ -78,6 +80,7 @@ class ProjectManager : public Control { ConfirmationDialog *multi_scan_ask; ConfirmationDialog *ask_update_settings; ConfirmationDialog *open_templates; + EditorAbout *about; HBoxContainer *settings_hb; @@ -100,6 +103,7 @@ class ProjectManager : public Control { void _erase_missing_projects(); void _erase_project_confirm(); void _erase_missing_projects_confirm(); + void _show_about(); void _update_project_buttons(); void _language_selected(int p_id); void _restart_confirm(); |