diff options
author | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-13 19:39:15 +0200 |
---|---|---|
committer | Stanislaw Halik <sthalik@misaki.pl> | 2018-07-24 00:43:03 +0200 |
commit | 1cac120c0b6b460899add3546d013b628d6b54bc (patch) | |
tree | 45362a76b8b47e310b13a679004b1f9936ff3a87 /main-window/module-mixin.hpp | |
parent | 3faf71a4b51c3f972593d1df8f649a4a100226ac (diff) |
WIP
Diffstat (limited to 'main-window/module-mixin.hpp')
-rw-r--r-- | main-window/module-mixin.hpp | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/main-window/module-mixin.hpp b/main-window/module-mixin.hpp new file mode 100644 index 00000000..307d79b8 --- /dev/null +++ b/main-window/module-mixin.hpp @@ -0,0 +1,58 @@ +#pragma once + +#include "mixins.hpp" +#include "compat/library-path.hpp" +#include "api/plugin-api.hpp" +#include "logic/extensions.hpp" +#include "logic/work.hpp" + +#include <memory> +#include <utility> + +#include <QObject> +#include <QString> + +namespace OTR_MIXIN_NS(module_mixin) { + +using namespace options; + +using dylib_ptr = Modules::dylib_ptr; +using dylib_list = Modules::dylib_list; + +struct OTR_MAIN_EXPORT module_settings final +{ + bundle b { make_bundle("modules") }; + value<QString> tracker_dll { b, "tracker-dll", "pt" }, + filter_dll { b, "filter-dll", "accela" }, + protocol_dll { b, "protocol-dll", "freetrack" }; + module_settings(); +}; + +struct OTR_MAIN_EXPORT module_mixin +{ + module_mixin(); + virtual ~module_mixin(); + + std::unique_ptr<ITrackerDialog> tracker_dialog; + std::unique_ptr<IProtocolDialog> proto_dialog; + std::unique_ptr<IFilterDialog> filter_dialog; + + std::tuple<dylib_ptr, int> module_by_name(const QString& name, const dylib_list& list) const; + + dylib_ptr current_tracker(); + dylib_ptr current_protocol(); + dylib_ptr current_filter(); + + void show_tracker_settings(); + void show_proto_settings(); + void show_filter_settings(); + +private: + Modules modules { OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH }; + event_handler ev { modules.extensions() }; + module_settings s; +}; + +} + +OTR_DECLARE_MIXIN(module_mixin) |