/* * Copyright (c) 2022, Gregory Bertilson * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include #include #include #include #include #include #include #include "VideoFrameWidget.h" namespace VideoPlayer { class VideoPlayerWidget final : public GUI::Widget { C_OBJECT_ABSTRACT(VideoPlayerWidget) public: static ErrorOr> try_create(); virtual ~VideoPlayerWidget() override = default; void close_file(); void open_file(StringView filename); void resume_playback(); void pause_playback(); void toggle_pause(); void update_title(); Video::PlaybackManager::SeekMode seek_mode(); void set_seek_mode(Video::PlaybackManager::SeekMode seek_mode); ErrorOr initialize_menubar(GUI::Window&); private: VideoPlayerWidget() = default; ErrorOr setup_interface(); void update_play_pause_icon(); void update_seek_slider_max(); void set_current_timestamp(Time); void set_time_label(Time); void on_decoding_error(Video::DecoderError const&); void cycle_sizing_modes(); void toggle_fullscreen(); virtual void drop_event(GUI::DropEvent&) override; DeprecatedString m_path; RefPtr m_video_display; RefPtr m_seek_slider; RefPtr m_play_icon; RefPtr m_pause_icon; RefPtr m_play_pause_action; RefPtr m_timestamp_label; RefPtr m_cycle_sizing_modes_action; RefPtr m_volume_slider; RefPtr m_use_fast_seeking; RefPtr m_toggle_fullscreen_action; OwnPtr m_sizing_mode_group; RefPtr m_size_fit_action; RefPtr m_size_fill_action; RefPtr m_size_stretch_action; RefPtr m_size_fullsize_action; OwnPtr m_playback_manager; bool m_was_playing_before_seek { false }; }; }