GpgFrontend Project
A Free, Powerful, Easy-to-Use, Compact, Cross-Platform, and Installation-Free OpenPGP(pgp) Crypto Tool.
FileReadTask.h
1 
27 #ifndef GPGFRONTEND_FILEREADTHREAD_H
28 #define GPGFRONTEND_FILEREADTHREAD_H
29 
30 #include "core/GpgFrontendCore.h"
31 #include "core/thread/Task.h"
32 
33 namespace GpgFrontend::UI {
34 
39 class GPGFRONTEND_CORE_EXPORT FileReadTask : public GpgFrontend::Thread::Task {
40  Q_OBJECT
41  public:
42  explicit FileReadTask(std::string path);
43 
44  virtual ~FileReadTask() override;
45 
46  void Run() override;
47 
48  signals:
49  void SignalFileBytesRead(QByteArray bytes);
50  void SignalFileBytesReadEnd();
51  void SignalFileBytesReadNext();
52 
53  private:
54  std::filesystem::path read_file_path_;
55  QFile target_file_;
56  const size_t buffer_size_ = 4096;
57  QEventLoop looper;
58 
59  private slots:
60  void read_bytes();
61 };
62 
63 } // namespace GpgFrontend::UI
64 
65 #endif // GPGFRONTEND_FILEREADTHREAD_H
Definition: Task.h:45
Definition: FileReadTask.h:39
Definition: FileReadTask.cpp:31