mirror of
https://github.com/narrrl/proton-stream.git
synced 2026-11-03 16:41:26 +01:00
fix(app): stop from the full player, and keep fullscreen and speed in step
- The full player overlay had no Stop: Esc leaves the page and keeps playing, so ending an episode took a trip to the bar underneath. It has a Stop button now, and stopping from fullscreen leaves fullscreen. - `F` toggled the app's own idea of fullscreen, which the window manager could change behind it (F11, a title-bar double-click). The flag now follows the window. - The speed menu stopped at 2x while `]` went to 3x.
This commit is contained in:
1 parent
33da1563ee
commit
3ff55a9af9
3 files changed
+30
-1
No files matched your search
@@ -982,6 +982,10 @@ impl App {
|
|||||||
// — unless the next episode is already opening, which is
|
// — unless the next episode is already opening, which is
|
||||||
// exactly where the viewer wants to stay.
|
// exactly where the viewer wants to stay.
|
||||||
if self.page == Page::Player && self.opening.is_none() {
|
if self.page == Page::Player && self.opening.is_none() {
|
||||||
|
if self.fullscreen {
|
||||||
|
self.fullscreen = false;
|
||||||
|
ctx.send_viewport_cmd(egui::ViewportCommand::Fullscreen(false));
|
||||||
|
}
|
||||||
self.page = match target {
|
self.page = match target {
|
||||||
Some(key) => Page::Title(key),
|
Some(key) => Page::Title(key),
|
||||||
None => Page::Library,
|
None => Page::Library,
|
||||||
@@ -1854,6 +1858,11 @@ impl eframe::App for App {
|
|||||||
let ctx = ui.ctx().clone();
|
let ctx = ui.ctx().clone();
|
||||||
let ctx = &ctx;
|
let ctx = &ctx;
|
||||||
self.pump(ctx, frame);
|
self.pump(ctx, frame);
|
||||||
|
// The window manager can leave fullscreen without asking (F11, a
|
||||||
|
// double-click on a title bar), and `F` then toggled the wrong way.
|
||||||
|
if let Some(actual) = ctx.input(|input| input.viewport().fullscreen) {
|
||||||
|
self.fullscreen = actual;
|
||||||
|
}
|
||||||
// A window left open for days still picks up what was added: the
|
// A window left open for days still picks up what was added: the
|
||||||
// launch check alone would only ever run once.
|
// launch check alone would only ever run once.
|
||||||
let now = ctx.input(|input| input.time);
|
let now = ctx.input(|input| input.time);
|
||||||
|
|||||||
@@ -740,6 +740,25 @@ fn chrome(
|
|||||||
actions.push(Action::ToggleEpisodes);
|
actions.push(Action::ToggleEpisodes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Esc leaves the page and keeps playing; this is the one-step
|
||||||
|
// way to be done with the episode.
|
||||||
|
ui.add_space(theme::space::S);
|
||||||
|
if ui
|
||||||
|
.add(
|
||||||
|
egui::Button::new(
|
||||||
|
theme::Role::Subhead
|
||||||
|
.rich(egui_phosphor::regular::STOP)
|
||||||
|
.color(Color32::WHITE),
|
||||||
|
)
|
||||||
|
.fill(Color32::from_black_alpha(160))
|
||||||
|
.corner_radius(CornerRadius::same(theme::radius::MD))
|
||||||
|
.min_size(Vec2::new(38.0, 32.0)),
|
||||||
|
)
|
||||||
|
.on_hover_text("Stop")
|
||||||
|
.clicked()
|
||||||
|
{
|
||||||
|
actions.push(Action::Player(Command::Stop));
|
||||||
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -509,7 +509,8 @@ fn speed_menu(ui: &mut egui::Ui, playback: &Playback, actions: &mut Vec<Action>)
|
|||||||
format!("Speed · {}", ui::format_speed(playback.speed))
|
format!("Speed · {}", ui::format_speed(playback.speed))
|
||||||
};
|
};
|
||||||
ui.menu_button(label, |ui| {
|
ui.menu_button(label, |ui| {
|
||||||
for speed in [0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0] {
|
// The same steps `[` and `]` walk.
|
||||||
|
for speed in [0.5, 0.75, 1.0, 1.25, 1.5, 1.75, 2.0, 3.0] {
|
||||||
if ui
|
if ui
|
||||||
.selectable_label(
|
.selectable_label(
|
||||||
(playback.speed - speed).abs() < 1e-6,
|
(playback.speed - speed).abs() < 1e-6,
|
||||||
|
|||||||
Reference in new issue
Block a user