summaryrefslogtreecommitdiff
path: root/editor/project_manager.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/project_manager.cpp')
-rw-r--r--editor/project_manager.cpp64
1 files changed, 32 insertions, 32 deletions
diff --git a/editor/project_manager.cpp b/editor/project_manager.cpp
index 341b59779d..134f238bb6 100644
--- a/editor/project_manager.cpp
+++ b/editor/project_manager.cpp
@@ -161,7 +161,7 @@ private:
}
}
- if (valid_path == "") {
+ if (valid_path.is_empty()) {
set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR);
memdelete(d);
get_ok_button()->set_disabled(true);
@@ -175,7 +175,7 @@ private:
valid_install_path = install_path->get_text().strip_edges();
}
- if (valid_install_path == "") {
+ if (valid_install_path.is_empty()) {
set_message(TTR("The path specified doesn't exist."), MESSAGE_ERROR, INSTALL_PATH);
memdelete(d);
get_ok_button()->set_disabled(true);
@@ -184,7 +184,7 @@ private:
}
if (mode == MODE_IMPORT || mode == MODE_RENAME) {
- if (valid_path != "" && !d->file_exists("project.godot")) {
+ if (!valid_path.is_empty() && !d->file_exists("project.godot")) {
if (valid_path.ends_with(".zip")) {
FileAccess *src_f = nullptr;
zlib_filefunc_def io = zipio_create_io_from_file(&src_f);
@@ -225,7 +225,7 @@ private:
d->list_dir_begin();
is_folder_empty = true;
String n = d->get_next();
- while (n != String()) {
+ while (!n.is_empty()) {
if (!n.begins_with(".")) {
// Allow `.`, `..` (reserved current/parent folder names)
// and hidden files/folders to be present.
@@ -265,7 +265,7 @@ private:
d->list_dir_begin();
is_folder_empty = true;
String n = d->get_next();
- while (n != String()) {
+ while (!n.is_empty()) {
if (!n.begins_with(".")) {
// Allow `.`, `..` (reserved current/parent folder names)
// and hidden files/folders to be present.
@@ -295,16 +295,16 @@ private:
void _path_text_changed(const String &p_path) {
String sp = _test_path();
- if (sp != "") {
+ if (!sp.is_empty()) {
// If the project name is empty or default, infer the project name from the selected folder name
- if (project_name->get_text().strip_edges() == "" || project_name->get_text().strip_edges() == TTR("New Game Project")) {
+ if (project_name->get_text().strip_edges().is_empty() || project_name->get_text().strip_edges() == TTR("New Game Project")) {
sp = sp.replace("\\", "/");
int lidx = sp.rfind("/");
if (lidx != -1) {
sp = sp.substr(lidx + 1, sp.length()).capitalize();
}
- if (sp == "" && mode == MODE_IMPORT) {
+ if (sp.is_empty() && mode == MODE_IMPORT) {
sp = TTR("Imported Project");
}
@@ -313,7 +313,7 @@ private:
}
}
- if (created_folder_path != "" && created_folder_path != p_path) {
+ if (!created_folder_path.is_empty() && created_folder_path != p_path) {
_remove_created_folder();
}
}
@@ -382,7 +382,7 @@ private:
void _create_folder() {
const String project_name_no_edges = project_name->get_text().strip_edges();
- if (project_name_no_edges == "" || created_folder_path != "" || project_name_no_edges.ends_with(".")) {
+ if (project_name_no_edges.is_empty() || !created_folder_path.is_empty() || project_name_no_edges.ends_with(".")) {
set_message(TTR("Invalid project name."), MESSAGE_WARNING);
return;
}
@@ -417,7 +417,7 @@ private:
_test_path();
- if (p_text.strip_edges() == "") {
+ if (p_text.strip_edges().is_empty()) {
set_message(TTR("It would be a good idea to name your project."), MESSAGE_ERROR);
}
}
@@ -432,7 +432,7 @@ private:
if (mode == MODE_RENAME) {
String dir2 = _test_path();
- if (dir2 == "") {
+ if (dir2.is_empty()) {
set_message(TTR("Invalid project path (changed anything?)."), MESSAGE_ERROR);
return;
}
@@ -546,7 +546,7 @@ private:
String path = fname;
- if (path == String() || path == zip_root || !zip_root.is_subsequence_of(path)) {
+ if (path.is_empty() || path == zip_root || !zip_root.is_subsequence_of(path)) {
//
} else if (path.ends_with("/")) { // a dir
@@ -617,7 +617,7 @@ private:
}
void _remove_created_folder() {
- if (created_folder_path != "") {
+ if (!created_folder_path.is_empty()) {
DirAccess *d = DirAccess::create(DirAccess::ACCESS_FILESYSTEM);
d->remove(created_folder_path);
memdelete(d);
@@ -717,7 +717,7 @@ public:
} else {
fav_dir = EditorSettings::get_singleton()->get("filesystem/directories/default_project_path");
- if (fav_dir != "") {
+ if (!fav_dir.is_empty()) {
project_path->set_text(fav_dir);
fdialog->set_current_dir(fav_dir);
} else {
@@ -850,7 +850,7 @@ public:
iphb->add_child(install_browse);
msg = memnew(Label);
- msg->set_align(Label::ALIGN_CENTER);
+ msg->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
vb->add_child(msg);
// rasterizer selection
@@ -904,8 +904,8 @@ public:
l->set_text(TTR("The renderer can be changed later, but scenes may need to be adjusted."));
// Add some extra spacing to separate it from the list above and the buttons below.
l->set_custom_minimum_size(Size2(0, 40) * EDSCALE);
- l->set_align(Label::ALIGN_CENTER);
- l->set_valign(Label::VALIGN_CENTER);
+ l->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
+ l->set_vertical_alignment(VERTICAL_ALIGNMENT_CENTER);
l->set_modulate(Color(1, 1, 1, 0.7));
rasterizer_container->add_child(l);
@@ -1158,7 +1158,7 @@ void ProjectList::load_project_icon(int p_index) {
Ref<Texture2D> default_icon = get_theme_icon(SNAME("DefaultProjectIcon"), SNAME("EditorIcons"));
Ref<Texture2D> icon;
- if (item.icon != "") {
+ if (!item.icon.is_empty()) {
Ref<Image> img;
img.instantiate();
Error err = img->load(item.icon.replace_first("res://", item.path + "/"));
@@ -1191,7 +1191,7 @@ ProjectList::Item ProjectList::load_project_data(const String &p_property_key, b
String project_name = TTR("Unnamed Project");
if (cf_err == OK) {
String cf_project_name = static_cast<String>(cf->get_value("application", "config/name", ""));
- if (cf_project_name != "") {
+ if (!cf_project_name.is_empty()) {
project_name = cf_project_name.xml_unescape();
}
config_version = (int)cf->get_value("", "config_version", 0);
@@ -1361,7 +1361,7 @@ void ProjectList::create_project_item_control(int p_index) {
favorite->set_mouse_filter(MOUSE_FILTER_PASS);
favorite->connect("pressed", callable_mp(this, &ProjectList::_favorite_pressed), varray(hb));
favorite_box->add_child(favorite);
- favorite_box->set_alignment(BoxContainer::ALIGN_CENTER);
+ favorite_box->set_alignment(BoxContainer::ALIGNMENT_CENTER);
hb->add_child(favorite_box);
hb->favorite_button = favorite;
hb->set_is_favorite(item.favorite);
@@ -1408,7 +1408,7 @@ void ProjectList::create_project_item_control(int p_index) {
unsupported_label->add_theme_font_override("font", get_theme_font(SNAME("title"), SNAME("EditorFonts")));
unsupported_label->add_theme_color_override("font_color", get_theme_color(SNAME("warning_color"), SNAME("Editor")));
unsupported_label->set_clip_text(true);
- unsupported_label->set_align(Label::ALIGN_RIGHT);
+ unsupported_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_RIGHT);
title_hb->add_child(unsupported_label);
Control *spacer = memnew(Control());
spacer->set_custom_minimum_size(Size2(10, 10));
@@ -1473,7 +1473,7 @@ void ProjectList::sort_projects() {
Item &item = _projects.write[i];
bool visible = true;
- if (_search_term != "") {
+ if (!_search_term.is_empty()) {
String search_path;
if (_search_term.find("/") != -1) {
// Search path will match the whole path
@@ -1785,7 +1785,7 @@ void ProjectList::_panel_input(const Ref<InputEvent> &p_ev, Node *p_hb) {
const Item &clicked_project = _projects[clicked_index];
if (mb.is_valid() && mb->is_pressed() && mb->get_button_index() == MouseButton::LEFT) {
- if (mb->is_shift_pressed() && _selected_project_keys.size() > 0 && _last_clicked != "" && clicked_project.project_key != _last_clicked) {
+ if (mb->is_shift_pressed() && _selected_project_keys.size() > 0 && !_last_clicked.is_empty() && clicked_project.project_key != _last_clicked) {
int anchor_index = -1;
for (int i = 0; i < _projects.size(); ++i) {
const Item &p = _projects[i];
@@ -2134,7 +2134,7 @@ void ProjectManager::_open_selected_projects_ask() {
PackedStringArray unsupported_features = project.unsupported_features;
Label *ask_update_label = ask_update_settings->get_label();
- ask_update_label->set_align(Label::ALIGN_LEFT); // Reset in case of previous center align.
+ ask_update_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_LEFT); // Reset in case of previous center align.
// Check if the config_version property was empty or 0
if (config_version == 0) {
@@ -2178,7 +2178,7 @@ void ProjectManager::_open_selected_projects_ask() {
warning_message += vformat(TTR("Warning: This project uses the following features not supported by this build of Godot:\n\n%s\n\n"), unsupported_features_str);
}
warning_message += TTR("Open anyway? Project will be modified.");
- ask_update_label->set_align(Label::ALIGN_CENTER);
+ ask_update_label->set_horizontal_alignment(HORIZONTAL_ALIGNMENT_CENTER);
ask_update_settings->set_text(warning_message);
ask_update_settings->popup_centered();
return;
@@ -2193,7 +2193,7 @@ void ProjectManager::_run_project_confirm() {
for (int i = 0; i < selected_list.size(); ++i) {
const String &selected_main = selected_list[i].main_scene;
- if (selected_main == "") {
+ if (selected_main.is_empty()) {
run_error_diag->set_text(TTR("Can't run project: no main scene defined.\nPlease edit the project and set the main scene in the Project Settings under the \"Application\" category."));
run_error_diag->popup_centered();
continue;
@@ -2246,7 +2246,7 @@ void ProjectManager::_scan_dir(const String &path, List<String> *r_projects) {
ERR_FAIL_COND_MSG(error != OK, "Could not scan directory at: " + path);
da->list_dir_begin();
String n = da->get_next();
- while (n != String()) {
+ while (!n.is_empty()) {
if (da->current_is_dir() && !n.begins_with(".")) {
_scan_dir(da->get_current_dir().plus_file(n), r_projects);
} else if (n == "project.godot") {
@@ -2388,7 +2388,7 @@ void ProjectManager::_files_dropped(PackedStringArray p_files, int p_screen) {
if (dir->change_dir(folders[0]) == OK) {
dir->list_dir_begin();
String file = dir->get_next();
- while (confirm && file != String()) {
+ while (confirm && !file.is_empty()) {
if (!dir->current_is_dir() && file.ends_with("project.godot")) {
confirm = false;
}
@@ -2537,7 +2537,7 @@ ProjectManager::ProjectManager() {
tabs = memnew(TabContainer);
center_box->add_child(tabs);
tabs->set_anchors_and_offsets_preset(Control::PRESET_WIDE);
- tabs->set_tab_align(TabContainer::ALIGN_LEFT);
+ tabs->set_tab_alignment(TabContainer::ALIGNMENT_LEFT);
tabs->connect("tab_changed", callable_mp(this, &ProjectManager::_on_tab_changed));
HBoxContainer *projects_hb = memnew(HBoxContainer);
@@ -2666,7 +2666,7 @@ ProjectManager::ProjectManager() {
{
// Version info and language options
settings_hb = memnew(HBoxContainer);
- settings_hb->set_alignment(BoxContainer::ALIGN_END);
+ settings_hb->set_alignment(BoxContainer::ALIGNMENT_END);
settings_hb->set_h_grow_direction(Control::GROW_DIRECTION_BEGIN);
settings_hb->set_anchors_and_offsets_preset(Control::PRESET_TOP_RIGHT);
@@ -2826,7 +2826,7 @@ ProjectManager::ProjectManager() {
}
String autoscan_path = EditorSettings::get_singleton()->get("filesystem/directories/autoscan_project_path");
- if (autoscan_path != "") {
+ if (!autoscan_path.is_empty()) {
if (dir_access->dir_exists(autoscan_path)) {
_scan_begin(autoscan_path);
} else {