| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
#ifndef PLUGININFO_H |
| 19 |
#define PLUGININFO_H |
| 20 |
|
| 21 |
#include <QLoggingCategory> |
| 22 |
#include <QObject> |
| 23 |
#include <QVariantMap> |
| 24 |
#include <QJsonObject> |
| 25 |
#include <QDebug> |
| 26 |
|
| 27 |
Q_DECLARE_LOGGING_CATEGORY(PLUGIN_INFO) |
| 28 |
|
| 29 |
class PluginInfo : public QObject |
| 30 |
{ |
| 31 |
Q_OBJECT |
| 32 |
Q_PROPERTY(QString pluginId READ pluginId CONSTANT) |
| 33 |
Q_PROPERTY(QString location READ location CONSTANT) |
| 34 |
Q_PROPERTY(QVariantMap documentation READ documentation CONSTANT) |
| 35 |
Q_PROPERTY(QVariantMap settings READ settings CONSTANT) |
| 36 |
|
| 37 |
public: |
| 38 |
explicit PluginInfo(QObject *parent = 0); |
| 39 |
|
| 40 |
virtual QString pluginId() const = 0; |
| 41 |
virtual QString location() const = 0; |
| 42 |
virtual QString i18n() const = 0; |
| 43 |
virtual QVariantMap documentation() const = 0; |
| 44 |
virtual QVariantMap settings() const { return QVariantMap();} |
| 45 |
|
| 46 |
}; |
| 47 |
|
| 48 |
class DekkoPlugin : public PluginInfo |
| 49 |
{ |
| 50 |
Q_OBJECT |
| 51 |
Q_PROPERTY(QString component READ component CONSTANT) |
| 52 |
public: |
| 53 |
explicit DekkoPlugin(QObject *parent = 0); |
| 54 |
|
| 55 |
static DekkoPlugin* fromSpec(const QString &specPath, QObject *parent = 0); |
| 56 |
|
| 57 |
QString pluginId() const; |
| 58 |
QString location() const; |
| 59 |
QString component(); |
| 60 |
QString i18n() const; |
| 61 |
QVariantMap documentation() const; |
| 62 |
QVariantMap settings() const; |
| 63 |
|
| 64 |
QString pluginPath() const; |
| 65 |
|
| 66 |
void setSpec(const QJsonObject &spec); |
| 67 |
void setPluginDirectory(const QString &path); |
| 68 |
|
| 69 |
private: |
| 70 |
QJsonObject m_spec; |
| 71 |
QString m_pluginPath; |
| 72 |
}; |
| 73 |
|
| 74 |
class ServicePlugin : public PluginInfo |
| 75 |
{ |
| 76 |
Q_OBJECT |
| 77 |
public: |
| 78 |
explicit ServicePlugin(QObject *parent = 0); |
| 79 |
|
| 80 |
|
| 81 |
public: |
| 82 |
virtual QString pluginId() const override { |
| 83 |
qWarning() << "Not implemented here"; |
| 84 |
return QString(); |
| 85 |
} |
| 86 |
virtual QString location() const override { |
| 87 |
qWarning() << "Not implemented here"; |
| 88 |
return QString(); |
| 89 |
} |
| 90 |
virtual QString i18n() const override { |
| 91 |
qWarning() << "Not implemented here"; |
| 92 |
return QString(); |
| 93 |
} |
| 94 |
virtual QVariantMap documentation() const override { |
| 95 |
qWarning() << "Not implemented here"; |
| 96 |
return QVariantMap(); |
| 97 |
} |
| 98 |
|
| 99 |
virtual void start() {} |
| 100 |
virtual void stop() {} |
| 101 |
|
| 102 |
virtual void messageReceived(const QString &key, const QVariant &value); |
| 103 |
}; |
| 104 |
|
| 105 |
#endif |