From 10a8d40e12b30beec0781deb0af894f66fe3561f Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Thu, 25 Jul 2024 08:20:05 +0200 Subject: turns: add initialization functions --- app/src/application.cpp | 12 ++++-------- core/CMakeLists.txt | 1 + core/include/turns/core/init.hpp | 11 +++++++++++ core/src/init.cpp | 15 +++++++++++++++ ui/CMakeLists.txt | 1 + ui/include/turns/ui/init.hpp | 11 +++++++++++ ui/src/init.cpp | 15 +++++++++++++++ 7 files changed, 58 insertions(+), 8 deletions(-) create mode 100644 core/include/turns/core/init.hpp create mode 100644 core/src/init.cpp create mode 100644 ui/include/turns/ui/init.hpp create mode 100644 ui/src/init.cpp diff --git a/app/src/application.cpp b/app/src/application.cpp index c0aba86..1635cec 100644 --- a/app/src/application.cpp +++ b/app/src/application.cpp @@ -1,6 +1,7 @@ #include "turns/app/application.hpp" -#include "turns/ui/widgets/turn_order_view.hpp" +#include "turns/core/init.hpp" +#include "turns/ui/init.hpp" #include "turns/ui/windows/tracker.hpp" #include @@ -16,6 +17,8 @@ namespace turns::app { Gtk::init_gtkmm_internals(); adw_init(); + core::register_types(); + app::register_types(); return std::shared_ptr{new application{}}; } @@ -65,13 +68,6 @@ namespace turns::app m_application->set_accel_for_action("win.next", "space"); m_application->set_accel_for_action("win.previous", "BackSpace"); m_application->set_accel_for_action("win.add_participant", "a"); - - register_derived_widgets(); - } - - auto application::register_derived_widgets() -> void - { - static_cast(widgets::turn_order_view{}); } } // namespace turns::app \ No newline at end of file diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 4928843..245c7f7 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -2,6 +2,7 @@ add_library("core" "src/disposition.cpp" + "src/init.cpp" "src/participant.cpp" "src/turn_order.cpp" ) diff --git a/core/include/turns/core/init.hpp b/core/include/turns/core/init.hpp new file mode 100644 index 0000000..f0dc70e --- /dev/null +++ b/core/include/turns/core/init.hpp @@ -0,0 +1,11 @@ +#ifndef TURNS_CORE_INIT_HPP +#define TURNS_CORE_INIT_HPP + +namespace turns::core +{ + + auto register_types() -> void; + +} // namespace turns::core + +#endif \ No newline at end of file diff --git a/core/src/init.cpp b/core/src/init.cpp new file mode 100644 index 0000000..258aceb --- /dev/null +++ b/core/src/init.cpp @@ -0,0 +1,15 @@ +#include "turns/core/init.hpp" + +#include "turns/core/participant.hpp" +#include "turns/core/turn_order.hpp" + +namespace turns::core +{ + + auto register_types() -> void + { + static_cast(participant{}); + static_cast(turn_order{}); + } + +} // namespace turns::core \ No newline at end of file diff --git a/ui/CMakeLists.txt b/ui/CMakeLists.txt index e3d8941..2532059 100644 --- a/ui/CMakeLists.txt +++ b/ui/CMakeLists.txt @@ -1,6 +1,7 @@ # Library add_library("ui" + "src/init.cpp" "src/widgets/participant_row.cpp" "src/widgets/turn_order_view.cpp" "src/windows/participant_editor.cpp" diff --git a/ui/include/turns/ui/init.hpp b/ui/include/turns/ui/init.hpp new file mode 100644 index 0000000..09a0f40 --- /dev/null +++ b/ui/include/turns/ui/init.hpp @@ -0,0 +1,11 @@ +#ifndef TURNS_UI_INIT_HPP +#define TURNS_UI_INIT_HPP + +namespace turns::app +{ + + auto register_types() -> void; + +} // namespace turns::aop + +#endif \ No newline at end of file diff --git a/ui/src/init.cpp b/ui/src/init.cpp new file mode 100644 index 0000000..f10521a --- /dev/null +++ b/ui/src/init.cpp @@ -0,0 +1,15 @@ +#include "turns/core/init.hpp" + +#include "turns/ui/widgets/participant_row.hpp" +#include "turns/ui/widgets/turn_order_view.hpp" + +namespace turns::app +{ + + auto register_types() -> void + { + static_cast(widgets::participant_row{{}}); + static_cast(widgets::turn_order_view{{}}); + } + +} // namespace turns::core \ No newline at end of file -- cgit v1.2.3