refactor: reduce core prebuild headers and isolate core to modules
This commit is contained in:
parent
091b579bbd
commit
154ebea202
@ -454,7 +454,7 @@ endif ()
|
|||||||
|
|
||||||
# link options for GpgFrontend
|
# link options for GpgFrontend
|
||||||
if (BUILD_APPLICATION)
|
if (BUILD_APPLICATION)
|
||||||
target_link_libraries(${AppName} gpgfrontend_ui gpgfrontend_module gpgfrontend_test)
|
target_link_libraries(${AppName} gpgfrontend_ui gpgfrontend_test)
|
||||||
if (MINGW)
|
if (MINGW)
|
||||||
message(STATUS "Link Application Library For MINGW")
|
message(STATUS "Link Application Library For MINGW")
|
||||||
target_link_libraries(${AppName} crypto)
|
target_link_libraries(${AppName} crypto)
|
||||||
@ -536,9 +536,7 @@ if (LINUX AND LINUX_INSTALL_SOFTWARE)
|
|||||||
gpgfrontend_core
|
gpgfrontend_core
|
||||||
gpgfrontend_ui
|
gpgfrontend_ui
|
||||||
gpgfrontend_test
|
gpgfrontend_test
|
||||||
gpgfrontend_pinentry
|
gpgfrontend_pinentry)
|
||||||
gpgfrontend_module_sdk
|
|
||||||
gpgfrontend_module)
|
|
||||||
|
|
||||||
message(STATUS "GpgFrontend Install Libraries: ${GPGFRONTEND_INSTALL_LIBRARIES}")
|
message(STATUS "GpgFrontend Install Libraries: ${GPGFRONTEND_INSTALL_LIBRARIES}")
|
||||||
install(TARGETS ${AppName} ${GPGFRONTEND_INSTALL_LIBRARIES}
|
install(TARGETS ${AppName} ${GPGFRONTEND_INSTALL_LIBRARIES}
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "GpgFrontendContext.h"
|
#include "GpgFrontendContext.h"
|
||||||
#include "core/GpgConstants.h"
|
#include "core/GpgConstants.h"
|
||||||
#include "core/GpgCoreInit.h"
|
#include "core/GpgCoreInit.h"
|
||||||
#include "module/GpgFrontendModuleInit.h"
|
#include "core/module/ModuleInit.h"
|
||||||
#include "ui/GpgFrontendUIInit.h"
|
#include "ui/GpgFrontendUIInit.h"
|
||||||
|
|
||||||
// main
|
// main
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "GpgConstants.h"
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
|
@ -30,23 +30,3 @@
|
|||||||
|
|
||||||
// Qt
|
// Qt
|
||||||
#include <QtCore>
|
#include <QtCore>
|
||||||
|
|
||||||
// std
|
|
||||||
#include <cstdint>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
// spdlog library configuration
|
|
||||||
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
|
|
||||||
#include <spdlog/spdlog.h>
|
|
||||||
|
|
||||||
// logger fmt
|
|
||||||
#include "log/QtLoggerFmt.h"
|
|
||||||
|
|
||||||
// gpgme library
|
|
||||||
#include <gpgme.h>
|
|
||||||
|
|
||||||
// logbal includes or macroes
|
|
||||||
#include "GpgFrontend.h"
|
|
||||||
|
|
||||||
// dll export macroes
|
|
||||||
#include "GpgFrontendCoreExport.h"
|
|
||||||
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "core/GpgFrontendCore.h"
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
|
@ -28,9 +28,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <cstdint>
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include "core/utils/LogUtils.h"
|
#include "core/utils/LogUtils.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <gpgme.h>
|
||||||
|
|
||||||
#include "core/function/SecureMemoryAllocator.h"
|
#include "core/function/SecureMemoryAllocator.h"
|
||||||
#include "core/function/basic/GpgFunctionObject.h"
|
#include "core/function/basic/GpgFunctionObject.h"
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <gpgme.h>
|
||||||
|
|
||||||
#include "core/GpgFrontendCoreExport.h"
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
#include "core/model/GFBuffer.h"
|
#include "core/model/GFBuffer.h"
|
||||||
#include "core/typedef/CoreTypedef.h"
|
#include "core/typedef/CoreTypedef.h"
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
class GPGFRONTEND_CORE_EXPORT GenKeyInfo {
|
class GPGFRONTEND_CORE_EXPORT GenKeyInfo {
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <gpgme.h>
|
||||||
|
|
||||||
#include "core/GpgFrontendCore.h"
|
#include "core/GpgFrontendCore.h"
|
||||||
#include "core/GpgFrontendCoreExport.h"
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <gpgme.h>
|
||||||
|
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
|
|
||||||
#include "GpgPassphraseContext.h"
|
#include "GpgPassphraseContext.h"
|
||||||
|
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
GpgPassphraseContext::GpgPassphraseContext(const QString& uids_info,
|
GpgPassphraseContext::GpgPassphraseContext(const QString& uids_info,
|
||||||
|
@ -30,6 +30,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
class GPGFRONTEND_CORE_EXPORT GpgPassphraseContext : public QObject {
|
class GPGFRONTEND_CORE_EXPORT GpgPassphraseContext : public QObject {
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <gpgme.h>
|
||||||
|
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <gpgme.h>
|
||||||
|
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
|
@ -26,7 +26,10 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "GpgFrontendModuleInit.h"
|
#include "ModuleInit.h"
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
#include "core/module/ModuleManager.h"
|
#include "core/module/ModuleManager.h"
|
||||||
#include "core/thread/Task.h"
|
#include "core/thread/Task.h"
|
||||||
@ -39,17 +42,17 @@ void LoadGpgFrontendModules(ModuleInitArgs) {
|
|||||||
Thread::TaskRunnerGetter::GetInstance().GetTaskRunner()->PostTask(
|
Thread::TaskRunnerGetter::GetInstance().GetTaskRunner()->PostTask(
|
||||||
new Thread::Task(
|
new Thread::Task(
|
||||||
[](const DataObjectPtr&) -> int {
|
[](const DataObjectPtr&) -> int {
|
||||||
MODULE_LOG_INFO("loading modules...");
|
GF_CORE_LOG_INFO("loading modules...");
|
||||||
|
|
||||||
auto exec_binary_path = QCoreApplication::applicationDirPath();
|
auto exec_binary_path = QCoreApplication::applicationDirPath();
|
||||||
auto mods_path = exec_binary_path + "/mods";
|
auto mods_path = exec_binary_path + "/mods";
|
||||||
|
|
||||||
if (!QDir(mods_path).exists()) {
|
if (!QDir(mods_path).exists()) {
|
||||||
MODULE_LOG_WARN("module directory not found, abort...");
|
GF_CORE_LOG_INFO("module directory not found, abort...");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_LOG_INFO("the path of modules directory: {}", mods_path);
|
GF_CORE_LOG_INFO("the path of modules directory: {}", mods_path);
|
||||||
|
|
||||||
for (const auto& module_library_name :
|
for (const auto& module_library_name :
|
||||||
QDir(mods_path).entryList(QStringList() << "*.so"
|
QDir(mods_path).entryList(QStringList() << "*.so"
|
||||||
@ -60,7 +63,7 @@ void LoadGpgFrontendModules(ModuleInitArgs) {
|
|||||||
module_library_name);
|
module_library_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
MODULE_LOG_INFO("load modules done.");
|
GF_CORE_LOG_INFO("load modules done.");
|
||||||
return 0;
|
return 0;
|
||||||
},
|
},
|
||||||
"modules_system_init_task"));
|
"modules_system_init_task"));
|
@ -28,7 +28,9 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "module/GpgFrontendModule.h"
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend::Module {
|
namespace GpgFrontend::Module {
|
||||||
|
|
||||||
@ -40,12 +42,12 @@ struct ModuleInitArgs {
|
|||||||
* @brief init the module library
|
* @brief init the module library
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void GPGFRONTEND_MODULE_EXPORT LoadGpgFrontendModules(ModuleInitArgs args);
|
void GPGFRONTEND_CORE_EXPORT LoadGpgFrontendModules(ModuleInitArgs args);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief shutdown the module library
|
* @brief shutdown the module library
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void GPGFRONTEND_MODULE_EXPORT ShutdownGpgFrontendModules();
|
void GPGFRONTEND_CORE_EXPORT ShutdownGpgFrontendModules();
|
||||||
|
|
||||||
}; // namespace GpgFrontend::Module
|
}; // namespace GpgFrontend::Module
|
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <tuple>
|
#include <gpgme.h>
|
||||||
|
|
||||||
#include "core/model/DataObject.h"
|
#include "core/model/DataObject.h"
|
||||||
|
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -54,8 +56,8 @@ auto GPGFRONTEND_CORE_EXPORT GetOnlyFileNameWithPath(const QString& path)
|
|||||||
* @param filename_pattern The pattern of the file name, e.g. "*.txt"
|
* @param filename_pattern The pattern of the file name, e.g. "*.txt"
|
||||||
* @return int64_t
|
* @return int64_t
|
||||||
*/
|
*/
|
||||||
auto GPGFRONTEND_CORE_EXPORT GetFileSizeByPath(
|
auto GPGFRONTEND_CORE_EXPORT GetFileSizeByPath(const QString& path,
|
||||||
const QString& path, const QString& filename_pattern)
|
const QString& filename_pattern)
|
||||||
-> int64_t;
|
-> int64_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -72,7 +74,7 @@ auto GPGFRONTEND_CORE_EXPORT GetHumanFriendlyFileSize(int64_t size) -> QString;
|
|||||||
* @param path
|
* @param path
|
||||||
* @param filename_pattern
|
* @param filename_pattern
|
||||||
*/
|
*/
|
||||||
void GPGFRONTEND_CORE_EXPORT DeleteAllFilesByPattern(
|
void GPGFRONTEND_CORE_EXPORT
|
||||||
const QString& path, const QString& filename_pattern);
|
DeleteAllFilesByPattern(const QString& path, const QString& filename_pattern);
|
||||||
|
|
||||||
} // namespace GpgFrontend
|
} // namespace GpgFrontend
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
auto GPGFRONTEND_CORE_EXPORT GetLocalizedDateByTimestamp(time_t) -> QString;
|
auto GPGFRONTEND_CORE_EXPORT GetLocalizedDateByTimestamp(time_t) -> QString;
|
||||||
|
@ -28,6 +28,49 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
// spdlog library configuration
|
||||||
|
#undef SPDLOG_ACTIVE_LEVEL
|
||||||
|
#define SPDLOG_ACTIVE_LEVEL SPDLOG_LEVEL_TRACE
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
|
// logger fmt
|
||||||
|
#include "core/GpgFrontendCoreExport.h"
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<QString> {
|
||||||
|
// Parses format specifications.
|
||||||
|
constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
|
||||||
|
return ctx.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formats the QString qstr and writes it to the output.
|
||||||
|
template <typename FormatContext>
|
||||||
|
auto format(const QString& qstr, FormatContext& ctx) const
|
||||||
|
-> decltype(ctx.out()) {
|
||||||
|
// Convert QString to UTF-8 QString (to handle Unicode characters
|
||||||
|
// correctly)
|
||||||
|
QByteArray utf8_array = qstr.toUtf8();
|
||||||
|
return fmt::format_to(ctx.out(), "{}", utf8_array.constData());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<QByteArray> {
|
||||||
|
// Parses format specifications.
|
||||||
|
constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
|
||||||
|
return ctx.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formats the QString qstr and writes it to the output.
|
||||||
|
template <typename FormatContext>
|
||||||
|
auto format(const QByteArray& qarray, FormatContext& ctx) const
|
||||||
|
-> decltype(ctx.out()) {
|
||||||
|
// Convert QString to UTF-8 QString (to handle Unicode characters
|
||||||
|
// correctly)
|
||||||
|
return fmt::format_to(ctx.out(), "{}", qarray.constData());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
namespace GpgFrontend {
|
namespace GpgFrontend {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -50,7 +93,7 @@ auto GPGFRONTEND_CORE_EXPORT GetCoreLogger() -> std::shared_ptr<spdlog::logger>;
|
|||||||
*
|
*
|
||||||
* @return std::shared_ptr<spdlog::logger>
|
* @return std::shared_ptr<spdlog::logger>
|
||||||
*/
|
*/
|
||||||
auto GPGFRONTEND_CORE_EXPORT GetLogger(const QString &)
|
auto GPGFRONTEND_CORE_EXPORT GetLogger(const QString&)
|
||||||
-> std::shared_ptr<spdlog::logger>;
|
-> std::shared_ptr<spdlog::logger>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -65,7 +108,7 @@ void GPGFRONTEND_CORE_EXPORT SetDefaultLogLevel(spdlog::level::level_enum);
|
|||||||
*
|
*
|
||||||
* @return auto
|
* @return auto
|
||||||
*/
|
*/
|
||||||
void GPGFRONTEND_CORE_EXPORT RegisterAsyncLogger(const QString &,
|
void GPGFRONTEND_CORE_EXPORT RegisterAsyncLogger(const QString&,
|
||||||
spdlog::level::level_enum);
|
spdlog::level::level_enum);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +116,7 @@ void GPGFRONTEND_CORE_EXPORT RegisterAsyncLogger(const QString &,
|
|||||||
*
|
*
|
||||||
* @return auto
|
* @return auto
|
||||||
*/
|
*/
|
||||||
void GPGFRONTEND_CORE_EXPORT RegisterSyncLogger(const QString &,
|
void GPGFRONTEND_CORE_EXPORT RegisterSyncLogger(const QString&,
|
||||||
spdlog::level::level_enum);
|
spdlog::level::level_enum);
|
||||||
|
|
||||||
} // namespace GpgFrontend
|
} // namespace GpgFrontend
|
||||||
|
@ -31,9 +31,9 @@
|
|||||||
#include "core/GpgCoreInit.h"
|
#include "core/GpgCoreInit.h"
|
||||||
#include "core/function/GlobalSettingStation.h"
|
#include "core/function/GlobalSettingStation.h"
|
||||||
#include "core/function/gpg/GpgAdvancedOperator.h"
|
#include "core/function/gpg/GpgAdvancedOperator.h"
|
||||||
|
#include "core/module/ModuleInit.h"
|
||||||
#include "core/thread/TaskRunnerGetter.h"
|
#include "core/thread/TaskRunnerGetter.h"
|
||||||
#include "core/utils/LogUtils.h"
|
#include "core/utils/LogUtils.h"
|
||||||
#include "module/GpgFrontendModuleInit.h"
|
|
||||||
#include "ui/GpgFrontendUIInit.h"
|
#include "ui/GpgFrontendUIInit.h"
|
||||||
|
|
||||||
// main
|
// main
|
||||||
|
@ -32,13 +32,14 @@ aux_source_directory(sdk MODULE_SDK_SOURCE)
|
|||||||
add_library(gpgfrontend_module_sdk SHARED ${MODULE_SDK_SOURCE})
|
add_library(gpgfrontend_module_sdk SHARED ${MODULE_SDK_SOURCE})
|
||||||
set(_export_file_sdk "${CMAKE_CURRENT_SOURCE_DIR}/sdk/GFSDKExport.h")
|
set(_export_file_sdk "${CMAKE_CURRENT_SOURCE_DIR}/sdk/GFSDKExport.h")
|
||||||
generate_export_header(gpgfrontend_module_sdk EXPORT_FILE_NAME "${_export_file_sdk}")
|
generate_export_header(gpgfrontend_module_sdk EXPORT_FILE_NAME "${_export_file_sdk}")
|
||||||
target_include_directories(gpgfrontend_module_sdk PUBLIC
|
target_include_directories(gpgfrontend_module_sdk PRIVATE
|
||||||
sdk
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gpgfrontend_module_sdk_autogen/include
|
${CMAKE_CURRENT_BINARY_DIR}/gpgfrontend_module_sdk_autogen/include
|
||||||
${CMAKE_SOURCE_DIR}/third_party/spdlog/include)
|
${CMAKE_SOURCE_DIR}/third_party/spdlog/include)
|
||||||
|
|
||||||
|
target_include_directories(gpgfrontend_module_sdk PUBLIC sdk)
|
||||||
|
|
||||||
# link module system
|
# link module system
|
||||||
target_link_libraries(gpgfrontend_module_sdk PUBLIC gpgfrontend_core)
|
target_link_libraries(gpgfrontend_module_sdk PRIVATE gpgfrontend_core)
|
||||||
|
|
||||||
if (XCODE_BUILD)
|
if (XCODE_BUILD)
|
||||||
set_target_properties(gpgfrontend_module_sdk
|
set_target_properties(gpgfrontend_module_sdk
|
||||||
@ -63,38 +64,3 @@ foreach(child ${children})
|
|||||||
list(APPEND all_integrated_module_libraries ${integrated_lib_name})
|
list(APPEND all_integrated_module_libraries ${integrated_lib_name})
|
||||||
endif()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
aux_source_directory(. MODULE_SOURCE)
|
|
||||||
add_library(gpgfrontend_module SHARED ${MODULE_SOURCE})
|
|
||||||
|
|
||||||
set(_export_file "${CMAKE_CURRENT_SOURCE_DIR}/GpgFrontendModuleExport.h")
|
|
||||||
generate_export_header(gpgfrontend_module EXPORT_FILE_NAME "${_export_file}")
|
|
||||||
|
|
||||||
# set up pch
|
|
||||||
target_precompile_headers(gpgfrontend_module PUBLIC GpgFrontendModule.h)
|
|
||||||
|
|
||||||
# add ui generator include path
|
|
||||||
target_include_directories(gpgfrontend_module PUBLIC
|
|
||||||
${CMAKE_CURRENT_BINARY_DIR}/gpgfrontend_module_autogen/include
|
|
||||||
${CMAKE_SOURCE_DIR}/third_party/spdlog/include)
|
|
||||||
|
|
||||||
# link gpgfrontend_module_sdk
|
|
||||||
target_link_libraries(gpgfrontend_module PRIVATE gpgfrontend_module_sdk)
|
|
||||||
|
|
||||||
if (XCODE_BUILD)
|
|
||||||
set_target_properties(gpgfrontend_module
|
|
||||||
PROPERTIES
|
|
||||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
|
|
||||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}
|
|
||||||
XCODE_ATTRIBUTE_SKIP_INSTALL "Yes"
|
|
||||||
XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "${GPGFRONTEND_XOCDE_CODE_SIGN_IDENTITY}")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
|
|
||||||
# link all integrated modules
|
|
||||||
message(STATUS "All Module Libraries: ${all_integrated_module_libraries}")
|
|
||||||
# target_link_libraries(gpgfrontend_module PRIVATE ${all_integrated_module_libraries})
|
|
||||||
|
|
||||||
# using std c++ 17
|
|
||||||
target_compile_features(gpgfrontend_module PUBLIC cxx_std_17)
|
|
@ -1,46 +0,0 @@
|
|||||||
/**
|
|
||||||
* Copyright (C) 2021 Saturneric <eric@bktus.com>
|
|
||||||
*
|
|
||||||
* This file is part of GpgFrontend.
|
|
||||||
*
|
|
||||||
* GpgFrontend is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GpgFrontend is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GpgFrontend. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*
|
|
||||||
* The initial version of the source code is inherited from
|
|
||||||
* the gpg4usb project, which is under GPL-3.0-or-later.
|
|
||||||
*
|
|
||||||
* All the source code of GpgFrontend was modified and released by
|
|
||||||
* Saturneric <eric@bktus.com> starting on May 12, 2021.
|
|
||||||
*
|
|
||||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Project internal dependencies
|
|
||||||
*/
|
|
||||||
#include "GpgFrontend.h"
|
|
||||||
#include "GpgFrontendModuleExport.h"
|
|
||||||
#include "core/GpgFrontendCore.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief logger for inner
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
#define MODULE_LOG_TRACE(...) GF_LOG_TRACE("module", __VA_ARGS__)
|
|
||||||
#define MODULE_LOG_DEBUG(...) GF_LOG_DEBUG("module", __VA_ARGS__)
|
|
||||||
#define MODULE_LOG_INFO(...) GF_LOG_INFO("module", __VA_ARGS__)
|
|
||||||
#define MODULE_LOG_WARN(...) GF_LOG_WARN("module", __VA_ARGS__)
|
|
||||||
#define MODULE_LOG_ERROR(...) GF_LOG_ERROR("module", __VA_ARGS__)
|
|
@ -1,42 +0,0 @@
|
|||||||
|
|
||||||
#ifndef GPGFRONTEND_MODULE_EXPORT_H
|
|
||||||
#define GPGFRONTEND_MODULE_EXPORT_H
|
|
||||||
|
|
||||||
#ifdef GPGFRONTEND_MODULE_STATIC_DEFINE
|
|
||||||
# define GPGFRONTEND_MODULE_EXPORT
|
|
||||||
# define GPGFRONTEND_MODULE_NO_EXPORT
|
|
||||||
#else
|
|
||||||
# ifndef GPGFRONTEND_MODULE_EXPORT
|
|
||||||
# ifdef gpgfrontend_module_EXPORTS
|
|
||||||
/* We are building this library */
|
|
||||||
# define GPGFRONTEND_MODULE_EXPORT __attribute__((visibility("default")))
|
|
||||||
# else
|
|
||||||
/* We are using this library */
|
|
||||||
# define GPGFRONTEND_MODULE_EXPORT __attribute__((visibility("default")))
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
# ifndef GPGFRONTEND_MODULE_NO_EXPORT
|
|
||||||
# define GPGFRONTEND_MODULE_NO_EXPORT __attribute__((visibility("hidden")))
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GPGFRONTEND_MODULE_DEPRECATED
|
|
||||||
# define GPGFRONTEND_MODULE_DEPRECATED __attribute__ ((__deprecated__))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GPGFRONTEND_MODULE_DEPRECATED_EXPORT
|
|
||||||
# define GPGFRONTEND_MODULE_DEPRECATED_EXPORT GPGFRONTEND_MODULE_EXPORT GPGFRONTEND_MODULE_DEPRECATED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef GPGFRONTEND_MODULE_DEPRECATED_NO_EXPORT
|
|
||||||
# define GPGFRONTEND_MODULE_DEPRECATED_NO_EXPORT GPGFRONTEND_MODULE_NO_EXPORT GPGFRONTEND_MODULE_DEPRECATED
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if 0 /* DEFINE_NO_DEPRECATED */
|
|
||||||
# ifndef GPGFRONTEND_MODULE_NO_DEPRECATED
|
|
||||||
# define GPGFRONTEND_MODULE_NO_DEPRECATED
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* GPGFRONTEND_MODULE_EXPORT_H */
|
|
@ -34,6 +34,9 @@ generate_export_header(gpgfrontend_gnupg_info_gathering
|
|||||||
BASE_NAME "GF_MODULE"
|
BASE_NAME "GF_MODULE"
|
||||||
EXPORT_FILE_NAME "${_export_file}")
|
EXPORT_FILE_NAME "${_export_file}")
|
||||||
|
|
||||||
|
target_include_directories(gpgfrontend_gnupg_info_gathering PRIVATE
|
||||||
|
${CMAKE_SOURCE_DIR}/third_party/spdlog/include)
|
||||||
|
|
||||||
if (XCODE_BUILD)
|
if (XCODE_BUILD)
|
||||||
set_target_properties(gpgfrontend_gnupg_info_gathering
|
set_target_properties(gpgfrontend_gnupg_info_gathering
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
@ -46,7 +49,12 @@ endif ()
|
|||||||
|
|
||||||
# link sdk
|
# link sdk
|
||||||
target_link_libraries(gpgfrontend_gnupg_info_gathering PRIVATE
|
target_link_libraries(gpgfrontend_gnupg_info_gathering PRIVATE
|
||||||
gpgfrontend_module_sdk)
|
gpgfrontend_module_sdk)
|
||||||
|
|
||||||
|
# link qt
|
||||||
|
target_link_libraries(gpgfrontend_gnupg_info_gathering PRIVATE
|
||||||
|
Qt6::Core)
|
||||||
|
|
||||||
|
|
||||||
# set output directory
|
# set output directory
|
||||||
set_target_properties(gpgfrontend_gnupg_info_gathering PROPERTIES
|
set_target_properties(gpgfrontend_gnupg_info_gathering PROPERTIES
|
||||||
|
@ -31,9 +31,50 @@
|
|||||||
#include <GFSDKBasic.h>
|
#include <GFSDKBasic.h>
|
||||||
#include <GFSDKBuildInfo.h>
|
#include <GFSDKBuildInfo.h>
|
||||||
#include <GFSDKLog.h>
|
#include <GFSDKLog.h>
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
|
#include <QCryptographicHash>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
#include "GpgInfo.h"
|
#include "GpgInfo.h"
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<QString> {
|
||||||
|
// Parses format specifications.
|
||||||
|
constexpr auto parse(format_parse_context &ctx) -> decltype(ctx.begin()) {
|
||||||
|
return ctx.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formats the QString qstr and writes it to the output.
|
||||||
|
template <typename FormatContext>
|
||||||
|
auto format(const QString &qstr, FormatContext &ctx) const
|
||||||
|
-> decltype(ctx.out()) {
|
||||||
|
// Convert QString to UTF-8 QString (to handle Unicode characters
|
||||||
|
// correctly)
|
||||||
|
QByteArray utf8_array = qstr.toUtf8();
|
||||||
|
return fmt::format_to(ctx.out(), "{}", utf8_array.constData());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<QByteArray> {
|
||||||
|
// Parses format specifications.
|
||||||
|
constexpr auto parse(format_parse_context &ctx) -> decltype(ctx.begin()) {
|
||||||
|
return ctx.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formats the QString qstr and writes it to the output.
|
||||||
|
template <typename FormatContext>
|
||||||
|
auto format(const QByteArray &qarray, FormatContext &ctx) const
|
||||||
|
-> decltype(ctx.out()) {
|
||||||
|
// Convert QString to UTF-8 QString (to handle Unicode characters
|
||||||
|
// correctly)
|
||||||
|
return fmt::format_to(ctx.out(), "{}", qarray.constData());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
extern auto CalculateBinaryChacksum(const QString &path)
|
extern auto CalculateBinaryChacksum(const QString &path)
|
||||||
-> std::optional<QString>;
|
-> std::optional<QString>;
|
||||||
|
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QString>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Use to record some info about gnupg
|
* @brief Use to record some info about gnupg
|
||||||
*
|
*
|
||||||
|
@ -28,6 +28,10 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct fmt::formatter<QString> {
|
struct fmt::formatter<QString> {
|
||||||
// Parses format specifications.
|
// Parses format specifications.
|
@ -34,6 +34,9 @@ generate_export_header(gpgfrontend_version_checking
|
|||||||
BASE_NAME "GF_MODULE"
|
BASE_NAME "GF_MODULE"
|
||||||
EXPORT_FILE_NAME "${_export_file}")
|
EXPORT_FILE_NAME "${_export_file}")
|
||||||
|
|
||||||
|
target_include_directories(gpgfrontend_version_checking PRIVATE
|
||||||
|
${CMAKE_SOURCE_DIR}/third_party/spdlog/include)
|
||||||
|
|
||||||
if (XCODE_BUILD)
|
if (XCODE_BUILD)
|
||||||
set_target_properties(gpgfrontend_version_checking
|
set_target_properties(gpgfrontend_version_checking
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
@ -46,14 +49,14 @@ endif ()
|
|||||||
|
|
||||||
# link sdk
|
# link sdk
|
||||||
target_link_libraries(gpgfrontend_version_checking PRIVATE
|
target_link_libraries(gpgfrontend_version_checking PRIVATE
|
||||||
gpgfrontend_module_sdk)
|
gpgfrontend_module_sdk)
|
||||||
|
|
||||||
if(GPGFRONTEND_QT5_BUILD)
|
if(GPGFRONTEND_QT5_BUILD)
|
||||||
# link Qt
|
# link Qt
|
||||||
target_link_libraries(gpgfrontend_version_checking PUBLIC Qt5::Network)
|
target_link_libraries(gpgfrontend_version_checking PUBLIC Qt5::Core Qt5::Network)
|
||||||
else()
|
else()
|
||||||
# link Qt
|
# link Qt
|
||||||
target_link_libraries(gpgfrontend_version_checking PUBLIC Qt6::Network)
|
target_link_libraries(gpgfrontend_version_checking PUBLIC Qt6::Core Qt6::Network)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# set output directory
|
# set output directory
|
||||||
|
68
src/module/integrated/version_checking_module/QtLoggerFmt.h
Normal file
68
src/module/integrated/version_checking_module/QtLoggerFmt.h
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
/**
|
||||||
|
* Copyright (C) 2021 Saturneric <eric@bktus.com>
|
||||||
|
*
|
||||||
|
* This file is part of GpgFrontend.
|
||||||
|
*
|
||||||
|
* GpgFrontend is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GpgFrontend is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GpgFrontend. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* The initial version of the source code is inherited from
|
||||||
|
* the gpg4usb project, which is under GPL-3.0-or-later.
|
||||||
|
*
|
||||||
|
* All the source code of GpgFrontend was modified and released by
|
||||||
|
* Saturneric <eric@bktus.com> starting on May 12, 2021.
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<QString> {
|
||||||
|
// Parses format specifications.
|
||||||
|
constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
|
||||||
|
return ctx.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formats the QString qstr and writes it to the output.
|
||||||
|
template <typename FormatContext>
|
||||||
|
auto format(const QString& qstr, FormatContext& ctx) const
|
||||||
|
-> decltype(ctx.out()) {
|
||||||
|
// Convert QString to UTF-8 QString (to handle Unicode characters
|
||||||
|
// correctly)
|
||||||
|
QByteArray utf8_array = qstr.toUtf8();
|
||||||
|
return fmt::format_to(ctx.out(), "{}", utf8_array.constData());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<QByteArray> {
|
||||||
|
// Parses format specifications.
|
||||||
|
constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
|
||||||
|
return ctx.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formats the QString qstr and writes it to the output.
|
||||||
|
template <typename FormatContext>
|
||||||
|
auto format(const QByteArray& qarray, FormatContext& ctx) const
|
||||||
|
-> decltype(ctx.out()) {
|
||||||
|
// Convert QString to UTF-8 QString (to handle Unicode characters
|
||||||
|
// correctly)
|
||||||
|
return fmt::format_to(ctx.out(), "{}", qarray.constData());
|
||||||
|
}
|
||||||
|
};
|
@ -31,6 +31,44 @@
|
|||||||
#include <GFSDKBasic.h>
|
#include <GFSDKBasic.h>
|
||||||
#include <GFSDKExtra.h>
|
#include <GFSDKExtra.h>
|
||||||
#include <GFSDKLog.h>
|
#include <GFSDKLog.h>
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<QString> {
|
||||||
|
// Parses format specifications.
|
||||||
|
constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
|
||||||
|
return ctx.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formats the QString qstr and writes it to the output.
|
||||||
|
template <typename FormatContext>
|
||||||
|
auto format(const QString& qstr, FormatContext& ctx) const
|
||||||
|
-> decltype(ctx.out()) {
|
||||||
|
// Convert QString to UTF-8 QString (to handle Unicode characters
|
||||||
|
// correctly)
|
||||||
|
QByteArray utf8_array = qstr.toUtf8();
|
||||||
|
return fmt::format_to(ctx.out(), "{}", utf8_array.constData());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template <>
|
||||||
|
struct fmt::formatter<QByteArray> {
|
||||||
|
// Parses format specifications.
|
||||||
|
constexpr auto parse(format_parse_context& ctx) -> decltype(ctx.begin()) {
|
||||||
|
return ctx.begin();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Formats the QString qstr and writes it to the output.
|
||||||
|
template <typename FormatContext>
|
||||||
|
auto format(const QByteArray& qarray, FormatContext& ctx) const
|
||||||
|
-> decltype(ctx.out()) {
|
||||||
|
// Convert QString to UTF-8 QString (to handle Unicode characters
|
||||||
|
// correctly)
|
||||||
|
return fmt::format_to(ctx.out(), "{}", qarray.constData());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
auto SoftwareVersion::NeedUpgrade() const -> bool {
|
auto SoftwareVersion::NeedUpgrade() const -> bool {
|
||||||
GFModuleLogDebug(
|
GFModuleLogDebug(
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include <QString>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* @brief
|
||||||
*
|
*
|
||||||
|
@ -32,6 +32,7 @@
|
|||||||
#include <GFSDKBuildInfo.h>
|
#include <GFSDKBuildInfo.h>
|
||||||
#include <GFSDKExtra.h>
|
#include <GFSDKExtra.h>
|
||||||
#include <GFSDKLog.h>
|
#include <GFSDKLog.h>
|
||||||
|
#include <spdlog/spdlog.h>
|
||||||
|
|
||||||
#include <QMetaType>
|
#include <QMetaType>
|
||||||
#include <QtNetwork>
|
#include <QtNetwork>
|
||||||
|
@ -32,6 +32,8 @@
|
|||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
struct GFModuleMetaData {
|
struct GFModuleMetaData {
|
||||||
const char *key;
|
const char *key;
|
||||||
const char *value;
|
const char *value;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user