From 92db466083b1f0be0bede64fad692971ce18dcd2 Mon Sep 17 00:00:00 2001 From: Pcornat Date: Fri, 6 Feb 2026 19:18:06 +0100 Subject: [PATCH] Adding debug button for objects in sheet --- app_win_2_back.cpp | 12 ++++++++++++ app_win_2_back.hpp | 5 +++++ window_ui.ui | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/app_win_2_back.cpp b/app_win_2_back.cpp index db940e3..0ad2952 100644 --- a/app_win_2_back.cpp +++ b/app_win_2_back.cpp @@ -4,7 +4,9 @@ #include #include +#include #include + #include #include @@ -162,10 +164,13 @@ namespace gui_to_app { if (switches_procedure()) { return; } + debug_button = app_builder->get_widget("debug_button"); hab_base = app_builder->get_widget("habilete_label_base"); hab_carac = app_builder->get_widget("habilete_label_carac"); hab_mat = app_builder->get_widget("habilete_label_materiel"); hab_total = app_builder->get_widget("habilete_label_total"); + + debug_button->signal_clicked().connect(sigc::mem_fun(*this, &AppWin2Back::debug_button_clicked), false); } void AppWin2Back::on_quit() noexcept { @@ -181,6 +186,13 @@ namespace gui_to_app { return flag ? gestionnaire.insert_object(sheet, obj) : !gestionnaire.erase_object(sheet, obj); } + void AppWin2Back::debug_button_clicked() const noexcept { + spdlog::info("Display objects"); + for (const auto &obj: sheet.get_objects() | views::values) { + spdlog::info("Object: {}", obj->to_string()); + } + } + bool AppWin2Back::insert_obj(const character::billyEnums &obj) noexcept { return gestionnaire.insert_object(sheet, obj); } diff --git a/app_win_2_back.hpp b/app_win_2_back.hpp index 2f8bc52..b0f30d5 100644 --- a/app_win_2_back.hpp +++ b/app_win_2_back.hpp @@ -17,6 +17,7 @@ namespace learn_gtkmm4 { namespace Gtk { class Builder; class Label; + class Button; } namespace gui_to_app { @@ -59,6 +60,8 @@ namespace gui_to_app { bool switch_signal_handler(bool flag, const character::billyEnums &obj) noexcept; + void debug_button_clicked() const noexcept; + bool insert_obj(const character::billyEnums &obj) noexcept; bool erase_obj(const character::billyEnums &obj) noexcept; @@ -85,6 +88,8 @@ namespace gui_to_app { Gtk::Label *hab_mat{ nullptr }; Gtk::Label *hab_total{ nullptr }; + Gtk::Button *debug_button{ nullptr }; + std::array signal_handlers{ SwitchSignalHelper{ .app = *this, .obj = character::weapons::Sword }, SwitchSignalHelper{ .app = *this, .obj = character::weapons::Lance }, diff --git a/window_ui.ui b/window_ui.ui index 50ac0a2..c6cf1fd 100644 --- a/window_ui.ui +++ b/window_ui.ui @@ -719,6 +719,12 @@ + + + center + Print Sheet + +