Skip to content
Open
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
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/de.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2654,13 +2654,15 @@ file = "Datei"
link = "Link zum Teilen"

[editor.export.done]
copy_file = "Datei kopieren"
copy_link = "Link kopieren"
instant_hint = "Verwenden Sie für Ihre nächste Aufnahme den Instant-Modus, wenn Sie direkt nach dem Stoppen einen Link möchten."
link_copied = "Link kopiert"
open_file = "Datei öffnen"
open_link = "Link öffnen"
retry_copy = "Erneut kopieren"
reuploaded = "Ihre neueste Bearbeitung ist unter demselben Link bereit"
saved_copy = "Kopie gespeichert als {name}"
uploaded = "Ihr Cap wurde erfolgreich hochgeladen"

[editor.export.enhance]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/en.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2656,13 +2656,15 @@ file = { text = "File", context = "Export destination." }
link = { text = "Shareable Link", context = "Export destination." }

[editor.export.done]
copy_file = "Copy File"
copy_link = "Copy link"
instant_hint = "Use Instant Mode for your next recording if you want a link the moment you stop."
link_copied = "Link copied"
open_file = "Open File"
open_link = "Open link"
retry_copy = "Retry Copy"
reuploaded = "Your latest edit is ready at the same link"
saved_copy = { text = "Saved a copy as {name}", context = "{name} is the new file's name, for example Demo copy.mp4." }
uploaded = "Your Cap has been uploaded successfully"

[editor.export.enhance]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/es.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2654,13 +2654,15 @@ file = "Archivo"
link = "Enlace para compartir"

[editor.export.done]
copy_file = "Copiar archivo"
copy_link = "Copiar enlace"
instant_hint = "Usa el modo Instant en tu próxima grabación si quieres un enlace en cuanto te detengas."
link_copied = "Enlace copiado"
open_file = "Abrir archivo"
open_link = "Abrir enlace"
retry_copy = "Reintentar copia"
reuploaded = "Tu última edición está lista en el mismo enlace"
saved_copy = "Copia guardada como {name}"
uploaded = "Tu Cap se subió correctamente"

[editor.export.enhance]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/fr.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2654,13 +2654,15 @@ file = "Fichier"
link = "Lien de partage"

[editor.export.done]
copy_file = "Copier le fichier"
copy_link = "Copier le lien"
instant_hint = "Utilisez le mode Instant pour votre prochain enregistrement si vous voulez un lien dès que vous arrêtez."
link_copied = "Lien copié"
open_file = "Ouvrir le fichier"
open_link = "Ouvrir le lien"
retry_copy = "Réessayer la copie"
reuploaded = "Votre dernière modification est disponible sur le même lien"
saved_copy = "Copie enregistrée sous {name}"
uploaded = "Votre Cap a bien été mis en ligne"

[editor.export.enhance]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/hi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2654,13 +2654,15 @@ file = "फ़ाइल"
link = "शेयर लिंक"

[editor.export.done]
copy_file = "फ़ाइल कॉपी करें"
copy_link = "लिंक कॉपी करें"
instant_hint = "अगर आप रोकते ही लिंक चाहते हैं, तो अगली रिकॉर्डिंग के लिए Instant मोड इस्तेमाल करें।"
link_copied = "लिंक कॉपी हो गया"
open_file = "फ़ाइल खोलें"
open_link = "लिंक खोलें"
retry_copy = "फिर से कॉपी करें"
reuploaded = "आपका नया संपादन उसी लिंक पर तैयार है"
saved_copy = "कॉपी {name} के रूप में सहेजी गई"
uploaded = "आपका Cap सफलतापूर्वक अपलोड हो गया"

[editor.export.enhance]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/ja.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2654,13 +2654,15 @@ file = "ファイル"
link = "共有リンク"

[editor.export.done]
copy_file = "ファイルをコピー"
copy_link = "リンクをコピー"
instant_hint = "停止した瞬間にリンクが欲しい場合は、次の録画でInstantモードを使ってください。"
link_copied = "リンクをコピーしました"
open_file = "ファイルを開く"
open_link = "リンクを開く"
retry_copy = "コピーを再試行"
reuploaded = "最新の編集内容が同じリンクで利用できます"
saved_copy = "コピーを{name}として保存しました"
uploaded = "録画のアップロードが完了しました"

[editor.export.enhance]
Expand Down
2 changes: 2 additions & 0 deletions apps/desktop-gpui/locales/zh-CN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2654,13 +2654,15 @@ file = "文件"
link = "分享链接"

[editor.export.done]
copy_file = "复制文件"
copy_link = "复制链接"
instant_hint = "如果想在停止录制时立即获得链接,下次录制请使用 Instant 模式。"
link_copied = "链接已复制"
open_file = "打开文件"
open_link = "打开链接"
retry_copy = "重新复制"
reuploaded = "你最新的编辑已在同一链接上就绪"
saved_copy = "已将副本保存为 {name}"
uploaded = "你的录制已成功上传"

[editor.export.enhance]
Expand Down
78 changes: 77 additions & 1 deletion apps/desktop-gpui/src/editor_export.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,6 +414,7 @@ pub struct ExportUi {
pub rendered: u32,
pub total_frames: u32,
pub output_path: Option<PathBuf>,
copied_file: Option<PathBuf>,
pub error: Option<String>,
pub cancel: Arc<AtomicBool>,
pub export_task: Option<gpui::Task<()>>,
Expand Down Expand Up @@ -571,6 +572,7 @@ impl ExportUi {
rendered: 0,
total_frames: 0,
output_path: None,
copied_file: None,
error: None,
cancel: Arc::new(AtomicBool::new(false)),
export_task: None,
Expand Down Expand Up @@ -1334,6 +1336,7 @@ impl EditorWindow {
ui.rendered = 0;
ui.total_frames = 0;
ui.output_path = None;
ui.copied_file = None;
cx.notify();

ui.export_task = Some(cx.spawn_in(window, async move |this, cx| {
Expand Down Expand Up @@ -2014,6 +2017,44 @@ impl EditorWindow {
)
}

/// Runs in the `Copying` phase so closing the panel, starting another
/// export and installing an update all wait for the copy to finish.
fn duplicate_output(&mut self, window: &mut Window, cx: &mut Context<Self>) {
let Some(ui) = self
.export
.as_mut()
.filter(|ui| ui.phase == ExportPhase::Done)
Comment thread
yashranaway marked this conversation as resolved.
Resolved
else {
return;
};
let Some(source) = ui.output_path.clone() else {
return;
};
ui.phase = ExportPhase::Copying;
Comment thread
yashranaway marked this conversation as resolved.
Resolved
ui.copied_file = None;
ui.error = None;
cx.notify();
cx.spawn_in(window, async move |this, cx| {
let result = cx
.background_executor()
.spawn(async move { library::duplicate_file(&source) })
.await;
this.update_in(cx, |this, window, cx| {
if let Some(ui) = this.export.as_mut() {
ui.phase = ExportPhase::Done;
match result {
Ok(path) => ui.copied_file = Some(path),
Err(error) => ui.error = Some(error),
}
}
cx.notify();
this.finish_requested_export_close(window, cx);
})
.ok();
})
.detach();
Comment thread
yashranaway marked this conversation as resolved.
Resolved
}

fn retry_clipboard_copy(&mut self, window: &mut Window, cx: &mut Context<Self>) {
let Some(ui) = self.export.as_mut() else {
return;
Expand Down Expand Up @@ -4027,6 +4068,7 @@ impl EditorWindow {

let mut wash: Hsla = editor.window.into();
wash.a = 0.94;
let cancellable = ui.phase.is_busy() && ui.phase != ExportPhase::Copying;

div()
.absolute()
Expand Down Expand Up @@ -4107,7 +4149,20 @@ impl EditorWindow {
.child(error),
)
})
.when(ui.phase.is_busy(), |this| {
.when_some(
ui.copied_file.as_ref().and_then(|path| path.file_name()),
|this, name| {
this.child(
div()
.max_w(px(360.))
.text_size(px(12.))
.text_color(Hsla::from(editor.text_2))
.text_center()
.child(tr::editor::export::done::saved_copy(name.to_string_lossy())),
)
},
)
.when(cancellable, |this| {
this.child(
ui::Button::plain(
&theme,
Expand Down Expand Up @@ -4214,6 +4269,27 @@ impl EditorWindow {
}
}),
)
.when(
ui.phase == ExportPhase::Done
&& ui.format != ExportFormatKind::Tracks,
|this| {
this.child(
ui::Button::plain(
&theme,
"export-copy-file",
ui::ButtonVariant::Gray,
ui::ButtonSize::Md,
)
.icon("icons/copy.svg")
.label(tr::editor::export::done::copy_file())
.on_click(
cx.listener(|this, _, window, cx| {
this.duplicate_output(window, cx);
}),
),
)
},
)
},
)
.when(
Expand Down
6 changes: 6 additions & 0 deletions apps/desktop-gpui/src/i18n/editor_shell_surface_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ const FORMATTED: &[&str] = &[
"editor.clips.removed_media",
"editor.clips.save_before_recording_failed",
"editor.clips.split",
"editor.export.done.saved_copy",
"editor.export.estimate.gigabytes",
"editor.export.estimate.gigabytes_range",
"editor.export.estimate.hours",
Expand Down Expand Up @@ -221,6 +222,7 @@ fn editor_shell_surfaces_match_the_literals_they_replaced() {
(tr::editor::export::destination::clipboard(), "Clipboard"),
(tr::editor::export::destination::file(), "File"),
(tr::editor::export::destination::link(), "Shareable Link"),
(tr::editor::export::done::copy_file(), "Copy File"),
(tr::editor::export::done::copy_link(), "Copy link"),
(
tr::editor::export::done::instant_hint(),
Expand Down Expand Up @@ -1650,6 +1652,10 @@ fn editor_shell_messages_format_like_the_code_they_replaced() {
tr::editor::clips::append_error(&message),
format!("Failed to add clip: {message}")
);
assert_eq!(
tr::editor::export::done::saved_copy("Demo copy.mp4"),
"Saved a copy as Demo copy.mp4"
);
assert_eq!(
tr::editor::clips::import_error(&message),
format!("Failed to import clip: {message}")
Expand Down
3 changes: 3 additions & 0 deletions apps/desktop-gpui/src/library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
//! all it does is fan jobs out to that executor. Nothing here touches gpui
//! state.

mod file_copy;
pub use file_copy::duplicate_file;

use std::{
collections::HashSet,
path::{Path, PathBuf},
Expand Down
Loading
Loading