[Update] UIで使うデータ(min,maxなど)を浅い階層で設定するように。

初期データとして送られてきていたrangeなど、必要のないエンドポイントをコメントアウト。
This commit is contained in:
Sakamoto Shiina
2024-11-06 00:23:43 +09:00
parent 9beba4905b
commit 1acb0a9565
4 changed files with 38 additions and 29 deletions

View File

@@ -98,7 +98,7 @@ mapping = {
# Appearance
"/get/data/version": {"status": True, "variable":controller.getVersion},
"/get/data/transparency_range": {"status": True, "variable":controller.getTransparencyRange},
# "/get/data/transparency_range": {"status": True, "variable":controller.getTransparencyRange},
"/get/data/transparency": {"status": True, "variable":controller.getTransparency},
"/set/data/transparency": {"status": True, "variable":controller.setTransparency},
@@ -106,15 +106,15 @@ mapping = {
# "/get/data/appearance_theme": {"status": True, "variable":controller.getAppearanceTheme},
# "/set/data/appearance_theme": {"status": True, "variable":controller.setAppearanceTheme},
"/get/data/ui_scaling_range": {"status": True, "variable":controller.getUiScalingRange},
# "/get/data/ui_scaling_range": {"status": True, "variable":controller.getUiScalingRange},
"/get/data/ui_scaling": {"status": True, "variable":controller.getUiScaling},
"/set/data/ui_scaling": {"status": True, "variable":controller.setUiScaling},
"/get/data/textbox_ui_scaling_range": {"status": True, "variable":controller.getTextboxUiScalingRange},
# "/get/data/textbox_ui_scaling_range": {"status": True, "variable":controller.getTextboxUiScalingRange},
"/get/data/textbox_ui_scaling": {"status": True, "variable":controller.getTextboxUiScaling},
"/set/data/textbox_ui_scaling": {"status": True, "variable":controller.setTextboxUiScaling},
"/get/data/message_box_ratio_range": {"status": True, "variable":controller.getMessageBoxRatioRange},
# "/get/data/message_box_ratio_range": {"status": True, "variable":controller.getMessageBoxRatioRange},
"/get/data/message_box_ratio": {"status": True, "variable":controller.getMessageBoxRatio},
"/set/data/message_box_ratio": {"status": True, "variable":controller.setMessageBoxRatio},
@@ -124,9 +124,9 @@ mapping = {
"/get/data/ui_language": {"status": True, "variable":controller.getUiLanguage},
"/set/data/ui_language": {"status": True, "variable":controller.setUiLanguage},
"/get/data/restore_main_window_geometry": {"status": True, "variable":controller.getRestoreMainWindowGeometry},
"/set/enable/restore_main_window_geometry": {"status": True, "variable":controller.setEnableRestoreMainWindowGeometry},
"/set/disable/restore_main_window_geometry": {"status": True, "variable":controller.setDisableRestoreMainWindowGeometry},
# "/get/data/restore_main_window_geometry": {"status": True, "variable":controller.getRestoreMainWindowGeometry},
# "/set/enable/restore_main_window_geometry": {"status": True, "variable":controller.setEnableRestoreMainWindowGeometry},
# "/set/disable/restore_main_window_geometry": {"status": True, "variable":controller.setDisableRestoreMainWindowGeometry},
"/get/data/main_window_geometry": {"status": True, "variable":controller.getMainWindowGeometry},
"/set/data/main_window_geometry": {"status": True, "variable":controller.setMainWindowGeometry},
@@ -160,8 +160,8 @@ mapping = {
"/get/data/mic_device_list": {"status": True, "variable":controller.getMicDeviceList},
"/get/data/speaker_device_list": {"status": True, "variable":controller.getSpeakerDeviceList},
"/get/data/max_mic_threshold": {"status": True, "variable":controller.getMaxMicThreshold},
"/get/data/max_speaker_threshold": {"status": True, "variable":controller.getMaxSpeakerThreshold},
# "/get/data/max_mic_threshold": {"status": True, "variable":controller.getMaxMicThreshold},
# "/get/data/max_speaker_threshold": {"status": True, "variable":controller.getMaxSpeakerThreshold},
"/get/data/auto_mic_select": {"status": True, "variable":controller.getAutoMicSelect},
"/set/enable/auto_mic_select": {"status": True, "variable":controller.setEnableAutoMicSelect},
@@ -277,17 +277,17 @@ mapping = {
"/set/enable/send_message_to_vrc": {"status": True, "variable":controller.setEnableSendMessageToVrc},
"/set/disable/send_message_to_vrc": {"status": True, "variable":controller.setDisableSendMessageToVrc},
"/get/data/send_message_format": {"status": True, "variable":controller.getSendMessageFormat},
"/set/data/send_message_format": {"status": True, "variable":controller.setSendMessageFormat},
# "/get/data/send_message_format": {"status": True, "variable":controller.getSendMessageFormat},
# "/set/data/send_message_format": {"status": True, "variable":controller.setSendMessageFormat},
"/get/data/send_message_format_with_t": {"status": True, "variable":controller.getSendMessageFormatWithT},
"/set/data/send_message_format_with_t": {"status": True, "variable":controller.setSendMessageFormatWithT},
# "/get/data/send_message_format_with_t": {"status": True, "variable":controller.getSendMessageFormatWithT},
# "/set/data/send_message_format_with_t": {"status": True, "variable":controller.setSendMessageFormatWithT},
"/get/data/received_message_format": {"status": True, "variable":controller.getReceivedMessageFormat},
"/set/data/received_message_format": {"status": True, "variable":controller.setReceivedMessageFormat},
# "/get/data/received_message_format": {"status": True, "variable":controller.getReceivedMessageFormat},
# "/set/data/received_message_format": {"status": True, "variable":controller.setReceivedMessageFormat},
"/get/data/received_message_format_with_t": {"status": True, "variable":controller.getReceivedMessageFormatWithT},
"/set/data/received_message_format_with_t": {"status": True, "variable":controller.setReceivedMessageFormatWithT},
# "/get/data/received_message_format_with_t": {"status": True, "variable":controller.getReceivedMessageFormatWithT},
# "/set/data/received_message_format_with_t": {"status": True, "variable":controller.setReceivedMessageFormatWithT},
"/get/data/send_received_message_to_vrc": {"status": True, "variable":controller.getSendReceivedMessageToVrc},
"/set/enable/send_received_message_to_vrc": {"status": True, "variable":controller.setEnableSendReceivedMessageToVrc},

View File

@@ -2,6 +2,7 @@ import clsx from "clsx";
import { useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
import styles from "./Appearance.module.scss";
import { ui_configs } from "@ui_configs";
import { useStore_SelectableFontFamilyList } from "@store";
import {
useUiLanguage,
@@ -38,12 +39,6 @@ export const Appearance = () => {
const UiLanguageContainer = () => {
const { t } = useTranslation();
const { currentUiLanguage, setUiLanguage } = useUiLanguage();
const SELECTABLE_UI_LANGUAGES_DICT = {
en: "English",
ja: "日本語",
ko: "한국어",
"zh-Hant": "繁體中文",
};
const is_not_en_lang = currentUiLanguage.data !== "en" && currentUiLanguage.data !== undefined;
return (
@@ -60,7 +55,7 @@ const UiLanguageContainer = () => {
</div>
<div className={styles.ui_language_selector_container}>
{currentUiLanguage.state === "pending" && <span className={styles.loader}></span>}
{Object.entries(SELECTABLE_UI_LANGUAGES_DICT).map(([key, value]) => (
{Object.entries(ui_configs.selectable_ui_languages).map(([key, value]) => (
<label key={key} className={clsx(styles.radio_button_wrapper, { [styles.is_selected]: currentUiLanguage.data === key } )}>
<input
className={styles.radio_button_input}

View File

@@ -1,5 +1,6 @@
import { useTranslation } from "react-i18next";
import styles from "./Device.module.scss";
import { ui_configs } from "@ui_configs";
import {
useEnableAutoMicSelect,
useMicHostList,
@@ -120,8 +121,8 @@ const Mic_Container = () => {
<div className={styles.threshold_section}>
<ThresholdComponent
id="mic_threshold"
min="0"
max="2000"
min={ui_configs.mic_threshold_min}
max={ui_configs.mic_threshold_max}
/>
</div>
</div>
@@ -197,8 +198,8 @@ const Speaker_Container = () => {
<div className={styles.threshold_section}>
<ThresholdComponent
id="speaker_threshold"
min="0"
max="4000"
min={ui_configs.speaker_threshold_min}
max={ui_configs.speaker_threshold_max}
/>
</div>
</div>

View File

@@ -5,4 +5,17 @@ export const translator_status = [
{ translator_id: "Bing", translator_name: "Bing", is_available: false },
{ translator_id: "Papago", translator_name: "Papago", is_available: false },
{ translator_id: "CTranslate2", translator_name: `Internal\n(Default)`, is_available: false },
];
];
export const ui_configs = {
mic_threshold_min: 0,
mic_threshold_max: 2000,
speaker_threshold_min: 0,
speaker_threshold_max: 4000,
selectable_ui_languages: {
en: "English",
ja: "日本語",
ko: "한국어",
"zh-Hant": "繁體中文",
}
};