File presets in folders that open and close, as collections do
The presets menu and sheet listed every preset under flat section headings, seventy rows to scroll past. They now list folders, closed until opened, with how many presets each holds; opening one shows what is inside it, folders and presets indented beneath. A category is spelled in the name: "Portraits/Warm skin" is Warm skin in a Portraits folder under Yours. The file format does not change, so an older build lists the whole path as the name; renaming a preset is how it moves, and saving or renaming into a folder opens the way to it. A Lightroom import names what it reads after the folders below the one chosen, and a "/" in a displayed name becomes "∕" so it files nothing. The shipped film sections become Film › Colour, Cinema and Black and white. The tree is built and flattened in Rust (PresetTree), each row carrying its depth, and which folders are open is remembered for the session. A PopupWindow keeps the size it was shown at, so a folder opened in the menu pushed its contents under "Save or manage…"; the menu is shown again after each toggle to take its new height. That is a function on the rail because Slint 1.17 generates Rust that does not compile for a popup's close() reached from inside the popup. The sheet's list takes a preferred height of up to 400px, since a Flickable reports next to nothing and an opened folder showed three rows. The manual describes the folders and naming. Its pictures show the menu with Film › Colour open, and a black-and-white stock applied from Film › Black and white; the scenes aim popup rows from the rail's entry, and pick the menu's "Film" over the develop column's film chooser.
This commit is contained in:
@@ -49,7 +49,9 @@ pub struct Section {
|
|||||||
/// A stable identifier, for a frontend that remembers which sections a
|
/// A stable identifier, for a frontend that remembers which sections a
|
||||||
/// photographer folded away. Never shown.
|
/// photographer folded away. Never shown.
|
||||||
pub id: &'static str,
|
pub id: &'static str,
|
||||||
/// What the section is called on screen.
|
/// What the section is called on screen, as a category path: `/`
|
||||||
|
/// separates the levels, so `Film/Colour` is a folder inside `Film`. The
|
||||||
|
/// same spelling a photographer's own preset names use for theirs.
|
||||||
pub title: &'static str,
|
pub title: &'static str,
|
||||||
/// The presets in it, every one reaching only what it names.
|
/// The presets in it, every one reaching only what it names.
|
||||||
pub presets: PresetLibrary,
|
pub presets: PresetLibrary,
|
||||||
@@ -65,17 +67,17 @@ const SECTIONS: &[(&str, &str, &str)] = &[
|
|||||||
("skies", "Skies", include_str!("../presets/skies.drpl")),
|
("skies", "Skies", include_str!("../presets/skies.drpl")),
|
||||||
(
|
(
|
||||||
"colour_film",
|
"colour_film",
|
||||||
"Colour film",
|
"Film/Colour",
|
||||||
include_str!("../presets/colour_film.drpl"),
|
include_str!("../presets/colour_film.drpl"),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"cinema_film",
|
"cinema_film",
|
||||||
"Cinema film",
|
"Film/Cinema",
|
||||||
include_str!("../presets/cinema_film.drpl"),
|
include_str!("../presets/cinema_film.drpl"),
|
||||||
),
|
),
|
||||||
(
|
(
|
||||||
"bw_film",
|
"bw_film",
|
||||||
"Black and white film",
|
"Film/Black and white",
|
||||||
include_str!("../presets/bw_film.drpl"),
|
include_str!("../presets/bw_film.drpl"),
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -573,6 +573,32 @@ mod tests {
|
|||||||
assert_eq!(report.failed, 0);
|
assert_eq!(report.failed, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_subfolder_becomes_the_category_of_what_it_holds() {
|
||||||
|
// The folder picked is the root and names nothing; each folder under
|
||||||
|
// it is a level of category, as Lightroom's groups were.
|
||||||
|
let dir = tempdir("categories");
|
||||||
|
std::fs::write(dir.join("Golden Hour.xmp"), ELEMENT_FORM).unwrap();
|
||||||
|
let nested = dir.join("Film").join("Colour");
|
||||||
|
std::fs::create_dir_all(&nested).unwrap();
|
||||||
|
std::fs::write(nested.join("Golden Hour.xmp"), ELEMENT_FORM).unwrap();
|
||||||
|
|
||||||
|
let names: Vec<_> = read_path(&dir).presets.into_iter().map(|p| p.0).collect();
|
||||||
|
assert_eq!(names, ["Film/Colour/Golden Hour", "Golden Hour"]);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_slash_in_a_displayed_name_is_not_a_category() {
|
||||||
|
let dir = tempdir("slash");
|
||||||
|
std::fs::write(
|
||||||
|
dir.join("p.xmp"),
|
||||||
|
ATTRIBUTE_FORM.replace("Warm Portrait", "Warm / Cool"),
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let report = read_path(&dir);
|
||||||
|
assert_eq!(report.presets[0].0, "Warm \u{2215} Cool");
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn a_preset_without_a_name_is_called_after_its_file() {
|
fn a_preset_without_a_name_is_called_after_its_file() {
|
||||||
// Lightroom writes the name it displays, which is not always the file
|
// Lightroom writes the name it displays, which is not always the file
|
||||||
@@ -661,21 +687,37 @@ pub struct Report {
|
|||||||
/// A folder because that is the shape a photographer's presets are in — an
|
/// A folder because that is the shape a photographer's presets are in — an
|
||||||
/// exported Lightroom preset folder, nested one level per group — and asking
|
/// exported Lightroom preset folder, nested one level per group — and asking
|
||||||
/// them to import ninety files one at a time would be asking them not to
|
/// them to import ninety files one at a time would be asking them not to
|
||||||
/// bother. Nested folders are walked, which is what makes the group structure
|
/// bother. Nested folders are walked, and each one below `path` becomes a
|
||||||
/// available to whatever wants it later.
|
/// category: a preset in `Portraits/` is named `Portraits/Warm skin`, which is
|
||||||
|
/// how the preset menu files it (see `PresetLibrary`'s note on categories).
|
||||||
///
|
///
|
||||||
/// The *name* comes from `crs:Name` where the file carries one and from the
|
/// The *name* comes from `crs:Name` where the file carries one and from the
|
||||||
/// file stem where it does not. Lightroom writes the name it displays, which
|
/// file stem where it does not. Lightroom writes the name it displays, which
|
||||||
/// is not always the file name, and the displayed name is the one the
|
/// is not always the file name, and the displayed name is the one the
|
||||||
/// photographer will look for.
|
/// photographer will look for. A `/` inside that name would read as a
|
||||||
|
/// category it never had, so it becomes `∕`, which looks the same and
|
||||||
|
/// separates nothing.
|
||||||
pub fn read_path(path: &std::path::Path) -> Report {
|
pub fn read_path(path: &std::path::Path) -> Report {
|
||||||
let mut report = Report::default();
|
let mut report = Report::default();
|
||||||
read_into(path, &mut report);
|
read_into(path, "", &mut report);
|
||||||
report.presets.sort_by(|a, b| a.0.cmp(&b.0));
|
report.presets.sort_by(|a, b| a.0.cmp(&b.0));
|
||||||
report
|
report
|
||||||
}
|
}
|
||||||
|
|
||||||
fn read_into(path: &std::path::Path, report: &mut Report) {
|
/// The category a folder below the import root files its presets under.
|
||||||
|
fn category_of(parent: &str, folder: &std::path::Path) -> String {
|
||||||
|
let Some(name) = folder.file_name() else {
|
||||||
|
return parent.to_string();
|
||||||
|
};
|
||||||
|
let name = name.to_string_lossy().replace('/', "\u{2215}");
|
||||||
|
if parent.is_empty() {
|
||||||
|
name
|
||||||
|
} else {
|
||||||
|
format!("{parent}/{name}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn read_into(path: &std::path::Path, category: &str, report: &mut Report) {
|
||||||
if path.is_dir() {
|
if path.is_dir() {
|
||||||
let Ok(entries) = std::fs::read_dir(path) else {
|
let Ok(entries) = std::fs::read_dir(path) else {
|
||||||
log::warn!("preset import: cannot read {}", path.display());
|
log::warn!("preset import: cannot read {}", path.display());
|
||||||
@@ -686,7 +728,12 @@ fn read_into(path: &std::path::Path, report: &mut Report) {
|
|||||||
let mut paths: Vec<std::path::PathBuf> = entries.flatten().map(|e| e.path()).collect();
|
let mut paths: Vec<std::path::PathBuf> = entries.flatten().map(|e| e.path()).collect();
|
||||||
paths.sort();
|
paths.sort();
|
||||||
for path in paths {
|
for path in paths {
|
||||||
read_into(&path, report);
|
let category = if path.is_dir() {
|
||||||
|
category_of(category, &path)
|
||||||
|
} else {
|
||||||
|
category.to_string()
|
||||||
|
};
|
||||||
|
read_into(&path, &category, report);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -710,6 +757,12 @@ fn read_into(path: &std::path::Path, report: &mut Report) {
|
|||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
});
|
});
|
||||||
report.unsupported.extend(import.skipped);
|
report.unsupported.extend(import.skipped);
|
||||||
|
let name = name.replace('/', "\u{2215}");
|
||||||
|
let name = if category.is_empty() {
|
||||||
|
name
|
||||||
|
} else {
|
||||||
|
format!("{category}/{name}")
|
||||||
|
};
|
||||||
report.presets.push((name, import.preset));
|
report.presets.push((name, import.preset));
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
|
|||||||
+37
-37
File diff suppressed because one or more lines are too long
+24
-24
@@ -39,7 +39,7 @@ The list is longer than it is tall, so a way to walk it that cannot be lost to t
|
|||||||
|
|
||||||
Anchored on the fingers' midpoint, and on the pointer, so the gesture reads as magnifying the picture rather than sliding it about. Double-tap is the way to an exact 1:1; this is the way to everything in between. Past 1:1 the pixels are shown as they are, square and unsmoothed; below it, filtered.
|
Anchored on the fingers' midpoint, and on the pointer, so the gesture reads as magnifying the picture rather than sliding it about. Double-tap is the way to an exact 1:1; this is the way to everything in between. Past 1:1 the pixels are shown as they are, square and unsmoothed; below it, filtered.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:1974`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:1977`</sub>
|
||||||
|
|
||||||
### Move a magnified photograph about
|
### Move a magnified photograph about
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ Anchored on the fingers' midpoint, and on the pointer, so the gesture reads as m
|
|||||||
|
|
||||||
Only once there is something outside the viewport to reach, which is why the cursor becomes a hand exactly then. The view is clamped to the frame: panning past the edge would show undefined area beside the photograph, and that reads as a rendering fault rather than as the end of the picture.
|
Only once there is something outside the viewport to reach, which is why the cursor becomes a hand exactly then. The view is clamped to the frame: panning past the edge would show undefined area beside the photograph, and that reads as a rendering fault rather than as the end of the picture.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2070`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2073`</sub>
|
||||||
|
|
||||||
### Paint a mask by hand
|
### Paint a mask by hand
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ Only once there is something outside the viewport to reach, which is why the cur
|
|||||||
|
|
||||||
A model's mask stops inside a shoulder and leaks into the hair, and no single edge control fixes two errors that go opposite ways. The whole stroke is one step in the history, so taking a mark back costs one press however long it took to make.
|
A model's mask stops inside a shoulder and leaks into the hair, and no single edge control fixes two errors that go opposite ways. The whole stroke is one step in the history, so taking a mark back costs one press however long it took to make.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2161`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2164`</sub>
|
||||||
|
|
||||||
### Open this list
|
### Open this list
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ A model's mask stops inside a shoulder and leaks into the hair, and no single ed
|
|||||||
|
|
||||||
Most of the keys are develop's, and a reference that could only be opened from the grid had to be looked up before opening the photograph they were wanted for.
|
Most of the keys are develop's, and a reference that could only be opened from the grid had to be looked up before opening the photograph they were wanted for.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2387`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2390`</sub>
|
||||||
|
|
||||||
### Take back the last change
|
### Take back the last change
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ Most of the keys are develop's, and a reference that could only be opened from t
|
|||||||
|
|
||||||
A whole drag is one step, so undo takes back a decision rather than a frame of a gesture. The list is there because arriving six steps back costs what arriving from one does.
|
A whole drag is one step, so undo takes back a decision rather than a frame of a gesture. The list is there because arriving six steps back costs what arriving from one does.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2417`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2420`</sub>
|
||||||
|
|
||||||
### Do it again after taking it back
|
### Do it again after taking it back
|
||||||
|
|
||||||
@@ -90,7 +90,7 @@ A whole drag is one step, so undo takes back a decision rather than a frame of a
|
|||||||
- **Keyboard** — `Ctrl+Shift+Z`, or `Ctrl+Y`
|
- **Keyboard** — `Ctrl+Shift+Z`, or `Ctrl+Y`
|
||||||
- **See it** — [in the manual](manual/README.md#history-snapshots-presets)
|
- **See it** — [in the manual](manual/README.md#history-snapshots-presets)
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2431`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2434`</sub>
|
||||||
|
|
||||||
### Remove a repair
|
### Remove a repair
|
||||||
|
|
||||||
@@ -98,7 +98,7 @@ A whole drag is one step, so undo takes back a decision rather than a frame of a
|
|||||||
- **Pointer** — Click it, then Delete Repair
|
- **Pointer** — Click it, then Delete Repair
|
||||||
- **Keyboard** — `Delete` or `Backspace`, while repairing
|
- **Keyboard** — `Delete` or `Backspace`, while repairing
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2451`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2454`</sub>
|
||||||
|
|
||||||
### Copy the settings from this photograph
|
### Copy the settings from this photograph
|
||||||
|
|
||||||
@@ -109,7 +109,7 @@ A whole drag is one step, so undo takes back a decision rather than a frame of a
|
|||||||
|
|
||||||
The button is the copy that has to work: a tablet has no modifier key to hold and no menu bar to hang the action from. The shortcut is an accelerator for a control that is on screen either way.
|
The button is the copy that has to work: a tablet has no modifier key to hold and no menu bar to hang the action from. The shortcut is an accelerator for a control that is on screen either way.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2470`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2473`</sub>
|
||||||
|
|
||||||
### Paste the settings onto this photograph
|
### Paste the settings onto this photograph
|
||||||
|
|
||||||
@@ -120,7 +120,7 @@ The button is the copy that has to work: a tablet has no modifier key to hold an
|
|||||||
|
|
||||||
The button names what would be pasted — "3 adjustments", and whether the crop is coming with it — which the shortcut cannot say. Both paste the same scope.
|
The button names what would be pasted — "3 adjustments", and whether the crop is coming with it — which the shortcut cannot say. Both paste the same scope.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2483`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2486`</sub>
|
||||||
|
|
||||||
### Choose which kinds of edit a copy carries
|
### Choose which kinds of edit a copy carries
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ The button names what would be pasted — "3 adjustments", and whether the crop
|
|||||||
|
|
||||||
Lightroom's Copy Settings. Pasting a look across a shoot usually means leaving each frame's crop and rotation alone, and that is a choice to make at the moment of copying.
|
Lightroom's Copy Settings. Pasting a look across a shoot usually means leaving each frame's crop and rotation alone, and that is a choice to make at the moment of copying.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2501`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2504`</sub>
|
||||||
|
|
||||||
### Export this photograph as the last one was
|
### Export this photograph as the last one was
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ Lightroom's Copy Settings. Pasting a look across a shoot usually means leaving e
|
|||||||
|
|
||||||
Every export runs on the defaults in Settings, so "as the last one was" is what the button already does. The chord is Lightroom's and darktable's, kept so hands that learned it there need not learn it again.
|
Every export runs on the defaults in Settings, so "as the last one was" is what the button already does. The chord is Lightroom's and darktable's, kept so hands that learned it there need not learn it again.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2526`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2529`</sub>
|
||||||
|
|
||||||
### Choose how to export, then export
|
### Choose how to export, then export
|
||||||
|
|
||||||
@@ -153,7 +153,7 @@ Every export runs on the defaults in Settings, so "as the last one was" is what
|
|||||||
|
|
||||||
The export sheet is the export defaults alone with an Export button. What is chosen there is kept, so it is also what the next Ctrl+Shift+E uses.
|
The export sheet is the export defaults alone with an Export button. What is chosen there is kept, so it is also what the next Ctrl+Shift+E uses.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2539`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2542`</sub>
|
||||||
|
|
||||||
### Keep a crop that leaves a mask outside
|
### Keep a crop that leaves a mask outside
|
||||||
|
|
||||||
@@ -161,7 +161,7 @@ The export sheet is the export defaults alone with an Export button. What is cho
|
|||||||
- **Pointer** — Press "Keep crop" on the notice, or "Undo crop" to take it back
|
- **Pointer** — Press "Keep crop" on the notice, or "Undo crop" to take it back
|
||||||
- **Keyboard** — `Enter` keeps it; `Ctrl+Z` takes the crop back, like any other step
|
- **Keyboard** — `Enter` keeps it; `Ctrl+Z` takes the crop back, like any other step
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2604`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2607`</sub>
|
||||||
|
|
||||||
### Go back to the grid
|
### Go back to the grid
|
||||||
|
|
||||||
@@ -171,7 +171,7 @@ The export sheet is the export defaults alone with an Export button. What is cho
|
|||||||
|
|
||||||
Lightroom's key for the grid. Escape gets there too, but a step at a time — out of a mode, then out of a zoom — where this goes straight back.
|
Lightroom's key for the grid. Escape gets there too, but a step at a time — out of a mode, then out of a zoom — where this goes straight back.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2621`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2624`</sub>
|
||||||
|
|
||||||
### Nudge the control last moved
|
### Nudge the control last moved
|
||||||
|
|
||||||
@@ -181,7 +181,7 @@ Lightroom's key for the grid. Escape gets there too, but a step at a time — ou
|
|||||||
|
|
||||||
Lightroom's keys for the selected slider. There is no focus ring on a slider here, so "selected" is the last one moved — the same control `R` puts back — which covers the framing sliders, perspective included, as well as the adjustments.
|
Lightroom's keys for the selected slider. There is no focus ring on a slider here, so "selected" is the last one moved — the same control `R` puts back — which covers the framing sliders, perspective included, as well as the adjustments.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2650`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2653`</sub>
|
||||||
|
|
||||||
### Change which group of adjustments is on screen
|
### Change which group of adjustments is on screen
|
||||||
|
|
||||||
@@ -192,7 +192,7 @@ Lightroom's keys for the selected slider. There is no focus ring on a slider her
|
|||||||
|
|
||||||
The groups are whatever the operation set declares itself to be about, so there are as many as the pipeline has and no key can be assigned to one of them by name. Stepping is the binding that survives a node being added.
|
The groups are whatever the operation set declares itself to be about, so there are as many as the pipeline has and no key can be assigned to one of them by name. Stepping is the binding that survives a node being added.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2678`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2681`</sub>
|
||||||
|
|
||||||
### Look at the photograph at 1:1
|
### Look at the photograph at 1:1
|
||||||
|
|
||||||
@@ -203,7 +203,7 @@ The groups are whatever the operation set declares itself to be about, so there
|
|||||||
|
|
||||||
Noise reduction and capture sharpening are judgements about single pixels, and a fitted view averages several of the file's into each one on screen — so the frame looks softer than it is and the correction goes too far. The point and the magnification survive opening the next photograph, which is what makes checking the same eye across forty portraits forty keystrokes rather than forty pans. From 1:1 on the photograph is drawn as its own pixels, each a hard-edged square, rather than smoothed into a blur.
|
Noise reduction and capture sharpening are judgements about single pixels, and a fitted view averages several of the file's into each one on screen — so the frame looks softer than it is and the correction goes too far. The point and the magnification survive opening the next photograph, which is what makes checking the same eye across forty portraits forty keystrokes rather than forty pans. From 1:1 on the photograph is drawn as its own pixels, each a hard-edged square, rather than smoothed into a blur.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2714`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2717`</sub>
|
||||||
|
|
||||||
### Rate this photograph
|
### Rate this photograph
|
||||||
|
|
||||||
@@ -211,7 +211,7 @@ Noise reduction and capture sharpening are judgements about single pixels, and a
|
|||||||
- **Pointer** — Click a star in the top bar
|
- **Pointer** — Click a star in the top bar
|
||||||
- **Keyboard** — `0`–`5`
|
- **Keyboard** — `0`–`5`
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2771`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2774`</sub>
|
||||||
|
|
||||||
### Pick or reject this photograph
|
### Pick or reject this photograph
|
||||||
|
|
||||||
@@ -221,7 +221,7 @@ Noise reduction and capture sharpening are judgements about single pixels, and a
|
|||||||
|
|
||||||
The grid's keys, on the photograph that is open (FR-UI-5, 2026-09-19). Judging here does not move on to the next frame: that belongs to culling, and in develop the photograph in front of you is the one being worked on.
|
The grid's keys, on the photograph that is open (FR-UI-5, 2026-09-19). Judging here does not move on to the next frame: that belongs to culling, and in develop the photograph in front of you is the one being worked on.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2777`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2780`</sub>
|
||||||
|
|
||||||
### Give this photograph a colour label
|
### Give this photograph a colour label
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ The grid's keys, on the photograph that is open (FR-UI-5, 2026-09-19). Judging h
|
|||||||
|
|
||||||
The grid's keys, on the photograph that is open, so labelling while stepping through a folder is one hand's work. The bar names the label in words beside its mark.
|
The grid's keys, on the photograph that is open, so labelling while stepping through a folder is one hand's work. The bar names the label in words beside its mark.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2807`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2810`</sub>
|
||||||
|
|
||||||
### Move to the next or previous photograph
|
### Move to the next or previous photograph
|
||||||
|
|
||||||
@@ -243,7 +243,7 @@ The grid's keys, on the photograph that is open, so labelling while stepping thr
|
|||||||
|
|
||||||
The edit on screen is saved on the way out, so stepping through a folder is as much a departure as going back to the grid and loses nothing. A and D as well as the arrows, so the left hand steps along the roll while the right stays on the mouse.
|
The edit on screen is saved on the way out, so stepping through a folder is as much a departure as going back to the grid and loses nothing. A and D as well as the arrows, so the left hand steps along the roll while the right stays on the mouse.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2832`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2835`</sub>
|
||||||
|
|
||||||
### See the photograph before you edited it
|
### See the photograph before you edited it
|
||||||
|
|
||||||
@@ -254,7 +254,7 @@ The edit on screen is saved on the way out, so stepping through a folder is as m
|
|||||||
|
|
||||||
Held rather than toggled, and no split screen: a split halves the working image on the tablet the column was sized for, and the comparison photographers describe making is a flick back and forth. It takes no history step, so checking whether a frame is overcooked costs nothing to undo afterwards.
|
Held rather than toggled, and no split screen: a split halves the working image on the tablet the column was sized for, and the comparison photographers describe making is a flick back and forth. It takes no history step, so checking whether a frame is overcooked costs nothing to undo afterwards.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:2962`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:2965`</sub>
|
||||||
|
|
||||||
### Put one control back to its default
|
### Put one control back to its default
|
||||||
|
|
||||||
@@ -338,7 +338,7 @@ The question a correction raises is whether it did what it was for — whether t
|
|||||||
|
|
||||||
One key for "up one", innermost first: a question before the sheet under it, a sheet before the view, a view before the library. Nothing is left behind a dialogue that the key walked straight past.
|
One key for "up one", innermost first: a question before the sheet under it, a sheet before the view, a view before the library. Nothing is left behind a dialogue that the key walked straight past.
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:1022`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:1024`</sub>
|
||||||
|
|
||||||
### Do what a sheet offers
|
### Do what a sheet offers
|
||||||
|
|
||||||
@@ -346,7 +346,7 @@ One key for "up one", innermost first: a question before the sheet under it, a s
|
|||||||
- **Pointer** — Press its button — Export, or Copy
|
- **Pointer** — Press its button — Export, or Copy
|
||||||
- **Keyboard** — `Enter`, on the export and copy sheets
|
- **Keyboard** — `Enter`, on the export and copy sheets
|
||||||
|
|
||||||
<sub>`ui/dr-ui/ui/app.slint:1032`</sub>
|
<sub>`ui/dr-ui/ui/app.slint:1034`</sub>
|
||||||
|
|
||||||
### Scroll by the scrollbar
|
### Scroll by the scrollbar
|
||||||
|
|
||||||
|
|||||||
+15
-10
@@ -299,26 +299,31 @@ a gradient over the sky whose `Print Exposure` burns it in.
|
|||||||
|
|
||||||
Every change is a step; `Undo` and the History panel walk them. `Snapshot`
|
Every change is a step; `Undo` and the History panel walk them. `Snapshot`
|
||||||
keeps the current state under a name. `Presets`, at the foot of the tool
|
keeps the current state under a name. `Presets`, at the foot of the tool
|
||||||
rail on the left, opens a menu of presets beside the photograph; choosing
|
rail on the left, opens a menu of presets beside the photograph, filed in
|
||||||
one applies it. The menu's last row, `Save or manage…`, opens the presets
|
folders that start closed: your own under `Yours`, then the ones DarkRoom
|
||||||
sheet, which saves the settings to apply elsewhere, renames and deletes
|
ships — `Essentials`, `Skies`, and `Film`, which holds `Colour`, `Cinema`
|
||||||
them, and imports Lightroom presets — `Folder…` for a folder of them,
|
and `Black and white`, one measured stock each. Choosing a folder opens it;
|
||||||
`.xmp file…` for one.
|
choosing a preset applies it. The menu's last row, `Save or manage…`, opens
|
||||||
|
the presets sheet, which lists the same folders and saves the settings to
|
||||||
|
apply elsewhere, renames and deletes them, and imports Lightroom presets —
|
||||||
|
`Folder…` for a folder of them, `.xmp file…` for one.
|
||||||
|
|
||||||
The menu and the sheet list your own presets first, then the ones DarkRoom ships —
|
A `/` in a name files the preset: `Portraits/Warm skin` is `Warm skin` in a
|
||||||
Essentials, Skies, and colour, cinema and black-and-white film, one measured stock
|
`Portraits` folder under `Yours`, and renaming it is how it moves. An
|
||||||
each. A shipped preset is a look: it changes what it names and leaves the
|
imported Lightroom folder keeps its groups the same way.
|
||||||
|
|
||||||
|
A shipped preset is a look: it changes what it names and leaves the
|
||||||
photograph's own corrections alone, as an imported Lightroom preset does.
|
photograph's own corrections alone, as an imported Lightroom preset does.
|
||||||
Saving under a shipped preset's name makes your version the one that name
|
Saving under a shipped preset's name makes your version the one that name
|
||||||
applies, marked *changed*; `Revert` brings the shipped one back, and renaming
|
applies, marked *changed*; `Revert` brings the shipped one back, and renaming
|
||||||
yours makes it one of your own. A film preset carries its stock: choosing one
|
yours makes it one of your own. A film preset carries its stock: choosing one
|
||||||
sets the `Film` chooser and leaves the rest of the edit where it was.
|
sets the `Film` chooser and leaves the rest of the edit where it was.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### Copying settings
|
### Copying settings
|
||||||
|
|
||||||
|
|||||||
+14
-10
@@ -353,22 +353,26 @@ a gradient over the sky whose <code>Print Exposure</code> burns it in.</p>
|
|||||||
<h3 id="history-snapshots-presets">History, snapshots, presets</h3>
|
<h3 id="history-snapshots-presets">History, snapshots, presets</h3>
|
||||||
<p>Every change is a step; <code>Undo</code> and the History panel walk them. <code>Snapshot</code>
|
<p>Every change is a step; <code>Undo</code> and the History panel walk them. <code>Snapshot</code>
|
||||||
keeps the current state under a name. <code>Presets</code>, at the foot of the tool
|
keeps the current state under a name. <code>Presets</code>, at the foot of the tool
|
||||||
rail on the left, opens a menu of presets beside the photograph; choosing
|
rail on the left, opens a menu of presets beside the photograph, filed in
|
||||||
one applies it. The menu's last row, <code>Save or manage…</code>, opens the presets
|
folders that start closed: your own under <code>Yours</code>, then the ones DarkRoom
|
||||||
sheet, which saves the settings to apply elsewhere, renames and deletes
|
ships — <code>Essentials</code>, <code>Skies</code>, and <code>Film</code>, which holds <code>Colour</code>, <code>Cinema</code>
|
||||||
them, and imports Lightroom presets — <code>Folder…</code> for a folder of them,
|
and <code>Black and white</code>, one measured stock each. Choosing a folder opens it;
|
||||||
<code>.xmp file…</code> for one.</p>
|
choosing a preset applies it. The menu's last row, <code>Save or manage…</code>, opens
|
||||||
<p>The menu and the sheet list your own presets first, then the ones DarkRoom ships —
|
the presets sheet, which lists the same folders and saves the settings to
|
||||||
Essentials, Skies, and colour, cinema and black-and-white film, one measured stock
|
apply elsewhere, renames and deletes them, and imports Lightroom presets —
|
||||||
each. A shipped preset is a look: it changes what it names and leaves the
|
<code>Folder…</code> for a folder of them, <code>.xmp file…</code> for one.</p>
|
||||||
|
<p>A <code>/</code> in a name files the preset: <code>Portraits/Warm skin</code> is <code>Warm skin</code> in a
|
||||||
|
<code>Portraits</code> folder under <code>Yours</code>, and renaming it is how it moves. An
|
||||||
|
imported Lightroom folder keeps its groups the same way.</p>
|
||||||
|
<p>A shipped preset is a look: it changes what it names and leaves the
|
||||||
photograph's own corrections alone, as an imported Lightroom preset does.
|
photograph's own corrections alone, as an imported Lightroom preset does.
|
||||||
Saving under a shipped preset's name makes your version the one that name
|
Saving under a shipped preset's name makes your version the one that name
|
||||||
applies, marked <em>changed</em>; <code>Revert</code> brings the shipped one back, and renaming
|
applies, marked <em>changed</em>; <code>Revert</code> brings the shipped one back, and renaming
|
||||||
yours makes it one of your own. A film preset carries its stock: choosing one
|
yours makes it one of your own. A film preset carries its stock: choosing one
|
||||||
sets the <code>Film</code> chooser and leaves the rest of the edit where it was.</p>
|
sets the <code>Film</code> chooser and leaves the rest of the edit where it was.</p>
|
||||||
<figure><img loading="lazy" src="media/presets-menu.png" alt="The presets menu open beside the tool rail, over the photograph"><figcaption>The presets menu open beside the tool rail, over the photograph</figcaption></figure>
|
<figure><img loading="lazy" src="media/presets-menu.png" alt="The presets menu beside the tool rail, with Film and its colour stocks open"><figcaption>The presets menu beside the tool rail, with Film and its colour stocks open</figcaption></figure>
|
||||||
<figure><img loading="lazy" src="media/presets.png" alt="The presets sheet: a name for the current edit, the shipped Essentials, importing, and what an apply carries"><figcaption>The presets sheet: a name for the current edit, the shipped Essentials, importing, and what an apply carries</figcaption></figure>
|
<figure><img loading="lazy" src="media/presets.png" alt="The presets sheet: a name for the current edit, the shipped Essentials, importing, and what an apply carries"><figcaption>The presets sheet: a name for the current edit, the shipped Essentials, importing, and what an apply carries</figcaption></figure>
|
||||||
<figure><img loading="lazy" src="media/presets-film.gif" alt="Scrolling down the shipped presets to the black-and-white films, applying Ilford HP5 Plus, then holding Before"><figcaption>Scrolling down the shipped presets to the black-and-white films, applying Ilford HP5 Plus, then holding Before</figcaption></figure>
|
<figure><img loading="lazy" src="media/presets-film.gif" alt="Opening Film, then Black and white, in the presets menu and applying Ilford HP5 Plus, then holding Before"><figcaption>Opening Film, then Black and white, in the presets menu and applying Ilford HP5 Plus, then holding Before</figcaption></figure>
|
||||||
<h3 id="copying-settings">Copying settings</h3>
|
<h3 id="copying-settings">Copying settings</h3>
|
||||||
<p><code>Copy</code> in the top bar, or Ctrl+C, takes this photograph's settings; <code>Paste</code>,
|
<p><code>Copy</code> in the top bar, or Ctrl+C, takes this photograph's settings; <code>Paste</code>,
|
||||||
or Ctrl+V, puts them on another, and says what it would paste — how many
|
or Ctrl+V, puts them on another, and says what it would paste — how many
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
+49
-24
@@ -1157,25 +1157,56 @@ def presets_menu_open():
|
|||||||
dr.wait_for('Save or manage…@Button', 5)
|
dr.wait_for('Save or manage…@Button', 5)
|
||||||
|
|
||||||
|
|
||||||
def presets_manage():
|
def in_presets_menu(name):
|
||||||
""""Save or manage…", the menu's last row, pressed to open the sheet.
|
"""The centre of `name` in the open presets menu, on the screen.
|
||||||
|
|
||||||
Aimed from the rail's entry rather than by name, as the film list's rows
|
The automation reports a popup's elements in the popup's own
|
||||||
are: the automation reports a popup's elements in the popup's own
|
coordinates, so the menu's origin is worked out from what is known: it
|
||||||
coordinates. The menu opens beside the entry with its foot level with
|
opens beside the rail's entry, its foot level with the entry's, and its
|
||||||
the entry's, and the row is the last `PRESET_ROW` of it."""
|
last row is "Save or manage…". If the row already reads as on screen —
|
||||||
_, _, x1, y1 = dr.rect('Presets@Button')
|
right of the rail — the report is taken as it stands."""
|
||||||
dr.click(x1 + 100, y1 - PRESET_ROW // 2)
|
_, _, rx1, ry1 = dr.rect('Presets@Button')
|
||||||
|
mx0, _, _, my1 = dr.rect('Save or manage…@Button')
|
||||||
|
dx, dy = (0, 0) if mx0 >= rx1 else (rx1, ry1 - my1)
|
||||||
|
# "Film" is also the develop column's film chooser, so of the matches
|
||||||
|
# the one in the menu's own coordinates — left of the rail's edge — is
|
||||||
|
# the one meant.
|
||||||
|
hits = dr.matches(name)
|
||||||
|
inside = [h for h in hits if h['x'] < rx1] or hits
|
||||||
|
if not inside:
|
||||||
|
raise dr.NotFound(f'{name!r}: not in the presets menu')
|
||||||
|
h = inside[0]
|
||||||
|
x0, y0, x1, y1 = h['x'], h['y'], h['x'] + h['w'], h['y'] + h['h']
|
||||||
|
return (x0 + x1) // 2 + dx, (y0 + y1) // 2 + dy
|
||||||
|
|
||||||
|
|
||||||
|
def presets_menu_click(name):
|
||||||
|
dr.click(*in_presets_menu(name))
|
||||||
|
|
||||||
|
|
||||||
|
def presets_manage():
|
||||||
|
""""Save or manage…", the menu's last row, pressed to open the sheet."""
|
||||||
|
presets_menu_click('Save or manage…@Button')
|
||||||
dr.wait_for('CARRIES@Text', 5)
|
dr.wait_for('CARRIES@Text', 5)
|
||||||
|
|
||||||
|
|
||||||
@scene(media=['presets-menu.png', 'presets.png'],
|
@scene(media=['presets-menu.png', 'presets.png'],
|
||||||
sources=DEVELOP_SRC + ['ui/dr-ui/ui/presets.slint', 'ui/dr-ui/src/presets.rs'])
|
sources=DEVELOP_SRC + ['ui/dr-ui/ui/presets.slint', 'ui/dr-ui/src/presets.rs'])
|
||||||
def presets():
|
def presets():
|
||||||
|
"""The menu with Film and its colour stocks open, then the sheet — its
|
||||||
|
folders closed again, since opening is remembered only for the menu's
|
||||||
|
session and the sheet is the same list."""
|
||||||
at_develop()
|
at_develop()
|
||||||
presets_menu_open()
|
presets_menu_open()
|
||||||
|
pause(0.6)
|
||||||
|
presets_menu_click('Film@Button')
|
||||||
|
pause(0.6)
|
||||||
|
presets_menu_click('Colour@Button')
|
||||||
pause(1.0)
|
pause(1.0)
|
||||||
shot('presets-menu')
|
shot('presets-menu')
|
||||||
|
# Put back, so the sheet below opens on the folders alone.
|
||||||
|
presets_menu_click('Film@Button')
|
||||||
|
pause(0.6)
|
||||||
presets_manage()
|
presets_manage()
|
||||||
pause(1.5)
|
pause(1.5)
|
||||||
shot('presets')
|
shot('presets')
|
||||||
@@ -1187,26 +1218,20 @@ def presets():
|
|||||||
sources=DEVELOP_SRC + ['ui/dr-ui/ui/presets.slint', 'ui/dr-ui/src/presets.rs',
|
sources=DEVELOP_SRC + ['ui/dr-ui/ui/presets.slint', 'ui/dr-ui/src/presets.rs',
|
||||||
'core/dr-pipeline/presets/*.drpl', 'core/dr-pipeline/src/bundled.rs'])
|
'core/dr-pipeline/presets/*.drpl', 'core/dr-pipeline/src/bundled.rs'])
|
||||||
def presets_film():
|
def presets_film():
|
||||||
"""The sheet scrolled from Essentials down through the shipped film
|
"""Film opened in the rail's menu, then Black and white inside it, and a
|
||||||
sections, and a black-and-white stock applied from the last of them —
|
stock applied from there — a look, so the menu closes on the photograph
|
||||||
a look, so the sheet closes on the photograph with its film changed and
|
with its film changed and nothing else — then Before held."""
|
||||||
nothing else — then Before held."""
|
|
||||||
at_develop()
|
at_develop()
|
||||||
rec('presets-film')
|
rec('presets-film')
|
||||||
pause(0.4)
|
pause(0.4)
|
||||||
presets_menu_open()
|
presets_menu_open()
|
||||||
pause(0.8)
|
|
||||||
presets_manage()
|
|
||||||
pause(1.5)
|
|
||||||
x, y = dr.centre('Crisp detail@Button')
|
|
||||||
for _ in range(80): # a notch at a time, so the film shows the sections pass
|
|
||||||
if dr.present(f'{PRESET_BW}@Button'):
|
|
||||||
break
|
|
||||||
wheel(1, x, y)
|
|
||||||
pause(0.3)
|
|
||||||
pause(1.0)
|
pause(1.0)
|
||||||
dr.click_on(f'{PRESET_BW}@Button')
|
presets_menu_click('Film@Button')
|
||||||
dr.wait_gone('CARRIES@Text', 5)
|
pause(1.0)
|
||||||
|
presets_menu_click('Black and white@Button')
|
||||||
|
pause(1.2)
|
||||||
|
presets_menu_click(f'{PRESET_BW}@Button')
|
||||||
|
dr.wait_gone('Save or manage…@Button', 5)
|
||||||
pause(4)
|
pause(4)
|
||||||
hold_before(1.4)
|
hold_before(1.4)
|
||||||
pause(0.8)
|
pause(0.8)
|
||||||
@@ -1214,7 +1239,7 @@ def presets_film():
|
|||||||
undo_all()
|
undo_all()
|
||||||
|
|
||||||
|
|
||||||
PRESET_BW = 'Ilford HP5 Plus' # a shipped look in the black-and-white film section
|
PRESET_BW = 'Ilford HP5 Plus' # a shipped look in Film › Black and white
|
||||||
|
|
||||||
|
|
||||||
# --- panorama ---------------------------------------------------------------
|
# --- panorama ---------------------------------------------------------------
|
||||||
|
|||||||
+333
-27
@@ -723,6 +723,11 @@ pub fn wire(
|
|||||||
pub struct NamedPresets {
|
pub struct NamedPresets {
|
||||||
store: PresetStore,
|
store: PresetStore,
|
||||||
library: RefCell<PresetLibrary>,
|
library: RefCell<PresetLibrary>,
|
||||||
|
/// The category folders the photographer has opened, by key (see
|
||||||
|
/// [`PresetTree`]). Every folder starts closed, so a list of seventy
|
||||||
|
/// presets arrives as six lines; for the session, not saved, as the
|
||||||
|
/// collections tree remembers what it had open.
|
||||||
|
open: RefCell<std::collections::HashSet<String>>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl NamedPresets {
|
impl NamedPresets {
|
||||||
@@ -755,6 +760,7 @@ impl NamedPresets {
|
|||||||
Rc::new(Self {
|
Rc::new(Self {
|
||||||
store,
|
store,
|
||||||
library: RefCell::new(library),
|
library: RefCell::new(library),
|
||||||
|
open: RefCell::default(),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -813,33 +819,77 @@ impl NamedPresets {
|
|||||||
dr_pipeline::bundled::lookup(&self.library.borrow(), name)
|
dr_pipeline::bundled::lookup(&self.library.borrow(), name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Every row the sheet lists, headings included.
|
/// Every row the menu and the sheet list: the category folders, and
|
||||||
|
/// the presets inside the ones that are open.
|
||||||
///
|
///
|
||||||
/// The photographer's own section is left out while it is empty: a
|
/// The photographer's own section is left out while it is empty: a
|
||||||
/// heading over nothing reads as a list that failed to load.
|
/// folder over nothing reads as a list that failed to load.
|
||||||
pub fn rows(&self) -> Vec<crate::PresetRow> {
|
pub fn rows(&self) -> Vec<crate::PresetRow> {
|
||||||
use dr_pipeline::bundled::Origin;
|
let open = self.open.borrow();
|
||||||
let mut rows = Vec::new();
|
self.tree().flatten(&|key| open.contains(key))
|
||||||
for section in dr_pipeline::bundled::listing(&self.library.borrow()) {
|
|
||||||
if section.rows.is_empty() {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
rows.push(crate::PresetRow {
|
|
||||||
heading: section.title.into(),
|
/// Every row with every folder open — what the tests read.
|
||||||
name: Default::default(),
|
#[cfg(test)]
|
||||||
origin: crate::PresetOrigin::Shipped,
|
pub fn all_rows(&self) -> Vec<crate::PresetRow> {
|
||||||
});
|
self.tree().flatten(&|_| true)
|
||||||
rows.extend(section.rows.into_iter().map(|row| crate::PresetRow {
|
}
|
||||||
heading: Default::default(),
|
|
||||||
name: row.name.into(),
|
/// Open a closed folder, or close an open one.
|
||||||
origin: match row.origin {
|
pub fn toggle(&self, key: &str) {
|
||||||
|
let mut open = self.open.borrow_mut();
|
||||||
|
if !open.remove(key) {
|
||||||
|
open.insert(key.to_string());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Open every folder `name` is filed in, so a preset just saved or
|
||||||
|
/// renamed is on screen rather than inside a closed folder.
|
||||||
|
fn reveal(&self, name: &str) {
|
||||||
|
let name = name.trim();
|
||||||
|
// A changed copy lists in its shipped section, which the name does
|
||||||
|
// not say; your own are filed by the name's own categories.
|
||||||
|
let keys = match dr_pipeline::bundled::sections()
|
||||||
|
.into_iter()
|
||||||
|
.find(|section| section.presets.contains(name))
|
||||||
|
{
|
||||||
|
Some(section) => PresetTree::keys(SHIPPED, section.title),
|
||||||
|
None => {
|
||||||
|
let mut keys = vec![YOURS.to_string()];
|
||||||
|
if let Some((folders, _)) = name.rsplit_once('/') {
|
||||||
|
keys.extend(PresetTree::keys(YOURS, folders));
|
||||||
|
}
|
||||||
|
keys
|
||||||
|
}
|
||||||
|
};
|
||||||
|
self.open.borrow_mut().extend(keys);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The listing, filed into folders.
|
||||||
|
fn tree(&self) -> PresetTree {
|
||||||
|
use dr_pipeline::bundled::Origin;
|
||||||
|
let mut tree = PresetTree::default();
|
||||||
|
for section in dr_pipeline::bundled::listing(&self.library.borrow()) {
|
||||||
|
for row in section.rows {
|
||||||
|
let origin = match row.origin {
|
||||||
Origin::Yours => crate::PresetOrigin::Yours,
|
Origin::Yours => crate::PresetOrigin::Yours,
|
||||||
Origin::Shipped => crate::PresetOrigin::Shipped,
|
Origin::Shipped => crate::PresetOrigin::Shipped,
|
||||||
Origin::Changed => crate::PresetOrigin::Changed,
|
Origin::Changed => crate::PresetOrigin::Changed,
|
||||||
},
|
};
|
||||||
}));
|
match section.id {
|
||||||
|
// Your own are filed by their names' own categories,
|
||||||
|
// under one folder of their own.
|
||||||
|
None => tree.file(YOURS, section.title, &row.name, origin),
|
||||||
|
// A shipped preset's name is a name, not a path: the
|
||||||
|
// section title is its category.
|
||||||
|
Some(_) => {
|
||||||
|
let (root, label) = (SHIPPED, section.title);
|
||||||
|
tree.file_in(root, label, &row.name, &row.name, origin)
|
||||||
}
|
}
|
||||||
rows
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
tree
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether a preset is stored under `name`.
|
/// Whether a preset is stored under `name`.
|
||||||
@@ -936,6 +986,183 @@ fn import_presets(w: &AppWindow, named: &Rc<NamedPresets>, path: &Path) {
|
|||||||
render_named(w, named);
|
render_named(w, named);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The key of the photographer's own folder, and the prefix of every
|
||||||
|
/// folder inside it. Keys are never shown; they only have to stay the same
|
||||||
|
/// while the list is rebuilt around them.
|
||||||
|
const YOURS: &str = "yours";
|
||||||
|
/// The prefix of every shipped folder's key.
|
||||||
|
const SHIPPED: &str = "shipped";
|
||||||
|
|
||||||
|
/// TRACES: FR-DEV-6
|
||||||
|
/// The presets filed into folders, before they are flattened into rows.
|
||||||
|
///
|
||||||
|
/// # Categories are paths
|
||||||
|
///
|
||||||
|
/// A preset called `Portraits/Warm skin` is `Warm skin`, filed in
|
||||||
|
/// `Portraits`. The category is spelled in the name rather than stored
|
||||||
|
/// beside it, which costs nothing in the file format: an older build reads
|
||||||
|
/// the same file and lists the whole path as the name. Renaming is how a
|
||||||
|
/// preset moves, and a Lightroom import names what it reads after the
|
||||||
|
/// folders it was in (`dr_preset_xmp::read_path`). Shipped sections use the
|
||||||
|
/// same spelling for their titles, so `Film/Colour` is a folder in `Film`.
|
||||||
|
///
|
||||||
|
/// # Flattened in Rust, as the collections tree is
|
||||||
|
///
|
||||||
|
/// Slint cannot nest a repeater inside a `Flickable` with no layout to size
|
||||||
|
/// it, so the rows arrive flat, each carrying its depth, and the list draws
|
||||||
|
/// indentation from that integer.
|
||||||
|
#[derive(Default)]
|
||||||
|
struct PresetTree {
|
||||||
|
/// Top-level folders, in the order they were first filed into.
|
||||||
|
folders: Vec<Folder>,
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Folder {
|
||||||
|
key: String,
|
||||||
|
label: String,
|
||||||
|
folders: Vec<Folder>,
|
||||||
|
presets: Vec<(String, String, crate::PresetOrigin)>,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Folder {
|
||||||
|
fn new(key: String, label: &str) -> Self {
|
||||||
|
Self {
|
||||||
|
key,
|
||||||
|
label: label.to_string(),
|
||||||
|
folders: Vec::new(),
|
||||||
|
presets: Vec::new(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The folder labelled `label` directly inside this one, made if absent.
|
||||||
|
fn child(&mut self, label: &str) -> &mut Folder {
|
||||||
|
let at = match self.folders.iter().position(|f| f.label == label) {
|
||||||
|
Some(at) => at,
|
||||||
|
None => {
|
||||||
|
let key = format!("{}/{label}", self.key);
|
||||||
|
self.folders.push(Folder::new(key, label));
|
||||||
|
self.folders.len() - 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
&mut self.folders[at]
|
||||||
|
}
|
||||||
|
|
||||||
|
/// How many presets this folder holds, however deep.
|
||||||
|
fn count(&self) -> usize {
|
||||||
|
self.presets.len() + self.folders.iter().map(Folder::count).sum::<usize>()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl PresetTree {
|
||||||
|
/// The keys of `path`'s folders under `root`, outermost first — what
|
||||||
|
/// has to be open for something filed at `path` to be on screen.
|
||||||
|
fn keys(root: &str, path: &str) -> Vec<String> {
|
||||||
|
let mut key = root.to_string();
|
||||||
|
let mut keys = Vec::new();
|
||||||
|
for part in path.split('/').filter(|p| !p.is_empty()) {
|
||||||
|
key = format!("{key}/{part}");
|
||||||
|
keys.push(key.clone());
|
||||||
|
}
|
||||||
|
keys
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The top-level folder `label`, under the key prefix `root`.
|
||||||
|
fn top(&mut self, key: String, label: &str) -> &mut Folder {
|
||||||
|
let at = match self.folders.iter().position(|f| f.key == key) {
|
||||||
|
Some(at) => at,
|
||||||
|
None => {
|
||||||
|
self.folders.push(Folder::new(key, label));
|
||||||
|
self.folders.len() - 1
|
||||||
|
}
|
||||||
|
};
|
||||||
|
&mut self.folders[at]
|
||||||
|
}
|
||||||
|
|
||||||
|
/// File `name` into `root`'s folder called `title`, its own categories
|
||||||
|
/// taken from the name.
|
||||||
|
fn file(&mut self, root: &str, title: &str, name: &str, origin: crate::PresetOrigin) {
|
||||||
|
let mut folder = self.top(root.to_string(), title);
|
||||||
|
let mut parts: Vec<&str> = name.split('/').map(str::trim).collect();
|
||||||
|
// A name that is all separators still has to be applicable: its
|
||||||
|
// leaf is the whole name.
|
||||||
|
let leaf = parts.pop().filter(|l| !l.is_empty()).unwrap_or(name);
|
||||||
|
for part in parts.into_iter().filter(|p| !p.is_empty()) {
|
||||||
|
folder = folder.child(part);
|
||||||
|
}
|
||||||
|
folder
|
||||||
|
.presets
|
||||||
|
.push((leaf.to_string(), name.to_string(), origin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// File `name`, shown as `label`, at the category path `path`.
|
||||||
|
fn file_in(
|
||||||
|
&mut self,
|
||||||
|
root: &str,
|
||||||
|
path: &str,
|
||||||
|
label: &str,
|
||||||
|
name: &str,
|
||||||
|
origin: crate::PresetOrigin,
|
||||||
|
) {
|
||||||
|
let mut parts = path.split('/').filter(|p| !p.is_empty());
|
||||||
|
let Some(first) = parts.next() else { return };
|
||||||
|
let mut folder = self.top(format!("{root}/{first}"), first);
|
||||||
|
for part in parts {
|
||||||
|
folder = folder.child(part);
|
||||||
|
}
|
||||||
|
folder
|
||||||
|
.presets
|
||||||
|
.push((label.to_string(), name.to_string(), origin));
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The rows, with the contents of every folder `open` says is open.
|
||||||
|
///
|
||||||
|
/// Folders before presets at each level, each in the order filed —
|
||||||
|
/// which for your own is by name, as the library stores them.
|
||||||
|
fn flatten(&self, open: &dyn Fn(&str) -> bool) -> Vec<crate::PresetRow> {
|
||||||
|
fn visit(
|
||||||
|
folder: &Folder,
|
||||||
|
depth: i32,
|
||||||
|
open: &dyn Fn(&str) -> bool,
|
||||||
|
rows: &mut Vec<crate::PresetRow>,
|
||||||
|
) {
|
||||||
|
let expanded = open(&folder.key);
|
||||||
|
rows.push(crate::PresetRow {
|
||||||
|
folder: true,
|
||||||
|
key: folder.key.clone().into(),
|
||||||
|
label: folder.label.clone().into(),
|
||||||
|
depth,
|
||||||
|
expanded,
|
||||||
|
count: folder.count() as i32,
|
||||||
|
name: Default::default(),
|
||||||
|
origin: crate::PresetOrigin::Shipped,
|
||||||
|
});
|
||||||
|
if !expanded {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for child in &folder.folders {
|
||||||
|
visit(child, depth + 1, open, rows);
|
||||||
|
}
|
||||||
|
for (label, name, origin) in &folder.presets {
|
||||||
|
rows.push(crate::PresetRow {
|
||||||
|
folder: false,
|
||||||
|
key: Default::default(),
|
||||||
|
label: label.clone().into(),
|
||||||
|
depth: depth + 1,
|
||||||
|
expanded: false,
|
||||||
|
count: 0,
|
||||||
|
name: name.clone().into(),
|
||||||
|
origin: *origin,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let mut rows = Vec::new();
|
||||||
|
for folder in self.folders.iter().filter(|f| f.count() > 0) {
|
||||||
|
visit(folder, 0, open, &mut rows);
|
||||||
|
}
|
||||||
|
rows
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Push the listing onto the window.
|
/// Push the listing onto the window.
|
||||||
pub fn render_named(window: &AppWindow, named: &Rc<NamedPresets>) {
|
pub fn render_named(window: &AppWindow, named: &Rc<NamedPresets>) {
|
||||||
window.set_preset_rows(slint::ModelRc::new(slint::VecModel::from(named.rows())));
|
window.set_preset_rows(slint::ModelRc::new(slint::VecModel::from(named.rows())));
|
||||||
@@ -963,6 +1190,17 @@ pub fn wire_named(
|
|||||||
|
|
||||||
render_named(window, &named);
|
render_named(window, &named);
|
||||||
|
|
||||||
|
// --- open and close a category folder ---------------------------------
|
||||||
|
{
|
||||||
|
let weak = window.as_weak();
|
||||||
|
let named = named.clone();
|
||||||
|
window.on_toggle_preset_folder(move |key| {
|
||||||
|
let Some(w) = weak.upgrade() else { return };
|
||||||
|
named.toggle(&key);
|
||||||
|
render_named(&w, &named);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// --- save the open edit under a name ---------------------------------
|
// --- save the open edit under a name ---------------------------------
|
||||||
{
|
{
|
||||||
let weak = window.as_weak();
|
let weak = window.as_weak();
|
||||||
@@ -980,6 +1218,7 @@ pub fn wire_named(
|
|||||||
match named.insert(&name, preset) {
|
match named.insert(&name, preset) {
|
||||||
Ok(()) => {
|
Ok(()) => {
|
||||||
w.set_preset_name_error(Default::default());
|
w.set_preset_name_error(Default::default());
|
||||||
|
named.reveal(&name);
|
||||||
render_named(&w, &named);
|
render_named(&w, &named);
|
||||||
}
|
}
|
||||||
Err(e) => w.set_preset_name_error(e.message().into()),
|
Err(e) => w.set_preset_name_error(e.message().into()),
|
||||||
@@ -1134,6 +1373,9 @@ pub fn wire_named(
|
|||||||
// name it had, which is what this restores.
|
// name it had, which is what this restores.
|
||||||
let from = from.to_string();
|
let from = from.to_string();
|
||||||
let to = to.to_string();
|
let to = to.to_string();
|
||||||
|
// Renaming is how a preset changes folder, so the one it
|
||||||
|
// moved into is opened to show where it went.
|
||||||
|
named.reveal(&to);
|
||||||
if let Err(e) = named.persist(move |library| {
|
if let Err(e) = named.persist(move |library| {
|
||||||
let _ = library.rename(&to, &from);
|
let _ = library.rename(&to, &from);
|
||||||
}) {
|
}) {
|
||||||
@@ -1509,14 +1751,18 @@ mod tests {
|
|||||||
(NamedPresets::open_at(dir.join("presets.drpl")), dir)
|
(NamedPresets::open_at(dir.join("presets.drpl")), dir)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The rows under the heading `title`, as (name, origin).
|
/// The presets directly inside the folder labelled `title`, as (name,
|
||||||
|
/// origin), with every folder open.
|
||||||
fn section(presets: &NamedPresets, title: &str) -> Vec<(String, crate::PresetOrigin)> {
|
fn section(presets: &NamedPresets, title: &str) -> Vec<(String, crate::PresetOrigin)> {
|
||||||
presets
|
let rows = presets.all_rows();
|
||||||
.rows()
|
let Some(at) = rows.iter().position(|r| r.folder && r.label == title) else {
|
||||||
.into_iter()
|
return Vec::new();
|
||||||
.skip_while(|r| r.heading != title)
|
};
|
||||||
.skip(1)
|
let depth = rows[at].depth;
|
||||||
.take_while(|r| r.heading.is_empty())
|
rows[at + 1..]
|
||||||
|
.iter()
|
||||||
|
.take_while(|r| r.depth > depth)
|
||||||
|
.filter(|r| !r.folder && r.depth == depth + 1)
|
||||||
.map(|r| (r.name.to_string(), r.origin))
|
.map(|r| (r.name.to_string(), r.origin))
|
||||||
.collect()
|
.collect()
|
||||||
}
|
}
|
||||||
@@ -1536,7 +1782,7 @@ mod tests {
|
|||||||
#[test]
|
#[test]
|
||||||
fn an_empty_section_of_your_own_is_not_listed() {
|
fn an_empty_section_of_your_own_is_not_listed() {
|
||||||
let (presets, _dir) = named("no-yours");
|
let (presets, _dir) = named("no-yours");
|
||||||
assert!(presets.rows().iter().all(|r| r.heading != "Yours"));
|
assert!(presets.all_rows().iter().all(|r| r.label != "Yours"));
|
||||||
presets.insert("Mine", Preset::default()).unwrap();
|
presets.insert("Mine", Preset::default()).unwrap();
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
section(&presets, "Yours"),
|
section(&presets, "Yours"),
|
||||||
@@ -1569,6 +1815,66 @@ mod tests {
|
|||||||
.all(|(_, origin)| *origin == crate::PresetOrigin::Shipped));
|
.all(|(_, origin)| *origin == crate::PresetOrigin::Shipped));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn every_folder_starts_closed_and_opens_on_its_own() {
|
||||||
|
// Seventy shipped presets arrive as the handful of folders they are
|
||||||
|
// filed in, and opening one lists what is in it and nothing else.
|
||||||
|
let (presets, _dir) = named("closed");
|
||||||
|
let rows = presets.rows();
|
||||||
|
assert!(rows.iter().all(|r| r.folder && r.depth == 0), "{rows:?}");
|
||||||
|
let labels: Vec<_> = rows.iter().map(|r| r.label.to_string()).collect();
|
||||||
|
assert_eq!(labels, ["Essentials", "Skies", "Film"]);
|
||||||
|
|
||||||
|
presets.toggle("shipped/Film");
|
||||||
|
let film: Vec<_> = presets
|
||||||
|
.rows()
|
||||||
|
.into_iter()
|
||||||
|
.filter(|r| r.depth == 1)
|
||||||
|
.map(|r| r.label.to_string())
|
||||||
|
.collect();
|
||||||
|
assert_eq!(film, ["Colour", "Cinema", "Black and white"]);
|
||||||
|
|
||||||
|
presets.toggle("shipped/Film");
|
||||||
|
assert_eq!(presets.rows().len(), 3);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn a_slash_in_your_name_files_it_in_a_folder_of_that_name() {
|
||||||
|
let (presets, _dir) = named("categories");
|
||||||
|
presets
|
||||||
|
.insert("Portraits/Warm skin", Preset::default())
|
||||||
|
.unwrap();
|
||||||
|
presets.insert("Loose", Preset::default()).unwrap();
|
||||||
|
|
||||||
|
// The category's own presets, shown by their last part and applied
|
||||||
|
// by the whole name.
|
||||||
|
assert_eq!(
|
||||||
|
section(&presets, "Portraits"),
|
||||||
|
vec![(
|
||||||
|
"Portraits/Warm skin".to_string(),
|
||||||
|
crate::PresetOrigin::Yours
|
||||||
|
)]
|
||||||
|
);
|
||||||
|
let rows = presets.all_rows();
|
||||||
|
let yours = rows.iter().find(|r| r.label == "Yours").unwrap();
|
||||||
|
assert_eq!(yours.count, 2);
|
||||||
|
let warm = rows
|
||||||
|
.iter()
|
||||||
|
.find(|r| r.name == "Portraits/Warm skin")
|
||||||
|
.unwrap();
|
||||||
|
assert_eq!((warm.label.as_str(), warm.depth), ("Warm skin", 2));
|
||||||
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn saving_into_a_folder_opens_the_way_to_it() {
|
||||||
|
let (presets, _dir) = named("reveal");
|
||||||
|
presets
|
||||||
|
.insert("Travel/Night/Neon", Preset::default())
|
||||||
|
.unwrap();
|
||||||
|
presets.reveal("Travel/Night/Neon");
|
||||||
|
assert!(presets.rows().iter().any(|r| r.name == "Travel/Night/Neon"));
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn saving_over_a_shipped_name_changes_it_and_deleting_reverts() {
|
fn saving_over_a_shipped_name_changes_it_and_deleting_reverts() {
|
||||||
let (presets, _dir) = named("override");
|
let (presets, _dir) = named("override");
|
||||||
|
|||||||
@@ -521,6 +521,8 @@ export component AppWindow inherits Window {
|
|||||||
callback rename-preset(string, string);
|
callback rename-preset(string, string);
|
||||||
callback delete-preset(string);
|
callback delete-preset(string);
|
||||||
callback preset-name-edited(string);
|
callback preset-name-edited(string);
|
||||||
|
/// A category folder in the preset menu or sheet was opened or closed.
|
||||||
|
callback toggle-preset-folder(string);
|
||||||
|
|
||||||
/// TRACES: FR-DEV-6
|
/// TRACES: FR-DEV-6
|
||||||
/// Which kinds of edit a copy, paste or preset carries.
|
/// Which kinds of edit a copy, paste or preset carries.
|
||||||
@@ -1798,6 +1800,7 @@ in property <bool> panel-visible: true;
|
|||||||
root.apply-preset(name);
|
root.apply-preset(name);
|
||||||
}
|
}
|
||||||
manage-presets => { Transfer.open-presets(); }
|
manage-presets => { Transfer.open-presets(); }
|
||||||
|
folder-toggled(key) => { root.toggle-preset-folder(key); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// The canvas: compute output composited directly. No CPU
|
// The canvas: compute output composited directly. No CPU
|
||||||
@@ -3454,6 +3457,7 @@ in property <bool> panel-visible: true;
|
|||||||
remove(name) => { root.delete-preset(name); }
|
remove(name) => { root.delete-preset(name); }
|
||||||
name-edited(text) => { root.preset-name-edited(text); }
|
name-edited(text) => { root.preset-name-edited(text); }
|
||||||
dismiss => { root.presets-open = false; }
|
dismiss => { root.presets-open = false; }
|
||||||
|
folder-toggled(key) => { root.toggle-preset-folder(key); }
|
||||||
}
|
}
|
||||||
|
|
||||||
// TRACES: FR-EXP-7 | FR-UI-5
|
// TRACES: FR-EXP-7 | FR-UI-5
|
||||||
|
|||||||
+99
-15
@@ -1,7 +1,8 @@
|
|||||||
import { Theme } from "theme.slint";
|
import { Theme } from "theme.slint";
|
||||||
import { Button, Field, Caption, PanelHeading } from "widgets.slint";
|
import { Button, Field, Caption, PanelHeading, Label } from "widgets.slint";
|
||||||
import { ChoiceChip } from "controls.slint";
|
import { ChoiceChip } from "controls.slint";
|
||||||
import { Pickers } from "pickers.slint";
|
import { Pickers } from "pickers.slint";
|
||||||
|
import { Icon } from "icons.slint";
|
||||||
|
|
||||||
// TRACES: FR-DEV-6
|
// TRACES: FR-DEV-6
|
||||||
// One kind of edit, and whether a copy carries it.
|
// One kind of edit, and whether a copy carries it.
|
||||||
@@ -30,18 +31,86 @@ export enum PresetOrigin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TRACES: FR-DEV-6
|
// TRACES: FR-DEV-6
|
||||||
// One row of the preset sheet: a section heading, or a preset.
|
// One row of the preset tree: a category folder, or a preset inside one.
|
||||||
//
|
//
|
||||||
// One flat list with the headings in it rather than a list of sections, for
|
// One flat list with the folders in it rather than a tree, for the reason the
|
||||||
// the reason the rows are placed by index below: a nested `for` inside a
|
// rows are placed by index below: a nested `for` inside a `Flickable` has no
|
||||||
// `Flickable` has no layout to size it, and the arithmetic stays one line.
|
// layout to size it, and the arithmetic stays one line. Rust flattens the
|
||||||
|
// tree (`PresetTree` in `presets.rs`) and leaves out whatever is inside a
|
||||||
|
// closed folder, exactly as the collections tree arrives.
|
||||||
export struct PresetRow {
|
export struct PresetRow {
|
||||||
// Non-empty on a heading row, which names no preset.
|
// A category folder rather than a preset.
|
||||||
heading: string,
|
folder: bool,
|
||||||
|
// The folder's identity, handed back when it is opened or closed. Empty
|
||||||
|
// on a preset.
|
||||||
|
key: string,
|
||||||
|
// What the row says: the folder's name, or the preset's name without the
|
||||||
|
// categories it is filed in.
|
||||||
|
label: string,
|
||||||
|
// How many folders deep, from 0 for the top level.
|
||||||
|
depth: int,
|
||||||
|
// Whether a folder is open.
|
||||||
|
expanded: bool,
|
||||||
|
// How many presets a folder holds, however deep.
|
||||||
|
count: int,
|
||||||
|
// The preset's whole name — categories and all — which is what applying,
|
||||||
|
// renaming and deleting it are asked for by. Empty on a folder.
|
||||||
name: string,
|
name: string,
|
||||||
origin: PresetOrigin,
|
origin: PresetOrigin,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TRACES: FR-DEV-6
|
||||||
|
// A category folder: the disclosure arrow, its name and how many presets it
|
||||||
|
// holds. The whole row opens and closes it — unlike a collection, a folder
|
||||||
|
// here is nothing to select, so there is no second target to keep apart.
|
||||||
|
export component PresetFolderRow inherits TouchArea {
|
||||||
|
in property <PresetRow> entry;
|
||||||
|
in property <length> indent: Theme.indent;
|
||||||
|
|
||||||
|
mouse-cursor: pointer;
|
||||||
|
accessible-role: button;
|
||||||
|
accessible-label: root.entry.label;
|
||||||
|
accessible-description: root.entry.count + " presets";
|
||||||
|
accessible-expandable: true;
|
||||||
|
accessible-expanded: root.entry.expanded;
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
border-radius: Theme.radius;
|
||||||
|
background: root.pressed ? Theme.pressed
|
||||||
|
: (root.has-hover ? Theme.hover : transparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
HorizontalLayout {
|
||||||
|
padding-left: Theme.gap-sm + root.entry.depth * root.indent;
|
||||||
|
padding-right: Theme.gap;
|
||||||
|
spacing: Theme.gap-sm;
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
width: 14px;
|
||||||
|
Icon {
|
||||||
|
name: root.entry.expanded ? "chevron-down" : "chevron-right";
|
||||||
|
ink: Theme.ink-faint;
|
||||||
|
size: 10px;
|
||||||
|
x: (parent.width - self.width) / 2;
|
||||||
|
y: (parent.height - self.height) / 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Label {
|
||||||
|
text: root.entry.label;
|
||||||
|
emphasised: true;
|
||||||
|
horizontal-stretch: 1;
|
||||||
|
vertical-alignment: center;
|
||||||
|
overflow: elide;
|
||||||
|
}
|
||||||
|
|
||||||
|
Caption {
|
||||||
|
text: root.entry.count;
|
||||||
|
vertical-alignment: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// TRACES: FR-DEV-6 | FR-UI-2
|
// TRACES: FR-DEV-6 | FR-UI-2
|
||||||
// Which kinds of edit travel: a multi-select block of chips that wraps.
|
// Which kinds of edit travel: a multi-select block of chips that wraps.
|
||||||
//
|
//
|
||||||
@@ -125,6 +194,8 @@ export component PresetSheet inherits Rectangle {
|
|||||||
callback rename(string, string);
|
callback rename(string, string);
|
||||||
callback remove(string);
|
callback remove(string);
|
||||||
callback dismiss();
|
callback dismiss();
|
||||||
|
/// A category folder was opened or closed, by its key.
|
||||||
|
callback folder-toggled(string);
|
||||||
/// Every keystroke in the name field, so the shell can clear a refusal the
|
/// Every keystroke in the name field, so the shell can clear a refusal the
|
||||||
/// user has started correcting.
|
/// user has started correcting.
|
||||||
callback name-edited(string);
|
callback name-edited(string);
|
||||||
@@ -191,8 +262,10 @@ export component PresetSheet inherits Rectangle {
|
|||||||
if root.can-save: VerticalLayout {
|
if root.can-save: VerticalLayout {
|
||||||
spacing: Theme.gap-sm;
|
spacing: Theme.gap-sm;
|
||||||
|
|
||||||
|
// A `/` files it: "Portraits/Warm skin" goes in a folder
|
||||||
|
// called Portraits, under Yours.
|
||||||
name := Field {
|
name := Field {
|
||||||
placeholder: "Name this edit and press return";
|
placeholder: "Name this edit, or Folder/Name, and press return";
|
||||||
accepted(text) => {
|
accepted(text) => {
|
||||||
root.save(text);
|
root.save(text);
|
||||||
// Cleared only once the shell has accepted it. A
|
// Cleared only once the shell has accepted it. A
|
||||||
@@ -226,6 +299,11 @@ export component PresetSheet inherits Rectangle {
|
|||||||
// A floor, so the list is not squeezed out of existence by the
|
// A floor, so the list is not squeezed out of existence by the
|
||||||
// field and the button around it on a short window.
|
// field and the button around it on a short window.
|
||||||
min-height: 120px;
|
min-height: 120px;
|
||||||
|
// As tall as the rows, up to a limit: the card is sized from
|
||||||
|
// what it holds, and a Flickable reports next to nothing, so
|
||||||
|
// without this an opened folder showed three rows and hid the
|
||||||
|
// rest behind a scroll.
|
||||||
|
preferred-height: min(root.rows.length * (Theme.touch-target + 2px), 400px);
|
||||||
viewport-height: root.rows.length * (Theme.touch-target + 2px);
|
viewport-height: root.rows.length * (Theme.touch-target + 2px);
|
||||||
|
|
||||||
for entry[i] in root.rows: Rectangle {
|
for entry[i] in root.rows: Rectangle {
|
||||||
@@ -233,15 +311,18 @@ export component PresetSheet inherits Rectangle {
|
|||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: Theme.touch-target;
|
height: Theme.touch-target;
|
||||||
|
|
||||||
if entry.heading != "": PanelHeading {
|
if entry.folder: PresetFolderRow {
|
||||||
text: entry.heading;
|
entry: entry;
|
||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: parent.height;
|
height: parent.height;
|
||||||
vertical-alignment: bottom;
|
clicked => { root.folder-toggled(entry.key); }
|
||||||
}
|
}
|
||||||
|
|
||||||
if entry.heading == "" && root.renaming != entry.name: HorizontalLayout {
|
if !entry.folder && root.renaming != entry.name: HorizontalLayout {
|
||||||
spacing: Theme.gap-sm;
|
spacing: Theme.gap-sm;
|
||||||
|
// Under its folder's name, as the collections tree
|
||||||
|
// indents a child.
|
||||||
|
padding-left: Theme.gap-sm + entry.depth * Theme.indent;
|
||||||
|
|
||||||
// The name is the apply button rather than a label
|
// The name is the apply button rather than a label
|
||||||
// beside one. Applying is what this list is for, and a
|
// beside one. Applying is what this list is for, and a
|
||||||
@@ -249,8 +330,8 @@ export component PresetSheet inherits Rectangle {
|
|||||||
// gets pressed by accident and then distrusted.
|
// gets pressed by accident and then distrusted.
|
||||||
Button {
|
Button {
|
||||||
text: entry.origin == PresetOrigin.changed
|
text: entry.origin == PresetOrigin.changed
|
||||||
? entry.name + " · changed"
|
? entry.label + " · changed"
|
||||||
: entry.name;
|
: entry.label;
|
||||||
horizontal-stretch: 1;
|
horizontal-stretch: 1;
|
||||||
clicked => { root.apply(entry.name); }
|
clicked => { root.apply(entry.name); }
|
||||||
}
|
}
|
||||||
@@ -276,8 +357,11 @@ export component PresetSheet inherits Rectangle {
|
|||||||
// Renaming in place rather than in a second sheet: a
|
// Renaming in place rather than in a second sheet: a
|
||||||
// dialogue over a dialogue is where a user loses track of
|
// dialogue over a dialogue is where a user loses track of
|
||||||
// which one Escape closes.
|
// which one Escape closes.
|
||||||
if entry.heading == "" && root.renaming == entry.name: HorizontalLayout {
|
// The whole name, categories and all: renaming is how a
|
||||||
|
// preset moves to another folder.
|
||||||
|
if !entry.folder && root.renaming == entry.name: HorizontalLayout {
|
||||||
spacing: Theme.gap-sm;
|
spacing: Theme.gap-sm;
|
||||||
|
padding-left: Theme.gap-sm + entry.depth * Theme.indent;
|
||||||
|
|
||||||
rename-field := Field {
|
rename-field := Field {
|
||||||
text: entry.name;
|
text: entry.name;
|
||||||
|
|||||||
+34
-11
@@ -53,8 +53,8 @@
|
|||||||
import { Theme } from "theme.slint";
|
import { Theme } from "theme.slint";
|
||||||
import { Icon } from "icons.slint";
|
import { Icon } from "icons.slint";
|
||||||
import { ViewMode } from "session.slint";
|
import { ViewMode } from "session.slint";
|
||||||
import { PresetRow, PresetOrigin } from "presets.slint";
|
import { PresetRow, PresetOrigin, PresetFolderRow } from "presets.slint";
|
||||||
import { PanelHeading, Label, ScrollBar } from "widgets.slint";
|
import { Label, ScrollBar } from "widgets.slint";
|
||||||
|
|
||||||
// One tool. A struct rather than four parallel arrays so a row cannot be
|
// One tool. A struct rather than four parallel arrays so a row cannot be
|
||||||
// half-added — the compiler will not let a new entry omit its icon.
|
// half-added — the compiler will not let a new entry omit its icon.
|
||||||
@@ -137,6 +137,8 @@ export component ToolRail inherits Rectangle {
|
|||||||
in property <[PresetRow]> presets;
|
in property <[PresetRow]> presets;
|
||||||
callback preset-picked(string);
|
callback preset-picked(string);
|
||||||
callback manage-presets();
|
callback manage-presets();
|
||||||
|
/// A category folder in the menu was opened or closed, by its key.
|
||||||
|
callback folder-toggled(string);
|
||||||
|
|
||||||
/// The groups this rail actually draws.
|
/// The groups this rail actually draws.
|
||||||
///
|
///
|
||||||
@@ -217,6 +219,15 @@ export component ToolRail inherits Rectangle {
|
|||||||
// scrolls.
|
// scrolls.
|
||||||
private property <length> foot-height: Theme.rail-entry-height + 1px;
|
private property <length> foot-height: Theme.rail-entry-height + 1px;
|
||||||
|
|
||||||
|
// Show the presets menu again, so it takes the height its rows now want.
|
||||||
|
// A function on the rail rather than the two calls in the row that needs
|
||||||
|
// them: Slint 1.17 generates Rust that does not compile for a popup's
|
||||||
|
// `close()` reached from an element nested inside that popup.
|
||||||
|
function remeasure-menu() {
|
||||||
|
preset-menu.close();
|
||||||
|
preset-menu.show();
|
||||||
|
}
|
||||||
|
|
||||||
// One row of the presets menu. Shorter than a touch target for the reason
|
// One row of the presets menu. Shorter than a touch target for the reason
|
||||||
// the film list gives: a row's neighbours are other rows.
|
// the film list gives: a row's neighbours are other rows.
|
||||||
private property <length> menu-row-height: 32px;
|
private property <length> menu-row-height: 32px;
|
||||||
@@ -540,15 +551,24 @@ export component ToolRail inherits Rectangle {
|
|||||||
width: parent.width;
|
width: parent.width;
|
||||||
height: root.menu-row-height;
|
height: root.menu-row-height;
|
||||||
|
|
||||||
if entry.heading != "": PanelHeading {
|
// Opening a folder rebuilds the rows, and so the
|
||||||
x: Theme.gap;
|
// height the menu wants. A PopupWindow takes its
|
||||||
width: parent.width - 2 * Theme.gap;
|
// geometry once, when shown — a folder opened in
|
||||||
|
// place stayed the old size and pushed what it
|
||||||
|
// held under "Save or manage…" — so the menu is
|
||||||
|
// shown again, measured afresh, its foot still on
|
||||||
|
// the entry and growing upward.
|
||||||
|
if entry.folder: PresetFolderRow {
|
||||||
|
entry: entry;
|
||||||
|
width: parent.width;
|
||||||
height: parent.height;
|
height: parent.height;
|
||||||
text: entry.heading;
|
clicked => {
|
||||||
vertical-alignment: bottom;
|
root.folder-toggled(entry.key);
|
||||||
|
root.remeasure-menu();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if entry.heading == "": row := TouchArea {
|
if !entry.folder: row := TouchArea {
|
||||||
mouse-cursor: pointer;
|
mouse-cursor: pointer;
|
||||||
clicked => {
|
clicked => {
|
||||||
root.preset-picked(entry.name);
|
root.preset-picked(entry.name);
|
||||||
@@ -567,12 +587,15 @@ export component ToolRail inherits Rectangle {
|
|||||||
: (row.has-hover ? Theme.hover : transparent);
|
: (row.has-hover ? Theme.hover : transparent);
|
||||||
|
|
||||||
HorizontalLayout {
|
HorizontalLayout {
|
||||||
padding-left: Theme.gap;
|
// Past the folder's arrow, so a preset
|
||||||
|
// lines up with its folder's name.
|
||||||
|
padding-left: Theme.gap-sm + 14px + Theme.gap-sm
|
||||||
|
+ (entry.depth - 1) * Theme.indent;
|
||||||
padding-right: Theme.gap;
|
padding-right: Theme.gap;
|
||||||
Label {
|
Label {
|
||||||
text: entry.origin == PresetOrigin.changed
|
text: entry.origin == PresetOrigin.changed
|
||||||
? entry.name + " · changed"
|
? entry.label + " · changed"
|
||||||
: entry.name;
|
: entry.label;
|
||||||
emphasised: row.has-hover;
|
emphasised: row.has-hover;
|
||||||
vertical-alignment: center;
|
vertical-alignment: center;
|
||||||
overflow: elide;
|
overflow: elide;
|
||||||
|
|||||||
Reference in New Issue
Block a user