Serenity Operating System
at master 39 lines 1.2 kB view raw
1/* 2 * Copyright (c) 2021, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#pragma once 8 9#include "FileUtils.h" 10#include <LibCore/ElapsedTimer.h> 11#include <LibCore/File.h> 12#include <LibGUI/Widget.h> 13 14namespace FileManager { 15 16class FileOperationProgressWidget : public GUI::Widget { 17 C_OBJECT(FileOperationProgressWidget); 18 19public: 20 virtual ~FileOperationProgressWidget() override; 21 22private: 23 // FIXME: The helper_pipe_fd parameter is only needed because we can't get the fd from a Core::Stream. 24 FileOperationProgressWidget(FileOperation, NonnullOwnPtr<Core::BufferedFile> helper_pipe, int helper_pipe_fd); 25 26 void did_finish(); 27 void did_error(StringView message); 28 void did_progress(off_t bytes_done, off_t total_byte_count, size_t files_done, size_t total_file_count, off_t current_file_done, off_t current_file_size, StringView current_filename); 29 30 void close_pipe(); 31 32 DeprecatedString estimate_time(off_t bytes_done, off_t total_byte_count); 33 Core::ElapsedTimer m_elapsed_timer; 34 35 FileOperation m_operation; 36 RefPtr<Core::Notifier> m_notifier; 37 OwnPtr<Core::BufferedFile> m_helper_pipe; 38}; 39}