add ui toggle back
This commit is contained in:
parent
c3aa2d7c1b
commit
21e96083df
6 changed files with 46 additions and 4 deletions
|
|
@ -185,7 +185,7 @@ impl TranscriptionManager {
|
|||
params.set_print_timestamps(false);
|
||||
params.set_suppress_blank(true);
|
||||
params.set_suppress_non_speech_tokens(true);
|
||||
|
||||
|
||||
// Enable translation to English if requested
|
||||
if settings.translate_to_english {
|
||||
params.set_translate(true);
|
||||
|
|
@ -207,7 +207,11 @@ impl TranscriptionManager {
|
|||
}
|
||||
|
||||
let et = std::time::Instant::now();
|
||||
let translation_note = if settings.translate_to_english { " (translated)" } else { "" };
|
||||
let translation_note = if settings.translate_to_english {
|
||||
" (translated)"
|
||||
} else {
|
||||
""
|
||||
};
|
||||
println!("\ntook {}ms{}", (et - st).as_millis(), translation_note);
|
||||
|
||||
Ok(result.trim().to_string())
|
||||
|
|
|
|||
|
|
@ -14,9 +14,9 @@
|
|||
{
|
||||
"title": "Handy",
|
||||
"width": 540,
|
||||
"height": 590,
|
||||
"height": 630,
|
||||
"minWidth": 540,
|
||||
"minHeight": 590,
|
||||
"minHeight": 630,
|
||||
"resizable": true,
|
||||
"maximizable": false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import { PushToTalk } from "./PushToTalk";
|
|||
import { AudioFeedback } from "./AudioFeedback";
|
||||
import { OutputDeviceSelector } from "./OutputDeviceSelector";
|
||||
import { HandyShortcut } from "./HandyShortcut";
|
||||
import { TranslateToEnglish } from "./TranslateToEnglish";
|
||||
import { SettingsGroup } from "../ui/SettingsGroup";
|
||||
|
||||
export const Settings: React.FC = () => {
|
||||
|
|
@ -19,6 +20,7 @@ export const Settings: React.FC = () => {
|
|||
<PushToTalk descriptionMode="tooltip" grouped={true} />
|
||||
<AudioFeedback descriptionMode="tooltip" grouped={true} />
|
||||
<OutputDeviceSelector descriptionMode="tooltip" grouped={true} />
|
||||
<TranslateToEnglish descriptionMode="tooltip" grouped={true} />
|
||||
<AlwaysOnMicrophone descriptionMode="tooltip" grouped={true} />
|
||||
</SettingsGroup>
|
||||
</div>
|
||||
|
|
|
|||
29
src/components/settings/TranslateToEnglish.tsx
Normal file
29
src/components/settings/TranslateToEnglish.tsx
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import React from "react";
|
||||
import { ToggleSwitch } from "../ui/ToggleSwitch";
|
||||
import { useSettings } from "../../hooks/useSettings";
|
||||
|
||||
interface TranslateToEnglishProps {
|
||||
descriptionMode?: "inline" | "tooltip";
|
||||
grouped?: boolean;
|
||||
}
|
||||
|
||||
export const TranslateToEnglish: React.FC<TranslateToEnglishProps> = ({
|
||||
descriptionMode = "tooltip",
|
||||
grouped = false,
|
||||
}) => {
|
||||
const { getSetting, updateSetting, isUpdating } = useSettings();
|
||||
|
||||
const translateToEnglish = getSetting("translate_to_english") || false;
|
||||
|
||||
return (
|
||||
<ToggleSwitch
|
||||
checked={translateToEnglish}
|
||||
onChange={(enabled) => updateSetting("translate_to_english", enabled)}
|
||||
isUpdating={isUpdating("translate_to_english")}
|
||||
label="Translate to English"
|
||||
description="Automatically translate speech from other languages to English during transcription."
|
||||
descriptionMode={descriptionMode}
|
||||
grouped={grouped}
|
||||
/>
|
||||
);
|
||||
};
|
||||
|
|
@ -5,3 +5,4 @@ export { AlwaysOnMicrophone } from "./AlwaysOnMicrophone";
|
|||
export { PushToTalk } from "./PushToTalk";
|
||||
export { AudioFeedback } from "./AudioFeedback";
|
||||
export { HandyShortcut } from "./HandyShortcut";
|
||||
export { TranslateToEnglish } from "./TranslateToEnglish";
|
||||
|
|
|
|||
|
|
@ -189,6 +189,11 @@ export const useSettings = (): UseSettingsReturn => {
|
|||
deviceName: outputDeviceName,
|
||||
});
|
||||
break;
|
||||
case "translate_to_english":
|
||||
await invoke("change_translate_to_english_setting", {
|
||||
enabled: value,
|
||||
});
|
||||
break;
|
||||
case "bindings":
|
||||
// Handle bindings separately - they use their own invoke methods
|
||||
break;
|
||||
|
|
@ -231,6 +236,7 @@ export const useSettings = (): UseSettingsReturn => {
|
|||
push_to_talk: false,
|
||||
selected_microphone: "Default",
|
||||
selected_output_device: "Default",
|
||||
translate_to_english: false,
|
||||
};
|
||||
|
||||
const defaultValue = defaults[key];
|
||||
|
|
|
|||
Loading…
Reference in a new issue