Slint cannot split the .slint compilation across crates, but a Slint LIBRARY crate exposes its generated Rust types to dependent crates (verified with a minimal proof). So: - NEW crate `qbz-ui` (lib): owns the whole .slint tree + build.rs + bundled translations; `slint::include_modules!()` + the generated types (AppWindow, MiniPlayerWindow, all globals/structs) are re-exported. Translation domain is now `qbz-ui` (the .po files renamed accordingly). - `qbz-slint` (bin) -> renamed to `qbz` (package + `[[bin]] name = "qbz"`), reclaiming the binary name from the retired Tauri app. It depends on `qbz-ui` and does `pub use qbz_ui::*;` so existing `crate::AppWindow` / `crate::*State` references resolve unchanged. This splits the single ~20 GB rustc into two crates (UI/codegen vs the 75k LOC of logic) — the foundation for lower build peak, incremental caching, and the upcoming per-feature crate extraction. Also fixed for the move: qbz-i18n bundled-.po include paths, the font/WGSL `include_bytes!`/`include_str!` paths (-> ../../qbz-ui/ui/), workspace members, dev scripts (`-p qbz`), and the CI workflows. `cargo check -p qbz` is green. cc
105 lines
4.3 KiB
Plaintext
105 lines
4.3 KiB
Plaintext
// "Create folder" modal — a name field + Create. Opened from the
|
|
// sidebar's "New folder" action (CreateFolderState.open).
|
|
|
|
import { Theme } from "../foundation/semantic-colors.slint";
|
|
import { Typography } from "../foundation/typography.slint";
|
|
import { Radius } from "../foundation/radius.slint";
|
|
import { CreateFolderState, CreateFolderActions } from "../state.slint";
|
|
import { QbzIcon } from "QbzIcon.slint";
|
|
import { LineEdit } from "std-widgets.slint";
|
|
|
|
export component CreateFolderModal inherits Rectangle {
|
|
visible: CreateFolderState.open;
|
|
|
|
if CreateFolderState.open: Rectangle {
|
|
background: #000000bf;
|
|
TouchArea {
|
|
mouse-cursor: default;
|
|
clicked => {
|
|
CreateFolderActions.close();
|
|
}
|
|
}
|
|
Rectangle {
|
|
width: Math.min(root.width - 80px, 400px);
|
|
height: panel.preferred-height;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
border-radius: Radius.md;
|
|
background: Theme.surface-card;
|
|
border-width: 1px;
|
|
border-color: Theme.border-subtle;
|
|
drop-shadow-blur: 32px;
|
|
drop-shadow-color: #00000080;
|
|
TouchArea { }
|
|
|
|
panel := VerticalLayout {
|
|
padding: 20px;
|
|
spacing: 16px;
|
|
|
|
HorizontalLayout {
|
|
Text {
|
|
text: @tr("New folder");
|
|
color: Theme.text-primary;
|
|
font-size: Typography.heading;
|
|
font-weight: Typography.semibold;
|
|
horizontal-stretch: 1;
|
|
vertical-alignment: center;
|
|
}
|
|
close-x := TouchArea {
|
|
width: 28px;
|
|
height: 28px;
|
|
mouse-cursor: pointer;
|
|
clicked => {
|
|
CreateFolderActions.close();
|
|
}
|
|
QbzIcon {
|
|
source: @image-url("../assets/icons/x.svg");
|
|
width: 17px;
|
|
height: 17px;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
tint: close-x.has-hover ? Theme.text-primary : Theme.text-muted;
|
|
}
|
|
}
|
|
}
|
|
|
|
name-input := LineEdit {
|
|
placeholder-text: @tr("Folder name");
|
|
text <=> CreateFolderState.name;
|
|
accepted => {
|
|
CreateFolderActions.submit();
|
|
}
|
|
}
|
|
|
|
HorizontalLayout {
|
|
alignment: end;
|
|
Rectangle {
|
|
width: create-label.preferred-width + 36px;
|
|
height: 36px;
|
|
border-radius: Radius.sm;
|
|
opacity: (CreateFolderState.name != "" && !CreateFolderState.creating) ? 1.0 : 0.5;
|
|
background: create-ta.has-hover ? #ffffffd6 : Theme.accent;
|
|
create-label := Text {
|
|
text: CreateFolderState.creating ? @tr("Creating...") : @tr("Create");
|
|
color: #ffffff;
|
|
font-size: Typography.body;
|
|
font-weight: Typography.semibold;
|
|
x: Math.round((parent.width - self.width) / 2 / 1px) * 1px;
|
|
y: Math.round((parent.height - self.height) / 2 / 1px) * 1px;
|
|
}
|
|
create-ta := TouchArea {
|
|
mouse-cursor: (CreateFolderState.name != "" && !CreateFolderState.creating)
|
|
? pointer : default;
|
|
clicked => {
|
|
if (CreateFolderState.name != "" && !CreateFolderState.creating) {
|
|
CreateFolderActions.submit();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|