video sound works right and some alignment tweaks

This commit is contained in:
Chris Cochrun 2024-11-21 14:24:40 -06:00
parent e39fc92ea4
commit 0974024fe6

View file

@ -315,6 +315,11 @@ impl cosmic::Application for App {
match message { match message {
Message::Present(message) => { Message::Present(message) => {
let _ = self.presenter.update(message); let _ = self.presenter.update(message);
if self.presentation_open {
if let Some(video) = &mut self.presenter.video {
video.set_muted(false);
}
}
// self.core.nav_bar_toggle(); // self.core.nav_bar_toggle();
Task::none() Task::none()
} }
@ -356,6 +361,9 @@ impl cosmic::Application for App {
debug!(?id, "Window opened"); debug!(?id, "Window opened");
if id > self.core.main_window_id().unwrap() { if id > self.core.main_window_id().unwrap() {
self.presentation_open = true; self.presentation_open = true;
if let Some(video) = &mut self.presenter.video {
video.set_muted(false);
}
warn!(self.presentation_open); warn!(self.presentation_open);
window::change_mode(id, Mode::Fullscreen) window::change_mode(id, Mode::Fullscreen)
} else { } else {
@ -376,6 +384,9 @@ impl cosmic::Application for App {
cosmic::iced::exit() cosmic::iced::exit()
} else { } else {
self.presentation_open = false; self.presentation_open = false;
if let Some(video) = &mut self.presenter.video {
video.set_muted(true);
}
Task::none() Task::none()
} }
} }
@ -440,15 +451,15 @@ impl cosmic::Application for App {
.align_right(Length::Fill) .align_right(Length::Fill)
.width(Length::FillPortion(1)), .width(Length::FillPortion(1)),
Container::new(column![ Container::new(column![
Space::with_height(Length::Fill), Responsive::new(|size| {
Responsive::new(move |size| { debug!(?size);
let height = size.width * 9.0 / 16.0; let height = size.width * 9.0 / 16.0;
debug!(?height);
Container::new( Container::new(
self.presenter self.presenter
.view() .view()
.map(|m| Message::Present(m)), .map(|m| Message::Present(m)),
) )
.width(Length::Fill)
.height(height) .height(height)
.into() .into()
}), }),
@ -469,13 +480,10 @@ impl cosmic::Application for App {
] ]
.padding(5) .padding(5)
) )
.align_top(Length::Shrink)
.height(Length::Shrink)
.center_x(Length::Fill), .center_x(Length::Fill),
Space::with_height(Length::Fill)
]) ])
.center_y(Length::Fill) .center_y(Length::Fill)
.center_x(Length::FillPortion(3)), .width(Length::FillPortion(3)),
Container::new( Container::new(
button::icon(icon_right) button::icon(icon_right)
.icon_size(128) .icon_size(128)