Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions crates/engine/src/activity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -518,12 +518,27 @@ impl Activity {
lock(&self.inner.finished).iter().cloned().collect()
}

/// Tasks that were asked to stop and still hold their row: what Quit Anyway waits for.
pub fn stopping(&self) -> Vec<TaskInfo> {
lock(&self.inner.tasks).iter().filter(|e| e.is_cancellable() && e.is_cancelled()).map(|e| e.info()).collect()
}

/// Tasks that quitting would cut short: cancellable ones not already stopping.
pub fn running_cancellable(&self) -> Vec<TaskInfo> {
lock(&self.inner.tasks).iter().filter(|e| e.is_cancellable() && !e.is_cancelled()).map(|e| e.info()).collect()
}
}

/// How long Quit Anyway waits for the tasks it asked to stop, before the process ends anyway.
pub const QUIT_DRAIN: std::time::Duration = std::time::Duration::from_secs(5);

/// How long a plug-in gets to wind down once quitting tells it to: shorter than [`QUIT_DRAIN`], so a plug-in that
/// stalls can't hold the app past its own limit.
pub const PLUGIN_QUIT_WINDOW: std::time::Duration = std::time::Duration::from_secs(2);

/// How long the drain may take before the quit prompt swaps its buttons for a spinner.
pub const QUIT_SPINNER_AFTER: std::time::Duration = std::time::Duration::from_millis(500);

/// A task's place in the list, held by whoever owns the job; dropping it removes the row.
pub struct TaskGuard {
activity: Activity,
Expand Down Expand Up @@ -779,6 +794,23 @@ mod tests {
assert!(a.list().is_empty());
}

#[test]
fn the_plug_in_window_is_shorter_than_the_app_timer() {
assert!(PLUGIN_QUIT_WINDOW < QUIT_DRAIN, "a stalled plug-in must not hold the app past its own limit");
assert!(QUIT_SPINNER_AFTER < PLUGIN_QUIT_WINDOW);
}

#[test]
fn stopping_lists_cancelled_tasks_until_they_end() {
let a = Activity::default();
let g = a.start("export", "Exporting", Cancel::Yes);
assert!(a.stopping().is_empty(), "nothing was asked to stop");
assert_eq!(a.cancel_all(), 1);
assert_eq!(a.stopping().len(), 1);
drop(g);
assert!(a.stopping().is_empty(), "the row goes when the task ends");
}

#[test]
fn cancel_sets_the_adopted_flag() {
let a = Activity::default();
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/cs-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
"Version {version} is installed": "Je nainstalována verze {version}",
"Video in {dir}": "Video ve složce {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Kalibrace vinětace nepoužita u {n} fotografií: chybí reference pro jejich fotoaparát, objektiv a clonu",
"Waiting for {names} to stop…": "Čekání na zastavení: {names}…",
"Waiting to export {total} photo{}": "Čeká export {total} fotografií{:.0}",
"What {name} does with it:": "Co s tím {name} dělá:",
"Where should the Capture One catalog “{catalog}” go?": "Kam má jít katalog Capture One „{catalog}“?",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/de-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
"Version {version} is installed": "Version {version} ist installiert",
"Video in {dir}": "Video in {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Vignettierungs-Kalibrierung bei {n} Fotos nicht angewendet: keine Referenz für Kamera, Objektiv und Blende",
"Waiting for {names} to stop…": "Warte, bis {names} beendet ist…",
"Waiting to export {total} photo{}": "Warte auf Export von {total} Foto{}",
"Where should the Capture One catalog “{catalog}” go?": "Wohin soll der Capture-One-Katalog „{catalog}“?",
"Your own curve files go in {folder}": "Eigene Kurvendateien kommen in {folder}",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/es-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
"Version {version} is installed": "La versión {version} está instalada",
"Video in {dir}": "Vídeo en {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Calibración del viñeteado no aplicada a {n} fotos: no hay referencia para su cámara, objetivo y diafragma",
"Waiting for {names} to stop…": "Esperando a que se detenga: {names}…",
"Waiting to export {total} photo{}": "Esperando para exportar {total} foto{}",
"Where should the Capture One catalog “{catalog}” go?": "¿Dónde debe ir el catálogo de Capture One “{catalog}”?",
"Your own curve files go in {folder}": "Tus propios archivos de curvas van en {folder}",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/fi-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@
"Version {version} is installed": "Versio {version} on asennettu",
"Video in {dir}": "Video kansiossa {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Vinjetoinnin kalibrointia ei käytetty {n} kuvaan: niiden kameralle, objektiiville ja aukolle ei ole viitekuvaa",
"Waiting for {names} to stop…": "Odotetaan, että {names} pysähtyy…",
"Waiting to export {total} photo{}": "Odottaa viennin alkua: {total} kuvaa{:.0}",
"What {name} does with it:": "Mitä {name} tekee sillä:",
"Where should the Capture One catalog “{catalog}” go?": "Minne Capture One -luettelo ”{catalog}” tuodaan?",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/fr-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
"Version {version} is installed": "La version {version} est installée",
"Video in {dir}": "Vidéo dans {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Calibrage du vignettage non appliqué à {n} photos : aucune référence pour leur appareil, leur objectif et leur ouverture",
"Waiting for {names} to stop…": "En attente de l’arrêt de {names}…",
"Waiting to export {total} photo{}": "En attente d'exportation de {total} photo{}",
"Where should the Capture One catalog “{catalog}” go?": "Où importer le catalogue Capture One « {catalog} » ?",
"Your own curve files go in {folder}": "Vos propres fichiers de courbes vont dans {folder}",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/id-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@
"Version {version} is installed": "Versi {version} terinstal",
"Video in {dir}": "Video di {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Kalibrasi vignet tidak diterapkan pada {n} foto: tidak ada referensi untuk kamera, lensa, dan bukaannya",
"Waiting for {names} to stop…": "Menunggu {names} berhenti…",
"Waiting to export {total} photo{}": "Menunggu untuk mengekspor {total} foto{:.0}",
"What {name} does with it:": "Apa yang dilakukan {name} dengannya:",
"Where should the Capture One catalog “{catalog}” go?": "Ke mana katalog Capture One “{catalog}” diimpor?",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/it-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@
"Version {version} is installed": "È installata la versione {version}",
"Video in {dir}": "Video in {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Calibrazione della vignettatura non applicata a {n} foto: nessun riferimento per fotocamera, obiettivo e diaframma",
"Waiting for {names} to stop…": "In attesa che {names} si fermi…",
"Waiting to export {total} photo{}": "In attesa di esportare {total} foto{:.0}",
"What {name} does with it:": "Cosa ne fa {name}:",
"Where should the Capture One catalog “{catalog}” go?": "Dove importare il catalogo Capture One “{catalog}”?",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/ja-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
"Version {version} is installed": "バージョン {version} がインストールされています",
"Video in {dir}": "{dir} にビデオ",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "{n} 枚の写真に周辺減光キャリブレーションを適用しませんでした: そのカメラ、レンズ、絞りの参照写真がありません",
"Waiting for {names} to stop…": "{names} の停止を待っています…",
"Waiting to export {total} photo{}": "{total} 枚の写真の書き出し待ち{:.0}",
"Where should the Capture One catalog “{catalog}” go?": "Capture One カタログ「{catalog}」をどこに読み込みますか?",
"Your own curve files go in {folder}": "自分のカーブファイルは {folder} に置きます",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/ka-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@
"Version {version} is installed": "დაინსტალირებულია ვერსია {version}",
"Video in {dir}": "ვიდეო: {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "ვინეტირების კალიბრაცია არ გამოიყენება {n} ფოტოზე: მათი კამერის, ობიექტივისა და დიაფრაგმისთვის საცნობარო ფოტო არ არის",
"Waiting for {names} to stop…": "ველოდებით {names}-ის გაჩერებას…",
"Waiting to export {total} photo{}": "ელოდება {total} ფოტოს ექსპორტს{:.0}",
"What {name} does with it:": "რას აკეთებს ამით {name}:",
"Where should the Capture One catalog “{catalog}” go?": "სად გადავიტანოთ Capture One-ის კატალოგი „{catalog}“?",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/pl-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@
"Version {version} is installed": "Zainstalowana jest wersja {version}",
"Video in {dir}": "Wideo w {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Kalibracji winietowania nie zastosowano do {n} zdjęć: brak odniesienia dla ich aparatu, obiektywu i przysłony",
"Waiting for {names} to stop…": "Oczekiwanie na zatrzymanie: {names}…",
"Waiting to export {total} photo{}": "Oczekuje na eksport: zdjęcia {total}{:.0}",
"What {name} does with it:": "Co {name} z tym robi:",
"Where should the Capture One catalog “{catalog}” go?": "Dokąd zaimportować katalog Capture One „{catalog}”?",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/pt-br-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
"Version {version} is installed": "A versão {version} está instalada",
"Video in {dir}": "Vídeo em {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Calibração de vinheta não aplicada a {n} fotos: não há referência para sua câmera, lente e abertura",
"Waiting for {names} to stop…": "Aguardando {names} parar…",
"Waiting to export {total} photo{}": "Aguardando para exportar {total} foto{}",
"Where should the Capture One catalog “{catalog}” go?": "Para onde vai o catálogo do Capture One “{catalog}”?",
"Your own curve files go in {folder}": "Seus próprios arquivos de curva ficam em {folder}",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/ru-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
"Version {version} is installed": "Установлена версия {version}",
"Video in {dir}": "Видео в {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Калибровка виньетирования не применена к {n} фото: нет эталона для их камеры, объектива и диафрагмы",
"Waiting for {names} to stop…": "Ожидание остановки: {names}…",
"Waiting to export {total} photo{}": "Ожидает экспорта фото: {total}{:.0}",
"Where should the Capture One catalog “{catalog}” go?": "Куда импортировать каталог Capture One «{catalog}»?",
"Your own curve files go in {folder}": "Свои файлы кривых кладите в {folder}",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/sv-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
"Version {version} is installed": "Version {version} är installerad",
"Video in {dir}": "Video i {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Vinjetteringskalibrering användes inte på {n} foton: ingen referens för deras kamera, objektiv och bländare",
"Waiting for {names} to stop…": "Väntar på att {names} ska stoppas…",
"Waiting to export {total} photo{}": "Väntar på att exportera {total} foto{:.0}",
"What {name} does with it:": "Vad {name} gör med det:",
"Where should the Capture One catalog “{catalog}” go?": "Vart ska Capture One-katalogen ”{catalog}” importeras?",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/uk-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@
"Version {version} is installed": "Встановлено версію {version}",
"Video in {dir}": "Відео у {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Калібрування віньєтування не застосовано до {n} фото: немає еталона для їхньої камери, об’єктива й діафрагми",
"Waiting for {names} to stop…": "Очікування зупинки: {names}…",
"Waiting to export {total} photo{}": "Очікує експорту фото: {total}{:.0}",
"Where should the Capture One catalog “{catalog}” go?": "Куди імпортувати каталог Capture One «{catalog}»?",
"Your own curve files go in {folder}": "Власні файли кривих кладіть у {folder}",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/vi-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
"Version {version} is installed": "Đã cài phiên bản {version}",
"Video in {dir}": "Video trong {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "Không áp dụng hiệu chuẩn tối góc cho {n} ảnh: không có ảnh tham chiếu cho máy ảnh, ống kính và khẩu độ của chúng",
"Waiting for {names} to stop…": "Đang chờ {names} dừng…",
"Waiting to export {total} photo{}": "Đang chờ xuất {total} ảnh{:.0}",
"What {name} does with it:": "{name} làm gì với nó:",
"Where should the Capture One catalog “{catalog}” go?": "Nhập danh mục Capture One «{catalog}» vào đâu?",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/zh-hans-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
"Version {version} is installed": "已安装版本 {version}",
"Video in {dir}": "视频位于 {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "{n} 张照片未应用暗角校准:没有其相机、镜头和光圈的参考照片",
"Waiting for {names} to stop…": "正在等待 {names} 停止…",
"Waiting to export {total} photo{}": "正在等待导出 {total} 张照片{:.0}",
"Where should the Capture One catalog “{catalog}” go?": "Capture One 目录“{catalog}”要导入到哪里?",
"Your own curve files go in {folder}": "自己的曲线文件放在 {folder}",
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/locales/fork/zh-hant-formats.json
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@
"Version {version} is installed": "已安裝版本 {version}",
"Video in {dir}": "視訊位於 {dir}",
"Vignetting calibration not applied to {n} photos: no reference for their camera, lens and aperture": "{n} 張照片未套用暗角校準:沒有其相機、鏡頭和光圈的參考照片",
"Waiting for {names} to stop…": "正在等待 {names} 停止…",
"Waiting to export {total} photo{}": "正在等待匯出 {total} 張照片{:.0}",
"Where should the Capture One catalog “{catalog}” go?": "Capture One 目錄「{catalog}」要匯入到哪裡?",
"Your own curve files go in {folder}": "自己的曲線檔案放在 {folder}",
Expand Down
8 changes: 8 additions & 0 deletions crates/ui-egui/src/headless.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,9 @@ pub struct Headless {
pub window_focused: bool,
/// The simulated window is covered or minimized (off by default).
pub window_occluded: bool,
/// The pretend host asks the window to close in the next frame, as the close button or the system does
/// (`close_requested`); the app may answer `CancelClose` ([`Self::window_commands`]).
pub host_close: bool,
/// Window-management and pointer commands the app sent (`StartDrag`, `Maximized`,
/// `CursorPosition`, …), oldest first.
pub window_commands: Vec<ViewportCommand>,
Expand Down Expand Up @@ -333,6 +336,7 @@ impl Headless {
window_maximized: false,
window_focused: true,
window_occluded: false,
host_close: false,
window_commands: vec![],
last_cursor: egui::CursorIcon::Default,
}
Expand Down Expand Up @@ -373,6 +377,9 @@ impl Headless {
info.maximized = Some(self.window_maximized);
info.focused = Some(self.window_focused);
info.occluded = Some(self.window_occluded);
if std::mem::take(&mut self.host_close) {
info.events.push(egui::ViewportEvent::Close);
}
}
raw.max_texture_side = (self.reported_texture_side != Some(self.max_texture_side)).then_some(self.max_texture_side);
self.reported_texture_side = Some(self.max_texture_side);
Expand Down Expand Up @@ -409,6 +416,7 @@ impl Headless {
}
}
ViewportCommand::Close => self.quit = true,
ViewportCommand::CancelClose => self.window_commands.push(c),
ViewportCommand::Maximized(on) => {
self.window_maximized = on;
self.window_commands.push(c);
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/src/keyboard.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub(crate) fn answer_waiting(app: &LccApp) -> bool {
|| app.help.open
// the quit questions and the settings-file notice
|| app.quit_prompt.is_some()
|| app.quit_drain.is_some()
|| !app.notices.is_empty()
|| catalog_dialog_modal(app)
|| app.onboarding.wizard.is_some()
Expand Down
Loading