Skip to content

Commit

Permalink
Merge branch 'main' of github.com:VOICEVOX/voicevox
Browse files Browse the repository at this point in the history
  • Loading branch information
tsukumijima committed Dec 3, 2024
2 parents 683ce25 + 02ac972 commit 6b118ee
Show file tree
Hide file tree
Showing 20 changed files with 285 additions and 331 deletions.
6 changes: 1 addition & 5 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,7 @@ module.exports = {
plugins: ["import"],
parser: vueEslintParser,
parserOptions: vueEslintParserOptions,
ignorePatterns: [
"dist/**/*",
"dist_*/**/*",
"node_modules/**/*",
],
ignorePatterns: ["dist/**/*", "dist_*/**/*", "node_modules/**/*"],
rules: {
"linebreak-style":
process.env.NODE_ENV === "production" && process.platform !== "win32"
Expand Down
185 changes: 0 additions & 185 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,191 +47,6 @@ jobs:
uses: ./.github/actions/setup-environment
- run: npm run electron:build

# # unit テスト
# unit-test:
# runs-on: windows-2022
# steps:
# - uses: actions/checkout@v4
# - name: Setup environment
# uses: ./.github/actions/setup-environment

# - name: Run test
# run: |
# npm run test:unit

# # e2e テスト
# e2e-test:
# runs-on: ${{ matrix.os }}
# needs: [config]
# strategy:
# fail-fast: false
# matrix:
# os:
# - windows-2022
# - macos-13
# - macos-14
# # - ubuntu-20.04
# include:
# - os: windows-2022
# aivisspeech_engine_asset_name: windows-x64
# - os: macos-13
# aivisspeech_engine_asset_name: macos-x64
# - os: macos-14
# aivisspeech_engine_asset_name: macos-arm64
# # - os: ubuntu-20.04
# # aivisspeech_engine_asset_name: linux-x64
# steps:
# - uses: actions/checkout@v4
# - name: Setup environment
# uses: ./.github/actions/setup-environment

# - name: Install xvfb and x11-xserver-utils
# if: startsWith(matrix.os, 'ubuntu')
# run: |
# sudo apt-get update
# sudo apt-get install -y xvfb x11-xserver-utils # for electron
# sudo apt-get install -y libsndfile1 # for engine

# - name: Download AivisSpeech Engine
# id: download-engine
# uses: ./.github/actions/download-engine
# with:
# repo: ${{ env.AIVISSPEECH_ENGINE_REPO }}
# version: ${{ env.AIVISSPEECH_ENGINE_VERSION }}
# dest: ${{ github.workspace }}/AivisSpeech-Engine
# target: ${{ matrix.aivisspeech_engine_asset_name }}
# token: ${{ secrets.ENGINE_DOWNLOADER_TOKEN }}

# - name: Setup
# run: |
# # run.exe
# chmod +x ${{ steps.download-engine.outputs.run_path }}

# # .env
# sed -i -e 's|"074fc39e-678b-4c13-8916-ffca8d505d1d"|"208cf94d-43d2-4cf5-abc0-9783cac36d29"|' .env.test
# sed -i -e 's|"../AivisSpeech-Engine/run.exe"|"${{ steps.download-engine.outputs.run_path }}"|' .env.test
# cp .env.test .env

# - name: Run npm run test:browser-e2e
# run: |
# if [ -n "${{ runner.debug }}" ]; then
# export DEBUG="pw:browser*"
# fi
# ARGS=""
# if [[ ${{ needs.config.outputs.shouldUpdateSnapshots }} == 'true' ]]; then
# ARGS="--update-snapshots"
# fi
# npm run test:browser-e2e -- $ARGS

# - name: Run npm run test:electron-e2e
# run: |
# if [ -n "${{ runner.debug }}" ]; then
# export DEBUG="pw:browser*"
# fi
# if [[ ${{ matrix.os }} == ubuntu-* ]]; then
# xvfb-run --auto-servernum npm run test:electron-e2e
# else
# npm run test:electron-e2e
# fi

# - name: Run npm run test:storybook-vrt
# run: |
# if [ -n "${{ runner.debug }}" ]; then
# export DEBUG="pw:browser*"
# fi
# ARGS=""
# if [[ ${{ needs.config.outputs.shouldUpdateSnapshots }} == 'true' ]]; then
# ARGS="--update-snapshots"
# fi
# npm run test:storybook-vrt -- $ARGS

# - name: Upload playwright report to artifact
# if: failure()
# uses: actions/upload-artifact@v4
# with:
# name: playwright-report-${{ matrix.os }}
# path: playwright-report

# - name: Collect patch for snapshots
# if: needs.config.outputs.shouldUpdateSnapshots == 'true'
# run: |
# git add --intent-to-add tests/ # git diff に表示されるようにする
# git diff tests/ # ロギング用
# git diff --binary tests/ > patch-${{ matrix.os }}.diff

# - name: Upload patch to artifact
# if: needs.config.outputs.shouldUpdateSnapshots == 'true'
# uses: actions/upload-artifact@v4
# with:
# name: updated-snapshots-${{ matrix.os }}
# path: patch-${{ matrix.os }}.diff

# commit-snapshots:
# runs-on: ubuntu-latest
# permissions:
# contents: write
# needs: [config, e2e-test]
# if: needs.config.outputs.shouldUpdateSnapshots == 'true'
# steps:
# - uses: actions/checkout@v4
# with:
# # NOTE: デフォルトの設定だとgithub-push-actionが動いてくれないので設定を変えている。
# # ref: https://github.com/ad-m/github-push-action/issues/44#issuecomment-581706892
# persist-credentials: false
# fetch-depth: 0

# - name: Download artifacts
# uses: actions/download-artifact@v4
# with:
# pattern: updated-snapshots-*
# path: patches
# merge-multiple: true

# - name: Commit updated snapshots
# id: commit-updated-snapshots
# run: |
# # パッチを適用
# for patch in patches/*.diff; do
# git apply --allow-empty $patch
# rm $patch
# done

# # 変更があるかチェック
# if [ -n "$(git status --porcelain)" ]; then
# git config --global user.name "github-actions[bot]"
# git config --global user.email "github-actions[bot]@users.noreply.github.com"
# git add tests/
# git commit -m "(スナップショットを更新)"

# echo "changes_exist=true" >> $GITHUB_OUTPUT
# else
# echo "No changes to commit"

# echo "changes_exist=false" >> $GITHUB_OUTPUT
# fi

# - name: Push changes
# if: steps.commit-updated-snapshots.outputs.changes_exist == 'true'
# uses: ad-m/github-push-action@77c5b412c50b723d2a4fbc6d71fb5723bcd439aa
# with:
# github_token: ${{ secrets.PUSH_TOKEN || secrets.GITHUB_TOKEN }}
# branch: ${{ github.ref }}

# - name: Show warning if token is not set
# if: steps.commit-updated-snapshots.outputs.changes_exist == 'true'
# uses: actions/github-script@v7
# with:
# script: |
# const pushTokenProvided = `${{ secrets.PUSH_TOKEN }}` !== "";
# if (!pushTokenProvided) {
# core.warning(
# "スクリーンショットを更新したので、空コミットをプッシュしてテストを再実行してください。\n" +
# "PUSH_TOKENをSecretsに追加すると次からこの操作を省けます。\n" +
# "Secretsの設定方法はREADME.mdを参照してください。"
# );
# }
# console.log(`pushTokenProvided: ${pushTokenProvided}`);

lint:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 4 additions & 0 deletions public/howtouse.md
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,10 @@ Anneli​(上機嫌),さようなら
- 元に戻す
- `Ctrl` + `Y`
- やり直す
- `Ctrl` + `+`
- 拡大
- `Ctrl` + `-`
- 縮小
- `Esc`
- テキスト欄からカーソルを外す
- スライダーの上でマウスホイール
Expand Down
17 changes: 15 additions & 2 deletions src/backend/browser/sandbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,22 @@ export const api: Sandbox = {
minimizeWindow() {
throw new Error(`Not supported on Browser version: minimizeWindow`);
},
maximizeWindow() {
throw new Error(`Not supported on Browser version: maximizeWindow`);
toggleMaximizeWindow() {
throw new Error(`Not supported on Browser version: toggleMaximizeWindow`);
},
toggleFullScreen() {
throw new Error(`Not supported on Browser version: toggleFullScreen`);
},
zoomIn() {
throw new Error(`Not supported on Browser version: zoomIn`);
},
zoomOut() {
throw new Error(`Not supported on Browser version: zoomOut`);
},
zoomReset() {
throw new Error(`Not supported on Browser version: zoomReset`);
},

/* eslint-disable no-console */ // ログの吐き出し先は console ぐらいしかないので、ここでは特例で許可している
logError(...params: unknown[]) {
console.error(...params);
Expand Down
31 changes: 28 additions & 3 deletions src/backend/electron/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -616,14 +616,39 @@ registerIpcMainHandle<IpcMainHandle>({
MINIMIZE_WINDOW: () => {
win.minimize();
},
MAXIMIZE_WINDOW: () => {
if (win.isMaximized()) {
TOGGLE_MAXIMIZE_WINDOW: () => {
// 全画面表示中は、全画面表示解除のみを行い、最大化解除処理は実施しない
if (win.isFullScreen()) {
win.setFullScreen(false);
} else if (win.isMaximized()) {
win.unmaximize();
} else {
win.maximize();
}
},

TOGGLE_FULLSCREEN: () => {
if (win.isFullScreen()) {
win.setFullScreen(false);
} else {
win.setFullScreen(true);
}
},
/** UIの拡大 */
ZOOM_IN: () => {
win.webContents.setZoomFactor(
Math.min(Math.max(win.webContents.getZoomFactor() + 0.1, 0.5), 3),
);
},
/** UIの縮小 */
ZOOM_OUT: () => {
win.webContents.setZoomFactor(
Math.min(Math.max(win.webContents.getZoomFactor() - 0.1, 0.5), 3),
);
},
/** UIの拡大率リセット */
ZOOM_RESET: () => {
win.webContents.setZoomFactor(1);
},
OPEN_LOG_DIRECTORY: () => {
void shell.openPath(app.getPath("logs"));
},
Expand Down
18 changes: 16 additions & 2 deletions src/backend/electron/preload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,22 @@ const api: Sandbox = {
void ipcRendererInvokeProxy.MINIMIZE_WINDOW();
},

maximizeWindow: () => {
void ipcRendererInvokeProxy.MAXIMIZE_WINDOW();
toggleMaximizeWindow: () => {
void ipcRendererInvokeProxy.TOGGLE_MAXIMIZE_WINDOW();
},

toggleFullScreen: () => {
void ipcRendererInvokeProxy.TOGGLE_FULLSCREEN();
},

zoomIn: () => {
void ipcRendererInvokeProxy.ZOOM_IN();
},
zoomOut: () => {
void ipcRendererInvokeProxy.ZOOM_OUT();
},
zoomReset: () => {
void ipcRendererInvokeProxy.ZOOM_RESET();
},

logError: (...params) => {
Expand Down
24 changes: 10 additions & 14 deletions src/components/Dialog/HelpDialog/HelpLibraryPolicySection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,13 @@
style="margin-top: 20px !important"
spaced
/>
<QItemLabel header>{{
mapNullablePipe(engineInfos.get(engineId), (v) => v.name)
}}</QItemLabel>
<QItemLabel header>{{ engineInfos.get(engineId)?.name }}</QItemLabel>
</template>
<template
v-for="([, characterInfo], characterIndex) in mapNullablePipe(
engineInfos.get(engineId),
(v) => v.characterInfos,
)"
v-for="([, characterInfo], characterIndex) in getOrThrow(
engineInfos,
engineId,
).characterInfos"
:key="characterIndex"
>
<QItem
Expand Down Expand Up @@ -58,12 +56,10 @@
</div>
<h3 style="margin-top: 24px !important">
{{
mapNullablePipe(
engineInfos.get(selectedInfo.engine),
(v) => v.characterInfos,
(v) => mapNullablePipe(selectedInfo, (i) => v.get(i.character)),
(v) => v.metas.speakerName,
)
selectedInfo &&
engineInfos
.get(selectedInfo.engine)
?.characterInfos.get(selectedInfo.character)?.metas.speakerName
}}
</h3>
<QCard flat bordered class="q-mt-lg">
Expand All @@ -83,7 +79,7 @@ import { computed, ref } from "vue";
import { useStore } from "@/store";
import { useMarkdownIt } from "@/plugins/markdownItPlugin";
import { EngineId, SpeakerId } from "@/type/preload";
import { mapNullablePipe } from "@/helpers/map";
import { getOrThrow } from "@/helpers/mapHelper";

type DetailKey = { engine: EngineId; character: SpeakerId };

Expand Down
Loading

0 comments on commit 6b118ee

Please sign in to comment.