2021-04-12 15:32:40 -03:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
2021-04-22 05:24:48 -03:00
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
2021-04-12 15:32:40 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2021-06-22 08:56:40 -03:00
|
|
|
#include "FileUtils.h"
|
2021-04-16 22:41:44 -03:00
|
|
|
#include <LibCore/ElapsedTimer.h>
|
2021-04-12 15:32:40 -03:00
|
|
|
#include <LibGUI/Widget.h>
|
|
|
|
|
|
|
|
|
|
namespace FileManager {
|
|
|
|
|
|
|
|
|
|
class FileOperationProgressWidget : public GUI::Widget {
|
|
|
|
|
C_OBJECT(FileOperationProgressWidget);
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
virtual ~FileOperationProgressWidget() override;
|
|
|
|
|
|
|
|
|
|
private:
|
2021-06-22 08:56:40 -03:00
|
|
|
FileOperationProgressWidget(FileOperation, NonnullRefPtr<Core::File> helper_pipe);
|
2021-04-12 15:32:40 -03:00
|
|
|
|
|
|
|
|
void did_finish();
|
2021-06-24 12:28:24 -03:00
|
|
|
void did_error(StringView const& message);
|
2021-06-17 07:23:12 -03:00
|
|
|
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 const& current_filename);
|
2021-04-12 15:32:40 -03:00
|
|
|
|
|
|
|
|
void close_pipe();
|
|
|
|
|
|
2021-04-16 22:41:44 -03:00
|
|
|
String estimate_time(off_t bytes_done, off_t total_byte_count);
|
|
|
|
|
Core::ElapsedTimer m_elapsed_timer;
|
|
|
|
|
|
2021-06-22 08:56:40 -03:00
|
|
|
FileOperation m_operation;
|
2021-04-12 15:32:40 -03:00
|
|
|
RefPtr<Core::Notifier> m_notifier;
|
2021-04-13 04:58:09 -03:00
|
|
|
RefPtr<Core::File> m_helper_pipe;
|
2021-04-12 15:32:40 -03:00
|
|
|
};
|
|
|
|
|
}
|