1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 23:57:44 +00:00

Userland: Port to automatic GML initializer where possible

This commit is contained in:
kleines Filmröllchen 2024-01-22 16:52:25 +01:00 committed by Andrew Kaster
parent dec066fa5c
commit adc845e0cb
41 changed files with 148 additions and 245 deletions

View file

@ -24,16 +24,7 @@
namespace VideoPlayer {
ErrorOr<NonnullRefPtr<VideoPlayerWidget>> VideoPlayerWidget::create()
{
auto main_widget = TRY(try_create());
TRY(main_widget->setup_interface());
return main_widget;
}
ErrorOr<void> VideoPlayerWidget::setup_interface()
ErrorOr<void> VideoPlayerWidget::initialize()
{
m_video_display = find_descendant_of_type_named<VideoPlayer::VideoFrameWidget>("video_frame");
m_video_display->on_click = [&]() { toggle_pause(); };

View file

@ -25,7 +25,7 @@ class VideoPlayerWidget final : public GUI::Widget {
public:
static ErrorOr<NonnullRefPtr<VideoPlayerWidget>> try_create();
static ErrorOr<NonnullRefPtr<VideoPlayerWidget>> create();
ErrorOr<void> initialize();
virtual ~VideoPlayerWidget() override = default;
void close_file();
void open_file(FileSystemAccessClient::File filename);
@ -43,7 +43,6 @@ public:
private:
VideoPlayerWidget() = default;
ErrorOr<void> setup_interface();
void update_play_pause_icon();
void update_seek_slider_max();
void set_current_timestamp(Duration);

View file

@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
TRY(Core::System::unveil("/res", "r"));
TRY(Core::System::unveil(nullptr, nullptr));
auto main_widget = TRY(VideoPlayer::VideoPlayerWidget::create());
auto main_widget = TRY(VideoPlayer::VideoPlayerWidget::try_create());
window->set_main_widget(main_widget);
main_widget->update_title();
TRY(main_widget->initialize_menubar(window));