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)
# 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

View File

@ -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)

View File

@ -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);

View File

@ -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() {