From 808a0cbc8d47f2c77fc69f2ad850d2e91dc9ca21 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 19 Jul 2022 09:55:42 -0400 Subject: Use a uniform interface for changing settings in the UI --- src/Configuration.hpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/Configuration.hpp') diff --git a/src/Configuration.hpp b/src/Configuration.hpp index 6a59076..770a240 100644 --- a/src/Configuration.hpp +++ b/src/Configuration.hpp @@ -63,6 +63,23 @@ public: } } + // Set a global configuration setting + template + void set_setting(S new_setting) + { + set(new_setting.value); + } + + // Set a global port color setting + void set_setting(setting::PortColor new_setting) + { + auto& color = _port_colors[static_cast(new_setting.type)]; + + if (color != new_setting.color) { + set_port_color(new_setting.type, new_setting.color); + } + } + // Get a global configuration setting template const decltype(S::value) get() const -- cgit v1.2.1