aboutsummaryrefslogtreecommitdiffstats
path: root/src/core/module/Event.h
diff options
context:
space:
mode:
authorsaturneric <[email protected]>2024-07-27 12:18:26 +0000
committersaturneric <[email protected]>2024-07-27 12:18:26 +0000
commit5be04d1602355278814bc86c69ec9f648978be8c (patch)
tree6d691279591a267a6fe82bd3e9f84ced68dea214 /src/core/module/Event.h
parentfix: discover and solve some memory issues (diff)
downloadGpgFrontend-5be04d1602355278814bc86c69ec9f648978be8c.tar.gz
GpgFrontend-5be04d1602355278814bc86c69ec9f648978be8c.zip
feat: improve sdk api for pinentry module
Diffstat (limited to 'src/core/module/Event.h')
-rw-r--r--src/core/module/Event.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/core/module/Event.h b/src/core/module/Event.h
index cb41c125..64c35592 100644
--- a/src/core/module/Event.h
+++ b/src/core/module/Event.h
@@ -50,16 +50,16 @@ class GPGFRONTEND_CORE_EXPORT Event {
using ParameterValue = std::any;
using EventIdentifier = QString;
using ListenerIdentifier = QString;
+ using Params = QMap<QString, QString>;
+
using EventCallback =
- std::function<void(EventIdentifier, ListenerIdentifier, DataObjectPtr)>;
+ std::function<void(EventIdentifier, ListenerIdentifier, Params)>;
struct ParameterInitializer {
QString key;
QString value;
};
- explicit Event(const QString&,
- std::initializer_list<ParameterInitializer> = {},
- EventCallback = nullptr);
+ explicit Event(const QString&, Params = {}, EventCallback = nullptr);
~Event();
@@ -81,7 +81,7 @@ class GPGFRONTEND_CORE_EXPORT Event {
void AddParameter(const QString& key, const QString& value);
- void ExecuteCallback(ListenerIdentifier, DataObjectPtr);
+ void ExecuteCallback(ListenerIdentifier, const Params&);
auto ToModuleEvent() -> GFModuleEvent*;
@@ -91,10 +91,8 @@ class GPGFRONTEND_CORE_EXPORT Event {
};
template <typename... Args>
-auto MakeEvent(const EventIdentifier& event_id, Args&&... args,
+auto MakeEvent(const EventIdentifier& event_id, const Event::Params& params,
Event::EventCallback e_cb) -> EventReference {
- std::initializer_list<Event::ParameterInitializer> params = {
- Event::ParameterInitializer{std::forward<Args>(args)}...};
return GpgFrontend::SecureCreateSharedObject<Event>(event_id, params, e_cb);
}