Merge pull request #77179 from KoBeWi/that's_a_lot_of_files

Add scrolling to overwrite dialog
This commit is contained in:
Yuri Sizov 2023-05-22 20:17:26 +02:00 committed by GitHub
commit 903dda8337
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 5 deletions

View file

@ -460,6 +460,8 @@ void FileSystemDock::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
overwrite_dialog_scroll->add_theme_style_override("panel", get_theme_stylebox("panel", "Tree"));
if (is_visible_in_tree()) {
_update_display_mode(true);
}
@ -1725,11 +1727,12 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_cop
Vector<String> conflicting_items = _check_existing();
if (!conflicting_items.is_empty()) {
// Ask to do something.
overwrite_dialog->set_text(vformat(
p_copy ? TTR("The following files or folders conflict with items in the target location '%s':\n\n%s\n\nDo you wish to overwrite them or rename the copied files?")
: TTR("The following files or folders conflict with items in the target location '%s':\n\n%s\n\nDo you wish to overwrite them or rename the moved files?"),
to_move_path,
String("\n").join(conflicting_items)));
overwrite_dialog_header->set_text(vformat(
TTR("The following files or folders conflict with items in the target location '%s':"), to_move_path));
overwrite_dialog_file_list->set_text(String("\n").join(conflicting_items));
overwrite_dialog_footer->set_text(
p_copy ? TTR("Do you wish to overwrite them or rename the copied files?")
: TTR("Do you wish to overwrite them or rename the moved files?"));
overwrite_dialog->popup_centered();
return;
}
@ -3368,6 +3371,22 @@ FileSystemDock::FileSystemDock() {
overwrite_dialog->add_button(TTR("Keep Both"), true)->connect("pressed", callable_mp(this, &FileSystemDock::_overwrite_dialog_action).bind(false));
overwrite_dialog->connect("confirmed", callable_mp(this, &FileSystemDock::_overwrite_dialog_action).bind(true));
VBoxContainer *overwrite_dialog_vb = memnew(VBoxContainer);
overwrite_dialog->add_child(overwrite_dialog_vb);
overwrite_dialog_header = memnew(Label);
overwrite_dialog_vb->add_child(overwrite_dialog_header);
overwrite_dialog_scroll = memnew(ScrollContainer);
overwrite_dialog_vb->add_child(overwrite_dialog_scroll);
overwrite_dialog_scroll->set_custom_minimum_size(Vector2(400, 600) * EDSCALE);
overwrite_dialog_file_list = memnew(Label);
overwrite_dialog_scroll->add_child(overwrite_dialog_file_list);
overwrite_dialog_footer = memnew(Label);
overwrite_dialog_vb->add_child(overwrite_dialog_footer);
duplicate_dialog = memnew(ConfirmationDialog);
VBoxContainer *duplicate_dialog_vb = memnew(VBoxContainer);
duplicate_dialog->add_child(duplicate_dialog_vb);

View file

@ -164,7 +164,13 @@ private:
ConfirmationDialog *duplicate_dialog = nullptr;
LineEdit *duplicate_dialog_text = nullptr;
DirectoryCreateDialog *make_dir_dialog = nullptr;
ConfirmationDialog *overwrite_dialog = nullptr;
ScrollContainer *overwrite_dialog_scroll = nullptr;
Label *overwrite_dialog_header = nullptr;
Label *overwrite_dialog_footer = nullptr;
Label *overwrite_dialog_file_list = nullptr;
SceneCreateDialog *make_scene_dialog = nullptr;
ScriptCreateDialog *make_script_dialog = nullptr;
ShaderCreateDialog *make_shader_dialog = nullptr;