From 5d8f799a1171f92054d4b45ba130cd7fdad0bd01 Mon Sep 17 00:00:00 2001 From: Felix Morgner Date: Fri, 23 May 2025 14:04:27 +0200 Subject: app: prepare restructuring --- core/include/turns/core/json_ext.hpp | 43 ----------- core/include/turns/core/settings.hpp | 21 ------ core/include/turns/core/turn_order_model.hpp | 102 --------------------------- 3 files changed, 166 deletions(-) delete mode 100644 core/include/turns/core/json_ext.hpp delete mode 100644 core/include/turns/core/settings.hpp delete mode 100644 core/include/turns/core/turn_order_model.hpp (limited to 'core/include') diff --git a/core/include/turns/core/json_ext.hpp b/core/include/turns/core/json_ext.hpp deleted file mode 100644 index 3eedb64..0000000 --- a/core/include/turns/core/json_ext.hpp +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef TURNS_CORE_JSON_EXT_HPP -#define TURNS_CORE_JSON_EXT_HPP - -#include -#include - -#include - -#include - -NLOHMANN_JSON_NAMESPACE_BEGIN - -template -struct adl_serializer> -{ - static void to_json(json & to, Glib::Property const & from) - { - to = from.get_value(); - } - - static void from_json(json const & from, Glib::Property & to) - { - to = from.template get(); - } -}; - -template<> -struct adl_serializer -{ - static void to_json(json & to, Glib::ustring const & from) - { - to = static_cast(from); - } - - static void from_json(json const & from, Glib::ustring & to) - { - to = from.template get(); - } -}; - -NLOHMANN_JSON_NAMESPACE_END - -#endif \ No newline at end of file diff --git a/core/include/turns/core/settings.hpp b/core/include/turns/core/settings.hpp deleted file mode 100644 index 304394d..0000000 --- a/core/include/turns/core/settings.hpp +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef TURNS_CORE_SETTINGS_HPP -#define TURNS_CORE_SETTINGS_HPP - -#include - -#include - -namespace turns::core -{ - namespace settings::key - { - auto constexpr disposition_friendly_color = "disposition-color-friendly"; - auto constexpr disposition_hostile_color = "disposition-color-hostile"; - auto constexpr disposition_secret_color = "disposition-color-secret"; - auto constexpr skip_defeated = "skip-defeated"; - } // namespace settings::key - - auto get_settings() -> Glib::RefPtr; -} // namespace turns::core - -#endif \ No newline at end of file diff --git a/core/include/turns/core/turn_order_model.hpp b/core/include/turns/core/turn_order_model.hpp deleted file mode 100644 index b7ce484..0000000 --- a/core/include/turns/core/turn_order_model.hpp +++ /dev/null @@ -1,102 +0,0 @@ -#ifndef TURNS_CORE_TURN_ORDER_MODEL_HPP -#define TURNS_CORE_TURN_ORDER_MODEL_HPP - -#include "turns/core/fwd.hpp" - -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include -#include -#include - -namespace turns::core -{ - - struct TurnOderModel : Gio::ListModel, - Glib::Object - { - using value_type = Glib::RefPtr; - using container_type = std::vector; - using iterator = container_type::iterator; - using const_iterator = container_type::const_iterator; - - using active_participant_type = unsigned int; - using is_empty_type = bool; - using has_next_type = bool; - using has_previous_type = bool; - using is_running_type = bool; - using progress_type = double; - using round_number_type = unsigned int; - using skip_defeated_type = bool; - - // auto static constexpr invalid_participant_index = std::numeric_limits::max(); - // auto static constexpr invalid_round_number = std::numeric_limits::max(); - - /** Life-time */ - // TurnOderModel(); - - // auto static create() -> Glib::RefPtr; - // auto static create(nlohmann::json const & from) -> Glib::RefPtr; - - /** Properties */ - // auto is_empty() const -> Glib::PropertyProxy_ReadOnly; - auto has_next() const -> Glib::PropertyProxy_ReadOnly; - auto has_previous() const -> Glib::PropertyProxy_ReadOnly; - auto is_running() const -> Glib::PropertyProxy_ReadOnly; - auto progress() const -> Glib::PropertyProxy_ReadOnly; - auto round_number() const -> Glib::PropertyProxy_ReadOnly; - auto skip_defeated() -> Glib::PropertyProxy; - - /** Element Modifications */ - // auto add(Glib::ustring const & name, float priority, Disposition disposition) -> void; - // auto clear() -> void; - // auto remove(unsigned index) -> void; - - /** Turn Modification */ - auto next() -> void; - auto previous() -> void; - auto start() -> void; - auto stop() -> void; - - /** Serialization */ - auto load(nlohmann::json const & from) -> void; - auto serialize() -> nlohmann::json; - - private: - explicit TurnOderModel(nlohmann::json const & from); - - auto get_item_type_vfunc() -> GType override; - auto get_n_items_vfunc() -> unsigned override; - auto get_item_vfunc(unsigned position) -> void * override; - - /** Signal handlers */ - auto handle_priority_changed(value_type entry) -> void; - - /** Data management */ - auto find(value_type entry) const -> const_iterator; - auto insert(value_type entry) -> const_iterator; - - container_type m_data{}; - std::optional m_active{}; - - Glib::Property m_has_next{*this, "has-next", false}; - Glib::Property m_has_previous{*this, "has-previous", false}; - Glib::Property m_is_empty{*this, "is-empty", true}; - Glib::Property m_is_running{*this, "is-running", false}; - Glib::Property m_progress{*this, "progress", 0.0}; - Glib::Property m_round_number{*this, "round-number", invalid_round_number}; - Glib::Property m_skip_defeated{*this, "skip-defeated", false}; - }; - -} // namespace turns::core - -#endif \ No newline at end of file -- cgit v1.2.3