Skip to content

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

feat(library): every set of shelves has All, and a library opens on it

Jareer6466b9f7ecbe
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index e93596d9..02a85596 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -359,7 +359,7 @@ fn gcd(a: i64, b: i64) -> i64 {
/// the model a library renders arrives already narrowed, which is what lets
/// it be laid out as a grid - a tile's place is its index, and an index only
/// means a place when every entry in the model is one that shows.
-#[derive(Clone, Debug, Default)]
+#[derive(Clone, Debug)]
pub struct LibraryView {
/// The search box's text.
pub query: String,
@@ -371,6 +371,19 @@ pub struct LibraryView {
pub category: String,
}
+impl Default for LibraryView {
+ /// Every shelf at once: a library opens on All, not on whichever shelf
+ /// happens to be filed first.
+ fn default() -> Self {
+ LibraryView {
+ query: String::new(),
+ group: -1,
+ favourites: false,
+ category: String::new(),
+ }
+ }
+}
+
/// Which library a shelf index names. The numbers are the panel's own -
/// `PresetStack.shelf`, and `Library.view`'s shelf argument everywhere else -
/// and the order the tabs sit in.
diff --git a/src/crates/concat/ui/inspector/clip-inspector.slint b/src/crates/concat/ui/inspector/clip-inspector.slint
index 369f697a..a8475121 100644
--- a/src/crates/concat/ui/inspector/clip-inspector.slint
+++ b/src/crates/concat/ui/inspector/clip-inspector.slint
@@ -564,7 +564,39 @@ export component PresetStack inherits VerticalLayout {
// The shelves as pills on the panel, the Library pane's way,
// rather than a dark segmented track: picking one also leaves
- // the starred set, since a shelf is a different question.
+ // the starred set, since a shelf is a different question. All
+ // leads them, and is where a library opens.
+ for label[i] in [I18n.t("common.all")]: Rectangle {
+ property <bool> picked: !root.favourites-only && root.group == -1;
+ border-radius: 13px;
+ background: self.picked ? Theme.accent
+ : all-touch.has-hover ? Theme.field-hover : Theme.field;
+ min-width: all-text.preferred-width + 20px;
+ horizontal-stretch: 0;
+
+ animate background { duration: 120ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
+
+ all-text := Text {
+ text: label;
+ color: parent.picked ? Theme.on-accent
+ : all-touch.has-hover ? Theme.fg : Theme.fg-muted;
+ font-size: Theme.fs-sm;
+ font-weight: parent.picked ? Theme.weight-title : 400;
+ vertical-alignment: center;
+ horizontal-alignment: center;
+ }
+
+ all-touch := TouchArea {
+ mouse-cursor: pointer;
+ clicked => {
+ if (root.favourites-only) {
+ Library.favourites-changed(root.shelf, false);
+ }
+ Library.group-changed(root.shelf, -1);
+ }
+ }
+ }
+
for label[i] in root.group-labels: Rectangle {
property <bool> picked: !root.favourites-only && root.group == i;
border-radius: 13px;
diff --git a/src/crates/concat/ui/workspace/media-pane.slint b/src/crates/concat/ui/workspace/media-pane.slint
index 9133cf6c..ab19438b 100644
--- a/src/crates/concat/ui/workspace/media-pane.slint
+++ b/src/crates/concat/ui/workspace/media-pane.slint
@@ -2337,6 +2337,13 @@ export component MediaPane inherits Rectangle {
}
if root.transitions-open: VerticalLayout {
spacing: 1px;
+ // Every shelf at once, first and the default.
+ CategoryRow {
+ height: 24px;
+ label: I18n.t("common.all");
+ current: Library.view(3).group == -1;
+ clicked => { Library.group-changed(3, -1); }
+ }
for label[index] in root.transition-groups: CategoryRow {
height: 24px;
label: label;
@@ -2358,6 +2365,16 @@ export component MediaPane inherits Rectangle {
}
if root.effects-open: VerticalLayout {
spacing: 1px;
+ // Every shelf at once, first and the default.
+ CategoryRow {
+ height: 24px;
+ label: I18n.t("common.all");
+ current: !root.audio-shelf && Library.view(1).group == -1;
+ clicked => {
+ root.audio-shelf = false;
+ Library.group-changed(1, -1);
+ }
+ }
for label[index] in root.effect-groups: CategoryRow {
height: 24px;
label: label;
@@ -2376,6 +2393,16 @@ export component MediaPane inherits Rectangle {
}
if root.audio-open: VerticalLayout {
spacing: 1px;
+ // Every shelf at once, first and the default.
+ CategoryRow {
+ height: 24px;
+ label: I18n.t("common.all");
+ current: root.audio-shelf && Library.view(2).group == -1;
+ clicked => {
+ root.audio-shelf = true;
+ Library.group-changed(2, -1);
+ }
+ }
for label[index] in root.audio-groups: CategoryRow {
height: 24px;
label: label;
@@ -2401,6 +2428,13 @@ export component MediaPane inherits Rectangle {
}
if root.filters-open: VerticalLayout {
spacing: 1px;
+ // Every shelf at once, first and the default.
+ CategoryRow {
+ height: 24px;
+ label: I18n.t("common.all");
+ current: Library.view(0).group == -1;
+ clicked => { Library.group-changed(0, -1); }
+ }
for label[index] in root.filter-groups: CategoryRow {
height: 24px;
label: label;