Skip to content

OneShotモードをホットキー実行として復活 - #670

Draft
Freeesia wants to merge 5 commits into
masterfrom
codex/restore-oneshot-mode
Draft

OneShotモードをホットキー実行として復活#670
Freeesia wants to merge 5 commits into
masterfrom
codex/restore-oneshot-mode

Conversation

@Freeesia

@Freeesia Freeesia commented Aug 11, 2026

Copy link
Copy Markdown
Owner

概要

以前存在したOneShotモードを、Overlay表示のホットキー押下時にOCR・翻訳する機能として復活します。

背景

OCR表示をテキスト追跡方式へ移行した際にOneShot設定が削除されていました。
OneShotでは前回フレームの位置や追跡状態を引き継がず、ホットキーを契機に最初に届いた画像だけを独立して処理します。

変更内容

  • IsOneShotMode 設定と設定画面、日英リソースを復活
  • Overlay表示の既存ホットキーからOneShot処理を起動
  • OneShotでは周期タイマーを生成せず、ホットキーでキャプチャーを開始
  • 最初のフレーム通知でキャプチャーを停止し、そのフレームだけを処理
  • 停止後に届いたフレームは、初回処理済みの判定だけで破棄
  • OCRトラッカーを迂回し、OCR結果をすべて新規矩形として扱う
  • 通常モードと同じフィルター・翻訳経路を使い、未翻訳矩形から翻訳結果へ更新
  • Capture表示のホットキー仕様には変更を加えない

影響

通常モードの周期OCRとテキスト追跡は従来どおり動作します。
Overlay表示でOneShotを有効にした場合のみ、ホットキーごとに新しいキャプチャーセッションを開始します。

検証

  • dotnet build WindowTranslator.Tests\WindowTranslator.Tests.csproj --no-restore --configuration Debug --verbosity minimal -m:1 --disable-build-servers -p:UseSharedCompilation=false
    • 成功(既存の LanguageOptions.cs 警告1件のみ)
  • dotnet test WindowTranslator.Tests\WindowTranslator.Tests.csproj --no-build --no-restore --configuration Debug --verbosity minimal -m:1 --disable-build-servers
    • 78件成功、失敗0件

Comment thread WindowTranslator/Modules/Main/CaptureMainWindow.xaml.cs
Comment thread WindowTranslator/Modules/Main/MainViewModelBase.cs Outdated
Comment thread WindowTranslator/Modules/Main/MainViewModelBase.cs
Comment thread WindowTranslator/Modules/Main/MainViewModelBase.cs Outdated
Comment thread WindowTranslator/Modules/Main/MainViewModelBase.cs Outdated
Comment thread WindowTranslator/Modules/Ocr/OcrObservationSelector.cs Outdated
Comment thread WindowTranslator/AssemblyInfo.cs Outdated
private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.timer.Start();
if (this.isOneShotMode)

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ホットキーの登録はOneShotかどうかに関わらず必要では?本当にオーバーレイと実装揃ってる?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ご指摘のとおり、Capture表示のホットキー登録はOneShot固有の変更として入れるべきではありませんでした。今回の変更範囲とは関係ないため、CaptureMainWindowの差分をすべて戻し、OneShotはOverlay表示の既存ホットキー経路だけで起動する形に修正しました。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant