From 73650d0fea1555437f1fee5cf66e657c16bc64ba Mon Sep 17 00:00:00 2001 From: kobewi Date: Thu, 29 Jun 2023 16:03:21 +0200 Subject: [PATCH] Add scrolling to overwrite dialog (cherry picked from commit ab787fe4d25d426f8a03922c09370adc442f16fe) --- editor/filesystem_dock.cpp | 26 ++++++++++++++++++++++---- editor/filesystem_dock.h | 6 ++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index e1924c7994c..d75d08c584c 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -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 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); diff --git a/editor/filesystem_dock.h b/editor/filesystem_dock.h index 9060f5c0a4d..87db28e2488 100644 --- a/editor/filesystem_dock.h +++ b/editor/filesystem_dock.h @@ -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;