|
@@ -22,198 +22,160 @@
|
|
#ifndef CTKPLUGINFRAMEWORKEVENT_H
|
|
#ifndef CTKPLUGINFRAMEWORKEVENT_H
|
|
#define CTKPLUGINFRAMEWORKEVENT_H
|
|
#define CTKPLUGINFRAMEWORKEVENT_H
|
|
|
|
|
|
-#include <QObject>
|
|
|
|
#include <QSharedDataPointer>
|
|
#include <QSharedDataPointer>
|
|
|
|
|
|
#include "CTKPluginFrameworkExport.h"
|
|
#include "CTKPluginFrameworkExport.h"
|
|
|
|
|
|
|
|
+#include <stdexcept>
|
|
|
|
|
|
- class ctkPlugin;
|
|
|
|
- class ctkPluginFrameworkEventData;
|
|
|
|
|
|
+class ctkPlugin;
|
|
|
|
+class ctkPluginFrameworkEventData;
|
|
|
|
|
|
- /**
|
|
|
|
- * A general event from the Framework.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * <code>ctkPluginFrameworkEvent</code> objects are delivered to slots connected
|
|
|
|
- * <code>FrameworkListener</code>s when a general event occurs within the plugin
|
|
|
|
- * environment. A type code is used to identify the event type for future
|
|
|
|
- * extendability.
|
|
|
|
- *
|
|
|
|
- * @see ctkPluginContext#connectFrameworkListener
|
|
|
|
- * @see ctkEventBus
|
|
|
|
- */
|
|
|
|
- class CTK_PLUGINFW_EXPORT ctkPluginFrameworkEvent : public QObject
|
|
|
|
- {
|
|
|
|
- Q_OBJECT
|
|
|
|
- Q_PROPERTY(Type type READ getType CONSTANT)
|
|
|
|
- Q_PROPERTY(ctkPlugin* plugin READ getPlugin CONSTANT)
|
|
|
|
- Q_PROPERTY(QString errorString READ getErrorString CONSTANT)
|
|
|
|
- Q_ENUMS(Type)
|
|
|
|
-
|
|
|
|
- QSharedDataPointer<ctkPluginFrameworkEventData> d;
|
|
|
|
-
|
|
|
|
- public:
|
|
|
|
-
|
|
|
|
- enum Type {
|
|
|
|
- /**
|
|
|
|
- * The Framework has started.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * This event is fired when the Framework has started after all installed
|
|
|
|
- * plugins that are marked to be started have been started and the Framework
|
|
|
|
- * has reached the initial start level. The source of this event is the
|
|
|
|
- * System Plugin.
|
|
|
|
- */
|
|
|
|
- STARTED,
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * An error has occurred.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * There was an error associated with a plugin.
|
|
|
|
- */
|
|
|
|
- ERROR,
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * A warning has occurred.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * There was a warning associated with a plugin.
|
|
|
|
- */
|
|
|
|
- WARNING,
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * An informational event has occurred.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * There was an informational event associated with a plugin.
|
|
|
|
- */
|
|
|
|
- INFO,
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * The Framework has stopped.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * This event is fired when the Framework has been stopped because of a stop
|
|
|
|
- * operation on the system plugin. The source of this event is the System
|
|
|
|
- * Plugin.
|
|
|
|
- */
|
|
|
|
- STOPPED,
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * The Framework has stopped during update.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * This event is fired when the Framework has been stopped because of an
|
|
|
|
- * update operation on the system plugin. The Framework will be restarted
|
|
|
|
- * after this event is fired. The source of this event is the System Plugin.
|
|
|
|
- */
|
|
|
|
- STOPPED_UPDATE,
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * The Framework did not stop before the wait timeout expired.
|
|
|
|
- *
|
|
|
|
- * <p>
|
|
|
|
- * This event is fired when the Framework did not stop before the wait
|
|
|
|
- * timeout expired. The source of this event is the System Plugin.
|
|
|
|
- */
|
|
|
|
- WAIT_TIMEDOUT
|
|
|
|
-
|
|
|
|
- };
|
|
|
|
|
|
+/**
|
|
|
|
+ * A general event from the Framework.
|
|
|
|
+ *
|
|
|
|
+ * <p>
|
|
|
|
+ * <code>ctkPluginFrameworkEvent</code> objects are delivered to slots connected
|
|
|
|
+ * via ctkPluginContext::connectFrameworkListener when a general event occurs
|
|
|
|
+ * within the plugin environment.
|
|
|
|
+ * A type code is used to identify the event type for future extendability.
|
|
|
|
+ *
|
|
|
|
+ * @see ctkPluginContext#connectFrameworkListener
|
|
|
|
+ * @see ctkEventBus
|
|
|
|
+ */
|
|
|
|
+class CTK_PLUGINFW_EXPORT ctkPluginFrameworkEvent
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ QSharedDataPointer<ctkPluginFrameworkEventData> d;
|
|
|
|
|
|
|
|
+public:
|
|
|
|
+
|
|
|
|
+ enum Type {
|
|
/**
|
|
/**
|
|
- * Default constructor for use with the Qt meta object system.
|
|
|
|
|
|
+ * The Framework has started.
|
|
|
|
+ *
|
|
|
|
+ * <p>
|
|
|
|
+ * This event is fired when the Framework has started after all installed
|
|
|
|
+ * plugins that are marked to be started have been started and the Framework
|
|
|
|
+ * has reached the initial start level. The source of this event is the
|
|
|
|
+ * System Plugin.
|
|
*/
|
|
*/
|
|
- ctkPluginFrameworkEvent();
|
|
|
|
|
|
+ STARTED,
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Creates a Framework event regarding the specified plugin and exception.
|
|
|
|
|
|
+ * An error has occurred.
|
|
*
|
|
*
|
|
- * @param type The event type.
|
|
|
|
- * @param plugin The event source.
|
|
|
|
- * @param fwException The related exception.
|
|
|
|
|
|
+ * <p>
|
|
|
|
+ * There was an error associated with a plugin.
|
|
*/
|
|
*/
|
|
- ctkPluginFrameworkEvent(Type type, ctkPlugin* plugin, const std::exception& fwException);
|
|
|
|
|
|
+ ERROR,
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Creates a Framework event regarding the specified plugin.
|
|
|
|
|
|
+ * A warning has occurred.
|
|
*
|
|
*
|
|
- * @param type The event type.
|
|
|
|
- * @param plugin The event source.
|
|
|
|
|
|
+ * <p>
|
|
|
|
+ * There was a warning associated with a plugin.
|
|
*/
|
|
*/
|
|
- ctkPluginFrameworkEvent(Type type, ctkPlugin* plugin);
|
|
|
|
-
|
|
|
|
- ctkPluginFrameworkEvent(const ctkPluginFrameworkEvent& other);
|
|
|
|
|
|
+ WARNING,
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Returns the exception error string related to this event.
|
|
|
|
|
|
+ * An informational event has occurred.
|
|
*
|
|
*
|
|
- * @return The related error string.
|
|
|
|
|
|
+ * <p>
|
|
|
|
+ * There was an informational event associated with a plugin.
|
|
*/
|
|
*/
|
|
- QString getErrorString() const;
|
|
|
|
|
|
+ INFO,
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Returns the plugin associated with the event. This plugin is also the
|
|
|
|
- * source of the event.
|
|
|
|
|
|
+ * The Framework has stopped.
|
|
*
|
|
*
|
|
- * @return The plugin associated with the event.
|
|
|
|
|
|
+ * <p>
|
|
|
|
+ * This event is fired when the Framework has been stopped because of a stop
|
|
|
|
+ * operation on the system plugin. The source of this event is the System
|
|
|
|
+ * Plugin.
|
|
*/
|
|
*/
|
|
- ctkPlugin* getPlugin() const;
|
|
|
|
|
|
+ STOPPED,
|
|
|
|
|
|
/**
|
|
/**
|
|
- * Returns the type of framework event.
|
|
|
|
- * <p>
|
|
|
|
- * The type values are:
|
|
|
|
- * <ul>
|
|
|
|
- * <li>{@link #STARTED}
|
|
|
|
- * <li>{@link #ERROR}
|
|
|
|
- * <li>{@link #WARNING}
|
|
|
|
- * <li>{@link #INFO}
|
|
|
|
- * <li>{@link #STARTLEVEL_CHANGED}
|
|
|
|
- * <li>{@link #STOPPED}
|
|
|
|
- * <li>{@link #STOPPED_UPDATE}
|
|
|
|
- * <li>{@link #WAIT_TIMEDOUT}
|
|
|
|
- * </ul>
|
|
|
|
|
|
+ * The Framework has stopped during update.
|
|
*
|
|
*
|
|
- * @return The type of state change.
|
|
|
|
|
|
+ * <p>
|
|
|
|
+ * This event is fired when the Framework has been stopped because of an
|
|
|
|
+ * update operation on the system plugin. The Framework will be restarted
|
|
|
|
+ * after this event is fired. The source of this event is the System Plugin.
|
|
*/
|
|
*/
|
|
- Type getType() const;
|
|
|
|
- };
|
|
|
|
|
|
+ STOPPED_UPDATE,
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * The Framework did not stop before the wait timeout expired.
|
|
|
|
+ *
|
|
|
|
+ * <p>
|
|
|
|
+ * This event is fired when the Framework did not stop before the wait
|
|
|
|
+ * timeout expired. The source of this event is the System Plugin.
|
|
|
|
+ */
|
|
|
|
+ WAIT_TIMEDOUT
|
|
|
|
|
|
- class ctkPluginFrameworkEventData : public QSharedData
|
|
|
|
- {
|
|
|
|
- public:
|
|
|
|
|
|
+ };
|
|
|
|
|
|
- ctkPluginFrameworkEventData(ctkPluginFrameworkEvent::Type type, ctkPlugin* plugin, const QString& exc)
|
|
|
|
- : plugin(plugin), errorString(exc), type(type)
|
|
|
|
- {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Default constructor for use with the Qt meta object system.
|
|
|
|
+ */
|
|
|
|
+ ctkPluginFrameworkEvent();
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ ~ctkPluginFrameworkEvent();
|
|
|
|
|
|
- ctkPluginFrameworkEventData(const ctkPluginFrameworkEventData& other)
|
|
|
|
- : QSharedData(other), plugin(other.plugin), errorString(other.errorString),
|
|
|
|
- type(other.type)
|
|
|
|
- {
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Creates a Framework event regarding the specified plugin and exception.
|
|
|
|
+ *
|
|
|
|
+ * @param type The event type.
|
|
|
|
+ * @param plugin The event source.
|
|
|
|
+ * @param fwException The related exception.
|
|
|
|
+ */
|
|
|
|
+ ctkPluginFrameworkEvent(Type type, ctkPlugin* plugin, const std::exception& fwException);
|
|
|
|
|
|
- }
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Creates a Framework event regarding the specified plugin.
|
|
|
|
+ *
|
|
|
|
+ * @param type The event type.
|
|
|
|
+ * @param plugin The event source.
|
|
|
|
+ */
|
|
|
|
+ ctkPluginFrameworkEvent(Type type, ctkPlugin* plugin);
|
|
|
|
|
|
- /**
|
|
|
|
- * Plugin related to the event.
|
|
|
|
- */
|
|
|
|
- ctkPlugin* const plugin;
|
|
|
|
|
|
+ ctkPluginFrameworkEvent(const ctkPluginFrameworkEvent& other);
|
|
|
|
|
|
- /**
|
|
|
|
- * Exception related to the event.
|
|
|
|
- */
|
|
|
|
- const QString errorString;
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Returns the exception error string related to this event.
|
|
|
|
+ *
|
|
|
|
+ * @return The related error string.
|
|
|
|
+ */
|
|
|
|
+ QString getErrorString() const;
|
|
|
|
|
|
- /**
|
|
|
|
- * Type of event.
|
|
|
|
- */
|
|
|
|
- const ctkPluginFrameworkEvent::Type type;
|
|
|
|
- };
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Returns the plugin associated with the event. This plugin is also the
|
|
|
|
+ * source of the event.
|
|
|
|
+ *
|
|
|
|
+ * @return The plugin associated with the event.
|
|
|
|
+ */
|
|
|
|
+ ctkPlugin* getPlugin() const;
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Returns the type of framework event.
|
|
|
|
+ * <p>
|
|
|
|
+ * The type values are:
|
|
|
|
+ * <ul>
|
|
|
|
+ * <li>{@link #STARTED}
|
|
|
|
+ * <li>{@link #ERROR}
|
|
|
|
+ * <li>{@link #WARNING}
|
|
|
|
+ * <li>{@link #INFO}
|
|
|
|
+ * <li>{@link #STARTLEVEL_CHANGED}
|
|
|
|
+ * <li>{@link #STOPPED}
|
|
|
|
+ * <li>{@link #STOPPED_UPDATE}
|
|
|
|
+ * <li>{@link #WAIT_TIMEDOUT}
|
|
|
|
+ * </ul>
|
|
|
|
+ *
|
|
|
|
+ * @return The type of state change.
|
|
|
|
+ */
|
|
|
|
+ Type getType() const;
|
|
|
|
+};
|
|
|
|
|
|
#endif // CTKPLUGINFRAMEWORKEVENT_H
|
|
#endif // CTKPLUGINFRAMEWORKEVENT_H
|