[Update] Add Ui Scaling.

This commit is contained in:
Sakamoto Shiina
2024-09-27 07:48:29 +09:00
parent 4bd659103b
commit 14843066bb
10 changed files with 153 additions and 61 deletions

View File

@@ -0,0 +1,24 @@
import { useStore_UiScaling } from "@store";
import { useStdoutToPython } from "@logics/useStdoutToPython";
export const useUiScaling = () => {
const { asyncStdoutToPython } = useStdoutToPython();
const { currentUiScaling, updateUiScaling, pendingUiScaling } = useStore_UiScaling();
const getUiScaling = () => {
pendingUiScaling();
asyncStdoutToPython("/get/data/ui_scaling");
};
const setUiScaling = (selected_ui_scaling) => {
pendingUiScaling();
asyncStdoutToPython("/set/data/ui_scaling", selected_ui_scaling);
};
return {
currentUiScaling,
getUiScaling,
updateUiScaling,
setUiScaling,
};
};

View File

@@ -27,6 +27,7 @@ import { useEnableAutoClearMessageBox } from "@logics_configs/useEnableAutoClear
import { useSendMessageButtonType } from "@logics_configs/useSendMessageButtonType";
import { useUiLanguage } from "@logics_configs/useUiLanguage";
import { useUiScaling } from "@logics_configs/useUiScaling";
export const useReceiveRoutes = () => {
const { updateIsMainPageCompactMode } = useIsMainPageCompactMode();
@@ -63,6 +64,7 @@ export const useReceiveRoutes = () => {
const { updateEnableAutoClearMessageBox } = useEnableAutoClearMessageBox();
const { updateSendMessageButtonType } = useSendMessageButtonType();
const { updateUiLanguage } = useUiLanguage();
const { updateUiScaling } = useUiScaling();
const {
updateVolumeVariable_Mic,
updateVolumeVariable_Speaker,
@@ -198,6 +200,9 @@ export const useReceiveRoutes = () => {
"/get/data/ui_language": updateUiLanguage,
"/set/data/ui_language": updateUiLanguage,
"/get/data/ui_scaling": updateUiScaling,
"/set/data/ui_scaling": updateUiScaling,
// Others Tab
"/get/data/auto_clear_message_box": updateEnableAutoClearMessageBox,
"/set/enable/auto_clear_message_box": updateEnableAutoClearMessageBox,