summaryrefslogtreecommitdiffhomepage
path: root/opentrack/plugin-api.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2015-07-17 09:44:50 +0200
committerStanislaw Halik <sthalik@misaki.pl>2015-07-18 01:53:43 +0200
commitbe0ae02edeaf8c4320c217844b2c7fd507447335 (patch)
treefa634ad70976227fc436dd7dae08b41866f515d8 /opentrack/plugin-api.hpp
parent6e6a432a701e9a57fe0b03ca835a61f4206f2d5e (diff)
bundles are now reloaded when settings window is closed
This happens even if closed by alt+f4 or cancel button.
Diffstat (limited to 'opentrack/plugin-api.hpp')
-rw-r--r--opentrack/plugin-api.hpp21
1 files changed, 14 insertions, 7 deletions
diff --git a/opentrack/plugin-api.hpp b/opentrack/plugin-api.hpp
index 714e69d9..021f5017 100644
--- a/opentrack/plugin-api.hpp
+++ b/opentrack/plugin-api.hpp
@@ -2,6 +2,7 @@
#include "export.hpp"
#include <QString>
+#include <QWidget>
#include <QFrame>
#include <QIcon>
@@ -9,6 +10,15 @@ enum Axis {
TX = 0, TY, TZ, Yaw, Pitch, Roll
};
+class BaseDialog : public QWidget
+{
+ Q_OBJECT
+public:
+ void closeEvent(QCloseEvent *) override { emit closing(); }
+signals:
+ void closing();
+};
+
#define OPENTRACK_DECLARE_PLUGIN_INTERNAL(ctor_class, ctor_ret_class, metadata_class, dialog_class, dialog_ret_class) \
extern "C" OPENTRACK_EXPORT ctor_ret_class* GetConstructor() \
{ \
@@ -24,9 +34,9 @@ enum Axis {
}
// implement this in all plugins
+// also you must link against "opentrack-api" in CMakeList.txt to avoid vtable link errors
struct Metadata
{
-public:
// plugin name to be displayed in the interface
virtual QString name() = 0;
// plugin icon, you can return an empty QIcon()
@@ -38,7 +48,6 @@ public:
// implement this in filters
struct IFilter
{
-public:
// optional destructor
virtual ~IFilter() {}
// perform filtering step.
@@ -46,7 +55,7 @@ public:
virtual void filter(const double *input, double *output) = 0;
};
-struct IFilterDialog : public QWidget
+struct IFilterDialog : public BaseDialog
{
// optional destructor
virtual ~IFilterDialog() {}
@@ -63,7 +72,6 @@ struct IFilterDialog : public QWidget
// implement this in protocols
struct IProtocol
{
-public:
// optional destructor
virtual ~IProtocol() {}
// return true if protocol was properly initialized
@@ -75,7 +83,7 @@ public:
virtual QString game_name() = 0;
};
-struct IProtocolDialog : public QWidget
+struct IProtocolDialog : public BaseDialog
{
// optional destructor
virtual ~IProtocolDialog() {}
@@ -92,7 +100,6 @@ struct IProtocolDialog : public QWidget
// implement this in trackers
struct ITracker
{
-public:
// optional destructor
virtual ~ITracker() {}
// start tracking, and grab a frame to display webcam video in, optionally
@@ -101,7 +108,7 @@ public:
virtual void data(double *data) = 0;
};
-struct ITrackerDialog : public QWidget
+struct ITrackerDialog : public BaseDialog
{
// optional destructor
virtual ~ITrackerDialog() {}