diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 16 | ||||
-rw-r--r-- | src/main.cpp | 8 | ||||
-rw-r--r-- | src/module/CMakeLists.txt | 104 | ||||
-rw-r--r-- | src/module/GpgFrontendModule.h (renamed from src/plugin/GpgFrontendPlugin.h) | 2 | ||||
-rw-r--r-- | src/module/GpgFrontendModuleExport.h | 42 | ||||
-rw-r--r-- | src/module/GpgFrontendModuleInit.cpp (renamed from src/plugin/GpgFrontendPluginInit.cpp) | 36 | ||||
-rw-r--r-- | src/module/GpgFrontendModuleInit.h (renamed from src/plugin/GpgFrontendPluginInit.h) | 12 | ||||
-rw-r--r-- | src/module/integrated/version_checking_module/CMakeLists.txt (renamed from src/plugin/module/version_checking_plugin/CMakeLists.txt) | 16 | ||||
-rw-r--r-- | src/module/integrated/version_checking_module/SoftwareVersion.cpp (renamed from src/plugin/module/version_checking_plugin/SoftwareVersion.cpp) | 12 | ||||
-rw-r--r-- | src/module/integrated/version_checking_module/SoftwareVersion.h (renamed from src/plugin/module/version_checking_plugin/SoftwareVersion.h) | 12 | ||||
-rw-r--r-- | src/module/integrated/version_checking_module/VersionCheckTask.cpp (renamed from src/plugin/module/version_checking_plugin/VersionCheckTask.cpp) | 4 | ||||
-rw-r--r-- | src/module/integrated/version_checking_module/VersionCheckTask.h (renamed from src/plugin/module/version_checking_plugin/VersionCheckTask.h) | 8 | ||||
-rw-r--r-- | src/module/integrated/version_checking_module/VersionCheckingModule.cpp (renamed from src/plugin/module/version_checking_plugin/VersionCheckingPlugin.cpp) | 20 | ||||
-rw-r--r-- | src/module/integrated/version_checking_module/VersionCheckingModule.h (renamed from src/plugin/module/version_checking_plugin/VersionCheckingPlugin.h) | 16 | ||||
-rw-r--r-- | src/module/sdk/Basic.cpp (renamed from src/plugin/sdk/Basic.cpp) | 0 | ||||
-rw-r--r-- | src/module/sdk/Basic.h (renamed from src/plugin/sdk/Basic.h) | 0 | ||||
-rw-r--r-- | src/module/sdk/Gpg.cpp (renamed from src/plugin/sdk/Gpg.cpp) | 0 | ||||
-rw-r--r-- | src/module/sdk/Gpg.h (renamed from src/plugin/sdk/Gpg.h) | 0 | ||||
-rw-r--r-- | src/module/sdk/GpgFrontendModuleSDK.h (renamed from src/plugin/sdk/GpgFrontendPluginSDK.h) | 4 | ||||
-rw-r--r-- | src/module/sdk/GpgFrontendModuleSDKExport.h | 42 | ||||
-rw-r--r-- | src/module/sdk/UI.cpp (renamed from src/plugin/sdk/UI.cpp) | 0 | ||||
-rw-r--r-- | src/module/sdk/UI.h (renamed from src/plugin/sdk/UI.h) | 0 | ||||
-rw-r--r-- | src/module/system/Event.cpp (renamed from src/plugin/system/Event.cpp) | 4 | ||||
-rw-r--r-- | src/module/system/Event.h (renamed from src/plugin/system/Event.h) | 6 | ||||
-rw-r--r-- | src/module/system/GlobalModuleContext.cpp (renamed from src/plugin/system/GlobalPluginContext.cpp) | 73 | ||||
-rw-r--r-- | src/module/system/GlobalModuleContext.h (renamed from src/plugin/system/GlobalPluginContext.h) | 43 | ||||
-rw-r--r-- | src/module/system/GpgFrontendModuleSystem.h (renamed from src/plugin/system/GpgFrontendPluginSystem.h) | 6 | ||||
-rw-r--r-- | src/module/system/GpgFrontendModuleSystemExport.h | 42 | ||||
-rw-r--r-- | src/module/system/Module.cpp (renamed from src/plugin/system/Plugin.cpp) | 54 | ||||
-rw-r--r-- | src/module/system/Module.h (renamed from src/plugin/system/Plugin.h) | 41 | ||||
-rw-r--r-- | src/module/system/ModuleManager.cpp (renamed from src/plugin/system/PluginManager.cpp) | 46 | ||||
-rw-r--r-- | src/module/system/ModuleManager.h (renamed from src/plugin/system/PluginManager.h) | 44 | ||||
-rw-r--r-- | src/plugin/CMakeLists.txt | 104 | ||||
-rw-r--r-- | src/plugin/GpgFrontendPluginExport.h | 42 | ||||
-rw-r--r-- | src/plugin/sdk/GpgFrontendPluginSDKExport.h | 42 | ||||
-rw-r--r-- | src/plugin/system/GpgFrontendPluginSystemExport.h | 42 |
36 files changed, 475 insertions, 468 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 36165e73..1eb18adc 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -81,19 +81,19 @@ if (BUILD_APPLICATION) endif () endif () -if (BUILD_CORE_MODULE) - message("[*] Build Core Module") +if (BUILD_CORE) + message("[*] Build Core") add_subdirectory(core) endif () -if (BUILD_UI_MODULE) - message("[*] Build UI Module") +if (BUILD_UI) + message("[*] Build UI") add_subdirectory(ui) endif () -if (BUILD_PLUGIN_MODULE) - message("[*] Build Plugin Module") - add_subdirectory(plugin) +if (BUILD_MODULE) + message("[*] Build Module") + add_subdirectory(module) endif () if (BUILD_APPLICATION) @@ -468,7 +468,7 @@ endif () # link options for GpgFrontend if (BUILD_APPLICATION) - target_link_libraries(${AppName} gpgfrontend_ui gpgfrontend_plugin) + target_link_libraries(${AppName} gpgfrontend_ui gpgfrontend_module) if (MINGW) message(STATUS "Link Application Library For MINGW") target_link_libraries(${AppName} crypto) diff --git a/src/main.cpp b/src/main.cpp index 8c8030d6..58cacc63 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -39,7 +39,7 @@ #include "core/GpgConstants.h" #include "core/GpgCoreInit.h" #include "core/function/GlobalSettingStation.h" -#include "plugin/GpgFrontendPluginInit.h" +#include "module/GpgFrontendModuleInit.h" #include "spdlog/spdlog.h" #include "ui/GpgFrontendApplication.h" #include "ui/GpgFrontendUIInit.h" @@ -120,7 +120,7 @@ int main(int argc, char* argv[]) { GpgFrontend::UI::InitUILoggingSystem(); // init the logging system for ui - // GpgFrontend::Plugin::InitPluginLoggingSystem(); + GpgFrontend::Module::InitModuleLoggingSystem(); // change path to search for related init_global_path_env(); @@ -133,7 +133,7 @@ int main(int argc, char* argv[]) { int restart_count = 0; // load integrated plugins - GpgFrontend::Plugin::LoadGpgFrontendIntegratedPlugins(); + GpgFrontend::Module::LoadGpgFrontendIntegratedModules(); do { #ifndef WINDOWS @@ -168,7 +168,7 @@ int main(int argc, char* argv[]) { } while (return_from_event_loop_code == RESTART_CODE && restart_count < 3); // shutdown the logging system for core - // GpgFrontend::Plugin::ShutdownPluginLoggingSystem(); + GpgFrontend::Module::ShutdownModuleLoggingSystem(); // shutdown the logging system for ui GpgFrontend::UI::ShutdownUILoggingSystem(); diff --git a/src/module/CMakeLists.txt b/src/module/CMakeLists.txt new file mode 100644 index 00000000..ab0a0e1d --- /dev/null +++ b/src/module/CMakeLists.txt @@ -0,0 +1,104 @@ +# Copyright (C) 2021 Saturneric <[email protected]> +# +# 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 <[email protected]> starting on May 12, 2021. +# +# SPDX-License-Identifier: GPL-3.0-or-later + +set(CMAKE_CXX_VISIBILITY_PRESET hidden) +set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) + +# define libgpgfrontend_module_system +aux_source_directory(system PLUGIN_SYSTEM_SOURCE) +add_library(gpgfrontend_module_system SHARED ${PLUGIN_SYSTEM_SOURCE}) +set(_export_file_system "${CMAKE_CURRENT_SOURCE_DIR}/system/GpgFrontendModuleSystemExport.h") +generate_export_header(gpgfrontend_module_system EXPORT_FILE_NAME "${_export_file_system}") + +# link json +target_link_libraries(gpgfrontend_module_system + PUBLIC nlohmann_json::nlohmann_json) + +# spdlog +target_link_libraries(gpgfrontend_module_system PUBLIC spdlog) + +# link Qt core +if(Qt6_DIR) + target_link_libraries(gpgfrontend_module_system PUBLIC Qt6::Core) +else() + target_link_libraries(gpgfrontend_module_system PUBLIC Qt5::Core) +endif() + +# link core and ui module +target_link_libraries(gpgfrontend_module_system PUBLIC + gpgfrontend_core gpgfrontend_ui) + +# define libgpgfrontend_module_sdk +aux_source_directory(sdk MODULE_SDK_SOURCE) + +add_library(gpgfrontend_module_sdk SHARED ${MODULE_SDK_SOURCE}) +set(_export_file_sdk "${CMAKE_CURRENT_SOURCE_DIR}/sdk/GpgFrontendModuleSDKExport.h") +generate_export_header(gpgfrontend_module_sdk EXPORT_FILE_NAME "${_export_file_sdk}") +target_include_directories(gpgfrontend_module_sdk PUBLIC sdk) + +# link module system +target_link_libraries(gpgfrontend_module_sdk + PUBLIC gpgfrontend_module_system) + +# tracking integrated modules +set(all_integrated_module_libraries "") +file(GLOB children LIST_DIRECTORIES true "integrated/*") +foreach(child ${children}) + if(IS_DIRECTORY ${child}) + get_filename_component(dirName ${child} NAME) + add_subdirectory("integrated/${dirName}") + + string(REPLACE "_module" "" stripped_module ${dirName}) + set(integrated_lib_name "gpgfrontend_integrated_module_${stripped_module}") + list(APPEND all_integrated_module_libraries ${integrated_lib_name}) + endif() +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) + +target_link_libraries(gpgfrontend_module PRIVATE + gpgfrontend_core gpgfrontend_ui) + +# link gpgfrontend_module_sdk +target_link_libraries(gpgfrontend_module PRIVATE gpgfrontend_module_sdk) + +# 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)
\ No newline at end of file diff --git a/src/plugin/GpgFrontendPlugin.h b/src/module/GpgFrontendModule.h index e778978b..72eadc9a 100644 --- a/src/plugin/GpgFrontendPlugin.h +++ b/src/module/GpgFrontendModule.h @@ -33,7 +33,7 @@ * Project internal dependencies */ #include "GpgFrontend.h" -#include "GpgFrontendPluginExport.h" +#include "GpgFrontendModuleExport.h" #include "core/GpgFrontendCore.h" #endif // GPGFRONTEND_GPGFRONTENDPLUGIN_H
\ No newline at end of file diff --git a/src/module/GpgFrontendModuleExport.h b/src/module/GpgFrontendModuleExport.h new file mode 100644 index 00000000..33ecbd3b --- /dev/null +++ b/src/module/GpgFrontendModuleExport.h @@ -0,0 +1,42 @@ + +#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 */ diff --git a/src/plugin/GpgFrontendPluginInit.cpp b/src/module/GpgFrontendModuleInit.cpp index a21432c7..53f71b71 100644 --- a/src/plugin/GpgFrontendPluginInit.cpp +++ b/src/module/GpgFrontendModuleInit.cpp @@ -26,7 +26,7 @@ * */ -#include "GpgFrontendPluginInit.h" +#include "GpgFrontendModuleInit.h" #include <spdlog/async.h> #include <spdlog/common.h> @@ -36,25 +36,27 @@ #include <memory> #include "core/function/GlobalSettingStation.h" -#include "plugin/system/PluginManager.h" +#include "module/system/PluginManager.h" // integrated plugins -#include "module/version_checking_plugin/VersionCheckingPlugin.h" +#include "integrated/version_checking_module/VersionCheckingModule.h" -namespace GpgFrontend::Plugin { +namespace GpgFrontend::Module { -void LoadGpgFrontendIntegratedPlugins() { - PluginManager::GetInstance()->RegisterPlugin( - std::make_shared<Module::VersionCheckingPlugin::VersionCheckingPlugin>()); +void LoadGpgFrontendIntegratedModules() { + SPDLOG_INFO("loading integrated module..."); + ModuleManager::GetInstance()->RegisterPlugin( + std::make_shared< + Integrated::VersionCheckingModule::VersionCheckingModule>()); } -void InitPluginLoggingSystem() { +void InitModuleLoggingSystem() { using namespace boost::posix_time; using namespace boost::gregorian; // get the log directory auto logfile_path = - (GpgFrontend::GlobalSettingStation::GetInstance().GetLogDir() / "plugin"); + (GpgFrontend::GlobalSettingStation::GetInstance().GetLogDir() / "module"); logfile_path.replace_extension(".log"); // sinks @@ -67,26 +69,26 @@ void InitPluginLoggingSystem() { spdlog::init_thread_pool(1024, 2); // logger - auto plugin_logger = std::make_shared<spdlog::async_logger>( - "ui", begin(sinks), end(sinks), spdlog::thread_pool()); - plugin_logger->set_pattern( + auto module_logger = std::make_shared<spdlog::async_logger>( + "plugin", begin(sinks), end(sinks), spdlog::thread_pool()); + module_logger->set_pattern( "[%H:%M:%S.%e] [T:%t] [%=4n] %^[%=8l]%$ [%s:%#] [%!] -> %v (+%ius)"); #ifdef DEBUG - plugin_logger->set_level(spdlog::level::trace); + module_logger->set_level(spdlog::level::trace); #else ui_logger->set_level(spdlog::level::info); #endif // flush policy - plugin_logger->flush_on(spdlog::level::err); + module_logger->flush_on(spdlog::level::err); spdlog::flush_every(std::chrono::seconds(5)); // register it as default logger - spdlog::set_default_logger(plugin_logger); + spdlog::set_default_logger(module_logger); } -void ShutdownPluginLoggingSystem() { +void ShutdownModuleLoggingSystem() { #ifdef WINDOWS // Under VisualStudio, this must be called before main finishes to workaround // a known VS issue @@ -94,4 +96,4 @@ void ShutdownPluginLoggingSystem() { spdlog::shutdown(); #endif } -} // namespace GpgFrontend::Plugin
\ No newline at end of file +} // namespace GpgFrontend::Module
\ No newline at end of file diff --git a/src/plugin/GpgFrontendPluginInit.h b/src/module/GpgFrontendModuleInit.h index c4a48f27..47380720 100644 --- a/src/plugin/GpgFrontendPluginInit.h +++ b/src/module/GpgFrontendModuleInit.h @@ -29,28 +29,28 @@ #ifndef GPGFRONTEND_GPGFRONTENDPLUGININIT_H #define GPGFRONTEND_GPGFRONTENDPLUGININIT_H -#include "plugin/GpgFrontendPlugin.h" +#include "module/GpgFrontendModule.h" -namespace GpgFrontend::Plugin { +namespace GpgFrontend::Module { /** * @brief init the plugin library * */ -void GPGFRONTEND_PLUGIN_EXPORT LoadGpgFrontendIntegratedPlugins(); +void GPGFRONTEND_MODULE_EXPORT LoadGpgFrontendIntegratedModules(); /** * @brief * */ -void GPGFRONTEND_PLUGIN_EXPORT InitPluginLoggingSystem(); +void GPGFRONTEND_MODULE_EXPORT InitModuleLoggingSystem(); /** * @brief * */ -void GPGFRONTEND_PLUGIN_EXPORT ShutdownPluginLoggingSystem(); +void GPGFRONTEND_MODULE_EXPORT ShutdownModuleLoggingSystem(); -}; // namespace GpgFrontend::Plugin +}; // namespace GpgFrontend::Module #endif // GPGFRONTEND_GPGFRONTENDPLUGININIT_H diff --git a/src/plugin/module/version_checking_plugin/CMakeLists.txt b/src/module/integrated/version_checking_module/CMakeLists.txt index 85d533da..db1ba17f 100644 --- a/src/plugin/module/version_checking_plugin/CMakeLists.txt +++ b/src/module/integrated/version_checking_module/CMakeLists.txt @@ -24,23 +24,21 @@ # SPDX-License-Identifier: GPL-3.0-or-later -aux_source_directory(. INTEGRATED_PLUGIN_SOURCE) +aux_source_directory(. INTEGRATED_MODULE_SOURCE) # define libgpgfrontend_plugin -set(CMAKE_CXX_VISIBILITY_PRESET hidden) -set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) -add_library(gpgfrontend_integrated_plugin_version_checking SHARED ${INTEGRATED_PLUGIN_SOURCE}) +add_library(gpgfrontend_integrated_module_version_checking SHARED ${INTEGRATED_MODULE_SOURCE}) # link sdk -target_link_libraries(gpgfrontend_integrated_plugin_version_checking PRIVATE - gpgfrontend_plugin_sdk) +target_link_libraries(gpgfrontend_integrated_module_version_checking PRIVATE + gpgfrontend_module_sdk) # link Qt if(Qt6_DIR) - target_link_libraries(gpgfrontend_integrated_plugin_version_checking PRIVATE Qt6::Network) + target_link_libraries(gpgfrontend_integrated_module_version_checking PRIVATE Qt6::Network) else() - target_link_libraries(gpgfrontend_integrated_plugin_version_checking PRIVATE Qt5::Network) + target_link_libraries(gpgfrontend_integrated_module_version_checking PRIVATE Qt5::Network) endif() # using std c++ 17 -target_compile_features(gpgfrontend_integrated_plugin_version_checking PRIVATE cxx_std_17)
\ No newline at end of file +target_compile_features(gpgfrontend_integrated_module_version_checking PRIVATE cxx_std_17)
\ No newline at end of file diff --git a/src/plugin/module/version_checking_plugin/SoftwareVersion.cpp b/src/module/integrated/version_checking_module/SoftwareVersion.cpp index 8626c822..b82bfbba 100644 --- a/src/plugin/module/version_checking_plugin/SoftwareVersion.cpp +++ b/src/module/integrated/version_checking_module/SoftwareVersion.cpp @@ -28,9 +28,9 @@ #include "SoftwareVersion.h" -namespace GpgFrontend::Plugin::Module { +namespace GpgFrontend::Module::Integrated::VersionCheckingModule { -int VersionCheckingPlugin::SoftwareVersion::version_compare( +int VersionCheckingModule::SoftwareVersion::version_compare( const std::string& a, const std::string& b) { auto temp_a = a, temp_b = b; @@ -82,7 +82,7 @@ int VersionCheckingPlugin::SoftwareVersion::version_compare( return 0; } -bool VersionCheckingPlugin::SoftwareVersion::NeedUpgrade() const { +bool VersionCheckingModule::SoftwareVersion::NeedUpgrade() const { SPDLOG_DEBUG("compair version current {} latest {}, result {}", current_version, latest_version, version_compare(current_version, latest_version)); @@ -93,12 +93,12 @@ bool VersionCheckingPlugin::SoftwareVersion::NeedUpgrade() const { version_compare(current_version, latest_version) < 0; } -bool VersionCheckingPlugin::SoftwareVersion::VersionWithDrawn() const { +bool VersionCheckingModule::SoftwareVersion::VersionWithDrawn() const { return load_info_done && !current_version_found && current_prerelease && !current_draft; } -bool VersionCheckingPlugin::SoftwareVersion::CurrentVersionReleased() const { +bool VersionCheckingModule::SoftwareVersion::CurrentVersionReleased() const { return load_info_done && current_version_found; } -} // namespace GpgFrontend::Plugin::Module
\ No newline at end of file +} // namespace GpgFrontend::Module::Integrated::VersionCheckingModule
\ No newline at end of file diff --git a/src/plugin/module/version_checking_plugin/SoftwareVersion.h b/src/module/integrated/version_checking_module/SoftwareVersion.h index 6aac3894..2d4fa092 100644 --- a/src/plugin/module/version_checking_plugin/SoftwareVersion.h +++ b/src/module/integrated/version_checking_module/SoftwareVersion.h @@ -26,12 +26,12 @@ * */ -#ifndef GPGFRONTEND_PLUGIN_SOFTWAREVERSION_H -#define GPGFRONTEND_PLUGIN_SOFTWAREVERSION_H +#ifndef GPGFRONTEND_MODULE_SOFTWAREVERSION_H +#define GPGFRONTEND_MODULE_SOFTWAREVERSION_H -#include <plugin/sdk/GpgFrontendPluginSDK.h> +#include <module/sdk/GpgFrontendModuleSDK.h> -namespace GpgFrontend::Plugin::Module::VersionCheckingPlugin { +namespace GpgFrontend::Module::Integrated::VersionCheckingModule { /** * @brief * @@ -83,6 +83,6 @@ struct SoftwareVersion { private: static int version_compare(const std::string& a, const std::string& b); }; -} // namespace GpgFrontend::Plugin::Module::VersionCheckingPlugin +} // namespace GpgFrontend::Module::Integrated::VersionCheckingModule -#endif // GPGFRONTEND_PLUGIN_SOFTWAREVERSION_H +#endif // GPGFRONTEND_MODULE_SOFTWAREVERSION_H diff --git a/src/plugin/module/version_checking_plugin/VersionCheckTask.cpp b/src/module/integrated/version_checking_module/VersionCheckTask.cpp index 2a26a53c..b1e8eca8 100644 --- a/src/plugin/module/version_checking_plugin/VersionCheckTask.cpp +++ b/src/module/integrated/version_checking_module/VersionCheckTask.cpp @@ -34,7 +34,7 @@ #include "GpgFrontendBuildInfo.h" -namespace GpgFrontend::Plugin::Module::VersionCheckingPlugin { +namespace GpgFrontend::Module::Integrated::VersionCheckingModule { VersionCheckTask::VersionCheckTask() : Task("version_check_task"), @@ -176,4 +176,4 @@ void VersionCheckTask::slot_parse_current_version_info() { emit SignalTaskRunnableEnd(0); } -} // namespace GpgFrontend::Plugin::Module::VersionCheckingPlugin +} // namespace GpgFrontend::Module::Integrated::VersionCheckingModule diff --git a/src/plugin/module/version_checking_plugin/VersionCheckTask.h b/src/module/integrated/version_checking_module/VersionCheckTask.h index d5155cd9..d30c6dd7 100644 --- a/src/plugin/module/version_checking_plugin/VersionCheckTask.h +++ b/src/module/integrated/version_checking_module/VersionCheckTask.h @@ -29,14 +29,14 @@ #ifndef GPGFRONTEND_VERSIONCHECKTHREAD_H #define GPGFRONTEND_VERSIONCHECKTHREAD_H -#include <plugin/sdk/GpgFrontendPluginSDK.h> +#include <module/sdk/GpgFrontendModuleSDK.h> #include "SoftwareVersion.h" class QNetworkReply; class QNetworkAccessManager; -namespace GpgFrontend::Plugin::Module::VersionCheckingPlugin { +namespace GpgFrontend::Module::Integrated::VersionCheckingModule { /** * @brief @@ -92,7 +92,7 @@ class VersionCheckTask : public Thread::Task { SoftwareVersion version_; }; -} // namespace GpgFrontend::Plugin::Module::VersionCheckingPlugin - // GpgFrontend::Plugin::Custom::IntegradedPlugin::VersionCheckingPlugin +} // namespace GpgFrontend::Module::Integrated::VersionCheckingModule + // GpgFrontend::Module::Custom::IntegradedPlugin::VersionCheckingModule #endif // GPGFRONTEND_VERSIONCHECKTHREAD_H diff --git a/src/plugin/module/version_checking_plugin/VersionCheckingPlugin.cpp b/src/module/integrated/version_checking_module/VersionCheckingModule.cpp index 4d18b01c..3901a562 100644 --- a/src/plugin/module/version_checking_plugin/VersionCheckingPlugin.cpp +++ b/src/module/integrated/version_checking_module/VersionCheckingModule.cpp @@ -26,35 +26,35 @@ * */ -#include "VersionCheckingPlugin.h" +#include "VersionCheckingModule.h" #include "VersionCheckTask.h" -namespace GpgFrontend::Plugin::Module::VersionCheckingPlugin { +namespace GpgFrontend::Module::Integrated::VersionCheckingModule { -VersionCheckingPlugin::VersionCheckingPlugin() - : Plugin("com.bktus.gpgfrontend.plugin.integrated.versionchecking", "1.0.0", - PluginMetaData{{"description", "try to check gpgfrontend version"}, +VersionCheckingModule::VersionCheckingModule() + : Module("com.bktus.gpgfrontend.plugin.integrated.versionchecking", "1.0.0", + ModuleMetaData{{"description", "try to check gpgfrontend version"}, {"author", "saturneric"}}) {} -bool VersionCheckingPlugin::Register() { +bool VersionCheckingModule::Register() { SPDLOG_INFO("version checking plugin registering"); return true; } -bool VersionCheckingPlugin::Active() { +bool VersionCheckingModule::Active() { SPDLOG_INFO("version checking plugin activating"); listenEvent("APPLICATION_STARTED"); return true; } -int VersionCheckingPlugin::Exec(EventRefrernce event) { +int VersionCheckingModule::Exec(EventRefrernce event) { SPDLOG_INFO("version checking plugin ececuting"); getTaskRunner()->PostTask(new VersionCheckTask()); return 0; } -bool VersionCheckingPlugin::Deactive() { return true; } -} // namespace GpgFrontend::Plugin::Module::VersionCheckingPlugin +bool VersionCheckingModule::Deactive() { return true; } +} // namespace GpgFrontend::Module::Integrated::VersionCheckingModule diff --git a/src/plugin/module/version_checking_plugin/VersionCheckingPlugin.h b/src/module/integrated/version_checking_module/VersionCheckingModule.h index 7d489efd..5def5466 100644 --- a/src/plugin/module/version_checking_plugin/VersionCheckingPlugin.h +++ b/src/module/integrated/version_checking_module/VersionCheckingModule.h @@ -26,18 +26,18 @@ * */ -#ifndef GPGFRONTEND_PLUGIN_VERSIONCHECKINGPLUGIN_H -#define GPGFRONTEND_PLUGIN_VERSIONCHECKINGPLUGIN_H +#ifndef GPGFRONTEND_MODULE_VERSIONCHECKINGPLUGIN_H +#define GPGFRONTEND_MODULE_VERSIONCHECKINGPLUGIN_H -#include <plugin/sdk/GpgFrontendPluginSDK.h> +#include <module/sdk/GpgFrontendModuleSDK.h> #include "SoftwareVersion.h" -namespace GpgFrontend::Plugin::Module::VersionCheckingPlugin { +namespace GpgFrontend::Module::Integrated::VersionCheckingModule { -class GPGFRONTEND_PLUGIN_SDK_EXPORT VersionCheckingPlugin : public Plugin { +class GPGFRONTEND_MODULE_SDK_EXPORT VersionCheckingModule : public Module { public: - VersionCheckingPlugin(); + VersionCheckingModule(); virtual bool Register() override; @@ -47,6 +47,6 @@ class GPGFRONTEND_PLUGIN_SDK_EXPORT VersionCheckingPlugin : public Plugin { virtual bool Deactive() override; }; -} // namespace GpgFrontend::Plugin::Module::VersionCheckingPlugin +} // namespace GpgFrontend::Module::Integrated::VersionCheckingModule -#endif // GPGFRONTEND_PLUGIN_VERSIONCHECKINGPLUGIN_H
\ No newline at end of file +#endif // GPGFRONTEND_MODULE_VERSIONCHECKINGPLUGIN_H
\ No newline at end of file diff --git a/src/plugin/sdk/Basic.cpp b/src/module/sdk/Basic.cpp index 63859763..63859763 100644 --- a/src/plugin/sdk/Basic.cpp +++ b/src/module/sdk/Basic.cpp diff --git a/src/plugin/sdk/Basic.h b/src/module/sdk/Basic.h index 0702632a..0702632a 100644 --- a/src/plugin/sdk/Basic.h +++ b/src/module/sdk/Basic.h diff --git a/src/plugin/sdk/Gpg.cpp b/src/module/sdk/Gpg.cpp index 63859763..63859763 100644 --- a/src/plugin/sdk/Gpg.cpp +++ b/src/module/sdk/Gpg.cpp diff --git a/src/plugin/sdk/Gpg.h b/src/module/sdk/Gpg.h index 0702632a..0702632a 100644 --- a/src/plugin/sdk/Gpg.h +++ b/src/module/sdk/Gpg.h diff --git a/src/plugin/sdk/GpgFrontendPluginSDK.h b/src/module/sdk/GpgFrontendModuleSDK.h index 4decf317..47b017bf 100644 --- a/src/plugin/sdk/GpgFrontendPluginSDK.h +++ b/src/module/sdk/GpgFrontendModuleSDK.h @@ -28,5 +28,5 @@ #pragma once -#include <plugin/sdk/GpgFrontendPluginSDKExport.h> -#include <plugin/system/GpgFrontendPluginSystem.h>
\ No newline at end of file +#include <module/sdk/GpgFrontendModuleSDKExport.h> +#include <module/system/GpgFrontendModuleSystem.h>
\ No newline at end of file diff --git a/src/module/sdk/GpgFrontendModuleSDKExport.h b/src/module/sdk/GpgFrontendModuleSDKExport.h new file mode 100644 index 00000000..a62168bc --- /dev/null +++ b/src/module/sdk/GpgFrontendModuleSDKExport.h @@ -0,0 +1,42 @@ + +#ifndef GPGFRONTEND_MODULE_SDK_EXPORT_H +#define GPGFRONTEND_MODULE_SDK_EXPORT_H + +#ifdef GPGFRONTEND_MODULE_SDK_STATIC_DEFINE +# define GPGFRONTEND_MODULE_SDK_EXPORT +# define GPGFRONTEND_MODULE_SDK_NO_EXPORT +#else +# ifndef GPGFRONTEND_MODULE_SDK_EXPORT +# ifdef gpgfrontend_module_sdk_EXPORTS + /* We are building this library */ +# define GPGFRONTEND_MODULE_SDK_EXPORT __attribute__((visibility("default"))) +# else + /* We are using this library */ +# define GPGFRONTEND_MODULE_SDK_EXPORT __attribute__((visibility("default"))) +# endif +# endif + +# ifndef GPGFRONTEND_MODULE_SDK_NO_EXPORT +# define GPGFRONTEND_MODULE_SDK_NO_EXPORT __attribute__((visibility("hidden"))) +# endif +#endif + +#ifndef GPGFRONTEND_MODULE_SDK_DEPRECATED +# define GPGFRONTEND_MODULE_SDK_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef GPGFRONTEND_MODULE_SDK_DEPRECATED_EXPORT +# define GPGFRONTEND_MODULE_SDK_DEPRECATED_EXPORT GPGFRONTEND_MODULE_SDK_EXPORT GPGFRONTEND_MODULE_SDK_DEPRECATED +#endif + +#ifndef GPGFRONTEND_MODULE_SDK_DEPRECATED_NO_EXPORT +# define GPGFRONTEND_MODULE_SDK_DEPRECATED_NO_EXPORT GPGFRONTEND_MODULE_SDK_NO_EXPORT GPGFRONTEND_MODULE_SDK_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef GPGFRONTEND_MODULE_SDK_NO_DEPRECATED +# define GPGFRONTEND_MODULE_SDK_NO_DEPRECATED +# endif +#endif + +#endif /* GPGFRONTEND_MODULE_SDK_EXPORT_H */ diff --git a/src/plugin/sdk/UI.cpp b/src/module/sdk/UI.cpp index 63859763..63859763 100644 --- a/src/plugin/sdk/UI.cpp +++ b/src/module/sdk/UI.cpp diff --git a/src/plugin/sdk/UI.h b/src/module/sdk/UI.h index 0702632a..0702632a 100644 --- a/src/plugin/sdk/UI.h +++ b/src/module/sdk/UI.h diff --git a/src/plugin/system/Event.cpp b/src/module/system/Event.cpp index b899e7e3..3e27e26d 100644 --- a/src/plugin/system/Event.cpp +++ b/src/module/system/Event.cpp @@ -30,7 +30,7 @@ #include <memory> -namespace GpgFrontend::Plugin { +namespace GpgFrontend::Module { class Event::Impl { public: @@ -105,4 +105,4 @@ void Event::AddParameter(const std::string& key, const ParameterValue& value) { p_->AddParameter(key, value); } -} // namespace GpgFrontend::Plugin
\ No newline at end of file +} // namespace GpgFrontend::Module
\ No newline at end of file diff --git a/src/plugin/system/Event.h b/src/module/system/Event.h index e9c1c78a..4ffe4f0f 100644 --- a/src/plugin/system/Event.h +++ b/src/module/system/Event.h @@ -31,11 +31,11 @@ #include <memory> -#include "GpgFrontendPluginSystemExport.h" +#include "GpgFrontendModuleSystemExport.h" #include "core/GpgFrontendCore.h" #include "nlohmann/json_fwd.hpp" -namespace GpgFrontend::Plugin { +namespace GpgFrontend::Module { class Event; @@ -78,6 +78,6 @@ class Event { std::unique_ptr<Impl> p_; }; -} // namespace GpgFrontend::Plugin +} // namespace GpgFrontend::Module #endif // GPGFRONTEND_EVENT_H
\ No newline at end of file diff --git a/src/plugin/system/GlobalPluginContext.cpp b/src/module/system/GlobalModuleContext.cpp index 528fa8d7..6296250d 100644 --- a/src/plugin/system/GlobalPluginContext.cpp +++ b/src/module/system/GlobalModuleContext.cpp @@ -26,7 +26,7 @@ * */ -#include "GlobalPluginContext.h" +#include "GlobalModuleContext.h" #include <boost/random/mersenne_twister.hpp> #include <boost/random/uniform_int_distribution.hpp> @@ -37,12 +37,12 @@ #include <unordered_set> #include "core/thread/Task.h" -#include "plugin/system/Event.h" -#include "plugin/system/Plugin.h" +#include "module/system/Event.h" +#include "module/system/Module.h" -namespace GpgFrontend::Plugin { +namespace GpgFrontend::Module { -class GlobalPluginContext::Impl { +class GlobalModuleContext::Impl { public: Impl(TaskRunnerPtr task_runner) : default_task_runner_(task_runner), @@ -55,7 +55,7 @@ class GlobalPluginContext::Impl { acquired_channel_.insert(GPGFRONTEND_NON_ASCII_CHANNEL); } - int GetChannel(PluginPtr plugin) { + int GetChannel(ModulePtr plugin) { // Search for the plugin in the register table. auto plugin_info_opt = search_plugin_register_table(plugin->GetPluginIdentifier()); @@ -72,9 +72,9 @@ class GlobalPluginContext::Impl { return plugin_info->channel; } - int GetDefaultChannel(PluginPtr) { return GPGFRONTEND_DEFAULT_CHANNEL; } + int GetDefaultChannel(ModulePtr) { return GPGFRONTEND_DEFAULT_CHANNEL; } - std::optional<TaskRunnerPtr> GetTaskRunner(PluginPtr plugin) { + std::optional<TaskRunnerPtr> GetTaskRunner(ModulePtr plugin) { auto opt = search_plugin_register_table(plugin->GetPluginIdentifier()); if (!opt.has_value()) { return std::nullopt; @@ -82,7 +82,7 @@ class GlobalPluginContext::Impl { return opt.value()->task_runner; } - std::optional<TaskRunnerPtr> GetTaskRunner(PluginIdentifier plugin_id) { + std::optional<TaskRunnerPtr> GetTaskRunner(ModuleIdentifier plugin_id) { // Search for the plugin in the register table. auto plugin_info_opt = search_plugin_register_table(plugin_id); if (!plugin_info_opt.has_value()) { @@ -96,7 +96,7 @@ class GlobalPluginContext::Impl { return default_task_runner_; } - bool RegisterPlugin(PluginPtr plugin) { + bool RegisterPlugin(ModulePtr plugin) { SPDLOG_DEBUG("attempting to register plugin: {}", plugin->GetPluginIdentifier()); // Check if the plugin is null or already registered. @@ -107,6 +107,11 @@ class GlobalPluginContext::Impl { return false; } + if (!plugin->Register()) { + SPDLOG_ERROR("register plugin {} failed", plugin->GetPluginIdentifier()); + return false; + } + PluginRegisterInfo register_info; register_info.plugin = plugin; register_info.channel = acquire_new_unique_channel(); @@ -121,7 +126,7 @@ class GlobalPluginContext::Impl { return true; } - bool ActivePlugin(PluginIdentifier plugin_id) { + bool ActivePlugin(ModuleIdentifier plugin_id) { SPDLOG_DEBUG("attempting to activate plugin: {}", plugin_id); // Search for the plugin in the register table. @@ -141,13 +146,13 @@ class GlobalPluginContext::Impl { return plugin_info->activate; } - bool ListenEvent(PluginIdentifier plugin_id, EventIdentifier event) { + bool ListenEvent(ModuleIdentifier plugin_id, EventIdentifier event) { SPDLOG_DEBUG("plugin: {} is attempting to listen to event {}", plugin_id, event); // Check if the event exists, if not, create it. auto it = plugin_events_table_.find(event); if (it == plugin_events_table_.end()) { - plugin_events_table_[event] = std::unordered_set<PluginIdentifier>(); + plugin_events_table_[event] = std::unordered_set<ModuleIdentifier>(); it = plugin_events_table_.find(event); SPDLOG_INFO("new event {} of plugin system created", event); } @@ -162,7 +167,7 @@ class GlobalPluginContext::Impl { return true; } - bool DeactivatePlugin(PluginIdentifier plugin_id) { + bool DeactivatePlugin(ModuleIdentifier plugin_id) { // Search for the plugin in the register table. auto plugin_info_opt = search_plugin_register_table(plugin_id); if (!plugin_info_opt.has_value()) { @@ -239,15 +244,15 @@ class GlobalPluginContext::Impl { struct PluginRegisterInfo { int channel; TaskRunnerPtr task_runner; - PluginPtr plugin; + ModulePtr plugin; bool activate; }; using PluginRegisterInfoPtr = std::shared_ptr<PluginRegisterInfo>; - std::unordered_map<PluginIdentifier, PluginRegisterInfoPtr> + std::unordered_map<ModuleIdentifier, PluginRegisterInfoPtr> plugin_register_table_; - std::map<EventIdentifier, std::unordered_set<PluginIdentifier>> + std::map<EventIdentifier, std::unordered_set<ModuleIdentifier>> plugin_events_table_; std::set<int> acquired_channel_; @@ -270,7 +275,7 @@ class GlobalPluginContext::Impl { // Function to search for a plugin in the register table. std::optional<PluginRegisterInfoPtr> search_plugin_register_table( - PluginIdentifier identifier) { + ModuleIdentifier identifier) { auto it = plugin_register_table_.find(identifier); if (it == plugin_register_table_.end()) { return std::nullopt; @@ -278,59 +283,59 @@ class GlobalPluginContext::Impl { return it->second; } - std::list<PluginIdentifier>& search_plugin_events_table(PluginIdentifier); + std::list<ModuleIdentifier>& search_plugin_events_table(ModuleIdentifier); }; // Constructor for GlobalPluginContext, takes a TaskRunnerPtr as an argument. -GlobalPluginContext::GlobalPluginContext(TaskRunnerPtr task_runner) +GlobalModuleContext::GlobalModuleContext(TaskRunnerPtr task_runner) : p_(std::make_unique<Impl>(task_runner)) {} -GlobalPluginContext::~GlobalPluginContext() = default; +GlobalModuleContext::~GlobalModuleContext() = default; // Function to get the task runner associated with a plugin. -std::optional<TaskRunnerPtr> GlobalPluginContext::GetTaskRunner( - PluginPtr plugin) { +std::optional<TaskRunnerPtr> GlobalModuleContext::GetTaskRunner( + ModulePtr plugin) { return p_->GetTaskRunner(plugin); } // Function to get the task runner associated with a plugin. -std::optional<TaskRunnerPtr> GlobalPluginContext::GetTaskRunner( - PluginIdentifier plugin_id) { +std::optional<TaskRunnerPtr> GlobalModuleContext::GetTaskRunner( + ModuleIdentifier plugin_id) { return p_->GetTaskRunner(plugin_id); } // Function to get the global task runner. -std::optional<TaskRunnerPtr> GlobalPluginContext::GetGlobalTaskRunner() { +std::optional<TaskRunnerPtr> GlobalModuleContext::GetGlobalTaskRunner() { return p_->GetGlobalTaskRunner(); } -bool GlobalPluginContext::RegisterPlugin(PluginPtr plugin) { +bool GlobalModuleContext::RegisterPlugin(ModulePtr plugin) { return p_->RegisterPlugin(plugin); } -bool GlobalPluginContext::ActivePlugin(PluginIdentifier plugin_id) { +bool GlobalModuleContext::ActivePlugin(ModuleIdentifier plugin_id) { return p_->ActivePlugin(plugin_id); } -bool GlobalPluginContext::ListenEvent(PluginIdentifier plugin_id, +bool GlobalModuleContext::ListenEvent(ModuleIdentifier plugin_id, EventIdentifier event) { return p_->ListenEvent(plugin_id, event); } -bool GlobalPluginContext::DeactivatePlugin(PluginIdentifier plugin_id) { +bool GlobalModuleContext::DeactivatePlugin(ModuleIdentifier plugin_id) { return p_->DeactivatePlugin(plugin_id); } -bool GlobalPluginContext::TriggerEvent(EventRefrernce event) { +bool GlobalModuleContext::TriggerEvent(EventRefrernce event) { return p_->TriggerEvent(event); } -int GlobalPluginContext::GetChannel(PluginPtr plugin) { +int GlobalModuleContext::GetChannel(ModulePtr plugin) { return p_->GetChannel(plugin); } -int GlobalPluginContext::GetDefaultChannel(PluginPtr _) { +int GlobalModuleContext::GetDefaultChannel(ModulePtr _) { return p_->GetDefaultChannel(_); } -} // namespace GpgFrontend::Plugin +} // namespace GpgFrontend::Module diff --git a/src/plugin/system/GlobalPluginContext.h b/src/module/system/GlobalModuleContext.h index e9c218b0..810961ea 100644 --- a/src/plugin/system/GlobalPluginContext.h +++ b/src/module/system/GlobalModuleContext.h @@ -29,49 +29,48 @@ #ifndef GPGFRONTEND_GLOBALPLUGINCONTEXT_H #define GPGFRONTEND_GLOBALPLUGINCONTEXT_H -#include "GpgFrontendPluginSystemExport.h" +#include "GpgFrontendModuleSystemExport.h" #include "core/GpgFrontendCore.h" #include "core/thread/TaskRunner.h" -#include "plugin/system/Event.h" +#include "module/system/Event.h" -namespace GpgFrontend::Plugin { +namespace GpgFrontend::Module { -class GlobalPluginContext; +class GlobalModuleContext; -class Plugin; -class PluginManager; -using PluginIdentifier = std::string; -using PluginPtr = std::shared_ptr<Plugin>; -using PluginList = std::list<std::string>; +class Module; +class ModuleManager; +using ModuleIdentifier = std::string; +using ModulePtr = std::shared_ptr<Module>; -using GlobalPluginContextPtr = std::shared_ptr<GlobalPluginContext>; +using GlobalModuleContextPtr = std::shared_ptr<GlobalModuleContext>; using TaskRunnerPtr = std::shared_ptr<Thread::TaskRunner>; -class GPGFRONTEND_PLUGIN_SYSTEM_EXPORT GlobalPluginContext : public QObject { +class GPGFRONTEND_MODULE_SYSTEM_EXPORT GlobalModuleContext : public QObject { Q_OBJECT public: - GlobalPluginContext(TaskRunnerPtr); + GlobalModuleContext(TaskRunnerPtr); - ~GlobalPluginContext(); + ~GlobalModuleContext(); - int GetChannel(PluginPtr); + int GetChannel(ModulePtr); - int GetDefaultChannel(PluginPtr); + int GetDefaultChannel(ModulePtr); - std::optional<TaskRunnerPtr> GetTaskRunner(PluginPtr); + std::optional<TaskRunnerPtr> GetTaskRunner(ModulePtr); - std::optional<TaskRunnerPtr> GetTaskRunner(PluginIdentifier plugin); + std::optional<TaskRunnerPtr> GetTaskRunner(ModuleIdentifier plugin); std::optional<TaskRunnerPtr> GetGlobalTaskRunner(); - bool RegisterPlugin(PluginPtr); + bool RegisterPlugin(ModulePtr); - bool ActivePlugin(PluginIdentifier); + bool ActivePlugin(ModuleIdentifier); - bool DeactivatePlugin(PluginIdentifier); + bool DeactivatePlugin(ModuleIdentifier); - bool ListenEvent(PluginIdentifier, EventIdentifier); + bool ListenEvent(ModuleIdentifier, EventIdentifier); bool TriggerEvent(EventRefrernce); @@ -80,6 +79,6 @@ class GPGFRONTEND_PLUGIN_SYSTEM_EXPORT GlobalPluginContext : public QObject { std::unique_ptr<Impl> p_; }; -} // namespace GpgFrontend::Plugin +} // namespace GpgFrontend::Module #endif // GPGFRONTEND_GLOBALPLUGINCONTEXT_H
\ No newline at end of file diff --git a/src/plugin/system/GpgFrontendPluginSystem.h b/src/module/system/GpgFrontendModuleSystem.h index b4861e76..100c73e2 100644 --- a/src/plugin/system/GpgFrontendPluginSystem.h +++ b/src/module/system/GpgFrontendModuleSystem.h @@ -29,6 +29,6 @@ #pragma once #include <core/GpgFrontendCore.h> -#include <plugin/system/Event.h> -#include <plugin/system/Plugin.h> -#include <plugin/system/PluginManager.h>
\ No newline at end of file +#include <module/system/Event.h> +#include <module/system/Module.h> +#include <module/system/ModuleManager.h>
\ No newline at end of file diff --git a/src/module/system/GpgFrontendModuleSystemExport.h b/src/module/system/GpgFrontendModuleSystemExport.h new file mode 100644 index 00000000..dc8d6c3a --- /dev/null +++ b/src/module/system/GpgFrontendModuleSystemExport.h @@ -0,0 +1,42 @@ + +#ifndef GPGFRONTEND_MODULE_SYSTEM_EXPORT_H +#define GPGFRONTEND_MODULE_SYSTEM_EXPORT_H + +#ifdef GPGFRONTEND_MODULE_SYSTEM_STATIC_DEFINE +# define GPGFRONTEND_MODULE_SYSTEM_EXPORT +# define GPGFRONTEND_MODULE_SYSTEM_NO_EXPORT +#else +# ifndef GPGFRONTEND_MODULE_SYSTEM_EXPORT +# ifdef gpgfrontend_module_system_EXPORTS + /* We are building this library */ +# define GPGFRONTEND_MODULE_SYSTEM_EXPORT __attribute__((visibility("default"))) +# else + /* We are using this library */ +# define GPGFRONTEND_MODULE_SYSTEM_EXPORT __attribute__((visibility("default"))) +# endif +# endif + +# ifndef GPGFRONTEND_MODULE_SYSTEM_NO_EXPORT +# define GPGFRONTEND_MODULE_SYSTEM_NO_EXPORT __attribute__((visibility("hidden"))) +# endif +#endif + +#ifndef GPGFRONTEND_MODULE_SYSTEM_DEPRECATED +# define GPGFRONTEND_MODULE_SYSTEM_DEPRECATED __attribute__ ((__deprecated__)) +#endif + +#ifndef GPGFRONTEND_MODULE_SYSTEM_DEPRECATED_EXPORT +# define GPGFRONTEND_MODULE_SYSTEM_DEPRECATED_EXPORT GPGFRONTEND_MODULE_SYSTEM_EXPORT GPGFRONTEND_MODULE_SYSTEM_DEPRECATED +#endif + +#ifndef GPGFRONTEND_MODULE_SYSTEM_DEPRECATED_NO_EXPORT +# define GPGFRONTEND_MODULE_SYSTEM_DEPRECATED_NO_EXPORT GPGFRONTEND_MODULE_SYSTEM_NO_EXPORT GPGFRONTEND_MODULE_SYSTEM_DEPRECATED +#endif + +#if 0 /* DEFINE_NO_DEPRECATED */ +# ifndef GPGFRONTEND_MODULE_SYSTEM_NO_DEPRECATED +# define GPGFRONTEND_MODULE_SYSTEM_NO_DEPRECATED +# endif +#endif + +#endif /* GPGFRONTEND_MODULE_SYSTEM_EXPORT_H */ diff --git a/src/plugin/system/Plugin.cpp b/src/module/system/Module.cpp index ac10953a..c829b8aa 100644 --- a/src/plugin/system/Plugin.cpp +++ b/src/module/system/Module.cpp @@ -26,17 +26,19 @@ * */ -#include "Plugin.h" +#include "Module.h" -#include "plugin/system/GlobalPluginContext.h" +#include <memory> -namespace GpgFrontend::Plugin { +#include "module/system/GlobalModuleContext.h" -class Plugin::Impl { +namespace GpgFrontend::Module { + +class Module::Impl { public: - friend class GlobalPluginContext; + friend class GlobalModuleContext; - Impl(PluginIdentifier id, PluginVersion version, PluginMetaData meta_data) + Impl(ModuleIdentifier id, ModuleVersion version, ModuleMetaData meta_data) : identifier_((boost::format("__plugin_%1%") % id).str()), version_(version), meta_data_(meta_data) {} @@ -58,20 +60,20 @@ class Plugin::Impl { event); } - PluginIdentifier GetPluginIdentifier() const { return identifier_; } + ModuleIdentifier GetPluginIdentifier() const { return identifier_; } - void SetGPC(GlobalPluginContextPtr gpc) { gpc_ = gpc; } + void SetGPC(GlobalModuleContextPtr gpc) { gpc_ = gpc; } private: - GlobalPluginContextPtr gpc_; - const std::shared_ptr<Plugin> self_shared_ptr_; - const PluginIdentifier identifier_; - const PluginVersion version_; - const PluginMetaData meta_data_; + GlobalModuleContextPtr gpc_; + const std::shared_ptr<Module> self_shared_ptr_; + const ModuleIdentifier identifier_; + const ModuleVersion version_; + const ModuleMetaData meta_data_; - PluginIdentifier gpc_get_identifier() { return identifier_; } + ModuleIdentifier gpc_get_identifier() { return identifier_; } - const GlobalPluginContextPtr get_global_plugin_context() { + const GlobalModuleContextPtr get_global_plugin_context() { if (gpc_ == nullptr) { throw std::runtime_error("plugin is not registered by plugin manager"); } @@ -79,27 +81,27 @@ class Plugin::Impl { } }; -Plugin::Plugin(PluginIdentifier id, PluginVersion version, - PluginMetaData meta_data) - : s_(this) {} +Module::Module(ModuleIdentifier id, ModuleVersion version, + ModuleMetaData meta_data) + : p_(std::make_unique<Impl>(id, version, meta_data)) {} -Plugin::~Plugin() = default; +Module::~Module() = default; -int Plugin::getChannel() { return p_->GetChannel(); } +int Module::getChannel() { return p_->GetChannel(); } -int Plugin::getDefaultChannel() { return p_->GetDefaultChannel(); } +int Module::getDefaultChannel() { return p_->GetDefaultChannel(); } -TaskRunnerPtr Plugin::getTaskRunner() { +TaskRunnerPtr Module::getTaskRunner() { return p_->GetTaskRunner().value_or(nullptr); } -bool Plugin::listenEvent(EventIdentifier event) { +bool Module::listenEvent(EventIdentifier event) { return p_->ListenEvent(event); } -PluginIdentifier Plugin::GetPluginIdentifier() const { +ModuleIdentifier Module::GetPluginIdentifier() const { return p_->GetPluginIdentifier(); } -void Plugin::SetGPC(GlobalPluginContextPtr gpc) { p_->SetGPC(gpc); } -} // namespace GpgFrontend::Plugin
\ No newline at end of file +void Module::SetGPC(GlobalModuleContextPtr gpc) { p_->SetGPC(gpc); } +} // namespace GpgFrontend::Module
\ No newline at end of file diff --git a/src/plugin/system/Plugin.h b/src/module/system/Module.h index 7995d8dc..f8cfd230 100644 --- a/src/plugin/system/Plugin.h +++ b/src/module/system/Module.h @@ -26,36 +26,36 @@ * */ -#ifndef GPGFRONTEND_PLUGIN_H -#define GPGFRONTEND_PLUGIN_H +#ifndef GPGFRONTEND_MODULE_H +#define GPGFRONTEND_MODULE_H #include <memory> -#include "GpgFrontendPluginSystemExport.h" +#include "GpgFrontendModuleSystemExport.h" #include "core/thread/Task.h" #include "core/thread/TaskRunner.h" -#include "plugin/system/Event.h" +#include "module/system/Event.h" -namespace GpgFrontend::Plugin { +namespace GpgFrontend::Module { -class Plugin; -class GlobalPluginContext; -class PluginManager; +class Module; +class GlobalModuleContext; +class ModuleManager; -using PluginIdentifier = std::string; -using PluginVersion = std::string; -using PluginMetaData = std::map<std::string, std::string>; -using PluginPtr = std::shared_ptr<Plugin>; -using GlobalPluginContextPtr = std::shared_ptr<GlobalPluginContext>; +using ModuleIdentifier = std::string; +using ModuleVersion = std::string; +using ModuleMetaData = std::map<std::string, std::string>; +using ModulePtr = std::shared_ptr<Module>; +using GlobalModuleContextPtr = std::shared_ptr<GlobalModuleContext>; using TaskRunnerPtr = std::shared_ptr<Thread::TaskRunner>; -class GPGFRONTEND_PLUGIN_SYSTEM_EXPORT Plugin : public QObject { +class GPGFRONTEND_MODULE_SYSTEM_EXPORT Module : public QObject { Q_OBJECT public: - Plugin(PluginIdentifier, PluginVersion, PluginMetaData); + Module(ModuleIdentifier, ModuleVersion, ModuleMetaData); - ~Plugin(); + ~Module(); virtual bool Register() = 0; @@ -65,9 +65,9 @@ class GPGFRONTEND_PLUGIN_SYSTEM_EXPORT Plugin : public QObject { virtual bool Deactive() = 0; - PluginIdentifier GetPluginIdentifier() const; + ModuleIdentifier GetPluginIdentifier() const; - void SetGPC(GlobalPluginContextPtr); + void SetGPC(GlobalModuleContextPtr); protected: int getChannel(); @@ -81,9 +81,8 @@ class GPGFRONTEND_PLUGIN_SYSTEM_EXPORT Plugin : public QObject { private: class Impl; std::unique_ptr<Impl> p_; - const std::shared_ptr<Plugin> s_; }; -} // namespace GpgFrontend::Plugin +} // namespace GpgFrontend::Module -#endif // GPGFRONTEND_PLUGIN_H
\ No newline at end of file +#endif // GPGFRONTEND_MODULE_H
\ No newline at end of file diff --git a/src/plugin/system/PluginManager.cpp b/src/module/system/ModuleManager.cpp index c4623c32..8f0e7517 100644 --- a/src/plugin/system/PluginManager.cpp +++ b/src/module/system/ModuleManager.cpp @@ -26,24 +26,26 @@ * */ -#include "PluginManager.h" +#include "ModuleManager.h" #include "core/thread/TaskRunner.h" -#include "plugin/system/GlobalPluginContext.h" -#include "plugin/system/Plugin.h" +#include "module/system/GlobalModuleContext.h" +#include "module/system/Module.h" -namespace GpgFrontend::Plugin { +namespace GpgFrontend::Module { -PluginMangerPtr PluginManager::g_ = nullptr; +ModuleMangerPtr ModuleManager::g_ = nullptr; -class PluginManager::Impl { +class ModuleManager::Impl { public: Impl() : task_runner_(std::make_shared<Thread::TaskRunner>()), global_plugin_context_( - std::make_shared<GlobalPluginContext>(task_runner_)) {} + std::make_shared<GlobalModuleContext>(task_runner_)) { + task_runner_->start(); + } - void RegisterPlugin(PluginPtr plugin) { + void RegisterPlugin(ModulePtr plugin) { task_runner_->PostTask(new Thread::Task( std::move([=](GpgFrontend::Thread::DataObjectPtr) -> int { global_plugin_context_->RegisterPlugin(plugin); @@ -61,7 +63,7 @@ class PluginManager::Impl { __func__, nullptr, true)); } - void ActivePlugin(PluginIdentifier identifier) { + void ActivePlugin(ModuleIdentifier identifier) { task_runner_->PostTask(new Thread::Task( std::move([=](GpgFrontend::Thread::DataObjectPtr) -> int { global_plugin_context_->ActivePlugin(identifier); @@ -70,40 +72,40 @@ class PluginManager::Impl { __func__, nullptr, true)); } - std::optional<TaskRunnerPtr> GetTaskRunner(PluginIdentifier plugin_id) { + std::optional<TaskRunnerPtr> GetTaskRunner(ModuleIdentifier plugin_id) { return global_plugin_context_->GetTaskRunner(plugin_id); } private: - static PluginMangerPtr global_plugin_manager_; + static ModuleMangerPtr global_plugin_manager_; TaskRunnerPtr task_runner_; - GlobalPluginContextPtr global_plugin_context_; + GlobalModuleContextPtr global_plugin_context_; }; -PluginManager::PluginManager() : p_(std::make_unique<Impl>()) {} +ModuleManager::ModuleManager() : p_(std::make_unique<Impl>()) {} -PluginManager::~PluginManager() = default; +ModuleManager::~ModuleManager() = default; -PluginMangerPtr PluginManager::GetInstance() { - if (g_ == nullptr) g_ = std::shared_ptr<PluginManager>(new PluginManager()); +ModuleMangerPtr ModuleManager::GetInstance() { + if (g_ == nullptr) g_ = std::shared_ptr<ModuleManager>(new ModuleManager()); return g_; } -void PluginManager::RegisterPlugin(PluginPtr plugin) { +void ModuleManager::RegisterPlugin(ModulePtr plugin) { return p_->RegisterPlugin(plugin); } -void PluginManager::TriggerEvent(EventRefrernce event) { +void ModuleManager::TriggerEvent(EventRefrernce event) { return p_->TriggerEvent(event); } -void PluginManager::ActivePlugin(PluginIdentifier identifier) { +void ModuleManager::ActivePlugin(ModuleIdentifier identifier) { return p_->ActivePlugin(identifier); } -std::optional<TaskRunnerPtr> PluginManager::GetTaskRunner( - PluginIdentifier plugin_id) { +std::optional<TaskRunnerPtr> ModuleManager::GetTaskRunner( + ModuleIdentifier plugin_id) { return p_->GetTaskRunner(plugin_id); } -} // namespace GpgFrontend::Plugin
\ No newline at end of file +} // namespace GpgFrontend::Module
\ No newline at end of file diff --git a/src/plugin/system/PluginManager.h b/src/module/system/ModuleManager.h index 5fc36291..3520bbcf 100644 --- a/src/plugin/system/PluginManager.h +++ b/src/module/system/ModuleManager.h @@ -26,13 +26,13 @@ * */ -#ifndef GPGFRONTEND_PLUGINMANAGER_H -#define GPGFRONTEND_PLUGINMANAGER_H +#ifndef GPGFRONTEND_MODULEMANAGER_H +#define GPGFRONTEND_MODULEMANAGER_H #include <memory> #include <string> -#include "GpgFrontendPluginSystemExport.h" +#include "GpgFrontendModuleSystemExport.h" #include "core/GpgFrontendCore.h" #include "core/thread/Task.h" @@ -40,46 +40,46 @@ namespace GpgFrontend::Thread { class TaskRunner; } -namespace GpgFrontend::Plugin { +namespace GpgFrontend::Module { using TaskRunnerPtr = std::shared_ptr<Thread::TaskRunner>; class Event; -class Plugin; -class GlobalPluginContext; -class PluginManager; +class Module; +class GlobalModuleContext; +class ModuleManager; using EventRefrernce = std::shared_ptr<Event>; -using PluginIdentifier = std::string; -using PluginPtr = std::shared_ptr<Plugin>; -using PluginMangerPtr = std::shared_ptr<PluginManager>; -using GlobalPluginContextPtr = std::shared_ptr<GlobalPluginContext>; +using ModuleIdentifier = std::string; +using ModulePtr = std::shared_ptr<Module>; +using ModuleMangerPtr = std::shared_ptr<ModuleManager>; +using GlobalModuleContextPtr = std::shared_ptr<GlobalModuleContext>; -class GPGFRONTEND_PLUGIN_SYSTEM_EXPORT PluginManager : public QObject { +class GPGFRONTEND_MODULE_SYSTEM_EXPORT ModuleManager : public QObject { Q_OBJECT public: - ~PluginManager(); + ~ModuleManager(); - static PluginMangerPtr GetInstance(); + static ModuleMangerPtr GetInstance(); - void RegisterPlugin(PluginPtr); + void RegisterPlugin(ModulePtr); void TriggerEvent(EventRefrernce); - void ActivePlugin(PluginIdentifier); + void ActivePlugin(ModuleIdentifier); - void DeactivePlugin(PluginIdentifier); + void DeactivePlugin(ModuleIdentifier); - std::optional<TaskRunnerPtr> GetTaskRunner(PluginIdentifier); + std::optional<TaskRunnerPtr> GetTaskRunner(ModuleIdentifier); private: class Impl; std::unique_ptr<Impl> p_; - static PluginMangerPtr g_; + static ModuleMangerPtr g_; - PluginManager(); + ModuleManager(); }; -} // namespace GpgFrontend::Plugin +} // namespace GpgFrontend::Module -#endif // GPGFRONTEND_PLUGINMANAGER_H
\ No newline at end of file +#endif // GPGFRONTEND_MODULEMANAGER_H
\ No newline at end of file diff --git a/src/plugin/CMakeLists.txt b/src/plugin/CMakeLists.txt deleted file mode 100644 index 288f9c42..00000000 --- a/src/plugin/CMakeLists.txt +++ /dev/null @@ -1,104 +0,0 @@ -# Copyright (C) 2021 Saturneric <[email protected]> -# -# 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 <[email protected]> starting on May 12, 2021. -# -# SPDX-License-Identifier: GPL-3.0-or-later - - -# define libgpgfrontend_plugin_system -aux_source_directory(system PLUGIN_SYSTEM_SOURCE) -add_library(gpgfrontend_plugin_system SHARED ${PLUGIN_SYSTEM_SOURCE}) -set(_export_file_system "${CMAKE_CURRENT_SOURCE_DIR}/system/GpgFrontendPluginSystemExport.h") -generate_export_header(gpgfrontend_plugin_system EXPORT_FILE_NAME "${_export_file_system}") - -# link json -target_link_libraries(gpgfrontend_plugin_system - PUBLIC nlohmann_json::nlohmann_json) - -# spdlog -target_link_libraries(gpgfrontend_plugin_system PUBLIC spdlog) - -# link Qt core -if(Qt6_DIR) - target_link_libraries(gpgfrontend_plugin_system PUBLIC Qt6::Core) -else() - target_link_libraries(gpgfrontend_plugin_system PUBLIC Qt5::Core) -endif() - -# link core and ui module -target_link_libraries(gpgfrontend_plugin_system PUBLIC - gpgfrontend_core gpgfrontend_ui) - -# define libgpgfrontend_plugin_sdk -aux_source_directory(sdk PLUGIN_SDK_SOURCE) - -add_library(gpgfrontend_plugin_sdk SHARED ${PLUGIN_SDK_SOURCE}) -set(_export_file_sdk "${CMAKE_CURRENT_SOURCE_DIR}/sdk/GpgFrontendPluginSDKExport.h") -generate_export_header(gpgfrontend_plugin_sdk EXPORT_FILE_NAME "${_export_file_sdk}") -target_include_directories(gpgfrontend_plugin_sdk PUBLIC sdk) - -# link plugin system -target_link_libraries(gpgfrontend_plugin_sdk - PUBLIC gpgfrontend_plugin_system) - -# tracking integrated plugins -set(all_module_libraries "") -file(GLOB children LIST_DIRECTORIES true "module/*") -foreach(child ${children}) - if(IS_DIRECTORY ${child}) - get_filename_component(dirName ${child} NAME) - add_subdirectory("module/${dirName}") - - string(REPLACE "_plugin" "" stripped_plugin ${dirName}) - set(integrated_lib_name "gpgfrontend_integrated_plugin_${stripped_plugin}") - list(APPEND all_integrated_plugins_libraries ${integrated_lib_name}) - endif() -endforeach() - -set(CMAKE_CXX_VISIBILITY_PRESET hidden) -set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) -aux_source_directory(. PLUGIN_SOURCE) -add_library(gpgfrontend_plugin SHARED ${PLUGIN_SOURCE}) - -set(_export_file "${CMAKE_CURRENT_SOURCE_DIR}/GpgFrontendPluginExport.h") -generate_export_header(gpgfrontend_plugin EXPORT_FILE_NAME "${_export_file}") - -# set up pch -target_precompile_headers(gpgfrontend_plugin PUBLIC GpgFrontendPlugin.h) - -# add ui generator include path -target_include_directories(gpgfrontend_plugin PUBLIC - ${CMAKE_CURRENT_BINARY_DIR}/gpgfrontend_plugin_autogen/include - ${CMAKE_SOURCE_DIR}/third_party/spdlog/include) - -target_link_libraries(gpgfrontend_plugin PRIVATE - gpgfrontend_core gpgfrontend_ui) - -# link gpgfrontend_plugin_sdk -target_link_libraries(gpgfrontend_plugin PRIVATE gpgfrontend_plugin_sdk) - -# link all integrated plugins -message(STATUS "All Module Libraries: ${all_module_libraries}") -target_link_libraries(gpgfrontend_plugin PRIVATE ${all_module_libraries}) - -# using std c++ 17 -target_compile_features(gpgfrontend_plugin PUBLIC cxx_std_17)
\ No newline at end of file diff --git a/src/plugin/GpgFrontendPluginExport.h b/src/plugin/GpgFrontendPluginExport.h deleted file mode 100644 index a0eaa86c..00000000 --- a/src/plugin/GpgFrontendPluginExport.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef GPGFRONTEND_PLUGIN_EXPORT_H -#define GPGFRONTEND_PLUGIN_EXPORT_H - -#ifdef GPGFRONTEND_PLUGIN_STATIC_DEFINE -# define GPGFRONTEND_PLUGIN_EXPORT -# define GPGFRONTEND_PLUGIN_NO_EXPORT -#else -# ifndef GPGFRONTEND_PLUGIN_EXPORT -# ifdef gpgfrontend_plugin_EXPORTS - /* We are building this library */ -# define GPGFRONTEND_PLUGIN_EXPORT __attribute__((visibility("default"))) -# else - /* We are using this library */ -# define GPGFRONTEND_PLUGIN_EXPORT __attribute__((visibility("default"))) -# endif -# endif - -# ifndef GPGFRONTEND_PLUGIN_NO_EXPORT -# define GPGFRONTEND_PLUGIN_NO_EXPORT __attribute__((visibility("hidden"))) -# endif -#endif - -#ifndef GPGFRONTEND_PLUGIN_DEPRECATED -# define GPGFRONTEND_PLUGIN_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef GPGFRONTEND_PLUGIN_DEPRECATED_EXPORT -# define GPGFRONTEND_PLUGIN_DEPRECATED_EXPORT GPGFRONTEND_PLUGIN_EXPORT GPGFRONTEND_PLUGIN_DEPRECATED -#endif - -#ifndef GPGFRONTEND_PLUGIN_DEPRECATED_NO_EXPORT -# define GPGFRONTEND_PLUGIN_DEPRECATED_NO_EXPORT GPGFRONTEND_PLUGIN_NO_EXPORT GPGFRONTEND_PLUGIN_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef GPGFRONTEND_PLUGIN_NO_DEPRECATED -# define GPGFRONTEND_PLUGIN_NO_DEPRECATED -# endif -#endif - -#endif /* GPGFRONTEND_PLUGIN_EXPORT_H */ diff --git a/src/plugin/sdk/GpgFrontendPluginSDKExport.h b/src/plugin/sdk/GpgFrontendPluginSDKExport.h deleted file mode 100644 index 8e508e35..00000000 --- a/src/plugin/sdk/GpgFrontendPluginSDKExport.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef GPGFRONTEND_PLUGIN_SDK_EXPORT_H -#define GPGFRONTEND_PLUGIN_SDK_EXPORT_H - -#ifdef GPGFRONTEND_PLUGIN_SDK_STATIC_DEFINE -# define GPGFRONTEND_PLUGIN_SDK_EXPORT -# define GPGFRONTEND_PLUGIN_SDK_NO_EXPORT -#else -# ifndef GPGFRONTEND_PLUGIN_SDK_EXPORT -# ifdef gpgfrontend_plugin_sdk_EXPORTS - /* We are building this library */ -# define GPGFRONTEND_PLUGIN_SDK_EXPORT __attribute__((visibility("default"))) -# else - /* We are using this library */ -# define GPGFRONTEND_PLUGIN_SDK_EXPORT __attribute__((visibility("default"))) -# endif -# endif - -# ifndef GPGFRONTEND_PLUGIN_SDK_NO_EXPORT -# define GPGFRONTEND_PLUGIN_SDK_NO_EXPORT __attribute__((visibility("hidden"))) -# endif -#endif - -#ifndef GPGFRONTEND_PLUGIN_SDK_DEPRECATED -# define GPGFRONTEND_PLUGIN_SDK_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef GPGFRONTEND_PLUGIN_SDK_DEPRECATED_EXPORT -# define GPGFRONTEND_PLUGIN_SDK_DEPRECATED_EXPORT GPGFRONTEND_PLUGIN_SDK_EXPORT GPGFRONTEND_PLUGIN_SDK_DEPRECATED -#endif - -#ifndef GPGFRONTEND_PLUGIN_SDK_DEPRECATED_NO_EXPORT -# define GPGFRONTEND_PLUGIN_SDK_DEPRECATED_NO_EXPORT GPGFRONTEND_PLUGIN_SDK_NO_EXPORT GPGFRONTEND_PLUGIN_SDK_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef GPGFRONTEND_PLUGIN_SDK_NO_DEPRECATED -# define GPGFRONTEND_PLUGIN_SDK_NO_DEPRECATED -# endif -#endif - -#endif /* GPGFRONTEND_PLUGIN_SDK_EXPORT_H */ diff --git a/src/plugin/system/GpgFrontendPluginSystemExport.h b/src/plugin/system/GpgFrontendPluginSystemExport.h deleted file mode 100644 index e096f0dc..00000000 --- a/src/plugin/system/GpgFrontendPluginSystemExport.h +++ /dev/null @@ -1,42 +0,0 @@ - -#ifndef GPGFRONTEND_PLUGIN_SYSTEM_EXPORT_H -#define GPGFRONTEND_PLUGIN_SYSTEM_EXPORT_H - -#ifdef GPGFRONTEND_PLUGIN_SYSTEM_STATIC_DEFINE -# define GPGFRONTEND_PLUGIN_SYSTEM_EXPORT -# define GPGFRONTEND_PLUGIN_SYSTEM_NO_EXPORT -#else -# ifndef GPGFRONTEND_PLUGIN_SYSTEM_EXPORT -# ifdef gpgfrontend_plugin_system_EXPORTS - /* We are building this library */ -# define GPGFRONTEND_PLUGIN_SYSTEM_EXPORT __attribute__((visibility("default"))) -# else - /* We are using this library */ -# define GPGFRONTEND_PLUGIN_SYSTEM_EXPORT __attribute__((visibility("default"))) -# endif -# endif - -# ifndef GPGFRONTEND_PLUGIN_SYSTEM_NO_EXPORT -# define GPGFRONTEND_PLUGIN_SYSTEM_NO_EXPORT __attribute__((visibility("hidden"))) -# endif -#endif - -#ifndef GPGFRONTEND_PLUGIN_SYSTEM_DEPRECATED -# define GPGFRONTEND_PLUGIN_SYSTEM_DEPRECATED __attribute__ ((__deprecated__)) -#endif - -#ifndef GPGFRONTEND_PLUGIN_SYSTEM_DEPRECATED_EXPORT -# define GPGFRONTEND_PLUGIN_SYSTEM_DEPRECATED_EXPORT GPGFRONTEND_PLUGIN_SYSTEM_EXPORT GPGFRONTEND_PLUGIN_SYSTEM_DEPRECATED -#endif - -#ifndef GPGFRONTEND_PLUGIN_SYSTEM_DEPRECATED_NO_EXPORT -# define GPGFRONTEND_PLUGIN_SYSTEM_DEPRECATED_NO_EXPORT GPGFRONTEND_PLUGIN_SYSTEM_NO_EXPORT GPGFRONTEND_PLUGIN_SYSTEM_DEPRECATED -#endif - -#if 0 /* DEFINE_NO_DEPRECATED */ -# ifndef GPGFRONTEND_PLUGIN_SYSTEM_NO_DEPRECATED -# define GPGFRONTEND_PLUGIN_SYSTEM_NO_DEPRECATED -# endif -#endif - -#endif /* GPGFRONTEND_PLUGIN_SYSTEM_EXPORT_H */ |