/* * SPDX-FileCopyrightText: 2011-2016 Ivan Cukic * * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL */ #pragma once #include "kactivitymanagerd_plugin_export.h" // Qt #include #include // KDE #include #include // Utils #include // Local #include "Event.h" #include "Module.h" /** * */ class KACTIVITYMANAGERD_PLUGIN_EXPORT Plugin : public Module { Q_OBJECT public: explicit Plugin(QObject *parent); ~Plugin() override; /** * Initializes the plugin. * @arg modules Activities, Resources and Features manager objects * @returns the plugin needs to return whether it has * successfully been initialized */ virtual bool init(QHash &modules) = 0; /** * Returns the config group for the plugin. * In order to use it, you need to set the plugin name. */ KConfigGroup config() const; QString name() const; /** * Convenience meta-method to provide prettier invocation of QMetaObject::invokeMethod */ // template // inline static ReturnType retrieve(QObject *object, const char *method, // const char *returnTypeName) // { // ReturnType result; // // QMetaObject::invokeMethod( // object, method, Qt::DirectConnection, // QReturnArgument(returnTypeName, result)); // // return result; // } template inline static ReturnType retrieve(QObject *object, const char *method, Args... args) { ReturnType result; QMetaObject::invokeMethod(object, method, Qt::DirectConnection, Q_RETURN_ARG(ReturnType, result), args...); return result; } /** * Convenience meta-method to provide prettier invocation of QMetaObject::invokeMethod */ // template // inline static void invoke(QObject *object, const char *method, // const char *returnTypeName) // { // Q_UNUSED(returnTypeName); // QMetaObject::invokeMethod(object, method, connection); // } template inline static void invoke(QObject *object, const char *method, Args... args) { QMetaObject::invokeMethod(object, method, connection, args...); } protected: void setName(const QString &name); private: D_PTR; };