Merge branch 'develop'
This commit is contained in:
@@ -80,6 +80,7 @@ config_page:
|
|||||||
transcription: "Transcription"
|
transcription: "Transcription"
|
||||||
others: "Other"
|
others: "Other"
|
||||||
hotkeys: "Hotkeys"
|
hotkeys: "Hotkeys"
|
||||||
|
plugins: "Plugins"
|
||||||
advanced_settings: "Advanced Settings"
|
advanced_settings: "Advanced Settings"
|
||||||
|
|
||||||
device:
|
device:
|
||||||
@@ -235,17 +236,6 @@ config_page:
|
|||||||
toggle_transcription_receive:
|
toggle_transcription_receive:
|
||||||
label: "Toggle {{transcription_receive}}"
|
label: "Toggle {{transcription_receive}}"
|
||||||
|
|
||||||
advanced_settings:
|
|
||||||
osc_ip_address:
|
|
||||||
label: "OSC IP Address"
|
|
||||||
osc_port:
|
|
||||||
label: "OSC Port"
|
|
||||||
open_config_filepath:
|
|
||||||
label: "Open Config File"
|
|
||||||
switch_compute_device:
|
|
||||||
label: "Switch VRCT To CPU/GPU Version"
|
|
||||||
section_label_plugins: Plugins # Exception, It'll be moved later.
|
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
downloaded_version: "Downloaded version: {{downloaded_version}}"
|
downloaded_version: "Downloaded version: {{downloaded_version}}"
|
||||||
latest_version: "Latest version: {{latest_version}}"
|
latest_version: "Latest version: {{latest_version}}"
|
||||||
@@ -258,6 +248,16 @@ config_page:
|
|||||||
available_in_latest_vrct_version: "Available in the latest VRCT version"
|
available_in_latest_vrct_version: "Available in the latest VRCT version"
|
||||||
unavailable_not_downloaded: "Currently unavailable"
|
unavailable_not_downloaded: "Currently unavailable"
|
||||||
|
|
||||||
|
advanced_settings:
|
||||||
|
osc_ip_address:
|
||||||
|
label: "OSC IP Address"
|
||||||
|
osc_port:
|
||||||
|
label: "OSC Port"
|
||||||
|
open_config_filepath:
|
||||||
|
label: "Open Config File"
|
||||||
|
switch_compute_device:
|
||||||
|
label: "Switch VRCT To CPU/GPU Version"
|
||||||
|
|
||||||
plugin_notifications:
|
plugin_notifications:
|
||||||
downloading: Downloading the plugin.
|
downloading: Downloading the plugin.
|
||||||
downloaded_success: Downloaded successfully.
|
downloaded_success: Downloaded successfully.
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ config_page:
|
|||||||
transcription: "音声認識"
|
transcription: "音声認識"
|
||||||
others: "その他"
|
others: "その他"
|
||||||
hotkeys: "ホットキー"
|
hotkeys: "ホットキー"
|
||||||
|
plugins: "プラグイン"
|
||||||
advanced_settings: "高度な設定"
|
advanced_settings: "高度な設定"
|
||||||
|
|
||||||
device:
|
device:
|
||||||
@@ -235,17 +236,6 @@ config_page:
|
|||||||
toggle_transcription_receive:
|
toggle_transcription_receive:
|
||||||
label: "「{{transcription_receive}}」 オン/オフの切り替え"
|
label: "「{{transcription_receive}}」 オン/オフの切り替え"
|
||||||
|
|
||||||
advanced_settings:
|
|
||||||
osc_ip_address:
|
|
||||||
label: "OSC IP Address"
|
|
||||||
osc_port:
|
|
||||||
label: "OSC Port"
|
|
||||||
open_config_filepath:
|
|
||||||
label: "設定ファイルを開く"
|
|
||||||
switch_compute_device:
|
|
||||||
label: "VRCT CPU/GPUバージョンの切り替え"
|
|
||||||
section_label_plugins: プラグイン # Exception, It'll be moved later.
|
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
downloaded_version: "ダウンロード済バージョン: {{downloaded_version}}"
|
downloaded_version: "ダウンロード済バージョン: {{downloaded_version}}"
|
||||||
latest_version: "最新バージョン: {{latest_version}}"
|
latest_version: "最新バージョン: {{latest_version}}"
|
||||||
@@ -258,6 +248,17 @@ config_page:
|
|||||||
available_in_latest_vrct_version: VRCT最新版で利用可能
|
available_in_latest_vrct_version: VRCT最新版で利用可能
|
||||||
unavailable_not_downloaded: 現在利用不可
|
unavailable_not_downloaded: 現在利用不可
|
||||||
|
|
||||||
|
advanced_settings:
|
||||||
|
osc_ip_address:
|
||||||
|
label: "OSC IP Address"
|
||||||
|
osc_port:
|
||||||
|
label: "OSC Port"
|
||||||
|
open_config_filepath:
|
||||||
|
label: "設定ファイルを開く"
|
||||||
|
switch_compute_device:
|
||||||
|
label: "VRCT CPU/GPUバージョンの切り替え"
|
||||||
|
|
||||||
|
|
||||||
plugin_notifications:
|
plugin_notifications:
|
||||||
downloading: プラグインをダウンロード中。
|
downloading: プラグインをダウンロード中。
|
||||||
downloaded_success: プラグインのダウンロードが完了しました。
|
downloaded_success: プラグインのダウンロードが完了しました。
|
||||||
|
|||||||
@@ -956,7 +956,7 @@ class Config:
|
|||||||
|
|
||||||
def init_config(self):
|
def init_config(self):
|
||||||
# Read Only
|
# Read Only
|
||||||
self._VERSION = "3.1.0"
|
self._VERSION = "3.1.1"
|
||||||
if getattr(sys, 'frozen', False):
|
if getattr(sys, 'frozen', False):
|
||||||
self._PATH_LOCAL = os_path.dirname(sys.executable)
|
self._PATH_LOCAL = os_path.dirname(sys.executable)
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
import { store } from "@store";
|
||||||
|
|
||||||
export const CornerRadiusController = () => {
|
export const CornerRadiusController = () => {
|
||||||
const [is_win11, setIsWin11] = useState(false);
|
const [is_win11, setIsWin11] = useState(false);
|
||||||
const [is_maximized, setIsMaximized] = useState(false);
|
const [is_maximized, setIsMaximized] = useState(false);
|
||||||
|
|
||||||
|
const appWindow = store.appWindow;
|
||||||
|
|
||||||
// OS 判定(Win11 なら platformVersion の major ≥13)
|
// OS 判定(Win11 なら platformVersion の major ≥13)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (navigator.userAgentData?.getHighEntropyValues) {
|
if (navigator.userAgentData?.getHighEntropyValues) {
|
||||||
@@ -27,12 +29,11 @@ export const CornerRadiusController = () => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let unlisten;
|
let unlisten;
|
||||||
const setup = async () => {
|
const setup = async () => {
|
||||||
const window = await getCurrentWindow();
|
|
||||||
// 初期状態取得
|
// 初期状態取得
|
||||||
setIsMaximized(await window.isMaximized());
|
setIsMaximized(await appWindow.isMaximized());
|
||||||
// リサイズ時にも再取得
|
// リサイズ時にも再取得
|
||||||
const updateMax = () => window.isMaximized().then(setIsMaximized);
|
const updateMax = () => appWindow.isMaximized().then(setIsMaximized);
|
||||||
unlisten = await window.listen("tauri://resize", updateMax);
|
unlisten = await appWindow.listen("tauri://resize", updateMax);
|
||||||
}
|
}
|
||||||
setup();
|
setup();
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import {
|
|||||||
AdvancedSettings,
|
AdvancedSettings,
|
||||||
Vr,
|
Vr,
|
||||||
Hotkeys,
|
Hotkeys,
|
||||||
// Plugins,
|
Plugins,
|
||||||
Supporters,
|
Supporters,
|
||||||
AboutVrct,
|
AboutVrct,
|
||||||
} from "@setting_box";
|
} from "@setting_box";
|
||||||
@@ -33,8 +33,8 @@ export const SettingBox = () => {
|
|||||||
return <Hotkeys />;
|
return <Hotkeys />;
|
||||||
case "advanced_settings":
|
case "advanced_settings":
|
||||||
return <AdvancedSettings />;
|
return <AdvancedSettings />;
|
||||||
// case "plugins":
|
case "plugins":
|
||||||
// return <Plugins />;
|
return <Plugins />;
|
||||||
case "supporters":
|
case "supporters":
|
||||||
return <Supporters />;
|
return <Supporters />;
|
||||||
case "about_vrct":
|
case "about_vrct":
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ import { useEffect, useState } from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import styles from "./AdvancedSettings.module.scss";
|
import styles from "./AdvancedSettings.module.scss";
|
||||||
|
|
||||||
import { Plugins } from "./plugins/Plugins";
|
|
||||||
|
|
||||||
import { useOpenFolder } from "@logics_common";
|
import { useOpenFolder } from "@logics_common";
|
||||||
import {
|
import {
|
||||||
useOscIpAddress,
|
useOscIpAddress,
|
||||||
@@ -15,31 +13,18 @@ import {
|
|||||||
EntryWithSaveButtonContainer,
|
EntryWithSaveButtonContainer,
|
||||||
} from "../_templates/Templates";
|
} from "../_templates/Templates";
|
||||||
|
|
||||||
import {
|
|
||||||
SectionLabelComponent,
|
|
||||||
} from "../_components/";
|
|
||||||
|
|
||||||
|
|
||||||
import OpenFolderSvg from "@images/open_folder.svg?react";
|
import OpenFolderSvg from "@images/open_folder.svg?react";
|
||||||
import HelpSvg from "@images/help.svg?react";
|
import HelpSvg from "@images/help.svg?react";
|
||||||
|
|
||||||
export const AdvancedSettings = () => {
|
export const AdvancedSettings = () => {
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div>
|
<div>
|
||||||
|
|
||||||
<OscIpAddressContainer />
|
<OscIpAddressContainer />
|
||||||
<OscPortContainer />
|
<OscPortContainer />
|
||||||
<OpenConfigFolderContainer />
|
<OpenConfigFolderContainer />
|
||||||
<OpenSwitchComputeDeviceModalContainer />
|
<OpenSwitchComputeDeviceModalContainer />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
|
||||||
<SectionLabelComponent label={t("config_page.advanced_settings.section_label_plugins")} />
|
|
||||||
<Plugins />
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ export { Others, VrcMicMuteSyncContainer } from "./others/Others";
|
|||||||
export { AdvancedSettings } from "./advanced_settings/AdvancedSettings";
|
export { AdvancedSettings } from "./advanced_settings/AdvancedSettings";
|
||||||
export { Vr } from "./vr/Vr";
|
export { Vr } from "./vr/Vr";
|
||||||
export { Hotkeys } from "./hotkeys/Hotkeys";
|
export { Hotkeys } from "./hotkeys/Hotkeys";
|
||||||
// export { Plugins } from "./plugins/Plugins";
|
export { Plugins } from "./plugins/Plugins";
|
||||||
export { AboutVrct } from "./about_vrct/AboutVrct";
|
export { AboutVrct } from "./about_vrct/AboutVrct";
|
||||||
export { Supporters } from "./supporters/Supporters";
|
export { Supporters } from "./supporters/Supporters";
|
||||||
@@ -2,7 +2,7 @@ import { useEffect, useRef, useState, useCallback } from "react";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { usePlugins } from "@logics_configs";
|
import { usePlugins } from "@logics_configs";
|
||||||
import styles from "./Plugins.module.scss";
|
import styles from "./Plugins.module.scss";
|
||||||
import { PluginsControlComponent } from "../../_components/plugins_control_component/PluginsControlComponent";
|
import { PluginsControlComponent } from "../_components/plugins_control_component/PluginsControlComponent";
|
||||||
import { useNotificationStatus } from "@logics_common";
|
import { useNotificationStatus } from "@logics_common";
|
||||||
import ExternalLink from "@images/external_link.svg?react";
|
import ExternalLink from "@images/external_link.svg?react";
|
||||||
|
|
||||||
@@ -12,7 +12,7 @@ export const SidebarSection = () => {
|
|||||||
<Tab tab_id="vr" />
|
<Tab tab_id="vr" />
|
||||||
<Tab tab_id="others" />
|
<Tab tab_id="others" />
|
||||||
<Tab tab_id="hotkeys" />
|
<Tab tab_id="hotkeys" />
|
||||||
{/* <Tab tab_id="plugins" /> */}
|
<Tab tab_id="plugins" />
|
||||||
<Tab tab_id="advanced_settings" />
|
<Tab tab_id="advanced_settings" />
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.separated_tabs_wrapper}>
|
<div className={styles.separated_tabs_wrapper}>
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
||||||
import { ErrorBoundary } from "react-error-boundary";
|
import { ErrorBoundary } from "react-error-boundary";
|
||||||
import XMarkSvg from "@images/cancel.svg?react";
|
import XMarkSvg from "@images/cancel.svg?react";
|
||||||
import CopySvg from "@images/copy.svg?react";
|
import CopySvg from "@images/copy.svg?react";
|
||||||
@@ -7,6 +6,8 @@ import CheckMarkSvg from "@images/check_mark.svg?react";
|
|||||||
|
|
||||||
import { ContactsContainer } from "./contacts_container/ContactsContainer";
|
import { ContactsContainer } from "./contacts_container/ContactsContainer";
|
||||||
|
|
||||||
|
import { useWindow } from "@logics_common";
|
||||||
|
|
||||||
import styles from "./AppErrorBoundary.module.scss";
|
import styles from "./AppErrorBoundary.module.scss";
|
||||||
|
|
||||||
export const AppErrorBoundary = ({children}) => {
|
export const AppErrorBoundary = ({children}) => {
|
||||||
@@ -65,14 +66,9 @@ const ErrorContainer = ({error}) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const CloseButtonContainer = () => {
|
const CloseButtonContainer = () => {
|
||||||
|
const { asyncCloseApp } = useWindow();
|
||||||
const asyncClose = async () => {
|
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
appWindow.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button className={styles.close_button_wrapper} onClick={asyncClose}>
|
<button className={styles.close_button_wrapper} onClick={asyncCloseApp}>
|
||||||
<div className={styles.close_button}>
|
<div className={styles.close_button}>
|
||||||
<XMarkSvg className={styles.x_mark_svg}/>
|
<XMarkSvg className={styles.x_mark_svg}/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ import React from "react";
|
|||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
import "@root/locales/config.js";
|
import "@root/locales/config.js";
|
||||||
import "./_index_css/root.css";
|
import "./_index_css/root.css";
|
||||||
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||||
|
|
||||||
|
import { store } from "@store";
|
||||||
|
store.appWindow = getCurrentWindow();
|
||||||
|
|
||||||
import { App } from "./App";
|
import { App } from "./App";
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import { useMessage } from "@logics_common";
|
|||||||
import { useSendMessageButtonType, useEnableAutoClearMessageInputBox } from "@logics_configs";
|
import { useSendMessageButtonType, useEnableAutoClearMessageInputBox } from "@logics_configs";
|
||||||
import { useMessageLogScroll } from "@logics_main";
|
import { useMessageLogScroll } from "@logics_main";
|
||||||
import { store } from "@store";
|
import { store } from "@store";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
||||||
|
|
||||||
export const MessageInputBox = () => {
|
export const MessageInputBox = () => {
|
||||||
const [message_history, setMessageHistory] = useState([]);
|
const [message_history, setMessageHistory] = useState([]);
|
||||||
@@ -41,8 +40,6 @@ export const MessageInputBox = () => {
|
|||||||
|
|
||||||
const onSubmitFunction = (e) => {
|
const onSubmitFunction = (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
// const appWindow = getCurrentWindow();
|
|
||||||
// appWindow.minimize();
|
|
||||||
|
|
||||||
if (!currentMessageInputValue.data.trim()) return updateMessageInputValue("");
|
if (!currentMessageInputValue.data.trim()) return updateMessageInputValue("");
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,11 @@ import { useIsEnabledOverlaySmallLog, useIsEnabledOverlayLargeLog, useEnableVrcM
|
|||||||
import { OpenQuickSettingButton } from "./_buttons/OpenQuickSettingButton";
|
import { OpenQuickSettingButton } from "./_buttons/OpenQuickSettingButton";
|
||||||
|
|
||||||
export const RightSideComponents = () => {
|
export const RightSideComponents = () => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
|
|
||||||
|
<PluginsQuickSetting />
|
||||||
<OpenVrcMicMuteSyncQuickSetting />
|
<OpenVrcMicMuteSyncQuickSetting />
|
||||||
<OpenOverlayQuickSetting />
|
<OpenOverlayQuickSetting />
|
||||||
<SoftwareUpdateAvailableButton />
|
<SoftwareUpdateAvailableButton />
|
||||||
@@ -46,6 +49,21 @@ const OpenOverlayQuickSetting = () => {
|
|||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
const PluginsQuickSetting = () => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const { updateOpenedQuickSetting } = useStore_OpenedQuickSetting();
|
||||||
|
|
||||||
|
const onClickFunction = () => {
|
||||||
|
updateOpenedQuickSetting("plugins");
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<OpenQuickSettingButton
|
||||||
|
label={t("config_page.side_menu_labels.plugins")}
|
||||||
|
onClickFunction={onClickFunction}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
const OpenVrcMicMuteSyncQuickSetting = () => {
|
const OpenVrcMicMuteSyncQuickSetting = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|||||||
@@ -4,14 +4,22 @@ import styles from "./OpenQuickSettingButton.module.scss";
|
|||||||
|
|
||||||
export const OpenQuickSettingButton = (props) => {
|
export const OpenQuickSettingButton = (props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
const variable = (typeof props.variable === "boolean") ? props.variable : null;
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
<div className={styles.button_wrapper} onClick={props.onClickFunction}>
|
<div className={styles.button_wrapper} onClick={props.onClickFunction}>
|
||||||
<p className={styles.button_label}>{props.label}</p>
|
<p className={styles.button_label}>{props.label}</p>
|
||||||
{props.variable === true
|
{variable !== null && (
|
||||||
? <p className={clsx(styles.button_indicator_label, styles.enabled)}>{t("main_page.state_text_enabled")}</p>
|
props.variable === true ? (
|
||||||
: <p className={clsx(styles.button_indicator_label, styles.disabled)}>{t("main_page.state_text_disabled")}</p>
|
<p className={clsx(styles.button_indicator_label, styles.enabled)}>
|
||||||
}
|
{t("main_page.state_text_enabled")}
|
||||||
|
</p>
|
||||||
|
) : (
|
||||||
|
<p className={clsx(styles.button_indicator_label, styles.disabled)}>
|
||||||
|
{t("main_page.state_text_disabled")}
|
||||||
|
</p>
|
||||||
|
)
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
.container {
|
.container {
|
||||||
// height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button_wrapper {
|
.button_wrapper {
|
||||||
|
height: 100%;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 0.2rem;
|
gap: 0.2rem;
|
||||||
padding: 0.6rem 0.4rem;
|
padding: 0 0.8rem;
|
||||||
border-radius: 0.2rem;
|
border-radius: 0.2rem;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
&:hover {
|
&:hover {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import styles from "./ModalController.module.scss";
|
import styles from "./ModalController.module.scss";
|
||||||
import { useStore_OpenedQuickSetting } from "@store";
|
import { useStore_OpenedQuickSetting } from "@store";
|
||||||
import { Vr, VrcMicMuteSyncContainer } from "@setting_box";
|
import { Vr, VrcMicMuteSyncContainer, Plugins } from "@setting_box";
|
||||||
import { UpdateModal } from "./update_modal/UpdateModal";
|
import { UpdateModal } from "./update_modal/UpdateModal";
|
||||||
|
|
||||||
export const ModalController = () => {
|
export const ModalController = () => {
|
||||||
@@ -20,10 +20,12 @@ const QuickSettingsController = () => {
|
|||||||
const { currentOpenedQuickSetting, updateOpenedQuickSetting } = useStore_OpenedQuickSetting();
|
const { currentOpenedQuickSetting, updateOpenedQuickSetting } = useStore_OpenedQuickSetting();
|
||||||
|
|
||||||
switch (currentOpenedQuickSetting.data) {
|
switch (currentOpenedQuickSetting.data) {
|
||||||
case "overlay":
|
case "plugins":
|
||||||
return <Vr />;
|
return <Plugins />;
|
||||||
case "vrc_mic_mute_sync":
|
case "vrc_mic_mute_sync":
|
||||||
return <VrcMicMuteSyncContainer />;
|
return <VrcMicMuteSyncContainer />;
|
||||||
|
case "overlay":
|
||||||
|
return <Vr />;
|
||||||
case "update_software":
|
case "update_software":
|
||||||
return <UpdateModal />;
|
return <UpdateModal />;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import { StartUpProgressContainer } from "./start_up_progress_container/StartUpP
|
|||||||
import { DownloadModelsContainer } from "./download_models_container/DownloadModelsContainer/";
|
import { DownloadModelsContainer } from "./download_models_container/DownloadModelsContainer/";
|
||||||
import MegaphoneSvg from "@images/megaphone.svg?react";
|
import MegaphoneSvg from "@images/megaphone.svg?react";
|
||||||
import XMarkSvg from "@images/cancel.svg?react";
|
import XMarkSvg from "@images/cancel.svg?react";
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
import { useWindow } from "@logics_common";
|
||||||
import clsx from "clsx";
|
import clsx from "clsx";
|
||||||
|
|
||||||
export const SplashComponent = () => {
|
export const SplashComponent = () => {
|
||||||
@@ -73,13 +73,10 @@ const AnnouncementsContainer = () => {
|
|||||||
|
|
||||||
|
|
||||||
const CloseButtonContainer = () => {
|
const CloseButtonContainer = () => {
|
||||||
const asyncClose = async () => {
|
const { asyncCloseApp } = useWindow();
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
appWindow.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<button className={styles.close_button_wrapper} onClick={asyncClose}>
|
<button className={styles.close_button_wrapper} onClick={asyncCloseApp}>
|
||||||
<div className={styles.close_button}>
|
<div className={styles.close_button}>
|
||||||
<XMarkSvg className={styles.x_mark_svg}/>
|
<XMarkSvg className={styles.x_mark_svg}/>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { useWindow } from "@logics_common";
|
||||||
// import clsx from "clsx";
|
// import clsx from "clsx";
|
||||||
import styles from "./WindowTitleBar.module.scss";
|
import styles from "./WindowTitleBar.module.scss";
|
||||||
import XMarkSvg from "@images/cancel.svg?react";
|
import XMarkSvg from "@images/cancel.svg?react";
|
||||||
@@ -5,29 +6,8 @@ import SquareSvg from "@images/square.svg?react";
|
|||||||
import LineSvg from "@images/line.svg?react";
|
import LineSvg from "@images/line.svg?react";
|
||||||
import VrctSvg from "@images/vrct.svg?react";
|
import VrctSvg from "@images/vrct.svg?react";
|
||||||
|
|
||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
||||||
|
|
||||||
export const WindowTitleBar = () => {
|
export const WindowTitleBar = () => {
|
||||||
|
const { asyncCloseApp, asyncToggleMaximizeApp, asyncMinimizeApp} = useWindow();
|
||||||
const asyncMinimize = async () => {
|
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
appWindow.minimize();
|
|
||||||
};
|
|
||||||
|
|
||||||
const asyncMaximize = async () => {
|
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
const maximizeState = await appWindow.isMaximized();
|
|
||||||
if (!maximizeState) {
|
|
||||||
appWindow.maximize();
|
|
||||||
} else {
|
|
||||||
appWindow.unmaximize();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const asyncClose = async () => {
|
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
appWindow.close();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={styles.container}>
|
<div className={styles.container}>
|
||||||
@@ -37,13 +17,13 @@ export const WindowTitleBar = () => {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className={styles.window_control_wrapper}>
|
<div className={styles.window_control_wrapper}>
|
||||||
<div className={styles.minimize_button} onClick={asyncMinimize}>
|
<div className={styles.minimize_button} onClick={asyncMinimizeApp}>
|
||||||
<LineSvg className={styles.line_svg}/>
|
<LineSvg className={styles.line_svg}/>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.maximize_button} onClick={asyncMaximize}>
|
<div className={styles.maximize_button} onClick={asyncToggleMaximizeApp}>
|
||||||
<SquareSvg className={styles.square_svg}/>
|
<SquareSvg className={styles.square_svg}/>
|
||||||
</div>
|
</div>
|
||||||
<div className={styles.close_button} onClick={asyncClose}>
|
<div className={styles.close_button} onClick={asyncCloseApp}>
|
||||||
<XMarkSvg className={styles.x_mark_svg}/>
|
<XMarkSvg className={styles.x_mark_svg}/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useRef } from "react";
|
import { useEffect, useRef } from "react";
|
||||||
import { getCurrentWindow, currentMonitor, availableMonitors, PhysicalPosition, PhysicalSize } from "@tauri-apps/api/window";
|
import { currentMonitor, availableMonitors, PhysicalPosition, PhysicalSize } from "@tauri-apps/api/window";
|
||||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||||
import { useStore_IsBreakPoint } from "@store";
|
import { useStore_IsBreakPoint } from "@store";
|
||||||
import { useUiScaling } from "@logics_configs";
|
import { useUiScaling } from "@logics_configs";
|
||||||
@@ -10,9 +10,9 @@ export const useWindow = () => {
|
|||||||
const { currentUiScaling } = useUiScaling();
|
const { currentUiScaling } = useUiScaling();
|
||||||
const { updateIsBreakPoint } = useStore_IsBreakPoint();
|
const { updateIsBreakPoint } = useStore_IsBreakPoint();
|
||||||
|
|
||||||
|
const appWindow = store.appWindow;
|
||||||
|
|
||||||
const asyncGetWindowGeometry = async () => {
|
const asyncGetWindowGeometry = async () => {
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
try {
|
try {
|
||||||
const position = await appWindow.outerPosition();
|
const position = await appWindow.outerPosition();
|
||||||
const { x: x_pos, y: y_pos } = position;
|
const { x: x_pos, y: y_pos } = position;
|
||||||
@@ -32,7 +32,6 @@ export const useWindow = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const asyncSaveWindowGeometry = async () => {
|
const asyncSaveWindowGeometry = async () => {
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
const minimized = await appWindow.isMinimized();
|
const minimized = await appWindow.isMinimized();
|
||||||
if (minimized === true) return; // don't save while the window is minimized.
|
if (minimized === true) return; // don't save while the window is minimized.
|
||||||
const data = await asyncGetWindowGeometry();
|
const data = await asyncGetWindowGeometry();
|
||||||
@@ -40,8 +39,6 @@ export const useWindow = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const restoreWindowGeometry = async (data) => {
|
const restoreWindowGeometry = async (data) => {
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const monitors = await availableMonitors();
|
const monitors = await availableMonitors();
|
||||||
const { x_pos, y_pos, width, height } = data;
|
const { x_pos, y_pos, width, height } = data;
|
||||||
@@ -95,7 +92,6 @@ export const useWindow = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const asyncUpdateBreakPoint = async () => {
|
const asyncUpdateBreakPoint = async () => {
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
const size = await appWindow.innerSize();
|
const size = await appWindow.innerSize();
|
||||||
const dynamicBreakPoint = 800 * (currentUiScaling.data / 100);
|
const dynamicBreakPoint = 800 * (currentUiScaling.data / 100);
|
||||||
updateIsBreakPoint(size.width <= dynamicBreakPoint);
|
updateIsBreakPoint(size.width <= dynamicBreakPoint);
|
||||||
@@ -109,10 +105,7 @@ export const useWindow = () => {
|
|||||||
const unlistenMove = useRef(null);
|
const unlistenMove = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const setup = async () => {
|
const setup = () => {
|
||||||
if (store.is_register_window_geometry_controller) return;
|
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
|
|
||||||
unlistenResize.current = appWindow.onResized(() => {
|
unlistenResize.current = appWindow.onResized(() => {
|
||||||
clearTimeout(resizeTimeout.current);
|
clearTimeout(resizeTimeout.current);
|
||||||
resizeTimeout.current = setTimeout(() => {
|
resizeTimeout.current = setTimeout(() => {
|
||||||
@@ -127,7 +120,6 @@ export const useWindow = () => {
|
|||||||
asyncSaveWindowGeometry();
|
asyncSaveWindowGeometry();
|
||||||
}, 200);
|
}, 200);
|
||||||
});
|
});
|
||||||
store.is_register_window_geometry_controller = true;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
setup();
|
setup();
|
||||||
@@ -148,10 +140,30 @@ export const useWindow = () => {
|
|||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const asyncToggleMaximizeApp = async () => {
|
||||||
|
const maximizeState = await appWindow.isMaximized();
|
||||||
|
if (!maximizeState) {
|
||||||
|
await appWindow.maximize();
|
||||||
|
} else {
|
||||||
|
await appWindow.unmaximize();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const asyncMinimizeApp = async () => {
|
||||||
|
await appWindow.minimize();
|
||||||
|
};
|
||||||
|
const asyncCloseApp = async () => {
|
||||||
|
await appWindow.close();
|
||||||
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
WindowGeometryController,
|
WindowGeometryController,
|
||||||
asyncSaveWindowGeometry,
|
asyncSaveWindowGeometry,
|
||||||
restoreWindowGeometry,
|
restoreWindowGeometry,
|
||||||
asyncUpdateBreakPoint,
|
asyncUpdateBreakPoint,
|
||||||
|
|
||||||
|
asyncCloseApp,
|
||||||
|
asyncToggleMaximizeApp,
|
||||||
|
asyncMinimizeApp,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,3 @@
|
|||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
||||||
|
|
||||||
import { store, useStore_Hotkeys } from "@store";
|
import { store, useStore_Hotkeys } from "@store";
|
||||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||||
import { useNotificationStatus } from "@logics_common";
|
import { useNotificationStatus } from "@logics_common";
|
||||||
@@ -7,6 +5,8 @@ import { useMainFunction } from "@logics_main";
|
|||||||
import { register, unregisterAll, isRegistered } from "@tauri-apps/plugin-global-shortcut";
|
import { register, unregisterAll, isRegistered } from "@tauri-apps/plugin-global-shortcut";
|
||||||
|
|
||||||
export const useHotkeys = () => {
|
export const useHotkeys = () => {
|
||||||
|
const appWindow = store.appWindow;
|
||||||
|
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
const { currentHotkeys, updateHotkeys, pendingHotkeys } = useStore_Hotkeys();
|
const { currentHotkeys, updateHotkeys, pendingHotkeys } = useStore_Hotkeys();
|
||||||
const {
|
const {
|
||||||
@@ -68,8 +68,6 @@ export const useHotkeys = () => {
|
|||||||
if (!isAlreadyRegistered) {
|
if (!isAlreadyRegistered) {
|
||||||
await register(shortcut, async (event) => {
|
await register(shortcut, async (event) => {
|
||||||
if (event.state !== "Pressed") return;
|
if (event.state !== "Pressed") return;
|
||||||
const appWindow = await getCurrentWindow();
|
|
||||||
|
|
||||||
switch (actionKey) {
|
switch (actionKey) {
|
||||||
case "toggle_vrct_visibility": {
|
case "toggle_vrct_visibility": {
|
||||||
const minimized = await appWindow.isMinimized();
|
const minimized = await appWindow.isMinimized();
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
import { store } from "@store";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
useStore_TranslationStatus,
|
useStore_TranslationStatus,
|
||||||
@@ -6,10 +6,11 @@ import {
|
|||||||
useStore_TranscriptionReceiveStatus,
|
useStore_TranscriptionReceiveStatus,
|
||||||
useStore_ForegroundStatus,
|
useStore_ForegroundStatus,
|
||||||
} from "@store";
|
} from "@store";
|
||||||
import { useCallback } from "react";
|
|
||||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||||
|
|
||||||
export const useMainFunction = () => {
|
export const useMainFunction = () => {
|
||||||
|
const appWindow = store.appWindow;
|
||||||
|
|
||||||
const {
|
const {
|
||||||
currentTranslationStatus,
|
currentTranslationStatus,
|
||||||
updateTranslationStatus,
|
updateTranslationStatus,
|
||||||
@@ -76,9 +77,8 @@ export const useMainFunction = () => {
|
|||||||
|
|
||||||
|
|
||||||
const toggleForeground = async () => {
|
const toggleForeground = async () => {
|
||||||
const main_page = await getCurrentWindow();
|
|
||||||
const is_foreground_enabled = !currentForegroundStatus.data;
|
const is_foreground_enabled = !currentForegroundStatus.data;
|
||||||
main_page.setAlwaysOnTop(is_foreground_enabled);
|
await appWindow.setAlwaysOnTop(is_foreground_enabled);
|
||||||
updateForegroundStatus(is_foreground_enabled);
|
updateForegroundStatus(is_foreground_enabled);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
import { store } from "@store";
|
||||||
import { useStore_MessageInputBoxRatio } from "@store";
|
import { useStore_MessageInputBoxRatio } from "@store";
|
||||||
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
import { useStdoutToPython } from "@logics/useStdoutToPython";
|
||||||
import { clampMinMax } from "@utils";
|
import { clampMinMax } from "@utils";
|
||||||
export const useMessageInputBoxRatio = () => {
|
export const useMessageInputBoxRatio = () => {
|
||||||
|
const appWindow = store.appWindow;
|
||||||
|
|
||||||
const { asyncStdoutToPython } = useStdoutToPython();
|
const { asyncStdoutToPython } = useStdoutToPython();
|
||||||
const { currentMessageInputBoxRatio, updateMessageInputBoxRatio } = useStore_MessageInputBoxRatio();
|
const { currentMessageInputBoxRatio, updateMessageInputBoxRatio } = useStore_MessageInputBoxRatio();
|
||||||
@@ -12,7 +13,6 @@ export const useMessageInputBoxRatio = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const asyncSetMessageInputBoxRatio = async (ratio) => {
|
const asyncSetMessageInputBoxRatio = async (ratio) => {
|
||||||
const appWindow = getCurrentWindow();
|
|
||||||
const minimized = await appWindow.isMinimized();
|
const minimized = await appWindow.isMinimized();
|
||||||
if (minimized === true) return; // don't save while the window is minimized.
|
if (minimized === true) return; // don't save while the window is minimized.
|
||||||
const parsed = parseFloat(ratio.toFixed(2));
|
const parsed = parseFloat(ratio.toFixed(2));
|
||||||
|
|||||||
Reference in New Issue
Block a user