feat: modules moved and engine moved to submodule
This commit is contained in:
parent
dfb5e645cd
commit
c33d2130cc
5136 changed files with 225275 additions and 64485 deletions
|
|
@ -277,7 +277,7 @@ void ProjectDialog::_update_target_auto_dir() {
|
|||
case 0: // No convention
|
||||
break;
|
||||
case 1: // kebab-case
|
||||
new_auto_dir = new_auto_dir.to_lower().replace(" ", "-");
|
||||
new_auto_dir = new_auto_dir.to_kebab_case();
|
||||
break;
|
||||
case 2: // snake_case
|
||||
new_auto_dir = new_auto_dir.to_snake_case();
|
||||
|
|
@ -376,7 +376,7 @@ void ProjectDialog::_browse_project_path() {
|
|||
if (mode == MODE_IMPORT) {
|
||||
fdialog_project->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_ANY);
|
||||
fdialog_project->clear_filters();
|
||||
fdialog_project->add_filter("project.godot", vformat("%s %s", VERSION_NAME, TTR("Project")));
|
||||
fdialog_project->add_filter("project.godot", vformat("%s %s", GODOT_VERSION_NAME, TTR("Project")));
|
||||
fdialog_project->add_filter("*.zip", TTR("ZIP File"));
|
||||
} else {
|
||||
fdialog_project->set_file_mode(EditorFileDialog::FILE_MODE_OPEN_DIR);
|
||||
|
|
@ -725,6 +725,17 @@ void ProjectDialog::ok_pressed() {
|
|||
|
||||
hide();
|
||||
if (mode == MODE_NEW || mode == MODE_IMPORT || mode == MODE_INSTALL) {
|
||||
#ifdef ANDROID_ENABLED
|
||||
// Create a .nomedia file to hide assets from media apps on Android.
|
||||
const String nomedia_file_path = path.path_join(".nomedia");
|
||||
Ref<FileAccess> f2 = FileAccess::open(nomedia_file_path, FileAccess::WRITE);
|
||||
if (f2.is_null()) {
|
||||
// .nomedia isn't so critical.
|
||||
ERR_PRINT("Couldn't create .nomedia in project path.");
|
||||
} else {
|
||||
f2->close();
|
||||
}
|
||||
#endif
|
||||
emit_signal(SNAME("project_created"), path, edit_check_box->is_pressed());
|
||||
} else if (mode == MODE_RENAME) {
|
||||
emit_signal(SNAME("projects_updated"));
|
||||
|
|
@ -910,6 +921,7 @@ ProjectDialog::ProjectDialog() {
|
|||
|
||||
project_path = memnew(LineEdit);
|
||||
project_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
project_path->set_accessibility_name(TTRC("Project Path"));
|
||||
project_path->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE);
|
||||
pphb->add_child(project_path);
|
||||
|
||||
|
|
@ -925,6 +937,7 @@ ProjectDialog::ProjectDialog() {
|
|||
|
||||
install_path = memnew(LineEdit);
|
||||
install_path->set_h_size_flags(Control::SIZE_EXPAND_FILL);
|
||||
install_path->set_accessibility_name(TTRC("Install Path"));
|
||||
install_path->set_structured_text_bidi_override(TextServer::STRUCTURED_TEXT_FILE);
|
||||
iphb->add_child(install_path);
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef PROJECT_DIALOG_H
|
||||
#define PROJECT_DIALOG_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/dialogs.h"
|
||||
|
||||
|
|
@ -150,5 +149,3 @@ public:
|
|||
|
||||
ProjectDialog();
|
||||
};
|
||||
|
||||
#endif // PROJECT_DIALOG_H
|
||||
|
|
|
|||
|
|
@ -49,6 +49,10 @@
|
|||
#include "scene/gui/texture_rect.h"
|
||||
#include "scene/resources/image_texture.h"
|
||||
|
||||
const char *ProjectList::SIGNAL_LIST_CHANGED = "list_changed";
|
||||
const char *ProjectList::SIGNAL_SELECTION_CHANGED = "selection_changed";
|
||||
const char *ProjectList::SIGNAL_PROJECT_ASK_OPEN = "project_ask_open";
|
||||
|
||||
void ProjectListItemControl::_notification(int p_what) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_THEME_CHANGED: {
|
||||
|
|
@ -68,21 +72,60 @@ void ProjectListItemControl::_notification(int p_what) {
|
|||
project_unsupported_features->set_texture(get_editor_theme_icon(SNAME("NodeWarning")));
|
||||
|
||||
favorite_button->set_texture_normal(get_editor_theme_icon(SNAME("Favorites")));
|
||||
|
||||
if (project_is_missing) {
|
||||
explore_button->set_button_icon(get_editor_theme_icon(SNAME("FileBroken")));
|
||||
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||
} else {
|
||||
explore_button->set_button_icon(get_editor_theme_icon(SNAME("Load")));
|
||||
#endif
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_MOUSE_ENTER: {
|
||||
is_hovering = true;
|
||||
queue_redraw();
|
||||
queue_accessibility_update();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_MOUSE_EXIT: {
|
||||
is_hovering = false;
|
||||
queue_redraw();
|
||||
queue_accessibility_update();
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
|
||||
RID ae = get_accessibility_element();
|
||||
ERR_FAIL_COND(ae.is_null());
|
||||
|
||||
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_LIST_BOX_OPTION);
|
||||
DisplayServer::get_singleton()->accessibility_update_set_name(ae, TTR("Project") + " " + project_title->get_text());
|
||||
DisplayServer::get_singleton()->accessibility_update_set_value(ae, project_title->get_text());
|
||||
|
||||
DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_CLICK, callable_mp(this, &ProjectListItemControl::_accessibility_action_open));
|
||||
DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_SCROLL_INTO_VIEW, callable_mp(this, &ProjectListItemControl::_accessibility_action_scroll_into_view));
|
||||
DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_FOCUS, callable_mp(this, &ProjectListItemControl::_accessibility_action_focus));
|
||||
DisplayServer::get_singleton()->accessibility_update_add_action(ae, DisplayServer::AccessibilityAction::ACTION_BLUR, callable_mp(this, &ProjectListItemControl::_accessibility_action_blur));
|
||||
|
||||
ProjectList *pl = get_list();
|
||||
if (pl) {
|
||||
DisplayServer::get_singleton()->accessibility_update_set_list_item_index(ae, pl->get_index(this));
|
||||
}
|
||||
DisplayServer::get_singleton()->accessibility_update_set_list_item_level(ae, 0);
|
||||
DisplayServer::get_singleton()->accessibility_update_set_list_item_selected(ae, is_selected);
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_FOCUS_ENTER: {
|
||||
ProjectList *pl = get_list();
|
||||
if (pl) {
|
||||
int idx = pl->get_index(this);
|
||||
if (idx >= 0) {
|
||||
pl->ensure_project_visible(idx);
|
||||
pl->select_project(idx);
|
||||
|
||||
pl->emit_signal(SNAME(ProjectList::SIGNAL_SELECTION_CHANGED));
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_DRAW: {
|
||||
|
|
@ -98,6 +141,53 @@ void ProjectListItemControl::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
|
||||
ProjectList *ProjectListItemControl::get_list() const {
|
||||
if (!is_inside_tree()) {
|
||||
return nullptr;
|
||||
}
|
||||
ProjectList *pl = Object::cast_to<ProjectList>(get_parent()->get_parent());
|
||||
return pl;
|
||||
}
|
||||
|
||||
void ProjectListItemControl::_accessibility_action_scroll_into_view(const Variant &p_data) {
|
||||
ProjectList *pl = get_list();
|
||||
if (pl) {
|
||||
int idx = pl->get_index(this);
|
||||
if (idx >= 0) {
|
||||
pl->ensure_project_visible(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectListItemControl::_accessibility_action_open(const Variant &p_data) {
|
||||
ProjectList *pl = get_list();
|
||||
if (pl && !pl->project_opening_initiated) {
|
||||
pl->emit_signal(SNAME(ProjectList::SIGNAL_PROJECT_ASK_OPEN));
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectListItemControl::_accessibility_action_focus(const Variant &p_data) {
|
||||
ProjectList *pl = get_list();
|
||||
if (pl) {
|
||||
int idx = pl->get_index(this);
|
||||
if (idx >= 0) {
|
||||
pl->ensure_project_visible(idx);
|
||||
pl->select_project(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectListItemControl::_accessibility_action_blur(const Variant &p_data) {
|
||||
ProjectList *pl = get_list();
|
||||
if (pl) {
|
||||
int idx = pl->get_index(this);
|
||||
if (idx >= 0) {
|
||||
pl->ensure_project_visible(idx);
|
||||
pl->deselect_project(idx);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectListItemControl::_favorite_button_pressed() {
|
||||
emit_signal(SNAME("favorite_pressed"));
|
||||
}
|
||||
|
|
@ -108,10 +198,14 @@ void ProjectListItemControl::_explore_button_pressed() {
|
|||
|
||||
void ProjectListItemControl::set_project_title(const String &p_title) {
|
||||
project_title->set_text(p_title);
|
||||
project_title->set_accessibility_name(TTRC("Project Name"));
|
||||
queue_accessibility_update();
|
||||
}
|
||||
|
||||
void ProjectListItemControl::set_project_path(const String &p_path) {
|
||||
project_path->set_text(p_path);
|
||||
project_path->set_accessibility_name(TTRC("Project Path"));
|
||||
queue_accessibility_update();
|
||||
}
|
||||
|
||||
void ProjectListItemControl::set_tags(const PackedStringArray &p_tags, ProjectList *p_parent_list) {
|
||||
|
|
@ -153,7 +247,7 @@ void ProjectListItemControl::set_unsupported_features(PackedStringArray p_featur
|
|||
project_version_major = project_version_split[0].to_int();
|
||||
project_version_minor = project_version_split[1].to_int();
|
||||
}
|
||||
if (VERSION_MAJOR != project_version_major || VERSION_MINOR <= project_version_minor) {
|
||||
if (GODOT_VERSION_MAJOR != project_version_major || GODOT_VERSION_MINOR <= project_version_minor) {
|
||||
// Don't show a warning if the project was last edited in a previous minor version.
|
||||
tooltip_text += TTR("This project was last edited in a different Godot version: ") + p_features[i] + "\n";
|
||||
}
|
||||
|
|
@ -169,6 +263,8 @@ void ProjectListItemControl::set_unsupported_features(PackedStringArray p_featur
|
|||
return;
|
||||
}
|
||||
project_version->set_tooltip_text(tooltip_text);
|
||||
project_unsupported_features->set_focus_mode(FOCUS_ACCESSIBILITY);
|
||||
project_unsupported_features->set_accessibility_name(tooltip_text);
|
||||
project_unsupported_features->set_tooltip_text(tooltip_text);
|
||||
project_unsupported_features->show();
|
||||
} else {
|
||||
|
|
@ -183,6 +279,7 @@ bool ProjectListItemControl::should_load_project_icon() const {
|
|||
void ProjectListItemControl::set_selected(bool p_selected) {
|
||||
is_selected = p_selected;
|
||||
queue_redraw();
|
||||
queue_accessibility_update();
|
||||
}
|
||||
|
||||
void ProjectListItemControl::set_is_favorite(bool p_favorite) {
|
||||
|
|
@ -190,9 +287,6 @@ void ProjectListItemControl::set_is_favorite(bool p_favorite) {
|
|||
}
|
||||
|
||||
void ProjectListItemControl::set_is_missing(bool p_missing) {
|
||||
if (project_is_missing == p_missing) {
|
||||
return;
|
||||
}
|
||||
project_is_missing = p_missing;
|
||||
|
||||
if (project_is_missing) {
|
||||
|
|
@ -201,10 +295,8 @@ void ProjectListItemControl::set_is_missing(bool p_missing) {
|
|||
explore_button->set_button_icon(get_editor_theme_icon(SNAME("FileBroken")));
|
||||
explore_button->set_tooltip_text(TTR("Error: Project is missing on the filesystem."));
|
||||
} else {
|
||||
project_icon->set_modulate(Color(1, 1, 1, 1.0));
|
||||
|
||||
explore_button->set_button_icon(get_editor_theme_icon(SNAME("Load")));
|
||||
#if !defined(ANDROID_ENABLED) && !defined(WEB_ENABLED)
|
||||
explore_button->set_button_icon(get_editor_theme_icon(SNAME("Load")));
|
||||
explore_button->set_tooltip_text(TTR("Show in File Manager"));
|
||||
#else
|
||||
// Opening the system file manager is not supported on the Android and web editors.
|
||||
|
|
@ -238,6 +330,8 @@ ProjectListItemControl::ProjectListItemControl() {
|
|||
|
||||
favorite_button = memnew(TextureButton);
|
||||
favorite_button->set_name("FavoriteButton");
|
||||
favorite_button->set_tooltip_text(TTR("Add to favorites"));
|
||||
favorite_button->set_accessibility_name(TTRC("Add to favorites"));
|
||||
// This makes the project's "hover" style display correctly when hovering the favorite icon.
|
||||
favorite_button->set_mouse_filter(MOUSE_FILTER_PASS);
|
||||
favorite_box->add_child(favorite_button);
|
||||
|
|
@ -285,6 +379,8 @@ ProjectListItemControl::ProjectListItemControl() {
|
|||
|
||||
explore_button = memnew(Button);
|
||||
explore_button->set_name("ExploreButton");
|
||||
explore_button->set_tooltip_text(TTR("Open in file manager"));
|
||||
explore_button->set_accessibility_name(TTRC("Open in file manager"));
|
||||
explore_button->set_flat(true);
|
||||
path_hb->add_child(explore_button);
|
||||
explore_button->connect(SceneStringName(pressed), callable_mp(this, &ProjectListItemControl::_explore_button_pressed));
|
||||
|
|
@ -345,10 +441,6 @@ struct ProjectListComparator {
|
|||
}
|
||||
};
|
||||
|
||||
const char *ProjectList::SIGNAL_LIST_CHANGED = "list_changed";
|
||||
const char *ProjectList::SIGNAL_SELECTION_CHANGED = "selection_changed";
|
||||
const char *ProjectList::SIGNAL_PROJECT_ASK_OPEN = "project_ask_open";
|
||||
|
||||
// Helpers.
|
||||
|
||||
bool ProjectList::project_feature_looks_like_version(const String &p_feature) {
|
||||
|
|
@ -378,6 +470,15 @@ void ProjectList::_notification(int p_what) {
|
|||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case NOTIFICATION_ACCESSIBILITY_UPDATE: {
|
||||
RID ae = get_accessibility_element();
|
||||
ERR_FAIL_COND(ae.is_null());
|
||||
|
||||
DisplayServer::get_singleton()->accessibility_update_set_role(ae, DisplayServer::AccessibilityRole::ROLE_LIST_BOX);
|
||||
DisplayServer::get_singleton()->accessibility_update_set_list_item_count(ae, _projects.size());
|
||||
DisplayServer::get_singleton()->accessibility_update_set_flag(ae, DisplayServer::AccessibilityFlags::FLAG_MULTISELECTABLE, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -446,7 +547,7 @@ void ProjectList::_migrate_config() {
|
|||
String path = EDITOR_GET(property_key);
|
||||
print_line("Migrating legacy project '" + path + "'.");
|
||||
|
||||
String favoriteKey = "favorite_projects/" + property_key.get_slice("/", 1);
|
||||
String favoriteKey = "favorite_projects/" + property_key.get_slicec('/', 1);
|
||||
bool favorite = EditorSettings::get_singleton()->has_setting(favoriteKey);
|
||||
add_project(path, favorite);
|
||||
if (favorite) {
|
||||
|
|
@ -637,6 +738,7 @@ void ProjectList::update_project_list() {
|
|||
|
||||
set_v_scroll(0);
|
||||
emit_signal(SNAME(SIGNAL_LIST_CHANGED));
|
||||
queue_accessibility_update();
|
||||
}
|
||||
|
||||
void ProjectList::sort_projects() {
|
||||
|
|
@ -653,7 +755,7 @@ void ProjectList::sort_projects() {
|
|||
PackedStringArray remaining;
|
||||
for (const String &part : search_parts) {
|
||||
if (part.begins_with("tag:")) {
|
||||
tags.push_back(part.get_slice(":", 1));
|
||||
tags.push_back(part.get_slicec(':', 1));
|
||||
} else {
|
||||
remaining.append(part);
|
||||
}
|
||||
|
|
@ -701,6 +803,7 @@ void ProjectList::sort_projects() {
|
|||
// Rewind the coroutine because order of projects changed
|
||||
_update_icons_async();
|
||||
update_dock_menu();
|
||||
queue_accessibility_update();
|
||||
}
|
||||
|
||||
int ProjectList::get_project_count() const {
|
||||
|
|
@ -791,6 +894,7 @@ void ProjectList::add_project(const String &dir_path, bool favorite) {
|
|||
if (!_config.has_section(dir_path)) {
|
||||
_config.set_value(dir_path, "favorite", favorite);
|
||||
}
|
||||
queue_accessibility_update();
|
||||
}
|
||||
|
||||
void ProjectList::set_project_version(const String &p_project_path, int p_version) {
|
||||
|
|
@ -850,6 +954,15 @@ int ProjectList::refresh_project(const String &dir_path) {
|
|||
return index;
|
||||
}
|
||||
|
||||
int ProjectList::get_index(const ProjectListItemControl *p_control) const {
|
||||
for (int i = 0; i < _projects.size(); ++i) {
|
||||
if (_projects[i].control == p_control) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
void ProjectList::ensure_project_visible(int p_index) {
|
||||
const Item &item = _projects[p_index];
|
||||
ensure_control_visible(item.control);
|
||||
|
|
@ -917,6 +1030,7 @@ void ProjectList::_remove_project(int p_index, bool p_update_config) {
|
|||
// Not actually saving the file, in case you are doing more changes to settings
|
||||
}
|
||||
|
||||
queue_accessibility_update();
|
||||
update_dock_menu();
|
||||
}
|
||||
|
||||
|
|
@ -998,18 +1112,21 @@ void ProjectList::_clear_project_selection() {
|
|||
for (int i = 0; i < previous_selected_items.size(); ++i) {
|
||||
previous_selected_items[i].control->set_selected(false);
|
||||
}
|
||||
queue_accessibility_update();
|
||||
}
|
||||
|
||||
void ProjectList::_select_project_nocheck(int p_index) {
|
||||
Item &item = _projects.write[p_index];
|
||||
_selected_project_paths.insert(item.path);
|
||||
item.control->set_selected(true);
|
||||
queue_accessibility_update();
|
||||
}
|
||||
|
||||
void ProjectList::_deselect_project_nocheck(int p_index) {
|
||||
Item &item = _projects.write[p_index];
|
||||
_selected_project_paths.erase(item.path);
|
||||
item.control->set_selected(false);
|
||||
queue_accessibility_update();
|
||||
}
|
||||
|
||||
inline void _sort_project_range(int &a, int &b) {
|
||||
|
|
@ -1035,6 +1152,10 @@ void ProjectList::select_project(int p_index) {
|
|||
_select_project_nocheck(p_index);
|
||||
}
|
||||
|
||||
void ProjectList::deselect_project(int p_index) {
|
||||
_deselect_project_nocheck(p_index);
|
||||
}
|
||||
|
||||
void ProjectList::select_first_visible_project() {
|
||||
_clear_project_selection();
|
||||
|
||||
|
|
@ -1048,7 +1169,7 @@ void ProjectList::select_first_visible_project() {
|
|||
|
||||
Vector<ProjectList::Item> ProjectList::get_selected_projects() const {
|
||||
Vector<Item> items;
|
||||
if (_selected_project_paths.size() == 0) {
|
||||
if (_selected_project_paths.is_empty()) {
|
||||
return items;
|
||||
}
|
||||
items.resize(_selected_project_paths.size());
|
||||
|
|
@ -1069,7 +1190,7 @@ const HashSet<String> &ProjectList::get_selected_project_keys() const {
|
|||
}
|
||||
|
||||
int ProjectList::get_single_selected_index() const {
|
||||
if (_selected_project_paths.size() == 0) {
|
||||
if (_selected_project_paths.is_empty()) {
|
||||
// Default selection
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -1090,7 +1211,7 @@ int ProjectList::get_single_selected_index() const {
|
|||
}
|
||||
|
||||
void ProjectList::erase_selected_projects(bool p_delete_project_contents) {
|
||||
if (_selected_project_paths.size() == 0) {
|
||||
if (_selected_project_paths.is_empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef PROJECT_LIST_H
|
||||
#define PROJECT_LIST_H
|
||||
#pragma once
|
||||
|
||||
#include "core/io/config_file.h"
|
||||
#include "scene/gui/box_container.h"
|
||||
|
|
@ -65,6 +64,13 @@ class ProjectListItemControl : public HBoxContainer {
|
|||
void _favorite_button_pressed();
|
||||
void _explore_button_pressed();
|
||||
|
||||
ProjectList *get_list() const;
|
||||
|
||||
void _accessibility_action_open(const Variant &p_data);
|
||||
void _accessibility_action_scroll_into_view(const Variant &p_data);
|
||||
void _accessibility_action_focus(const Variant &p_data);
|
||||
void _accessibility_action_blur(const Variant &p_data);
|
||||
|
||||
protected:
|
||||
void _notification(int p_what);
|
||||
static void _bind_methods();
|
||||
|
|
@ -92,6 +98,7 @@ class ProjectList : public ScrollContainer {
|
|||
GDCLASS(ProjectList, ScrollContainer)
|
||||
|
||||
friend class ProjectManager;
|
||||
friend class ProjectListItemControl;
|
||||
|
||||
public:
|
||||
enum FilterOption {
|
||||
|
|
@ -259,10 +266,12 @@ public:
|
|||
void set_project_version(const String &p_project_path, int version);
|
||||
int refresh_project(const String &dir_path);
|
||||
void ensure_project_visible(int p_index);
|
||||
int get_index(const ProjectListItemControl *p_control) const;
|
||||
|
||||
// Project list selection.
|
||||
|
||||
void select_project(int p_index);
|
||||
void deselect_project(int p_index);
|
||||
void select_first_visible_project();
|
||||
Vector<Item> get_selected_projects() const;
|
||||
const HashSet<String> &get_selected_project_keys() const;
|
||||
|
|
@ -286,5 +295,3 @@ public:
|
|||
|
||||
ProjectList();
|
||||
};
|
||||
|
||||
#endif // PROJECT_LIST_H
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ ProjectTag::ProjectTag(const String &p_text, bool p_display_close) {
|
|||
add_child(button);
|
||||
button->set_auto_translate_mode(AUTO_TRANSLATE_MODE_DISABLED);
|
||||
button->set_text(p_text.capitalize());
|
||||
button->set_focus_mode(FOCUS_NONE);
|
||||
button->set_focus_mode(FOCUS_ACCESSIBILITY);
|
||||
button->set_accessibility_name(vformat(TTR("Project Tag: %s"), p_text));
|
||||
button->set_icon_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
|
||||
button->set_theme_type_variation(SNAME("ProjectTagButton"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef PROJECT_TAG_H
|
||||
#define PROJECT_TAG_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/box_container.h"
|
||||
|
||||
|
|
@ -52,5 +51,3 @@ public:
|
|||
|
||||
ProjectTag(const String &p_text, bool p_display_close = false);
|
||||
};
|
||||
|
||||
#endif // PROJECT_TAG_H
|
||||
|
|
|
|||
|
|
@ -48,6 +48,7 @@ void QuickSettingsDialog::_fetch_setting_values() {
|
|||
editor_themes.clear();
|
||||
editor_scales.clear();
|
||||
editor_network_modes.clear();
|
||||
editor_engine_version_update_modes.clear();
|
||||
editor_directory_naming_conventions.clear();
|
||||
|
||||
{
|
||||
|
|
@ -65,6 +66,8 @@ void QuickSettingsDialog::_fetch_setting_values() {
|
|||
editor_scales = pi.hint_string.split(",");
|
||||
} else if (pi.name == "network/connection/network_mode") {
|
||||
editor_network_modes = pi.hint_string.split(",");
|
||||
} else if (pi.name == "network/connection/engine_version_update_mode") {
|
||||
editor_engine_version_update_modes = pi.hint_string.split(",");
|
||||
} else if (pi.name == "project_manager/directory_naming_convention") {
|
||||
editor_directory_naming_conventions = pi.hint_string.split(",");
|
||||
}
|
||||
|
|
@ -130,6 +133,22 @@ void QuickSettingsDialog::_update_current_values() {
|
|||
}
|
||||
}
|
||||
|
||||
// Engine version update mode options.
|
||||
{
|
||||
const int current_update_mode = EDITOR_GET("network/connection/engine_version_update_mode");
|
||||
|
||||
for (int i = 0; i < editor_engine_version_update_modes.size(); i++) {
|
||||
const String &engine_version_update_mode_value = editor_engine_version_update_modes[i];
|
||||
if (current_update_mode == i) {
|
||||
engine_version_update_mode_button->set_text(engine_version_update_mode_value);
|
||||
engine_version_update_mode_button->select(i);
|
||||
|
||||
// Disables Engine Version Update Mode selection if Network mode is set to Offline.
|
||||
engine_version_update_mode_button->set_disabled(!EDITOR_GET("network/connection/network_mode"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Project directory naming options.
|
||||
{
|
||||
const int current_directory_naming = EDITOR_GET("project_manager/directory_naming_convention");
|
||||
|
|
@ -177,6 +196,13 @@ void QuickSettingsDialog::_scale_selected(int p_id) {
|
|||
|
||||
void QuickSettingsDialog::_network_mode_selected(int p_id) {
|
||||
_set_setting_value("network/connection/network_mode", p_id);
|
||||
|
||||
// Disables Engine Version Update Mode selection if Network mode is set to Offline.
|
||||
engine_version_update_mode_button->set_disabled(!p_id);
|
||||
}
|
||||
|
||||
void QuickSettingsDialog::_engine_version_update_mode_selected(int p_id) {
|
||||
_set_setting_value("network/connection/engine_version_update_mode", p_id);
|
||||
}
|
||||
|
||||
void QuickSettingsDialog::_directory_naming_convention_selected(int p_id) {
|
||||
|
|
@ -192,7 +218,11 @@ void QuickSettingsDialog::_set_setting_value(const String &p_setting, const Vari
|
|||
restart_required_label->show();
|
||||
|
||||
if (!restart_required_button) {
|
||||
restart_required_button = add_button(TTR("Restart Now"), !GLOBAL_GET("gui/common/swap_cancel_ok"));
|
||||
int ed_swap_cancel_ok = EDITOR_GET("interface/editor/accept_dialog_cancel_ok_buttons");
|
||||
if (ed_swap_cancel_ok == 0) {
|
||||
ed_swap_cancel_ok = DisplayServer::get_singleton()->get_swap_cancel_ok() ? 2 : 1;
|
||||
}
|
||||
restart_required_button = add_button(TTR("Restart Now"), ed_swap_cancel_ok != 2);
|
||||
restart_required_button->connect(SceneStringName(pressed), callable_mp(this, &QuickSettingsDialog::_request_restart));
|
||||
}
|
||||
}
|
||||
|
|
@ -316,6 +346,20 @@ QuickSettingsDialog::QuickSettingsDialog() {
|
|||
_add_setting_control(TTR("Network Mode"), network_mode_option_button);
|
||||
}
|
||||
|
||||
// Engine version update mode options.
|
||||
{
|
||||
engine_version_update_mode_button = memnew(OptionButton);
|
||||
engine_version_update_mode_button->set_fit_to_longest_item(false);
|
||||
engine_version_update_mode_button->connect(SceneStringName(item_selected), callable_mp(this, &QuickSettingsDialog::_engine_version_update_mode_selected));
|
||||
|
||||
for (int i = 0; i < editor_engine_version_update_modes.size(); i++) {
|
||||
const String &engine_version_update_mode_value = editor_engine_version_update_modes[i];
|
||||
engine_version_update_mode_button->add_item(engine_version_update_mode_value, i);
|
||||
}
|
||||
|
||||
_add_setting_control(TTR("Engine Version Update Mode"), engine_version_update_mode_button);
|
||||
}
|
||||
|
||||
// Project directory naming options.
|
||||
{
|
||||
directory_naming_convention_button = memnew(OptionButton);
|
||||
|
|
|
|||
|
|
@ -28,8 +28,7 @@
|
|||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/**************************************************************************/
|
||||
|
||||
#ifndef QUICK_SETTINGS_DIALOG_H
|
||||
#define QUICK_SETTINGS_DIALOG_H
|
||||
#pragma once
|
||||
|
||||
#include "scene/gui/dialogs.h"
|
||||
|
||||
|
|
@ -49,6 +48,7 @@ class QuickSettingsDialog : public AcceptDialog {
|
|||
Vector<String> editor_themes;
|
||||
Vector<String> editor_scales;
|
||||
Vector<String> editor_network_modes;
|
||||
Vector<String> editor_engine_version_update_modes;
|
||||
Vector<String> editor_directory_naming_conventions;
|
||||
|
||||
void _fetch_setting_values();
|
||||
|
|
@ -67,6 +67,7 @@ class QuickSettingsDialog : public AcceptDialog {
|
|||
OptionButton *theme_option_button = nullptr;
|
||||
OptionButton *scale_option_button = nullptr;
|
||||
OptionButton *network_mode_option_button = nullptr;
|
||||
OptionButton *engine_version_update_mode_button = nullptr;
|
||||
OptionButton *directory_naming_convention_button = nullptr;
|
||||
|
||||
Label *custom_theme_label = nullptr;
|
||||
|
|
@ -77,6 +78,7 @@ class QuickSettingsDialog : public AcceptDialog {
|
|||
void _theme_selected(int p_id);
|
||||
void _scale_selected(int p_id);
|
||||
void _network_mode_selected(int p_id);
|
||||
void _engine_version_update_mode_selected(int p_id);
|
||||
void _directory_naming_convention_selected(int p_id);
|
||||
void _set_setting_value(const String &p_setting, const Variant &p_value, bool p_restart_required = false);
|
||||
|
||||
|
|
@ -94,5 +96,3 @@ public:
|
|||
|
||||
QuickSettingsDialog();
|
||||
};
|
||||
|
||||
#endif // QUICK_SETTINGS_DIALOG_H
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue