Add scrolling to overwrite dialog

This commit is contained in:
kobewi 2023-05-18 00:09:44 +02:00
parent da21cb7042
commit ab787fe4d2
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;