Skip to content

Commit

Permalink
Applications: Port VideoPlayer to GML compilation
Browse files Browse the repository at this point in the history
This patch contributes to SerenityOS#20518
  • Loading branch information
tetektoza committed Oct 3, 2023
1 parent ed276e2 commit 054ae08
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 16 deletions.
7 changes: 2 additions & 5 deletions Userland/Applications/VideoPlayer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 0 additions & 2 deletions Userland/Applications/VideoPlayer/VideoFrameWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@

#include "VideoFrameWidget.h"

REGISTER_WIDGET(VideoPlayer, VideoFrameWidget);

namespace VideoPlayer {

VideoFrameWidget::VideoFrameWidget()
Expand Down
6 changes: 2 additions & 4 deletions Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@
#include <LibGUI/Toolbar.h>
#include <LibGUI/ToolbarContainer.h>
#include <LibGUI/Window.h>
#include <Userland/Applications/VideoPlayer/VideoPlayerWindowGML.h>

#include "VideoPlayerWidget.h"

namespace VideoPlayer {

ErrorOr<NonnullRefPtr<VideoPlayerWidget>> VideoPlayerWidget::try_create()
ErrorOr<NonnullRefPtr<VideoPlayerWidget>> 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());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@GUI::Widget {
@VideoPlayer::VideoPlayerWidget {
fill_with_background_color: true
layout: @GUI::VerticalBoxLayout {}

Expand All @@ -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"
}
Expand All @@ -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"
}
Expand All @@ -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"
}
Expand Down
1 change: 1 addition & 0 deletions Userland/Applications/VideoPlayer/VideoPlayerWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class VideoPlayerWidget final : public GUI::Widget {

public:
static ErrorOr<NonnullRefPtr<VideoPlayerWidget>> try_create();
static ErrorOr<NonnullRefPtr<VideoPlayerWidget>> create();
virtual ~VideoPlayerWidget() override = default;
void close_file();
void open_file(FileSystemAccessClient::File filename);
Expand Down
2 changes: 1 addition & 1 deletion Userland/Applications/VideoPlayer/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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::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));
Expand Down

0 comments on commit 054ae08

Please sign in to comment.