mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 04:27:44 +00:00
VideoPlayer: Port VideoPlayer to GML compilation
This commit is contained in:
parent
e26548989a
commit
1e11116d65
6 changed files with 10 additions and 16 deletions
|
@ -4,17 +4,14 @@ serenity_component(
|
||||||
DEPENDS AudioServer
|
DEPENDS AudioServer
|
||||||
)
|
)
|
||||||
|
|
||||||
stringify_gml(VideoPlayerWindow.gml VideoPlayerWindowGML.h videoplayer_window_gml)
|
compile_gml(VideoPlayerWidget.gml VideoPlayerWidgetGML.cpp)
|
||||||
|
|
||||||
set(SOURCES
|
set(SOURCES
|
||||||
main.cpp
|
main.cpp
|
||||||
|
VideoPlayerWidgetGML.cpp
|
||||||
VideoFrameWidget.cpp
|
VideoFrameWidget.cpp
|
||||||
VideoPlayerWidget.cpp
|
VideoPlayerWidget.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(GENERATED_SOURCES
|
|
||||||
VideoPlayerWindowGML.h
|
|
||||||
)
|
|
||||||
|
|
||||||
serenity_app(VideoPlayer ICON app-video-player)
|
serenity_app(VideoPlayer ICON app-video-player)
|
||||||
target_link_libraries(VideoPlayer PRIVATE LibVideo LibAudio LibConfig LibCore LibGfx LibGUI LibMain LibFileSystemAccessClient)
|
target_link_libraries(VideoPlayer PRIVATE LibVideo LibAudio LibConfig LibCore LibGfx LibGUI LibMain LibFileSystemAccessClient)
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
#include "VideoFrameWidget.h"
|
#include "VideoFrameWidget.h"
|
||||||
|
|
||||||
REGISTER_WIDGET(VideoPlayer, VideoFrameWidget);
|
|
||||||
|
|
||||||
namespace VideoPlayer {
|
namespace VideoPlayer {
|
||||||
|
|
||||||
VideoFrameWidget::VideoFrameWidget()
|
VideoFrameWidget::VideoFrameWidget()
|
||||||
|
|
|
@ -19,16 +19,14 @@
|
||||||
#include <LibGUI/Toolbar.h>
|
#include <LibGUI/Toolbar.h>
|
||||||
#include <LibGUI/ToolbarContainer.h>
|
#include <LibGUI/ToolbarContainer.h>
|
||||||
#include <LibGUI/Window.h>
|
#include <LibGUI/Window.h>
|
||||||
#include <Userland/Applications/VideoPlayer/VideoPlayerWindowGML.h>
|
|
||||||
|
|
||||||
#include "VideoPlayerWidget.h"
|
#include "VideoPlayerWidget.h"
|
||||||
|
|
||||||
namespace VideoPlayer {
|
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()));
|
auto main_widget = TRY(try_create());
|
||||||
TRY(main_widget->load_from_gml(videoplayer_window_gml));
|
|
||||||
|
|
||||||
TRY(main_widget->setup_interface());
|
TRY(main_widget->setup_interface());
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
@GUI::Widget {
|
@VideoPlayer::VideoPlayerWidget {
|
||||||
fill_with_background_color: true
|
fill_with_background_color: true
|
||||||
layout: @GUI::VerticalBoxLayout {}
|
layout: @GUI::VerticalBoxLayout {}
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
|
|
||||||
@GUI::Button {
|
@GUI::Button {
|
||||||
name: "playback"
|
name: "playback"
|
||||||
icon: "/res/icons/16x16/play.png"
|
icon_from_path: "/res/icons/16x16/play.png"
|
||||||
fixed_width: 24
|
fixed_width: 24
|
||||||
button_style: "Coolbar"
|
button_style: "Coolbar"
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@
|
||||||
|
|
||||||
@GUI::Button {
|
@GUI::Button {
|
||||||
name: "sizing"
|
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
|
fixed_width: 24
|
||||||
button_style: "Coolbar"
|
button_style: "Coolbar"
|
||||||
}
|
}
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
@GUI::Button {
|
@GUI::Button {
|
||||||
name: "fullscreen"
|
name: "fullscreen"
|
||||||
icon: "/res/icons/16x16/fullscreen.png"
|
icon_from_path: "/res/icons/16x16/fullscreen.png"
|
||||||
fixed_width: 24
|
fixed_width: 24
|
||||||
button_style: "Coolbar"
|
button_style: "Coolbar"
|
||||||
}
|
}
|
|
@ -25,6 +25,7 @@ class VideoPlayerWidget final : public GUI::Widget {
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ErrorOr<NonnullRefPtr<VideoPlayerWidget>> try_create();
|
static ErrorOr<NonnullRefPtr<VideoPlayerWidget>> try_create();
|
||||||
|
static ErrorOr<NonnullRefPtr<VideoPlayerWidget>> create();
|
||||||
virtual ~VideoPlayerWidget() override = default;
|
virtual ~VideoPlayerWidget() override = default;
|
||||||
void close_file();
|
void close_file();
|
||||||
void open_file(FileSystemAccessClient::File filename);
|
void open_file(FileSystemAccessClient::File filename);
|
||||||
|
|
|
@ -34,7 +34,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
TRY(Core::System::unveil("/res", "r"));
|
TRY(Core::System::unveil("/res", "r"));
|
||||||
TRY(Core::System::unveil(nullptr, nullptr));
|
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);
|
window->set_main_widget(main_widget);
|
||||||
main_widget->update_title();
|
main_widget->update_title();
|
||||||
TRY(main_widget->initialize_menubar(window));
|
TRY(main_widget->initialize_menubar(window));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue