diff options
| author | Felix Morgner <felix.morgner@gmail.com> | 2025-05-23 14:04:27 +0200 |
|---|---|---|
| committer | Felix Morgner <felix.morgner@gmail.com> | 2025-05-23 14:04:27 +0200 |
| commit | 5d8f799a1171f92054d4b45ba130cd7fdad0bd01 (patch) | |
| tree | 0f51290b3a60d71d25d7a49b66d5bd54dd7a4156 /core/include | |
| parent | c45004b73bb045328a724d1d860df6d1515af6d4 (diff) | |
| download | turns-5d8f799a1171f92054d4b45ba130cd7fdad0bd01.tar.xz turns-5d8f799a1171f92054d4b45ba130cd7fdad0bd01.zip | |
app: prepare restructuring
Diffstat (limited to 'core/include')
| -rw-r--r-- | core/include/turns/core/json_ext.hpp | 43 | ||||
| -rw-r--r-- | core/include/turns/core/settings.hpp | 21 | ||||
| -rw-r--r-- | core/include/turns/core/turn_order_model.hpp | 102 |
3 files changed, 0 insertions, 166 deletions
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 <glibmm/property.h> -#include <glibmm/ustring.h> - -#include <nlohmann/json.hpp> - -#include <string> - -NLOHMANN_JSON_NAMESPACE_BEGIN - -template<typename T> -struct adl_serializer<Glib::Property<T>> -{ - static void to_json(json & to, Glib::Property<T> const & from) - { - to = from.get_value(); - } - - static void from_json(json const & from, Glib::Property<T> & to) - { - to = from.template get<T>(); - } -}; - -template<> -struct adl_serializer<Glib::ustring> -{ - static void to_json(json & to, Glib::ustring const & from) - { - to = static_cast<std::string>(from); - } - - static void from_json(json const & from, Glib::ustring & to) - { - to = from.template get<std::string>(); - } -}; - -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 <glibmm/refptr.h> - -#include <giomm/settings.h> - -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<Gio::Settings>; -} // 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 <glibmm/object.h> -#include <glibmm/property.h> -#include <glibmm/propertyproxy.h> -#include <glibmm/refptr.h> -#include <glibmm/ustring.h> - -#include <giomm/listmodel.h> - -#include <glib-object.h> -#include <nlohmann/json_fwd.hpp> - -#include <limits> -#include <optional> -#include <vector> - -namespace turns::core -{ - - struct TurnOderModel : Gio::ListModel, - Glib::Object - { - using value_type = Glib::RefPtr<Participant>; - using container_type = std::vector<value_type>; - 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<active_participant_type>::max(); - // auto static constexpr invalid_round_number = std::numeric_limits<round_number_type>::max(); - - /** Life-time */ - // TurnOderModel(); - - // auto static create() -> Glib::RefPtr<TurnOderModel>; - // auto static create(nlohmann::json const & from) -> Glib::RefPtr<TurnOderModel>; - - /** Properties */ - // auto is_empty() const -> Glib::PropertyProxy_ReadOnly<is_empty_type>; - auto has_next() const -> Glib::PropertyProxy_ReadOnly<has_next_type>; - auto has_previous() const -> Glib::PropertyProxy_ReadOnly<has_previous_type>; - auto is_running() const -> Glib::PropertyProxy_ReadOnly<is_running_type>; - auto progress() const -> Glib::PropertyProxy_ReadOnly<progress_type>; - auto round_number() const -> Glib::PropertyProxy_ReadOnly<round_number_type>; - auto skip_defeated() -> Glib::PropertyProxy<skip_defeated_type>; - - /** 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<unsigned> m_active{}; - - Glib::Property<has_next_type> m_has_next{*this, "has-next", false}; - Glib::Property<has_previous_type> m_has_previous{*this, "has-previous", false}; - Glib::Property<is_empty_type> m_is_empty{*this, "is-empty", true}; - Glib::Property<is_running_type> m_is_running{*this, "is-running", false}; - Glib::Property<progress_type> m_progress{*this, "progress", 0.0}; - Glib::Property<round_number_type> m_round_number{*this, "round-number", invalid_round_number}; - Glib::Property<skip_defeated_type> m_skip_defeated{*this, "skip-defeated", false}; - }; - -} // namespace turns::core - -#endif
\ No newline at end of file |
