aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/module
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2025-05-01 14:39:10 +0000
committersaturneric <[email protected]>2025-05-01 14:39:10 +0000
commitc48a85cc0bcd6dd79e177d42ec27d7cc8262fd2d (patch)
tree45f3f09ccf9f38975881e4ce49901c0ae42ae3cc /src/core/module
parentfix: icon on linux platfrom (diff)
downloadGpgFrontend-c48a85cc0bcd6dd79e177d42ec27d7cc8262fd2d.tar.gz
GpgFrontend-c48a85cc0bcd6dd79e177d42ec27d7cc8262fd2d.zip
refactor: add cmake functions to register module and library
Diffstat (limited to 'src/core/module')
-rw-r--r--src/core/module/Event.cpp1
-rw-r--r--src/core/module/Event.h5
-rw-r--r--src/core/module/GlobalModuleContext.h2
-rw-r--r--src/core/module/GlobalRegisterTableTreeModel.h7
-rw-r--r--src/core/module/Module.cpp2
-rw-r--r--src/core/module/Module.h2
-rw-r--r--src/core/module/ModuleInit.h6
-rw-r--r--src/core/module/ModuleManager.cpp18
-rw-r--r--src/core/module/ModuleManager.h27
9 files changed, 34 insertions, 36 deletions
diff --git a/src/core/module/Event.cpp b/src/core/module/Event.cpp
index 56f45261..fd293184 100644
--- a/src/core/module/Event.cpp
+++ b/src/core/module/Event.cpp
@@ -29,6 +29,7 @@
#include "Event.h"
#include "core/utils/CommonUtils.h"
+#include "sdk/GFSDKModuleModel.h"
namespace GpgFrontend::Module {
diff --git a/src/core/module/Event.h b/src/core/module/Event.h
index a6660266..17c08d84 100644
--- a/src/core/module/Event.h
+++ b/src/core/module/Event.h
@@ -34,7 +34,8 @@
#include "core/GpgFrontendCore.h"
#include "core/model/DataObject.h"
-#include "sdk/GFSDKModule.h"
+
+struct GFModuleEvent;
namespace GpgFrontend::Module {
@@ -45,7 +46,7 @@ using EventIdentifier = QString;
using EventTriggerIdentifier = QString;
using Evnets = QContainer<Event>;
-class GPGFRONTEND_CORE_EXPORT Event {
+class GF_CORE_EXPORT Event {
public:
using ParameterValue = std::any;
using EventIdentifier = QString;
diff --git a/src/core/module/GlobalModuleContext.h b/src/core/module/GlobalModuleContext.h
index 611926b1..d980e23f 100644
--- a/src/core/module/GlobalModuleContext.h
+++ b/src/core/module/GlobalModuleContext.h
@@ -51,7 +51,7 @@ using GRTPtr = QSharedPointer<GlobalRegisterTable>;
using TaskRunnerPtr = QSharedPointer<Thread::TaskRunner>;
-class GPGFRONTEND_CORE_EXPORT GlobalModuleContext : public QObject {
+class GF_CORE_EXPORT GlobalModuleContext : public QObject {
Q_OBJECT
public:
explicit GlobalModuleContext();
diff --git a/src/core/module/GlobalRegisterTableTreeModel.h b/src/core/module/GlobalRegisterTableTreeModel.h
index 1d7ead77..8e44dba8 100644
--- a/src/core/module/GlobalRegisterTableTreeModel.h
+++ b/src/core/module/GlobalRegisterTableTreeModel.h
@@ -31,8 +31,7 @@
#include "core/module/GlobalRegisterTable.h"
namespace GpgFrontend::Module {
-class GPGFRONTEND_CORE_EXPORT GlobalRegisterTableTreeModel
- : public QAbstractItemModel {
+class GF_CORE_EXPORT GlobalRegisterTableTreeModel : public QAbstractItemModel {
public:
explicit GlobalRegisterTableTreeModel(GlobalRegisterTable *grt,
QObject *parent);
@@ -42,8 +41,8 @@ class GPGFRONTEND_CORE_EXPORT GlobalRegisterTableTreeModel
[[nodiscard]] auto columnCount(const QModelIndex &parent) const
-> int override;
- [[nodiscard]] auto data(const QModelIndex &index,
- int role) const -> QVariant override;
+ [[nodiscard]] auto data(const QModelIndex &index, int role) const
+ -> QVariant override;
[[nodiscard]] auto index(int row, int column, const QModelIndex &parent) const
-> QModelIndex override;
diff --git a/src/core/module/Module.cpp b/src/core/module/Module.cpp
index a77b974d..316058dc 100644
--- a/src/core/module/Module.cpp
+++ b/src/core/module/Module.cpp
@@ -31,7 +31,7 @@
#include "core/module/GlobalModuleContext.h"
#include "core/utils/CommonUtils.h"
#include "core/utils/IOUtils.h"
-#include "sdk/GFSDKModule.h"
+#include "sdk/GFSDKModuleModel.h"
#include "utils/BuildInfoUtils.h"
namespace GpgFrontend::Module {
diff --git a/src/core/module/Module.h b/src/core/module/Module.h
index 19c86be4..1999b352 100644
--- a/src/core/module/Module.h
+++ b/src/core/module/Module.h
@@ -44,7 +44,7 @@ using ModulePtr = QSharedPointer<Module>;
using TaskRunnerPtr = QSharedPointer<Thread::TaskRunner>;
-class GPGFRONTEND_CORE_EXPORT Module : public QObject {
+class GF_CORE_EXPORT Module : public QObject {
Q_OBJECT
public:
Module(ModuleIdentifier, ModuleVersion, const ModuleMetaData &);
diff --git a/src/core/module/ModuleInit.h b/src/core/module/ModuleInit.h
index c6e4b82b..2b9d42e4 100644
--- a/src/core/module/ModuleInit.h
+++ b/src/core/module/ModuleInit.h
@@ -28,8 +28,6 @@
#pragma once
-#include "core/GpgFrontendCoreExport.h"
-
namespace GpgFrontend::Module {
struct ModuleInitArgs {};
@@ -38,12 +36,12 @@ struct ModuleInitArgs {};
* @brief init the module library
*
*/
-void GPGFRONTEND_CORE_EXPORT LoadGpgFrontendModules(ModuleInitArgs args);
+void GF_CORE_EXPORT LoadGpgFrontendModules(ModuleInitArgs args);
/**
* @brief shutdown the module library
*
*/
-void GPGFRONTEND_CORE_EXPORT ShutdownGpgFrontendModules();
+void GF_CORE_EXPORT ShutdownGpgFrontendModules();
}; // namespace GpgFrontend::Module
diff --git a/src/core/module/ModuleManager.cpp b/src/core/module/ModuleManager.cpp
index 10c39eb6..fe22fcde 100644
--- a/src/core/module/ModuleManager.cpp
+++ b/src/core/module/ModuleManager.cpp
@@ -252,7 +252,7 @@ auto IsModuleActivate(ModuleIdentifier id) -> bool {
return ModuleManager::GetInstance().IsModuleActivated(id);
}
-auto GPGFRONTEND_CORE_EXPORT IsModuleExists(ModuleIdentifier id) -> bool {
+auto GF_CORE_EXPORT IsModuleExists(ModuleIdentifier id) -> bool {
auto module = ModuleManager::GetInstance().SearchModule(id);
return module != nullptr && module->IsGood();
}
@@ -263,13 +263,13 @@ auto UpsertRTValue(const QString& namespace_, const QString& key,
std::any(value));
}
-auto ListenRTPublishEvent(QObject* o, Namespace n, Key k,
- LPCallback c) -> bool {
+auto ListenRTPublishEvent(QObject* o, Namespace n, Key k, LPCallback c)
+ -> bool {
return ModuleManager::GetInstance().ListenRTPublish(o, n, k, c);
}
-auto ListRTChildKeys(const QString& namespace_,
- const QString& key) -> QContainer<Key> {
+auto ListRTChildKeys(const QString& namespace_, const QString& key)
+ -> QContainer<Key> {
return ModuleManager::GetInstance().ListRTChildKeys(namespace_, key);
}
@@ -328,8 +328,8 @@ auto ModuleManager::UpsertRTValue(Namespace n, Key k, std::any v) -> bool {
return p_->UpsertRTValue(n, k, v);
}
-auto ModuleManager::RetrieveRTValue(Namespace n,
- Key k) -> std::optional<std::any> {
+auto ModuleManager::RetrieveRTValue(Namespace n, Key k)
+ -> std::optional<std::any> {
return p_->RetrieveRTValue(n, k);
}
@@ -338,8 +338,8 @@ auto ModuleManager::ListenRTPublish(QObject* o, Namespace n, Key k,
return p_->ListenPublish(o, n, k, c);
}
-auto ModuleManager::ListRTChildKeys(const QString& n,
- const QString& k) -> QContainer<Key> {
+auto ModuleManager::ListRTChildKeys(const QString& n, const QString& k)
+ -> QContainer<Key> {
return p_->ListRTChildKeys(n, k);
}
diff --git a/src/core/module/ModuleManager.h b/src/core/module/ModuleManager.h
index 2c7d3bee..6adc7810 100644
--- a/src/core/module/ModuleManager.h
+++ b/src/core/module/ModuleManager.h
@@ -58,7 +58,7 @@ using Namespace = QString;
using Key = QString;
using LPCallback = std::function<void(Namespace, Key, int, std::any)>;
-class GPGFRONTEND_CORE_EXPORT ModuleManager
+class GF_CORE_EXPORT ModuleManager
: public SingletonFunctionObject<ModuleManager> {
public:
explicit ModuleManager(int channel);
@@ -138,7 +138,7 @@ void TriggerEvent(const EventIdentifier& event_id,
* @return true
* @return false
*/
-auto GPGFRONTEND_CORE_EXPORT IsModuleActivate(ModuleIdentifier) -> bool;
+auto GF_CORE_EXPORT IsModuleActivate(ModuleIdentifier) -> bool;
/**
* @brief
@@ -146,7 +146,7 @@ auto GPGFRONTEND_CORE_EXPORT IsModuleActivate(ModuleIdentifier) -> bool;
* @return true
* @return false
*/
-auto GPGFRONTEND_CORE_EXPORT IsModuleExists(ModuleIdentifier) -> bool;
+auto GF_CORE_EXPORT IsModuleExists(ModuleIdentifier) -> bool;
/**
* @brief
@@ -157,9 +157,8 @@ auto GPGFRONTEND_CORE_EXPORT IsModuleExists(ModuleIdentifier) -> bool;
* @return true
* @return false
*/
-auto GPGFRONTEND_CORE_EXPORT UpsertRTValue(const QString& namespace_,
- const QString& key,
- const std::any& value) -> bool;
+auto GF_CORE_EXPORT UpsertRTValue(const QString& namespace_, const QString& key,
+ const std::any& value) -> bool;
/**
* @brief
@@ -167,8 +166,8 @@ auto GPGFRONTEND_CORE_EXPORT UpsertRTValue(const QString& namespace_,
* @return true
* @return false
*/
-auto GPGFRONTEND_CORE_EXPORT ListenRTPublishEvent(QObject*, Namespace, Key,
- LPCallback) -> bool;
+auto GF_CORE_EXPORT ListenRTPublishEvent(QObject*, Namespace, Key, LPCallback)
+ -> bool;
/**
* @brief
@@ -177,12 +176,12 @@ auto GPGFRONTEND_CORE_EXPORT ListenRTPublishEvent(QObject*, Namespace, Key,
* @param key
* @return QContainer<Key>
*/
-auto GPGFRONTEND_CORE_EXPORT ListRTChildKeys(
- const QString& namespace_, const QString& key) -> QContainer<Key>;
+auto GF_CORE_EXPORT ListRTChildKeys(const QString& namespace_,
+ const QString& key) -> QContainer<Key>;
template <typename T>
-auto RetrieveRTValueTyped(const QString& namespace_,
- const QString& key) -> std::optional<T> {
+auto RetrieveRTValueTyped(const QString& namespace_, const QString& key)
+ -> std::optional<T> {
auto any_value =
ModuleManager::GetInstance().RetrieveRTValue(namespace_, key);
if (any_value && any_value->type() == typeid(T)) {
@@ -193,8 +192,8 @@ auto RetrieveRTValueTyped(const QString& namespace_,
template <typename T>
auto RetrieveRTValueTypedOrDefault(const QString& namespace_,
- const QString& key,
- const T& defaultValue) -> T {
+ const QString& key, const T& defaultValue)
+ -> T {
auto any_value =
ModuleManager::GetInstance().RetrieveRTValue(namespace_, key);
if (any_value && any_value->type() == typeid(T)) {