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_print_timestamps(false);
|
||||||
params.set_suppress_blank(true);
|
params.set_suppress_blank(true);
|
||||||
params.set_suppress_non_speech_tokens(true);
|
params.set_suppress_non_speech_tokens(true);
|
||||||
|
|
||||||
// Enable translation to English if requested
|
// Enable translation to English if requested
|
||||||
if settings.translate_to_english {
|
if settings.translate_to_english {
|
||||||
params.set_translate(true);
|
params.set_translate(true);
|
||||||
|
|
@ -207,7 +207,11 @@ impl TranscriptionManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
let et = std::time::Instant::now();
|
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);
|
println!("\ntook {}ms{}", (et - st).as_millis(), translation_note);
|
||||||
|
|
||||||
Ok(result.trim().to_string())
|
Ok(result.trim().to_string())
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,9 @@
|
||||||
{
|
{
|
||||||
"title": "Handy",
|
"title": "Handy",
|
||||||
"width": 540,
|
"width": 540,
|
||||||
"height": 590,
|
"height": 630,
|
||||||
"minWidth": 540,
|
"minWidth": 540,
|
||||||
"minHeight": 590,
|
"minHeight": 630,
|
||||||
"resizable": true,
|
"resizable": true,
|
||||||
"maximizable": false
|
"maximizable": false
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,7 @@ import { PushToTalk } from "./PushToTalk";
|
||||||
import { AudioFeedback } from "./AudioFeedback";
|
import { AudioFeedback } from "./AudioFeedback";
|
||||||
import { OutputDeviceSelector } from "./OutputDeviceSelector";
|
import { OutputDeviceSelector } from "./OutputDeviceSelector";
|
||||||
import { HandyShortcut } from "./HandyShortcut";
|
import { HandyShortcut } from "./HandyShortcut";
|
||||||
|
import { TranslateToEnglish } from "./TranslateToEnglish";
|
||||||
import { SettingsGroup } from "../ui/SettingsGroup";
|
import { SettingsGroup } from "../ui/SettingsGroup";
|
||||||
|
|
||||||
export const Settings: React.FC = () => {
|
export const Settings: React.FC = () => {
|
||||||
|
|
@ -19,6 +20,7 @@ export const Settings: React.FC = () => {
|
||||||
<PushToTalk descriptionMode="tooltip" grouped={true} />
|
<PushToTalk descriptionMode="tooltip" grouped={true} />
|
||||||
<AudioFeedback descriptionMode="tooltip" grouped={true} />
|
<AudioFeedback descriptionMode="tooltip" grouped={true} />
|
||||||
<OutputDeviceSelector descriptionMode="tooltip" grouped={true} />
|
<OutputDeviceSelector descriptionMode="tooltip" grouped={true} />
|
||||||
|
<TranslateToEnglish descriptionMode="tooltip" grouped={true} />
|
||||||
<AlwaysOnMicrophone descriptionMode="tooltip" grouped={true} />
|
<AlwaysOnMicrophone descriptionMode="tooltip" grouped={true} />
|
||||||
</SettingsGroup>
|
</SettingsGroup>
|
||||||
</div>
|
</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 { PushToTalk } from "./PushToTalk";
|
||||||
export { AudioFeedback } from "./AudioFeedback";
|
export { AudioFeedback } from "./AudioFeedback";
|
||||||
export { HandyShortcut } from "./HandyShortcut";
|
export { HandyShortcut } from "./HandyShortcut";
|
||||||
|
export { TranslateToEnglish } from "./TranslateToEnglish";
|
||||||
|
|
|
||||||
|
|
@ -189,6 +189,11 @@ export const useSettings = (): UseSettingsReturn => {
|
||||||
deviceName: outputDeviceName,
|
deviceName: outputDeviceName,
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "translate_to_english":
|
||||||
|
await invoke("change_translate_to_english_setting", {
|
||||||
|
enabled: value,
|
||||||
|
});
|
||||||
|
break;
|
||||||
case "bindings":
|
case "bindings":
|
||||||
// Handle bindings separately - they use their own invoke methods
|
// Handle bindings separately - they use their own invoke methods
|
||||||
break;
|
break;
|
||||||
|
|
@ -231,6 +236,7 @@ export const useSettings = (): UseSettingsReturn => {
|
||||||
push_to_talk: false,
|
push_to_talk: false,
|
||||||
selected_microphone: "Default",
|
selected_microphone: "Default",
|
||||||
selected_output_device: "Default",
|
selected_output_device: "Default",
|
||||||
|
translate_to_english: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
const defaultValue = defaults[key];
|
const defaultValue = defaults[key];
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue