Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
This commit is contained in:
@ -108,16 +108,18 @@ void ProjectExportDialog::_add_preset(int p_platform) {
|
||||
}
|
||||
}
|
||||
|
||||
if (valid)
|
||||
if (valid) {
|
||||
break;
|
||||
}
|
||||
|
||||
attempt++;
|
||||
name = EditorExport::get_singleton()->get_export_platform(p_platform)->get_name() + " " + itos(attempt);
|
||||
}
|
||||
|
||||
preset->set_name(name);
|
||||
if (make_runnable)
|
||||
if (make_runnable) {
|
||||
preset->set_runnable(make_runnable);
|
||||
}
|
||||
EditorExport::get_singleton()->add_export_preset(preset);
|
||||
_update_presets();
|
||||
_edit_preset(EditorExport::get_singleton()->get_export_preset_count() - 1);
|
||||
@ -137,8 +139,9 @@ void ProjectExportDialog::_update_presets() {
|
||||
updating = true;
|
||||
|
||||
Ref<EditorExportPreset> current;
|
||||
if (presets->get_current() >= 0 && presets->get_current() < presets->get_item_count())
|
||||
if (presets->get_current() >= 0 && presets->get_current() < presets->get_item_count()) {
|
||||
current = get_current_preset();
|
||||
}
|
||||
|
||||
int current_idx = -1;
|
||||
presets->clear();
|
||||
@ -149,8 +152,9 @@ void ProjectExportDialog::_update_presets() {
|
||||
}
|
||||
|
||||
String name = preset->get_name();
|
||||
if (preset->is_runnable())
|
||||
if (preset->is_runnable()) {
|
||||
name += " (" + TTR("Runnable") + ")";
|
||||
}
|
||||
preset->update_files_to_export();
|
||||
presets->add_item(name, preset->get_platform()->get_logo());
|
||||
}
|
||||
@ -237,8 +241,9 @@ void ProjectExportDialog::_edit_preset(int p_index) {
|
||||
Vector<String> items = error.split("\n", false);
|
||||
error = "";
|
||||
for (int i = 0; i < items.size(); i++) {
|
||||
if (i > 0)
|
||||
if (i > 0) {
|
||||
error += "\n";
|
||||
}
|
||||
error += " - " + items[i];
|
||||
}
|
||||
|
||||
@ -247,10 +252,11 @@ void ProjectExportDialog::_edit_preset(int p_index) {
|
||||
} else {
|
||||
export_error->hide();
|
||||
}
|
||||
if (needs_templates)
|
||||
if (needs_templates) {
|
||||
export_templates_error->show();
|
||||
else
|
||||
} else {
|
||||
export_templates_error->hide();
|
||||
}
|
||||
|
||||
export_button->set_disabled(true);
|
||||
get_ok()->set_disabled(true);
|
||||
@ -325,8 +331,9 @@ void ProjectExportDialog::_update_feature_list() {
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_custom_features_changed(const String &p_text) {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
ERR_FAIL_COND(current.is_null());
|
||||
@ -344,8 +351,9 @@ void ProjectExportDialog::_update_parameters(const String &p_edited_property) {
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_runnable_pressed() {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
ERR_FAIL_COND(current.is_null());
|
||||
@ -365,8 +373,9 @@ void ProjectExportDialog::_runnable_pressed() {
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_name_changed(const String &p_string) {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
ERR_FAIL_COND(current.is_null());
|
||||
@ -394,8 +403,9 @@ Ref<EditorExportPreset> ProjectExportDialog::get_current_preset() const {
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_export_path_changed(const StringName &p_property, const Variant &p_value, const String &p_field, bool p_changing) {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
ERR_FAIL_COND(current.is_null());
|
||||
@ -405,8 +415,9 @@ void ProjectExportDialog::_export_path_changed(const StringName &p_property, con
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_script_export_mode_changed(int p_mode) {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
ERR_FAIL_COND(current.is_null());
|
||||
@ -417,8 +428,9 @@ void ProjectExportDialog::_script_export_mode_changed(int p_mode) {
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_script_encryption_key_changed(const String &p_key) {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
ERR_FAIL_COND(current.is_null());
|
||||
@ -441,8 +453,9 @@ bool ProjectExportDialog::_validate_script_encryption_key(const String &p_key) {
|
||||
|
||||
void ProjectExportDialog::_duplicate_preset() {
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
if (current.is_null())
|
||||
if (current.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<EditorExportPreset> preset = current->get_platform()->create_preset();
|
||||
ERR_FAIL_COND(!preset.is_valid());
|
||||
@ -463,15 +476,17 @@ void ProjectExportDialog::_duplicate_preset() {
|
||||
}
|
||||
}
|
||||
|
||||
if (valid)
|
||||
if (valid) {
|
||||
break;
|
||||
}
|
||||
|
||||
name += " (copy)";
|
||||
}
|
||||
|
||||
preset->set_name(name);
|
||||
if (make_runnable)
|
||||
if (make_runnable) {
|
||||
preset->set_runnable(make_runnable);
|
||||
}
|
||||
preset->set_export_filter(current->get_export_filter());
|
||||
preset->set_include_filter(current->get_include_filter());
|
||||
preset->set_exclude_filter(current->get_exclude_filter());
|
||||
@ -488,8 +503,9 @@ void ProjectExportDialog::_duplicate_preset() {
|
||||
|
||||
void ProjectExportDialog::_delete_preset() {
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
if (current.is_null())
|
||||
if (current.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
delete_confirm->set_text(vformat(TTR("Delete preset '%s'?"), current->get_name()));
|
||||
delete_confirm->popup_centered_minsize();
|
||||
@ -533,11 +549,13 @@ Variant ProjectExportDialog::get_drag_data_fw(const Point2 &p_point, Control *p_
|
||||
bool ProjectExportDialog::can_drop_data_fw(const Point2 &p_point, const Variant &p_data, Control *p_from) const {
|
||||
if (p_from == presets) {
|
||||
Dictionary d = p_data;
|
||||
if (!d.has("type") || String(d["type"]) != "export_preset")
|
||||
if (!d.has("type") || String(d["type"]) != "export_preset") {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (presets->get_item_at_position(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point))
|
||||
if (presets->get_item_at_position(p_point, true) < 0 && !presets->is_pos_at_end_of_items(p_point)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -554,12 +572,13 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
|
||||
to_pos = presets->get_item_at_position(p_point, true);
|
||||
}
|
||||
|
||||
if (to_pos == -1 && !presets->is_pos_at_end_of_items(p_point))
|
||||
if (to_pos == -1 && !presets->is_pos_at_end_of_items(p_point)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (to_pos == from_pos)
|
||||
if (to_pos == from_pos) {
|
||||
return;
|
||||
else if (to_pos > from_pos) {
|
||||
} else if (to_pos > from_pos) {
|
||||
to_pos--;
|
||||
}
|
||||
|
||||
@ -568,20 +587,23 @@ void ProjectExportDialog::drop_data_fw(const Point2 &p_point, const Variant &p_d
|
||||
EditorExport::get_singleton()->add_export_preset(preset, to_pos);
|
||||
|
||||
_update_presets();
|
||||
if (to_pos >= 0)
|
||||
if (to_pos >= 0) {
|
||||
_edit_preset(to_pos);
|
||||
else
|
||||
} else {
|
||||
_edit_preset(presets->get_item_count() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_export_type_changed(int p_which) {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
if (current.is_null())
|
||||
if (current.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
current->set_export_filter(EditorExportPreset::ExportFilter(p_which));
|
||||
updating = true;
|
||||
@ -590,12 +612,14 @@ void ProjectExportDialog::_export_type_changed(int p_which) {
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_filter_changed(const String &p_filter) {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
if (current.is_null())
|
||||
if (current.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
current->set_include_filter(include_filters->get_text());
|
||||
current->set_exclude_filter(exclude_filters->get_text());
|
||||
@ -607,8 +631,9 @@ void ProjectExportDialog::_fill_resource_tree() {
|
||||
include_margin->hide();
|
||||
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
if (current.is_null())
|
||||
if (current.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
EditorExportPreset::ExportFilter f = current->get_export_filter();
|
||||
|
||||
@ -645,8 +670,9 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem
|
||||
|
||||
for (int i = 0; i < p_dir->get_file_count(); i++) {
|
||||
String type = p_dir->get_file_type(i);
|
||||
if (p_only_scenes && type != "PackedScene")
|
||||
if (p_only_scenes && type != "PackedScene") {
|
||||
continue;
|
||||
}
|
||||
|
||||
TreeItem *file = include_files->create_item(p_item);
|
||||
file->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
|
||||
@ -668,16 +694,19 @@ bool ProjectExportDialog::_fill_tree(EditorFileSystemDirectory *p_dir, TreeItem
|
||||
}
|
||||
|
||||
void ProjectExportDialog::_tree_changed() {
|
||||
if (updating)
|
||||
if (updating) {
|
||||
return;
|
||||
}
|
||||
|
||||
Ref<EditorExportPreset> current = get_current_preset();
|
||||
if (current.is_null())
|
||||
if (current.is_null()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TreeItem *item = include_files->get_edited();
|
||||
if (!item)
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
String path = item->get_metadata(0);
|
||||
bool added = item->is_checked(0);
|
||||
@ -762,10 +791,12 @@ void ProjectExportDialog::_validate_export_path(const String &p_path) {
|
||||
bool invalid_path = (p_path.get_file().get_basename() == "");
|
||||
|
||||
// Check if state change before needlessly messing with signals
|
||||
if (invalid_path && export_project->get_ok()->is_disabled())
|
||||
if (invalid_path && export_project->get_ok()->is_disabled()) {
|
||||
return;
|
||||
if (!invalid_path && !export_project->get_ok()->is_disabled())
|
||||
}
|
||||
if (!invalid_path && !export_project->get_ok()->is_disabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (invalid_path) {
|
||||
export_project->get_ok()->set_disabled(true);
|
||||
|
||||
Reference in New Issue
Block a user