VideoPlayer: Propagate errors using try_set_main_widget in main

This commit is contained in:
creator1creeper1 2022-01-07 15:01:38 +01:00 committed by Andreas Kling
parent c1dc5ef9d7
commit 20a7cb3004
Notes: sideshowbarker 2024-07-17 21:22:23 +09:00

View file

@ -27,13 +27,13 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
auto const video_track = track.video_track().value();
auto image = Gfx::Bitmap::try_create(Gfx::BitmapFormat::BGRx8888, Gfx::IntSize(video_track.pixel_height, video_track.pixel_width)).release_value_but_fixme_should_propagate_errors();
auto& main_widget = window->set_main_widget<GUI::Widget>();
main_widget.set_fill_with_background_color(true);
main_widget.set_layout<GUI::VerticalBoxLayout>();
auto& image_widget = main_widget.add<GUI::ImageWidget>();
auto main_widget = TRY(window->try_set_main_widget<GUI::Widget>());
main_widget->set_fill_with_background_color(true);
main_widget->set_layout<GUI::VerticalBoxLayout>();
auto& image_widget = main_widget->add<GUI::ImageWidget>();
image_widget.set_bitmap(image);
image_widget.set_fixed_size(video_track.pixel_height, video_track.pixel_width);
TRY(main_widget.try_add_child(image_widget));
TRY(main_widget->try_add_child(image_widget));
Video::VP9::Decoder vp9_decoder;
for (auto const& cluster : document->clusters()) {