diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-04-03 12:26:38 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-04-05 03:23:13 +0200 |
commit | eb32a2ac02c6d1adcfeb0a1a5522f8aaea442489 (patch) | |
tree | b15b4ab34600e9c5d5da17eac33ea687167bbfc7 /api/plugin-api.hpp | |
parent | 22a853b388597e9549125df69508c1c38706dd1d (diff) |
i18n: provide for non-QObject classes
See compat/tr.hpp for comment.
Diffstat (limited to 'api/plugin-api.hpp')
-rw-r--r-- | api/plugin-api.hpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/api/plugin-api.hpp b/api/plugin-api.hpp index 4a797f73..75555e93 100644 --- a/api/plugin-api.hpp +++ b/api/plugin-api.hpp @@ -16,6 +16,7 @@ #include <QDialog> #include "compat/simple-mat.hpp" +#include "compat/tr.hpp" #include "export.hpp" using Pose = Mat<double, 6, 1>; @@ -49,14 +50,14 @@ private slots: #define OPENTRACK_DECLARE_PLUGIN_INTERNAL(ctor_class, ctor_ret_class, metadata_class, dialog_class, dialog_ret_class) \ extern "C" OTR_PLUGIN_EXPORT ctor_ret_class* GetConstructor(); \ - extern "C" OTR_PLUGIN_EXPORT Metadata* GetMetadata(); \ + extern "C" OTR_PLUGIN_EXPORT Metadata_* GetMetadata(); \ extern "C" OTR_PLUGIN_EXPORT dialog_ret_class* GetDialog(); \ \ extern "C" OTR_PLUGIN_EXPORT ctor_ret_class* GetConstructor() \ { \ return new ctor_class; \ } \ - extern "C" OTR_PLUGIN_EXPORT Metadata* GetMetadata() \ + extern "C" OTR_PLUGIN_EXPORT Metadata_* GetMetadata() \ { \ return new metadata_class; \ } \ @@ -67,19 +68,26 @@ private slots: // implement this in all plugins // also you must link against "opentrack-api" in CMakeLists.txt to avoid vtable link errors -struct OTR_API_EXPORT Metadata +class OTR_API_EXPORT Metadata_ { - Metadata(const Metadata&) = delete; - Metadata(Metadata&&) = delete; - Metadata& operator=(const Metadata&) = delete; - Metadata(); +public: + Metadata_(); // plugin name to be displayed in the interface virtual QString name() = 0; // plugin icon, you can return an empty QIcon() virtual QIcon icon() = 0; // optional destructor - virtual ~Metadata(); + virtual ~Metadata_(); +}; + +class OTR_API_EXPORT Metadata : public TR, public Metadata_ +{ + Q_OBJECT + +public: + Metadata() {} + ~Metadata() {} }; struct OTR_API_EXPORT module_status final |