diff options
author | Leandro Pereira <leandro@hardinfo.org> | 2021-04-16 18:39:35 -0700 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2021-04-17 09:41:35 +0200 |
commit | 8d2529019855f73a4c6cc8c9dafe2c0552089d2a (patch) | |
tree | e97e1f82df11efdd416e93ca77302fd40a0cef45 | |
parent | eee8352494ac0247e72029000b2b6d8f55fdc613 (diff) | |
download | serenity-8d2529019855f73a4c6cc8c9dafe2c0552089d2a.zip |
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.
-rw-r--r-- | Base/res/graphics/file-flying-animation.gif | bin | 0 -> 1438 bytes | |||
-rw-r--r-- | Userland/Applications/FileManager/DirectoryView.cpp | 2 | ||||
-rw-r--r-- | Userland/Applications/FileManager/FileOperationProgress.gml | 19 | ||||
-rw-r--r-- | Userland/Applications/FileManager/FileOperationProgressWidget.cpp | 11 |
4 files changed, 31 insertions, 1 deletions
diff --git a/Base/res/graphics/file-flying-animation.gif b/Base/res/graphics/file-flying-animation.gif Binary files differnew file mode 100644 index 0000000000..d4557d7f7b --- /dev/null +++ b/Base/res/graphics/file-flying-animation.gif 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<FileOperationProgressWidget>(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 <LibCore/File.h> #include <LibCore/Notifier.h> #include <LibGUI/Button.h> +#include <LibGUI/ImageWidget.h> #include <LibGUI/Label.h> #include <LibGUI/MessageBox.h> #include <LibGUI/Progressbar.h> @@ -43,6 +44,16 @@ FileOperationProgressWidget::FileOperationProgressWidget(NonnullRefPtr<Core::Fil auto& button = *find_descendant_of_type_named<GUI::Button>("button"); + auto& file_copy_animation = *find_descendant_of_type_named<GUI::ImageWidget>("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<GUI::ImageWidget>("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<GUI::ImageWidget>("destination_folder_icon"); + destination_folder_icon.load_from_file("/res/icons/32x32/filetype-folder-open.png"); + button.on_click = [this] { close_pipe(); window()->close(); |