diff options
Diffstat (limited to 'main-window')
-rw-r--r-- | main-window/mixin-traits.cpp | 19 | ||||
-rw-r--r-- | main-window/mixin-traits.hpp | 13 | ||||
-rw-r--r-- | main-window/module-mixin.cpp | 35 | ||||
-rw-r--r-- | main-window/module-mixin.hpp | 22 | ||||
-rw-r--r-- | main-window/tracking-mixin.cpp | 5 | ||||
-rw-r--r-- | main-window/tracking-mixin.hpp | 19 |
6 files changed, 36 insertions, 77 deletions
diff --git a/main-window/mixin-traits.cpp b/main-window/mixin-traits.cpp index 5dc2efd8..b74a6f7a 100644 --- a/main-window/mixin-traits.cpp +++ b/main-window/mixin-traits.cpp @@ -43,16 +43,17 @@ void test1() struct W : C, A {}; struct Q : virtual W, virtual D {}; -#if 0 - (void)impl<Q, W>(); // W not a mixin - (void)impl<V, A>(); // A - (void)impl<V, D>(); // D => C => A - (void)impl<V, D>(); // D => C => A - (void)impl<W, C, B>(); // B +//#define SHOULD_NOT_COMPILE +#ifdef SHOULD_NOT_COMPILE + (void)impl<Q, W>{}; // W not a mixin + (void)impl<V, A>{}; // A + (void)impl<V, D>{}; // D => C => A + (void)impl<V, D>{}; // D => C => A + (void)impl<W, C, B>{}; // B #else - (void)impl<U, B>(); - (void)impl<W, C>(); - (void)impl<Q, D, A>(); + (void)impl<U, B>{}; + (void)impl<W, C>{}; + (void)impl<Q, D, A>{}; #endif } diff --git a/main-window/mixin-traits.hpp b/main-window/mixin-traits.hpp index 6a0206fc..45df7fdb 100644 --- a/main-window/mixin-traits.hpp +++ b/main-window/mixin-traits.hpp @@ -13,11 +13,7 @@ namespace mixins::traits_detail { template<typename t> struct mixin_traits { // implement this! - using depends = tuple<>; - - // unconditional but at instantiation time - static_assert(sizeof(t) < sizeof(char), - "must specialize mixin_traits"); + //using depends = tuple<>; }; template<typename klass, typename...> struct check_depends_; @@ -31,7 +27,7 @@ namespace mixins::traits_detail { struct check_depends_<klass, x, xs...> : std::bool_constant< std::is_base_of_v<x, klass> && - lift<check_depends_, cons<klass, typename mixin_traits<x>::depends>>::value && + lift_v<check_depends_, cons<klass, typename mixin_traits<x>::depends>> && check_depends_<klass, xs...>::value > { @@ -40,8 +36,7 @@ namespace mixins::traits_detail { template<typename klass, typename... xs> struct impl { - static constexpr bool class_must_inherit_dependent_mixins = - lift<check_depends_, tuple<klass, xs...>>::value; - static_assert(class_must_inherit_dependent_mixins); + static_assert(lift<check_depends_, tuple<klass, xs...>>::value, + "class must inherit dependent mixins"); }; } // ns mixins::traits_detail diff --git a/main-window/module-mixin.cpp b/main-window/module-mixin.cpp index 8d36cb0d..18b2867d 100644 --- a/main-window/module-mixin.cpp +++ b/main-window/module-mixin.cpp @@ -62,7 +62,7 @@ static bool mk_dialog(std::unique_ptr<t>& place, const std::shared_ptr<dylib>& l if (lib && lib->Dialog) return u{ (t*)lib->Dialog() }; else - return nullptr; + return u{}; }); } @@ -84,39 +84,34 @@ dylib_ptr module_mixin::current_filter() return ptr; } -void module_mixin::show_tracker_settings() +void module_mixin::show_tracker_settings_() { -#if 0 - if (mk_dialog(tracker_dialog, current_tracker()) && work && work->libs.pTracker) - tracker_dialog->register_tracker(work->libs.pTracker.get()); + if (mk_dialog(tracker_dialog, current_tracker()) && state.work && state.work->libs.pTracker) + tracker_dialog->register_tracker(state.work->libs.pTracker.get()); if (tracker_dialog) QObject::connect(tracker_dialog.get(), &ITrackerDialog::closing, - this, [this] { tracker_dialog = nullptr; }); -#endif + &fuzz, [this] { tracker_dialog = nullptr; }); } -void module_mixin::show_proto_settings() +void module_mixin::show_proto_settings_() { -#if 0 - if (mk_dialog(proto_dialog, current_protocol()) && work && work->libs.pProtocol) - proto_dialog->register_protocol(work->libs.pProtocol.get()); + if (mk_dialog(proto_dialog, current_protocol()) && state.work && state.work->libs.pProtocol) + proto_dialog->register_protocol(state.work->libs.pProtocol.get()); if (proto_dialog) QObject::connect(proto_dialog.get(), &IProtocolDialog::closing, - this, [this] { proto_dialog = nullptr; }); -#endif + &fuzz, [this] { proto_dialog = nullptr; }); } -void module_mixin::show_filter_settings() +void module_mixin::show_filter_settings_() { -#if 0 - if (mk_dialog(filter_dialog, current_filter()) && work && work->libs.pFilter) - filter_dialog->register_filter(work->libs.pFilter.get()); + if (mk_dialog(filter_dialog, current_filter()) && state.work && state.work->libs.pFilter) + filter_dialog->register_filter(state.work->libs.pFilter.get()); if (filter_dialog) QObject::connect(filter_dialog.get(), &IFilterDialog::closing, - this, [this] { filter_dialog = nullptr; }); -#endif + &fuzz, [this] { filter_dialog = nullptr; }); } +// this template function must go to a separate function like "options_mixin". template<typename t, typename... Args> static bool mk_window(std::unique_ptr<t>& place, Args&&... params) { @@ -128,6 +123,4 @@ static bool mk_window(std::unique_ptr<t>& place, Args&&... params) module_mixin::module_mixin() = default; module_mixin::~module_mixin() = default; -module_settings::module_settings() = default; - } // ns diff --git a/main-window/module-mixin.hpp b/main-window/module-mixin.hpp index 307d79b8..cde0484c 100644 --- a/main-window/module-mixin.hpp +++ b/main-window/module-mixin.hpp @@ -4,13 +4,13 @@ #include "compat/library-path.hpp" #include "api/plugin-api.hpp" #include "logic/extensions.hpp" -#include "logic/work.hpp" +#include "logic/state.hpp" +#include "logic/main-settings.hpp" #include <memory> #include <utility> #include <QObject> -#include <QString> namespace OTR_MIXIN_NS(module_mixin) { @@ -19,15 +19,6 @@ 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(); @@ -43,14 +34,17 @@ struct OTR_MAIN_EXPORT module_mixin dylib_ptr current_protocol(); dylib_ptr current_filter(); - void show_tracker_settings(); - void show_proto_settings(); - void show_filter_settings(); + 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; + State state { OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH }; + + QObject fuzz; }; } diff --git a/main-window/tracking-mixin.cpp b/main-window/tracking-mixin.cpp deleted file mode 100644 index 1ec6f3d5..00000000 --- a/main-window/tracking-mixin.cpp +++ /dev/null @@ -1,5 +0,0 @@ -#include "tracking-mixin.hpp" - -using namespace OTR_MIXIN_NS(tracking_mixin); - -has_work::has_work::~has_work() = default; diff --git a/main-window/tracking-mixin.hpp b/main-window/tracking-mixin.hpp deleted file mode 100644 index e48ca630..00000000 --- a/main-window/tracking-mixin.hpp +++ /dev/null @@ -1,19 +0,0 @@ -#pragma once - -#include "mixins.hpp" - -#include "logic/work.hpp" - -#include <memory> - -namespace OTR_MIXIN_NS(tracking_mixin) { - -using work_ptr = std::shared_ptr<Work>; - -struct OTR_MAIN_EXPORT has_work { - virtual explicit operator work_ptr() = 0; - inline has_work() = default; - virtual ~has_work(); -}; - -} |