mirror of
https://github.com/SerenityOS/serenity
synced 2024-10-06 16:09:30 +00:00
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.
This commit is contained in:
parent
eee8352494
commit
8d25290198
BIN
Base/res/graphics/file-flying-animation.gif
Normal file
BIN
Base/res/graphics/file-flying-animation.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
|
@ -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();
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue