mirror of
https://github.com/storytold/lightcraft.git
synced 2026-10-26 02:59:17 -06:00
Merge PR #324
This commit is contained in:
@@ -272,7 +272,8 @@ fn services() -> Services {
|
||||
let status = if cfg!(target_os = "macos") {
|
||||
std::process::Command::new("open").args(["-R", path]).status()
|
||||
} else if cfg!(target_os = "windows") {
|
||||
std::process::Command::new("explorer").arg(format!("/select,{path}")).status()
|
||||
let win_path = path.replace('/', "\\");
|
||||
std::process::Command::new("explorer").arg(format!("/select,{win_path}")).status()
|
||||
} else {
|
||||
let dir = std::path::Path::new(path).parent().map(|d| d.to_string_lossy().to_string()).unwrap_or_else(|| ".".into());
|
||||
std::process::Command::new("xdg-open").arg(dir).status()
|
||||
|
||||
@@ -803,6 +803,8 @@
|
||||
"Show destination gamut warning": "出力先の色域警告を表示",
|
||||
"Show display gamut warning": "ディスプレイの色域警告を表示",
|
||||
"Show file names": "ファイル名を表示",
|
||||
"Show in Explorer": "エクスプローラーで表示",
|
||||
"Show in File Manager": "ファイルマネージャーで表示",
|
||||
"Show in Finder": "Finderで表示",
|
||||
"Show on Map": "地図で表示",
|
||||
"Show overlay (O)": "重ね表示(O)",
|
||||
|
||||
@@ -1053,6 +1053,8 @@
|
||||
"Show destination gamut warning": "Mostrar aviso de gamut de destino",
|
||||
"Show display gamut warning": "Mostrar aviso de gamut da tela",
|
||||
"Show file names": "Mostrar nomes dos arquivos",
|
||||
"Show in Explorer": "Mostrar no Explorador de Arquivos",
|
||||
"Show in File Manager": "Mostrar no gerenciador de arquivos",
|
||||
"Show in Finder": "Mostrar no Finder",
|
||||
"Show on Map": "Mostrar no mapa",
|
||||
"Show overlay (O)": "Mostrar sobreposição (O)",
|
||||
|
||||
@@ -1045,6 +1045,8 @@
|
||||
"Show destination gamut warning": "显示目标色域警告",
|
||||
"Show display gamut warning": "显示显示器色域警告",
|
||||
"Show file names": "显示文件名",
|
||||
"Show in Explorer": "在文件资源管理器中显示",
|
||||
"Show in File Manager": "在文件管理器中显示",
|
||||
"Show in Finder": "在 Finder 中显示",
|
||||
"Show on Map": "在地图上显示",
|
||||
"Show overlay (O)": "显示叠加 (O)",
|
||||
|
||||
@@ -1045,6 +1045,8 @@
|
||||
"Show destination gamut warning": "顯示目標色域警告",
|
||||
"Show display gamut warning": "顯示螢幕色域警告",
|
||||
"Show file names": "顯示檔案名稱",
|
||||
"Show in Explorer": "在檔案總管中顯示",
|
||||
"Show in File Manager": "在檔案管理員中顯示",
|
||||
"Show in Finder": "在 Finder 中顯示",
|
||||
"Show on Map": "在地圖上顯示",
|
||||
"Show overlay (O)": "顯示疊加(O)",
|
||||
|
||||
@@ -342,6 +342,7 @@ fn live_label(app: &LightcraftApp, id: &str, label: &str) -> String {
|
||||
"photo.delete" if n > 1 => crate::i18n::tr_format!("Delete {n} Photos", n = n),
|
||||
"photo.virtualCopy" if n > 1 => crate::i18n::tr_format!("Create {n} Virtual Copies", n = n),
|
||||
"dialog.rename" if n > 1 => crate::i18n::tr_format!("Rename {n} Photos…", n = n),
|
||||
"app.showInFinder" => crate::i18n::tr(crate::menus::reveal_label()).to_string(),
|
||||
_ => label.to_string(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1329,6 +1329,17 @@ pub fn confirm_delete(app: &mut LightcraftApp) -> bool {
|
||||
true
|
||||
}
|
||||
|
||||
/// Platform-appropriate label for revealing a file in the system file manager.
|
||||
pub fn reveal_label() -> &'static str {
|
||||
if cfg!(target_os = "macos") {
|
||||
"Show in Finder"
|
||||
} else if cfg!(target_os = "windows") {
|
||||
"Show in Explorer"
|
||||
} else {
|
||||
"Show in File Manager"
|
||||
}
|
||||
}
|
||||
|
||||
/// Reveal the active photo's original in the system file manager.
|
||||
fn show_in_finder(app: &mut LightcraftApp) -> Result<Value, String> {
|
||||
let id = app.session.active().ok_or("no photo selected")?;
|
||||
|
||||
@@ -900,7 +900,7 @@ pub fn context_menu(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
|
||||
if missing && ui.button(crate::i18n::tr("Locate Missing File…")).clicked() {
|
||||
let _ = app.run("photo.locate", json!({}));
|
||||
}
|
||||
if ui.add_enabled(crate::menus::ui_enabled(app, "app.showInFinder"), egui::Button::new(crate::i18n::tr("Show in Finder"))).clicked() {
|
||||
if ui.add_enabled(crate::menus::ui_enabled(app, "app.showInFinder"), egui::Button::new(crate::i18n::tr(crate::menus::reveal_label()))).clicked() {
|
||||
let _ = app.run("app.showInFinder", json!({}));
|
||||
}
|
||||
if ui.button(crate::i18n::tr("Export…")).clicked() {
|
||||
|
||||
@@ -521,7 +521,7 @@ fn folder_tree(
|
||||
}
|
||||
}
|
||||
if app.services.reveal.is_some()
|
||||
&& ui.button(crate::i18n::tr("Show in Finder")).clicked()
|
||||
&& ui.button(crate::i18n::tr(crate::menus::reveal_label())).clicked()
|
||||
&& let Some(f) = app.services.reveal.as_mut()
|
||||
{
|
||||
let _ = f(path);
|
||||
|
||||
@@ -482,7 +482,7 @@ fn info(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
|
||||
ui.add(egui::Label::new(egui::RichText::new(path).size(12.0).color(t.text_label)).truncate());
|
||||
if crate::menus::ui_enabled(app, "app.showInFinder") {
|
||||
ui.with_layout(egui::Layout::right_to_left(egui::Align::Center), |ui| {
|
||||
if crate::widgets::icon_button(ui, "infoReveal", Icon::Folder, vec2(20.0, 20.0), false, true, "Show in Finder").clicked() {
|
||||
if crate::widgets::icon_button(ui, "infoReveal", Icon::Folder, vec2(20.0, 20.0), false, true, crate::menus::reveal_label()).clicked() {
|
||||
let _ = app.run("app.showInFinder", json!({}));
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user