aboutsummaryrefslogtreecommitdiff
path: root/src/commands/toggle_pause.cpp
blob: 54682c6db164e10ac2e0591e39eb088b468d1ab8 (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<IStatusManager> status_manager
) noexcept
	: _generation_tracker(std::move(generation_tracker)),
	  _status_manager(std::move(status_manager))
{
}

void TogglePauseCommand::execute() noexcept
{
	auto onoff = !_generation_tracker->get_is_paused();

	_generation_tracker->set_is_paused(onoff);

	_status_manager->set_section_body(StatusLineSection::D, onoff ? "yes" : "no");
}