gallery/src/main.slint
Greg Pomerantz e1982eade4 M1: metadata scan + sqlite DB + placeholder list
- scan.rs: recursive walk of Pictures/DCIM (GALLERY_SCAN_DIRS override),
  image-ext detection, mtime/size capture, no symlink-dir following
- db.rs: rusqlite(bundled) store; incremental apply (insert/update/delete)
  keyed on path with mtime/size change detection; derived columns reset on
  change; Android DB path in Android/data/<pkg>/files (EXTERNAL_DATA_DIR is
  unset in this NativeActivity setup)
- lib.rs: start_scan() background thread -> invoke_from_event_loop ->
  VecModel + status line; called from desktop and Android entry points
- main.slint: ListView of paths (M1), status line with scan stats
- main.rs: fix desktop bin for 1.18.1 (no slint::Result; ComponentHandle)
- build.sh: export NDK clang CC_/CXX_/AR_ per target (bundled sqlite)
- tests: 5k-file scan < 2s, incremental apply, roundtrip

Verified on emulator: 5002 files in 153-226 ms; relaunch 0+ 0~ 0-;
touch -> 1~, delete -> 1-.
2026-10-27 13:28:33 -04:00

49 lines
1.6 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Gallery — M1: metadata scan + placeholder list.
// The real grid (image cells) arrives with M3 per HANDOFF.md.
import { ListView, VerticalBox } from "std-widgets.slint";
export component Main inherits Window {
title: "Gallery";
/// Scan/DB status line ("Scanning… 1234", "5123 files (42+ 3~ 1–) in 380 ms").
in property <string> status: "Scanning…";
/// Scanned file paths, newest first (M1: shown as text rows).
in property <[string]> items;
VerticalBox {
width: 100%;
spacing: 12px;
padding: 24px;
// Respect status-bar / nav-bar cutouts (built into the Slint window
// on Android via safe-area-insets).
padding-top: 24px + root.safe-area-insets.top;
padding-bottom: 24px + root.safe-area-insets.bottom;
Text {
text: "Gallery";
font-size: 24px;
font-weight: 600;
}
Text { text: "\{status}"; font-size: 14px; }
// M1: paths as text. M3 replaces the row body with square image cells.
ListView {
width: 100%;
vertical-stretch: 1;
for path[index] in root.items: Rectangle {
height: 28px;
width: parent.width;
background: Math.mod(index, 2) == 0 ? #1e1e1e : #242424;
border-radius: 4px;
Text {
x: 8px;
text: path;
font-size: 13px;
vertical-alignment: center;
overflow: elide;
}
}
}
}
}