aboutsummaryrefslogtreecommitdiff
path: root/src/commands/toggle_pause.cpp
blob: 8a3f44c697f61033cc96bce0f695a9b1c6438542 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#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: {}", onoff ? "yes" : "no"));
}