Add scrolling to overwrite dialog

(cherry picked from commit ab787fe4d2)
This commit is contained in:
kobewi 2023-06-29 16:03:21 +02:00 committed by Yuri Sizov
parent f2738cbd41
commit 73650d0fea
2 changed files with 28 additions and 4 deletions

View File

@ -434,6 +434,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);
}
@ -1686,10 +1688,10 @@ void FileSystemDock::_move_operation_confirm(const String &p_to_path, bool p_ove
Vector<String> conflicting_items = _check_existing();
if (!conflicting_items.is_empty()) {
// Ask to do something.
overwrite_dialog->set_text(vformat(
TTR("The following files or folders conflict with items in the target location '%s':\n\n%s\n\nDo you wish to overwrite them?"),
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(TTR("Do you wish to overwrite them?"));
overwrite_dialog->popup_centered();
return;
}
@ -3298,6 +3300,22 @@ FileSystemDock::FileSystemDock() {
add_child(overwrite_dialog);
overwrite_dialog->connect("confirmed", callable_mp(this, &FileSystemDock::_move_with_overwrite));
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

@ -151,7 +151,13 @@ private:
LineEdit *duplicate_dialog_text = nullptr;
ConfirmationDialog *make_dir_dialog = nullptr;
LineEdit *make_dir_dialog_text = 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;