mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-11-15 04:46:10 -08:00
Drop 16 overlay preload methods with no caller (onSubtitleAss, getCurrentSubtitleAss, onVisibility, getOverlayVisibility, openYomitanSettings, quitApp, toggleOverlay, getMecabStatus, setMecabEnabled, getKeybindings, saveControllerPreference, getAnkiConnectStatus, setAnkiConnectEnabled, clearAnkiConnectHistory, cycleRuntimeOption, appendClipboardVideoToQueue) along with their IPC_CHANNELS keys, handlers, validators and dep plumbing. With both ASS consumers gone, stop observing sub-text/ass in mpv and remove the subtitle-ass-change event chain and appState.currentSubAssText. The main-process functions these wrapped stay; tray, CLI, shortcuts and session actions still use them.
37 lines
1.1 KiB
TypeScript
37 lines
1.1 KiB
TypeScript
import {
|
|
RuntimeOptionApplyResult,
|
|
RuntimeOptionId,
|
|
RuntimeOptionValue,
|
|
} from '../../types/runtime-options';
|
|
|
|
export interface RuntimeOptionsManagerLike {
|
|
setOptionValue: (id: RuntimeOptionId, value: RuntimeOptionValue) => RuntimeOptionApplyResult;
|
|
cycleOption: (id: RuntimeOptionId, direction: 1 | -1) => RuntimeOptionApplyResult;
|
|
}
|
|
|
|
export function applyRuntimeOptionResultRuntime(
|
|
result: RuntimeOptionApplyResult,
|
|
showMpvOsd: (text: string) => void,
|
|
): RuntimeOptionApplyResult {
|
|
if (result.ok && result.osdMessage) {
|
|
showMpvOsd(result.osdMessage);
|
|
}
|
|
return result;
|
|
}
|
|
|
|
export function setRuntimeOptionFromIpcRuntime(
|
|
manager: RuntimeOptionsManagerLike | null,
|
|
id: RuntimeOptionId,
|
|
value: RuntimeOptionValue,
|
|
showMpvOsd: (text: string) => void,
|
|
): RuntimeOptionApplyResult {
|
|
if (!manager) {
|
|
return { ok: false, error: 'Runtime options manager unavailable' };
|
|
}
|
|
const result = applyRuntimeOptionResultRuntime(manager.setOptionValue(id, value), showMpvOsd);
|
|
if (!result.ok && result.error) {
|
|
showMpvOsd(result.error);
|
|
}
|
|
return result;
|
|
}
|