diff options
author | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-18 16:37:02 +0200 |
---|---|---|
committer | Loek Le Blansch <loek@pipeframe.xyz> | 2024-10-18 16:37:02 +0200 |
commit | 4cb7ca42003c177e3acc80075d7594e555966106 (patch) | |
tree | d2f5836d70a1fa2dc1d18c4fb59f1bf1f2f91f5a /ToggleArtistVisibilityCommand.cpp | |
parent | d8289105193707daede1a5b59137f18e20f20aeb (diff) |
fix command design pattern
Diffstat (limited to 'ToggleArtistVisibilityCommand.cpp')
-rw-r--r-- | ToggleArtistVisibilityCommand.cpp | 10 |
1 files changed, 4 insertions, 6 deletions
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); } |