Skip to content

Commit

Permalink
set pw color
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Sep 18, 2024
1 parent a97ba6c commit 720b739
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/base/base.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 4 additions & 3 deletions src/bedsidemon/spo2/spo2_parameter_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
2 changes: 1 addition & 1 deletion src/bedsidemon/spo2/spo2_parameter_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint32_t, 4> possible_colors = {{
Expand Down
23 changes: 22 additions & 1 deletion src/bedsidemon/spo2/spo2_parameter_window_menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.

#include "spo2_parameter_window_menu.hpp"

#include <algorithm>

#include <ruis/widget/button/selection_box.hpp>
#include <ruis/widget/label/gap.hpp>
#include <ruis/widget/label/margins.hpp>
Expand All @@ -31,6 +33,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "spo2_parameter_window.hpp"

using namespace std::string_literals;
using namespace std::string_view_literals;

using namespace ruis::length_literals;

Expand Down Expand Up @@ -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<ruis::selection_box>("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()
{
Expand Down

0 comments on commit 720b739

Please sign in to comment.