aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-11-21 21:54:02 +0000
committersaturneric <[email protected]>2024-11-21 21:54:02 +0000
commit9146f7ad486e34f52ad794db4c3085f913369a2c (patch)
treefbc0e56cb18db2162a5eb690e474148be86db8eb
parentfeat: show release note of latest version and improve ui structure (diff)
downloadModules-9146f7ad486e34f52ad794db4c3085f913369a2c.tar.gz
Modules-9146f7ad486e34f52ad794db4c3085f913369a2c.zip
feat: async gather_gnupg_info()
-rw-r--r--CMakeLists.txt4
-rw-r--r--src/m_gpg_info/CMakeLists.txt2
-rw-r--r--src/m_gpg_info/GnuPGInfoGatheringModule.cpp2
-rw-r--r--src/m_gpg_info/GnupgTab.cpp16
4 files changed, 14 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4492b56..83e1d34 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,11 +77,11 @@ link_directories(
if(GPGFRONTEND_QT5_BUILD)
# Introduce Qt
# Support Qt version: 5.15.x
- find_package(Qt5 5.15 COMPONENTS Core Widgets Network LinguistTools REQUIRED)
+ find_package(Qt5 5.15 COMPONENTS Core Widgets Network LinguistTools Concurrent REQUIRED)
else()
# Introduce Qt
# Support Qt version: 6.x
- find_package(Qt6 6 COMPONENTS Core Widgets Network LinguistTools REQUIRED)
+ find_package(Qt6 6 COMPONENTS Core Widgets Network LinguistTools Concurrent REQUIRED)
endif()
# Qt configuration
diff --git a/src/m_gpg_info/CMakeLists.txt b/src/m_gpg_info/CMakeLists.txt
index e9f269d..6624e82 100644
--- a/src/m_gpg_info/CMakeLists.txt
+++ b/src/m_gpg_info/CMakeLists.txt
@@ -40,7 +40,7 @@ target_link_libraries(mod_gpg_info PRIVATE
gpgfrontend_module_sdk)
# link qt
-target_link_libraries(mod_gpg_info PRIVATE Qt::Core Qt::Widgets)
+target_link_libraries(mod_gpg_info PRIVATE Qt::Core Qt::Widgets Qt::Concurrent)
# using std c++ 17
target_compile_features(mod_gpg_info PRIVATE cxx_std_17)
diff --git a/src/m_gpg_info/GnuPGInfoGatheringModule.cpp b/src/m_gpg_info/GnuPGInfoGatheringModule.cpp
index 08611fe..e882d67 100644
--- a/src/m_gpg_info/GnuPGInfoGatheringModule.cpp
+++ b/src/m_gpg_info/GnuPGInfoGatheringModule.cpp
@@ -47,7 +47,7 @@
#include "GpgInfo.h"
GF_MODULE_API_DEFINE("com.bktus.gpgfrontend.module.gnupg_info_gathering",
- "GatherGnupgInfo", "1.0.0",
+ "GatherGnupgInfo", "1.0.1",
"Try gathering gnupg informations.", "Saturneric")
DEFINE_TRANSLATIONS_STRUCTURE(ModuleGnuPGInfoGathering);
diff --git a/src/m_gpg_info/GnupgTab.cpp b/src/m_gpg_info/GnupgTab.cpp
index 3d0d687..5123155 100644
--- a/src/m_gpg_info/GnupgTab.cpp
+++ b/src/m_gpg_info/GnupgTab.cpp
@@ -32,6 +32,8 @@
#include "GnupgTab.h"
+#include <QtConcurrent>
+
#include "GFModuleCommonUtils.hpp"
#include "GFSDKModule.h"
#include "GnuPGInfoGatheringModule.h"
@@ -106,12 +108,14 @@ GnupgTab::GnupgTab(QWidget* parent)
ui_->optionDetailsTable->setFocusPolicy(Qt::NoFocus);
ui_->optionDetailsTable->setAlternatingRowColors(true);
- if (GFModuleRetrieveRTValueOrDefaultBool(
- DUP("ui"), DUP("env.state.gnupg_info_gathering"), 0) == 1) {
- process_software_info();
- } else {
- gather_gnupg_info();
- }
+ auto future = (QThreadPool::globalInstance(), [=]() {
+ if (GFModuleRetrieveRTValueOrDefaultBool(
+ DUP("ui"), DUP("env.state.gnupg_info_gathering"), 0) == 1) {
+ process_software_info();
+ } else {
+ gather_gnupg_info();
+ }
+ });
}
void GnupgTab::process_software_info() {