From 8d2529019855f73a4c6cc8c9dafe2c0552089d2a Mon Sep 17 00:00:00 2001 From: Leandro Pereira Date: Fri, 16 Apr 2021 18:39:35 -0700 Subject: FileManager: Show file copying animation Bring some mid-90s charm and show a file flying animation while copying files. Icons for both source and destination directories are currently the default icons, but in the future they could be the respective icons for the destination directory. --- Base/res/graphics/file-flying-animation.gif | Bin 0 -> 1438 bytes Userland/Applications/FileManager/DirectoryView.cpp | 2 +- .../FileManager/FileOperationProgress.gml | 19 +++++++++++++++++++ .../FileManager/FileOperationProgressWidget.cpp | 11 +++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Base/res/graphics/file-flying-animation.gif diff --git a/Base/res/graphics/file-flying-animation.gif b/Base/res/graphics/file-flying-animation.gif new file mode 100644 index 0000000000..d4557d7f7b Binary files /dev/null and b/Base/res/graphics/file-flying-animation.gif differ diff --git a/Userland/Applications/FileManager/DirectoryView.cpp b/Userland/Applications/FileManager/DirectoryView.cpp index 14e1d689bc..eb1567e439 100644 --- a/Userland/Applications/FileManager/DirectoryView.cpp +++ b/Userland/Applications/FileManager/DirectoryView.cpp @@ -95,7 +95,7 @@ static void run_file_operation([[maybe_unused]] FileOperation operation, const S window->set_title("Copying Files..."); window->set_main_widget(pipe_input_file); - window->resize(320, 200); + window->resize(320, 190); if (parent_window) window->center_within(*parent_window); window->show(); diff --git a/Userland/Applications/FileManager/FileOperationProgress.gml b/Userland/Applications/FileManager/FileOperationProgress.gml index 2ab7257a3d..ab7012deff 100644 --- a/Userland/Applications/FileManager/FileOperationProgress.gml +++ b/Userland/Applications/FileManager/FileOperationProgress.gml @@ -5,6 +5,25 @@ margins: [4, 4, 4, 4] } + @GUI::Widget { + fixed_height: 32 + + layout: @GUI::HorizontalBoxLayout { + } + + @GUI::ImageWidget { + name: "source_folder_icon" + } + + @GUI::ImageWidget { + name: "file_copy_animation" + } + + @GUI::ImageWidget { + name: "destination_folder_icon" + } + } + @GUI::Label { text: "Copying files..." text_alignment: "CenterLeft" diff --git a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp index 83821344ea..5adbc0711f 100644 --- a/Userland/Applications/FileManager/FileOperationProgressWidget.cpp +++ b/Userland/Applications/FileManager/FileOperationProgressWidget.cpp @@ -29,6 +29,7 @@ #include #include #include +#include #include #include #include @@ -43,6 +44,16 @@ FileOperationProgressWidget::FileOperationProgressWidget(NonnullRefPtr("button"); + auto& file_copy_animation = *find_descendant_of_type_named("file_copy_animation"); + file_copy_animation.load_from_file("/res/graphics/file-flying-animation.gif"); + file_copy_animation.animate(); + + auto& source_folder_icon = *find_descendant_of_type_named("source_folder_icon"); + source_folder_icon.load_from_file("/res/icons/32x32/filetype-folder-open.png"); + + auto& destination_folder_icon = *find_descendant_of_type_named("destination_folder_icon"); + destination_folder_icon.load_from_file("/res/icons/32x32/filetype-folder-open.png"); + button.on_click = [this] { close_pipe(); window()->close(); -- cgit v1.2.3