| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
#ifndef ACTIONREGISTRY_H |
| 19 |
#define ACTIONREGISTRY_H |
| 20 |
|
| 21 |
#include <QLoggingCategory> |
| 22 |
#include <QObject> |
| 23 |
#include <QQmlIncubator> |
| 24 |
#include <QQmlListProperty> |
| 25 |
#include "PluginIncubator.h" |
| 26 |
|
| 27 |
|
| 28 |
Q_DECLARE_LOGGING_CATEGORY(PLUGIN_ACTION) |
| 29 |
|
| 30 |
class ActionRegistry : public QObject |
| 31 |
{ |
| 32 |
Q_OBJECT |
| 33 |
Q_PROPERTY(QQmlListProperty<QObject> defaultActions READ defaultActions) |
| 34 |
Q_PROPERTY(QList<QObject *> actions READ actions NOTIFY actionsChanged) |
| 35 |
Q_PROPERTY(QString location READ location WRITE setLocation NOTIFY locationChanged) |
| 36 |
|
| 37 |
public: |
| 38 |
explicit ActionRegistry(QObject *parent = 0); |
| 39 |
~ActionRegistry(); |
| 40 |
|
| 41 |
QQmlListProperty<QObject> defaultActions(); |
| 42 |
QList<QObject *> actions() const; |
| 43 |
QString location() const; |
| 44 |
|
| 45 |
signals: |
| 46 |
void actionsChanged(QList<QObject *> actions); |
| 47 |
void locationChanged(QString location); |
| 48 |
|
| 49 |
public slots: |
| 50 |
void setLocation(QString location); |
| 51 |
|
| 52 |
private slots: |
| 53 |
void loadActions(); |
| 54 |
void finishLoading(); |
| 55 |
void handleError(); |
| 56 |
|
| 57 |
private: |
| 58 |
QList<QObject *> m_actions; |
| 59 |
QList<QObject *> m_defaults; |
| 60 |
QString m_location; |
| 61 |
IncubatorList m_incubators; |
| 62 |
}; |
| 63 |
|
| 64 |
#endif |