Skip to content

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

feat(ui): rebuild the launch screen as a launcher

Jareer98a3bbe1445a
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index bd08f55e..1cfab7b4 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -224,9 +224,13 @@ sequenceDiagram
device (`concat/src/gpu.rs`), so a frame is a texture Slint samples with no
readback. Drawing happens on the event-loop thread only; decoding on a
worker.
-- **The launch screen** (`concat/ui/start.slint`) takes three shapes by
- width: recents beside the form, under it, or the phone shape with stacked
- labels and full-width controls.
+- **The launch screen** (`concat/ui/start.slint`) is a launcher: a rail of
+ verbs, and beside it either the new-project form or the whole recent list.
+ It takes three shapes by width — the rail with its words, the rail as
+ icons only, or the phone shape, where the rail becomes a bar of tabs above
+ the content and every label sits over its value. The form's frame is a
+ shape and a size rather than a fixed list; `frame_size` in `studio.rs`
+ is the one place that turns the pair into pixels.
## 6. The document, undo and the file
diff --git a/scripts/locales.py b/scripts/locales.py
index 0d8fc1bf..931b1db9 100755
--- a/scripts/locales.py
+++ b/scripts/locales.py
@@ -6,11 +6,12 @@
scripts/locales.py --check # report what each locale lacks; exit 1 on
# a key no source asks for
-Every string a person reads passes through `I18n.t("...")` in the .slint
-tree or `t("...")` / `tf("...")` in the window's Rust, with the English as
-the key. This script collects those keys, plus the names the effect
-packages and text presets carry in their manifests (they are looked up the
-same way), and writes them to en.json with each key as its own value.
+Every string a person reads passes through `I18n.t("...")` or
+`I18n.upper("...")` in the .slint tree, or `t("...")` / `tf("...")` in the
+window's Rust, with the English as the key. This script collects those
+keys, plus the names the effect packages and text presets carry in their
+manifests (they are looked up the same way), and writes them to en.json
+with each key as its own value.
That file is the inventory a translator starts from; see TRANSLATING.md.
"""
import json
@@ -25,7 +26,7 @@ PACKAGES = ROOT / "src" / "crates" / "concat-effects" / "packages"
# A Rust or Slint string literal, with its escapes.
LITERAL = r'"((?:[^"\\]|\\.)*)"'
-SLINT_CALL = re.compile(r"I18n\.t[12]?\(\s*" + LITERAL)
+SLINT_CALL = re.compile(r"I18n\.(?:t[12]?|upper)\(\s*" + LITERAL)
RUST_CALL = re.compile(r"(?<![A-Za-z_])(?:i18n::)?tf?\(\s*" + LITERAL)
TOML_FIELD = re.compile(r'^(name|description|category|label|group)\s*=\s*' + LITERAL, re.M)
PRESET = re.compile(r'look\(\s*"[^"]+",\s*' + LITERAL)
diff --git a/src/crates/concat/locales/en.json b/src/crates/concat/locales/en.json
index 5485d15a..5eb42380 100644
--- a/src/crates/concat/locales/en.json
+++ b/src/crates/concat/locales/en.json
@@ -298,6 +298,7 @@
"Everyday": "Everyday",
"Everything brighter than the threshold turns negative, as an over-exposed print does.": "Everything brighter than the threshold turns negative, as an over-exposed print does.",
"Everything on this machine. Transcription and speech run against models you download here, and nothing about a project leaves the device.": "Everything on this machine. Transcription and speech run against models you download here, and nothing about a project leaves the device.",
+ "Everything you have opened on this machine.": "Everything you have opened on this machine.",
"Export": "Export",
"Export again": "Export again",
"Export failed: {0}": "Export failed: {0}",
@@ -578,6 +579,7 @@
"One title per sentence, held for as long as it takes to read, one after another on the first lane with room.": "One title per sentence, held for as long as it takes to read, one after another on the first lane with room.",
"Only panel": "Only panel",
"Opacity": "Opacity",
+ "Open a project": "Open a project",
"Open project": "Open project",
"Open project…": "Open project…",
"Operating system": "Operating system",
@@ -707,6 +709,7 @@
"Script": "Script",
"Scroll Ticker": "Scroll Ticker",
"Search {0}s": "Search {0}s",
+ "See all": "See all",
"Segments": "Segments",
"Select a clip on the timeline first": "Select a clip on the timeline first",
"Select a clip with a voice in it to clone": "Select a clip with a voice in it to clone",
@@ -960,6 +963,7 @@
"{0} days ago": "{0} days ago",
"{0} Hz": "{0} Hz",
"{0} installed · {1} MB on disk": "{0} installed · {1} MB on disk",
+ "{0} is not a Concat project folder": "{0} is not a Concat project folder",
"{0} is not an address like 127.0.0.1:7420": "{0} is not an address like 127.0.0.1:7420",
"{0} K": "{0} K",
"{0} MB of {1} MB": "{0} MB of {1} MB",
diff --git a/src/crates/concat/src/lib.rs b/src/crates/concat/src/lib.rs
index f6e40878..4128df1e 100644
--- a/src/crates/concat/src/lib.rs
+++ b/src/crates/concat/src/lib.rs
@@ -61,7 +61,7 @@ use panes::settings::SettingsMsg;
use panes::speech::SpeechMsg;
use panes::start::StartMsg;
use panes::timeline::TimelineMsg;
-use studio::{Models, OUTPUTS, RESOLUTIONS, START_RATES, Studio};
+use studio::{ASPECTS, Models, OUTPUTS, SIZES, START_RATES, Studio};
use ui::*;
/// Opens this run's log file and makes it where the app writes things down.
@@ -211,17 +211,36 @@ pub fn run() -> Result<(), slint::PlatformError> {
))));
// The ladders' labels, handed over once; the index the form reports back
- // is what carries the meaning.
- app.set_start_resolutions(ModelRc::from(Rc::new(VecModel::from(
- RESOLUTIONS
+ // is what carries the meaning. The shapes carry their ratio as well,
+ // because the form draws each one as a box of its own proportions and
+ // a label is a string Slint cannot do arithmetic with.
+ app.set_start_aspects(ModelRc::from(Rc::new(VecModel::from(
+ ASPECTS
.iter()
- .map(|(label, _, _)| SharedString::from(*label))
+ .map(|(label, w, h)| ChipOption {
+ label: SharedString::from(*label),
+ ratio: *w as f32 / *h as f32,
+ })
+ .collect::<Vec<_>>(),
+ ))));
+ // A size and a rate are words and nothing else, so their chips carry no
+ // shape: a zero ratio is what the form draws nothing for.
+ app.set_start_sizes(ModelRc::from(Rc::new(VecModel::from(
+ SIZES
+ .iter()
+ .map(|(label, _)| ChipOption {
+ label: SharedString::from(*label),
+ ratio: 0.0,
+ })
.collect::<Vec<_>>(),
))));
app.set_start_rates(ModelRc::from(Rc::new(VecModel::from(
START_RATES
.iter()
- .map(|(label, _, _)| SharedString::from(*label))
+ .map(|(label, _, _)| ChipOption {
+ label: SharedString::from(*label),
+ ratio: 0.0,
+ })
.collect::<Vec<_>>(),
))));
app.set_languages(ModelRc::from(Rc::new(VecModel::from(
@@ -242,6 +261,10 @@ pub fn run() -> Result<(), slint::PlatformError> {
words.on_lookup(|_, key| i18n::t(&key).into());
words.on_lookup1(|_, key, a| i18n::tf(&key, &[&a]).into());
words.on_lookup2(|_, key, a, b| i18n::tf(&key, &[&a, &b]).into());
+ // Uppercased here rather than in the tree: Slint has no text
+ // transform, and casing is the language's rule and not the
+ // interface's to guess at.
+ words.on_lookup_upper(|_, key| i18n::t(&key).to_uppercase().into());
words.set_lang(i18n::current().into());
}
@@ -347,8 +370,11 @@ pub fn run() -> Result<(), slint::PlatformError> {
app.on_start_location_edited(on_window!(|state, path: SharedString| {
state.handle(Msg::Start(StartMsg::LocationEdited(path.to_string())));
}));
- app.on_start_resolution_changed(on_window!(|state, index: i32| {
- state.handle(Msg::Start(StartMsg::ResolutionChanged(index)));
+ app.on_start_aspect_changed(on_window!(|state, index: i32| {
+ state.handle(Msg::Start(StartMsg::AspectChanged(index)));
+ }));
+ app.on_start_size_changed(on_window!(|state, index: i32| {
+ state.handle(Msg::Start(StartMsg::SizeChanged(index)));
}));
app.on_start_rate_changed(on_window!(|state, index: i32| {
state.handle(Msg::Start(StartMsg::RateChanged(index)));
@@ -362,6 +388,9 @@ pub fn run() -> Result<(), slint::PlatformError> {
app.on_start_create(on_window!(|state| {
state.handle(Msg::Start(StartMsg::Create));
}));
+ app.on_start_open(on_window!(|state| {
+ state.handle(Msg::Start(StartMsg::Open));
+ }));
app.on_start_open_recent(on_window!(|state, path: SharedString| {
state.handle(Msg::Start(StartMsg::OpenRecent(path.to_string())));
}));
@@ -1174,19 +1203,12 @@ pub fn run() -> Result<(), slint::PlatformError> {
state.open_menu = -1;
match action.as_str() {
"add-selected" => state.handle(Msg::Media(MediaMsg::AddSelectedAtPlayhead)),
- "open" => {
- if let Some(path) = platform::pick_folder(&i18n::t("Open project"), "")
- {
- let concat_json = path.join("concat.json");
- if concat_json.exists() {
- state.handle(Msg::Start(StartMsg::OpenRecent(
- path.to_string_lossy().into_owned(),
- )));
- } else {
- state.notify("Not a valid project folder", true);
- }
- }
- }
+ // The launch screen's own verb, from the menu bar:
+ // the picker, the check and the notice are all one
+ // implementation in panes/start.rs, so the two
+ // cannot drift into disagreeing about what a project
+ // folder is.
+ "open" => state.handle(Msg::Start(StartMsg::Open)),
"import" => {
platform::pick_files_async(&i18n::t("Import media"), None, |paths| {
on_ui(move |studio, _, _| {
diff --git a/src/crates/concat/src/panes/start.rs b/src/crates/concat/src/panes/start.rs
index 0c974aaf..6df8f1d4 100644
--- a/src/crates/concat/src/panes/start.rs
+++ b/src/crates/concat/src/panes/start.rs
@@ -1,14 +1,15 @@
// SPDX-License-Identifier: AGPL-3.0-or-later
// SPDX-FileCopyrightText: 2026 Jareer and Concat contributors
-//! The launch screen's form: a new project's name, place, frame and
-//! rate, and the recent list's verbs.
+//! The launch screen's form: a new project's name, place, shape, size and
+//! rate, the verb that opens one that already exists, and the recent
+//! list's own two verbs.
use concat_host::projects;
-use crate::i18n::t;
+use crate::i18n::{t, tf};
use crate::platform;
-use crate::studio::{RESOLUTIONS, START_RATES, Studio, home_folder};
+use crate::studio::{ASPECTS, SIZES, START_RATES, Studio, frame_size, home_folder};
use crate::ui::StartData;
/// Everything that can happen to the launch screen's form.
@@ -16,12 +17,17 @@ use crate::ui::StartData;
pub enum StartMsg {
NameEdited(String),
LocationEdited(String),
- ResolutionChanged(i32),
+ /// The frame's shape: 16:9, 9:16, 1:1, 4:3.
+ AspectChanged(i32),
+ /// The frame's size, as the short edge: 720p, 1080p, 4K.
+ SizeChanged(i32),
RateChanged(i32),
DismissError,
/// Pick where the project folder goes.
Browse,
Create,
+ /// Open a project that already exists, picked from disk.
+ Open,
OpenRecent(String),
ForgetRecent(String),
}
@@ -30,7 +36,10 @@ pub enum StartMsg {
pub struct StartPane {
pub name: String,
pub location: String,
- pub resolution: usize,
+ /// Index into [`ASPECTS`].
+ pub aspect: usize,
+ /// Index into [`SIZES`].
+ pub size: usize,
pub rate: usize,
pub busy: bool,
pub error: String,
@@ -47,7 +56,10 @@ impl Default for StartPane {
} else {
"Desktop/Concat"
}),
- resolution: 0,
+ aspect: 0,
+ // 1080p, not the first of the three. The size everything else
+ // in the app assumes, and the one a phone and a desk agree on.
+ size: 1,
rate: 3,
busy: false,
error: String::new(),
@@ -62,8 +74,11 @@ impl StartPane {
match msg {
StartMsg::NameEdited(name) => self.name = name,
StartMsg::LocationEdited(path) => self.location = path,
- StartMsg::ResolutionChanged(index) => {
- self.resolution = (index.max(0) as usize).min(RESOLUTIONS.len() - 1);
+ StartMsg::AspectChanged(index) => {
+ self.aspect = (index.max(0) as usize).min(ASPECTS.len() - 1);
+ }
+ StartMsg::SizeChanged(index) => {
+ self.size = (index.max(0) as usize).min(SIZES.len() - 1);
}
StartMsg::RateChanged(index) => {
self.rate = (index.max(0) as usize).min(START_RATES.len() - 1);
@@ -77,6 +92,7 @@ impl StartPane {
}
}
StartMsg::Create => self.create(studio),
+ StartMsg::Open => self.open(studio),
StartMsg::OpenRecent(path) => {
let opened = projects::open(&path).and_then(|info| studio.open_project(info));
self.opened(opened);
@@ -98,7 +114,7 @@ impl StartPane {
} else {
name
};
- let (_, width, height) = RESOLUTIONS[self.resolution.min(RESOLUTIONS.len() - 1)];
+ let (width, height) = frame_size(self.aspect, self.size);
let (_, num, den) = START_RATES[self.rate.min(START_RATES.len() - 1)];
if self.location.trim().is_empty() {
self.error = t("Choose where the project folder should go");
@@ -109,6 +125,32 @@ impl StartPane {
self.opened(opened);
}
+ /// Opens a project folder that already exists.
+ ///
+ /// The folder is checked before it is read, so picking the wrong one
+ /// says which folder and what was wrong with it rather than reporting a
+ /// missing file by its path — which is what `projects::open` has to say
+ /// about a folder that was never a project in the first place.
+ ///
+ /// This is also what File › Open project does, from the menu bar of a
+ /// window that already has a project in it. That is why it reports
+ /// through the toast rather than through the form's own notice: the
+ /// notice is on the launch screen, and half the presses of this never
+ /// see the launch screen at all.
+ fn open(&mut self, studio: &mut Studio) {
+ let Some(folder) = platform::pick_folder(&t("Open a project"), &self.location) else {
+ return;
+ };
+ let path = folder.to_string_lossy().into_owned();
+ if !projects::is_project(&folder) {
+ studio.notify(&tf("{0} is not a Concat project folder", &[&path]), true);
+ return;
+ }
+ if let Err(error) = projects::open(&path).and_then(|info| studio.open_project(info)) {
+ studio.notify(&error, true);
+ }
+ }
+
/// The form after an open: at rest, and saying why when it failed.
fn opened(&mut self, result: Result<(), String>) {
self.busy = false;
@@ -120,12 +162,13 @@ impl StartPane {
/// The form as Slint shows it.
pub fn data(&self) -> StartData {
- let (_, width, height) = RESOLUTIONS[self.resolution.min(RESOLUTIONS.len() - 1)];
+ let (width, height) = frame_size(self.aspect, self.size);
let (_, num, den) = START_RATES[self.rate.min(START_RATES.len() - 1)];
StartData {
name: self.name.as_str().into(),
location: self.location.as_str().into(),
- resolution: self.resolution as i32,
+ aspect: self.aspect as i32,
+ size: self.size as i32,
rate: self.rate as i32,
size_readout: format!("{width} x {height}").into(),
frame_aspect: width as f32 / height.max(1) as f32,
diff --git a/src/crates/concat/src/studio.rs b/src/crates/concat/src/studio.rs
index a920614e..08230730 100644
--- a/src/crates/concat/src/studio.rs
+++ b/src/crates/concat/src/studio.rs
@@ -159,14 +159,56 @@ pub(crate) const EXPORT_TIERS: [f32; 3] = [16.0, 8.0, 4.0];
pub(crate) const EXPORT_CRF: [u8; 3] = [16, 20, 26];
pub(crate) const AUDIO_BPS: f32 = 192_000.0;
-/// The frame sizes the launch screen offers, and what each label means.
-pub const RESOLUTIONS: [(&str, u32, u32); 4] = [
- ("1080p", 1920, 1080),
- ("720p", 1280, 720),
- ("4K", 3840, 2160),
- ("Vertical", 1080, 1920),
+/// The frame shapes the launch screen offers, as the ratio behind each
+/// label: width over height.
+///
+/// A shape and a size rather than the four fixed frames this was. Those
+/// offered one upright frame at one size and no square at all, so a phone
+/// cut at 4K was not a thing the form could ask for. Every pair of indices
+/// resolves through [`frame_size`], which is the one place that knows what
+/// a label means in pixels.
+pub const ASPECTS: [(&str, u32, u32); 4] = [
+ ("16:9", 16, 9),
+ ("9:16", 9, 16),
+ ("1:1", 1, 1),
+ ("4:3", 4, 3),
];
+/// The sizes, as the *short* edge in pixels.
+///
+/// Which is what the "p" in 1080p has always counted, and the only reading
+/// that survives turning a frame upright: 1080p landscape is 1920 x 1080
+/// and 1080p vertical is 1080 x 1920, the same number of lines either way.
+/// Naming the long edge instead would make a vertical 1080p a 1080 x 1920
+/// frame at one moment and a 608 x 1080 frame at another.
+pub const SIZES: [(&str, u32); 3] = [("720p", 720), ("1080p", 1080), ("4K", 2160)];
+
+/// The frame an aspect and a size name, in pixels.
+///
+/// Both indices are clamped rather than trusted: they arrive from the form
+/// as plain integers, and a frame is not worth a panic.
+pub fn frame_size(aspect: usize, size: usize) -> (u32, u32) {
+ let (_, w, h) = ASPECTS[aspect.min(ASPECTS.len() - 1)];
+ let (_, short) = SIZES[size.min(SIZES.len() - 1)];
+ // Multiplied before divided, so 1080 x 16 / 9 is 1920 and not 1080.
+ let long = even(short * w.max(h) / w.min(h));
+ if w >= h {
+ (long, even(short))
+ } else {
+ (even(short), long)
+ }
+}
+
+/// Rounded down to an even number of pixels.
+///
+/// Every ratio above already lands even at every size; this is for the next
+/// one added. Chroma is subsampled by two in both directions in every format
+/// the export writes, and an odd dimension is what an encoder either refuses
+/// or quietly crops.
+fn even(value: u32) -> u32 {
+ value & !1
+}
+
/// The frame rates, as exact fractions. 29.97 is 30000/1001 and never
/// anything else - a decimal is for reading, and export must never be handed
/// one.
diff --git a/src/crates/concat/ui/app.slint b/src/crates/concat/ui/app.slint
index b298170d..25edaa51 100644
--- a/src/crates/concat/ui/app.slint
+++ b/src/crates/concat/ui/app.slint
@@ -30,7 +30,7 @@ import { SpeechDialog, SpeechSheetData } from "dialogs/speech.slint";
import { DockDivider, DockSide, SeatBox } from "dock.slint";
import { Editor } from "editor.slint";
import { PaneKind } from "workspace/pane-switcher.slint";
-import { RecentProjectData, StartData, StartScreen } from "start.slint";
+import { ChipOption, RecentProjectData, StartData, StartScreen } from "start.slint";
import { TitleBar } from "title-bar.slint";
import {
AppliedEntryData, AppliedParamData, CatalogueEntryData, Library, LibraryViewData,
@@ -54,7 +54,7 @@ export {
ClipData, ClipField, ClipKeyData, ClipKind, ClipTextField, DropData, Keyframes,
SelectedClipData, StageGuideData, StageItemData, TextAlignment, TimelineTabData,
TimelineTool, TrackData, TrackSize, MenuItemData, MenuRow, ExportData, ExportPhase, ModelData, SettingsData,
- RecentProjectData, StartData, SystemFactData, ToastData, ProjectSheetData,
+ ChipOption, RecentProjectData, StartData, SystemFactData, ToastData, ProjectSheetData,
CaptionsSheetData, SpeechSheetData,
}
@@ -118,16 +118,20 @@ export component App inherits Window {
// bound rather than during the window's own construction.
in property <bool> on-start: true;
in property <StartData> start;
- in property <[string]> start-resolutions;
- in property <[string]> start-rates;
+ in property <[ChipOption]> start-aspects;
+ in property <[ChipOption]> start-sizes;
+ in property <[ChipOption]> start-rates;
in property <[RecentProjectData]> recents;
callback start-name-edited(name: string);
callback start-location-edited(path: string);
callback start-browse();
- callback start-resolution-changed(index: int);
+ callback start-aspect-changed(index: int);
+ callback start-size-changed(index: int);
callback start-rate-changed(index: int);
callback start-create();
+ /// Open a project that already exists, picked from disk.
+ callback start-open();
callback start-open-recent(path: string);
callback start-forget-recent(path: string);
callback start-dismiss-error();
@@ -415,6 +419,7 @@ export component App inherits Window {
TitleBar {
macos: root.macos;
minimal: root.on-start;
+ deep: root.on-start;
project-name: root.project-name;
status: root.project-status;
@@ -442,16 +447,20 @@ export component App inherits Window {
vertical-stretch: 1;
data: root.start;
- resolutions: root.start-resolutions;
+ aspects: root.start-aspects;
+ sizes: root.start-sizes;
rates: root.start-rates;
recents: root.recents;
name-edited(name) => { root.start-name-edited(name); }
location-edited(path) => { root.start-location-edited(path); }
browse => { root.start-browse(); }
- resolution-changed(index) => { root.start-resolution-changed(index); }
+ aspect-changed(index) => { root.start-aspect-changed(index); }
+ size-changed(index) => { root.start-size-changed(index); }
rate-changed(index) => { root.start-rate-changed(index); }
create => { root.start-create(); }
+ open => { root.start-open(); }
+ open-settings => { root.open-settings(); }
open-recent(path) => { root.start-open-recent(path); }
forget-recent(path) => { root.start-forget-recent(path); }
dismiss-error => { root.start-dismiss-error(); }
diff --git a/src/crates/concat/ui/i18n.slint b/src/crates/concat/ui/i18n.slint
index bd3fcef3..2c273cb2 100644
--- a/src/crates/concat/ui/i18n.slint
+++ b/src/crates/concat/ui/i18n.slint
@@ -27,6 +27,13 @@ export global I18n {
/// The same, with `{0}` and `{1}` replaced.
pure callback lookup2(lang: string, key: string, a: string, b: string) -> string;
lookup2(lang, key, a, b) => { return key; }
+ /// The translation, in capitals: the small letter-spaced labels on the
+ /// launch screen. Rust does the casing because Slint has no text
+ /// transform, and because which letters a language has capitals for is
+ /// the language's business — an interface that upper-cased by hand
+ /// would be doing it in English on every string it was handed.
+ pure callback lookup-upper(lang: string, key: string) -> string;
+ lookup-upper(lang, key) => { return key; }
/// `key` in the active language.
public pure function t(key: string) -> string {
@@ -42,4 +49,9 @@ export global I18n {
public pure function t2(key: string, a: string, b: string) -> string {
return lookup2(lang, key, a, b);
}
+
+ /// `key` in the active language, in capitals.
+ public pure function upper(key: string) -> string {
+ return lookup-upper(lang, key);
+ }
}
diff --git a/src/crates/concat/ui/start.slint b/src/crates/concat/ui/start.slint
index 7fbcfb24..5bcec5a8 100644
--- a/src/crates/concat/ui/start.slint
+++ b/src/crates/concat/ui/start.slint
@@ -4,42 +4,69 @@
import { I18n } from "i18n.slint";
import { Theme } from "theme/theme.slint";
import { CopyChip } from "primitives/modal.slint";
+import { FocusRing } from "primitives/focus-ring.slint";
import { Glyph, Icon } from "icons.slint";
-import { SegmentedControl } from "primitives/segmented-control.slint";
import { ThinScrollbar } from "primitives/scrollbar.slint";
+import { Tip } from "primitives/tooltip.slint";
-// The launch screen.
+// The launch screen: a launcher with a rail, and the window's own ground
+// under all of it — no card around the whole thing, no shadow. A setup
+// screen is not a dialog floating over something; it *is* the window.
//
-// Full-bleed on the window's own ground — no card, no border, no shadow. A
-// setup screen is not a dialog floating over something; it *is* the window,
-// and framing it as a card only adds an edge that means nothing. Hierarchy
-// comes from type size and whitespace instead, which is why this is the one
-// surface in the app with a display-sized heading on it.
+// The rail is what makes it a launcher rather than a form. Everything you
+// can do before a project is open is one column of verbs: start a new one,
+// go through the ones you have, open a folder from disk, change the
+// settings. The page beside it is whichever of the first two is current.
+// Nothing here is a mode you have to leave — the rail is always there, and
+// the two pages are two views of the same four hundred pixels.
//
-// An editor should not drop you straight into an untitled timeline either: the
-// frame rate, the frame size and where the folder goes are decisions the whole
-// edit depends on, and choosing them after material is cut is how you end up
-// conforming footage.
+// An editor should not drop you straight into an untitled timeline either:
+// the frame rate, the frame shape and where the folder goes are decisions
+// the whole edit depends on, and choosing them after material is cut is how
+// you end up conforming footage.
//
-// The form and the recents are the whole of the screen, and they take three
-// shapes by the width they are given, since a Slint layout has no wrap:
+// Three shapes by the width the window is given, since a Slint layout has
+// no wrap:
//
-// - wide: the form with the recents in a column beside it;
-// - middle: the form across the width, the recents under it;
-// - narrow, a phone held upright: every label above its value, every control
-// across the width, the button across the width, and the forget cross on
-// every recent row, since there is no hover to reveal it with.
+// - wide: the rail with its words, the page beside it;
+// - middle: the rail as icons only, each with its word in a tip;
+// - narrow, a phone held upright: no rail at all — its two pages become two
+// tabs above the content and its two actions become two round buttons
+// beside them — every label above its value, every chip row across the
+// width, and the forget cross on every recent card, since there is no
+// hover to reveal it with.
+//
+// The look is the website's, which is the same product wearing the same
+// clothes: near-black steps for the surfaces, a hairline of light on the
+// top edge of anything raised, one lime accent used on almost nothing, and
+// a filled button whose fill is the ink rather than the accent. What the
+// site does with an accent — one highlighted word — this does with the
+// rail's current marker and the one link in the form.
//
// There is no template store in this tree, which is also why the library's
-// "save as template" is an unwired seam.
+// "save as template" is an unwired seam, and why the rail has no fifth
+// verb.
+
+/// One option on one of the form's three ladders.
+///
+/// The word the chip carries, and — on the shape ladder — the proportions
+/// of the little box drawn beside it. A zero ratio is a chip with no box,
+/// which is every size and every rate.
+export struct ChipOption {
+ label: string,
+ /// Width over height: 1.78 for 16:9, 0.5625 upright, 0 for no box.
+ ratio: float,
+}
-/// One row of the Recent column.
+/// One card in the Recent grid.
///
-/// The two lines under the name arrive formatted. A decimal frame rate to two
-/// places and a coarse "4 days ago" are both easier to produce where the
-/// numbers are than in an expression language with no printf and no clock.
+/// The two lines under the name arrive formatted. A decimal frame rate to
+/// two places and a coarse "4 days ago" are both easier to produce where
+/// the numbers are than in an expression language with no printf and no
+/// clock.
export struct RecentProjectData {
- /// The folder, and the row's identity — what reopening and forgetting name.
+ /// The folder, and the card's identity — what reopening and forgetting
+ /// name.
path: string,
name: string,
/// "1080 x 1920 · 30.00 fps"
@@ -52,14 +79,16 @@ export struct RecentProjectData {
poster: image,
}
-/// The form, as one struct — the same shape the two dialogs use, and for the
-/// same reason: it is one screen's worth of state and a partial update is how
-/// a panel ends up showing half of two things.
+/// The form, as one struct — the same shape the two dialogs use, and for
+/// the same reason: it is one screen's worth of state and a partial update
+/// is how a panel ends up showing half of two things.
export struct StartData {
name: string,
location: string,
- /// Index into `resolutions`; the numbers behind it are Rust's.
- resolution: int,
+ /// Index into `aspects`; the ratio behind it is Rust's.
+ aspect: int,
+ /// Index into `sizes`.
+ size: int,
/// Index into `rates`.
rate: int,
/// "1920 x 1080"
@@ -67,8 +96,8 @@ export struct StartData {
/// The chosen frame's width over its height, for the swatch beside the
/// readout that shows its shape: 1.78 for landscape HD, 0.56 upright.
frame-aspect: float,
- /// "30/1 fps" — the exact fraction, because 29.97 is 30000/1001 and never
- /// anything else.
+ /// "30/1 fps" — the exact fraction, because 29.97 is 30000/1001 and
+ /// never anything else.
rate-readout: string,
/// Creating. The button says so and everything is refused meanwhile.
busy: bool,
@@ -76,63 +105,49 @@ export struct StartData {
error: string,
}
-// A labelled row with a hairline under it, in the style of a settings list.
-// Beside the value where there is room; above it where there is not.
-component Field inherits Rectangle {
- in property <string> label;
- /// The last row carries no rule: there is nothing under it to divide from.
- in property <bool> last;
- /// The label over the value rather than beside it: the narrow shape.
- in property <bool> stacked;
+// ── the small parts ──────────────────────────────────────────────────────
- /// The label column. Wide enough for "Resolution" and "Frame rate" at
- /// 13px without wrapping, which is what keeps every value on one x.
- property <length> label-w: 112px;
- property <length> body-x: root.stacked ? 0px : root.label-w + 16px;
- property <length> body-y: root.stacked ? 38px : 16px;
+// The shape of a frame: a box of the frame's own proportions inside a
+// square of room, so 9:16 reads as upright at a glance and 4:3 as nearly
+// square, without anyone reading the digits. At 15px it rides inside a
+// chip; at 40px it stands beside the size readout.
+component FrameShape inherits Rectangle {
+ in property <float> ratio: 16 / 9;
+ in property <length> room: 40px;
+ in property <brush> tint: Theme.line-strong;
+ in property <brush> fill: Theme.launch-well;
- height: root.body-y + body.preferred-height + 16px;
+ property <float> shape: Math.max(0.2, Math.min(5.0, root.ratio));
- Text {
- x: 0;
- y: root.stacked ? 14px : 16px;
- width: root.stacked ? root.width : root.label-w;
- text: root.label;
- color: Theme.fg-muted;
- font-size: Theme.fs-lg;
- }
-
- body := VerticalLayout {
- x: root.body-x;
- y: root.body-y;
- width: root.width - root.body-x;
- height: self.preferred-height;
- spacing: 8px;
+ width: root.room;
+ height: root.room;
- @children
- }
+ Rectangle {
+ x: (parent.width - self.width) / 2;
+ y: (parent.height - self.height) / 2;
+ width: root.shape >= 1 ? root.room : root.room * root.shape;
+ height: root.shape >= 1 ? root.room / root.shape : root.room;
+ border-radius: Theme.r-xs;
+ background: root.fill;
+ border-width: 1px;
+ border-color: root.tint;
- if !root.last: Rectangle {
- x: 0;
- y: parent.height - 1px;
- width: parent.width;
- height: 1px;
- background: Theme.line;
+ animate width, height { duration: 160ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
}
}
-// A field's editable line: no box, no ground, just the text on the row it is
-// in. The rules between the rows are already saying where one value ends and
-// the next begins, so a border round each one is the same fact twice.
+// A field's editable line: no box, no ground, just the text on the row it
+// is in. The rules between the rows are already saying where one value ends
+// and the next begins, so a border round each one is the same fact twice.
component PlainInput inherits Rectangle {
in property <string> text;
in property <string> placeholder;
in property <length> size: Theme.fs-input;
in property <string> face: Theme.font;
in property <bool> enabled: true;
- /// Takes the caret when the screen opens, and selects what is there — so
- /// the default name can be replaced by typing rather than by clearing it
- /// first.
+ /// Takes the caret when the screen opens, and selects what is there —
+ /// so the default name can be replaced by typing rather than by
+ /// clearing it first.
in property <bool> autofocus;
callback edited(text: string);
@@ -143,10 +158,10 @@ component PlainInput inherits Rectangle {
// The text being edited, held apart from `text`.
//
// A TextInput writes to whatever it is bound to, and an assignment in
- // Slint replaces the binding — so binding straight to the published value
- // works for one keystroke and then goes deaf. Seeded instead, and never
- // while the field has focus, so a republish mid-word cannot yank the
- // caret. Same as `Field` in primitives/modal.slint, same reason.
+ // Slint replaces the binding — so binding straight to the published
+ // value works for one keystroke and then goes deaf. Seeded instead, and
+ // never while the field has focus, so a republish mid-word cannot yank
+ // the caret. Same as `Field` in primitives/modal.slint, same reason.
property <string> draft;
function seed() { root.draft = root.text; }
init => {
@@ -171,10 +186,10 @@ component PlainInput inherits Rectangle {
x: 0;
y: (parent.height - self.height) / 2;
width: parent.width;
- // A TextInput fills its Rectangle parent by default, so without this
- // the centring above subtracts the parent's own height from itself
- // and resolves to zero, leaving the text against the top edge. Same
- // fix, and the same reason, as Field in modal.slint.
+ // A TextInput fills its Rectangle parent by default, so without
+ // this the centring above subtracts the parent's own height from
+ // itself and resolves to zero, leaving the text against the top
+ // edge. Same fix, and the same reason, as Field in modal.slint.
height: self.preferred-height;
text <=> root.draft;
color: Theme.fg;
@@ -201,9 +216,10 @@ component PlainInput inherits Rectangle {
}
}
-// The one accent-coloured word in the form. A link and not a button: it opens
-// a picker for the field beside it rather than doing anything to the project,
-// and a filled button here would out-shout Create.
+// The one accent-coloured word on the screen that is not the rail's marker.
+// A link and not a button: it opens a picker for the field beside it rather
+// than doing anything to the project, and a filled button here would
+// out-shout Create.
component LinkButton inherits Rectangle {
in property <string> label;
in property <bool> enabled: true;
@@ -222,6 +238,7 @@ component LinkButton inherits Rectangle {
text: root.label;
color: Theme.accent;
font-size: Theme.fs-lg;
+ font-weight: Theme.weight-title;
}
touch := TouchArea {
@@ -231,66 +248,532 @@ component LinkButton inherits Rectangle {
}
}
-// The shape of the chosen frame, beside its numbers: a box of the frame's
-// own proportions in a square of room, so 9:16 reads as upright at a glance
-// and 4:3 as nearly square, without anyone reading the digits.
-component FrameShape inherits Rectangle {
- in property <float> aspect: 16 / 9;
- property <float> shape: Math.max(0.2, Math.min(5.0, root.aspect));
- property <length> room: 40px;
+// One chip on a ladder: a pill that is either the answer or one of the
+// others. Selected is a lit surface and a brighter edge, never a fill of
+// the accent — the accent on this screen belongs to the rail and the link,
+// and four lime pills in a row would leave nothing for the button to say.
+component Chip inherits Rectangle {
+ in property <string> label;
+ /// Non-zero draws the shape of that ratio before the word.
+ in property <float> ratio;
+ in property <bool> selected;
+ in property <bool> enabled: true;
+ /// Fill the width the row gives it, rather than its own.
+ in property <bool> block;
+ /// The keyboard is on this row and this is the chip it is on.
+ in property <bool> ring;
- width: root.room;
- height: root.room;
+ callback clicked();
+
+ property <bool> lit: touch.has-hover && root.enabled;
+ property <length> box: root.ratio > 0 ? 15px : 0px;
+ property <length> gap: root.ratio > 0 ? 7px : 0px;
+
+ height: 32px;
+ horizontal-stretch: root.block ? 1 : 0;
+ // From the label's *preferred* width, never its actual one: the layout
+ // below sizes the label from this chip's width, so reading back the
+ // result is a loop. Same as Button in primitives/modal.slint.
+ min-width: caption.preferred-width + root.box + root.gap + 26px;
+ border-radius: self.height / 2;
+ background: root.selected ? Theme.launch-field
+ : root.lit ? Theme.launch-raised
+ : Colors.transparent;
+ border-width: 1px;
+ border-color: root.selected || root.lit ? Theme.line-strong : Theme.line;
+ opacity: root.enabled ? 1.0 : 0.45;
+
+ animate background, border-color { duration: 140ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
+
+ HorizontalLayout {
+ alignment: center;
+ spacing: root.gap;
+
+ if root.ratio > 0: VerticalLayout {
+ alignment: center;
+ FrameShape {
+ room: root.box;
+ ratio: root.ratio;
+ fill: Colors.transparent;
+ tint: root.selected ? Theme.fg-muted : Theme.fg-dim;
+ }
+ }
+
+ // The weight does not move with the selection: it is this chip's
+ // own preferred width, and a row whose chips resize as you step
+ // along it is a row that shudders.
+ caption := Text {
+ text: root.label;
+ color: root.selected || root.lit ? Theme.fg : Theme.fg-muted;
+ font-size: Theme.fs-lg;
+ font-weight: Theme.weight-title;
+ vertical-alignment: center;
+
+ animate color { duration: 140ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
+ }
+ }
+
+ touch := TouchArea {
+ enabled: root.enabled;
+ mouse-cursor: pointer;
+ clicked => { root.clicked(); }
+ }
+
+ FocusRing {
+ active: root.ring;
+ radius: root.height / 2;
+ }
+}
+
+// A ladder of chips, and the arrow keys that walk it.
+//
+// The focus ring goes round the current chip rather than round the row: a
+// stadium two hundred pixels wide says the row has the keyboard but not
+// which answer it is on.
+component ChipRow inherits Rectangle {
+ in property <[ChipOption]> options;
+ in property <int> current;
+ in property <bool> enabled: true;
+ /// The chips share the width rather than take their own: the phone
+ /// shape, where five rates have to fit across a thumb's screen.
+ in property <bool> block;
+
+ callback changed(index: int);
+
+ property <bool> ring;
+
+ height: 32px;
+
+ function select(index: int) {
+ if (index >= 0 && index < root.options.length) {
+ root.changed(index);
+ }
+ }
+
+ fs := FocusScope {
+ enabled: root.enabled;
+ // :focus-visible — keyboard focus only, as in SegmentedControl.
+ focus-gained(reason) => {
+ root.ring = reason == FocusReason.tab-navigation;
+ }
+ focus-lost(reason) => {
+ root.ring = false;
+ }
+ key-pressed(event) => {
+ if (event.text == Key.RightArrow || event.text == Key.DownArrow) {
+ root.select(Math.mod(root.current + 1, root.options.length));
+ return EventResult.accept;
+ }
+ if (event.text == Key.LeftArrow || event.text == Key.UpArrow) {
+ root.select(Math.mod(root.current - 1 + root.options.length,
+ root.options.length));
+ return EventResult.accept;
+ }
+ return EventResult.reject;
+ }
+ }
+
+ HorizontalLayout {
+ alignment: root.block ? LayoutAlignment.stretch : LayoutAlignment.start;
+ spacing: 8px;
+
+ for option[index] in root.options: Chip {
+ label: option.label;
+ ratio: option.ratio;
+ selected: index == root.current;
+ enabled: root.enabled;
+ block: root.block;
+ ring: root.ring && index == root.current;
+ clicked => {
+ fs.focus();
+ root.select(index);
+ }
+ }
+ }
+}
+
+// A labelled row of the form, with a hairline under it. Beside the value
+// where there is room, above it where there is not.
+//
+// The label is the website's eyebrow: small, letter-spaced, quiet. It is
+// handed here already in capitals, because the casing is Rust's — see
+// `I18n.upper`.
+component FormRow inherits Rectangle {
+ in property <string> label;
+ /// The last row carries no rule: there is nothing under it to divide
+ /// from.
+ in property <bool> last;
+ /// The label over the value rather than beside it: the narrow shape.
+ in property <bool> stacked;
+
+ /// The label column. Wide enough for the longest of them at 10px with
+ /// its tracking, which is what keeps every value on one x.
+ property <length> label-w: 84px;
+ property <length> body-x: root.stacked ? 0px : root.label-w + 20px;
+ property <length> body-y: root.stacked ? 30px : 18px;
+
+ height: root.body-y + body.preferred-height + 18px;
+
+ Text {
+ x: 0;
+ // Against the first line of the body rather than the top of the
+ // row: a ten-pixel label hung from the same y as a thirty-pixel
+ // chip reads as a footnote to the row above it.
+ y: root.stacked ? 14px : root.body-y + 9px;
+ width: root.stacked ? root.width : root.label-w;
+ text: root.label;
+ color: Theme.fg-dim;
+ font-family: Theme.font-technical;
+ font-size: Theme.fs-xs;
+ letter-spacing: 0.9px;
+ }
+
+ body := VerticalLayout {
+ x: root.body-x;
+ y: root.body-y;
+ width: root.width - root.body-x;
+ height: self.preferred-height;
+ spacing: 10px;
+
+ @children
+ }
+
+ if !root.last: Rectangle {
+ x: 0;
+ y: parent.height - 1px;
+ width: parent.width;
+ height: 1px;
+ background: Theme.line;
+ }
+}
+
+// The one raised surface on the screen. A panel over the page, a hairline
+// of light caught on its top edge, and the largest corner in the app —
+// what the site's cards do with `hairline` and `shadow-raised`, minus the
+// drop shadow Slint has no way to draw.
+component Card inherits Rectangle {
+ background: Theme.launch-panel;
+ border-radius: Theme.r-xl;
+ border-width: 1px;
+ border-color: Theme.line;
Rectangle {
+ x: 1px;
+ y: 1px;
+ width: parent.width - 2px;
+ height: 1px;
+ background: Theme.line-strong;
+ }
+
+ @children
+}
+
+// The pill the whole screen is built around, and its quieter sibling.
+//
+// Primary is the ink itself — near-white on the dark palette, near-black on
+// the light one — and not the accent. It is the site's rule: one accent,
+// spent on a word and a marker, never on a fill this size. Hover goes one
+// step further from the ground rather than towards it, which is what
+// `fg-hot` is for.
+component PillButton inherits Rectangle {
+ in property <string> label;
+ in property <Glyph> glyph;
+ in property <bool> primary;
+ in property <bool> enabled: true;
+ in property <bool> block;
+
+ callback clicked();
+
+ property <bool> lit: touch.has-hover && root.enabled;
+ property <length> mark: root.glyph == Glyph.none ? 0px : 15px;
+ property <length> gap: root.glyph == Glyph.none ? 0px : 8px;
+ property <brush> ink: root.primary ? Theme.launch-page
+ : root.lit ? Theme.fg
+ : Theme.fg-muted;
+
+ height: 40px;
+ horizontal-stretch: root.block ? 1 : 0;
+ min-width: root.block ? 0px
+ : caption.preferred-width + root.mark + root.gap + 44px;
+ border-radius: self.height / 2;
+ background: root.primary ? (root.lit ? Theme.fg-hot : Theme.fg)
+ : root.lit ? Theme.launch-field
+ : Theme.launch-raised;
+ border-width: root.primary ? 0px : 1px;
+ border-color: root.lit ? Theme.line-strong : Theme.line;
+ opacity: root.enabled ? 1.0 : 0.4;
+
+ animate background, border-color { duration: 140ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
+
+ HorizontalLayout {
+ alignment: center;
+ spacing: root.gap;
+
+ if root.glyph != Glyph.none: VerticalLayout {
+ alignment: center;
+ Icon {
+ glyph: root.glyph;
+ size: 15px;
+ tint: root.ink;
+ }
+ }
+
+ caption := Text {
+ text: root.label;
+ color: root.ink;
+ font-size: Theme.fs-xl;
+ font-weight: Theme.weight-title;
+ vertical-alignment: center;
+ }
+ }
+
+ touch := TouchArea {
+ enabled: root.enabled;
+ mouse-cursor: pointer;
+ clicked => { root.clicked(); }
+ }
+}
+
+// A round icon button: the rail's two actions, for the phone that has no
+// rail to put them in.
+component BarAction inherits Rectangle {
+ in property <Glyph> glyph;
+ in property <string> label;
+ in property <bool> enabled: true;
+
+ callback clicked();
+
+ property <bool> lit: touch.has-hover && root.enabled;
+
+ width: 34px;
+ height: 34px;
+ border-radius: self.width / 2;
+ background: root.lit ? Theme.launch-field : Theme.launch-raised;
+ border-width: 1px;
+ border-color: root.lit ? Theme.line-strong : Theme.line;
+ opacity: root.enabled ? 1.0 : 0.4;
+
+ animate background, border-color { duration: 140ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
+
+ Icon {
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
- width: root.shape >= 1 ? root.room : root.room * root.shape;
- height: root.shape >= 1 ? root.room / root.shape : root.room;
- border-radius: Theme.r-xs;
- background: Theme.well;
- border-width: 1px;
- border-color: Theme.line-strong;
+ glyph: root.glyph;
+ size: 15px;
+ tint: root.lit ? Theme.fg : Theme.fg-muted;
+ }
- animate width, height { duration: 160ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
+ touch := TouchArea {
+ enabled: root.enabled;
+ mouse-cursor: pointer;
+ clicked => { root.clicked(); }
+ }
+
+ Tip {
+ text: root.label;
+ active: touch.has-hover;
}
}
-// One project in the Recent column: poster, name, what it is, when it was
-// last open — and the cross that forgets it: on hover where there is a
-// pointer, always where there is not.
-component RecentRow inherits Rectangle {
- in property <RecentProjectData> project;
+// ── the rail ─────────────────────────────────────────────────────────────
+
+// One verb in the rail: a page to go to, or a thing to do. The current one
+// wears a lit surface and a two-pixel accent mark on its leading edge —
+// the whole of the accent's job on this screen, alongside the one link.
+component RailItem inherits Rectangle {
+ in property <string> label;
+ in property <Glyph> glyph;
+ in property <bool> current;
in property <bool> enabled: true;
- /// The narrow shape: a smaller poster, and the forget cross always
- /// there, since a finger cannot hover.
+ /// Icons only, with the word in a tip: the middle width.
in property <bool> compact;
+ /// A count after the word. Zero says nothing.
+ in property <int> badge;
+
+ callback clicked();
+
+ property <bool> lit: touch.has-hover && root.enabled;
+ property <brush> ink: root.current || root.lit ? Theme.fg : Theme.fg-muted;
+
+ height: 36px;
+ border-radius: Theme.r;
+ background: root.current ? Theme.launch-field
+ : root.lit ? Theme.launch-raised
+ : Colors.transparent;
+ opacity: root.enabled ? 1.0 : 0.4;
+
+ animate background { duration: 120ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
+
+ if root.current: Rectangle {
+ x: 0;
+ y: (parent.height - self.height) / 2;
+ width: 2px;
+ height: 18px;
+ border-radius: 1px;
+ background: Theme.accent;
+ }
+
+ HorizontalLayout {
+ padding-left: root.compact ? 0px : 13px;
+ padding-right: root.compact ? 0px : 11px;
+ spacing: 10px;
+ alignment: root.compact ? LayoutAlignment.center : LayoutAlignment.start;
+
+ VerticalLayout {
+ alignment: center;
+ Icon {
+ glyph: root.glyph;
+ size: 15px;
+ tint: root.ink;
+ }
+ }
+
+ if !root.compact: VerticalLayout {
+ alignment: center;
+ horizontal-stretch: 1;
+ Text {
+ text: root.label;
+ color: root.ink;
+ font-size: Theme.fs-lg;
+ font-weight: Theme.weight-title;
+ overflow: elide;
+ }
+ }
+
+ if !root.compact && root.badge > 0: VerticalLayout {
+ alignment: center;
+ Text {
+ text: root.badge;
+ color: Theme.fg-dim;
+ font-family: Theme.font-technical;
+ font-size: Theme.fs-sm;
+ }
+ }
+ }
+
+ touch := TouchArea {
+ enabled: root.enabled;
+ mouse-cursor: pointer;
+ clicked => { root.clicked(); }
+ }
+
+ // Only where the word has been taken away. A tip repeating a label that
+ // is already on screen is noise.
+ if root.compact: Tip {
+ text: root.label;
+ active: touch.has-hover;
+ }
+}
+
+// The column of verbs. Its own surface, a shade above the page, with the
+// window's edge on one side and a hairline on the other.
+component Rail inherits Rectangle {
+ /// Sized by the screen — see `rail-w` there. A width of its own would
+ /// make the screen's own minimum depend on whether the rail is up,
+ /// which depends on the screen's width: a binding loop, and Slint says
+ /// so.
+ in property <int> view;
+ in property <int> recents-count;
+ in property <bool> compact;
+ in property <bool> enabled: true;
+
+ callback go(view: int);
+ callback open();
+ callback settings();
+
+ background: Theme.launch-panel;
+
+ Rectangle {
+ x: parent.width - 1px;
+ y: 0;
+ width: 1px;
+ height: parent.height;
+ background: Theme.line;
+ }
+
+ VerticalLayout {
+ padding: root.compact ? 10px : 12px;
+ padding-top: 14px;
+ padding-bottom: 14px;
+ spacing: 4px;
+
+ RailItem {
+ label: I18n.t("New project");
+ glyph: Glyph.plus;
+ current: root.view == 0;
+ compact: root.compact;
+ enabled: root.enabled;
+ clicked => { root.go(0); }
+ }
+
+ // No stop for a list that is empty: a "Recent" heading over nothing
+ // is worse than no heading, and a rail item that leads to one is
+ // worse again.
+ if root.recents-count > 0: RailItem {
+ label: I18n.t("Recent");
+ glyph: Glyph.clock;
+ badge: root.recents-count;
+ current: root.view == 1;
+ compact: root.compact;
+ enabled: root.enabled;
+ clicked => { root.go(1); }
+ }
+
+ Rectangle { vertical-stretch: 1; }
+
+ RailItem {
+ label: I18n.t("Open project");
+ glyph: Glyph.folder;
+ compact: root.compact;
+ enabled: root.enabled;
+ clicked => { root.open(); }
+ }
+
+ RailItem {
+ label: I18n.t("Settings");
+ glyph: Glyph.settings;
+ compact: root.compact;
+ enabled: root.enabled;
+ clicked => { root.settings(); }
+ }
+ }
+}
+
+// ── the recents ──────────────────────────────────────────────────────────
+
+// One project: its poster, its name, what it is, when it was last open —
+// and the cross that forgets it, on hover where there is a pointer and
+// always where there is not.
+component PosterCard inherits Rectangle {
+ in property <RecentProjectData> project;
+ in property <bool> enabled: true;
+ /// No pointer to hover with, so the cross stays out.
+ in property <bool> touchy;
callback opened();
callback forgotten();
- property <length> poster-w: root.compact ? 72px : 96px;
- property <bool> forgettable: root.compact || touch.has-hover;
+ property <bool> lit: touch.has-hover && root.enabled;
+ property <bool> forgettable: root.touchy || touch.has-hover;
- height: root.poster-w * 9 / 16 + 22px;
border-radius: Theme.r-lg;
- background: touch.has-hover ? Theme.field : Colors.transparent;
+ background: root.lit ? Theme.launch-raised : Theme.launch-panel;
+ border-width: 1px;
+ border-color: root.lit ? Theme.line-strong : Theme.line;
+ clip: true;
- animate background { duration: 100ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
+ animate background, border-color { duration: 120ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
touch := TouchArea {
mouse-cursor: root.enabled ? pointer : default;
clicked => { root.opened(); }
poster := Rectangle {
- x: 8px;
- y: (parent.height - self.height) / 2;
- width: root.poster-w;
- height: self.width * 9 / 16;
- border-radius: Theme.r;
- background: Theme.well;
- border-width: 1px;
- border-color: Theme.line;
+ x: 0;
+ y: 0;
+ width: parent.width;
+ height: parent.width * 9 / 16;
+ background: Theme.launch-well;
clip: true;
if root.project.poster.width > 0: Image {
@@ -304,23 +787,57 @@ component RecentRow inherits Rectangle {
x: (parent.width - self.width) / 2;
y: (parent.height - self.height) / 2;
glyph: Glyph.film;
- size: 17px;
+ size: 19px;
weight: 1.5;
tint: Theme.fg-dim;
}
+
+ Rectangle {
+ x: 0;
+ y: parent.height - 1px;
+ width: parent.width;
+ height: 1px;
+ background: Theme.line;
+ }
+
+ // A permanent cross on every card of a list of your own work is
+ // a list of invitations to lose one; on a phone there is no
+ // hover, so it stays, quiet, in the corner.
+ if root.forgettable: Rectangle {
+ x: parent.width - self.width - 6px;
+ y: 6px;
+ width: 24px;
+ height: 24px;
+ border-radius: self.width / 2;
+ background: forget.has-hover ? Theme.launch-field-active : Theme.overlay;
+
+ Icon {
+ x: (parent.width - self.width) / 2;
+ y: (parent.height - self.height) / 2;
+ glyph: Glyph.close;
+ size: 11px;
+ tint: forget.has-hover ? Theme.fg : Theme.fg-muted;
+ }
+
+ forget := TouchArea {
+ mouse-cursor: pointer;
+ clicked => { root.forgotten(); }
+ }
+ }
}
VerticalLayout {
- x: poster.x + poster.width + 12px;
- y: (parent.height - self.preferred-height) / 2;
- width: parent.width - poster.width - 20px - 34px;
+ x: 12px;
+ y: poster.height + 11px;
+ width: parent.width - 24px;
height: self.preferred-height;
- spacing: 2px;
+ spacing: 3px;
Text {
text: root.project.name;
color: Theme.fg;
font-size: Theme.fs-xl;
+ font-weight: Theme.weight-title;
overflow: elide;
}
@@ -339,520 +856,582 @@ component RecentRow inherits Rectangle {
overflow: elide;
}
}
-
- // Hover-only where there is a pointer, like the bin's card: a
- // permanent cross on every row of a list of your own work is a list
- // of invitations to lose one. On a phone there is no hover, so it
- // stays, quiet, at the row's end.
- if root.forgettable: Rectangle {
- x: parent.width - self.width - 8px;
- y: (parent.height - self.height) / 2;
- width: 28px;
- height: 28px;
- border-radius: Theme.r-xs;
- background: forget.has-hover ? Theme.field-active : Colors.transparent;
-
- Icon {
- x: (parent.width - self.width) / 2;
- y: (parent.height - self.height) / 2;
- glyph: Glyph.close;
- size: 12px;
- tint: forget.has-hover ? Theme.fg : Theme.fg-dim;
- }
-
- forget := TouchArea {
- mouse-cursor: pointer;
- clicked => { root.forgotten(); }
- }
- }
}
}
-// The Recent column. Its own component because it appears in two places: to
-// the right of the form when there is room, and under it when there is not.
-//
-// No empty state — a "Recent" heading over nothing is worse than no heading —
-// so whoever places this only places it when there is something to show.
-component RecentsColumn inherits VerticalLayout {
+// `grid-cols-[repeat(auto-fill,minmax(210px,1fr))]`, arithmetic instead of
+// a layout: Slint has no auto-fill grid, and a GridLayout wants its cells
+// named at compile time, which a model cannot do. Same as the bin's grid in
+// workspace/media-pane.slint.
+component RecentsGrid inherits Rectangle {
in property <[RecentProjectData]> recents;
in property <bool> enabled: true;
- in property <bool> compact;
- /// The rule above the heading, for the stacked arrangement. Beside the
- /// form there is a whole column of air doing that job already.
- in property <bool> ruled;
+ in property <bool> touchy;
+ /// One row of them and no more: the strip on the form's own page, which
+ /// is a glance at the list rather than the list.
+ in property <bool> one-row;
callback opened(path: string);
callback forgotten(path: string);
- alignment: start;
-
- if root.ruled: Rectangle {
- height: root.compact ? 40px : 56px;
-
- Rectangle {
- x: 0;
- y: parent.height / 2;
+ property <length> gap: 14px;
+ property <length> min-card: 210px;
+ property <int> cols: Math.max(1,
+ Math.floor((root.width + root.gap) / (root.min-card + root.gap)));
+ property <length> card-w: (root.width - (root.cols - 1) * root.gap) / root.cols;
+ /// poster + the name, the detail and the when under it
+ property <length> card-h: root.card-w * 9 / 16 + 74px;
+ /// How many are drawn. The rest of the model is still repeated over —
+ /// a Slint repeater has no take(n) — but each one past this is a box of
+ /// no size with nothing in it.
+ out property <int> shown: root.one-row
+ ? Math.min(root.cols, root.recents.length)
+ : root.recents.length;
+ property <int> rows: Math.ceil(root.shown / root.cols);
+
+ height: root.rows > 0 ? root.rows * (root.card-h + root.gap) - root.gap : 0px;
+
+ for project[index] in root.recents: Rectangle {
+ x: Math.mod(index, root.cols) * (root.card-w + root.gap);
+ y: Math.floor(index / root.cols) * (root.card-h + root.gap);
+ width: index < root.shown ? root.card-w : 0px;
+ height: index < root.shown ? root.card-h : 0px;
+
+ if index < root.shown: PosterCard {
width: parent.width;
- height: 1px;
- background: Theme.line;
+ height: parent.height;
+ project: project;
+ enabled: root.enabled;
+ touchy: root.touchy;
+ opened => { root.opened(project.path); }
+ forgotten => { root.forgotten(project.path); }
}
}
-
- HorizontalLayout {
- spacing: 8px;
-
- Text {
- text: I18n.t("Recent");
- color: Theme.fg-muted;
- font-size: Theme.fs-lg;
- font-weight: Theme.weight-title;
- }
-
- // How many, quietly: a count is the one thing a list of rows does
- // not say about itself until it is scrolled.
- Text {
- text: root.recents.length;
- color: Theme.fg-dim;
- font-family: Theme.font-technical;
- font-size: Theme.fs-sm;
- vertical-alignment: center;
- }
- }
-
- Rectangle { height: 12px; }
-
- for project in root.recents: RecentRow {
- project: project;
- enabled: root.enabled;
- compact: root.compact;
- opened => { root.opened(project.path); }
- forgotten => { root.forgotten(project.path); }
- }
}
-// A pill, and the only filled accent in the form: it is the one thing on
-// this screen that starts an edit. Its own width beside its note; the whole
-// width on a phone.
-component CreateButton inherits Rectangle {
- in property <bool> busy;
- in property <bool> enabled: true;
- in property <bool> block;
-
- callback clicked();
-
- // Its label's width plus the pill's ends beside the note; across the
- // width when the layout it sits in stretches it.
- min-width: label.preferred-width + 48px;
- preferred-width: label.preferred-width + 48px;
- horizontal-stretch: root.block ? 1 : 0;
- height: root.block ? 44px : 40px;
- border-radius: self.height / 2;
- background: go.has-hover && root.enabled ? Theme.accent-hover : Theme.accent;
- opacity: root.enabled ? 1.0 : 0.4;
-
- animate background { duration: 120ms; easing: cubic-bezier(0.4, 0, 0.2, 1); }
-
- label := Text {
- x: (parent.width - self.width) / 2;
- y: (parent.height - self.height) / 2;
- text: root.busy ? I18n.t("Creating…") : I18n.t("Create");
- color: Theme.on-accent;
- font-size: Theme.fs-xl;
- font-weight: Theme.weight-title;
- }
-
- go := TouchArea {
- enabled: root.enabled;
- mouse-cursor: pointer;
- clicked => { root.clicked(); }
- }
-}
-
-// The line under or beside the button: what pressing it does to the disk.
-component CreateNote inherits HorizontalLayout {
- spacing: 6px;
-
- VerticalLayout {
- alignment: start;
- padding-top: 2px;
- Icon {
- glyph: Glyph.info;
- size: 12px;
- tint: Theme.fg-dim;
- }
- }
-
- Text {
- horizontal-stretch: 1;
- text: I18n.t("The project folder is created now; the edit autosaves into it.");
- color: Theme.fg-dim;
- font-size: Theme.fs-sm;
- vertical-alignment: center;
- wrap: word-wrap;
- }
-}
+// ── the screen ───────────────────────────────────────────────────────────
export component StartScreen inherits Rectangle {
in property <StartData> data;
- /// The two ladders' labels. The numbers behind each index are Rust's, so
- /// there is one place that knows 4K is 3840 x 2160 and 29.97 is 30000
- /// over 1001 — see `RESOLUTIONS` and `START_RATES` in the window.
- in property <[string]> resolutions;
- in property <[string]> rates;
+ /// The three ladders. The numbers behind each index are Rust's, so
+ /// there is one place that knows what 4K is in pixels and that 29.97 is
+ /// 30000 over 1001 — see `ASPECTS`, `SIZES` and `START_RATES` in the
+ /// window.
+ in property <[ChipOption]> aspects;
+ in property <[ChipOption]> sizes;
+ in property <[ChipOption]> rates;
in property <[RecentProjectData]> recents;
callback name-edited(name: string);
callback location-edited(path: string);
callback browse();
- callback resolution-changed(index: int);
+ callback aspect-changed(index: int);
+ callback size-changed(index: int);
callback rate-changed(index: int);
callback create();
+ /// Open a project that already exists, picked from disk.
+ callback open();
callback open-recent(path: string);
callback forget-recent(path: string);
callback dismiss-error();
-
- // ── the three shapes ─────────────────────────────────────────────────
- //
- // Narrow is a phone held upright, or a window squeezed that far: under
- // this the label column and the value cannot share a row. Wide is the
- // recents beside the form, only once there is history to show and room
- // for both columns at their full widths.
- property <bool> narrow: root.width < 600px;
- /// The form's own column, and the widest the pair may run to.
- property <length> form-w: 700px;
- property <length> recents-w: 340px;
- property <length> column-gap: 64px;
- property <bool> side-by-side: root.recents.length > 0
- && root.width >= root.form-w + root.column-gap + root.recents-w + 96px;
- /// The margin the sheet keeps from the window's edge: a twelfth of the
- /// width, between the phone's 20px and the desktop's 48px.
- property <length> pad: Math.max(20px, Math.min(48px, root.width / 12));
- /// The top margin: room to breathe on a desktop, less on a phone where
- /// the height is the scarce thing.
- property <length> pad-top: root.narrow ? 24px : 48px;
+ callback open-settings();
+
+ /// Which of the rail's two pages is current: the form, or the whole
+ /// recent list.
+ property <int> view: 0;
+ /// And which one is actually shown. Forgetting the last project takes
+ /// the second page's reason to exist away with it, so the screen falls
+ /// back to the form rather than leaving the rail pointing at nothing.
+ property <int> page: root.recents.length > 0 ? root.view : 0;
+
+ /// A phone held upright, or a window squeezed that far: under this the
+ /// rail is a bar and every label sits over its value.
+ property <bool> narrow: root.width < 680px;
+ /// Under this the rail keeps its verbs but loses its words.
+ property <bool> compact-rail: root.width < 940px;
+ /// The margin the content keeps from the page's edges: between the
+ /// phone's 20px and the desktop's 56px.
+ property <length> pad: Math.max(20px, Math.min(56px, root.width / 14));
+ /// Room above the heading. The site opens on a screen of air; a window
+ /// has less of it to give, and a phone less again.
+ property <length> pad-top: root.narrow ? 24px
+ : Math.max(32px, Math.min(88px, root.height / 9));
+ /// The content column. The list gets a wider one than the form: three
+ /// cards of history read as a shelf, three hundred pixels of input does
+ /// not read as anything.
+ property <length> content-w: root.page == 1 ? 1120px : 740px;
+ /// The rail's width, and the page's left edge. Zero is a phone, which
+ /// has the rail's verbs in a bar of its own instead.
+ property <length> rail-w: root.narrow ? 0px : (root.compact-rail ? 62px : 208px);
/// A project needs somewhere to go. Everything else has a default.
property <bool> can-create: !root.data.busy && root.data.location != "";
- background: Theme.page;
+ background: Theme.launch-page;
clip: true;
- // The whole screen scrolls when it does not fit: a wheel, a trackpad or
- // a finger, which a Flickable takes all of. It clamps its own travel.
- flick := Flickable {
- viewport-width: self.width;
- viewport-height: Math.max(self.height, sheet.height + root.pad-top + root.pad);
- interactive: sheet.height + root.pad-top + root.pad > self.height;
-
- sheet := Rectangle {
- // Centred when it fits and pinned to the top when it does not,
- // which is what `justify-center` in a scroll container gives.
- x: (flick.width - self.width) / 2;
- y: sheet.height + root.pad-top + root.pad > flick.height
- ? root.pad-top
- : Math.max(root.pad-top, (flick.height - self.height) / 2);
- width: Math.min(flick.width - 2 * root.pad,
- root.side-by-side
- ? root.form-w + root.column-gap + root.recents-w
- : root.form-w);
- height: columns.preferred-height;
-
- columns := HorizontalLayout {
- spacing: root.column-gap;
-
- // ── the form ─────────────────────────────────────────────
- VerticalLayout {
- horizontal-stretch: 1;
+ // Placed rather than laid out. A HorizontalLayout here would make this
+ // screen's minimum width the rail's plus the page's, and `narrow` —
+ // which decides whether there is a rail at all — is read from the width
+ // that minimum helps decide. Slint calls that a binding loop and is
+ // right to. Two absolute boxes have no such opinion.
+ if !root.narrow: Rail {
+ x: 0;
+ y: 0;
+ width: root.rail-w;
+ height: root.height;
+
+ view: root.page;
+ recents-count: root.recents.length;
+ compact: root.compact-rail;
+ enabled: !root.data.busy;
+ go(view) => { root.view = view; }
+ open => { root.open(); }
+ settings => { root.open-settings(); }
+ }
+
+ Rectangle {
+ x: root.rail-w;
+ y: 0;
+ width: root.width - root.rail-w;
+ height: root.height;
+
+ // The page scrolls when it does not fit: a wheel, a trackpad or
+ // a finger, which a Flickable takes all of. It clamps its own
+ // travel.
+ flick := Flickable {
+ viewport-width: self.width;
+ viewport-height: Math.max(self.height,
+ column.height + root.pad-top + root.pad);
+ interactive: column.height + root.pad-top + root.pad > self.height;
+
+ column := Rectangle {
+ x: (flick.width - self.width) / 2;
+ y: root.pad-top;
+ width: Math.min(flick.width - 2 * root.pad, root.content-w);
+ height: stack.preferred-height;
+
+ stack := VerticalLayout {
alignment: start;
+ // ── the rail's job, on a phone ───────────────────────
+ if root.narrow: HorizontalLayout {
+ spacing: 8px;
+
+ Chip {
+ label: I18n.t("New project");
+ selected: root.page == 0;
+ enabled: !root.data.busy;
+ clicked => { root.view = 0; }
+ }
+
+ if root.recents.length > 0: Chip {
+ label: I18n.t("Recent");
+ selected: root.page == 1;
+ enabled: !root.data.busy;
+ clicked => { root.view = 1; }
+ }
+
+ Rectangle { horizontal-stretch: 1; }
+
+ VerticalLayout {
+ alignment: center;
+ horizontal-stretch: 0;
+ BarAction {
+ glyph: Glyph.folder;
+ label: I18n.t("Open project");
+ enabled: !root.data.busy;
+ clicked => { root.open(); }
+ }
+ }
+
+ VerticalLayout {
+ alignment: center;
+ horizontal-stretch: 0;
+ BarAction {
+ glyph: Glyph.settings;
+ label: I18n.t("Settings");
+ enabled: !root.data.busy;
+ clicked => { root.open-settings(); }
+ }
+ }
+ }
+
+ if root.narrow: Rectangle { height: 28px; }
+
+ // ── the heading ──────────────────────────────────────
Text {
- text: I18n.t("New project");
+ text: root.page == 1 ? I18n.t("Recent") : I18n.t("New project");
color: Theme.fg;
- // The one display-sized line in the app. The tree
- // bundles two faces and no display face, so the
- // interface face carries it at its heaviest weight and
- // tight tracking — -0.03em, which at 34px is a point.
- // A phone gets it at 26px, still the largest thing on
- // its screen and no longer half of it.
+ // The one display-sized line in the app. The
+ // tree bundles two faces and no display face,
+ // so the interface face carries it at its
+ // heaviest weight and tight tracking — -0.03em,
+ // which at 34px is a point. A phone gets it at
+ // 26px, still the largest thing on its screen
+ // and no longer half of it.
font-size: root.narrow ? 26px : Theme.fs-display;
font-weight: Theme.weight-display;
letter-spacing: root.narrow ? -0.6px : -1px;
wrap: word-wrap;
}
- Rectangle { height: 6px; }
+ Rectangle { height: 8px; }
Text {
- text: I18n.t("These settings apply to the whole edit and cannot be changed later.");
+ text: root.page == 1
+ ? I18n.t("Everything you have opened on this machine.")
+ : I18n.t("These settings apply to the whole edit and cannot be changed later.");
color: Theme.fg-muted;
font-size: root.narrow ? Theme.fs-lg : Theme.fs-xl;
wrap: word-wrap;
}
- Rectangle { height: root.narrow ? 24px : 40px; }
-
- Field {
- label: I18n.t("Name");
- stacked: root.narrow;
+ Rectangle { height: root.narrow ? 24px : 34px; }
- PlainInput {
- text: root.data.name;
- placeholder: I18n.t("Untitled project");
- autofocus: true;
- enabled: !root.data.busy;
- edited(text) => { root.name-edited(text); }
- accepted => { root.create(); }
- }
- }
+ // ── the form ─────────────────────────────────────────
+ if root.page == 0: Card {
+ VerticalLayout {
+ padding-left: root.narrow ? 18px : 26px;
+ padding-right: root.narrow ? 18px : 26px;
+ padding-top: 6px;
+ padding-bottom: 22px;
+
+ FormRow {
+ label: I18n.upper("Name");
+ stacked: root.narrow;
+
+ PlainInput {
+ text: root.data.name;
+ placeholder: I18n.t("Untitled project");
+ autofocus: true;
+ enabled: !root.data.busy;
+ edited(text) => { root.name-edited(text); }
+ accepted => { root.create(); }
+ }
+ }
- Field {
- label: I18n.t("Location");
- stacked: root.narrow;
+ FormRow {
+ label: I18n.upper("Location");
+ stacked: root.narrow;
+
+ HorizontalLayout {
+ spacing: 12px;
+
+ PlainInput {
+ horizontal-stretch: 1;
+ text: root.data.location;
+ placeholder: I18n.t("Choose a folder");
+ size: Theme.fs;
+ face: Theme.font-technical;
+ enabled: !root.data.busy;
+ edited(text) => { root.location-edited(text); }
+ accepted => { root.create(); }
+ }
- HorizontalLayout {
- spacing: 12px;
-
- PlainInput {
- horizontal-stretch: 1;
- text: root.data.location;
- placeholder: I18n.t("Choose a folder");
- size: Theme.fs;
- face: Theme.font-technical;
- enabled: !root.data.busy;
- edited(text) => { root.location-edited(text); }
- accepted => { root.create(); }
+ VerticalLayout {
+ alignment: center;
+ horizontal-stretch: 0;
+ LinkButton {
+ label: I18n.t("Choose…");
+ enabled: !root.data.busy;
+ clicked => { root.browse(); }
+ }
+ }
+ }
}
- VerticalLayout {
- alignment: center;
- LinkButton {
- label: I18n.t("Choose…");
- enabled: !root.data.busy;
- clicked => { root.browse(); }
+ FormRow {
+ label: I18n.upper("Shape");
+ stacked: root.narrow;
+
+ HorizontalLayout {
+ spacing: 16px;
+
+ ChipRow {
+ horizontal-stretch: 1;
+ options: root.aspects;
+ current: root.data.aspect;
+ enabled: !root.data.busy;
+ block: root.narrow;
+ changed(index) => { root.aspect-changed(index); }
+ }
+
+ // The chosen frame at the row's end,
+ // drawn rather than described: the
+ // one thing on this screen that
+ // shows what the numbers mean.
+ if !root.narrow: VerticalLayout {
+ alignment: center;
+ horizontal-stretch: 0;
+ FrameShape {
+ room: 32px;
+ ratio: root.data.frame-aspect;
+ }
+ }
}
}
- }
- }
- Field {
- label: I18n.t("Resolution");
- stacked: root.narrow;
-
- // The control takes the row up to its natural width
- // and the whole row on a phone, where four labels
- // need every pixel there is.
- SegmentedControl {
- width: Math.min(312px, parent.width);
- options: root.resolutions;
- current <=> root.res-index;
- enabled: !root.data.busy;
- changed(index) => { root.resolution-changed(index); }
- }
+ FormRow {
+ label: I18n.upper("Size");
+ stacked: root.narrow;
- HorizontalLayout {
- spacing: 12px;
- alignment: start;
+ HorizontalLayout {
+ spacing: 16px;
- FrameShape {
- aspect: root.data.frame-aspect;
- }
+ ChipRow {
+ horizontal-stretch: 1;
+ options: root.sizes;
+ current: root.data.size;
+ enabled: !root.data.busy;
+ block: root.narrow;
+ changed(index) => { root.size-changed(index); }
+ }
- VerticalLayout {
- alignment: center;
- Text {
- text: root.data.size-readout;
- color: Theme.fg-dim;
- font-family: Theme.font-technical;
- font-size: Theme.fs-sm;
+ VerticalLayout {
+ alignment: center;
+ horizontal-stretch: 0;
+ Text {
+ text: root.data.size-readout;
+ color: Theme.fg-dim;
+ font-family: Theme.font-technical;
+ font-size: Theme.fs-sm;
+ }
+ }
}
}
- }
- }
- Field {
- label: I18n.t("Frame rate");
- last: true;
- stacked: root.narrow;
+ FormRow {
+ label: I18n.upper("Frame rate");
+ last: true;
+ stacked: root.narrow;
+
+ HorizontalLayout {
+ spacing: 16px;
+
+ ChipRow {
+ horizontal-stretch: 1;
+ options: root.rates;
+ current: root.data.rate;
+ enabled: !root.data.busy;
+ block: root.narrow;
+ changed(index) => { root.rate-changed(index); }
+ }
- SegmentedControl {
- width: Math.min(300px, parent.width);
- options: root.rates;
- current <=> root.rate-index;
- enabled: !root.data.busy;
- changed(index) => { root.rate-changed(index); }
- }
+ VerticalLayout {
+ alignment: center;
+ horizontal-stretch: 0;
+ Text {
+ text: root.data.rate-readout;
+ color: Theme.fg-dim;
+ font-family: Theme.font-technical;
+ font-size: Theme.fs-sm;
+ }
+ }
+ }
+ }
- Text {
- text: root.data.rate-readout;
- color: Theme.fg-dim;
- font-family: Theme.font-technical;
- font-size: Theme.fs-sm;
- }
- }
+ // The notice, above the button, wrapping to
+ // as many lines as the error takes: an
+ // elided error is half an error, and on a
+ // phone that is most of it.
+ if root.data.error != "": Rectangle {
+ height: notice.preferred-height + 4px;
+
+ notice := Rectangle {
+ x: 0;
+ y: 4px;
+ width: parent.width;
+ height: self.preferred-height;
+ border-radius: Theme.r;
+ background: Theme.danger-soft;
+
+ HorizontalLayout {
+ padding-left: 10px;
+ padding-right: 6px;
+ padding-top: 8px;
+ padding-bottom: 8px;
+ spacing: 8px;
+
+ VerticalLayout {
+ alignment: start;
+ padding-top: 2px;
+ Icon {
+ glyph: Glyph.info;
+ size: 13px;
+ tint: Theme.danger;
+ }
+ }
- // The notice, above the button, wrapping to as many
- // lines as the error takes: an elided error is half an
- // error, and on a phone that is most of it.
- if root.data.error != "": Rectangle {
- height: notice.preferred-height + 12px;
-
- notice := Rectangle {
- x: 0;
- y: 12px;
- width: parent.width;
- height: self.preferred-height;
- border-radius: Theme.r;
- background: Theme.danger-soft;
-
- HorizontalLayout {
- padding-left: 10px;
- padding-right: 6px;
- padding-top: 8px;
- padding-bottom: 8px;
- spacing: 8px;
+ Text {
+ horizontal-stretch: 1;
+ text: root.data.error;
+ color: Theme.danger;
+ font-size: Theme.fs;
+ wrap: word-wrap;
+ }
- VerticalLayout {
- alignment: start;
- padding-top: 2px;
- Icon {
- glyph: Glyph.info;
- size: 13px;
- tint: Theme.danger;
+ VerticalLayout {
+ alignment: start;
+ CopyChip {
+ text: root.data.error;
+ }
+ }
+
+ VerticalLayout {
+ alignment: start;
+ Rectangle {
+ width: 22px;
+ height: 22px;
+ border-radius: Theme.r-xs;
+
+ Icon {
+ x: (parent.width - self.width) / 2;
+ y: (parent.height - self.height) / 2;
+ glyph: Glyph.close;
+ size: 11px;
+ tint: Theme.danger;
+ }
+
+ TouchArea {
+ mouse-cursor: pointer;
+ clicked => { root.dismiss-error(); }
+ }
+ }
+ }
}
}
+ }
- Text {
- horizontal-stretch: 1;
- text: root.data.error;
- color: Theme.danger;
- font-size: Theme.fs;
- wrap: word-wrap;
+ Rectangle { height: 22px; }
+
+ // The button and the line about what
+ // pressing it does to the disk: side by
+ // side where there is room, the button
+ // across the width and the line under it on
+ // a phone, where a pill a thumb can miss is
+ // a pill that will be missed.
+ if !root.narrow: HorizontalLayout {
+ spacing: 18px;
+
+ PillButton {
+ primary: true;
+ label: root.data.busy
+ ? I18n.t("Creating…")
+ : I18n.t("Create");
+ enabled: root.can-create;
+ clicked => { root.create(); }
}
VerticalLayout {
- alignment: start;
- CopyChip {
- text: root.data.error;
+ alignment: center;
+ horizontal-stretch: 1;
+ Text {
+ text: I18n.t("The project folder is created now; the edit autosaves into it.");
+ color: Theme.fg-dim;
+ font-size: Theme.fs-sm;
+ wrap: word-wrap;
}
}
+ }
- VerticalLayout {
- alignment: start;
- Rectangle {
- width: 22px;
- height: 22px;
- border-radius: Theme.r-xs;
-
- Icon {
- x: (parent.width - self.width) / 2;
- y: (parent.height - self.height) / 2;
- glyph: Glyph.close;
- size: 11px;
- tint: Theme.danger;
- }
+ if root.narrow: VerticalLayout {
+ spacing: 12px;
+
+ PillButton {
+ primary: true;
+ block: true;
+ label: root.data.busy
+ ? I18n.t("Creating…")
+ : I18n.t("Create");
+ enabled: root.can-create;
+ clicked => { root.create(); }
+ }
- TouchArea {
- mouse-cursor: pointer;
- clicked => { root.dismiss-error(); }
- }
- }
+ Text {
+ text: I18n.t("The project folder is created now; the edit autosaves into it.");
+ color: Theme.fg-dim;
+ font-size: Theme.fs-sm;
+ horizontal-alignment: center;
+ wrap: word-wrap;
}
}
}
}
- Rectangle { height: root.narrow ? 28px : 40px; }
+ // ── a glance at the history, under the form ──────────
+ if root.page == 0 && root.recents.length > 0: VerticalLayout {
+ Rectangle { height: root.narrow ? 32px : 44px; }
- // ── the recents, under the form ──────────────────────
- //
- // Placed here rather than reflowed: a Slint layout has no
- // wrap, so the two arrangements are two shapes and each is
- // only built at the width the other cannot fit. On a phone
- // they come after the button, which is the thing the
- // screen is for and should not need a scroll to reach.
- if !root.side-by-side && !root.narrow && root.recents.length > 0: RecentsColumn {
- recents: root.recents;
- enabled: !root.data.busy;
- ruled: true;
- opened(path) => { root.open-recent(path); }
- forgotten(path) => { root.forget-recent(path); }
- }
+ HorizontalLayout {
+ height: 24px;
+ spacing: 8px;
+
+ Text {
+ text: I18n.t("Recent");
+ color: Theme.fg;
+ font-size: Theme.fs-xl;
+ font-weight: Theme.weight-title;
+ vertical-alignment: center;
+ }
- // The button and its note: side by side where there is
- // room, the button across the width and the note under
- // it on a phone, where a pill a thumb can miss is a pill
- // that will be missed.
- if !root.narrow: HorizontalLayout {
- alignment: start;
- spacing: 16px;
-
- CreateButton {
- busy: root.data.busy;
- enabled: root.can-create;
- clicked => { root.create(); }
- }
+ // How many, quietly: a count is the one
+ // thing a shelf of cards does not say about
+ // itself until it is scrolled.
+ Text {
+ text: root.recents.length;
+ color: Theme.fg-dim;
+ font-family: Theme.font-technical;
+ font-size: Theme.fs-sm;
+ vertical-alignment: center;
+ }
- VerticalLayout {
- alignment: center;
- horizontal-stretch: 1;
- CreateNote { }
+ Rectangle { horizontal-stretch: 1; }
+
+ // Only when the strip is holding something
+ // back. A link to the rest of nothing is a
+ // link to this page.
+ if root.recents.length > strip.shown: VerticalLayout {
+ alignment: center;
+ LinkButton {
+ label: I18n.t("See all");
+ clicked => { root.view = 1; }
+ }
+ }
}
- }
- if root.narrow: VerticalLayout {
- spacing: 12px;
+ Rectangle { height: 14px; }
- CreateButton {
- block: true;
- busy: root.data.busy;
- enabled: root.can-create;
- clicked => { root.create(); }
+ strip := RecentsGrid {
+ recents: root.recents;
+ enabled: !root.data.busy;
+ touchy: root.narrow;
+ one-row: true;
+ opened(path) => { root.open-recent(path); }
+ forgotten(path) => { root.forget-recent(path); }
}
-
- CreateNote { }
}
- if root.narrow && root.recents.length > 0: RecentsColumn {
+ // ── the whole history ────────────────────────────────
+ if root.page == 1: RecentsGrid {
recents: root.recents;
enabled: !root.data.busy;
- ruled: true;
- compact: true;
+ touchy: root.narrow;
opened(path) => { root.open-recent(path); }
forgotten(path) => { root.forget-recent(path); }
}
}
-
- // ── the recents, beside the form ─────────────────────────
- if root.side-by-side: RecentsColumn {
- width: root.recents-w;
- recents: root.recents;
- enabled: !root.data.busy;
- opened(path) => { root.open-recent(path); }
- forgotten(path) => { root.forget-recent(path); }
- }
}
}
- }
-
- // The segmented controls own their `current`: they write to it, and a
- // write replaces whatever binding was declared. Seeded from the published
- // form instead, the way the inspector's tab strip is.
- property <int> res-index;
- property <int> rate-index;
- function seed() {
- root.res-index = root.data.resolution;
- root.rate-index = root.data.rate;
- }
- init => { root.seed(); }
- changed data => { root.seed(); }
- if flick.interactive: ThinScrollbar {
- x: parent.width - self.width - 2px;
- y: 0;
- height: root.height;
- viewport: root.height;
- content: flick.viewport-height;
- offset: -flick.viewport-y;
- scrolled(to) => { flick.viewport-y = -to; }
+ if flick.interactive: ThinScrollbar {
+ x: parent.width - self.width - 2px;
+ y: 0;
+ height: parent.height;
+ viewport: parent.height;
+ content: flick.viewport-height;
+ offset: -flick.viewport-y;
+ scrolled(to) => { flick.viewport-y = -to; }
+ }
}
}
diff --git a/src/crates/concat/ui/theme/dark.slint b/src/crates/concat/ui/theme/dark.slint
index f813b7b2..043d83e0 100644
--- a/src/crates/concat/ui/theme/dark.slint
+++ b/src/crates/concat/ui/theme/dark.slint
@@ -84,6 +84,27 @@ export global Dark {
out property <color> field-hover: #3b3b3e;
out property <color> field-active: #46464a;
+ // the launch screen's own ladder — a deeper cut of the one above
+ //
+ // The window before a project is open is not a window full of panes, so
+ // the reasoning that holds the everyday ladder up in the mid-darks does
+ // not apply to it: there are no gutters to widen, no lanes to sit under
+ // a panel, and nothing on screen that has to be told from four other
+ // surfaces at a glance. What there is instead is one card, one rail and
+ // a great deal of air — which is exactly the arrangement a near-black
+ // ground flatters, and the one the website opens on.
+ //
+ // Same five steps in the same order, so every rule written above still
+ // reads: `launch-well` is sunken under the card, `launch-raised` is the
+ // lift a hover gives, `launch-field` is a chip that is the answer. Only
+ // the whole ladder has moved down.
+ out property <color> launch-page: #0e0e10;
+ out property <color> launch-panel: #161619;
+ out property <color> launch-well: #101013;
+ out property <color> launch-raised: #1e1e22;
+ out property <color> launch-field: #26262b;
+ out property <color> launch-field-active: #313138;
+
// hairlines — white-alpha, so they hold on panel, well, and ground alike.
out property <color> line: #ffffff1a; // rgb(255 255 255 / 0.1)
out property <color> line-strong: #ffffff33; // rgb(255 255 255 / 0.2)
@@ -92,6 +113,11 @@ export global Dark {
out property <color> fg: #f5f5f7;
out property <color> fg-muted: #a1a1a6;
out property <color> fg-dim: #6e6e73;
+ // One step past `fg`, away from the ground: pure white here, pure black
+ // on the light palette. For the one button whose fill *is* the ink —
+ // the launch screen's Create — where hover has to mean more contrast
+ // and there is no surface left above `fg` to go to.
+ out property <color> fg-hot: #ffffff;
// accents
//
diff --git a/src/crates/concat/ui/theme/light.slint b/src/crates/concat/ui/theme/light.slint
index a9756c39..26102070 100644
--- a/src/crates/concat/ui/theme/light.slint
+++ b/src/crates/concat/ui/theme/light.slint
@@ -60,6 +60,18 @@ export global Light {
out property <color> field-hover: #e8e8ec;
out property <color> field-active: #d6d6dd;
+ // the launch screen's own ladder — see the dark palette for why it
+ // exists. Deeper here too, which on this side of the switch means a
+ // greyer page and panes that stop short of white: the launcher is the
+ // one screen with no picture on it, and it is allowed to be the quiet
+ // room the rest of the app is not.
+ out property <color> launch-page: #c4c4cd;
+ out property <color> launch-panel: #ededf1;
+ out property <color> launch-well: #d6d6dd;
+ out property <color> launch-raised: #f7f7f8;
+ out property <color> launch-field: #e2e2e8;
+ out property <color> launch-field-active: #cdcdd6;
+
// hairlines — black-alpha, the mirror of the dark palette's white-alpha,
// so they hold on panel, well, and ground alike. A shade heavier than a
// straight inversion: dark hairlines on light surfaces are read at lower
@@ -72,6 +84,8 @@ export global Light {
out property <color> fg: #16161a;
out property <color> fg-muted: #56565e;
out property <color> fg-dim: #86868c;
+ // Away from a light ground is down, not up; see the dark palette.
+ out property <color> fg-hot: #000000;
// accents
//
diff --git a/src/crates/concat/ui/theme/theme.slint b/src/crates/concat/ui/theme/theme.slint
index fb93cf83..45b7db63 100644
--- a/src/crates/concat/ui/theme/theme.slint
+++ b/src/crates/concat/ui/theme/theme.slint
@@ -110,6 +110,17 @@ export global Theme {
out property <color> field-hover: dark ? Dark.field-hover : Light.field-hover;
out property <color> field-active: dark ? Dark.field-active : Light.field-active;
+ // the launch screen's ladder: the same five steps, cut deeper. Read by
+ // start.slint and by the title strip while it is up, and by nothing
+ // else — the editor keeps the ladder above.
+ out property <color> launch-page: dark ? Dark.launch-page : Light.launch-page;
+ out property <color> launch-panel: dark ? Dark.launch-panel : Light.launch-panel;
+ out property <color> launch-well: dark ? Dark.launch-well : Light.launch-well;
+ out property <color> launch-raised: dark ? Dark.launch-raised : Light.launch-raised;
+ out property <color> launch-field: dark ? Dark.launch-field : Light.launch-field;
+ out property <color> launch-field-active:
+ dark ? Dark.launch-field-active : Light.launch-field-active;
+
// hairlines
out property <color> line: dark ? Dark.line : Light.line;
out property <color> line-strong: dark ? Dark.line-strong : Light.line-strong;
@@ -118,6 +129,7 @@ export global Theme {
out property <color> fg: dark ? Dark.fg : Light.fg;
out property <color> fg-muted: dark ? Dark.fg-muted : Light.fg-muted;
out property <color> fg-dim: dark ? Dark.fg-dim : Light.fg-dim;
+ out property <color> fg-hot: dark ? Dark.fg-hot : Light.fg-hot;
// accents
out property <color> accent: dark ? Dark.accent : Light.accent;
diff --git a/src/crates/concat/ui/title-bar.slint b/src/crates/concat/ui/title-bar.slint
index e629f60c..953aca53 100644
--- a/src/crates/concat/ui/title-bar.slint
+++ b/src/crates/concat/ui/title-bar.slint
@@ -116,6 +116,11 @@ export component TitleBar inherits Rectangle {
/// act on an edit, and on this screen there is neither — a strip of
/// controls that all refuse is worse than a strip without them.
in property <bool> minimal;
+ /// The launch screen is under the strip, which has a ground of its own —
+ /// a deeper one than the editor's. The strip takes that ground rather
+ /// than its usual panel, so the launcher reads as one room and not as a
+ /// dark window with a light lid. See the `launch-` ladder in theme/.
+ in property <bool> deep;
/// Draw the window buttons at the right: true wherever the platform's
/// decorations were taken off, which is everywhere but macOS.
@@ -139,7 +144,7 @@ export component TitleBar inherits Rectangle {
callback export-clicked();
height: 32px;
- background: Theme.panel;
+ background: root.deep ? Theme.launch-page : Theme.panel;
property <bool> drag-armed: false;
property <length> press-x: 0px;