LeechCraft 0.6.70-17609-g3dde4097dd
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
notificationactionhandler.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <functional>
12#include <QObject>
13#include <QPointer>
15#include "xpcconfig.h"
16
17namespace LC::Util
18{
51 class NotificationActionHandler : public QObject
52 {
53 Q_OBJECT
54
55 Entity& Entity_;
56 public:
59 using Callback_t = std::function<void ()>;
60 private:
61 QList<QPair<QString, Callback_t>> ActionName2Callback_;
62
63 QList<QPointer<QObject>> DependentObjects_;
64 public:
71 UTIL_XPC_API explicit NotificationActionHandler (Entity& entity, QObject* = nullptr);
72
83 UTIL_XPC_API void AddFunction (const QString& name, Callback_t action);
84
89 UTIL_XPC_API void AddDependentObject (QObject *object);
90 public slots:
92 };
93}
UTIL_XPC_API NotificationActionHandler(Entity &entity, QObject *=nullptr)
Creates the handler on the given entity.
UTIL_XPC_API void AddDependentObject(QObject *object)
Adds an object as a dependent object.
UTIL_XPC_API void AddFunction(const QString &name, Callback_t action)
Adds an action with the given name.
std::function< void()> Callback_t
Type of functions used as actions in the handler.
A message used for inter-plugin communication.
Definition structures.h:96
#define UTIL_XPC_API
Definition xpcconfig.h:16