Show open with button when no media loaded, fixes #55

This commit is contained in:
Jeremy Soller 2025-01-19 10:19:47 -07:00
parent 5c6163eed7
commit 22c7a76f41
No known key found for this signature in database
GPG key ID: D02FD439211AF56F
2 changed files with 20 additions and 2 deletions

View file

@ -1,4 +1,6 @@
audio = Audio
no-video-or-audio-file-open = No video or audio file open
open-file = Open file
subtitles = Subtitles
# Context Pages

View file

@ -832,8 +832,24 @@ impl Application for App {
};
let Some(video) = &self.video_opt else {
//TODO: open button if no video?
return widget::container(widget::text("No video open"))
//TODO: use space variables
let column = widget::column::with_capacity(4)
.align_items(Alignment::Center)
.spacing(24)
.width(Length::Fill)
.height(Length::Fill)
.push(widget::vertical_space(Length::Fill))
.push(
widget::column::with_capacity(2)
.align_items(Alignment::Center)
.spacing(8)
.push(widget::icon::from_name("folder-symbolic").size(64))
.push(widget::text::body(fl!("no-video-or-audio-file-open"))),
)
.push(widget::button::suggested(fl!("open-file")).on_press(Message::FileOpen))
.push(widget::vertical_space(Length::Fill));
return widget::container(column)
.width(Length::Fill)
.height(Length::Fill)
.style(theme::Container::WindowBackground)