Skip to content

Commit a16c06f

Browse files
committed
Improve rssi bars position
1 parent ffbfc4e commit a16c06f

File tree

2 files changed

+23
-20
lines changed

2 files changed

+23
-20
lines changed

src/gui/player_rect.cpp

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,17 @@ void PlayerRect::custom_ready() {
9393
tip_label_->set_font_size(HUD_LABEL_FONT_SIZE);
9494
add_child(tip_label_);
9595

96+
hud_container_ = std::make_shared<revector::VBoxContainer>();
97+
add_child(hud_container_);
98+
hud_container_->set_anchor_flag(revector::AnchorFlag::BottomWide);
99+
hud_container_->set_visibility(false);
100+
hud_container_->set_separation(2);
101+
96102
{
97-
auto vbox_container = std::make_shared<revector::GridContainer>();
98-
add_child(vbox_container);
99-
vbox_container->set_separation(2);
100-
vbox_container->set_anchor_flag(revector::AnchorFlag::BottomWide);
103+
auto lq_container = std::make_shared<revector::GridContainer>();
104+
hud_container_->add_child(lq_container);
105+
lq_container->set_separation(2);
106+
lq_container->set_anchor_flag(revector::AnchorFlag::BottomWide);
101107

102108
for (int i = 0; i < 2; i++) {
103109
for (int j = 0; j < ANTENNA_COUNT; j++) {
@@ -113,30 +119,27 @@ void PlayerRect::custom_ready() {
113119
}
114120

115121
for (const auto &bar : lq_bars_) {
116-
vbox_container->add_child(bar);
122+
lq_container->add_child(bar);
117123
bar->set_value(0);
118124
bar->set_custom_minimum_size({0, 4});
119125
bar->set_size({0, 4});
120126
bar->set_visibility(false);
121127
}
122128
}
123129

124-
hud_container_ = std::make_shared<revector::HBoxContainer>();
125-
add_child(hud_container_);
126-
hud_container_->set_size({0, 32});
130+
auto label_container_ = std::make_shared<revector::HBoxContainer>();
131+
hud_container_->add_child(label_container_);
127132
revector::StyleBox box;
128133
box.bg_color =
129134
GuiInterface::Instance().dark_mode_ ? revector::ColorU(27, 27, 27, 100) : revector::ColorU(228, 228, 228, 100);
130135
box.border_width = 0;
131136
box.corner_radius = 0;
132-
hud_container_->theme_override_bg = box;
133-
hud_container_->set_anchor_flag(revector::AnchorFlag::BottomWide);
134-
hud_container_->set_visibility(false);
135-
hud_container_->set_separation(16);
137+
label_container_->theme_override_bg = box;
138+
label_container_->set_separation(16);
136139

137140
{
138141
video_info_label_ = std::make_shared<revector::Label>();
139-
hud_container_->add_child(video_info_label_);
142+
label_container_->add_child(video_info_label_);
140143
video_info_label_->set_text("");
141144
video_info_label_->set_font_size(HUD_LABEL_FONT_SIZE);
142145
video_info_label_->set_visibility(false);
@@ -155,25 +158,25 @@ void PlayerRect::custom_ready() {
155158
}
156159

157160
bitrate_label_ = std::make_shared<revector::Label>();
158-
hud_container_->add_child(bitrate_label_);
161+
label_container_->add_child(bitrate_label_);
159162
bitrate_label_->set_font_size(HUD_LABEL_FONT_SIZE);
160163
bitrate_label_->set_visibility(false);
161164

162165
render_fps_label_ = std::make_shared<revector::Label>();
163-
hud_container_->add_child(render_fps_label_);
166+
label_container_->add_child(render_fps_label_);
164167
render_fps_label_->set_font_size(HUD_LABEL_FONT_SIZE);
165168

166169
decoder_label_ = std::make_shared<revector::Label>();
167-
hud_container_->add_child(decoder_label_);
170+
label_container_->add_child(decoder_label_);
168171
decoder_label_->set_font_size(HUD_LABEL_FONT_SIZE);
169172
decoder_label_->set_visibility(false);
170173

171174
#ifndef _WIN32
172175
pl_label_ = std::make_shared<revector::Label>();
173-
hud_container_->add_child(pl_label_);
176+
label_container_->add_child(pl_label_);
174177
pl_label_->set_font_size(HUD_LABEL_FONT_SIZE);
175178
fec_label_ = std::make_shared<revector::Label>();
176-
hud_container_->add_child(fec_label_);
179+
label_container_->add_child(fec_label_);
177180
fec_label_->set_font_size(HUD_LABEL_FONT_SIZE);
178181
#endif
179182

@@ -218,7 +221,7 @@ void PlayerRect::custom_ready() {
218221
rx_status_update_timer->start_timer(0.1);
219222

220223
record_status_label_ = std::make_shared<revector::Label>();
221-
hud_container_->add_child(record_status_label_);
224+
label_container_->add_child(record_status_label_);
222225
record_status_label_->container_sizing.flag_h = revector::ContainerSizingFlag::ShrinkEnd;
223226
record_status_label_->set_text("");
224227
record_status_label_->set_font_size(HUD_LABEL_FONT_SIZE);

src/gui/player_rect.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class PlayerRect final : public revector::TextureRect {
3232

3333
std::shared_ptr<revector::CollapseContainer> collapse_panel_;
3434

35-
std::shared_ptr<revector::HBoxContainer> hud_container_;
35+
std::shared_ptr<revector::VBoxContainer> hud_container_;
3636

3737
std::shared_ptr<revector::Label> record_status_label_;
3838

0 commit comments

Comments
 (0)