Skip to content

The truly free, open-source, local-first, cross-platform CapCut replacement. Scriptable through a JSON-RPC API & MCP.

fix(phone): Back closes the phone editor's own sheet before it leaves the project; and four inspector fixes from the audit

Jareer3e651f4f49de
diff --git a/src/crates/concat/ui/app.slint b/src/crates/concat/ui/app.slint
index f1a775b2..0b2a28a9 100644
--- a/src/crates/concat/ui/app.slint
+++ b/src/crates/concat/ui/app.slint
@@ -36,7 +36,7 @@ import { Editor } from "editor.slint";
import { PaneKind, Panes } from "workspace/pane-switcher.slint";
import { ChipOption, NewProjectDialog, RecentProjectData, StartData, StartScreen } from "start.slint";
import { TitleBar } from "title-bar.slint";
-import { PhoneEditor } from "phone/editor.slint";
+import { PhoneEditor, PhoneSheets } from "phone/editor.slint";
import {
AppliedEntryData, AppliedParamData, CatalogueEntryData, Library, LibraryViewData,
TransitionChoiceData,
@@ -540,6 +540,12 @@ export component App inherits Window {
return accept;
}
}
+ // The phone editor's own sheet - Effects, Text, a clip's tools -
+ // comes down before Back leaves the project.
+ if ((event.text == Key.Back || event.text == Key.Escape) && root.phone && PhoneSheets.open) {
+ PhoneSheets.close-asked += 1;
+ return accept;
+ }
// Back with nothing on top: the editor saves and goes back to
// the launch screen, as a phone editor's Back returns to its
// projects. On the launch screen it goes on up, and Android
diff --git a/src/crates/concat/ui/inspector/clip-inspector.slint b/src/crates/concat/ui/inspector/clip-inspector.slint
index f6d7dcda..fe7e775e 100644
--- a/src/crates/concat/ui/inspector/clip-inspector.slint
+++ b/src/crates/concat/ui/inspector/clip-inspector.slint
@@ -360,8 +360,13 @@ export component PresetStack inherits VerticalLayout {
VerticalLayout {
alignment: center;
- Switch {
- checked: item.on;
+ // The switch flips itself on a click, which
+ // ends a binding; it is set again whenever
+ // the document says otherwise - an undo.
+ switch := Switch {
+ property <bool> held: item.on;
+ checked: self.held;
+ changed held => { self.checked = self.held; }
toggled(on) => { root.toggle(index); }
}
}
diff --git a/src/crates/concat/ui/inspector/controls.slint b/src/crates/concat/ui/inspector/controls.slint
index fd82aef0..98c5011e 100644
--- a/src/crates/concat/ui/inspector/controls.slint
+++ b/src/crates/concat/ui/inspector/controls.slint
@@ -706,6 +706,9 @@ export component Note inherits HorizontalLayout {
export component SearchField inherits Rectangle {
in-out property <string> text;
in property <string> placeholder;
+ /// Esc goes on up rather than letting go of the keyboard: for a field
+ /// inside a popup, whose Esc closes the popup.
+ in property <bool> esc-passes: false;
callback edited(text: string);
@@ -762,7 +765,7 @@ export component SearchField inherits Rectangle {
// words stay; the cross clears them.
accepted => { Focus.release(); }
key-pressed(event) => {
- if (event.text == Key.Escape) {
+ if (event.text == Key.Escape && !root.esc-passes) {
Focus.release();
return EventResult.accept;
}
diff --git a/src/crates/concat/ui/inspector/font-picker.slint b/src/crates/concat/ui/inspector/font-picker.slint
index d0ab5bc3..d7cd9220 100644
--- a/src/crates/concat/ui/inspector/font-picker.slint
+++ b/src/crates/concat/ui/inspector/font-picker.slint
@@ -97,6 +97,7 @@ export component FontPicker inherits Rectangle {
search := SearchField {
placeholder: I18n.t("textPanel.searchFonts");
+ esc-passes: true;
edited(text) => { FontSearch.query-changed(text); }
init => { self.focus(); }
}
diff --git a/src/crates/concat/ui/phone/editor.slint b/src/crates/concat/ui/phone/editor.slint
index 80c1d28a..90bbf59c 100644
--- a/src/crates/concat/ui/phone/editor.slint
+++ b/src/crates/concat/ui/phone/editor.slint
@@ -326,6 +326,14 @@ component LaneChip inherits Rectangle {
}
}
+/// Whether a sheet is up in the phone editor, and a way to ask it down:
+/// Android's Back, which the window hears, closes it before it leaves the
+/// project - with Effects open, Back saved and went back to the projects.
+export global PhoneSheets {
+ in-out property <bool> open;
+ in-out property <int> close-asked;
+}
+
export component PhoneEditor inherits Rectangle {
in property <string> project-name;
/// "saved", "saving…": the little truth under the name.
@@ -341,6 +349,11 @@ export component PhoneEditor inherits Rectangle {
/// "adjustments", "transitions" - the project's own, and a "clip-" page
/// of the inspector for the selected clip.
property <string> sheet;
+ // Back closes the sheet on top before it leaves the editor; the window
+ // hears the key, so the sheet's state is told it through PhoneSheets.
+ changed sheet => { PhoneSheets.open = root.sheet != ""; }
+ property <int> close-asked: PhoneSheets.close-asked;
+ changed close-asked => { root.hide(); }
/// The Audio sheet's shelf: 0 my sounds, 1 voices, 2 styles.
property <int> audio-shelf;
/// The sheet up is one of the clip's, and goes with the clip.
diff --git a/src/crates/concat/ui/workspace/config-pane.slint b/src/crates/concat/ui/workspace/config-pane.slint
index 7128904d..073de42a 100644
--- a/src/crates/concat/ui/workspace/config-pane.slint
+++ b/src/crates/concat/ui/workspace/config-pane.slint
@@ -252,7 +252,15 @@ export component ConfigPane inherits Rectangle {
/// chain is not something to go looking for: its tab shows only on a
/// clip that already carries one - from an older project, a template,
/// the API - so that chain can still be seen, tuned and taken off.
- property <bool> has-chain: root.applied-visual.length > 0;
+ /// The colour panel's own package and the chroma key have homes of
+ /// their own (Adjust, the cutout), so they do not count as a chain: a
+ /// clip only graded or keyed has no Effects tab to go looking in.
+ pure function own-link(id: string) -> bool {
+ return id == "concat.adjust" || id == "concat.chroma-key";
+ }
+ property <bool> has-chain: root.applied-visual.length > 2
+ || (root.applied-visual.length > 0 && !root.own-link(root.applied-visual[0].id))
+ || (root.applied-visual.length > 1 && !root.own-link(root.applied-visual[1].id));
property <[string]> tabs: root.selected.batch-volume ? ["Audio"]
: root.is-text ? (root.has-chain ? ["Text", "Effects"] : ["Text"])
: root.is-layer ? ["Filter"]
@@ -795,7 +803,10 @@ export component ConfigPane inherits Rectangle {
noun: I18n.t("common.audioEffect");
library-title: I18n.t("configPane.audioEffects");
shelf: 2;
- hidden: ["concat.loudness", "concat.denoise", "concat.enhance-voice"];
+ // A sound layer has no Sound page with their switches,
+ // so its treatments are cards like any other link.
+ hidden: root.selected.kind == ClipKind.sound-layer ? []
+ : ["concat.loudness", "concat.denoise", "concat.enhance-voice"];
group-labels: root.audio-groups;
catalogue: root.catalogue-audio;
applied: root.applied-audio;