From dfb4b71fd2f8e67cf2b16e4c0a8cdb692e7d3f6a Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Tue, 14 Dec 2021 21:32:20 +0100 Subject: api, gui: add types for embeddable module dialogs --- api/plugin-api.cpp | 3 +++ api/plugin-api.hpp | 7 +++++++ gui/mapping-dialog.hpp | 1 + 3 files changed, 11 insertions(+) diff --git a/api/plugin-api.cpp b/api/plugin-api.cpp index 79f9b464..b6de3b16 100644 --- a/api/plugin-api.cpp +++ b/api/plugin-api.cpp @@ -23,6 +23,8 @@ void BaseDialog::done(int) } } +bool BaseDialog::embeddable() noexcept { return false; } + } // ns plugin_api::detail // these exist so that vtable is emitted in a single compilation unit, not all of them. @@ -47,6 +49,7 @@ ITrackerDialog::ITrackerDialog() = default; ITrackerDialog::~ITrackerDialog() = default; void ITrackerDialog::register_tracker(ITracker*) {} void ITrackerDialog::unregister_tracker() {} +void ITrackerDialog::set_buttons_visible(bool) {} IExtension::~IExtension() = default; IExtensionDialog::~IExtensionDialog() = default; diff --git a/api/plugin-api.hpp b/api/plugin-api.hpp index c7d5715d..ab43884a 100644 --- a/api/plugin-api.hpp +++ b/api/plugin-api.hpp @@ -42,6 +42,7 @@ protected: BaseDialog(); public: void closeEvent(QCloseEvent *) override; + virtual bool embeddable() noexcept; signals: void closing(); private slots: @@ -215,11 +216,17 @@ struct OTR_API_EXPORT ITrackerDialog : public plugin_api::detail::BaseDialog virtual void register_tracker(ITracker *tracker); // received tracker pointer is about to get deleted virtual void unregister_tracker(); + virtual void set_buttons_visible(bool x); // XXX TODO remove it once all modules are converted + virtual void save(); // XXX HACK should be pure virtual + virtual void reload(); // XXX HACK should be pure virtual -sh 20211214 ITrackerDialog(); ~ITrackerDialog() override; }; +inline void ITrackerDialog::save() {} +inline void ITrackerDialog::reload() {} + // call once with your chosen class names in the plugin #define OPENTRACK_DECLARE_TRACKER(tracker_class, dialog_class, metadata_class) \ OPENTRACK_DECLARE_PLUGIN_INTERNAL(tracker_class, ITracker, metadata_class, dialog_class, ITrackerDialog) diff --git a/gui/mapping-dialog.hpp b/gui/mapping-dialog.hpp index 09170c62..3758e7c7 100644 --- a/gui/mapping-dialog.hpp +++ b/gui/mapping-dialog.hpp @@ -16,6 +16,7 @@ class OTR_GUI_EXPORT mapping_dialog final : public QDialog public: mapping_dialog(Mappings& m); void refresh_tab(); + inline bool embeddable() noexcept { return false; } private: Ui::mapping_dialog ui; Mappings& m; -- cgit v1.2.3