Skip to content

Commit aa96bac

Browse files
committed
Improve UI
1 parent 0507a72 commit aa96bac

File tree

5 files changed

+31
-19
lines changed

5 files changed

+31
-19
lines changed

assets/translations.csv

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
tag,en,zh,ru,ja
22
lang,Language,语言,Язык,言語
33
fullscreen,Fullscreen,全屏,Полноэкранный,全画面
4-
bit rate,Bit rate,码率,Битрейт,ビットレート
4+
bitrate,Bitrate,码率,Битрейт,ビットレート
55
render fps,Render FPS,渲染帧率,FPS рендера,レンダリングFPS
6-
hw decoder,Hardware decoder,硬件解码器,Аппаратный декодер,ハードウェアデコーダー
6+
decoder,Decoder,解码器,Декодер,デコーダ
77
capture frame,Capture frame,截图,кадр захвата,フレームキャプチャ
88
player control,Player control,播放控制,контроль игрока,プレイヤーコントロール
99
record mp4,Record MP4,录制 MP4,Запись MP4,MP4録画

src/gui/player_rect.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#include "src/player/gst/video_player.h"
77
#endif
88

9+
constexpr uint32_t HUD_LABEL_FONT_SIZE = 20;
10+
911
class SignalBar : public revector::ProgressBar {
1012
void custom_ready() override {
1113
theme_fg = {};
@@ -89,11 +91,12 @@ void PlayerRect::custom_ready() {
8991
tip_label_->set_anchor_flag(revector::AnchorFlag::VCenterWide);
9092
tip_label_->set_visibility(false);
9193
tip_label_->set_word_wrap(true);
94+
tip_label_->set_font_size(HUD_LABEL_FONT_SIZE);
9295
add_child(tip_label_);
9396

9497
hud_container_ = std::make_shared<revector::HBoxContainer>();
9598
add_child(hud_container_);
96-
hud_container_->set_size({0, 48});
99+
hud_container_->set_size({0, 32});
97100
revector::StyleBox box;
98101
box.bg_color =
99102
GuiInterface::Instance().dark_mode_ ? revector::ColorU(27, 27, 27, 100) : revector::ColorU(228, 228, 228, 100);
@@ -127,6 +130,7 @@ void PlayerRect::custom_ready() {
127130
video_info_label_ = std::make_shared<revector::Label>();
128131
hud_container_->add_child(video_info_label_);
129132
video_info_label_->set_text("");
133+
video_info_label_->set_font_size(HUD_LABEL_FONT_SIZE);
130134
video_info_label_->set_visibility(false);
131135

132136
auto on_decoder_ready = [this](uint32_t width, uint32_t height, float fps, std::string decoder_name) {
@@ -135,28 +139,34 @@ void PlayerRect::custom_ready() {
135139
video_info_label_->set_text(ss.str());
136140
video_info_label_->set_visibility(true);
137141

138-
hw_status_label_->set_text(FTR("hw decoder") + ": " + decoder_name);
139-
hw_status_label_->set_visibility(true);
142+
decoder_label_->set_text(FTR("decoder") + ": " + decoder_name);
143+
decoder_label_->set_font_size(HUD_LABEL_FONT_SIZE);
144+
decoder_label_->set_visibility(true);
140145
};
141146
GuiInterface::Instance().decoderReadyCallbacks.emplace_back(on_decoder_ready);
142147
}
143148

144149
bitrate_label_ = std::make_shared<revector::Label>();
145150
hud_container_->add_child(bitrate_label_);
146-
bitrate_label_->set_text(FTR("bit rate") + ": 0 bps");
151+
bitrate_label_->set_font_size(HUD_LABEL_FONT_SIZE);
152+
bitrate_label_->set_visibility(false);
147153

148154
render_fps_label_ = std::make_shared<revector::Label>();
149155
hud_container_->add_child(render_fps_label_);
156+
render_fps_label_->set_font_size(HUD_LABEL_FONT_SIZE);
150157

151-
hw_status_label_ = std::make_shared<revector::Label>();
152-
hud_container_->add_child(hw_status_label_);
153-
hw_status_label_->set_visibility(false);
158+
decoder_label_ = std::make_shared<revector::Label>();
159+
hud_container_->add_child(decoder_label_);
160+
decoder_label_->set_font_size(HUD_LABEL_FONT_SIZE);
161+
decoder_label_->set_visibility(false);
154162

155163
#ifndef _WIN32
156164
pl_label_ = std::make_shared<revector::Label>();
157165
hud_container_->add_child(pl_label_);
166+
pl_label_->set_font_size(HUD_LABEL_FONT_SIZE);
158167
fec_label_ = std::make_shared<revector::Label>();
159168
hud_container_->add_child(fec_label_);
169+
fec_label_->set_font_size(HUD_LABEL_FONT_SIZE);
160170
#endif
161171

162172
rx_status_update_timer = std::make_shared<revector::Timer>();
@@ -199,6 +209,7 @@ void PlayerRect::custom_ready() {
199209
hud_container_->add_child(record_status_label_);
200210
record_status_label_->container_sizing.flag_h = revector::ContainerSizingFlag::ShrinkEnd;
201211
record_status_label_->set_text("");
212+
record_status_label_->set_font_size(HUD_LABEL_FONT_SIZE);
202213

203214
auto capture_button = std::make_shared<revector::Button>();
204215
vbox->add_child(capture_button);
@@ -292,7 +303,7 @@ void PlayerRect::custom_ready() {
292303
// }
293304

294305
auto onBitrateUpdate = [this](uint64_t bitrate) {
295-
std::string text = FTR("bit rate") + ": ";
306+
std::string text = FTR("bitrate") + ": ";
296307
if (bitrate > 1024 * 1024) {
297308
text += std::format("{:.1f}", bitrate / 1024.0 / 1024.0) + " Mbps";
298309
} else if (bitrate > 1024) {
@@ -301,6 +312,7 @@ void PlayerRect::custom_ready() {
301312
text += std::format("{:d}", bitrate) + " bps";
302313
}
303314
bitrate_label_->set_text(text);
315+
bitrate_label_->show();
304316
};
305317
GuiInterface::Instance().bitrateUpdateCallbacks.emplace_back(onBitrateUpdate);
306318

src/gui/player_rect.h

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

3939
std::shared_ptr<revector::Label> bitrate_label_;
4040

41-
std::shared_ptr<revector::Label> hw_status_label_;
41+
std::shared_ptr<revector::Label> decoder_label_;
4242

4343
std::shared_ptr<revector::Label> pl_label_;
4444

src/main.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main() {
1313
GuiInterface::Instance().PutLog(LogLevel::Info, "App started");
1414

1515
auto app =
16-
new revector::App({1280, 720}, GuiInterface::Instance().dark_mode_, GuiInterface::Instance().use_vulkan_);
16+
new revector::App({1080, 480}, GuiInterface::Instance().dark_mode_, GuiInterface::Instance().use_vulkan_);
1717
app->set_window_title("Aviateur - OpenIPC FPV Ground Station");
1818

1919
GuiInterface::Instance().PutLog(LogLevel::Info, "revector app created");
@@ -24,19 +24,19 @@ int main() {
2424
int rc = libusb_init(nullptr);
2525

2626
{
27-
auto split_container = std::make_shared<revector::SplitContainer>();
28-
split_container->set_split_ratio(1.0f);
29-
split_container->set_anchor_flag(revector::AnchorFlag::FullRect);
30-
app->get_tree_root()->add_child(split_container);
27+
auto hbox_container = std::make_shared<revector::HBoxContainer>();
28+
hbox_container->set_anchor_flag(revector::AnchorFlag::FullRect);
29+
hbox_container->set_separation(0);
30+
app->get_tree_root()->add_child(hbox_container);
3131

3232
auto player_rect = std::make_shared<PlayerRect>();
3333
player_rect->container_sizing.flag_h = revector::ContainerSizingFlag::Fill;
3434
player_rect->container_sizing.flag_v = revector::ContainerSizingFlag::Fill;
35-
split_container->add_child(player_rect);
35+
hbox_container->add_child(player_rect);
3636

3737
auto control_panel = std::make_shared<ControlPanel>();
3838
control_panel->container_sizing.flag_v = revector::ContainerSizingFlag::Fill;
39-
split_container->add_child(control_panel);
39+
hbox_container->add_child(control_panel);
4040

4141
std::weak_ptr control_panel_weak = control_panel;
4242
std::weak_ptr player_rect_weak = player_rect;

src/player/ffmpeg/video_player.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ void VideoPlayerFfmpeg::play(const std::string &playUrl, bool forceSoftwareDecod
8080
return;
8181
}
8282

83-
std::string decoder_name = decoder->hwDecoderName.has_value() ? decoder->hwDecoderName.value() : "N/A";
83+
std::string decoder_name = decoder->hwDecoderName.has_value() ? decoder->hwDecoderName.value() : "Software";
8484

8585
GuiInterface::Instance().EmitDecoderReady(decoder->GetWidth(),
8686
decoder->GetHeight(),

0 commit comments

Comments
 (0)