Skip to content

Commit

Permalink
stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
igagis committed Mar 17, 2024
1 parent c4462be commit 7507700
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
/* ================ LICENSE END ================ */

#include <clargs/parser.hpp>
#include <ruis/layout.hpp>
#include <ruis/layouts/layout.hpp>
#include <ruisapp/application.hpp>

#include "spo2/contec_cms50d_plus.hpp"
Expand Down
25 changes: 13 additions & 12 deletions src/spo2/spo2_parameter_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <ratio>
#include <vector>

#include <ruis/layout.hpp>
#include <ruis/layouts/layout.hpp>
#include <ruis/widgets/label/rectangle.hpp>

using namespace std::string_literals;
Expand Down Expand Up @@ -61,7 +61,7 @@ std::vector<utki::shared_ref<ruis::widget>> build_layout(utki::shared_ref<ruis::
.widget_params = {
.id = "pw_waveform"s,
.lp = {
.dims = {0, ruis::lp::fill},
.dims = {lp::fill, lp::fill},
.weight = 3
}
},
Expand All @@ -74,7 +74,7 @@ std::vector<utki::shared_ref<ruis::widget>> build_layout(utki::shared_ref<ruis::
{
.widget_params = {
.lp = {
.dims = {c.get().units.pp_to_px(1), ruis::lp::fill}
.dims = {c.get().units.pp_to_px(1), lp::fill}
}
},
.color_params = {
Expand All @@ -86,7 +86,7 @@ std::vector<utki::shared_ref<ruis::widget>> build_layout(utki::shared_ref<ruis::
{
.widget_params = {
.lp = {
.dims = {0, lp::min},
.dims = {lp::fill, lp::min},
.weight = 1
}
},
Expand Down Expand Up @@ -158,18 +158,19 @@ spo2_parameter_window::spo2_parameter_window(utki::shared_ref<ruis::context> con
ruis::widget( //
std::move(context),
{//
.lp =
{//
.dims = {ruis::lp::fill, ruis::lp::min}
}
.widget_params =
{.lp =
{//
.dims = {ruis::lp::fill, ruis::lp::min}
}}
}
),
ruis::container( //
this->context,
{},
{//
.layout = ruis::layout::row
},
{.container_params =
{//
.layout = ruis::layout::row
}},
build_layout(this->context)
),
spo2_value(this->get_widget_as<ruis::text>("spo2_value")),
Expand Down
2 changes: 1 addition & 1 deletion src/spo2/spo2_parameter_window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.

#pragma once

#include <ruis/widget.hpp>
#include <ruis/widgets/label/text.hpp>
#include <ruis/widgets/widget.hpp>

#include "../waveform.hpp"

Expand Down
25 changes: 12 additions & 13 deletions src/waveform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,18 @@ namespace {
constexpr auto default_max_value = 100;
} // namespace

waveform::waveform(
utki::shared_ref<ruis::context> context,
ruis::widget::parameters widget_params,
ruis::color_widget::parameters color_params
) :
ruis::widget(std::move(context), std::move(widget_params)),
ruis::color_widget(this->context, std::move(color_params)),
paths{
{//
{.vao{this->context.get().renderer}},
{.vao{this->context.get().renderer}}
}
},
waveform::waveform(utki::shared_ref<ruis::context> context, all_parameters params) :
ruis::widget(
std::move(context),
{
.widget_params = std::move(params.widget_params)
}
),
ruis::color_widget(this->context, std::move(params.color_params)),
paths{{//
{.vao{this->context.get().renderer}},
{.vao{this->context.get().renderer}}
}},
value_max(default_max_value)
{
constexpr auto default_sweep_speed_mm_per_sec = 100;
Expand Down
26 changes: 9 additions & 17 deletions src/waveform.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <deque>

#include <ruis/paint/path_vao.hpp>
#include <ruis/widget.hpp>
#include <ruis/widgets/base/color_widget.hpp>
#include <ruis/widgets/widget.hpp>

namespace bedsidemon {

Expand All @@ -50,11 +50,12 @@ class waveform :
ruis::real gap_px;

public:
waveform(
utki::shared_ref<ruis::context> context,
ruis::widget::parameters widget_params,
ruis::color_widget::parameters color_params
);
struct all_parameters {
ruis::widget::parameters widget_params;
ruis::color_widget::parameters color_params;
};

waveform(utki::shared_ref<ruis::context> context, all_parameters params);

void render(const ruis::matrix4& matrix) const override;

Expand All @@ -68,21 +69,12 @@ class waveform :

namespace make {

struct waveform_parameters {
ruis::widget::parameters widget_params;
ruis::color_widget::parameters color_params;
};

inline utki::shared_ref<ruis::widget> waveform( //
utki::shared_ref<ruis::context> context,
waveform_parameters params
waveform::all_parameters params
)
{
return utki::make_shared<bedsidemon::waveform>(
std::move(context),
std::move(params.widget_params),
std::move(params.color_params)
);
return utki::make_shared<bedsidemon::waveform>(std::move(context), std::move(params));
}
} // namespace make

Expand Down

0 comments on commit 7507700

Please sign in to comment.