diff options
Diffstat (limited to 'editor/project_manager')
-rw-r--r-- | editor/project_manager/project_dialog.cpp | 27 | ||||
-rw-r--r-- | editor/project_manager/project_dialog.h | 3 | ||||
-rw-r--r-- | editor/project_manager/quick_settings_dialog.cpp | 21 | ||||
-rw-r--r-- | editor/project_manager/quick_settings_dialog.h | 8 |
4 files changed, 43 insertions, 16 deletions
diff --git a/editor/project_manager/project_dialog.cpp b/editor/project_manager/project_dialog.cpp index ad0e8491a5..28d2362c9c 100644 --- a/editor/project_manager/project_dialog.cpp +++ b/editor/project_manager/project_dialog.cpp @@ -351,15 +351,19 @@ void ProjectDialog::_install_path_changed() { } void ProjectDialog::_browse_project_path() { + String path = project_path->get_text(); + if (path.is_empty()) { + path = EDITOR_GET("filesystem/directories/default_project_path"); + } if (mode == MODE_IMPORT && install_path->is_visible_in_tree()) { // Select last ZIP file. - fdialog_project->set_current_path(project_path->get_text()); + fdialog_project->set_current_path(path); } else if ((mode == MODE_NEW || mode == MODE_INSTALL) && create_dir->is_pressed()) { // Select parent directory of project path. - fdialog_project->set_current_dir(project_path->get_text().get_base_dir()); + fdialog_project->set_current_dir(path.get_base_dir()); } else { // Select project path. - fdialog_project->set_current_dir(project_path->get_text()); + fdialog_project->set_current_dir(path); } if (mode == MODE_IMPORT) { @@ -370,6 +374,8 @@ void ProjectDialog::_browse_project_path() { } else { fdialog_project->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR); } + + hide(); fdialog_project->popup_file_dialog(); } @@ -389,7 +395,7 @@ void ProjectDialog::_browse_install_path() { } void ProjectDialog::_project_path_selected(const String &p_path) { - show_dialog(); + show_dialog(false); if (create_dir->is_pressed() && (mode == MODE_NEW || mode == MODE_INSTALL)) { // Replace parent directory, but keep target dir name. @@ -423,6 +429,10 @@ void ProjectDialog::_install_path_selected(const String &p_path) { get_ok_button()->grab_focus(); } +void ProjectDialog::_reset_name() { + project_name->set_text(TTR("New Game Project")); +} + void ProjectDialog::_renderer_selected() { ERR_FAIL_NULL(renderer_button_group->get_pressed_button()); @@ -699,10 +709,11 @@ void ProjectDialog::set_project_path(const String &p_path) { } void ProjectDialog::ask_for_path_and_show() { + _reset_name(); _browse_project_path(); } -void ProjectDialog::show_dialog() { +void ProjectDialog::show_dialog(bool p_reset_name) { if (mode == MODE_RENAME) { // Name and path are set in `ProjectManager::_rename_project`. project_path->set_editable(false); @@ -722,8 +733,9 @@ void ProjectDialog::show_dialog() { callable_mp((Control *)project_name, &Control::grab_focus).call_deferred(); callable_mp(project_name, &LineEdit::select_all).call_deferred(); } else { - String proj = TTR("New Game Project"); - project_name->set_text(proj); + if (p_reset_name) { + _reset_name(); + } project_path->set_editable(true); String fav_dir = EDITOR_GET("filesystem/directories/default_project_path"); @@ -804,6 +816,7 @@ void ProjectDialog::_notification(int p_what) { fdialog_project->set_access(EditorFileDialog::ACCESS_FILESYSTEM); fdialog_project->connect("dir_selected", callable_mp(this, &ProjectDialog::_project_path_selected)); fdialog_project->connect("file_selected", callable_mp(this, &ProjectDialog::_project_path_selected)); + fdialog_project->connect("canceled", callable_mp(this, &ProjectDialog::show_dialog).bind(false), CONNECT_DEFERRED); callable_mp((Node *)this, &Node::add_sibling).call_deferred(fdialog_project, false); } break; } diff --git a/editor/project_manager/project_dialog.h b/editor/project_manager/project_dialog.h index f30c358baa..9cc1cd1576 100644 --- a/editor/project_manager/project_dialog.h +++ b/editor/project_manager/project_dialog.h @@ -124,6 +124,7 @@ private: void _project_path_selected(const String &p_path); void _install_path_selected(const String &p_path); + void _reset_name(); void _renderer_selected(); void _nonempty_confirmation_ok_pressed(); @@ -141,7 +142,7 @@ public: void set_zip_title(const String &p_title); void ask_for_path_and_show(); - void show_dialog(); + void show_dialog(bool p_reset_name = true); ProjectDialog(); }; diff --git a/editor/project_manager/quick_settings_dialog.cpp b/editor/project_manager/quick_settings_dialog.cpp index ee53bd7927..4502b42fe6 100644 --- a/editor/project_manager/quick_settings_dialog.cpp +++ b/editor/project_manager/quick_settings_dialog.cpp @@ -31,7 +31,7 @@ #include "quick_settings_dialog.h" #include "core/config/project_settings.h" -#include "core/string/translation.h" +#include "core/string/translation_server.h" #include "editor/editor_settings.h" #include "editor/editor_string_names.h" #include "editor/themes/editor_scale.h" @@ -43,7 +43,9 @@ #include "scene/gui/panel_container.h" void QuickSettingsDialog::_fetch_setting_values() { +#ifndef ANDROID_ENABLED editor_languages.clear(); +#endif editor_themes.clear(); editor_scales.clear(); editor_network_modes.clear(); @@ -55,7 +57,9 @@ void QuickSettingsDialog::_fetch_setting_values() { for (const PropertyInfo &pi : editor_settings_properties) { if (pi.name == "interface/editor/editor_language") { +#ifndef ANDROID_ENABLED editor_languages = pi.hint_string.split(","); +#endif } else if (pi.name == "interface/theme/preset") { editor_themes = pi.hint_string.split(","); } else if (pi.name == "interface/editor/display_scale") { @@ -70,6 +74,7 @@ void QuickSettingsDialog::_fetch_setting_values() { } void QuickSettingsDialog::_update_current_values() { +#ifndef ANDROID_ENABLED // Language options. { const String current_lang = EDITOR_GET("interface/editor/editor_language"); @@ -82,6 +87,7 @@ void QuickSettingsDialog::_update_current_values() { } } } +#endif // Theme options. { @@ -151,10 +157,12 @@ void QuickSettingsDialog::_add_setting_control(const String &p_text, Control *p_ container->add_child(p_control); } +#ifndef ANDROID_ENABLED void QuickSettingsDialog::_language_selected(int p_id) { const String selected_language = language_option_button->get_item_metadata(p_id); _set_setting_value("interface/editor/editor_language", selected_language, true); } +#endif void QuickSettingsDialog::_theme_selected(int p_id) { const String selected_theme = theme_option_button->get_item_text(p_id); @@ -195,7 +203,9 @@ void QuickSettingsDialog::_request_restart() { } void QuickSettingsDialog::update_size_limits(const Size2 &p_max_popup_size) { +#ifndef ANDROID_ENABLED language_option_button->get_popup()->set_max_size(p_max_popup_size); +#endif } void QuickSettingsDialog::_notification(int p_what) { @@ -237,6 +247,7 @@ QuickSettingsDialog::QuickSettingsDialog() { settings_list = memnew(VBoxContainer); settings_list_panel->add_child(settings_list); +#ifndef ANDROID_ENABLED // Language options. { language_option_button = memnew(OptionButton); @@ -252,6 +263,7 @@ QuickSettingsDialog::QuickSettingsDialog() { _add_setting_control(TTR("Language"), language_option_button); } +#endif // Theme options. { @@ -319,13 +331,6 @@ QuickSettingsDialog::QuickSettingsDialog() { } _update_current_values(); - -#ifdef ANDROID_ENABLED - // The language selection dropdown doesn't work on Android (as the setting isn't saved), see GH-60353. - // Also, the dropdown it spawns is very tall and can't be scrolled without a hardware mouse. - language_option_button->hide(); - scale_option_button->hide(); -#endif } // Restart required panel. diff --git a/editor/project_manager/quick_settings_dialog.h b/editor/project_manager/quick_settings_dialog.h index 7a03996934..938a6de16d 100644 --- a/editor/project_manager/quick_settings_dialog.h +++ b/editor/project_manager/quick_settings_dialog.h @@ -43,7 +43,9 @@ class VBoxContainer; class QuickSettingsDialog : public AcceptDialog { GDCLASS(QuickSettingsDialog, AcceptDialog); +#ifndef ANDROID_ENABLED Vector<String> editor_languages; +#endif Vector<String> editor_themes; Vector<String> editor_scales; Vector<String> editor_network_modes; @@ -57,7 +59,11 @@ class QuickSettingsDialog : public AcceptDialog { void _add_setting_control(const String &p_text, Control *p_control); +#ifndef ANDROID_ENABLED + // The language selection dropdown doesn't work on Android (as the setting isn't saved), see GH-60353. + // Also, the dropdown it spawns is very tall and can't be scrolled without a hardware mouse. OptionButton *language_option_button = nullptr; +#endif OptionButton *theme_option_button = nullptr; OptionButton *scale_option_button = nullptr; OptionButton *network_mode_option_button = nullptr; @@ -65,7 +71,9 @@ class QuickSettingsDialog : public AcceptDialog { Label *custom_theme_label = nullptr; +#ifndef ANDROID_ENABLED void _language_selected(int p_id); +#endif void _theme_selected(int p_id); void _scale_selected(int p_id); void _network_mode_selected(int p_id); |