app: open a clip view from a card and after an export

The grid answers what was exported; the view answers this one clip.
It plays the file muted and looping, with a transport under it, and a
panel on the right for the title and the share.

The title is the file's name, because a file is the only place a clip
keeps one: saving renames it, the miniature follows, and the grid
shows the new name. Share puts the file itself on the clipboard, so
pasting it into a chat attaches the video. The card's share button
does the same now, and an export that finishes opens the view it
produced.
This commit is contained in:
vhaudiquet committed 2026-11-22 19:20:16 +01:00
1 parent 146256714b
commit 9ce2b75568
8 files changed
+491 -13

No files matched your search

+31 -4
View File
@@ -22,6 +22,7 @@ pub enum Screen {
Settings,
History,
Clips,
Clip,
Review,
}
@@ -142,6 +143,10 @@ pub struct App {
/// Every clip the user exported, newest first. Read when the screen opens.
pub clips: Vec<Clip>,
pub clips_loaded: bool,
/// The open clip: its view, with the title being set and its player.
pub clip: Option<screens::clip::ClipView>,
/// A clip waiting for the clipboard: its file. Handled off the handler, in poll.
pub share_clip: Option<PathBuf>,
/// The clips' miniatures, decoded off the render path and cached by file.
pub thumbs: Option<rune::ImageCache>,
/// A miniature on its way: the clip's name and the file that holds it.
@@ -205,6 +210,8 @@ impl App {
menu_open: None,
clips: Vec::new(),
clips_loaded: false,
clip: None,
share_clip: None,
thumbs: None,
thumbs_rx: None,
clips_menu_open: None,
@@ -938,9 +945,14 @@ impl App {
// Keep the clock running so the status stays live even when nothing draws.
tx.wake_after(Duration::from_millis(1000));
// The clip view plays its file; leaving the screen behind stops it with the view.
if self.screen != Screen::Clip && self.clip.take().is_some() {
changed = true;
}
if self.screen == Screen::Review {
changed |= screens::review::tick(self, tx);
}
changed |= screens::clip::tick(self, tx);
changed
}
}
@@ -990,6 +1002,11 @@ pub fn on_key(app: &mut App, event: &KeyEvent, _tx: &mut Tx) -> bool {
app.clips_menu_open = None;
true
}
(Key::Escape, _) if app.screen == Screen::Clip => {
app.menu_open = None;
app.screen = Screen::Clips;
true
}
(Key::Escape, _) if app.screen == Screen::Clips => {
app.menu_open = None;
app.screen = Screen::History;
@@ -1080,18 +1097,27 @@ fn titlebar(p: Paint, app: &App) -> El {
let mut leading = row().key("leading").gap(8.0).center_y();
if matches!(
app.screen,
Screen::Settings | Screen::Clips | Screen::Review
Screen::Settings | Screen::Clips | Screen::Clip | Screen::Review
) {
let from_clip = app.screen == Screen::Clip;
leading = leading.child(ui::button(
p,
"back",
"← Match history",
if from_clip {
"← Clips"
} else {
"← Match history"
},
false,
|app: &mut App| {
if app.screen == Screen::Review {
screens::review::leave(app);
}
app.screen = Screen::History;
app.screen = if app.screen == Screen::Clip {
Screen::Clips
} else {
Screen::History
};
},
));
}
@@ -1105,7 +1131,7 @@ fn titlebar(p: Paint, app: &App) -> El {
// On the settings screen the title bar has nothing to offer: refreshing and opening
// settings again would only repeat what the screen already does.
if app.screen != Screen::Settings {
if app.screen != Screen::Clips {
if !matches!(app.screen, Screen::Clips | Screen::Clip) {
actions = actions.child(ui::button(
p,
"open-clips",
@@ -1201,6 +1227,7 @@ pub fn view(app: &App, cx: &mut Cx<App>) -> El {
Screen::Settings => screens::settings::view(app, p),
Screen::History => screens::history::view(app, p, &mut overlays),
Screen::Clips => screens::clips::view(app, p, &mut overlays),
Screen::Clip => screens::clip::view(app, p),
Screen::Review => screens::review::view(app, p),
};
let mut main = col().key("main").grow(1.0).min_h(0.0).w_full().fill(p.t.bg);