Skip to content

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

feat(ui): Settings fits a phone: the whole screen, its pages as tabs, every model row whole (#354, #355)

Jareere76ea4877ddd
diff --git a/src/crates/concat/ui/app.slint b/src/crates/concat/ui/app.slint
index 8dae454f..bbec6c28 100644
--- a/src/crates/concat/ui/app.slint
+++ b/src/crates/concat/ui/app.slint
@@ -171,6 +171,10 @@ export component App inherits Window {
/// strip, no dock - and the launch screen carries its own verbs, as it
/// does whenever it is narrow. Set once from Rust; see platform::phone.
in property <bool> phone;
+ /// A sheet with pages of its own is the whole window, inside its safe
+ /// area, on a phone and in any window too narrow for it to float as a
+ /// card with room around it.
+ property <bool> sheets-fill: root.phone || root.width < 600px;
/// The File / Edit / View menus. Built in Rust like every other menu here,
/// because what belongs on them depends on the project.
@@ -676,6 +680,11 @@ export component App inherits Window {
// scrim keeps the rail from being pressed — so the order between the two
// decides nothing and this one reads first because it comes first.
NewProjectDialog {
+ fill: root.sheets-fill;
+ inset-top: root.safe-area-insets.top;
+ inset-bottom: root.safe-area-insets.bottom;
+ inset-left: root.safe-area-insets.left;
+ inset-right: root.safe-area-insets.right;
x: 0;
y: 0;
width: root.width;
@@ -733,6 +742,11 @@ export component App inherits Window {
}
SettingsDialog {
+ fill: root.sheets-fill;
+ inset-top: root.safe-area-insets.top;
+ inset-bottom: root.safe-area-insets.bottom;
+ inset-left: root.safe-area-insets.left;
+ inset-right: root.safe-area-insets.right;
x: 0;
y: 0;
width: root.width;
@@ -783,6 +797,11 @@ export component App inherits Window {
callback relink-dismiss();
ProjectDialog {
+ fill: root.sheets-fill;
+ inset-top: root.safe-area-insets.top;
+ inset-bottom: root.safe-area-insets.bottom;
+ inset-left: root.safe-area-insets.left;
+ inset-right: root.safe-area-insets.right;
x: 0;
y: 0;
width: root.width;
@@ -801,6 +820,11 @@ export component App inherits Window {
}
RelinkDialog {
+ fill: root.sheets-fill;
+ inset-top: root.safe-area-insets.top;
+ inset-bottom: root.safe-area-insets.bottom;
+ inset-left: root.safe-area-insets.left;
+ inset-right: root.safe-area-insets.right;
data: root.relink;
relink-all => { root.relink-all(); }
dismiss => { root.relink-dismiss(); }
@@ -813,6 +837,10 @@ export component App inherits Window {
callback confirm-dismissed();
ConfirmDialog {
+ inset-top: root.safe-area-insets.top;
+ inset-bottom: root.safe-area-insets.bottom;
+ inset-left: root.safe-area-insets.left;
+ inset-right: root.safe-area-insets.right;
x: 0;
y: 0;
width: root.width;
@@ -824,6 +852,11 @@ export component App inherits Window {
CaptionsDialog {
+ fill: root.sheets-fill;
+ inset-top: root.safe-area-insets.top;
+ inset-bottom: root.safe-area-insets.bottom;
+ inset-left: root.safe-area-insets.left;
+ inset-right: root.safe-area-insets.right;
x: 0;
y: 0;
width: root.width;
@@ -843,6 +876,11 @@ export component App inherits Window {
}
SpeechDialog {
+ fill: root.sheets-fill;
+ inset-top: root.safe-area-insets.top;
+ inset-bottom: root.safe-area-insets.bottom;
+ inset-left: root.safe-area-insets.left;
+ inset-right: root.safe-area-insets.right;
x: 0;
y: 0;
width: root.width;
diff --git a/src/crates/concat/ui/dialogs/settings.slint b/src/crates/concat/ui/dialogs/settings.slint
index 1c62d5d3..26d328c0 100644
--- a/src/crates/concat/ui/dialogs/settings.slint
+++ b/src/crates/concat/ui/dialogs/settings.slint
@@ -110,8 +110,65 @@ component Pips inherits HorizontalLayout {
}
}
+// A model's quality, its size and what can be done with it: at the end of
+// its row on a wide sheet, on a line of its own under the name on a narrow
+// one, where `spread` puts the button against the far edge.
+component ModelMeta inherits HorizontalLayout {
+ in property <ModelData> model;
+ in property <bool> spread;
+
+ callback download();
+ callback cancel();
+ callback remove();
+
+ spacing: 10px;
+
+ VerticalLayout {
+ alignment: center;
+ Pips { value: root.model.accuracy; }
+ }
+
+ VerticalLayout {
+ alignment: center;
+ Text {
+ text: root.model.size;
+ color: Theme.fg-dim;
+ font-family: Theme.font-technical;
+ font-size: Theme.fs-sm;
+ }
+ }
+
+ if root.spread: Rectangle { horizontal-stretch: 1; }
+
+ VerticalLayout {
+ alignment: center;
+
+ if root.model.downloading: Button {
+ label: I18n.t("common.cancel");
+ glyph: Glyph.close;
+ ghost: true;
+ clicked => { root.cancel(); }
+ }
+
+ if !root.model.downloading && root.model.installed: Button {
+ label: I18n.t("common.remove");
+ glyph: Glyph.trash;
+ danger: true;
+ clicked => { root.remove(); }
+ }
+
+ if !root.model.downloading && !root.model.installed: Button {
+ label: I18n.t("settings.download");
+ glyph: Glyph.import;
+ clicked => { root.download(); }
+ }
+ }
+}
+
component ModelRow inherits Rectangle {
in property <ModelData> model;
+ /// A narrow sheet: the controls go on a line under the name.
+ in property <bool> compact;
callback activated();
callback download();
@@ -206,49 +263,28 @@ component ModelRow inherits Rectangle {
text: root.model.note;
color: Theme.fg-muted;
font-size: Theme.fs-sm;
+ wrap: root.compact ? TextWrap.word-wrap : TextWrap.no-wrap;
overflow: elide;
}
}
- VerticalLayout {
- alignment: center;
- Pips { value: root.model.accuracy; }
- }
-
- VerticalLayout {
- alignment: center;
- Text {
- text: root.model.size;
- color: Theme.fg-dim;
- font-family: Theme.font-technical;
- font-size: Theme.fs-sm;
- }
+ if !root.compact: ModelMeta {
+ model: root.model;
+ download => { root.download(); }
+ cancel => { root.cancel(); }
+ remove => { root.remove(); }
}
+ }
- VerticalLayout {
- alignment: center;
-
- if root.model.downloading: Button {
- label: I18n.t("common.cancel");
- glyph: Glyph.close;
- ghost: true;
- clicked => { root.cancel(); }
- }
-
- if !root.model.downloading && root.model.installed: Button {
- label: I18n.t("common.remove");
- glyph: Glyph.trash;
- danger: true;
- clicked => { root.remove(); }
- }
-
- if !root.model.downloading && !root.model.installed: Button {
- label: I18n.t("settings.download");
- glyph: Glyph.import;
- clicked => { root.download(); }
- }
-
- }
+ // Narrow, the quality, the size and the button go under the name, so
+ // the name and its note have the row's whole width.
+ if root.compact: ModelMeta {
+ padding-left: 26px;
+ spread: true;
+ model: root.model;
+ download => { root.download(); }
+ cancel => { root.cancel(); }
+ remove => { root.remove(); }
}
if root.model.downloading: VerticalLayout {
@@ -489,6 +525,24 @@ export component SettingsDialog inherits Modal {
/// what drags it.
in property <bool> phone;
+ /// Too narrow for a column of pages beside the page: a phone, a tablet
+ /// held upright in a small window, a narrow desk window. The pages are
+ /// a row of tabs across the top instead, the page has the whole width,
+ /// and a model's row puts its controls under its name.
+ property <bool> compact: root.width < 600px;
+
+ /// Every page, in order; the column and the row of tabs are drawn from
+ /// the same list. `desk` is a page a phone does not show.
+ property <[{label: string, glyph: Glyph, page: int, desk: bool}]> page-list: [
+ {label: I18n.t("settings.general"), glyph: Glyph.settings, page: 0, desk: false},
+ {label: I18n.t("settings.appearance"), glyph: Glyph.sun, page: 1, desk: false},
+ {label: I18n.t("common.transcriber"), glyph: Glyph.waveform, page: 2, desk: false},
+ {label: I18n.t("common.speech"), glyph: Glyph.music, page: 3, desk: false},
+ {label: I18n.t("settings.automation"), glyph: Glyph.lock, page: 4, desk: true},
+ {label: I18n.t("settings.version"), glyph: Glyph.tag, page: 6, desk: true},
+ {label: I18n.t("settings.about"), glyph: Glyph.sparkle, page: 5, desk: false},
+ ];
+
/// The column of pages' width, as the hairline beside it was last left.
/// In-out because it is dragged; what is drawn is `pages` below, which
/// keeps it inside the room the sheet has.
@@ -558,11 +612,42 @@ export component SettingsDialog inherits Modal {
/// - whose sheet is its screen - keeps most of the width for the
/// page. See `headers-w` in the timeline pane, which has the
/// same problem for the same reason.
- property <length> pages: Math.max(root.min-pages,
+ property <length> pages: root.compact ? 0px : Math.max(root.min-pages,
Math.min(root.pages-w, self.width * 0.4));
+ /// The row of tabs' height, when the pages are a row.
+ property <length> strip: root.compact ? 46px : 0px;
- // ── the pages ────────────────────────────────────────────────
- Rectangle {
+ // ── the pages, as a row of tabs across the top ───────────────
+ if root.compact: Rectangle {
+ x: 0;
+ y: 0;
+ width: parent.width;
+ height: body.strip;
+
+ Flickable {
+ content-width: Math.max(self.width, tabs.preferred-width);
+ content-height: self.height;
+
+ tabs := HorizontalLayout {
+ padding: 8px;
+ spacing: 4px;
+ alignment: start;
+
+ for entry in root.page-list: PageTab {
+ visible: !(entry.desk && root.phone);
+ min-width: self.preferred-width;
+ label: entry.label;
+ glyph: entry.glyph;
+ current: root.data.tab == entry.page;
+ clicked => { root.page-changed(entry.page); }
+ }
+ }
+ }
+
+ }
+
+ // ── the pages, as a column ───────────────────────────────────
+ if !root.compact: Rectangle {
x: 0;
y: 0;
width: body.pages;
@@ -574,47 +659,12 @@ export component SettingsDialog inherits Modal {
spacing: 2px;
alignment: start;
- PageTab {
- label: I18n.t("settings.general");
- glyph: Glyph.settings;
- current: root.data.tab == 0;
- clicked => { root.page-changed(0); }
- }
- PageTab {
- label: I18n.t("settings.appearance");
- glyph: Glyph.sun;
- current: root.data.tab == 1;
- clicked => { root.page-changed(1); }
- }
- PageTab {
- label: I18n.t("common.transcriber");
- glyph: Glyph.waveform;
- current: root.data.tab == 2;
- clicked => { root.page-changed(2); }
- }
- PageTab {
- label: I18n.t("common.speech");
- glyph: Glyph.music;
- current: root.data.tab == 3;
- clicked => { root.page-changed(3); }
- }
- if !root.phone: PageTab {
- label: I18n.t("settings.automation");
- glyph: Glyph.lock;
- current: root.data.tab == 4;
- clicked => { root.page-changed(4); }
- }
- if !root.phone: PageTab {
- label: I18n.t("settings.version");
- glyph: Glyph.tag;
- current: root.data.tab == 6;
- clicked => { root.page-changed(6); }
- }
- PageTab {
- label: I18n.t("settings.about");
- glyph: Glyph.sparkle;
- current: root.data.tab == 5;
- clicked => { root.page-changed(5); }
+ for entry in root.page-list: PageTab {
+ visible: !(entry.desk && root.phone);
+ label: entry.label;
+ glyph: entry.glyph;
+ current: root.data.tab == entry.page;
+ clicked => { root.page-changed(entry.page); }
}
}
}
@@ -622,7 +672,7 @@ export component SettingsDialog inherits Modal {
// The hairline between the two, and the handle that moves it:
// the one the panes size their columns by. Wider to take hold
// of on a phone.
- HairlineSplitter {
+ if !root.compact: HairlineSplitter {
x: body.pages;
y: 0;
height: parent.height;
@@ -637,14 +687,15 @@ export component SettingsDialog inherits Modal {
// ── the page ─────────────────────────────────────────────────────
PaneScroll {
- x: body.pages + 1px;
- y: 0;
- width: Math.max(0px, body.width - body.pages - 1px);
- height: parent.height;
+ x: root.compact ? 0px : body.pages + 1px;
+ y: body.strip;
+ width: root.compact ? body.width : Math.max(0px, body.width - body.pages - 1px);
+ height: parent.height - body.strip;
finger: root.phone;
if root.data.tab == 0: VerticalLayout {
DialogSection {
+ ruled: false;
first: true;
title: I18n.t("settings.language");
@@ -663,6 +714,7 @@ export component SettingsDialog inherits Modal {
// the environment overrides this for one run.
// https://github.com/jub0t/Concat/issues/223
DialogSection {
+ ruled: false;
title: I18n.t("settings.logLevel");
hint: I18n.t("settings.logLevelHint");
@@ -684,6 +736,7 @@ export component SettingsDialog inherits Modal {
// timeline of the mainstream editors, asked for in
// https://github.com/jub0t/Concat/issues/106
DialogSection {
+ ruled: false;
title: I18n.t("common.magneticTimeline");
hint: I18n.t("settings.deletingClipPullsWhat");
switchable: true;
@@ -696,6 +749,7 @@ export component SettingsDialog inherits Modal {
// the last clip included, so a clip can be placed out there.
// On, it stops where the content does.
DialogSection {
+ ruled: false;
title: I18n.t("settings.playhead");
hint: I18n.t("settings.offClickRulerPast");
switchable: true;
@@ -708,6 +762,7 @@ export component SettingsDialog inherits Modal {
// larger than HD gets a smaller copy, written once in the
// background, which Half and Quarter play from.
DialogSection {
+ ruled: false;
title: I18n.t("settings.proxies");
hint: I18n.t("settings.proxiesHint");
switchable: true;
@@ -720,6 +775,7 @@ export component SettingsDialog inherits Modal {
// they stay reachable; where a download looks first is a
// matter of where you are. Every source is still tried.
DialogSection {
+ ruled: false;
title: I18n.t("settings.downloads");
hint: I18n.t("settings.modelsFetchedFirstTime");
choices: [
@@ -759,6 +815,7 @@ export component SettingsDialog inherits Modal {
// stays the one place a remembered preference will be written.
if root.data.tab == 1: VerticalLayout {
DialogSection {
+ ruled: false;
first: true;
title: I18n.t("settings.theme");
@@ -777,6 +834,7 @@ export component SettingsDialog inherits Modal {
// the row: a dot is a colour, not a word, and the word is
// what the settings file remembers.
DialogSection {
+ ruled: false;
title: I18n.t("settings.accent");
HorizontalLayout {
@@ -856,6 +914,7 @@ export component SettingsDialog inherits Modal {
// accent is, and the hex is always shown: what the line is
// wearing is the whole point of the row.
DialogSection {
+ ruled: false;
title: I18n.t("settings.playhead");
hint: I18n.t("settings.lineAcrossLanesMarks");
@@ -936,6 +995,7 @@ export component SettingsDialog inherits Modal {
// to apply it (lib.rs, `on_settings_scale_changed`).
// https://github.com/jub0t/Concat/issues/320
if !root.phone: DialogSection {
+ ruled: false;
title: I18n.t("settings.scale");
hint: I18n.t("settings.scaleHint");
@@ -952,10 +1012,12 @@ export component SettingsDialog inherits Modal {
if root.data.tab == 2: VerticalLayout {
DialogSection {
+ ruled: false;
first: true;
title: I18n.t("settings.models");
for model in root.transcribers: ModelRow {
+ compact: root.compact;
model: model;
activated => { root.model-activated(model.id); }
download => { root.model-download(model.id); }
@@ -993,10 +1055,12 @@ export component SettingsDialog inherits Modal {
if root.data.tab == 3: VerticalLayout {
DialogSection {
+ ruled: false;
first: true;
title: I18n.t("settings.voices");
for model in root.voices: ModelRow {
+ compact: root.compact;
model: model;
activated => { root.model-activated(model.id); }
download => { root.model-download(model.id); }
@@ -1012,6 +1076,7 @@ export component SettingsDialog inherits Modal {
// what that opens.
if root.data.tab == 4 && !root.phone: VerticalLayout {
DialogSection {
+ ruled: false;
first: true;
title: I18n.t("settings.scriptsAndApps");
hint: I18n.t("settings.servesConcatApiWhile");
@@ -1029,6 +1094,8 @@ export component SettingsDialog inherits Modal {
}
DialogSection {
+
+ ruled: false;
title: I18n.t("settings.address");
hint: I18n.t("settings.localAddressWarning");
@@ -1077,6 +1144,8 @@ export component SettingsDialog inherits Modal {
}
DialogSection {
+
+ ruled: false;
title: I18n.t("settings.token");
hint: I18n.t("settings.whatConnectionMustPresent");
@@ -1116,6 +1185,7 @@ export component SettingsDialog inherits Modal {
// its updating.
if root.data.tab == 6 && !root.phone: VerticalLayout {
DialogSection {
+ ruled: false;
first: true;
title: I18n.t("settings.version");
@@ -1151,6 +1221,8 @@ export component SettingsDialog inherits Modal {
}
DialogSection {
+
+ ruled: false;
title: I18n.t("settings.switchVersion");
hint: I18n.t("settings.switchVersionNote");
@@ -1214,6 +1286,7 @@ export component SettingsDialog inherits Modal {
// and the FFmpeg it links are rows of the table below, where
// a report reads them from.
DialogSection {
+ ruled: false;
first: true;
title: I18n.t("settings.about");
diff --git a/src/crates/concat/ui/phone/editor.slint b/src/crates/concat/ui/phone/editor.slint
index c3a82e23..c46d9ccd 100644
--- a/src/crates/concat/ui/phone/editor.slint
+++ b/src/crates/concat/ui/phone/editor.slint
@@ -331,7 +331,7 @@ export component PhoneEditor inherits Rectangle {
Rectangle {
width: export-label.preferred-width + export-icon.width + 32px;
height: 36px;
- border-radius: 18px;
+ border-radius: Theme.r;
background: export-touch.pressed ? Theme.accent-hover : Theme.accent;
animate background { duration: 100ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
diff --git a/src/crates/concat/ui/primitives/modal.slint b/src/crates/concat/ui/primitives/modal.slint
index 3db1aca2..ae4a81c0 100644
--- a/src/crates/concat/ui/primitives/modal.slint
+++ b/src/crates/concat/ui/primitives/modal.slint
@@ -28,13 +28,24 @@ export component Modal inherits Rectangle {
/// Zero fits the content, which is what a short dialog wants; a fixed
/// height is for the ones with their own scrolling body.
in property <length> surface-height: 0px;
+ /// The sheet is the window, inside its safe area, rather than a card
+ /// floating in it: what a phone or a narrow window wants for a sheet
+ /// with pages of its own, where a card left a third of the screen to
+ /// the scrim. A short dialog - a question - stays a card.
+ in property <bool> fill;
+ /// How far the system's bars reach into the window on each side (the
+ /// window's safe-area-insets; zero on a desk). The sheet stays inside.
+ in property <length> inset-top;
+ in property <length> inset-bottom;
+ in property <length> inset-left;
+ in property <length> inset-right;
callback closed();
visible: root.open;
// Dark rather than blurred: Slint has no backdrop filter, and a scrim that
// only dims is honest about that where a fake blur would not be.
- background: Theme.overlay;
+ background: root.fill ? Theme.panel : Theme.overlay;
// Declared first, so the surface and everything in it sits above and takes
// its own presses. A click that lands here landed outside the dialog.
@@ -46,21 +57,26 @@ export component Modal inherits Rectangle {
}
}
+ /// The room inside the system's bars.
+ property <length> room-w: root.width - root.inset-left - root.inset-right;
+ property <length> room-h: root.height - root.inset-top - root.inset-bottom;
+
surface := Rectangle {
- x: (parent.width - self.width) / 2;
- y: (parent.height - self.height) / 2;
- // Never wider or taller than the window less a margin: a phone held
- // upright is narrower than any sheet's width, and a sheet that runs
- // off both edges cannot be read or dismissed. On a desk the window's
- // minimum is past every sheet's size, so this decides nothing there.
- width: Math.min(root.surface-width, root.width - 24px);
- height: Math.min(
+ x: root.inset-left + (root.room-w - self.width) / 2;
+ y: root.inset-top + (root.room-h - self.height) / 2;
+ // Filling, the room inside the bars. Otherwise never wider or taller
+ // than that room less a margin: a phone held upright is narrower than
+ // any sheet's width, and a sheet that runs off both edges cannot be
+ // read or dismissed. On a desk the window's minimum is past every
+ // sheet's size, so this decides nothing there.
+ width: root.fill ? root.room-w : Math.min(root.surface-width, root.room-w - 24px);
+ height: root.fill ? root.room-h : Math.min(
root.surface-height > 0px ? root.surface-height : body.preferred-height,
- root.height - 24px);
+ root.room-h - 24px);
background: Theme.panel;
- border-width: 1px;
+ border-width: root.fill ? 0px : 1px;
border-color: Theme.line-strong;
- border-radius: Theme.r-xl;
+ border-radius: root.fill ? 0px : Theme.r-xl;
clip: true;
// Swallows presses that land on the dialog, so they do not reach the
@@ -396,6 +412,9 @@ export component DialogSection inherits VerticalLayout {
in-out property <bool> open: true;
/// suppress the leading hairline, for the first group in a sheet
in property <bool> first;
+ /// A hairline above the group, setting it off from the one before. Off,
+ /// the groups are told apart by a gap alone, as the Settings sheet's are.
+ in property <bool> ruled: true;
/// The paragraph that would otherwise sit under the controls, moved to
/// a question mark beside the title: read on hover, out of the way
/// otherwise.
@@ -419,10 +438,13 @@ export component DialogSection inherits VerticalLayout {
in property <int> choice;
callback chose(index: int);
- if !root.first: Rectangle {
+ if !root.first && root.ruled: Rectangle {
height: 1px;
background: Theme.line;
}
+ if !root.first && !root.ruled: Rectangle {
+ height: 6px;
+ }
// The header band. Tight to the title, because the gap under it is the
// header's leftover height plus the body's top padding, and the two