From 486ca3846b46dc229e5807968578809766ec1991 Mon Sep 17 00:00:00 2001 From: HampusM Date: Wed, 23 Mar 2022 19:41:31 +0100 Subject: feat: implement generations & multithreading --- src/commands/toggle_pause.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 src/commands/toggle_pause.cpp (limited to 'src/commands/toggle_pause.cpp') diff --git a/src/commands/toggle_pause.cpp b/src/commands/toggle_pause.cpp new file mode 100644 index 0000000..8a3f44c --- /dev/null +++ b/src/commands/toggle_pause.cpp @@ -0,0 +1,22 @@ +#include "toggle_pause.hpp" + +#include +#include + +TogglePauseCommand::TogglePauseCommand( + std::shared_ptr generation_tracker, + std::shared_ptr statusline) noexcept + : _generation_tracker(std::move(generation_tracker)), + _statusline(std::move(statusline)) +{ +} + +void TogglePauseCommand::execute() noexcept +{ + auto onoff = !_generation_tracker->get_is_paused(); + + _generation_tracker->set_is_paused(onoff); + + _statusline->set_status(StatusLineSection::B, + fmt::format("Paused: {}", onoff ? "yes" : "no")); +} -- cgit v1.2.3-18-g5258