1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 22:18:12 +00:00

FileManager: Show progress dialog for file deletions

Progress dialogs are nice! :^)

Showing a proper file-deletion animation would be nice, but that is
outside the scope of my abilities.
This commit is contained in:
Sam Atkins 2021-06-22 15:56:55 +01:00 committed by Andreas Kling
parent 967314023c
commit 469bca9d3a
3 changed files with 20 additions and 38 deletions

View file

@ -26,6 +26,7 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation
auto& button = *find_descendant_of_type_named<GUI::Button>("button");
// FIXME: Show a different animation for deletions
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();
@ -53,6 +54,10 @@ FileOperationProgressWidget::FileOperationProgressWidget(FileOperation operation
files_copied_label.set_text("Moving files...");
current_file_action_label.set_text("Moving: ");
break;
case FileOperation::Delete:
files_copied_label.set_text("Deleting files...");
current_file_action_label.set_text("Deleting: ");
break;
default:
VERIFY_NOT_REACHED();
}
@ -168,6 +173,9 @@ void FileOperationProgressWidget::did_progress(off_t bytes_done, off_t total_byt
case FileOperation::Move:
files_copied_label.set_text(String::formatted("Moving file {} of {}", files_done, total_file_count));
break;
case FileOperation::Delete:
files_copied_label.set_text(String::formatted("Deleting file {} of {}", files_done, total_file_count));
break;
default:
VERIFY_NOT_REACHED();
}