diff options
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Applications/VideoPlayer/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp | 21 | ||||
-rw-r--r-- | Userland/Applications/VideoPlayer/VideoPlayerWidget.h | 2 |
3 files changed, 24 insertions, 1 deletions
diff --git a/Userland/Applications/VideoPlayer/CMakeLists.txt b/Userland/Applications/VideoPlayer/CMakeLists.txt index 86844c266d..20aaabd61d 100644 --- a/Userland/Applications/VideoPlayer/CMakeLists.txt +++ b/Userland/Applications/VideoPlayer/CMakeLists.txt @@ -17,4 +17,4 @@ set(GENERATED_SOURCES ) serenity_app(VideoPlayer ICON app-video-player) -target_link_libraries(VideoPlayer PRIVATE LibVideo LibAudio LibCore LibGfx LibGUI LibMain) +target_link_libraries(VideoPlayer PRIVATE LibVideo LibAudio LibCore LibGfx LibGUI LibMain LibFileSystemAccessClient) diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp index f390397ad4..a3315fac00 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include <LibFileSystemAccessClient/Client.h> #include <LibGUI/Action.h> #include <LibGUI/BoxLayout.h> #include <LibGUI/FilePicker.h> @@ -265,6 +266,26 @@ void VideoPlayerWidget::event(Core::Event& event) Widget::event(event); } +void VideoPlayerWidget::drop_event(GUI::DropEvent& event) +{ + event.accept(); + window()->move_to_front(); + + if (event.mime_data().has_urls()) { + auto urls = event.mime_data().urls(); + if (urls.is_empty()) + return; + if (urls.size() > 1) { + GUI::MessageBox::show_error(window(), "VideoPlayer can only view one clip at a time!"sv); + return; + } + auto response = FileSystemAccessClient::Client::the().request_file_read_only_approved(window(), urls.first().path()); + if (response.is_error()) + return; + open_file(response.value().filename()); + } +} + void VideoPlayerWidget::cycle_sizing_modes() { auto sizing_mode = m_video_display->sizing_mode(); diff --git a/Userland/Applications/VideoPlayer/VideoPlayerWidget.h b/Userland/Applications/VideoPlayer/VideoPlayerWidget.h index 3202430603..b99e8a2fae 100644 --- a/Userland/Applications/VideoPlayer/VideoPlayerWidget.h +++ b/Userland/Applications/VideoPlayer/VideoPlayerWidget.h @@ -53,6 +53,8 @@ private: void event(Core::Event&) override; + virtual void drop_event(GUI::DropEvent&) override; + DeprecatedString m_path; RefPtr<VideoFrameWidget> m_video_display; |