aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/thread/FileReadTask.cpp
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-01-05 08:11:24 +0000
committersaturneric <[email protected]>2024-01-05 08:11:24 +0000
commit3c40fa27823e70215261d3845275360f85e59623 (patch)
tree7c39090027d8ad7fbe1662d7a73cc5748a2d5b52 /src/core/thread/FileReadTask.cpp
parentfeat: switch to portable mode by adding a txt file under bin path (diff)
downloadGpgFrontend-3c40fa27823e70215261d3845275360f85e59623.tar.gz
GpgFrontend-3c40fa27823e70215261d3845275360f85e59623.zip
fix: slove some known issues
Diffstat (limited to 'src/core/thread/FileReadTask.cpp')
-rw-r--r--src/core/thread/FileReadTask.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/thread/FileReadTask.cpp b/src/core/thread/FileReadTask.cpp
index 52ec9db9..906ea188 100644
--- a/src/core/thread/FileReadTask.cpp
+++ b/src/core/thread/FileReadTask.cpp
@@ -30,6 +30,8 @@
namespace GpgFrontend::UI {
+constexpr size_t kBufferSize = 8192;
+
FileReadTask::FileReadTask(std::string path) : Task("file_read_task") {
HoldOnLifeCycle(true);
connect(this, &FileReadTask::SignalFileBytesReadNext, this,
@@ -68,11 +70,11 @@ void FileReadTask::Run() {
void FileReadTask::read_bytes() {
QByteArray read_buffer;
if (!target_file_.atEnd() &&
- (read_buffer = target_file_.read(buffer_size_)).size() > 0) {
- SPDLOG_DEBUG("read bytes: {}", read_buffer.size());
+ (read_buffer = target_file_.read(kBufferSize)).size() > 0) {
+ SPDLOG_DEBUG("io thread read bytes: {}", read_buffer.size());
emit SignalFileBytesRead(std::move(read_buffer));
} else {
- SPDLOG_DEBUG("read bytes end");
+ SPDLOG_DEBUG("io read bytes end");
emit SignalFileBytesReadEnd();
// announce finish task
emit SignalTaskShouldEnd(0);