Add “Processing…” overlay state when post-processing (#740)
* feat: add “Processing…” overlay state * format * missing translations --------- Co-authored-by: CJ Pais <cj@cjpais.com>
This commit is contained in:
parent
a4999164ae
commit
82d5c759ad
19 changed files with 59 additions and 53 deletions
|
|
@ -7,7 +7,9 @@ use crate::managers::transcription::TranscriptionManager;
|
|||
use crate::settings::{get_settings, AppSettings, APPLE_INTELLIGENCE_PROVIDER_ID};
|
||||
use crate::shortcut;
|
||||
use crate::tray::{change_tray_icon, TrayIconState};
|
||||
use crate::utils::{self, show_recording_overlay, show_transcribing_overlay};
|
||||
use crate::utils::{
|
||||
self, show_processing_overlay, show_recording_overlay, show_transcribing_overlay,
|
||||
};
|
||||
use crate::ManagedToggleState;
|
||||
use ferrous_opencc::{config::BuiltinConfig, OpenCC};
|
||||
use log::{debug, error};
|
||||
|
|
@ -341,6 +343,9 @@ impl ShortcutAction for TranscribeAction {
|
|||
|
||||
// Then apply LLM post-processing if this is the post-process hotkey
|
||||
// Uses final_text which may already have Chinese conversion applied
|
||||
if post_process {
|
||||
show_processing_overlay(&ah);
|
||||
}
|
||||
let processed = if post_process {
|
||||
post_process_transcription(&settings, &final_text).await
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -272,39 +272,7 @@ pub fn create_recording_overlay(app_handle: &AppHandle) {
|
|||
}
|
||||
}
|
||||
|
||||
/// Shows the recording overlay window with fade-in animation
|
||||
pub fn show_recording_overlay(app_handle: &AppHandle) {
|
||||
// Check if overlay should be shown based on position setting
|
||||
let settings = settings::get_settings(app_handle);
|
||||
if settings.overlay_position == OverlayPosition::None {
|
||||
return;
|
||||
}
|
||||
|
||||
if let Some(overlay_window) = app_handle.get_webview_window("recording_overlay") {
|
||||
// Update position before showing to prevent flicker from position changes
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
update_gtk_layer_shell_anchors(&overlay_window);
|
||||
}
|
||||
|
||||
if let Some((x, y)) = calculate_overlay_position(app_handle) {
|
||||
let _ = overlay_window
|
||||
.set_position(tauri::Position::Logical(tauri::LogicalPosition { x, y }));
|
||||
}
|
||||
|
||||
let _ = overlay_window.show();
|
||||
|
||||
// On Windows, aggressively re-assert "topmost" in the native Z-order after showing
|
||||
#[cfg(target_os = "windows")]
|
||||
force_overlay_topmost(&overlay_window);
|
||||
|
||||
// Emit event to trigger fade-in animation with recording state
|
||||
let _ = overlay_window.emit("show-overlay", "recording");
|
||||
}
|
||||
}
|
||||
|
||||
/// Shows the transcribing overlay window
|
||||
pub fn show_transcribing_overlay(app_handle: &AppHandle) {
|
||||
fn show_overlay_state(app_handle: &AppHandle, state: &str) {
|
||||
// Check if overlay should be shown based on position setting
|
||||
let settings = settings::get_settings(app_handle);
|
||||
if settings.overlay_position == OverlayPosition::None {
|
||||
|
|
@ -320,11 +288,25 @@ pub fn show_transcribing_overlay(app_handle: &AppHandle) {
|
|||
#[cfg(target_os = "windows")]
|
||||
force_overlay_topmost(&overlay_window);
|
||||
|
||||
// Emit event to switch to transcribing state
|
||||
let _ = overlay_window.emit("show-overlay", "transcribing");
|
||||
let _ = overlay_window.emit("show-overlay", state);
|
||||
}
|
||||
}
|
||||
|
||||
/// Shows the recording overlay window with fade-in animation
|
||||
pub fn show_recording_overlay(app_handle: &AppHandle) {
|
||||
show_overlay_state(app_handle, "recording");
|
||||
}
|
||||
|
||||
/// Shows the transcribing overlay window
|
||||
pub fn show_transcribing_overlay(app_handle: &AppHandle) {
|
||||
show_overlay_state(app_handle, "transcribing");
|
||||
}
|
||||
|
||||
/// Shows the processing overlay window
|
||||
pub fn show_processing_overlay(app_handle: &AppHandle) {
|
||||
show_overlay_state(app_handle, "processing");
|
||||
}
|
||||
|
||||
/// Updates the overlay window position based on current settings
|
||||
pub fn update_overlay_position(app_handle: &AppHandle) {
|
||||
if let Some(overlay_window) = app_handle.get_webview_window("recording_overlay") {
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "تغيير لغة واجهة Handy"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "...جاري التفريغ"
|
||||
"transcribing": "...جاري التفريغ",
|
||||
"processing": "...جاري المعالجة"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Změňte jazyk rozhraní Handy"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Přepisuji..."
|
||||
"transcribing": "Přepisuji...",
|
||||
"processing": "Zpracovávám..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Sprache der Handy-Oberfläche ändern"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Transkribiere..."
|
||||
"transcribing": "Transkribiere...",
|
||||
"processing": "Verarbeite..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Change the language of the Handy interface"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Transcribing..."
|
||||
"transcribing": "Transcribing...",
|
||||
"processing": "Processing..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Cambia el idioma de la interfaz de Handy"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Transcribiendo..."
|
||||
"transcribing": "Transcribiendo...",
|
||||
"processing": "Procesando..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Changer la langue de l'interface de Handy"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Transcription..."
|
||||
"transcribing": "Transcription...",
|
||||
"processing": "Traitement..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Cambia la lingua dell'interfaccia di Handy"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Trascrizione..."
|
||||
"transcribing": "Trascrizione...",
|
||||
"processing": "Elaborazione..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Handyインターフェースの言語を変更"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "文字起こし中..."
|
||||
"transcribing": "文字起こし中...",
|
||||
"processing": "処理中..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Handy 인터페이스의 언어를 변경하세요"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "텍스트로 변환 중..."
|
||||
"transcribing": "텍스트로 변환 중...",
|
||||
"processing": "처리 중..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Zmień język interfejsu Handy"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Transkrypcja..."
|
||||
"transcribing": "Transkrypcja...",
|
||||
"processing": "Przetwarzanie..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Alterar o idioma da interface do Handy"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Transcrevendo..."
|
||||
"transcribing": "Transcrevendo...",
|
||||
"processing": "Processando..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Изменить языка интерфейса Handy"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Расшифровка..."
|
||||
"transcribing": "Расшифровка...",
|
||||
"processing": "Обработка..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Handy arayüzünün dilini değiştirin"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Transkribe ediliyor..."
|
||||
"transcribing": "Transkribe ediliyor...",
|
||||
"processing": "İşleniyor..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Змінити мову інтерфейсу Handy"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Обробка..."
|
||||
"transcribing": "Обробка...",
|
||||
"processing": "Постобробка..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "Thay đổi ngôn ngữ giao diện của Handy"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "Đang chuyển đổi..."
|
||||
"transcribing": "Đang chuyển đổi...",
|
||||
"processing": "Đang xử lý..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -497,6 +497,7 @@
|
|||
"description": "更改 Handy 界面的语言"
|
||||
},
|
||||
"overlay": {
|
||||
"transcribing": "正在转录..."
|
||||
"transcribing": "正在转录...",
|
||||
"processing": "处理中..."
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { commands } from "@/bindings";
|
|||
import i18n, { syncLanguageFromSettings } from "@/i18n";
|
||||
import { getLanguageDirection } from "@/lib/utils/rtl";
|
||||
|
||||
type OverlayState = "recording" | "transcribing";
|
||||
type OverlayState = "recording" | "transcribing" | "processing";
|
||||
|
||||
const RecordingOverlay: React.FC = () => {
|
||||
const { t } = useTranslation();
|
||||
|
|
@ -96,6 +96,9 @@ const RecordingOverlay: React.FC = () => {
|
|||
{state === "transcribing" && (
|
||||
<div className="transcribing-text">{t("overlay.transcribing")}</div>
|
||||
)}
|
||||
{state === "processing" && (
|
||||
<div className="transcribing-text">{t("overlay.processing")}</div>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<div className="overlay-right">
|
||||
|
|
|
|||
Loading…
Reference in a new issue