Export to an album instead of a folder in the settings

Export took a path typed into the settings page, or a folder inside the
library on the server. The first is how exports end up somewhere nobody
looks; the second put JPEGs into the tree a scan catalogues, where they
came back as photographs beside the RAWs they were made from.

The destination is now an album (FR-EXP-10), chosen by name in the
export sheet. Albums are listed under the collections in the sidebar;
"+" there, or "New album…" in the sheet, opens a sheet for its name and
its folder — on this device through the platform's dialogue, or on the
server through the browser with "New folder". A server folder inside
the library is refused, and the sheet says why. Selecting an album
narrows the grid to the photographs behind its files: library::Scope
is Collection or Album, and scope_clause is the one place the two are
spelled, which also retires the two copies of the collection predicate
total_images_scoped and read_cells_scoped had inlined.

A batch resolves the album when it starts, and refuses in words when
none is chosen, it has gone, or its folder is local to another device.
Each item reports the image it came from, and the files written are
recorded against the album in one transaction when the batch ends.

A server album lives outside the library, so its queued uploads are
relative to the account root. That is a third line in the outbox's
.dest record rather than a leading slash, because a record written
before albums may carry a stray slash and must keep the meaning it was
written with.

An export folder set before albums becomes an album called "Exports"
on first open, so upgrading does not lose where exports were going.
The old destination fields stay in ExportSettings so older settings
files still read.
This commit is contained in:
2026-09-26 14:13:53 -04:00
parent 2eb06b1064
commit 7cbcacc02e
19 changed files with 1757 additions and 672 deletions
+35 -173
View File
@@ -43,33 +43,16 @@ export global ExportOptions {
in property <[string]> collision-labels;
in property <int> collision-selected: 0;
in property <bool> strip-location: true;
in-out property <string> destination;
// What the destination field means depends on this, so the placeholder
// comes from Rust alongside it rather than being written twice here.
in property <string> destination-hint;
in property <[string]> target-labels;
in property <int> target-selected: 0;
// --- the remote folder picker ------------------------------------
// --- where it goes (FR-EXP-10) -----------------------------------
//
// The same navigation the launch screen uses to choose a library root,
// driven by the same `FolderBrowser` model in Rust. A folder on the
// server is not something anyone can be expected to type from memory.
in property <bool> browse-open: false;
in property <string> browse-path;
in property <[string]> browse-entries;
in property <bool> browse-loading: false;
/// At the library root, so there is nowhere up to go.
in property <bool> browse-at-root: true;
/// Whether the destination is one that can be walked.
///
/// A boolean from Rust rather than a test on `target-selected`. The index
/// was hardcoded to 1, which was Remote's position while both targets were
/// offered — and the moment Android's list narrowed to Remote alone, that
/// index became 0 and the button vanished on the one platform where it is
/// the *only* way to set a destination. An index into a list whose length
/// varies is not a fact about the target.
in property <bool> browse-available: false;
// An album, by name. The folder behind it — on this device or on the
// server — is chosen once, when the album is made, in the platform's
// dialogue or the server browser; exporting only says which album.
in property <[string]> album-labels;
/// -1 while none is chosen, and an export is refused until one is.
in property <int> album-selected: -1;
/// Where the chosen album's files go, in words.
in property <string> album-detail;
callback format-picked(int);
callback quality-changed(int);
@@ -83,13 +66,9 @@ export global ExportOptions {
callback template-changed(string);
callback collision-picked(int);
callback strip-location-toggled(bool);
callback destination-changed(string);
callback target-picked(int);
callback browse-open-picker();
callback browse-into(string);
callback browse-up();
callback browse-confirm();
callback browse-cancel();
callback album-picked(int);
/// Make a new album, from here rather than from the sidebar.
callback album-new();
}
// What the image becomes: format, quality, colour, size, sharpening. The
@@ -222,152 +201,35 @@ export component ExportFileOptions inherits VerticalLayout {
picked(i) => { ExportOptions.collision-picked(i); }
}
// Where the file lands, before what it is called: on
// Android the answer decides whether an export needs
// the Storage Access Framework at all, and on any
// platform a server destination is reached over a
// network that may not be there.
Segmented {
label: "Export to";
options: ExportOptions.target-labels;
selected: ExportOptions.target-selected;
picked(i) => { ExportOptions.target-picked(i); }
// TRACES: FR-EXP-10
// Where the file lands, before what it is called: an album, which
// names a folder on this device or on the server and remembers
// what was sent to it. Not the library — a JPEG written into the
// library's own tree would be catalogued by the next scan as a
// photograph of its own.
if ExportOptions.album-labels.length > 0: Segmented {
label: "Album";
options: ExportOptions.album-labels;
selected: ExportOptions.album-selected;
columns: 3;
picked(i) => { ExportOptions.album-picked(i); }
}
TextRow {
label: "Destination";
// What an empty field does, not what it was once
// going to do: nothing asks, and an export with
// no folder is refused and says so in the header.
hint: "a folder on this device; exports are refused until one is set";
text <=> ExportOptions.destination;
field-width: 320px;
placeholder: ExportOptions.destination-hint;
accepted(t) => { ExportOptions.destination-changed(t); }
if ExportOptions.album-labels.length == 0: Caption {
text: "No album yet. An album is a folder exports go to — on this device or on the server — and the photographs sent to it are listed under Albums in the library.";
wrap: word-wrap;
}
// Offered only for a server destination. A folder on
// this device is chosen by the platform's own dialogue
// or typed; a folder on the server can only be found
// by walking it, and expecting anyone to recall the
// exact spelling of a path three levels down is how a
// destination silently becomes a new folder at the
// root.
if ExportOptions.browse-available && !ExportOptions.browse-open: HorizontalLayout {
if ExportOptions.album-detail != "": Caption {
text: ExportOptions.album-detail;
wrap: word-wrap;
}
HorizontalLayout {
alignment: start;
Button {
text: "Choose folder…";
clicked => { ExportOptions.browse-open-picker(); }
}
}
if ExportOptions.browse-open: Rectangle {
background: Theme.ground;
border-radius: Theme.radius;
height: picker.preferred-height + 2 * Theme.gap;
picker := VerticalLayout {
x: Theme.gap;
y: Theme.gap;
width: parent.width - 2 * Theme.gap;
spacing: Theme.gap-sm;
HorizontalLayout {
spacing: Theme.gap-sm;
Button {
text: "↑ Up";
// Disabled rather than hidden at the
// root: a control that vanishes moves
// everything beside it, and the row
// would jump as the user navigates.
enabled: !ExportOptions.browse-at-root;
clicked => { ExportOptions.browse-up(); }
}
Value {
text: ExportOptions.browse-path;
overflow: elide;
horizontal-stretch: 1;
vertical-alignment: center;
}
Caption {
text: ExportOptions.browse-loading ? "Listing…" : "";
vertical-alignment: center;
}
}
// A fixed height rather than one that grows
// with the listing: a folder with sixty
// children would otherwise push the rest of
// the settings page off the bottom.
Rectangle {
height: 180px;
background: Theme.surface;
border-radius: Theme.radius;
Flickable {
x: 4px;
y: 4px;
width: parent.width - 8px;
height: parent.height - 8px;
viewport-height: folders.preferred-height;
folders := VerticalLayout {
width: 100%;
spacing: 2px;
alignment: start;
if ExportOptions.browse-entries.length == 0
&& !ExportOptions.browse-loading: Caption {
text: "No folders here. "
+ "Use this one, or go up.";
}
for name in ExportOptions.browse-entries: Rectangle {
height: 32px;
background: touch.has-hover
? Theme.surface-raised
: transparent;
border-radius: Theme.radius;
Label {
x: Theme.gap-sm;
text: name;
vertical-alignment: center;
overflow: elide;
width: parent.width - 2 * Theme.gap-sm;
}
touch := TouchArea {
clicked => { ExportOptions.browse-into(name); }
}
}
}
}
}
HorizontalLayout {
spacing: Theme.gap-sm;
alignment: end;
Button {
text: "Cancel";
clicked => { ExportOptions.browse-cancel(); }
}
// Confirms the folder currently *shown*,
// not one selected in the list — the same
// rule the library picker follows, so
// "use this one" means the same thing in
// both places.
Button {
text: "Use this folder";
active: true;
clicked => { ExportOptions.browse-confirm(); }
}
}
text: "New album…";
clicked => { ExportOptions.album-new(); }
}
}