From c1a5fff98cab4adf04210ba8120459b8e87a8fa3 Mon Sep 17 00:00:00 2001 From: saturneric Date: Sun, 15 Oct 2023 16:17:28 +0800 Subject: fix: solve some issues on linux .desktop file --- src/ui/thread/ListedKeyServerTestTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/thread/ListedKeyServerTestTask.cpp') diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp index 914cd3d6..259953aa 100644 --- a/src/ui/thread/ListedKeyServerTestTask.cpp +++ b/src/ui/thread/ListedKeyServerTestTask.cpp @@ -40,7 +40,7 @@ GpgFrontend::UI::ListedKeyServerTestTask::ListedKeyServerTestTask( } void GpgFrontend::UI::ListedKeyServerTestTask::run() { - SetFinishAfterRun(false); + HoldOnLifeCycle(true); size_t index = 0; for (const auto& url : urls_) { -- cgit v1.2.3 From 7c21fdd97132e63572a6aca6fa0492d2ce74e777 Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 16 Oct 2023 03:47:52 +0800 Subject: feat: start to add plugin system and do some improve on project configuration --- src/ui/thread/ListedKeyServerTestTask.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/ui/thread/ListedKeyServerTestTask.cpp') diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp index 259953aa..205c4d80 100644 --- a/src/ui/thread/ListedKeyServerTestTask.cpp +++ b/src/ui/thread/ListedKeyServerTestTask.cpp @@ -26,6 +26,7 @@ #include "ListedKeyServerTestTask.h" +#include #include GpgFrontend::UI::ListedKeyServerTestTask::ListedKeyServerTestTask( -- cgit v1.2.3 From 95997d27106daf91336847f50efaaa32279b7fc7 Mon Sep 17 00:00:00 2001 From: saturneric Date: Mon, 16 Oct 2023 17:54:05 +0800 Subject: fix: check and update copyright at files --- src/ui/thread/ListedKeyServerTestTask.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/ui/thread/ListedKeyServerTestTask.cpp') diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp index 205c4d80..f02d3ce1 100644 --- a/src/ui/thread/ListedKeyServerTestTask.cpp +++ b/src/ui/thread/ListedKeyServerTestTask.cpp @@ -1,5 +1,5 @@ /** - * Copyright (C) 2021 Saturneric + * Copyright (C) 2021 Saturneric * * This file is part of GpgFrontend. * @@ -19,8 +19,10 @@ * The initial version of the source code is inherited from * the gpg4usb project, which is under GPL-3.0-or-later. * - * The source code version of this software was modified and released - * by Saturneric starting on May 12, 2021. + * All the source code of GpgFrontend was modified and released by + * Saturneric starting on May 12, 2021. + * + * SPDX-License-Identifier: GPL-3.0-or-later * */ -- cgit v1.2.3 From 70196cf01757824a578e4d9c49a210bf136de266 Mon Sep 17 00:00:00 2001 From: saturneric Date: Wed, 18 Oct 2023 22:45:33 +0800 Subject: feat: using pool for concurrent executions, not stable yet --- src/ui/thread/ListedKeyServerTestTask.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/ui/thread/ListedKeyServerTestTask.cpp') diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp index f02d3ce1..38495f55 100644 --- a/src/ui/thread/ListedKeyServerTestTask.cpp +++ b/src/ui/thread/ListedKeyServerTestTask.cpp @@ -38,13 +38,12 @@ GpgFrontend::UI::ListedKeyServerTestTask::ListedKeyServerTestTask( timeout_(timeout), network_manager_(new QNetworkAccessManager(this)), result_(urls_.size(), kTestResultType_Error) { + HoldOnLifeCycle(true); qRegisterMetaType>( "std::vector"); } void GpgFrontend::UI::ListedKeyServerTestTask::run() { - HoldOnLifeCycle(true); - size_t index = 0; for (const auto& url : urls_) { auto key_url = QUrl{url}; @@ -87,6 +86,6 @@ void GpgFrontend::UI::ListedKeyServerTestTask::slot_process_network_reply( if (++result_count_ == urls_.size()) { emit SignalKeyServerListTestResult(result_); - emit SignalTaskRunnableEnd(0); + emit SignalTaskShouldEnd(0); } } -- cgit v1.2.3 From a23b2fbc707406dec0dd924c089b4285bc7f0010 Mon Sep 17 00:00:00 2001 From: Saturneric Date: Wed, 25 Oct 2023 15:40:43 +0800 Subject: feat: use rt listen publish event function in main windows' app version upgrade notification --- src/ui/thread/ListedKeyServerTestTask.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/ui/thread/ListedKeyServerTestTask.cpp') diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp index 38495f55..28eb33f7 100644 --- a/src/ui/thread/ListedKeyServerTestTask.cpp +++ b/src/ui/thread/ListedKeyServerTestTask.cpp @@ -35,9 +35,9 @@ GpgFrontend::UI::ListedKeyServerTestTask::ListedKeyServerTestTask( const QStringList& urls, int timeout, QWidget* parent) : Task("listed_key_server_test_task"), urls_(urls), - timeout_(timeout), + result_(urls_.size(), kTestResultType_Error), network_manager_(new QNetworkAccessManager(this)), - result_(urls_.size(), kTestResultType_Error) { + timeout_(timeout) { HoldOnLifeCycle(true); qRegisterMetaType>( "std::vector"); -- cgit v1.2.3 From 644aa4397b03dbef73f8bfedc13925b51cad836b Mon Sep 17 00:00:00 2001 From: saturneric Date: Fri, 5 Jan 2024 20:55:15 +0800 Subject: feat: integrate logging api to core --- src/ui/thread/ListedKeyServerTestTask.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/ui/thread/ListedKeyServerTestTask.cpp') diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp index 28eb33f7..18299725 100644 --- a/src/ui/thread/ListedKeyServerTestTask.cpp +++ b/src/ui/thread/ListedKeyServerTestTask.cpp @@ -47,20 +47,20 @@ void GpgFrontend::UI::ListedKeyServerTestTask::run() { size_t index = 0; for (const auto& url : urls_) { auto key_url = QUrl{url}; - SPDLOG_DEBUG("key server request: {}", key_url.host().toStdString()); + GF_UI_LOG_DEBUG("key server request: {}", key_url.host().toStdString()); auto* network_reply = network_manager_->get(QNetworkRequest{key_url}); auto* timer = new QTimer(this); connect(network_reply, &QNetworkReply::finished, this, [this, index, network_reply]() { - SPDLOG_DEBUG("key server domain reply: {}", - urls_[index].toStdString()); + GF_UI_LOG_DEBUG("key server domain reply: {}", + urls_[index].toStdString()); this->slot_process_network_reply(index, network_reply); }); connect(timer, &QTimer::timeout, this, [this, index, network_reply]() { - SPDLOG_DEBUG("timeout for key server: {}", urls_[index].toStdString()); + GF_UI_LOG_DEBUG("timeout for key server: {}", urls_[index].toStdString()); if (network_reply->isRunning()) { network_reply->abort(); this->slot_process_network_reply(index, network_reply); -- cgit v1.2.3 From 0266ff1bbce2feccec34ab789f9e378948d1b24d Mon Sep 17 00:00:00 2001 From: saturneric Date: Thu, 11 Jan 2024 11:05:45 +0800 Subject: feat: improve api and ui of keys import and export --- src/ui/thread/ListedKeyServerTestTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/ui/thread/ListedKeyServerTestTask.cpp') diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp index 18299725..11552562 100644 --- a/src/ui/thread/ListedKeyServerTestTask.cpp +++ b/src/ui/thread/ListedKeyServerTestTask.cpp @@ -43,7 +43,7 @@ GpgFrontend::UI::ListedKeyServerTestTask::ListedKeyServerTestTask( "std::vector"); } -void GpgFrontend::UI::ListedKeyServerTestTask::run() { +void GpgFrontend::UI::ListedKeyServerTestTask::Run() { size_t index = 0; for (const auto& url : urls_) { auto key_url = QUrl{url}; -- cgit v1.2.3 From 4994f4eaa1211d402b791660ad6221154a4c2405 Mon Sep 17 00:00:00 2001 From: saturneric Date: Tue, 16 Jan 2024 11:49:50 +0800 Subject: fix: make task and threading system safer --- src/ui/thread/ListedKeyServerTestTask.cpp | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'src/ui/thread/ListedKeyServerTestTask.cpp') diff --git a/src/ui/thread/ListedKeyServerTestTask.cpp b/src/ui/thread/ListedKeyServerTestTask.cpp index 11552562..4ab7ba5f 100644 --- a/src/ui/thread/ListedKeyServerTestTask.cpp +++ b/src/ui/thread/ListedKeyServerTestTask.cpp @@ -32,10 +32,10 @@ #include GpgFrontend::UI::ListedKeyServerTestTask::ListedKeyServerTestTask( - const QStringList& urls, int timeout, QWidget* parent) + QStringList urls, int timeout, QWidget* /*parent*/) : Task("listed_key_server_test_task"), - urls_(urls), - result_(urls_.size(), kTestResultType_Error), + urls_(std::move(urls)), + result_(urls_.size(), kTEST_RESULT_TYPE_ERROR), network_manager_(new QNetworkAccessManager(this)), timeout_(timeout) { HoldOnLifeCycle(true); @@ -43,7 +43,7 @@ GpgFrontend::UI::ListedKeyServerTestTask::ListedKeyServerTestTask( "std::vector"); } -void GpgFrontend::UI::ListedKeyServerTestTask::Run() { +auto GpgFrontend::UI::ListedKeyServerTestTask::Run() -> int { size_t index = 0; for (const auto& url : urls_) { auto key_url = QUrl{url}; @@ -68,20 +68,22 @@ void GpgFrontend::UI::ListedKeyServerTestTask::Run() { }); timer->start(timeout_); - index++; } + + return 0; } void GpgFrontend::UI::ListedKeyServerTestTask::slot_process_network_reply( int index, QNetworkReply* reply) { if (!reply->isRunning() && reply->error() == QNetworkReply::NoError) { - result_[index] = kTestResultType_Success; + result_[index] = kTEST_RESULT_TYPE_SUCCESS; } else { - if (!reply->isFinished()) - result_[index] = kTestResultType_Timeout; - else - result_[index] = kTestResultType_Error; + if (!reply->isFinished()) { + result_[index] = kTEST_RESULT_TYPE_TIMEOUT; + } else { + result_[index] = kTEST_RESULT_TYPE_ERROR; + } } if (++result_count_ == urls_.size()) { -- cgit v1.2.3