From 4cb7ca42003c177e3acc80075d7594e555966106 Mon Sep 17 00:00:00 2001 From: Loek Le Blansch Date: Fri, 18 Oct 2024 16:37:02 +0200 Subject: fix command design pattern --- ToggleArtistVisibilityCommand.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'ToggleArtistVisibilityCommand.cpp') diff --git a/ToggleArtistVisibilityCommand.cpp b/ToggleArtistVisibilityCommand.cpp index 6c22dbc..17583de 100644 --- a/ToggleArtistVisibilityCommand.cpp +++ b/ToggleArtistVisibilityCommand.cpp @@ -1,13 +1,11 @@ #include "ToggleArtistVisibilityCommand.h" #include "ViewController.h" -void ToggleArtistVisibilityCommand::set(bool visible) { - ViewController & controller = this->get_controller(); - controller.set_artists_visible(visible); +ToggleArtistVisibilityCommand::ToggleArtistVisibilityCommand(ViewController & c) : controller(c) { } -void ToggleArtistVisibilityCommand::toggle() { - ViewController & controller = this->get_controller(); - controller.set_artists_visible(!controller.get_artists_visible()); +void ToggleArtistVisibilityCommand::execute() { + bool value = !this->controller.get_artists_visible(); + this->controller.set_artists_visible(value); } -- cgit v1.2.3