S034: screenshot matrix and UI review fixes
--matrix renders every screen light/dark, hovered/pressed, empty/full and at 720x480. Fixes: breadcrumb overflow mark, compact toolbar, names-only narrow panes, short-window dialogs, scrolling settings pages. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
parent
cf70592958
commit
b042dfe29c
10 changed files with 431 additions and 22 deletions
|
|
@ -29,7 +29,8 @@ use tunal_core::{Locations, Uri};
|
|||
slint::include_modules!();
|
||||
|
||||
const USAGE: &str = "usage: tunal [<folder>…] [--split <folder> <folder>] \
|
||||
[--gallery [--page menu|dialog|connection|host-key|secret]] [--screenshot <png> [--dark] [--size WxH]]";
|
||||
[--gallery [--page menu|dialog|connection|host-key|secret]] [--screenshot <png> [--dark] [--size WxH]] \
|
||||
| --matrix <dir>";
|
||||
|
||||
fn main() -> ExitCode {
|
||||
// Root helper (`pkexec tunal --elevated-helper`): before any UI, theme or env lookups.
|
||||
|
|
@ -39,7 +40,21 @@ fn main() -> ExitCode {
|
|||
Err(_) => ExitCode::FAILURE,
|
||||
};
|
||||
}
|
||||
let result = parse(std::env::args().skip(1)).and_then(|args| match args.screenshot {
|
||||
let mut argv = std::env::args().skip(1);
|
||||
if std::env::args().nth(1).as_deref() == Some("--matrix") {
|
||||
let result = match (argv.nth(1), argv.next()) {
|
||||
(Some(dir), None) => screenshot::matrix(std::path::Path::new(&dir)),
|
||||
_ => Err(USAGE.into()),
|
||||
};
|
||||
return match result {
|
||||
Ok(()) => ExitCode::SUCCESS,
|
||||
Err(message) => {
|
||||
eprintln!("tunal: {message}");
|
||||
ExitCode::FAILURE
|
||||
}
|
||||
};
|
||||
}
|
||||
let result = parse(argv).and_then(|args| match args.screenshot {
|
||||
None if args.gallery => gallery(args.page).and_then(run).map_err(|e| e.to_string()),
|
||||
None => window(args.tabs, false)
|
||||
.and_then(|(ui, shell)| {
|
||||
|
|
@ -64,6 +79,13 @@ fn main() -> ExitCode {
|
|||
|| {
|
||||
if let Some(shell) = shell.borrow().as_ref() {
|
||||
shell.settle_thumbs();
|
||||
// `TUNAL_ACTION=<id>` runs a menu action on what `TUNAL_POINTER` selected.
|
||||
if let Some(action) = std::env::var("TUNAL_ACTION")
|
||||
.ok()
|
||||
.and_then(|id| actions::Action::from_id(&id))
|
||||
{
|
||||
shell.run_action(action);
|
||||
}
|
||||
}
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -56,13 +56,20 @@ pub fn run<C: Themed>(
|
|||
window.set_size(PhysicalSize::new(width, height));
|
||||
ui.show().map_err(|e| e.to_string())?;
|
||||
let mut pixels = vec![PremultipliedRgbaColor::default(); (width * height) as usize];
|
||||
if let Ok(spec) = std::env::var("TUNAL_DRAG") {
|
||||
let drag_spec = std::env::var("TUNAL_DRAG").ok();
|
||||
let pointer_spec = std::env::var("TUNAL_POINTER").ok();
|
||||
if drag_spec.is_some() || pointer_spec.is_some() {
|
||||
// Lay the window out before pointing at it.
|
||||
window.draw_if_needed(|renderer| {
|
||||
renderer.render(&mut pixels, width as usize);
|
||||
});
|
||||
}
|
||||
if let Some(spec) = drag_spec {
|
||||
drag(&window, &spec);
|
||||
}
|
||||
if let Some(spec) = pointer_spec {
|
||||
pointer(&window, &spec);
|
||||
}
|
||||
// Lay the window out once so the views report what they show, then let work they asked
|
||||
// for (thumbnails) finish before the frame.
|
||||
window.draw_if_needed(|renderer| {
|
||||
|
|
@ -112,6 +119,324 @@ fn drag(window: &MinimalSoftwareWindow, spec: &str) {
|
|||
slint::platform::update_timers_and_animations();
|
||||
}
|
||||
|
||||
/// `TUNAL_POINTER=x,y[,press|click|menu]`: hovers a window point, or holds the button
|
||||
/// down there (`press`), clicks it (`click`, selects a row) or right-clicks it (`menu`).
|
||||
fn pointer(window: &MinimalSoftwareWindow, spec: &str) {
|
||||
use slint::LogicalPosition;
|
||||
use slint::platform::{PointerEventButton, WindowEvent};
|
||||
let parts: Vec<&str> = spec.split(',').map(str::trim).collect();
|
||||
let n: Vec<f32> = parts.iter().filter_map(|p| p.parse().ok()).collect();
|
||||
let [x, y] = n[..] else {
|
||||
eprintln!("tunal: TUNAL_POINTER wants x,y[,press|click|menu]");
|
||||
return;
|
||||
};
|
||||
let position = LogicalPosition::new(x, y);
|
||||
window.dispatch_event(WindowEvent::PointerMoved { position });
|
||||
let (button, release) = match parts.get(2) {
|
||||
Some(&"press") => (PointerEventButton::Left, false),
|
||||
Some(&"click") => (PointerEventButton::Left, true),
|
||||
Some(&"menu") => (PointerEventButton::Right, true),
|
||||
_ => {
|
||||
slint::platform::update_timers_and_animations();
|
||||
return;
|
||||
}
|
||||
};
|
||||
window.dispatch_event(WindowEvent::PointerPressed { position, button });
|
||||
if release {
|
||||
window.dispatch_event(WindowEvent::PointerReleased { position, button });
|
||||
}
|
||||
slint::platform::update_timers_and_animations();
|
||||
}
|
||||
|
||||
/// One screenshot of the matrix: a name, the arguments after the output path and its env.
|
||||
struct Cell {
|
||||
name: &'static str,
|
||||
args: Vec<String>,
|
||||
env: Vec<(&'static str, String)>,
|
||||
/// Also rendered dark.
|
||||
dark: bool,
|
||||
}
|
||||
|
||||
/// `tunal --matrix <dir>`: renders every screen (shell, views, dialogs, settings pages,
|
||||
/// gallery) light and dark, hovered and pressed, empty and full, and at the smallest window
|
||||
/// size into `<dir>`, one child process per PNG over a stand-in folder in `<dir>/fixture`.
|
||||
pub fn matrix(dir: &Path) -> Result<(), String> {
|
||||
let exe = std::env::current_exe().map_err(|e| e.to_string())?;
|
||||
let fixture = dir.join("fixture");
|
||||
let full = fixture.join("Project files");
|
||||
let empty = fixture.join("Empty folder");
|
||||
let config = dir.join("config");
|
||||
let song = full.join("Evening tide.flac");
|
||||
fixture_files(&full, &empty, &config, &song).map_err(|e| format!("fixture: {e}"))?;
|
||||
let s = |p: &Path| p.display().to_string();
|
||||
let a = |list: &[&str]| list.iter().map(|x| x.to_string()).collect::<Vec<_>>();
|
||||
let shell = |name, args: Vec<String>, env: Vec<(&'static str, String)>, dark| Cell {
|
||||
name,
|
||||
args,
|
||||
env,
|
||||
dark,
|
||||
};
|
||||
let folder = vec![s(&full)];
|
||||
let sized = |size: &str| [folder.clone(), a(&["--size", size])].concat();
|
||||
let normal = sized("1200x760");
|
||||
let min = sized("720x480");
|
||||
let on = |key: &'static str, value: &str| vec![(key, value.to_string())];
|
||||
// A file row, the second in the details view at 1200x760.
|
||||
let row = "520,170";
|
||||
let mut cells = vec![
|
||||
shell("shell-full", normal.clone(), vec![], true),
|
||||
shell("shell-grid", normal.clone(), on("TUNAL_VIEW", "grid"), true),
|
||||
shell(
|
||||
"shell-empty",
|
||||
[vec![s(&empty)], a(&["--size", "1200x760"])].concat(),
|
||||
vec![],
|
||||
true,
|
||||
),
|
||||
shell(
|
||||
"shell-split",
|
||||
[
|
||||
a(&["--split"]),
|
||||
vec![s(&full), s(&empty)],
|
||||
a(&["--size", "1200x760"]),
|
||||
]
|
||||
.concat(),
|
||||
vec![],
|
||||
true,
|
||||
),
|
||||
shell("shell-min", min.clone(), vec![], true),
|
||||
shell(
|
||||
"shell-min-split",
|
||||
[
|
||||
a(&["--split"]),
|
||||
vec![s(&full), s(&empty)],
|
||||
a(&["--size", "720x480"]),
|
||||
]
|
||||
.concat(),
|
||||
vec![],
|
||||
false,
|
||||
),
|
||||
shell("row-hover", normal.clone(), on("TUNAL_POINTER", row), true),
|
||||
shell(
|
||||
"row-pressed",
|
||||
normal.clone(),
|
||||
on("TUNAL_POINTER", &format!("{row},press")),
|
||||
true,
|
||||
),
|
||||
shell(
|
||||
"row-selected",
|
||||
normal.clone(),
|
||||
on("TUNAL_POINTER", &format!("{row},click")),
|
||||
false,
|
||||
),
|
||||
shell(
|
||||
"context-menu",
|
||||
normal.clone(),
|
||||
on("TUNAL_POINTER", &format!("{row},menu")),
|
||||
true,
|
||||
),
|
||||
shell(
|
||||
"drag-hold",
|
||||
normal.clone(),
|
||||
on("TUNAL_DRAG", "520,170,520,240,hold"),
|
||||
false,
|
||||
),
|
||||
shell(
|
||||
"rename",
|
||||
normal.clone(),
|
||||
[
|
||||
on("TUNAL_POINTER", &format!("{row},click")),
|
||||
on("TUNAL_ACTION", "rename"),
|
||||
]
|
||||
.concat(),
|
||||
false,
|
||||
),
|
||||
shell(
|
||||
"properties",
|
||||
normal.clone(),
|
||||
[
|
||||
on("TUNAL_POINTER", &format!("{row},click")),
|
||||
on("TUNAL_ACTION", "properties"),
|
||||
]
|
||||
.concat(),
|
||||
true,
|
||||
),
|
||||
shell(
|
||||
"properties-min",
|
||||
min.clone(),
|
||||
[
|
||||
on("TUNAL_POINTER", "420,170,click"),
|
||||
on("TUNAL_ACTION", "properties"),
|
||||
]
|
||||
.concat(),
|
||||
false,
|
||||
),
|
||||
shell(
|
||||
"open-with",
|
||||
normal.clone(),
|
||||
[
|
||||
on("TUNAL_POINTER", &format!("{row},click")),
|
||||
on("TUNAL_ACTION", "open-with"),
|
||||
]
|
||||
.concat(),
|
||||
true,
|
||||
),
|
||||
shell(
|
||||
"delete-confirm",
|
||||
normal.clone(),
|
||||
[
|
||||
on("TUNAL_POINTER", &format!("{row},click")),
|
||||
on("TUNAL_ACTION", "delete"),
|
||||
]
|
||||
.concat(),
|
||||
true,
|
||||
),
|
||||
shell(
|
||||
"appearance",
|
||||
normal.clone(),
|
||||
on("TUNAL_APPEARANCE", "1"),
|
||||
true,
|
||||
),
|
||||
shell("player", normal.clone(), on("TUNAL_PLAY", &s(&song)), true),
|
||||
shell(
|
||||
"tag-editor",
|
||||
normal.clone(),
|
||||
[
|
||||
on("TUNAL_TAGS", &format!("editor:{}", s(&song))),
|
||||
on("TUNAL_TAGS_SYNC", "1"),
|
||||
]
|
||||
.concat(),
|
||||
true,
|
||||
),
|
||||
];
|
||||
for page in 0..=5 {
|
||||
let name = [
|
||||
"settings-0",
|
||||
"settings-1",
|
||||
"settings-2",
|
||||
"settings-3",
|
||||
"settings-4",
|
||||
"settings-5",
|
||||
][page];
|
||||
cells.push(shell(
|
||||
name,
|
||||
normal.clone(),
|
||||
on("TUNAL_SETTINGS", &page.to_string()),
|
||||
true,
|
||||
));
|
||||
}
|
||||
cells.push(shell("settings-min", min, on("TUNAL_SETTINGS", "0"), false));
|
||||
for (name, page) in [
|
||||
("gallery-menu", "menu"),
|
||||
("gallery-dialog", "dialog"),
|
||||
("gallery-connection", "connection"),
|
||||
("gallery-host-key", "host-key"),
|
||||
("gallery-secret", "secret"),
|
||||
] {
|
||||
cells.push(shell(
|
||||
name,
|
||||
a(&["--gallery", "--page", page, "--size", "960x640"]),
|
||||
vec![],
|
||||
true,
|
||||
));
|
||||
}
|
||||
cells.push(shell(
|
||||
"gallery-controls",
|
||||
a(&["--gallery", "--size", "1200x1000"]),
|
||||
vec![],
|
||||
true,
|
||||
));
|
||||
|
||||
let mut failed = Vec::new();
|
||||
for cell in &cells {
|
||||
for dark in [false, true] {
|
||||
if dark && !cell.dark {
|
||||
continue;
|
||||
}
|
||||
let png = dir.join(format!(
|
||||
"{}-{}.png",
|
||||
cell.name,
|
||||
if dark { "dark" } else { "light" }
|
||||
));
|
||||
let mut command = std::process::Command::new(&exe);
|
||||
command
|
||||
.args(&cell.args)
|
||||
.arg("--screenshot")
|
||||
.arg(&png)
|
||||
.env("XDG_CONFIG_HOME", &config)
|
||||
.env("TUNAL_REDUCED_MOTION", "1")
|
||||
.envs(cell.env.iter().map(|(k, v)| (k, v)));
|
||||
if dark {
|
||||
command.arg("--dark");
|
||||
}
|
||||
let ok = command.status().is_ok_and(|s| s.success()) && png.exists();
|
||||
println!("{} {}", if ok { "ok " } else { "FAIL" }, png.display());
|
||||
if !ok {
|
||||
failed.push(png.display().to_string());
|
||||
}
|
||||
}
|
||||
}
|
||||
if failed.is_empty() {
|
||||
Ok(())
|
||||
} else {
|
||||
Err(format!("{} screenshots failed", failed.len()))
|
||||
}
|
||||
}
|
||||
|
||||
/// The stand-in folders: a full one (folders, documents, images, an audio file with tags),
|
||||
/// an empty one, and a config folder with the user's places but no saved session.
|
||||
fn fixture_files(full: &Path, empty: &Path, config: &Path, song: &Path) -> std::io::Result<()> {
|
||||
std::fs::create_dir_all(empty)?;
|
||||
std::fs::create_dir_all(config.join("tunal"))?;
|
||||
if let Some(home) = std::env::var_os("HOME") {
|
||||
let dirs = Path::new(&home).join(".config/user-dirs.dirs");
|
||||
if dirs.exists() {
|
||||
std::fs::copy(dirs, config.join("user-dirs.dirs"))?;
|
||||
}
|
||||
}
|
||||
for name in ["Designs", "Invoices", "Photos 2026"] {
|
||||
std::fs::create_dir_all(full.join(name))?;
|
||||
}
|
||||
for (name, size) in [
|
||||
("Meeting notes.txt", 2_400),
|
||||
("Quarterly report.pdf", 482_000),
|
||||
("budget.ods", 31_000),
|
||||
("cover-draft.svg", 12_000),
|
||||
("install.sh", 900),
|
||||
("archive-2025.tar.gz", 8_400_000),
|
||||
(
|
||||
"A very long file name that keeps going well past the column width.md",
|
||||
1_200,
|
||||
),
|
||||
] {
|
||||
let path = full.join(name);
|
||||
if !path.exists() {
|
||||
std::fs::write(path, vec![b'x'; size])?;
|
||||
}
|
||||
}
|
||||
if !song.exists() {
|
||||
// A short tone with tags; skipped without ffmpeg (the player cells then fail).
|
||||
let _ = std::process::Command::new("ffmpeg")
|
||||
.args([
|
||||
"-loglevel",
|
||||
"error",
|
||||
"-f",
|
||||
"lavfi",
|
||||
"-i",
|
||||
"sine=frequency=330:duration=8",
|
||||
])
|
||||
.args([
|
||||
"-metadata",
|
||||
"title=Evening tide",
|
||||
"-metadata",
|
||||
"artist=Harbour Lights",
|
||||
])
|
||||
.args(["-metadata", "album=Low Water"])
|
||||
.arg(song)
|
||||
.status();
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_png(path: &Path, width: u32, height: u32, rgba: &[u8]) -> Result<(), png::EncodingError> {
|
||||
let mut encoder = png::Encoder::new(BufWriter::new(File::create(path)?), width, height);
|
||||
encoder.set_color(png::ColorType::Rgba);
|
||||
|
|
|
|||
|
|
@ -212,6 +212,17 @@ export component MainWindow inherits Window {
|
|||
// Sidebar.
|
||||
in property <[SidebarSection]> sections;
|
||||
in property <bool> show-sidebar: true;
|
||||
// Set after a resize, not bound: the window's size depends on the toolbar's buttons.
|
||||
property <bool> toolbar-compact;
|
||||
function fit-toolbar() {
|
||||
root.toolbar-compact = root.width - (root.show-sidebar ? 240px : 0) < Theme.toolbar-compact-width;
|
||||
}
|
||||
changed width => {
|
||||
root.fit-toolbar();
|
||||
}
|
||||
changed show-sidebar => {
|
||||
root.fit-toolbar();
|
||||
}
|
||||
in property <[MenuItem]> place-menu;
|
||||
callback toggle-sidebar();
|
||||
callback place-opened(int, int, bool);
|
||||
|
|
@ -495,6 +506,7 @@ export component MainWindow inherits Window {
|
|||
|
||||
VerticalLayout {
|
||||
toolbar := Toolbar {
|
||||
compact: root.toolbar-compact;
|
||||
can-back: root.can-back;
|
||||
can-forward: root.can-forward;
|
||||
can-up: root.can-up;
|
||||
|
|
|
|||
|
|
@ -142,7 +142,8 @@ export component Dialog inherits Overlay {
|
|||
spacing: Theme.space-4;
|
||||
|
||||
// The cookie turns into place as the dialog opens.
|
||||
if root.glyph != "": HorizontalLayout {
|
||||
// A short window drops the cookie so the content keeps its room.
|
||||
if root.glyph != "" && root.height >= Theme.dialog-cookie-min-height: HorizontalLayout {
|
||||
alignment: center;
|
||||
|
||||
Shape {
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ export global Icons {
|
|||
out property <string> expand-more: "\u{e5cf}";
|
||||
out property <string> side-navigation: "\u{e9e2}";
|
||||
out property <string> more-vert: "\u{e5d4}";
|
||||
out property <string> more-horiz: "\u{e5d3}";
|
||||
out property <string> drag-handle: "\u{e945}";
|
||||
out property <string> restore: "\u{e8b3}";
|
||||
out property <string> create-new-folder: "\u{e2cc}";
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
import { ScrollView } from "std-widgets.slint";
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Motion } from "../motion.slint";
|
||||
import { Dialog } from "../components/dialog.slint";
|
||||
|
|
@ -212,9 +213,10 @@ export component SettingsDialog inherits Dialog {
|
|||
root.closed();
|
||||
}
|
||||
|
||||
// The pages scroll when the window is too short for them.
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
height: 400px;
|
||||
height: min(400px, max(160px, root.height - 250px));
|
||||
|
||||
VerticalLayout {
|
||||
width: 168px;
|
||||
|
|
@ -234,6 +236,10 @@ export component SettingsDialog inherits Dialog {
|
|||
Rectangle {
|
||||
horizontal-stretch: 1;
|
||||
|
||||
if root.page < 5: ScrollView {
|
||||
VerticalLayout {
|
||||
alignment: start;
|
||||
|
||||
if root.page == 0: VerticalLayout {
|
||||
alignment: start;
|
||||
|
||||
|
|
@ -517,6 +523,9 @@ export component SettingsDialog inherits Dialog {
|
|||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if root.page == 5: MenuEditor {
|
||||
contexts: root.menu-contexts;
|
||||
context: root.menu-context;
|
||||
|
|
|
|||
|
|
@ -127,8 +127,10 @@ export component Breadcrumb inherits Rectangle {
|
|||
}
|
||||
|
||||
// Crumbs keep their natural width; when they don't fit, the first one elides, and past
|
||||
// that the row slides left so the current folder stays in view.
|
||||
if !root.editing: HorizontalLayout {
|
||||
// that the row slides left so the current folder stays in view, behind an ellipsis that
|
||||
// marks the hidden part (a click on it edits the path).
|
||||
if !root.editing: Rectangle {
|
||||
row := HorizontalLayout {
|
||||
x: min(0, root.width - self.width);
|
||||
width: max(root.width, self.min-width);
|
||||
padding-left: Theme.space-1;
|
||||
|
|
@ -168,6 +170,26 @@ export component Breadcrumb inherits Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
if row.x < 0: Rectangle {
|
||||
x: 0;
|
||||
width: Theme.space-8;
|
||||
background: Theme.surface-container-high;
|
||||
|
||||
Icon {
|
||||
glyph: Icons.more-horiz;
|
||||
size: 18px;
|
||||
color: Theme.on-surface-variant;
|
||||
}
|
||||
|
||||
TouchArea {
|
||||
mouse-cursor: MouseCursor.text;
|
||||
clicked => {
|
||||
root.edit();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
keys := FocusScope {
|
||||
visible: root.editing;
|
||||
enabled: root.editing;
|
||||
|
|
|
|||
|
|
@ -48,6 +48,9 @@ export component Toolbar inherits Rectangle {
|
|||
}
|
||||
|
||||
height: 56px;
|
||||
// A short bar (the smallest window) drops Forward (Alt+Right) and the previews toggle so
|
||||
// the path keeps its room. Set by the window: the bar's own width depends on its buttons.
|
||||
in property <bool> compact;
|
||||
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-2;
|
||||
|
|
@ -81,7 +84,7 @@ export component Toolbar inherits Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
if !root.compact: VerticalLayout {
|
||||
alignment: center;
|
||||
IconButton {
|
||||
icon: Icons.arrow-forward;
|
||||
|
|
@ -110,8 +113,8 @@ export component Toolbar inherits Rectangle {
|
|||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
padding-left: Theme.space-2;
|
||||
padding-right: Theme.space-2;
|
||||
padding-left: root.compact ? 0 : Theme.space-2;
|
||||
padding-right: root.compact ? 0 : Theme.space-2;
|
||||
|
||||
crumb := Breadcrumb {
|
||||
crumbs: root.crumbs;
|
||||
|
|
@ -142,7 +145,7 @@ export component Toolbar inherits Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
VerticalLayout {
|
||||
if !root.compact: VerticalLayout {
|
||||
alignment: center;
|
||||
IconButton {
|
||||
// `checked` is flipped by the click: follow `previews` again after it.
|
||||
|
|
|
|||
|
|
@ -100,6 +100,10 @@ export global Theme {
|
|||
out property <float> scrim-opacity: 0.32;
|
||||
// Gap kept between a floating surface and the window edge.
|
||||
out property <length> window-margin: 8px;
|
||||
// Below this window height dialogs drop their cookie; below this width the toolbar
|
||||
// drops its secondary buttons.
|
||||
out property <length> dialog-cookie-min-height: 560px;
|
||||
out property <length> toolbar-compact-width: 640px;
|
||||
|
||||
// Keyboard focus ring, drawn outside the control's shape.
|
||||
out property <length> focus-ring-width: 2px;
|
||||
|
|
|
|||
|
|
@ -437,6 +437,8 @@ export component DetailsView inherits Rectangle {
|
|||
|
||||
// Narrow views drop the Type column so names keep their room.
|
||||
property <bool> compact: root.width < 640px;
|
||||
// A narrow pane (split at the smallest window) shows only the names.
|
||||
property <bool> narrow: root.width < 400px;
|
||||
property <float> settle: Motion.settle(root.motion);
|
||||
|
||||
public function focus-view() {
|
||||
|
|
@ -537,7 +539,7 @@ export component DetailsView inherits Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
HeaderColumn {
|
||||
if !root.narrow: HeaderColumn {
|
||||
width: Columns.size;
|
||||
text: "Size";
|
||||
end-aligned: true;
|
||||
|
|
@ -560,7 +562,7 @@ export component DetailsView inherits Rectangle {
|
|||
}
|
||||
}
|
||||
|
||||
HeaderColumn {
|
||||
if !root.narrow: HeaderColumn {
|
||||
width: Columns.modified;
|
||||
text: "Modified";
|
||||
active: root.state.sort == SortColumn.modified;
|
||||
|
|
@ -696,7 +698,7 @@ export component DetailsView inherits Rectangle {
|
|||
root.row-activated(i);
|
||||
}
|
||||
|
||||
Cell {
|
||||
if !root.narrow: Cell {
|
||||
width: Columns.size;
|
||||
text: row.size;
|
||||
end-aligned: true;
|
||||
|
|
@ -709,7 +711,7 @@ export component DetailsView inherits Rectangle {
|
|||
color: row.selected ? Theme.on-secondary-container : Theme.on-surface-variant;
|
||||
}
|
||||
|
||||
Cell {
|
||||
if !root.narrow: Cell {
|
||||
width: Columns.modified;
|
||||
text: row.modified;
|
||||
color: row.selected ? Theme.on-secondary-container : Theme.on-surface-variant;
|
||||
|
|
|
|||
Loading…
Reference in a new issue