summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lang/include/turns/lang/messages.hpp1
-rw-r--r--lang/po/de.po3
-rw-r--r--lang/po/en.po3
-rw-r--r--lang/tests/messages.cpp1
-rw-r--r--ui/include/turns/ui/windows/tracker.hpp2
-rw-r--r--ui/src/windows/tracker.cpp27
6 files changed, 31 insertions, 6 deletions
diff --git a/lang/include/turns/lang/messages.hpp b/lang/include/turns/lang/messages.hpp
index 9c07917..59a099b 100644
--- a/lang/include/turns/lang/messages.hpp
+++ b/lang/include/turns/lang/messages.hpp
@@ -19,6 +19,7 @@ namespace turns::lang
auto constexpr static priority = "Priority";
auto constexpr static priority_number = "Priority {}";
auto constexpr static quit = "_Quit";
+ auto constexpr static round_number = "Round {}";
auto constexpr static start_turn_order = "Start turn order";
auto constexpr static turns = "Turns";
} // namespace turns::lang
diff --git a/lang/po/de.po b/lang/po/de.po
index 5f57e3d..698d813 100644
--- a/lang/po/de.po
+++ b/lang/po/de.po
@@ -56,6 +56,9 @@ msgstr "Priorität {}"
msgid "_Quit"
msgstr "_Beenden"
+msgid "Round {}"
+msgstr "Runde {}"
+
msgid "Start turn order"
msgstr "Zugreihenfolge starten"
diff --git a/lang/po/en.po b/lang/po/en.po
index 2f7ff85..b716a17 100644
--- a/lang/po/en.po
+++ b/lang/po/en.po
@@ -56,6 +56,9 @@ msgstr "Priority {}"
msgid "_Quit"
msgstr "_Quit"
+msgid "Round {}"
+msgstr "Round {}"
+
msgid "Start turn order"
msgstr "Start turn order"
diff --git a/lang/tests/messages.cpp b/lang/tests/messages.cpp
index 14e9fcf..33c4202 100644
--- a/lang/tests/messages.cpp
+++ b/lang/tests/messages.cpp
@@ -36,6 +36,7 @@ namespace turns::lang::tests
priority_number,
quit,
start_turn_order,
+ round_number,
turns);
SECTION(std::format("has a translation for '{}'", message))
diff --git a/ui/include/turns/ui/windows/tracker.hpp b/ui/include/turns/ui/windows/tracker.hpp
index 4af7c43..04174e6 100644
--- a/ui/include/turns/ui/windows/tracker.hpp
+++ b/ui/include/turns/ui/windows/tracker.hpp
@@ -32,6 +32,8 @@ namespace turns::app::windows
auto setup_actions() -> void;
+ auto update_subtitle() -> void;
+
AdwApplicationWindow * m_adw;
Gtk::Revealer * m_controls;
Gtk::Widget * m_empty;
diff --git a/ui/src/windows/tracker.cpp b/ui/src/windows/tracker.cpp
index 4372117..b3e03d1 100644
--- a/ui/src/windows/tracker.cpp
+++ b/ui/src/windows/tracker.cpp
@@ -1,15 +1,18 @@
#include "turns/ui/windows/tracker.hpp"
-#include "turns/ui/windows/participant_editor.hpp"
#include "turns/core/participant.hpp"
#include "turns/core/turn_order.hpp"
#include "turns/lang/messages.hpp"
+#include "turns/ui/windows/participant_editor.hpp"
+
+#include <sigc++/functors/mem_fun.h>
#include <glibmm/binding.h>
#include <glibmm/i18n.h>
#include <adwaita.h>
+#include <format>
#include <utility>
namespace turns::app::windows
@@ -51,6 +54,10 @@ namespace turns::app::windows
m_stack->add(*m_turn_order_view);
+ m_turn_order->is_empty().signal_changed().connect(sigc::mem_fun(*this, &tracker::update_subtitle));
+ m_turn_order->round_number().signal_changed().connect(sigc::mem_fun(*this, &tracker::update_subtitle));
+ update_subtitle();
+
// clang-format off
Glib::Binding::bind_property(m_turn_order->is_empty(),
m_stack->property_visible_child(),
@@ -60,11 +67,6 @@ namespace turns::app::windows
Glib::Binding::bind_property(m_turn_order->is_running(),
m_controls->property_reveal_child(),
Glib::Binding::Flags::SYNC_CREATE);
-
- Glib::Binding::bind_property(m_turn_order->is_empty(),
- m_subtitle,
- Glib::Binding::Flags::SYNC_CREATE,
- [](auto empty) { return empty ? _(lang::no_active_turn_order) : ""; });
// clang-format on
}
@@ -174,4 +176,17 @@ namespace turns::app::windows
}
}
+ auto tracker::update_subtitle() -> void
+ {
+ if (m_turn_order->is_empty())
+ {
+ m_subtitle = _(lang::no_active_turn_order);
+ }
+ else
+ {
+ auto round_number = m_turn_order->round_number() + 1;
+ m_subtitle = round_number == 0 ? "" : std::vformat(_("Round {}"), std::make_format_args(round_number));
+ }
+ }
+
} // namespace turns::app::windows