FileReadTask.h
#ifndef GPGFRONTEND_FILEREADTHREAD_H
#define GPGFRONTEND_FILEREADTHREAD_H
#include "core/GpgFrontendCore.h"
#include "core/thread/Task.h"
namespace GpgFrontend::UI {
class GPGFRONTEND_CORE_EXPORT FileReadTask : public GpgFrontend::Thread::Task {
Q_OBJECT
public:
explicit FileReadTask(std::string path);
virtual ~FileReadTask() override;
void Run() override;
signals:
void SignalFileBytesRead(QByteArray bytes);
void SignalFileBytesReadEnd();
void SignalFileBytesReadNext();
private:
std::filesystem::path read_file_path_;
QFile target_file_;
const size_t buffer_size_ = 4096;
QEventLoop looper;
private slots:
void read_bytes();
};
} // namespace GpgFrontend::UI
#endif // GPGFRONTEND_FILEREADTHREAD_H
GpgFrontend::UI
Definition: FileReadTask.cpp:31
GpgFrontend::UI::FileReadTask
Definition: FileReadTask.h:39
GpgFrontend::Thread::Task
Definition: Task.h:45
GpgFrontend::Thread::Task::SetFinishAfterRun
void SetFinishAfterRun(bool finish_after_run)
Set the Finish After Run object.
Definition: Task.cpp:73
GpgFrontend::UI::FileReadTask::Run
void Run() override
Run - run the task.
Definition: FileReadTask.cpp:47