blob: d978bc60283554be0eb1e0391cffa98c20548680 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
#include "toggle_pause.hpp"
#include <fmt/core.h>
#include <utility>
TogglePauseCommand::TogglePauseCommand(
std::shared_ptr<IGenerationTracker> generation_tracker,
std::shared_ptr<IStatusLine> 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: {} Generation: {}",
_generation_tracker->get_is_paused() ? "yes" : "no",
_generation_tracker->get_current_generation()));
}
|