Skip to content

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

fix(phone): Transitions and Filters have their shelves as pills, All first, so a phone reaches every one (#415)

Jareera1fd411befb2
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index f5653c0f..4d8a058b 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -9249,7 +9249,8 @@ impl Studio {
/// so the query goes.
pub fn library_group(&mut self, shelf: i32, index: i32) {
if let Some(view) = self.library_at(shelf) {
- view.group = index.max(0);
+ // -1 is every shelf at once: the phone's All pill.
+ view.group = index.max(-1);
view.category.clear();
view.query.clear();
view.favourites = false;
diff --git a/src/crates/concat/ui/phone/editor.slint b/src/crates/concat/ui/phone/editor.slint
index 2f25bc39..e4dbf6b6 100644
--- a/src/crates/concat/ui/phone/editor.slint
+++ b/src/crates/concat/ui/phone/editor.slint
@@ -12,7 +12,7 @@ import { Param, ParamFormat, SwitchRow } from "../inspector/controls.slint";
import { PreviewPane } from "../workspace/preview-pane.slint";
import { ContextMenu } from "../primitives/context-menu.slint";
import {
- CategoryPillBar, MediaCard, MediaItemData, PresetGrid, ShelfGrid, ShelfSearch,
+ CategoryPillBar, GroupPillBar, MediaCard, MediaItemData, PresetGrid, ShelfGrid, ShelfSearch,
} from "../workspace/media-pane.slint";
import {
AdjustPanel, AudioPanel, EnhancePanel, FilterPanel, Library, PresetStack, ProcessorRows,
@@ -1302,6 +1302,10 @@ export component PhoneEditor inherits Rectangle {
shelf: 0;
placeholder: I18n.t1("common.searchKind", I18n.t("mediaPane.filter"));
}
+ GroupPillBar {
+ shelf: 0;
+ groups: Editor.filter-groups;
+ }
ShelfGrid {
entries: Editor.catalogue-filters;
auditions: false;
@@ -1359,6 +1363,10 @@ export component PhoneEditor inherits Rectangle {
shelf: 3;
placeholder: I18n.t1("common.searchKind", I18n.t("mediaPane.transition"));
}
+ GroupPillBar {
+ shelf: 3;
+ groups: Editor.transition-groups;
+ }
ShelfGrid {
entries: Editor.catalogue-transitions;
glyph: Glyph.transition;
diff --git a/src/crates/concat/ui/workspace/media-pane.slint b/src/crates/concat/ui/workspace/media-pane.slint
index bfaba7fd..652a80c6 100644
--- a/src/crates/concat/ui/workspace/media-pane.slint
+++ b/src/crates/concat/ui/workspace/media-pane.slint
@@ -1499,6 +1499,61 @@ export component CategoryPillBar inherits Rectangle {
}
}
+// A kind's shelves as a strip of pills, All first: the phone's way to the
+// desktop's shelf strip. Without it a phone showed the first shelf alone,
+// and the first shelf of transitions holds a Dissolve and nothing else
+// (#415).
+export component GroupPillBar inherits Rectangle {
+ /// `Library.view`'s shelf: 0 filters, 1 effects, 2 audio, 3 transitions.
+ in property <int> shelf;
+ in property <[string]> groups;
+
+ height: 30px;
+ clip: true;
+
+ property <int> current: Library.view(root.shelf).group;
+ property <length> offset: 0px;
+ property <length> max-scroll: Math.max(0px, row.preferred-width - root.width);
+ property <length> press-x: 0px;
+ property <length> press-offset: 0px;
+
+ touch := TouchArea {
+ pointer-event(event) => {
+ if (event.kind == PointerEventKind.down) {
+ root.press-x = touch.mouse-x;
+ root.press-offset = root.offset;
+ }
+ }
+ moved => {
+ if (touch.pressed) {
+ root.offset = Math.max(-root.max-scroll, Math.min(0px, root.press-offset + touch.mouse-x - root.press-x));
+ }
+ }
+ scroll-event(event) => {
+ root.offset = Math.max(-root.max-scroll, Math.min(0px, root.offset + event.delta-x + event.delta-y));
+ return EventResult.accept;
+ }
+
+ row := HorizontalLayout {
+ x: Math.max(-root.max-scroll, Math.min(0px, root.offset));
+ y: 3px;
+ height: 24px;
+ spacing: 6px;
+
+ CategoryPill {
+ text: I18n.t("sounds.all");
+ selected: root.current < 0;
+ clicked => { Library.group-changed(root.shelf, -1); }
+ }
+ for label[index] in root.groups: CategoryPill {
+ text: label;
+ selected: root.current == index;
+ clicked => { Library.group-changed(root.shelf, index); }
+ }
+ }
+ }
+}
+
// The Presets shelf: the same auto-fill arithmetic as the other grids.
export component PresetGrid inherits Rectangle {
in property <[TextPresetData]> items;