diff --git a/Userland/Applications/VideoPlayer/CMakeLists.txt b/Userland/Applications/VideoPlayer/CMakeLists.txt index c6a0b96c6f6d1cc..16ed221736295a2 100644 --- a/Userland/Applications/VideoPlayer/CMakeLists.txt +++ b/Userland/Applications/VideoPlayer/CMakeLists.txt @@ -4,17 +4,14 @@ serenity_component( DEPENDS AudioServer ) -stringify_gml(VideoPlayerWindow.gml VideoPlayerWindowGML.h videoplayer_window_gml) +compile_gml(VideoPlayerWidget.gml VideoPlayerWidgetGML.cpp) set(SOURCES main.cpp + VideoPlayerWidgetGML.cpp VideoFrameWidget.cpp VideoPlayerWidget.cpp ) -set(GENERATED_SOURCES - VideoPlayerWindowGML.h -) - serenity_app(VideoPlayer ICON app-video-player) target_link_libraries(VideoPlayer PRIVATE LibVideo LibAudio LibConfig LibCore LibGfx LibGUI LibMain LibFileSystemAccessClient) diff --git a/Userland/Applications/VideoPlayer/VideoFrameWidget.cpp b/Userland/Applications/VideoPlayer/VideoFrameWidget.cpp index bbeca22bb22935b..f219617b7b81b78 100644 --- a/Userland/Applications/VideoPlayer/VideoFrameWidget.cpp +++ b/Userland/Applications/VideoPlayer/VideoFrameWidget.cpp @@ -9,8 +9,6 @@ #include "VideoFrameWidget.h" -REGISTER_WIDGET(VideoPlayer, VideoFrameWidget); - namespace VideoPlayer { VideoFrameWidget::VideoFrameWidget() diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp index c6cc777ee6f82a0..4cf4d423997bc88 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp @@ -19,16 +19,14 @@ #include #include #include -#include #include "VideoPlayerWidget.h" namespace VideoPlayer { -ErrorOr> VideoPlayerWidget::try_create() +ErrorOr> VideoPlayerWidget::create() { - auto main_widget = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) VideoPlayerWidget())); - TRY(main_widget->load_from_gml(videoplayer_window_gml)); + auto main_widget = TRY(try_create()); TRY(main_widget->setup_interface()); diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWindow.gml b/Userland/Applications/VideoPlayer/VideoPlayerWidget.gml similarity index 86% rename from Userland/Applications/VideoPlayer/VideoPlayerWindow.gml rename to Userland/Applications/VideoPlayer/VideoPlayerWidget.gml index 162ea5f4699e95e..86c1977a1b6195f 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWindow.gml +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.gml @@ -1,4 +1,4 @@ -@GUI::Widget { +@VideoPlayer::VideoPlayerWidget { fill_with_background_color: true layout: @GUI::VerticalBoxLayout {} @@ -25,7 +25,7 @@ @GUI::Button { name: "playback" - icon: "/res/icons/16x16/play.png" + icon_from_path: "/res/icons/16x16/play.png" fixed_width: 24 button_style: "Coolbar" } @@ -41,7 +41,7 @@ @GUI::Button { name: "sizing" - icon: "/res/icons/16x16/fit-image-to-view.png" + icon_from_path: "/res/icons/16x16/fit-image-to-view.png" fixed_width: 24 button_style: "Coolbar" } @@ -59,7 +59,7 @@ @GUI::Button { name: "fullscreen" - icon: "/res/icons/16x16/fullscreen.png" + icon_from_path: "/res/icons/16x16/fullscreen.png" fixed_width: 24 button_style: "Coolbar" } diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.h b/Userland/Applications/VideoPlayer/VideoPlayerWidget.h index 745577b0459edde..3275bc5155d03ee 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.h +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.h @@ -25,6 +25,7 @@ class VideoPlayerWidget final : public GUI::Widget { public: static ErrorOr> try_create(); + static ErrorOr> create(); virtual ~VideoPlayerWidget() override = default; void close_file(); void open_file(FileSystemAccessClient::File filename); diff --git a/Userland/Applications/VideoPlayer/main.cpp b/Userland/Applications/VideoPlayer/main.cpp index 97d485548df71ea..58166dad1a35153 100644 --- a/Userland/Applications/VideoPlayer/main.cpp +++ b/Userland/Applications/VideoPlayer/main.cpp @@ -34,7 +34,7 @@ ErrorOr serenity_main(Main::Arguments arguments) TRY(Core::System::unveil("/res", "r")); TRY(Core::System::unveil(nullptr, nullptr)); - auto main_widget = TRY(VideoPlayer::VideoPlayerWidget::try_create()); + auto main_widget = TRY(VideoPlayer::VideoPlayerWidget::create()); window->set_main_widget(main_widget); main_widget->update_title(); TRY(main_widget->initialize_menubar(window));