From 756d2925904ca87266fc30c3d84b9c3682c73fce Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Fri, 17 Dec 2021 17:51:32 +0100 Subject: opentrack: kill unfinished obsolete code --- main-window/CMakeLists.txt | 6 --- main-window/export.hpp | 11 ---- main-window/lang/nl_NL.ts | 4 -- main-window/lang/ru_RU.ts | 4 -- main-window/lang/stub.ts | 4 -- main-window/lang/zh_CN.ts | 4 -- main-window/mixin-traits.cpp | 62 --------------------- main-window/mixin-traits.hpp | 42 --------------- main-window/mixins.hpp | 13 ----- main-window/module-mixin.cpp | 126 ------------------------------------------- main-window/module-mixin.hpp | 52 ------------------ 11 files changed, 328 deletions(-) delete mode 100644 main-window/CMakeLists.txt delete mode 100644 main-window/export.hpp delete mode 100644 main-window/lang/nl_NL.ts delete mode 100644 main-window/lang/ru_RU.ts delete mode 100644 main-window/lang/stub.ts delete mode 100644 main-window/lang/zh_CN.ts delete mode 100644 main-window/mixin-traits.cpp delete mode 100644 main-window/mixin-traits.hpp delete mode 100644 main-window/mixins.hpp delete mode 100644 main-window/module-mixin.cpp delete mode 100644 main-window/module-mixin.hpp diff --git a/main-window/CMakeLists.txt b/main-window/CMakeLists.txt deleted file mode 100644 index c9228536..00000000 --- a/main-window/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -if(opentrack_maintainer-mode) - otr_module(main-window BIN NO-INSTALL) - foreach(k user-interface logic pose-widget migration spline) - target_link_libraries(${self} opentrack-${k}) - endforeach() -endif() diff --git a/main-window/export.hpp b/main-window/export.hpp deleted file mode 100644 index 184cf035..00000000 --- a/main-window/export.hpp +++ /dev/null @@ -1,11 +0,0 @@ -// generates export.hpp for each module from compat/linkage.hpp - -#pragma once - -#include "compat/linkage-macros.hpp" - -#ifdef BUILD_MAIN_WINDOW -# define OTR_MAIN_EXPORT OTR_GENERIC_EXPORT -#else -# define OTR_MAIN_EXPORT OTR_GENERIC_IMPORT -#endif diff --git a/main-window/lang/nl_NL.ts b/main-window/lang/nl_NL.ts deleted file mode 100644 index 6401616d..00000000 --- a/main-window/lang/nl_NL.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/main-window/lang/ru_RU.ts b/main-window/lang/ru_RU.ts deleted file mode 100644 index 6401616d..00000000 --- a/main-window/lang/ru_RU.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/main-window/lang/stub.ts b/main-window/lang/stub.ts deleted file mode 100644 index 6401616d..00000000 --- a/main-window/lang/stub.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/main-window/lang/zh_CN.ts b/main-window/lang/zh_CN.ts deleted file mode 100644 index 6401616d..00000000 --- a/main-window/lang/zh_CN.ts +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/main-window/mixin-traits.cpp b/main-window/mixin-traits.cpp deleted file mode 100644 index b74a6f7a..00000000 --- a/main-window/mixin-traits.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#define MIXIN_TRAIT_TESTS - -#ifdef MIXIN_TRAIT_TESTS -# include "mixin-traits.hpp" - -// the `impl' class provides a cast template through the CRTP pattern. -// mixins don't do direct inheritance on themselves, -// that's what mixin_traits::depends is for. - -namespace mixins::traits_detail { - -struct A {}; -struct B {}; -struct C {}; -struct D {}; - -template<> struct mixin_traits -{ - using depends = tuple<>; -}; - -template<> struct mixin_traits -{ - using depends = tuple; -}; - -template<> struct mixin_traits -{ - using depends = tuple; -}; - -template<> struct mixin_traits -{ - using depends = tuple; -}; - -extern void test1(); - -void test1() -{ - struct U : B, A {}; - struct V : D {}; - struct W : C, A {}; - struct Q : virtual W, virtual D {}; - -//#define SHOULD_NOT_COMPILE -#ifdef SHOULD_NOT_COMPILE - (void)impl{}; // W not a mixin - (void)impl{}; // A - (void)impl{}; // D => C => A - (void)impl{}; // D => C => A - (void)impl{}; // B -#else - (void)impl{}; - (void)impl{}; - (void)impl{}; -#endif -} - -} // ns mixins::traits_detail - -#endif diff --git a/main-window/mixin-traits.hpp b/main-window/mixin-traits.hpp deleted file mode 100644 index 45df7fdb..00000000 --- a/main-window/mixin-traits.hpp +++ /dev/null @@ -1,42 +0,0 @@ -#pragma once - -#include "compat/meta.hpp" - -#include - -namespace mixins::traits_detail { - - using namespace meta; - - template using tuple = tuple_; - - template - struct mixin_traits { - // implement this! - //using depends = tuple<>; - }; - - template struct check_depends_; - - template - struct check_depends_ : std::true_type - { - }; - - template - struct check_depends_ : - std::bool_constant< - std::is_base_of_v && - lift_v::depends>> && - check_depends_::value - > - { - }; - - template - struct impl - { - static_assert(lift>::value, - "class must inherit dependent mixins"); - }; -} // ns mixins::traits_detail diff --git a/main-window/mixins.hpp b/main-window/mixins.hpp deleted file mode 100644 index b85e6498..00000000 --- a/main-window/mixins.hpp +++ /dev/null @@ -1,13 +0,0 @@ -#pragma once - -#include "export.hpp" - -// XXX TODO add is_base_of and void_t stuff - -#define OTR_MIXIN_NS(name) \ - mixins :: detail :: name - -#define OTR_DECLARE_MIXIN(name) \ - namespace mixins { \ - using name = :: OTR_MIXIN_NS(name) :: name; \ - } diff --git a/main-window/module-mixin.cpp b/main-window/module-mixin.cpp deleted file mode 100644 index 5c4c3234..00000000 --- a/main-window/module-mixin.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include "module-mixin.hpp" - -#include - -namespace OTR_MIXIN_NS(module_mixin) { - -std::tuple -module_mixin::module_by_name(const QString& name, const dylib_list& list) const -{ - auto it = std::find_if(list.cbegin(), list.cend(), [&name](const dylib_ptr& lib) { - if (!lib) - return name.isEmpty(); - else - return name == lib->module_name; - }); - - if (it == list.cend()) - return { nullptr, -1 }; - else - return { *it, int(std::distance(list.cbegin(), it)) }; -} - -//static -void show_window(QWidget& d, bool fresh) -{ - if (fresh) - { - d.setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | d.windowFlags()); - d.setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - - d.show(); - d.adjustSize(); - d.raise(); - } - else - { - d.show(); - d.raise(); - } -} - -template -static bool mk_window_common(std::unique_ptr& d, F&& fun) -{ - bool fresh = false; - - if (!d) - d = fun(), fresh = !!d; - - if (d) - show_window(*d, fresh); - - return fresh; -} - -template -static bool mk_dialog(std::unique_ptr& place, const std::shared_ptr& lib) -{ - using u = std::unique_ptr; - - return mk_window_common(place, [&] { - if (lib && lib->Dialog) - return u{ (t*)lib->Dialog() }; - else - return u{}; - }); -} - -dylib_ptr module_mixin::current_tracker() -{ - auto [ptr, idx] = module_by_name(s.tracker_dll, modules.trackers()); - return ptr; -} - -dylib_ptr module_mixin::current_protocol() -{ - auto [ptr, idx] = module_by_name(s.protocol_dll, modules.protocols()); - return ptr; -} - -dylib_ptr module_mixin::current_filter() -{ - auto [ptr, idx] = module_by_name(s.filter_dll, modules.filters()); - return ptr; -} - -void module_mixin::show_tracker_settings_() -{ - if (mk_dialog(tracker_dialog, current_tracker()) && state.work && state.work->libs.pTracker) - tracker_dialog->register_tracker(&*state.work->libs.pTracker); - if (tracker_dialog) - QObject::connect(&*tracker_dialog, &ITrackerDialog::closing, - &fuzz, [this] { tracker_dialog = nullptr; }); -} - -void module_mixin::show_proto_settings_() -{ - if (mk_dialog(proto_dialog, current_protocol()) && state.work && state.work->libs.pProtocol) - proto_dialog->register_protocol(&*state.work->libs.pProtocol); - if (proto_dialog) - QObject::connect(&*proto_dialog, &IProtocolDialog::closing, - &fuzz, [this] { proto_dialog = nullptr; }); -} - -void module_mixin::show_filter_settings_() -{ - if (mk_dialog(filter_dialog, current_filter()) && state.work && state.work->libs.pFilter) - filter_dialog->register_filter(&*state.work->libs.pFilter); - if (filter_dialog) - QObject::connect(&*filter_dialog, &IFilterDialog::closing, - &fuzz, [this] { filter_dialog = nullptr; }); -} - -// this template function must go to a separate function like "options_mixin". -template -static bool mk_window(std::unique_ptr& place, Args&&... params) -{ - return mk_window_common(place, [&] { - return std::make_unique(params...); - }); -} - -module_mixin::module_mixin() = default; -module_mixin::~module_mixin() = default; - -} // ns diff --git a/main-window/module-mixin.hpp b/main-window/module-mixin.hpp deleted file mode 100644 index cde0484c..00000000 --- a/main-window/module-mixin.hpp +++ /dev/null @@ -1,52 +0,0 @@ -#pragma once - -#include "mixins.hpp" -#include "compat/library-path.hpp" -#include "api/plugin-api.hpp" -#include "logic/extensions.hpp" -#include "logic/state.hpp" -#include "logic/main-settings.hpp" - -#include -#include - -#include - -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_mixin -{ - module_mixin(); - virtual ~module_mixin(); - - std::unique_ptr tracker_dialog; - std::unique_ptr proto_dialog; - std::unique_ptr filter_dialog; - - std::tuple 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; - State state { OPENTRACK_BASE_PATH + OPENTRACK_LIBRARY_PATH }; - - QObject fuzz; -}; - -} - -OTR_DECLARE_MIXIN(module_mixin) -- cgit v1.2.3