2021-04-12 20:32:40 +02:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
2021-04-22 01:24:48 -07:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-04-12 20:32:40 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
2021-06-22 12:56:40 +01:00
|
|
|
#include "FileUtils.h"
|
2021-04-16 18:41:44 -07:00
|
|
|
#include <LibCore/ElapsedTimer.h>
|
2023-02-09 03:02:46 +01:00
|
|
|
#include <LibCore/File.h>
|
2021-04-12 20:32:40 +02:00
|
|
|
#include <LibGUI/Widget.h>
|
|
|
|
|
|
|
|
namespace FileManager {
|
|
|
|
|
|
|
|
class FileOperationProgressWidget : public GUI::Widget {
|
|
|
|
C_OBJECT(FileOperationProgressWidget);
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~FileOperationProgressWidget() override;
|
|
|
|
|
|
|
|
private:
|
2022-03-12 13:45:03 +00:00
|
|
|
// FIXME: The helper_pipe_fd parameter is only needed because we can't get the fd from a Core::Stream.
|
2023-05-03 18:45:18 -04:00
|
|
|
FileOperationProgressWidget(FileOperation, NonnullOwnPtr<Core::InputBufferedFile> helper_pipe, int helper_pipe_fd);
|
2021-04-12 20:32:40 +02:00
|
|
|
|
|
|
|
void did_finish();
|
2021-11-11 00:55:02 +01:00
|
|
|
void did_error(StringView message);
|
|
|
|
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);
|
2021-04-12 20:32:40 +02:00
|
|
|
|
|
|
|
void close_pipe();
|
|
|
|
|
2022-12-04 18:02:33 +00:00
|
|
|
DeprecatedString estimate_time(off_t bytes_done, off_t total_byte_count);
|
2021-04-16 18:41:44 -07:00
|
|
|
Core::ElapsedTimer m_elapsed_timer;
|
|
|
|
|
2021-06-22 12:56:40 +01:00
|
|
|
FileOperation m_operation;
|
2021-04-12 20:32:40 +02:00
|
|
|
RefPtr<Core::Notifier> m_notifier;
|
2023-05-03 18:45:18 -04:00
|
|
|
OwnPtr<Core::InputBufferedFile> m_helper_pipe;
|
2021-04-12 20:32:40 +02:00
|
|
|
};
|
|
|
|
}
|