[Update] Add save success notification.

This commit is contained in:
Sakamoto Shiina
2025-06-21 02:35:41 +09:00
parent 824be74b6e
commit 1623352c92
14 changed files with 440 additions and 144 deletions

View File

@@ -10,7 +10,7 @@ import { useNotificationStatus } from "@logics_common";
export const useAdvancedSettings = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { showNotification_Error } = useNotificationStatus();
const { showNotification_Error, showNotification_SaveSuccess } = useNotificationStatus();
// OSC IP Address
const { currentOscIpAddress, updateOscIpAddress, pendingOscIpAddress } = useStore_OscIpAddress();
@@ -32,6 +32,11 @@ export const useAdvancedSettings = () => {
asyncStdoutToPython("/set/data/osc_ip_address", osc_ip_address);
};
const setSuccessOscIpAddress = (osc_ip_address) => {
updateOscIpAddress(osc_ip_address);
showNotification_SaveSuccess();
};
// OSC Port
const getOscPort = () => {
pendingOscPort();
@@ -43,12 +48,17 @@ export const useAdvancedSettings = () => {
asyncStdoutToPython("/set/data/osc_port", osc_port);
};
const saveErrorOscPort = ({data, message, _result}) => {
const setSuccessOscPort = (osc_port) => {
updateOscPort(osc_port);
showNotification_SaveSuccess();
};
const saveErrorOscPort = ({ data, message, _result }) => {
updateOscPort(d => d.data);
showNotification_Error(_result);
};
// WebSocket
// WebSocket Enable
const getEnableWebsocket = () => {
pendingEnableWebsocket();
asyncStdoutToPython("/get/data/websocket_server");
@@ -63,7 +73,12 @@ export const useAdvancedSettings = () => {
}
};
const setSuccessEnableWebsocket = (is_enabled) => {
updateEnableWebsocket(is_enabled);
showNotification_SaveSuccess();
};
// WebSocket Host
const getWebsocketHost = () => {
pendingWebsocketHost();
asyncStdoutToPython("/get/data/websocket_host");
@@ -74,7 +89,12 @@ export const useAdvancedSettings = () => {
asyncStdoutToPython("/set/data/websocket_host", websocket_host);
};
const setSuccessWebsocketHost = (websocket_host) => {
updateWebsocketHost(websocket_host);
showNotification_SaveSuccess();
};
// WebSocket Port
const getWebsocketPort = () => {
pendingWebsocketPort();
asyncStdoutToPython("/get/data/websocket_port");
@@ -85,6 +105,10 @@ export const useAdvancedSettings = () => {
asyncStdoutToPython("/set/data/websocket_port", websocket_port);
};
const setSuccessWebsocketPort = (websocket_port) => {
updateWebsocketPort(websocket_port);
showNotification_SaveSuccess();
};
return {
// OSC IP Address
@@ -92,28 +116,35 @@ export const useAdvancedSettings = () => {
getOscIpAddress,
updateOscIpAddress,
setOscIpAddress,
setSuccessOscIpAddress,
// OSC Port
currentOscPort,
getOscPort,
updateOscPort,
setOscPort,
setSuccessOscPort,
saveErrorOscPort,
// WebSocket
// WebSocket Enable
currentEnableWebsocket,
updateEnableWebsocket,
getEnableWebsocket,
updateEnableWebsocket,
toggleEnableWebsocket,
setSuccessEnableWebsocket,
// WebSocket Host
currentWebsocketHost,
updateWebsocketHost,
getWebsocketHost,
updateWebsocketHost,
setWebsocketHost,
setSuccessWebsocketHost,
// WebSocket Port
currentWebsocketPort,
updateWebsocketPort,
getWebsocketPort,
updateWebsocketPort,
setWebsocketPort,
setSuccessWebsocketPort,
};
};

View File

@@ -8,9 +8,13 @@ import {
useStore_Transparency,
} from "@store";
import { useStdoutToPython } from "@useStdoutToPython";
import { useI18n } from "@useI18n";
import { useNotificationStatus } from "@logics_common";
export const useAppearance = () => {
const { t } = useI18n();
const { asyncStdoutToPython } = useStdoutToPython();
const { showNotification_SaveSuccess } = useNotificationStatus();
// UI Language
const { currentUiLanguage, updateUiLanguage, pendingUiLanguage } = useStore_UiLanguage();
@@ -39,6 +43,11 @@ export const useAppearance = () => {
asyncStdoutToPython("/set/data/ui_language", selected_ui_language);
};
const setSuccessUiLanguage = (selected_ui_language) => {
updateUiLanguage(selected_ui_language);
showNotification_SaveSuccess();
};
// UI Scaling
const getUiScaling = () => {
pendingUiScaling();
@@ -50,6 +59,11 @@ export const useAppearance = () => {
asyncStdoutToPython("/set/data/ui_scaling", selected_ui_scaling);
};
const setSuccessUiScaling = (selected_ui_scaling) => {
updateUiScaling(selected_ui_scaling);
showNotification_SaveSuccess();
};
// Message Log Ui Scaling
const getMessageLogUiScaling = () => {
pendingMessageLogUiScaling();
@@ -61,6 +75,11 @@ export const useAppearance = () => {
asyncStdoutToPython("/set/data/textbox_ui_scaling", selected_ui_scaling);
};
const setSuccessMessageLogUiScaling = (selected_ui_scaling) => {
updateMessageLogUiScaling(selected_ui_scaling);
showNotification_SaveSuccess();
};
// Send Message Button Type
const getSendMessageButtonType = () => {
pendingSendMessageButtonType();
@@ -72,6 +91,11 @@ export const useAppearance = () => {
asyncStdoutToPython("/set/data/send_message_button_type", send_message_button_type);
};
const setSuccessSendMessageButtonType = (send_message_button_type) => {
updateSendMessageButtonType(send_message_button_type);
showNotification_SaveSuccess();
};
// Show Resend Button
const getShowResendButton = () => {
pendingShowResendButton();
@@ -86,6 +110,10 @@ export const useAppearance = () => {
asyncStdoutToPython("/set/enable/show_resend_button");
}
};
const setSuccessShowResendButton = (to_show) => {
updateShowResendButton(to_show);
showNotification_SaveSuccess();
};
// Selected Font Family
const getSelectedFontFamily = () => {
@@ -98,6 +126,11 @@ export const useAppearance = () => {
asyncStdoutToPython("/set/data/font_family", selected_font_family);
};
const setSuccessSelectedFontFamily = (selected_font_family) => {
updateSelectedFontFamily(selected_font_family);
showNotification_SaveSuccess();
};
// Transparency
const getTransparency = () => {
pendingTransparency();
@@ -109,6 +142,11 @@ export const useAppearance = () => {
asyncStdoutToPython("/set/data/transparency", selected_transparency);
};
const setSuccessTransparency = (selected_transparency) => {
updateTransparency(selected_transparency);
showNotification_SaveSuccess();
};
return {
// UI Language
@@ -116,23 +154,27 @@ export const useAppearance = () => {
getUiLanguage,
updateUiLanguage,
setUiLanguage,
setSuccessUiLanguage,
// UI Scaling
currentUiScaling,
getUiScaling,
updateUiScaling,
setUiScaling,
setSuccessUiScaling,
// Message Log Ui Scaling
currentMessageLogUiScaling,
getMessageLogUiScaling,
updateMessageLogUiScaling,
setMessageLogUiScaling,
setSuccessMessageLogUiScaling,
// Send Message Button Type
currentSendMessageButtonType,
getSendMessageButtonType,
setSendMessageButtonType,
setSuccessSendMessageButtonType,
updateSendMessageButtonType,
// Show Resend Button
@@ -140,17 +182,20 @@ export const useAppearance = () => {
getShowResendButton,
updateShowResendButton,
toggleShowResendButton,
setSuccessShowResendButton,
// Selected Font Family
currentSelectedFontFamily,
getSelectedFontFamily,
updateSelectedFontFamily,
setSelectedFontFamily,
setSuccessSelectedFontFamily,
// Transparency
currentTransparency,
getTransparency,
updateTransparency,
setTransparency,
setSuccessTransparency,
};
};

View File

@@ -18,9 +18,11 @@ import {
} from "@store";
import { useStdoutToPython } from "@useStdoutToPython";
import { arrayToObject } from "@utils";
import { useNotificationStatus } from "@logics_common";
export const useDevice = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { showNotification_SaveSuccess } = useNotificationStatus();
const { currentEnableAutoMicSelect, updateEnableAutoMicSelect, pendingEnableAutoMicSelect } = useStore_EnableAutoMicSelect();
const { currentEnableAutoSpeakerSelect, updateEnableAutoSpeakerSelect, pendingEnableAutoSpeakerSelect } = useStore_EnableAutoSpeakerSelect();
@@ -34,11 +36,11 @@ export const useDevice = () => {
const { currentSelectedSpeakerDevice, updateSelectedSpeakerDevice, pendingSelectedSpeakerDevice } = useStore_SelectedSpeakerDevice();
const { updateMicThreshold, currentMicThreshold } = useStore_MicThreshold();
const { updateEnableAutomaticMicThreshold, currentEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold();
const { currentMicThreshold, updateMicThreshold } = useStore_MicThreshold();
const { currentEnableAutomaticMicThreshold, updateEnableAutomaticMicThreshold, pendingEnableAutomaticMicThreshold } = useStore_EnableAutomaticMicThreshold();
const { updateSpeakerThreshold, currentSpeakerThreshold } = useStore_SpeakerThreshold();
const { updateEnableAutomaticSpeakerThreshold, currentEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold();
const { currentSpeakerThreshold, updateSpeakerThreshold } = useStore_SpeakerThreshold();
const { currentEnableAutomaticSpeakerThreshold, updateEnableAutomaticSpeakerThreshold, pendingEnableAutomaticSpeakerThreshold } = useStore_EnableAutomaticSpeakerThreshold();
// Auto Select (Mic)
const getEnableAutoMicSelect = () => {
@@ -54,6 +56,12 @@ export const useDevice = () => {
asyncStdoutToPython("/set/enable/auto_mic_select");
}
};
const setSuccessEnableAutoMicSelect = (enabled) => {
updateEnableAutoMicSelect(enabled);
showNotification_SaveSuccess();
};
// Auto Select (Speaker)
const getEnableAutoSpeakerSelect = () => {
pendingEnableAutoSpeakerSelect();
@@ -69,6 +77,10 @@ export const useDevice = () => {
}
};
const setSuccessEnableAutoSpeakerSelect = (enabled) => {
updateEnableAutoSpeakerSelect(enabled);
showNotification_SaveSuccess();
};
// List (Mic device)
const getMicDeviceList = () => {
@@ -79,6 +91,7 @@ export const useDevice = () => {
const updateMicDeviceList_FromBackend = (payload) => {
updateMicDeviceList(arrayToObject(payload));
};
// List (Mic host)
const getMicHostList = () => {
pendingMicHostList();
@@ -88,6 +101,7 @@ export const useDevice = () => {
const updateMicHostList_FromBackend = (payload) => {
updateMicHostList(arrayToObject(payload));
};
// List (Speaker device)
const getSpeakerDeviceList = () => {
pendingSpeakerDeviceList();
@@ -98,7 +112,6 @@ export const useDevice = () => {
updateSpeakerDeviceList(arrayToObject(payload));
};
// Selected (Mic host)
const getSelectedMicHost = () => {
pendingSelectedMicHost();
@@ -109,6 +122,12 @@ export const useDevice = () => {
pendingSelectedMicHost();
asyncStdoutToPython("/set/data/selected_mic_host", selected_mic_host);
};
const setSuccessSelectedMicHost = (payload) => {
updateSelectedMicHostAndDevice(payload); // Receive host and device from backend.
showNotification_SaveSuccess();
};
// Selected (Mic device)
const getSelectedMicDevice = () => {
pendingSelectedMicDevice();
@@ -120,11 +139,16 @@ export const useDevice = () => {
asyncStdoutToPython("/set/data/selected_mic_device", selected_mic_device);
};
// Selected (Mic and Host)
const setSuccessSelectedMicDevice = (selected_mic_device) => {
updateSelectedMicDevice(selected_mic_device);
showNotification_SaveSuccess();
};
// Selected (Mic Device and Host)
const updateSelectedMicHostAndDevice = (payload) => {
updateSelectedMicHost(payload.host);
updateSelectedMicDevice(payload.device);
};
}
// Selected (Speaker device)
const getSelectedSpeakerDevice = () => {
@@ -137,6 +161,10 @@ export const useDevice = () => {
asyncStdoutToPython("/set/data/selected_speaker_device", selected_speaker_device);
};
const setSuccessSelectedSpeakerDevice = (selected_speaker_device) => {
updateSelectedSpeakerDevice(selected_speaker_device);
showNotification_SaveSuccess();
};
// Threshold (Mic)
const getMicThreshold = () => {
@@ -147,6 +175,11 @@ export const useDevice = () => {
asyncStdoutToPython("/set/data/mic_threshold", mic_threshold);
};
const setSuccessMicThreshold = (mic_threshold) => {
updateMicThreshold(mic_threshold);
showNotification_SaveSuccess();
};
const getEnableAutomaticMicThreshold = () => {
pendingEnableAutomaticMicThreshold();
asyncStdoutToPython("/get/data/mic_automatic_threshold");
@@ -160,6 +193,12 @@ export const useDevice = () => {
asyncStdoutToPython("/set/enable/mic_automatic_threshold");
}
};
const setSuccessEnableAutomaticMicThreshold = (enabled) => {
updateEnableAutomaticMicThreshold(enabled);
showNotification_SaveSuccess();
};
// Threshold (Speaker)
const getSpeakerThreshold = () => {
asyncStdoutToPython("/get/data/speaker_threshold");
@@ -169,6 +208,11 @@ export const useDevice = () => {
asyncStdoutToPython("/set/data/speaker_threshold", speaker_threshold);
};
const setSuccessSpeakerThreshold = (speaker_threshold) => {
updateSpeakerThreshold(speaker_threshold);
showNotification_SaveSuccess();
};
const getEnableAutomaticSpeakerThreshold = () => {
pendingEnableAutomaticSpeakerThreshold();
asyncStdoutToPython("/get/data/speaker_automatic_threshold");
@@ -183,19 +227,23 @@ export const useDevice = () => {
}
};
const setSuccessEnableAutomaticSpeakerThreshold = (enabled) => {
updateEnableAutomaticSpeakerThreshold(enabled);
showNotification_SaveSuccess();
};
return {
currentEnableAutoMicSelect,
getEnableAutoMicSelect,
updateEnableAutoMicSelect,
toggleEnableAutoMicSelect,
setSuccessEnableAutoMicSelect,
currentEnableAutoSpeakerSelect,
getEnableAutoSpeakerSelect,
updateEnableAutoSpeakerSelect,
toggleEnableAutoSpeakerSelect,
setSuccessEnableAutoSpeakerSelect,
currentMicDeviceList,
getMicDeviceList,
@@ -212,46 +260,47 @@ export const useDevice = () => {
updateSpeakerDeviceList,
updateSpeakerDeviceList_FromBackend,
currentSelectedMicHost,
getSelectedMicHost,
updateSelectedMicHost,
setSelectedMicHost,
setSuccessSelectedMicHost,
currentSelectedMicDevice,
getSelectedMicDevice,
updateSelectedMicDevice,
setSelectedMicDevice,
setSuccessSelectedMicDevice,
updateSelectedMicHostAndDevice,
currentSelectedSpeakerDevice,
getSelectedSpeakerDevice,
updateSelectedSpeakerDevice,
setSelectedSpeakerDevice,
setSuccessSelectedSpeakerDevice,
currentMicThreshold,
getMicThreshold,
setMicThreshold,
updateMicThreshold,
setSuccessMicThreshold,
currentEnableAutomaticMicThreshold,
getEnableAutomaticMicThreshold,
toggleEnableAutomaticMicThreshold,
updateEnableAutomaticMicThreshold,
setSuccessEnableAutomaticMicThreshold,
currentSpeakerThreshold,
getSpeakerThreshold,
setSpeakerThreshold,
updateSpeakerThreshold,
setSuccessSpeakerThreshold,
currentEnableAutomaticSpeakerThreshold,
getEnableAutomaticSpeakerThreshold,
toggleEnableAutomaticSpeakerThreshold,
updateEnableAutomaticSpeakerThreshold,
setSuccessEnableAutomaticSpeakerThreshold,
};
};

View File

@@ -20,7 +20,7 @@ export const useHotkeys = () => {
pendingHotkeys();
asyncStdoutToPython("/get/data/hotkeys");
};
const { showNotification_Success, showNotification_Error, closeNotification } = useNotificationStatus();
const { showNotification_SaveSuccess, showNotification_Error, closeNotification } = useNotificationStatus();
const setHotkeys = (hotkeys) => {
pendingHotkeys();
@@ -106,11 +106,17 @@ export const useHotkeys = () => {
}
};
const setSuccessHotkeys = (hotkeys) => {
updateHotkeys(hotkeys);
showNotification_SaveSuccess();
};
return {
currentHotkeys,
getHotkeys,
updateHotkeys,
setHotkeys,
setSuccessHotkeys,
registerShortcuts,
unregisterAll,
};

View File

@@ -8,6 +8,7 @@ import {
useStore_EnableSendReceivedMessageToVrc,
} from "@store";
import { useStdoutToPython } from "@useStdoutToPython";
import { useNotificationStatus } from "@logics_common";
export const useOthers = () => {
const { asyncStdoutToPython } = useStdoutToPython();
@@ -29,6 +30,7 @@ export const useOthers = () => {
// Send Received Message To VRC
const { currentEnableSendReceivedMessageToVrc, updateEnableSendReceivedMessageToVrc, pendingEnableSendReceivedMessageToVrc } = useStore_EnableSendReceivedMessageToVrc();
const { showNotification_SaveSuccess } = useNotificationStatus();
// Auto Clear Message Input Box
const getEnableAutoClearMessageInputBox = () => {
@@ -45,6 +47,11 @@ export const useOthers = () => {
}
};
const setSuccessEnableAutoClearMessageInputBox = (enabled) => {
updateEnableAutoClearMessageInputBox(enabled);
showNotification_SaveSuccess();
};
// Send Only Translated Messages
const getEnableSendOnlyTranslatedMessages = () => {
pendingEnableSendOnlyTranslatedMessages();
@@ -60,6 +67,11 @@ export const useOthers = () => {
}
};
const setSuccessEnableSendOnlyTranslatedMessages = (enabled) => {
updateEnableSendOnlyTranslatedMessages(enabled);
showNotification_SaveSuccess();
};
// Auto Export Message Logs
const getEnableAutoExportMessageLogs = () => {
pendingEnableAutoExportMessageLogs();
@@ -75,6 +87,11 @@ export const useOthers = () => {
}
};
const setSuccessEnableAutoExportMessageLogs = (enabled) => {
updateEnableAutoExportMessageLogs(enabled);
showNotification_SaveSuccess();
};
// VRC Mic Mute Sync
const getEnableVrcMicMuteSync = () => {
pendingEnableVrcMicMuteSync();
@@ -90,10 +107,9 @@ export const useOthers = () => {
}
};
const updateEnableVrcMicMuteSync_FromBackend = (payload) => {
updateEnableVrcMicMuteSync((old_value) => {
return {...old_value.data, is_enabled: payload};
});
const setSuccessEnableVrcMicMuteSync = (is_enabled) => {
updateEnableVrcMicMuteSync(old => ({ ...old.data, is_enabled: is_enabled }));
showNotification_SaveSuccess();
};
// Send Message To VRCT
@@ -111,6 +127,11 @@ export const useOthers = () => {
}
};
const setSuccessEnableSendMessageToVrc = (enabled) => {
updateEnableSendMessageToVrc(enabled);
showNotification_SaveSuccess();
};
// Sounds
// Notification VRC SFX
const getEnableNotificationVrcSfx = () => {
@@ -127,6 +148,11 @@ export const useOthers = () => {
}
};
const setSuccessEnableNotificationVrcSfx = (enabled) => {
updateEnableNotificationVrcSfx(enabled);
showNotification_SaveSuccess();
};
// Speaker2Chatbox
// Send Received Message To VRC
const getEnableSendReceivedMessageToVrc = () => {
@@ -143,37 +169,46 @@ export const useOthers = () => {
}
};
const setSuccessEnableSendReceivedMessageToVrc = (enabled) => {
updateEnableSendReceivedMessageToVrc(enabled);
showNotification_SaveSuccess();
};
return {
// Auto Clear Message Input Box
currentEnableAutoClearMessageInputBox,
getEnableAutoClearMessageInputBox,
toggleEnableAutoClearMessageInputBox,
updateEnableAutoClearMessageInputBox,
setSuccessEnableAutoClearMessageInputBox,
// Send Only Translated Messages
currentEnableSendOnlyTranslatedMessages,
getEnableSendOnlyTranslatedMessages,
toggleEnableSendOnlyTranslatedMessages,
updateEnableSendOnlyTranslatedMessages,
setSuccessEnableSendOnlyTranslatedMessages,
// Auto Export Message Logs
currentEnableAutoExportMessageLogs,
getEnableAutoExportMessageLogs,
toggleEnableAutoExportMessageLogs,
updateEnableAutoExportMessageLogs,
setSuccessEnableAutoExportMessageLogs,
// VRC Mic Mute Sync
currentEnableVrcMicMuteSync,
getEnableVrcMicMuteSync,
toggleEnableVrcMicMuteSync,
updateEnableVrcMicMuteSync,
updateEnableVrcMicMuteSync_FromBackend,
setSuccessEnableVrcMicMuteSync,
// Send Message To VRCT
currentEnableSendMessageToVrc,
getEnableSendMessageToVrc,
toggleEnableSendMessageToVrc,
updateEnableSendMessageToVrc,
setSuccessEnableSendMessageToVrc,
// Sounds
// Notification VRC SFX
@@ -181,6 +216,7 @@ export const useOthers = () => {
getEnableNotificationVrcSfx,
toggleEnableNotificationVrcSfx,
updateEnableNotificationVrcSfx,
setSuccessEnableNotificationVrcSfx,
// Speaker2Chatbox
// Send Received Message To VRC
@@ -188,5 +224,6 @@ export const useOthers = () => {
getEnableSendReceivedMessageToVrc,
toggleEnableSendReceivedMessageToVrc,
updateEnableSendReceivedMessageToVrc,
setSuccessEnableSendReceivedMessageToVrc,
};
};

View File

@@ -37,7 +37,7 @@ const PLUGIN_LIST_URL = getPluginsList();
export const usePlugins = () => {
const { t, i18n } = useI18n();
const { showNotification_Success, showNotification_Error } = useNotificationStatus();
const { showNotification_SaveSuccess, showNotification_Success, showNotification_Error } = useNotificationStatus();
const { asyncStdoutToPython } = useStdoutToPython();
const { currentFetchedPluginsInfo, updateFetchedPluginsInfo, pendingFetchedPluginsInfo, errorFetchedPluginsInfo } = useStore_FetchedPluginsInfo();
@@ -371,6 +371,10 @@ export const usePlugins = () => {
});
}
const setSuccessSavedPluginsStatus = (plugins_status) => {
updateSavedPluginsStatus(plugins_status);
showNotification_SaveSuccess();
};
return {
@@ -385,6 +389,7 @@ export const usePlugins = () => {
currentSavedPluginsStatus,
updateSavedPluginsStatus,
setSuccessSavedPluginsStatus,
currentPluginsData,
updatePluginsData,

View File

@@ -17,9 +17,11 @@ import {
} from "@store";
import { useStdoutToPython } from "@useStdoutToPython";
import { transformToIndexedArray } from "@utils";
import { useNotificationStatus } from "@logics_common";
export const useTranscription = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { showNotification_SaveSuccess } = useNotificationStatus();
// Mic
const { currentMicRecordTimeout, updateMicRecordTimeout, pendingMicRecordTimeout } = useStore_MicRecordTimeout();
@@ -39,7 +41,6 @@ export const useTranscription = () => {
const { currentSelectableWhisperComputeDeviceList, updateSelectableWhisperComputeDeviceList, pendingSelectableWhisperComputeDeviceList } = useStore_SelectableWhisperComputeDeviceList();
const { currentSelectedWhisperComputeDevice, updateSelectedWhisperComputeDevice, pendingSelectedWhisperComputeDevice } = useStore_SelectedWhisperComputeDevice();
// Mic
const getMicRecordTimeout = () => {
pendingMicRecordTimeout();
@@ -51,6 +52,10 @@ export const useTranscription = () => {
asyncStdoutToPython("/set/data/mic_record_timeout", selected_mic_record_timeout);
};
const setSuccessMicRecordTimeout = (value) => {
updateMicRecordTimeout(value);
showNotification_SaveSuccess();
};
const getMicPhraseTimeout = () => {
pendingMicPhraseTimeout();
@@ -62,6 +67,10 @@ export const useTranscription = () => {
asyncStdoutToPython("/set/data/mic_phrase_timeout", selected_mic_phrase_timeout);
};
const setSuccessMicPhraseTimeout = (value) => {
updateMicPhraseTimeout(value);
showNotification_SaveSuccess();
};
const getMicMaxWords = () => {
pendingMicMaxWords();
@@ -73,6 +82,11 @@ export const useTranscription = () => {
asyncStdoutToPython("/set/data/mic_max_phrases", selected_mic_max_phrases);
};
const setSuccessMicMaxWords = (value) => {
updateMicMaxWords(value);
showNotification_SaveSuccess();
};
const getMicWordFilterList = () => {
pendingMicWordFilterList();
asyncStdoutToPython("/get/data/mic_word_filter");
@@ -83,7 +97,7 @@ export const useTranscription = () => {
asyncStdoutToPython("/set/data/mic_word_filter", selected_mic_word_filter);
};
const updateMicWordFilterList_FromBackend = (payload) => {
const setSuccessMicWordFilterList = (payload) => {
updateMicWordFilterList((prev_list) => {
const updated_list = [...prev_list.data];
for (const value of payload) {
@@ -96,6 +110,7 @@ export const useTranscription = () => {
}
return updated_list;
});
showNotification_SaveSuccess();
};
// Speaker
@@ -109,6 +124,10 @@ export const useTranscription = () => {
asyncStdoutToPython("/set/data/speaker_record_timeout", selected_speaker_record_timeout);
};
const setSuccessSpeakerRecordTimeout = (value) => {
updateSpeakerRecordTimeout(value);
showNotification_SaveSuccess();
};
const getSpeakerPhraseTimeout = () => {
pendingSpeakerPhraseTimeout();
@@ -120,6 +139,10 @@ export const useTranscription = () => {
asyncStdoutToPython("/set/data/speaker_phrase_timeout", selected_speaker_phrase_timeout);
};
const setSuccessSpeakerPhraseTimeout = (value) => {
updateSpeakerPhraseTimeout(value);
showNotification_SaveSuccess();
};
const getSpeakerMaxWords = () => {
pendingSpeakerMaxWords();
@@ -131,6 +154,10 @@ export const useTranscription = () => {
asyncStdoutToPython("/set/data/speaker_max_phrases", selected_speaker_max_phrases);
};
const setSuccessSpeakerMaxWords = (value) => {
updateSpeakerMaxWords(value);
showNotification_SaveSuccess();
};
// Transcription Engines
// Transcription Engines (Google / Whisper)
@@ -144,6 +171,10 @@ export const useTranscription = () => {
asyncStdoutToPython("/set/data/selected_transcription_engine", selected_transcription_engine);
};
const setSuccessSelectedTranscriptionEngine = (engine) => {
updateSelectedTranscriptionEngine(engine);
showNotification_SaveSuccess();
};
// Transcription Engines (Weight Type List)
const updateDownloadedWhisperWeightTypeStatus = (downloaded_weight_type_status) => {
@@ -199,6 +230,10 @@ export const useTranscription = () => {
asyncStdoutToPython("/set/data/whisper_weight_type", selected_whisper_weight_type);
};
const setSuccessSelectedWhisperWeightType = (wt) => {
updateSelectedWhisperWeightType(wt);
showNotification_SaveSuccess();
};
// Transcription Engines (Compute Device List)
const getSelectableWhisperComputeDeviceList = () => {
@@ -221,50 +256,62 @@ export const useTranscription = () => {
asyncStdoutToPython("/set/data/selected_transcription_compute_device", selected_transcription_compute_device);
};
const setSuccessSelectedWhisperComputeDevice = (dev) => {
updateSelectedWhisperComputeDevice(dev);
showNotification_SaveSuccess();
};
return {
// Mic
currentMicRecordTimeout,
getMicRecordTimeout,
updateMicRecordTimeout,
setMicRecordTimeout,
setSuccessMicRecordTimeout,
currentMicPhraseTimeout,
getMicPhraseTimeout,
updateMicPhraseTimeout,
setMicPhraseTimeout,
setSuccessMicPhraseTimeout,
currentMicMaxWords,
getMicMaxWords,
updateMicMaxWords,
setMicMaxWords,
setSuccessMicMaxWords,
currentMicWordFilterList,
getMicWordFilterList,
updateMicWordFilterList,
setMicWordFilterList,
updateMicWordFilterList_FromBackend,
setSuccessMicWordFilterList,
// Speaker
currentSpeakerRecordTimeout,
getSpeakerRecordTimeout,
updateSpeakerRecordTimeout,
setSpeakerRecordTimeout,
setSuccessSpeakerRecordTimeout,
currentSpeakerPhraseTimeout,
getSpeakerPhraseTimeout,
updateSpeakerPhraseTimeout,
setSpeakerPhraseTimeout,
setSuccessSpeakerPhraseTimeout,
currentSpeakerMaxWords,
getSpeakerMaxWords,
updateSpeakerMaxWords,
setSpeakerMaxWords,
setSuccessSpeakerMaxWords,
// Transcription Engines
currentSelectedTranscriptionEngine,
getSelectedTranscriptionEngine,
updateSelectedTranscriptionEngine,
setSelectedTranscriptionEngine,
setSuccessSelectedTranscriptionEngine,
currentWhisperWeightTypeStatus,
updateWhisperWeightTypeStatus,
@@ -278,6 +325,7 @@ export const useTranscription = () => {
getSelectedWhisperWeightType,
updateSelectedWhisperWeightType,
setSelectedWhisperWeightType,
setSuccessSelectedWhisperWeightType,
currentSelectableWhisperComputeDeviceList,
getSelectableWhisperComputeDeviceList,
@@ -288,5 +336,6 @@ export const useTranscription = () => {
getSelectedWhisperComputeDevice,
updateSelectedWhisperComputeDevice,
setSelectedWhisperComputeDevice,
setSuccessSelectedWhisperComputeDevice,
};
};

View File

@@ -13,7 +13,7 @@ import { useNotificationStatus } from "@logics_common";
export const useTranslation = () => {
const { t } = useI18n();
const { asyncStdoutToPython } = useStdoutToPython();
const { showNotification_Success, showNotification_Error } = useNotificationStatus();
const { showNotification_SaveSuccess } = useNotificationStatus();
const { currentCTranslate2WeightTypeStatus, updateCTranslate2WeightTypeStatus, pendingCTranslate2WeightTypeStatus } = useStore_CTranslate2WeightTypeStatus();
const { currentSelectedCTranslate2WeightType, updateSelectedCTranslate2WeightType, pendingSelectedCTranslate2WeightType } = useStore_SelectedCTranslate2WeightType();
@@ -74,6 +74,11 @@ export const useTranslation = () => {
asyncStdoutToPython("/set/data/ctranslate2_weight_type", selected_ctranslate2_weight_type);
};
const setSuccessSelectedCTranslate2WeightType = (selected_ctranslate2_weight_type) => {
updateSelectedCTranslate2WeightType(selected_ctranslate2_weight_type);
showNotification_SaveSuccess();
};
const getSelectableCTranslate2ComputeDeviceList = () => {
pendingSelectableCTranslate2ComputeDeviceList();
@@ -95,6 +100,11 @@ export const useTranslation = () => {
asyncStdoutToPython("/set/data/selected_translation_compute_device", selected_translation_compute_device);
};
const setSuccessSelectedCTranslate2ComputeDevice = (selected_translation_compute_device) => {
updateSelectedCTranslate2ComputeDevice(selected_translation_compute_device);
showNotification_SaveSuccess();
};
const getDeepLAuthKey = () => {
pendingDeepLAuthKey();
@@ -106,17 +116,18 @@ export const useTranslation = () => {
asyncStdoutToPython("/set/data/deepl_auth_key", selected_deepl_auth_key);
};
const setSuccessDeepLAuthKey = (data) => {
updateDeepLAuthKey(data);
showNotification_SaveSuccess(t("config_page.translation.deepl_auth_key.auth_key_success"), { category_id: "deepl_auth_key" });
};
const deleteDeepLAuthKey = () => {
pendingDeepLAuthKey();
asyncStdoutToPython("/delete/data/deepl_auth_key");
};
const deletedDeepLAuthKey = () => {
updateDeepLAuthKey("");
};
const savedDeepLAuthKey = (data) => {
updateDeepLAuthKey(data);
showNotification_Success(t("config_page.translation.deepl_auth_key.auth_key_success"));
const deleteSuccessDeepLAuthKey = () => {
updateDeepLAuthKey("");
};
@@ -133,6 +144,7 @@ export const useTranslation = () => {
getSelectedCTranslate2WeightType,
updateSelectedCTranslate2WeightType,
setSelectedCTranslate2WeightType,
setSuccessSelectedCTranslate2WeightType,
currentSelectableCTranslate2ComputeDeviceList,
getSelectableCTranslate2ComputeDeviceList,
@@ -143,13 +155,14 @@ export const useTranslation = () => {
getSelectedCTranslate2ComputeDevice,
updateSelectedCTranslate2ComputeDevice,
setSelectedCTranslate2ComputeDevice,
setSuccessSelectedCTranslate2ComputeDevice,
currentDeepLAuthKey,
getDeepLAuthKey,
updateDeepLAuthKey,
setDeepLAuthKey,
deleteDeepLAuthKey,
deletedDeepLAuthKey,
savedDeepLAuthKey,
deleteSuccessDeepLAuthKey,
setSuccessDeepLAuthKey,
};
};

View File

@@ -6,9 +6,11 @@ import {
useStore_OverlayShowOnlyTranslatedMessages,
} from "@store";
import { useStdoutToPython } from "@useStdoutToPython";
import { useNotificationStatus } from "@logics_common";
export const useVr = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { showNotification_SaveSuccess } = useNotificationStatus();
const { currentIsEnabledOverlaySmallLog, updateIsEnabledOverlaySmallLog, pendingIsEnabledOverlaySmallLog } = useStore_IsEnabledOverlaySmallLog();
const { currentIsEnabledOverlayLargeLog, updateIsEnabledOverlayLargeLog, pendingIsEnabledOverlayLargeLog } = useStore_IsEnabledOverlayLargeLog();
@@ -16,7 +18,6 @@ export const useVr = () => {
const { currentOverlayLargeLogSettings, updateOverlayLargeLogSettings, pendingOverlayLargeLogSettings } = useStore_OverlayLargeLogSettings();
const { currentOverlayShowOnlyTranslatedMessages, updateOverlayShowOnlyTranslatedMessages, pendingOverlayShowOnlyTranslatedMessages } = useStore_OverlayShowOnlyTranslatedMessages();
const getIsEnabledOverlaySmallLog = () => {
pendingIsEnabledOverlaySmallLog();
asyncStdoutToPython("/get/data/overlay_small_log");
@@ -31,6 +32,10 @@ export const useVr = () => {
}
};
const setSuccessIsEnabledOverlaySmallLog = (enabled) => {
updateIsEnabledOverlaySmallLog(enabled);
showNotification_SaveSuccess();
};
const getIsEnabledOverlayLargeLog = () => {
pendingIsEnabledOverlayLargeLog();
@@ -46,6 +51,10 @@ export const useVr = () => {
}
};
const setSuccessIsEnabledOverlayLargeLog = (enabled) => {
updateIsEnabledOverlayLargeLog(enabled);
showNotification_SaveSuccess();
};
const getOverlaySmallLogSettings = () => {
// pendingOverlaySmallLogSettings();
@@ -57,6 +66,10 @@ export const useVr = () => {
asyncStdoutToPython("/set/data/overlay_small_log_settings", overlay_small_log_settings);
};
const setSuccessOverlaySmallLogSettings = (settings) => {
updateOverlaySmallLogSettings(settings);
showNotification_SaveSuccess();
};
const getOverlayLargeLogSettings = () => {
// pendingOverlayLargeLogSettings();
@@ -68,6 +81,10 @@ export const useVr = () => {
asyncStdoutToPython("/set/data/overlay_large_log_settings", overlay_large_log_settings);
};
const setSuccessOverlayLargeLogSettings = (settings) => {
updateOverlayLargeLogSettings(settings);
showNotification_SaveSuccess();
};
const getOverlayShowOnlyTranslatedMessages = () => {
pendingOverlayShowOnlyTranslatedMessages();
@@ -83,37 +100,45 @@ export const useVr = () => {
}
};
const setSuccessOverlayShowOnlyTranslatedMessages = (enabled) => {
updateOverlayShowOnlyTranslatedMessages(enabled);
showNotification_SaveSuccess();
};
const sendTextToOverlay = (text) => {
asyncStdoutToPython("/run/send_text_overlay", text);
};
return {
currentIsEnabledOverlaySmallLog,
getIsEnabledOverlaySmallLog,
updateIsEnabledOverlaySmallLog,
toggleIsEnabledOverlaySmallLog,
updateIsEnabledOverlaySmallLog,
setSuccessIsEnabledOverlaySmallLog,
currentIsEnabledOverlayLargeLog,
getIsEnabledOverlayLargeLog,
updateIsEnabledOverlayLargeLog,
toggleIsEnabledOverlayLargeLog,
updateIsEnabledOverlayLargeLog,
setSuccessIsEnabledOverlayLargeLog,
currentOverlaySmallLogSettings,
getOverlaySmallLogSettings,
updateOverlaySmallLogSettings,
setOverlaySmallLogSettings,
setSuccessOverlaySmallLogSettings,
currentOverlayLargeLogSettings,
getOverlayLargeLogSettings,
updateOverlayLargeLogSettings,
setOverlayLargeLogSettings,
setSuccessOverlayLargeLogSettings,
currentOverlayShowOnlyTranslatedMessages,
getOverlayShowOnlyTranslatedMessages,
updateOverlayShowOnlyTranslatedMessages,
toggleOverlayShowOnlyTranslatedMessages,
updateOverlayShowOnlyTranslatedMessages,
setSuccessOverlayShowOnlyTranslatedMessages,
sendTextToOverlay,
};