diff --git a/config/base/base.mk b/config/base/base.mk index e7a2ef3..d746a7d 100644 --- a/config/base/base.mk +++ b/config/base/base.mk @@ -4,7 +4,7 @@ this_cxxflags += -Werror # treat warnings as errors this_cxxflags += -Wfatal-errors # stop on first error encountered this_cxxflags += -fstrict-aliasing # in order to comply with the c++ standard more strictly this_cxxflags += -g # include debugging symbols -this_cxxflags += -std=c++17 +this_cxxflags += -std=c++20 this_cxxflags += -fPIC this_cxxflags += -Wno-deprecated-declarations diff --git a/src/bedsidemon/spo2/spo2_parameter_window.cpp b/src/bedsidemon/spo2/spo2_parameter_window.cpp index 35d907b..7591d68 100644 --- a/src/bedsidemon/spo2/spo2_parameter_window.cpp +++ b/src/bedsidemon/spo2/spo2_parameter_window.cpp @@ -337,7 +337,8 @@ void spo2_parameter_window::on_heart_timer_expired() // std::cout << "heart" << std::endl; } -void spo2_parameter_window::on_color_change(){ - this->spo2_value.set_color(this->get_color()); - this->waveform.set_color(this->get_color()); +void spo2_parameter_window::on_color_change() +{ + this->spo2_value.set_color(this->get_color()); + this->waveform.set_color(this->get_color()); } diff --git a/src/bedsidemon/spo2/spo2_parameter_window.hpp b/src/bedsidemon/spo2/spo2_parameter_window.hpp index 880ce56..7a4b593 100644 --- a/src/bedsidemon/spo2/spo2_parameter_window.hpp +++ b/src/bedsidemon/spo2/spo2_parameter_window.hpp @@ -68,7 +68,7 @@ class spo2_parameter_window : void set(const spo2_measurement& meas); - void on_color_change()override; + void on_color_change() override; // clang-format off constexpr static const std::array possible_colors = {{ diff --git a/src/bedsidemon/spo2/spo2_parameter_window_menu.cpp b/src/bedsidemon/spo2/spo2_parameter_window_menu.cpp index 567b2c8..5993e03 100644 --- a/src/bedsidemon/spo2/spo2_parameter_window_menu.cpp +++ b/src/bedsidemon/spo2/spo2_parameter_window_menu.cpp @@ -21,6 +21,8 @@ along with this program. If not, see . #include "spo2_parameter_window_menu.hpp" +#include + #include #include #include @@ -31,6 +33,7 @@ along with this program. If not, see . #include "spo2_parameter_window.hpp" using namespace std::string_literals; +using namespace std::string_view_literals; using namespace ruis::length_literals; @@ -146,7 +149,25 @@ spo2_parameter_window_menu::spo2_parameter_window_menu( ), spo2_pw(std::move(spo2_pw)) // clang-format on -{} +{ + { + auto& sb = this->get_widget_as("color_selection_box"sv); + + if (auto pw = this->spo2_pw.lock()) { + const auto& colors = spo2_parameter_window::possible_colors; + auto i = std::ranges::find(colors, pw->get_color()); + sb.set_selection(std::distance(colors.begin(), i)); + } + + sb.selection_handler = [this](ruis::selection_box& sb) { + auto pw = this->spo2_pw.lock(); + if (!pw) { + return; + } + pw->set_color(spo2_parameter_window::possible_colors.at(sb.get_selection())); + }; + } +} void spo2_parameter_window_menu::on_close() {