feat: async gather_gnupg_info()

This commit is contained in:
saturneric 2024-11-21 22:54:02 +01:00
parent 49642fc03d
commit 9146f7ad48
4 changed files with 14 additions and 10 deletions

View File

@ -77,11 +77,11 @@ link_directories(
if(GPGFRONTEND_QT5_BUILD) if(GPGFRONTEND_QT5_BUILD)
# Introduce Qt # Introduce Qt
# Support Qt version: 5.15.x # 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() else()
# Introduce Qt # Introduce Qt
# Support Qt version: 6.x # 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() endif()
# Qt configuration # Qt configuration

View File

@ -40,7 +40,7 @@ target_link_libraries(mod_gpg_info PRIVATE
gpgfrontend_module_sdk) gpgfrontend_module_sdk)
# link qt # 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 # using std c++ 17
target_compile_features(mod_gpg_info PRIVATE cxx_std_17) target_compile_features(mod_gpg_info PRIVATE cxx_std_17)

View File

@ -47,7 +47,7 @@
#include "GpgInfo.h" #include "GpgInfo.h"
GF_MODULE_API_DEFINE("com.bktus.gpgfrontend.module.gnupg_info_gathering", GF_MODULE_API_DEFINE("com.bktus.gpgfrontend.module.gnupg_info_gathering",
"GatherGnupgInfo", "1.0.0", "GatherGnupgInfo", "1.0.1",
"Try gathering gnupg informations.", "Saturneric") "Try gathering gnupg informations.", "Saturneric")
DEFINE_TRANSLATIONS_STRUCTURE(ModuleGnuPGInfoGathering); DEFINE_TRANSLATIONS_STRUCTURE(ModuleGnuPGInfoGathering);

View File

@ -32,6 +32,8 @@
#include "GnupgTab.h" #include "GnupgTab.h"
#include <QtConcurrent>
#include "GFModuleCommonUtils.hpp" #include "GFModuleCommonUtils.hpp"
#include "GFSDKModule.h" #include "GFSDKModule.h"
#include "GnuPGInfoGatheringModule.h" #include "GnuPGInfoGatheringModule.h"
@ -106,12 +108,14 @@ GnupgTab::GnupgTab(QWidget* parent)
ui_->optionDetailsTable->setFocusPolicy(Qt::NoFocus); ui_->optionDetailsTable->setFocusPolicy(Qt::NoFocus);
ui_->optionDetailsTable->setAlternatingRowColors(true); ui_->optionDetailsTable->setAlternatingRowColors(true);
auto future = (QThreadPool::globalInstance(), [=]() {
if (GFModuleRetrieveRTValueOrDefaultBool( if (GFModuleRetrieveRTValueOrDefaultBool(
DUP("ui"), DUP("env.state.gnupg_info_gathering"), 0) == 1) { DUP("ui"), DUP("env.state.gnupg_info_gathering"), 0) == 1) {
process_software_info(); process_software_info();
} else { } else {
gather_gnupg_info(); gather_gnupg_info();
} }
});
} }
void GnupgTab::process_software_info() { void GnupgTab::process_software_info() {