Skip to content

Bring PS5 GTA6 to 120FPS with DLSS 5. An advanced Windows video player and capture enhancement tool featuring real-time preview for videos, images, and capture card sources. Combine AI-powered Super Resolution, DLSS5 image enhancement, and Frame Generation to deliver a next-generation visual experience.

C++

refactor(ui): separate bridge domains and reusable QML panels

Veyra Goal Agentd4b1034ecb52
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 709aa333..52134ed9 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1083,6 +1083,23 @@ if(VEYRA_BUILD_QML_UI AND Qt6_FOUND)
set_source_files_properties(apps/veyra/ui/SubtitleOverlay.cpp PROPERTIES COMPILE_OPTIONS /utf-8)
# AUTOMOC: QmlPlayerBridge declares Q_OBJECT, so its meta-object has to be
# generated. Without this the library links but every signal is unresolved.
+ # Keep bridge domains explicit: no source glob or duplicate runtime state.
+ target_sources(veyra_qml_bridge PRIVATE
+ src/ui/bridge/Hardware.cpp
+ src/ui/bridge/Status.cpp
+ src/ui/bridge/FrameGeneration.cpp
+ src/ui/bridge/Colour.cpp
+ src/ui/bridge/Preferences.cpp
+ src/ui/bridge/Capture.cpp
+ src/ui/bridge/RemotePlay.cpp
+ src/ui/bridge/Export.cpp
+ src/ui/bridge/Subtitles.cpp
+ src/ui/bridge/Playback.cpp
+ src/ui/bridge/Enhancement.cpp
+ src/ui/bridge/Chain.cpp
+ src/ui/bridge/Recording.cpp
+ src/ui/bridge/View.cpp
+ src/ui/QmlPlayerBridge_p.h)
set_target_properties(veyra_qml_bridge PROPERTIES AUTOMOC ON)
# Interface language (UiLanguage.h): its own small library so the streaming models,
# which are tested without the player, translate their messages too.
@@ -1583,7 +1600,7 @@ target_link_options(veyra_hdr_tuning_tests PRIVATE /STACK:33554432)
# pushed the veyra_qml_ui link line over CMake's response-file threshold, and
# link.exe reads response files in the ANSI code page, which breaks the UTF-8
# Qt paths under E:/项目. Those system libraries come from #pragma comment in
- # QmlPlayerBridge.cpp instead.
+ # the private QmlPlayerBridge_p.h instead.
if(TARGET veyra_qml_bridge)
target_sources(veyra_qml_bridge PRIVATE src/remoteplay/ControllerInput.cpp)
target_link_libraries(veyra_qml_bridge PUBLIC $<TARGET_LINKER_FILE:SDL3::SDL3-static>)
diff --git a/i18n/catalog.json b/i18n/catalog.json
index 46e47419..ef72e9e4 100644
--- a/i18n/catalog.json
+++ b/i18n/catalog.json
@@ -2,7 +2,7 @@
"entries": [
{
"zh": "\n仅观看:电脑输入已关闭,手柄由 PS5 处理。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "\n僅觀看:電腦輸入已關閉,手把由 PS5 處理。",
"en": "\nView only: PC input is off; the controller is handled by the PS5.",
"ja": "\n視聴のみ:PC の入力はオフで、コントローラーは PS5 が処理します。"
@@ -23,7 +23,7 @@
},
{
"zh": "\n未检测到电脑手柄。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "\n未檢測到電腦手把。",
"en": "\nNo controller detected on this PC.",
"ja": "\nこの PC でコントローラーが検出されません。"
@@ -44,7 +44,7 @@
},
{
"zh": "\n陀螺仪 {} · 触摸板 {} · 扳机 {} · 触觉 {}{}",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "\n陀螺儀 {} · 觸控板 {} · 扳機 {} · 觸覺 {}{}",
"en": "\nGyro {} · Touchpad {} · Triggers {} · Haptics {}{}",
"ja": "\nジャイロ {} · タッチパッド {} · トリガー {} · 触覚 {}{}"
@@ -121,7 +121,7 @@
},
{
"zh": " / 4 个区域",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": " / 4 個區域",
"en": " / 4 areas",
"ja": " / 4 領域"
@@ -170,21 +170,21 @@
},
{
"zh": " ms)的比例;超过 100% 就跟不上源帧率。当前状态:",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPerfOrbs.qml",
"zh-TW": " ms)的比例;超過 100% 就跟不上源幀率。當前狀態:",
"en": " ms); above 100% it cannot keep up with the source frame rate. Current state: ",
"ja": " ms)に対する割合。100% を超えるとソースのフレームレートに追いつけません。現在の状態:"
},
{
"zh": " · %1 声道",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": " · %1 聲道",
"en": " · %1 ch",
"ja": " · %1 ch"
},
{
"zh": " · 下混",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": " · 下混",
"en": " · downmix",
"ja": " · ダウンミックス"
@@ -233,7 +233,7 @@
},
{
"zh": " · 当前默认",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": " · 當前預設",
"en": " · current default",
"ja": " · 現在の既定"
@@ -254,21 +254,21 @@
},
{
"zh": " · 时域 4x(实验)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": " · 時域 4x(實驗)",
"en": " · temporal 4x (experimental)",
"ja": " · 時間方向 4x(実験的)"
},
{
"zh": " · 时域 T2x(实验)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": " · 時域 T2x(實驗)",
"en": " · temporal T2x (experimental)",
"ja": " · 時間方向 T2x(実験的)"
},
{
"zh": " · 校准中",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": " · 校準中",
"en": " · calibrating",
"ja": " · 補正中"
@@ -296,7 +296,7 @@
},
{
"zh": " · 节点",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": " · 節點",
"en": " · node",
"ja": " · ノード"
@@ -310,7 +310,7 @@
},
{
"zh": " · 质量 ",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ProPage.qml",
"zh-TW": " · 品質 ",
"en": " · quality ",
"ja": " · 品質 "
@@ -338,7 +338,7 @@
},
{
"zh": " → 建议 ",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": " → 建議 ",
"en": " → Suggested: ",
"ja": " → 推奨:"
@@ -380,7 +380,7 @@
},
{
"zh": " 声道",
- "src": "qml/CineBar.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": " 聲道",
"en": " ch",
"ja": " ch"
@@ -415,7 +415,7 @@
},
{
"zh": " 的比例",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPerfOrbs.qml",
"zh-TW": " 的比例",
"en": " share",
"ja": " の割合"
@@ -450,35 +450,35 @@
},
{
"zh": "%1 · 去重后约 %2 fps",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "%1 · 去重後約 %2 fps",
"en": "%1 · about %2 fps after deduplication",
"ja": "%1 · 重複除去後は約 %2 fps"
},
{
"zh": "%1 · 尚未观察到去重",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "%1 · 尚未觀察到去重",
"en": "%1 · no intentional frame skips observed yet",
"ja": "%1 · 重複除去によるスキップはまだありません"
},
{
"zh": "%1 · 屏幕 %2 Hz",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "%1 · 螢幕 %2 Hz",
"en": "%1 · display %2 Hz",
"ja": "%1 · ディスプレイ %2 Hz"
},
{
"zh": "%1 · 当前来源未去重",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "%1 · 目前來源未去重",
"en": "%1 · deduplication inactive for this source",
"ja": "%1 · このソースでは重複除去は無効"
},
{
"zh": "%1 · 当前约 %2 fps",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "%1 · 目前約 %2 fps",
"en": "%1 · currently about %2 fps",
"ja": "%1 · 現在約 %2 fps"
@@ -492,21 +492,21 @@
},
{
"zh": "%1 已用于其他操作",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "%1 已用於其他操作",
"en": "%1 is already used for another action",
"ja": "%1 はすでに別の操作に使われています"
},
{
"zh": "%1 已被固定功能占用",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "%1 已被固定功能占用",
"en": "%1 is reserved for a fixed function",
"ja": "%1 は固定機能で使用されています"
},
{
"zh": "%1 最多 %2 个",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "%1 最多 %2 個",
"en": "At most %2 × %1",
"ja": "%1 は最大 %2 個です"
@@ -534,7 +534,7 @@
},
{
"zh": "(未命名设备)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "(未命名裝置)",
"en": "(unnamed device)",
"ja": "(名前のないデバイス)"
@@ -555,21 +555,21 @@
},
{
"zh": "0 = 不做高光滚降",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "0 = 不做高光滾降",
"en": "0 = no highlight roll-off",
"ja": "0 = ハイライト壓縮なし"
},
{
"zh": "0 = 不限制",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "0 = 不限制",
"en": "0 = no limit",
"ja": "0 = 制限なし"
},
{
"zh": "0 = 沿用所选格式;设备返回其他帧率会报错,不在软件中偷偷丢帧",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "0 = 沿用所選格式;裝置返回其他幀率會報錯,不在軟體中偷偷丟幀",
"en": "0 = use the selected format; a device that returns another frame rate reports an error instead of frames being dropped silently",
"ja": "0 = 選択したフォーマットのまま。デバイスが別のフレームレートを返した場合はエラーになり、黙ってフレームを捨てることはしません"
@@ -583,14 +583,14 @@
},
{
"zh": "0 = 跟随片源",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "0 = 跟隨片源",
"en": "0 = follow the source",
"ja": "0 = ソースに追従"
},
{
"zh": "0 = 跟随片源;实际效果取决于显示设备",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "0 = 跟隨片源;實際效果取決於顯示設備",
"en": "0 = follow the source; results depend on the display",
"ja": "0 = ソースに追従。効果はディスプレイによって異なります"
@@ -625,49 +625,49 @@
},
{
"zh": "2 项",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "2 項",
"en": "2 items",
"ja": "2 項目"
},
{
"zh": "203 = 中性;调高整体变亮,峰值不变",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "203 = 中性;調高整體變亮,峰值不變",
"en": "203 = neutral; higher brightens the picture with the peak unchanged",
"ja": "203 = 中性。上げると全體が明るくなるがピークは不變"
},
{
"zh": "2X 为原生路径,3X / 4X 为实验解锁;失败原因见诊断",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "2X 為原生路徑,3X / 4X 為實驗解鎖;失敗原因見診斷",
"en": "2X is the native path; 3X / 4X are experimental unlocks. See diagnostics for failures",
"ja": "2X はネイティブ動作、3X / 4X は実験的なアンロックです。失敗の理由は診断を参照してください"
},
{
"zh": "4 项",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "4 項",
"en": "4 items",
"ja": "4 項目"
},
{
"zh": "5 项",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "5 項",
"en": "5 items",
"ja": "5 項目"
},
{
"zh": "6 项",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "6 項",
"en": "6 items",
"ja": "6 項目"
},
{
"zh": "8 位配对码",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "8 位配對碼",
"en": "8-digit pairing code",
"ja": "8 桁のペアリングコード"
@@ -709,7 +709,7 @@
},
{
"zh": "AMD 光流",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "AMD 光流",
"en": "AMD optical flow",
"ja": "AMD オプティカルフロー"
@@ -730,7 +730,7 @@
},
{
"zh": "AV1 需要主机显卡能编码、本机显卡能解码",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "AV1 需要主機顯示卡能編碼、本機顯示卡能解碼",
"en": "AV1 needs a host GPU that can encode it and a local GPU that can decode it",
"ja": "AV1 にはホスト GPU のエンコード対応と、この PC の GPU のデコード対応が必要です"
@@ -898,21 +898,21 @@
},
{
"zh": "Blackmagic 两个条目可能属于同一张卡。DirectShow 黑屏可尝试下方原生采集开关;手动格式须匹配实际信号。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "Blackmagic 兩個項目可能屬於同一張卡。DirectShow 黑畫面可嘗試下方原生擷取開關;手動格式須符合實際訊號。",
"en": "Both Blackmagic entries may refer to one card. If DirectShow is black, try native capture below. Manual formats must match the input signal.",
"ja": "Blackmagic の二つの項目が同じカードを指す場合があります。DirectShow が黒画面になる場合は下のネイティブキャプチャを試してください。手動形式は実際の信号に合わせます。"
},
{
"zh": "Blackmagic 原生采集",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "Blackmagic 原生擷取",
"en": "Blackmagic native capture",
"ja": "Blackmagic ネイティブキャプチャ"
},
{
"zh": "CBR/VBR 需要指定码率",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/QmlPlayerBridge_p.h",
"zh-TW": "CBR/VBR 需要指定位元率",
"en": "CBR/VBR needs a bitrate",
"ja": "CBR/VBR にはビットレートの指定が必要です"
@@ -926,7 +926,7 @@
},
{
"zh": "CPU 软件",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "CPU 軟體",
"en": "CPU software",
"ja": "CPU ソフトウェア"
@@ -947,14 +947,14 @@
},
{
"zh": "Cube LUT (*.cube);;所有文件 (*.*)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "Cube LUT (*.cube);;所有檔案 (*.*)",
"en": "Cube LUT (*.cube);;All files (*.*)",
"ja": "Cube LUT (*.cube);;すべてのファイル (*.*)"
},
{
"zh": "D3D12VA 硬件",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "D3D12VA 硬體",
"en": "D3D12VA hardware",
"ja": "D3D12VA ハードウェア"
@@ -968,7 +968,7 @@
},
{
"zh": "DLSS 帧生成",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "DLSS 幀生成",
"en": "DLSS Frame Generation",
"ja": "DLSS フレーム生成"
@@ -989,14 +989,14 @@
},
{
"zh": "DXGI 为显示器兼容方式,无鼠标指针;捕获显示器时不显示黄色边框,Veyra 自己也不会出现在截图和录屏里",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "DXGI 為顯示器相容方式,無滑鼠指標;擷取顯示器時不顯示黃色邊框,Veyra 自己也不會出現在截圖和錄影裡",
"en": "DXGI is the display-compatible mode, without the mouse pointer. A display capture shows no yellow border, and Veyra itself stays out of screenshots and recordings",
"ja": "DXGI はディスプレイ互換モードで、マウスポインターは映りません。ディスプレイのキャプチャでは黄色い枠を表示せず、Veyra 自身もスクリーンショットや録画に映りません"
},
{
"zh": "Dolby / DTS 位流",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "Dolby / DTS 位流",
"en": "Dolby / DTS bitstream",
"ja": "Dolby / DTS ビットストリーム"
@@ -1031,7 +1031,7 @@
},
{
"zh": "FSR 3.1 / 4 · 自动兼容",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Hardware.cpp",
"zh-TW": "FSR 3.1 / 4 · 自動相容",
"en": "FSR 3.1 / 4 · Automatic compatibility",
"ja": "FSR 3.1 / 4 · 自動互換"
@@ -1045,14 +1045,14 @@
},
{
"zh": "FSR 3.1 跨厂商补帧 · 最高 2X",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "FSR 3.1 跨廠商補幀 · 最高 2X",
"en": "FSR 3.1 cross-vendor frame generation · up to 2X",
"ja": "FSR 3.1 ベンダー共通フレーム生成 · 最大 2X"
},
{
"zh": "FSR 4 ML · RX 9000 · 实验",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "FSR 4 ML · RX 9000 · 實驗",
"en": "FSR 4 ML · RX 9000 · experimental",
"ja": "FSR 4 ML · RX 9000 · 実験的"
@@ -1073,14 +1073,14 @@
},
{
"zh": "FSR 4 ML 补帧只支持 AMD RX 9000 显卡,当前显卡不能使用,已保持原来的补帧方式",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "FSR 4 ML 補幀只支援 AMD RX 9000 顯示卡,當前顯示卡不能使用,已保持原來的補幀方式",
"en": "FSR 4 ML frame generation only supports AMD RX 9000 GPUs; this GPU cannot use it, so the current frame generation is kept",
"ja": "FSR 4 ML のフレーム生成は AMD RX 9000 のみ対応です。この GPU では使えないため、現在のフレーム生成方式のままにしました"
},
{
"zh": "FSR 4 ML 需要支持的 RX 9000 和驱动;实卡待验",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "FSR 4 ML 需要支援的 RX 9000 和驅動;實卡待驗",
"en": "FSR 4 ML needs a supported RX 9000 and driver; not yet tested on real cards",
"ja": "FSR 4 ML には対応する RX 9000 とドライバーが必要です。実機での検証は未完了です"
@@ -1122,14 +1122,14 @@
},
{
"zh": "GPU 光流",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "GPU 光流",
"en": "GPU optical flow",
"ja": "GPU オプティカルフロー"
},
{
"zh": "GPU 占用",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPerfOrbs.qml",
"zh-TW": "GPU 占用",
"en": "GPU usage",
"ja": "GPU 使用率"
@@ -1192,21 +1192,21 @@
},
{
"zh": "HDR 亮度曲线",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "HDR 亮度曲線",
"en": "HDR brightness curve",
"ja": "HDR 輝度カーブ"
},
{
"zh": "HDR 元数据",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "HDR 中繼資料",
"en": "HDR metadata",
"ja": "HDR メタデータ"
},
{
"zh": "HDR 片源也按 SDR 显示;与采集卡的“转为 SDR 显示”是同一设置",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "HDR 片源也按 SDR 顯示;與擷取卡的“轉為 SDR 顯示”是同一設定",
"en": "HDR sources are shown as SDR too; the same setting as the capture card's \"Show as SDR\"",
"ja": "HDR ソースも SDR で表示します。キャプチャーカードの「SDR で表示」と同じ設定です"
@@ -1241,14 +1241,14 @@
},
{
"zh": "HDR 输出格式",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "HDR 輸出格式",
"en": "HDR output format",
"ja": "HDR 出力形式"
},
{
"zh": "HDR 需要 PS5 实际输出 HDR 且 Windows HDR 开启",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "HDR 需要 PS5 實際輸出 HDR 且 Windows HDR 開啟",
"en": "HDR needs the PS5 to actually output HDR and Windows HDR to be on",
"ja": "HDR には PS5 が実際に HDR を出力し、Windows の HDR がオンである必要があります"
@@ -1262,7 +1262,7 @@
},
{
"zh": "HDR10 提示;系统或显示器可能忽略,让它的动态色调映射有依据。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "HDR10 提示;系統或顯示器可能忽略,讓其動態色調映射有依據。",
"en": "HDR10 hints for dynamic tone mapping; the system or display may ignore them.",
"ja": "HDR10 のトーンマッピング用ヒントです。システムやディスプレイに無視される場合があります。"
@@ -1311,14 +1311,14 @@
},
{
"zh": "IP 或主机名,端口不是 47989 时写成 192.168.1.20:47989",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "IP 或主機名,端口不是 47989 時寫成 192.168.1.20:47989",
"en": "IP or host name; if the port is not 47989, write it as 192.168.1.20:47989",
"ja": "IP またはホスト名。ポートが 47989 以外なら 192.168.1.20:47989 の形式で入力"
},
{
"zh": "Intel XeSS · 实验",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "Intel XeSS · 實驗",
"en": "Intel XeSS · experimental",
"ja": "Intel XeSS · 実験的"
@@ -1339,21 +1339,21 @@
},
{
"zh": "LUT 不可用:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "LUT 不可用:%1",
"en": "LUT unavailable: %1",
"ja": "LUT を使用できません:%1"
},
{
"zh": "LUT 名称过长",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "LUT 名稱過長",
"en": "LUT name is too long",
"ja": "LUT 名が長すぎます"
},
{
"zh": "LUT 导入失败:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "LUT 匯入失敗:%1",
"en": "LUT import failed: %1",
"ja": "LUT の読み込みに失敗しました:%1"
@@ -1374,7 +1374,7 @@
},
{
"zh": "LUT 强度",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "LUT 強度",
"en": "LUT strength",
"ja": "LUT の強度"
@@ -1388,7 +1388,7 @@
},
{
"zh": "Limited = 16–235,Full = 0–255。画面发灰选「有限」,暗部全黑、亮部过曝选「完全」",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "Limited = 16–235,Full = 0–255。畫面發灰選「有限」,暗部全黑、亮部過曝選「完全」",
"en": "Limited = 16–235, Full = 0–255. If the picture looks washed out choose Limited; if shadows crush to black and highlights blow out choose Full",
"ja": "Limited = 16–235、Full = 0–255。映像が白っぽいなら「Limited」、暗部が黒つぶれ・明部が白飛びするなら「Full」"
@@ -1444,7 +1444,7 @@
},
{
"zh": "NR 保护区域仅在列表模式可用",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "NR 保護區域僅在列表模式可用",
"en": "NR protected areas are available in list mode only",
"ja": "NR 保護領域はリストモードでのみ使えます"
@@ -1465,14 +1465,14 @@
},
{
"zh": "NR 层 ",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ProPage.qml",
"zh-TW": "NR 層 ",
"en": "NR layer ",
"ja": "NR 層 "
},
{
"zh": "NR 求值 %1 / NVOF %2",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "NR 求值 %1 / NVOF %2",
"en": "NR evaluate %1 / NVOF %2",
"ja": "NR 評価 %1 / NVOF %2"
@@ -1493,42 +1493,42 @@
},
{
"zh": "NR 画面增强 · 第 %1 层",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "NR 畫面增強 · 第 %1 層",
"en": "NR enhancement · layer %1",
"ja": "NR 画質補正 · 第 %1 層"
},
{
"zh": "NR 第1层",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "NR 第1層",
"en": "NR layer 1",
"ja": "NR 第 1 層"
},
{
"zh": "NR 第2层",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "NR 第2層",
"en": "NR layer 2",
"ja": "NR 第 2 層"
},
{
"zh": "NR 第3层",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "NR 第3層",
"en": "NR layer 3",
"ja": "NR 第 3 層"
},
{
"zh": "NR 第4层",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "NR 第4層",
"en": "NR layer 4",
"ja": "NR 第 4 層"
},
{
"zh": "NR 自动 %1% · %2×%3",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "NR 自動 %1% · %2×%3",
"en": "Auto NR %1% · %2×%3",
"ja": "NR 自動 %1% · %2×%3"
@@ -1549,7 +1549,7 @@
},
{
"zh": "NR采样",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "NR取樣",
"en": "NR",
"ja": "NR"
@@ -1570,7 +1570,7 @@
},
{
"zh": "NVIDIA RTX 补帧;倍率以运行库实际能力为准",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "NVIDIA RTX 補幀;倍率以執行庫實際能力為準",
"en": "NVIDIA RTX frame generation; the multiplier depends on what the runtime supports",
"ja": "NVIDIA RTX のフレーム生成。倍率はランタイムの実際の対応範囲によります"
@@ -1591,7 +1591,7 @@
},
{
"zh": "NVIDIA 新增的性能模式(测试版):补帧更省 GPU,高倍率更稳,画质可能略降;导出仍用标准模式",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "NVIDIA 新增的效能模式(測試版):補幀更省 GPU,高倍率更穩,畫質可能略降;匯出仍用標準模式",
"en": "NVIDIA's new performance mode (beta): frame generation uses less GPU and holds high multipliers better, possibly at slightly lower quality; export keeps the standard mode",
"ja": "NVIDIA の新しいパフォーマンスモード(ベータ):フレーム生成の GPU 負荷が減り高倍率でも安定、画質はやや落ちる場合あり。書き出しは標準モードのまま"
@@ -1633,7 +1633,7 @@
},
{
"zh": "PC 串流 · %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "PC 串流 · %1",
"en": "PC streaming · %1",
"ja": "PC ストリーミング · %1"
@@ -1647,7 +1647,7 @@
},
{
"zh": "PNG 图片 (*.png);;JPEG 图片 (*.jpg)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "PNG 圖片 (*.png);;JPEG 圖片 (*.jpg)",
"en": "PNG image (*.png);;JPEG image (*.jpg)",
"ja": "PNG 画像 (*.png);;JPEG 画像 (*.jpg)"
@@ -1661,7 +1661,7 @@
},
{
"zh": "PS5 串流 · %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "PS5 串流 · %1",
"en": "PS5 streaming · %1",
"ja": "PS5 ストリーミング · %1"
@@ -1682,7 +1682,7 @@
},
{
"zh": "PS5 串流已停止,可以重新连接。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "PS5 串流已停止,可以重新連接。",
"en": "PS5 streaming stopped; you can reconnect.",
"ja": "PS5 ストリーミングを停止しました。再接続できます。"
@@ -1717,14 +1717,14 @@
},
{
"zh": "PS5 主机",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "PS5 主機",
"en": "PS5 console",
"ja": "PS5 本体"
},
{
"zh": "PS5 仍会发一路 720p 30fps、约 5 Mbps 的保活画面,本机收到即丢弃;PS5 同一时间只允许一个远程游玩连接。再串流时记得打开上面的「音频监听」。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "PS5 仍會發一路 720p 30fps、約 5 Mbps 的保活畫面,本機收到即丟棄;PS5 同一時間只允許一個遠程遊玩連線。再串流時記得打開上面的「音訊監聽」。",
"en": "The PS5 still sends a 720p 30 fps keepalive picture of about 5 Mbps, which this PC drops on arrival. A PS5 allows one Remote Play connection at a time. When re-streaming, turn on Audio monitoring above.",
"ja": "PS5 は 720p 30fps・約 5 Mbps の維持用映像を送り続けますが、この PC は受け取ってすぐ破棄します。PS5 のリモートプレイ接続は同時に 1 つだけです。再ストリーミングするときは上の「音声モニター」をオンにしてください。"
@@ -1752,7 +1752,7 @@
},
{
"zh": "PS5 手柄控制",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "PS5 手把控制",
"en": "PS5 controller control",
"ja": "PS5 コントローラー操作"
@@ -1766,21 +1766,21 @@
},
{
"zh": "PS5 手柄控制已停止",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "PS5 手把控制已停止",
"en": "PS5 controller control stopped",
"ja": "PS5 コントローラー操作を停止しました"
},
{
"zh": "PS5 手柄控制已连接",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "PS5 手把控制已連接",
"en": "PS5 controller control connected",
"ja": "PS5 コントローラー操作に接続しました"
},
{
"zh": "PS5 手柄控制已连接 · 保活画面 %1 fps(收到即丢弃)",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "PS5 手把控制已連接 · 保活畫面 %1 fps(收到即丟棄)",
"en": "PS5 controller control connected · keepalive picture %1 fps (dropped on arrival)",
"ja": "PS5 コントローラー操作に接続しました · 維持用映像 %1 fps(受信後すぐ破棄)"
@@ -1794,7 +1794,7 @@
},
{
"zh": "PS5 手柄控制设置保存失败",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "PS5 手把控制設定儲存失敗",
"en": "PS5 controller control setting could not be saved",
"ja": "PS5 コントローラー操作の設定を保存できませんでした"
@@ -1808,21 +1808,21 @@
},
{
"zh": "PS5 手柄控制:还没有配对的 PS5,先在「PS5 串流」里配对一次",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "PS5 手把控制:還沒有配對的 PS5,先在「PS5 串流」裡配對一次",
"en": "PS5 controller control: no PS5 is paired yet. Pair one once under PS5 streaming",
"ja": "PS5 コントローラー操作:ペアリング済みの PS5 がありません。先に「PS5 ストリーミング」で一度ペアリングしてください"
},
{
"zh": "PS5 提示时填写",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "PS5 提示時填寫",
"en": "Fill in when the PS5 asks",
"ja": "PS5 に求められたときに入力"
},
{
"zh": "PS5 提示时填写,不是 8 位配对码",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "PS5 提示時填寫,不是 8 位配對碼",
"en": "Enter it when the PS5 asks; not the 8-digit pairing code",
"ja": "PS5 に求められたら入力します。8 桁のペアリングコードではありません"
@@ -1843,14 +1843,14 @@
},
{
"zh": "PS5 画面已进入播放;关闭此面板不停止串流。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "PS5 畫面已進入播放;關閉此面板不停止串流。",
"en": "The PS5 picture is playing; closing this panel does not stop streaming.",
"ja": "PS5 の映像を再生中です。このパネルを閉じてもストリーミングは止まりません。"
},
{
"zh": "PS5 的 HDMI 接了采集卡时,可以只用远程游玩传手柄、画面用采集卡原画(可 4K/HDR),也方便再串流给掌机",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "PS5 的 HDMI 接了擷取卡時,可以只用遠程遊玩傳手把、畫面用擷取卡原畫(可 4K/HDR),也方便再串流給掌機",
"en": "With the PS5 HDMI on a capture card, Remote Play can carry only the controller while the picture comes from the capture card (4K/HDR possible), which also suits re-streaming to a handheld",
"ja": "PS5 の HDMI をキャプチャーカードにつないでいる場合、リモートプレイはコントローラーだけを送り、映像はキャプチャーカードの元映像(4K/HDR 可)を使えます。携帯機への再ストリーミングにも便利です"
@@ -1864,28 +1864,28 @@
},
{
"zh": "PS5 要求输入登录 PIN",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "PS5 要求輸入登入 PIN",
"en": "The PS5 asks for the sign-in PIN",
"ja": "PS5 がサインイン PIN を求めています"
},
{
"zh": "PS5 要求输入登录 PIN:在采集卡面板「PS5 手柄控制」里填写",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "PS5 要求輸入登入 PIN:在擷取卡面板「PS5 手把控制」裡填寫",
"en": "The PS5 asks for the sign-in PIN: enter it under PS5 controller control in the capture card panel",
"ja": "PS5 がサインイン PIN を求めています:キャプチャーカードパネルの「PS5 コントローラー操作」で入力してください"
},
{
"zh": "PS5 设置 → 系统 → 远程游玩 → 关联设备",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "PS5 設定 → 系統 → 遠程遊玩 → 關聯裝置",
"en": "PS5 Settings → System → Remote Play → Link Device",
"ja": "PS5 の 設定 → システム → リモートプレイ → 機器を登録する"
},
{
"zh": "PS5 设置 → 网络 → 连接状态;找不到时可手填 IP",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "PS5 設定 → 網路 → 連接狀態;找不到時可手填 IP",
"en": "PS5 Settings → Network → Connection Status; if it is not found, enter the IP by hand",
"ja": "PS5 の 設定 → ネットワーク → 接続状況。見つからない場合は IP を手入力"
@@ -1899,28 +1899,28 @@
},
{
"zh": "PSN 授权失败({});原有配对不受影响,可重新登录。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "PSN 授權失敗({});原有配對不受影響,可重新登入。",
"en": "PSN authorization failed ({}); existing pairing is unaffected, you can sign in again.",
"ja": "PSN の認証に失敗しました({})。既存のペアリングには影響ありません。再度サインインできます。"
},
{
"zh": "PSN 授权已删除,局域网配对保留。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "PSN 授權已刪除,區域網路配對保留。",
"en": "PSN authorization removed; LAN pairing kept.",
"ja": "PSN の認証を削除しました。LAN のペアリングは保持されます。"
},
{
"zh": "PSN 登录已保存,Account ID 已填入。首次仍需配对;已配对主机直接连接。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "PSN 登入已儲存,Account ID 已填入。首次仍需配對;已配對主機直接連接。",
"en": "PSN sign-in saved and the Account ID filled in. First use still needs pairing; paired consoles connect directly.",
"ja": "PSN のサインインを保存し、Account ID を入力しました。初回はペアリングが必要です。ペアリング済みの本体はそのまま接続できます。"
},
{
"zh": "PSN 账号",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "PSN 帳號",
"en": "PSN account",
"ja": "PSN アカウント"
@@ -1997,7 +1997,7 @@
},
{
"zh": "SDK 提交",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "SDK 提交",
"en": "SDK submit",
"ja": "SDK 送信"
@@ -2025,7 +2025,7 @@
},
{
"zh": "SDR 片源没有 HDR 亮度元数据;可手动选档,HDR 输出时生效。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "SDR 片源沒有 HDR 亮度元資料;可手動選檔,HDR 輸出時生效。",
"en": "SDR sources have no HDR luminance metadata. Choose a preset manually; it applies to HDR output.",
"ja": "SDR ソースには HDR 輝度メタデータがありません。手動でプリセットを選ぶと HDR 出力に適用されます。"
@@ -2067,21 +2067,21 @@
},
{
"zh": "VFG 中间帧约 %1 ms、其余每张约 %2 ms,当前负载约可稳定 %3X",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "VFG 中間影格約 %1 ms、其餘每張約 %2 ms,目前負載約可穩定 %3X",
"en": "VFG takes about %1 ms for the middle frame and %2 ms for each other frame; about %3X holds at the current load",
"ja": "VFG は中央の 1 枚が約 %1 ms、その他は 1 枚あたり約 %2 ms、現在の負荷で安定するのは約 %3X"
},
{
"zh": "VFG 支持 2X~8X 和低 / 中 / 高质量;6X~8X 为实验档,高倍高质量会增加处理时间",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "VFG 支援 2X~8X 和低 / 中 / 高品質;6X~8X 為實驗檔,高倍高品質會增加處理時間",
"en": "VFG supports 2X–8X and Low / Medium / High quality. 6X–8X are experimental; higher multipliers and quality take more processing time.",
"ja": "VFG は 2X~8X と低 / 中 / 高品質に対応します。6X~8X は実験設定です。倍率や品質を上げると処理時間が増えます。"
},
{
"zh": "VFG 每张约 %1 ms,当前负载约可稳定 %2X",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "VFG 每張約 %1 ms,目前負載約可穩定 %2X",
"en": "VFG takes about %1 ms per frame; about %2X holds at the current load",
"ja": "VFG は 1 枚あたり約 %1 ms、現在の負荷で安定するのは約 %2X"
@@ -2095,14 +2095,14 @@
},
{
"zh": "VFG 质量设置未被接受,原设置保留",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "VFG 品質設定未被接受,原設定保留",
"en": "VFG quality was not accepted; the previous setting was kept.",
"ja": "VFG 品質設定が拒否されたため、前の設定を保持しました。"
},
{
"zh": "VFG 需要 NVIDIA Ada / Blackwell 显卡(RTX 40 / 50)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "VFG 需要 NVIDIA Ada / Blackwell 顯示卡(RTX 40 / 50)",
"en": "VFG requires an NVIDIA Ada / Blackwell GPU (RTX 40 / 50).",
"ja": "VFG には NVIDIA Ada / Blackwell GPU(RTX 40 / 50)が必要です。"
@@ -2123,28 +2123,28 @@
},
{
"zh": "Veyra 预设 (*.vpreset)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "Veyra 預設 (*.vpreset)",
"en": "Veyra preset (*.vpreset)",
"ja": "Veyra プリセット (*.vpreset)"
},
{
"zh": "Veyra 预设 (*.vpreset);;所有文件 (*)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "Veyra 預設 (*.vpreset);;所有檔案 (*)",
"en": "Veyra preset (*.vpreset);;All files (*)",
"ja": "Veyra プリセット (*.vpreset);;すべてのファイル (*)"
},
{
"zh": "Veyra 颜色预设 (*.vpcolor)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "Veyra 顏色預設 (*.vpcolor)",
"en": "Veyra color preset (*.vpcolor)",
"ja": "Veyra カラープリセット (*.vpcolor)"
},
{
"zh": "Veyra 颜色预设 (*.vpcolor);;所有文件 (*.*)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "Veyra 顏色預設 (*.vpcolor);;所有檔案 (*.*)",
"en": "Veyra color preset (*.vpcolor);;All files (*.*)",
"ja": "Veyra カラープリセット (*.vpcolor);;すべてのファイル (*.*)"
@@ -2200,7 +2200,7 @@
},
{
"zh": "Windows GPU 引擎占用率(",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPerfOrbs.qml",
"zh-TW": "Windows GPU 引擎占用率(",
"en": "Windows GPU engine usage (",
"ja": "Windows の GPU エンジン使用率("
@@ -2221,7 +2221,7 @@
},
{
"zh": "Xbox 串流 · %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "Xbox 串流 · %1",
"en": "Xbox streaming · %1",
"ja": "Xbox ストリーミング · %1"
@@ -2396,7 +2396,7 @@
},
{
"zh": "Z / X 微调 50 ms,Shift 为 1 s;正值 = 字幕推后",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "Z / X 微調 50 ms,Shift 為 1 s;正值 = 字幕推後",
"en": "Z / X nudge by 50 ms, with Shift 1 s; positive = subtitles later",
"ja": "Z / X で 50 ms、Shift 併用で 1 s 調整。正の値 = 字幕を遅らせる"
@@ -2417,7 +2417,7 @@
},
{
"zh": "scRGB 浮点",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "scRGB 浮點",
"en": "scRGB float",
"ja": "scRGB 浮動小数点"
@@ -2473,7 +2473,7 @@
},
{
"zh": "一键推荐",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "一鍵推薦",
"en": "Recommend",
"ja": "おすすめ"
@@ -2494,7 +2494,7 @@
},
{
"zh": "一键选档",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "一鍵選檔",
"en": "Quick presets",
"ja": "簡単プリセット"
@@ -2543,35 +2543,35 @@
},
{
"zh": "上次的捕获目标「%1」已不在,请重新选择",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "上次的擷取目標「%1」已不在,請重新選擇",
"en": "The last capture target \"%1\" is gone; choose again",
"ja": "前回のキャプチャー対象「%1」が見つかりません。選び直してください"
},
{
"zh": "上次的视频文件不存在:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "上次的影片檔案不存在:%1",
"en": "The previous video file does not exist: %1",
"ja": "前回の動画ファイルが見つかりません:%1"
},
{
"zh": "上次的采集格式不可用,请在采集卡面板重新选择",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "上次的擷取格式不可用,請在擷取卡面板重新選擇",
"en": "The last capture format is not available; choose again in the capture card panel",
"ja": "前回のキャプチャーフォーマットは使用できません。キャプチャーカードのパネルで選び直してください"
},
{
"zh": "上次的音频输入未连接",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "上次的音訊輸入未連接",
"en": "Previous audio input is disconnected",
"ja": "前回の音声入力が接続されていません"
},
{
"zh": "上次的音频输入未连接,请插回设备或重新选择音频监听",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "上次的音訊輸入未連接,請重新插入裝置或選擇音訊監聽",
"en": "The previous audio input is disconnected. Reconnect it or select an audio input",
"ja": "前回の音声入力が接続されていません。再接続するか音声入力を選び直してください"
@@ -2585,7 +2585,7 @@
},
{
"zh": "上次采集设备未连接。插回后刷新,或手动选择其他设备。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "上次擷取裝置未連接。插回後刷新,或手動選擇其他裝置。",
"en": "The last capture device is not connected. Plug it back in and refresh, or choose another device.",
"ja": "前回のキャプチャーデバイスが接続されていません。差し直して更新するか、別のデバイスを選んでください。"
@@ -2599,21 +2599,21 @@
},
{
"zh": "上限 %1 nit 未被触及(滚降区 %2% · 暗部提升区 %3%)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "上限 %1 nit 未被觸及(滾降區 %2% · 暗部提升區 %3%)",
"en": "Cap %1 nit not reached (highlight compression %2% · shadow lift %3%)",
"ja": "上限 %1 nit 未到達(ハイライト圧縮 %2% · 暗部持ち上げ %3%)"
},
{
"zh": "上限覆盖片源标注峰值;处理后的画面以抽样读数为准",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "上限覆蓋片源標注峰值;處理後的畫面以抽樣讀數為準",
"en": "The cap covers the declared source peak; check the sample reading for the processed image",
"ja": "上限はソースの公称ピーク以上です。処理後の映像はサンプル値で確認してください。"
},
{
"zh": "上面选“自动”时仍用性能最强的显卡;选一块显卡后它也负责运算",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "上面選「自動」時仍用效能最強的顯示卡;選一塊顯示卡後它也負責運算",
"en": "With \"Auto\" above, the most powerful GPU is still used; pick a GPU above to compute on it too",
"ja": "上で「自動」の場合は最も高性能な GPU を使用。GPU を選ぶとその GPU で処理も行います"
@@ -2634,7 +2634,7 @@
},
{
"zh": "下次启动软件时自动应用这个预设",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "下次啟動軟體時自動應用這個預設",
"en": "Apply this preset automatically the next time the app starts",
"ja": "次回起動時にこのプリセットを自動適用"
@@ -2648,14 +2648,14 @@
},
{
"zh": "下载 %1 MB/s",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "下載 %1 MB/s",
"en": "Download %1 MB/s",
"ja": "ダウンロード %1 MB/s"
},
{
"zh": "下载 —",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "下載 —",
"en": "Download —",
"ja": "ダウンロード —"
@@ -2676,28 +2676,28 @@
},
{
"zh": "不可用",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "不可用",
"en": "Unavailable",
"ja": "使用不可"
},
{
"zh": "不向 PS5 转发电脑手柄输入",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "不向 PS5 轉發電腦手把輸入",
"en": "Don't forward this PC's controller input to the PS5",
"ja": "この PC のコントローラー入力を PS5 に転送しない"
},
{
"zh": "不支持",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "不支援",
"en": "Not supported",
"ja": "非対応"
},
{
"zh": "不是 8 位配对码",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "不是 8 位配對碼",
"en": "Not an 8-digit pairing code",
"ja": "8 桁のペアリングコードではありません"
@@ -2725,14 +2725,14 @@
},
{
"zh": "不监听音频",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "不監聽音訊",
"en": "Don't monitor audio",
"ja": "音声をモニターしない"
},
{
"zh": "不确定就选「自动」。采集 HDR:采集格式选 P010,这里选「HDR · PQ」(游戏机、显卡的 HDR10 都是 PQ)。「HDR · HLG」用于广播信号。「SDR · 709」是普通画面。变更需重连",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "不確定就選「自動」。擷取 HDR:擷取格式選 P010,這裡選「HDR · PQ」(遊戲機、顯示卡的 HDR10 都是 PQ)。「HDR · HLG」用於廣播信號。「SDR · 709」是普通畫面。變更需重連",
"en": "If unsure, choose Auto. To capture HDR: pick P010 as the capture format and HDR · PQ here (HDR10 from consoles and GPUs is PQ). HDR · HLG is for broadcast signals. SDR · 709 is a normal picture. Changes need a reconnect",
"ja": "わからなければ「自動」を選んでください。HDR をキャプチャーする場合:フォーマットに P010 を選び、ここでは「HDR · PQ」を選択(ゲーム機や GPU の HDR10 は PQ)。「HDR · HLG」は放送信号用、「SDR · 709」は通常の映像です。変更には再接続が必要です"
@@ -2746,7 +2746,7 @@
},
{
"zh": "不补偿",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "不補償",
"en": "No compensation",
"ja": "補正なし"
@@ -2795,21 +2795,21 @@
},
{
"zh": "丢包 %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "丟包 %1",
"en": "Lost %1",
"ja": "パケット損失 %1"
},
{
"zh": "两台电脑接在同一个局域网,这里会自动出现;也可以在下面手填它的 IP。首次使用需要配对。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "兩台電腦接在同一個區域網路,這裡會自動出現;也可以在下面手填它的 IP。首次使用需要配對。",
"en": "With both PCs on the same LAN, the host appears here automatically; you can also enter its IP below. Pairing is needed the first time.",
"ja": "2 台の PC が同じ LAN にあれば自動でここに表示されます。下で IP を手入力することもできます。初回はペアリングが必要です。"
},
{
"zh": "两头极端",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "兩頭極端",
"en": "Dark and bright",
"ja": "明暗が極端"
@@ -2872,7 +2872,7 @@
},
{
"zh": "中灰 (nit)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "中灰 (nit)",
"en": "Mid-gray (nit)",
"ja": "中間調 (nit)"
@@ -2907,7 +2907,7 @@
},
{
"zh": "串流你自己的 Xbox 主机 · 非官方实验功能 · 增强与调色沿用软件自己的处理链",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "串流你自己的 Xbox 主機 · 非官方實驗功能 · 增強與調色沿用軟體自己的處理鏈",
"en": "Stream your own Xbox console · unofficial, experimental · enhancement and color use this app's own pipeline",
"ja": "自分の Xbox 本体をストリーミング · 非公式の実験機能 · 補正とカラー調整はこのアプリの処理を使用"
@@ -2921,7 +2921,7 @@
},
{
"zh": "串流另一台电脑(Sunshine 主机)· 增强与调色沿用软件自己的处理链",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "串流另一台電腦(Sunshine 主機)· 增強與調色沿用軟體自己的處理鏈",
"en": "Stream another PC (Sunshine host) · enhancement and color use this app's own pipeline",
"ja": "別の PC(Sunshine ホスト)をストリーミング · 補正とカラー調整はこのアプリの処理を使用"
@@ -2949,7 +2949,7 @@
},
{
"zh": "串流设置(只影响串流本身,按主机保存)",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "串流設定(只影響串流本身,按主機儲存)",
"en": "Streaming settings (affect only the stream itself; saved per host)",
"ja": "ストリーミング設定(ストリーミング自体にのみ影響、ホストごとに保存)"
@@ -2963,7 +2963,7 @@
},
{
"zh": "串流(重连生效)",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "串流(重連生效)",
"en": "Streaming (applies on reconnect)",
"ja": "ストリーミング(再接続で反映)"
@@ -2977,35 +2977,35 @@
},
{
"zh": "主字幕",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "主字幕",
"en": "Main subtitles",
"ja": "メイン字幕"
},
{
"zh": "主字幕已关闭",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "主字幕已關閉",
"en": "Main subtitles are off",
"ja": "メイン字幕はオフです"
},
{
"zh": "主字幕延时",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "主字幕延時",
"en": "Main subtitle delay",
"ja": "メイン字幕の遅延"
},
{
"zh": "主字幕:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "主字幕:%1",
"en": "Main subtitles: %1",
"ja": "メイン字幕:%1"
},
{
"zh": "主机",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "主機",
"en": "Host",
"ja": "ホスト"
@@ -3019,7 +3019,7 @@
},
{
"zh": "主机上有游戏在运行。断开串流不会结束它;选它并开始即可继续。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "主機上有遊戲在執行。斷開串流不會結束它;選它並開始即可繼續。",
"en": "A game is running on the host. Disconnecting does not end it; select it and start to continue.",
"ja": "ホストでゲームが実行中です。切断しても終了しません。選んで開始すると続きから再開できます。"
@@ -3096,21 +3096,21 @@
},
{
"zh": "主机列表",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "主機列表",
"en": "Hosts",
"ja": "ホスト一覧"
},
{
"zh": "主机同时出声",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "主機同時出聲",
"en": "Also play sound on the host",
"ja": "ホストでも音を出す"
},
{
"zh": "主机地址",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "主機地址",
"en": "Host address",
"ja": "ホストのアドレス"
@@ -3138,14 +3138,14 @@
},
{
"zh": "主机按这个尺寸编码;软件的超分与增强在收到之后再做",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "主機按這個尺寸編碼;軟體的超解析與增強在收到之後再做",
"en": "The host encodes at this size; the app's super resolution and enhancement run after the stream arrives",
"ja": "ホストはこのサイズでエンコードします。アプリの超解像と補正は受信後に行います"
},
{
"zh": "主机搜索发生错误({}),详情见日志;可手填 IP。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "主機搜索發生錯誤({}),詳情見日誌;可手填 IP。",
"en": "Host search hit an error ({}); details in the log. You can enter the IP by hand.",
"ja": "ホストの検索でエラーが発生しました({})。詳細はログを参照してください。IP を手入力することもできます。"
@@ -3194,7 +3194,7 @@
},
{
"zh": "主机现在连不上(离线、休眠,或地址变了)。开机后点「刷新」。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "主機現在連不上(離線、休眠,或地址變了)。開機後點「刷新」。",
"en": "The host cannot be reached right now (offline, asleep, or its address changed). Turn it on and click Refresh.",
"ja": "現在ホストに接続できません(オフライン、スリープ中、またはアドレスが変わった)。電源を入れて「更新」を押してください。"
@@ -3215,7 +3215,7 @@
},
{
"zh": "主机要用同一个账号登录,并在 设置 → 设备和连接 → 远程功能 里启用远程功能",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "主機要用同一個帳號登入,並在 設定 → 裝置和連接 → 遠程功能 裡啟用遠程功能",
"en": "The console must be signed in with the same account, with remote features enabled under Settings → Devices & connections → Remote features",
"ja": "本体は同じアカウントでサインインし、設定 → デバイスと接続 → リモート機能 でリモート機能を有効にする必要があります"
@@ -3285,7 +3285,7 @@
},
{
"zh": "亮度分布均衡",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "亮度分布均衡",
"en": "Balanced brightness",
"ja": "バランスのよい輝度分布"
@@ -3320,7 +3320,7 @@
},
{
"zh": "人脸识别",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "人臉識別",
"en": "Face detection",
"ja": "顔検出"
@@ -3348,7 +3348,7 @@
},
{
"zh": "仅接受驱动尺寸范围与步进支持的值;连接时核对实际格式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "僅接受驅動尺寸範圍與步進支援的值;連線時核對實際格式",
"en": "Only sizes within driver bounds and granularity are accepted; the actual format is checked on connection",
"ja": "ドライバーのサイズ範囲と刻みに合う値のみ使用できます。実際の形式は接続時に確認します"
@@ -3376,14 +3376,14 @@
},
{
"zh": "仅美乐威 Pro Capture(PCIe 内置卡)可用;USB Capture 系列不支持",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "僅美樂威 Pro Capture(PCIe 內建卡)可用;USB Capture 系列不支援",
"en": "Magewell Pro Capture (PCIe) only; the USB Capture series is not supported",
"ja": "Magewell Pro Capture(PCIe 内蔵カード)のみ対応。USB Capture シリーズは非対応"
},
{
"zh": "仅观看",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "僅觀看",
"en": "View only",
"ja": "視聴のみ"
@@ -3418,14 +3418,14 @@
},
{
"zh": "会压缩",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "會壓縮",
"en": "Compression needed",
"ja": "圧縮が必要"
},
{
"zh": "位流优先",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "位流優先",
"en": "Bitstream first",
"ja": "ビットストリーム優先"
@@ -3460,7 +3460,7 @@
},
{
"zh": "低延迟 NR 先行时,“增强前底图”是原图缩放,不是独立超分对照",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "低延遲 NR 先行時,“增強前底圖”是原圖縮放,不是獨立超解析對照",
"en": "With low-latency NR first, \"before enhancement\" is the original scaled up, not a separate super-resolution reference",
"ja": "低遅延(NR 先行)時の「補正前」は元映像の拡大で、超解像の比較対象ではありません"
@@ -3495,7 +3495,7 @@
},
{
"zh": "低延迟队列 · 当前未生效",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "低延遲佇列 · 目前未生效",
"en": "Low-latency queue · currently inactive",
"ja": "低遅延キュー · 現在無効"
@@ -3537,7 +3537,7 @@
},
{
"zh": "例如:夜间游戏",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "例如:夜間遊戲",
"en": "e.g. Night gaming",
"ja": "例:夜のゲーム"
@@ -3558,14 +3558,14 @@
},
{
"zh": "保存到",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "儲存到",
"en": "Save to",
"ja": "保存先"
},
{
"zh": "保存后设为启动默认",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "儲存後設為啟動預設",
"en": "Make it the startup default after saving",
"ja": "保存後に起動時の既定にする"
@@ -3579,7 +3579,7 @@
},
{
"zh": "保存失败:名称可能已存在",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "儲存失敗:名稱可能已存在",
"en": "Save failed: the name may already exist",
"ja": "保存に失敗しました:同じ名前が既にある可能性があります"
@@ -3614,28 +3614,28 @@
},
{
"zh": "保存超时",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "儲存超時",
"en": "Save timed out",
"ja": "保存がタイムアウトしました"
},
{
"zh": "保存连接设置失败,请检查目录权限。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "儲存連接設定失敗,請檢查目錄權限。",
"en": "Could not save the connection settings; check folder permissions.",
"ja": "接続設定を保存できませんでした。フォルダーの権限を確認してください。"
},
{
"zh": "保存预设",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "儲存預設",
"en": "Save preset",
"ja": "プリセットを保存"
},
{
"zh": "保存预设失败: %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "儲存預設失敗: %1",
"en": "Failed to save preset: %1",
"ja": "プリセットの保存に失敗しました:%1"
@@ -3719,7 +3719,7 @@
},
{
"zh": "偏好保存失败,已保留原设置",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "偏好儲存失敗,已保留原設定",
"en": "Could not save preferences; previous settings kept",
"ja": "設定を保存できなかったため、以前の設定のままです"
@@ -3733,14 +3733,14 @@
},
{
"zh": "偏移 %1 ms",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "偏移 %1 ms",
"en": "Offset %1 ms",
"ja": "オフセット %1 ms"
},
{
"zh": "偏高",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "偏高",
"en": "High",
"ja": "高め"
@@ -3754,7 +3754,7 @@
},
{
"zh": "像素格式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "像素格式",
"en": "Pixel format",
"ja": "ピクセルフォーマット"
@@ -3775,21 +3775,21 @@
},
{
"zh": "先断开采集,再配置驱动",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "先中斷擷取,再設定驅動",
"en": "Disconnect capture before configuring the driver",
"ja": "キャプチャを切断してからドライバーを設定"
},
{
"zh": "先选择一个捕获目标",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "先選擇一個擷取目標",
"en": "Choose a capture target first",
"ja": "まずキャプチャー対象を選んでください"
},
{
"zh": "先选择分辨率,再选择该分辨率支持的帧率和像素格式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "先選擇解析度,再選擇該解析度支援的幀率和像素格式",
"en": "Choose a resolution first, then a frame rate and pixel format supported at that resolution.",
"ja": "先に解像度を選択し、その解像度で対応するフレームレートとピクセル形式を選択してください。"
@@ -3810,7 +3810,7 @@
},
{
"zh": "光流与内容节奏",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "光流與內容節奏",
"en": "Optical flow and content cadence",
"ja": "オプティカルフローとコンテンツのフレームレート"
@@ -3887,7 +3887,7 @@
},
{
"zh": "全屏缩放已启用:键盘和手柄控制源窗口,鼠标点击已拦截以免错位;需要鼠标穿透时切回贴合原窗口",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "全螢幕縮放已啟用:鍵盤和手把控制來源視窗,滑鼠點擊已攔截以免錯位;需要滑鼠穿透時切回貼合原視窗",
"en": "Fullscreen scaling is active. Keyboard and gamepad control the source window; mouse clicks are blocked to avoid misalignment. Return to original-window alignment for mouse passthrough.",
"ja": "全画面拡大を有効にしました。キーボードとゲームパッドは元のウィンドウを操作し、位置ずれを防ぐためマウスクリックを遮断します。マウス透過には元のウィンドウに合わせる表示へ戻してください。"
@@ -3901,7 +3901,7 @@
},
{
"zh": "全部显卡",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPerfOrbs.qml",
"zh-TW": "全部顯示卡",
"en": "All GPUs",
"ja": "すべての GPU"
@@ -3943,7 +3943,7 @@
},
{
"zh": "关",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "關",
"en": "Off",
"ja": "オフ"
@@ -3957,7 +3957,7 @@
},
{
"zh": "关机",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "關機",
"en": "Off",
"ja": "電源オフ"
@@ -3979,14 +3979,14 @@
{
"zh": "关闭",
"ctx": "off",
- "src": "qml/CineBar.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "關閉",
"en": "Off",
"ja": "オフ"
},
{
"zh": "关闭其他占用同一采集卡的软件",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "關閉其他占用同一擷取卡的軟體",
"en": "Close other software using the same capture card",
"ja": "同じキャプチャーカードを使っている他のソフトを閉じてください"
@@ -4000,7 +4000,7 @@
},
{
"zh": "关闭时主机保持自己的分辨率,画面由主机缩放",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "關閉時主機保持自己的解析度,畫面由主機縮放",
"en": "When off, the host keeps its own resolution and scales the picture itself",
"ja": "オフのとき、ホストは自身の解像度のままで映像をスケーリングします"
@@ -4014,7 +4014,7 @@
},
{
"zh": "关闭时增强、补帧和导出用性能最强的显卡",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "關閉時增強、補幀和匯出用效能最強的顯示卡",
"en": "When off, enhancement, frame generation and export use the most powerful GPU",
"ja": "オフのときは補正・フレーム生成・書き出しに最も高性能な GPU を使います"
@@ -4035,14 +4035,14 @@
},
{
"zh": "关闭补偿",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "關閉補償",
"en": "No compensation",
"ja": "補正なし"
},
{
"zh": "兼容",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "相容",
"en": "Compatible",
"ja": "互換"
@@ -4070,7 +4070,7 @@
},
{
"zh": "内容亮度远超显示设备能力",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "內容亮度遠超顯示裝置能力",
"en": "Content brightness far exceeds the display capability",
"ja": "コンテンツの輝度がディスプレイの能力を大幅に上回ります"
@@ -4084,49 +4084,49 @@
},
{
"zh": "内容:两头极端",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "內容:兩頭極端",
"en": "Content: dark and bright",
"ja": "内容:明暗が極端"
},
{
"zh": "内容:暗场多",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "內容:暗場多",
"en": "Content: mostly dark",
"ja": "内容:暗い場面が多い"
},
{
"zh": "内容:标准",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "內容:標準",
"en": "Content: standard",
"ja": "内容:標準"
},
{
"zh": "内容:老片平淡",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "內容:老片平淡",
"en": "Content: flat older transfer",
"ja": "内容:平坦な旧作"
},
{
"zh": "内容:这部片子属于哪一类",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "內容:這部片子屬於哪一類",
"en": "Content: what kind of film is this?",
"ja": "内容:この作品はどのタイプですか?"
},
{
"zh": "内容:高光强",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "內容:高光強",
"en": "Content: strong highlights",
"ja": "内容:強いハイライト"
},
{
"zh": "内嵌",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "內嵌",
"en": "Embedded",
"ja": "内蔵"
@@ -4147,7 +4147,7 @@
},
{
"zh": "内置预设不能删除,可以另存一份",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "內建預設不能刪除,可以另存一份",
"en": "Built-in presets cannot be deleted; you can save a copy",
"ja": "内蔵プリセットは削除できません。コピーを保存できます"
@@ -4189,7 +4189,7 @@
},
{
"zh": "再串流时建议打开:Veyra 不在前台也继续转发。打开后在这台电脑上用别的程序时,手柄也会操作 PS5",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "再串流時建議打開:Veyra 不在前景也繼續轉發。打開後在這台電腦上用別的程式時,手把也會操作 PS5",
"en": "Recommended when re-streaming: input keeps going while Veyra is not in front. While on, the controller also drives the PS5 when you use other programs on this PC",
"ja": "再ストリーミングするときはオン推奨:Veyra が前面になくても転送を続けます。オンの間は、この PC で他のソフトを使っていてもコントローラーが PS5 を操作します"
@@ -4266,21 +4266,21 @@
},
{
"zh": "分屏",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "分屏",
"en": "Split",
"ja": "分割"
},
{
"zh": "分析中…",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "分析中…",
"en": "Analyzing…",
"ja": "分析中…"
},
{
"zh": "分析前 30 分钟的人声与字幕时间",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "分析前 30 分鐘的人聲與字幕時間",
"en": "Analyzes speech and subtitle timing in the first 30 minutes",
"ja": "最初の 30 分の音声と字幕のタイミングを分析します"
@@ -4308,28 +4308,28 @@
},
{
"zh": "分离中间调",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "分離中間調",
"en": "Split midtones",
"ja": "スプリット中間調"
},
{
"zh": "分离阴影",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "分離陰影",
"en": "Split shadows",
"ja": "スプリットシャドウ"
},
{
"zh": "分离高光",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "分離高光",
"en": "Split highlights",
"ja": "スプリットハイライト"
},
{
"zh": "分辨率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "解析度",
"en": "Resolution",
"ja": "解像度"
@@ -4343,7 +4343,7 @@
},
{
"zh": "分辨率与帧率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "解析度與幀率",
"en": "Resolution and frame rate",
"ja": "解像度とフレームレート"
@@ -4420,14 +4420,14 @@
},
{
"zh": "列出离散帧率及驱动范围内的候选;设备帧率填 0 时沿用此选择,连接时验证实际值",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "列出離散影格率及驅動範圍內的候選;裝置影格率填 0 時沿用此選擇,連線時驗證實際值",
"en": "Lists discrete rates and candidates within driver bounds; device FPS 0 uses this selection, verified on connection",
"ja": "個別のレートとドライバー範囲内の候補を表示します。デバイスFPSが0の場合はこの選択を使い、接続時に実際の値を検証します"
},
{
"zh": "列表",
- "src": "qml/DialogHost.qml",
+ "src": "qml/NodePage.qml",
"zh-TW": "列表",
"en": "List",
"ja": "リスト"
@@ -4462,7 +4462,7 @@
},
{
"zh": "创建显卡会话后生效",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "建立顯示卡工作階段後生效",
"en": "Applies when a GPU session is created",
"ja": "GPU セッションの作成後に適用"
@@ -4497,7 +4497,7 @@
},
{
"zh": "删除",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "刪除",
"en": "Delete",
"ja": "削除"
@@ -4511,14 +4511,14 @@
},
{
"zh": "删除失败,请检查目录权限。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "刪除失敗,請檢查目錄權限。",
"en": "Delete failed; check folder permissions.",
"ja": "削除に失敗しました。フォルダーの権限を確認してください。"
},
{
"zh": "删除授权失败,请检查目录权限。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "刪除授權失敗,請檢查目錄權限。",
"en": "Could not delete the authorization; check folder permissions.",
"ja": "認証情報を削除できませんでした。フォルダーの権限を確認してください。"
@@ -4546,28 +4546,28 @@
},
{
"zh": "删除配对",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "刪除配對",
"en": "Remove pairing",
"ja": "ペアリングを削除"
},
{
"zh": "删除预设失败",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "刪除預設失敗",
"en": "Could not delete the preset",
"ja": "プリセットを削除できませんでした"
},
{
"zh": "删除颜色预设失败",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "刪除顏色預設失敗",
"en": "Could not delete the color preset",
"ja": "カラープリセットを削除できませんでした"
},
{
"zh": "刷新",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "刷新",
"en": "Refresh",
"ja": "更新"
@@ -4588,14 +4588,14 @@
},
{
"zh": "刷新显示器状态没有完成,请稍后再试",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "重新整理顯示器狀態未完成,請稍後再試",
"en": "Refreshing the display state did not finish; try again later",
"ja": "ディスプレイの状態の更新が完了しませんでした。しばらくしてからもう一度お試しください"
},
{
"zh": "刷新设备",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "刷新裝置",
"en": "Refresh devices",
"ja": "デバイスを更新"
@@ -4616,7 +4616,7 @@
},
{
"zh": "剪贴板不是有效的 Sony 授权回调地址。请复制登录完成后的完整 URL。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "剪貼簿不是有效的 Sony 授權回調地址。請複製登入完成後的完整 URL。",
"en": "The clipboard does not hold a valid Sony authorization callback URL. Copy the full URL after signing in.",
"ja": "クリップボードの内容は有効な Sony 認証コールバック URL ではありません。サインイン完了後の URL を丸ごとコピーしてください。"
@@ -4630,21 +4630,21 @@
},
{
"zh": "副字幕已关闭",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "副字幕已關閉",
"en": "Secondary subtitles are off",
"ja": "サブ字幕はオフです"
},
{
"zh": "副字幕(双语)",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "副字幕(雙語)",
"en": "Secondary subtitles (bilingual)",
"ja": "サブ字幕(2 か国語)"
},
{
"zh": "副字幕:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "副字幕:%1",
"en": "Secondary subtitles: %1",
"ja": "サブ字幕:%1"
@@ -4658,7 +4658,7 @@
},
{
"zh": "加入导出队列",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "加入匯出佇列",
"en": "Add to export queue",
"ja": "書き出しキューに追加"
@@ -4672,7 +4672,7 @@
},
{
"zh": "加载外部字幕",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "載入外部字幕",
"en": "Load external subtitles",
"ja": "外部字幕を読み込む"
@@ -4686,14 +4686,14 @@
},
{
"zh": "加载文件…",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "載入檔案…",
"en": "Load file…",
"ja": "ファイルを読み込む…"
},
{
"zh": "包含",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "包含",
"en": "Includes",
"ja": "含む"
@@ -4721,14 +4721,14 @@
},
{
"zh": "半分辨率",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "半解析度",
"en": "Half resolution",
"ja": "半解像度"
},
{
"zh": "单位 0.01 EV:正值提亮暗部,负值压暗",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "單位 0.01 EV:正值提亮暗部,負值壓暗",
"en": "Units of 0.01 EV: positive lifts shadows, negative darkens them",
"ja": "単位は 0.01 EV。正の値で暗部を明るく、負の値で暗くします。"
@@ -4777,7 +4777,7 @@
},
{
"zh": "压住高光",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "壓住高光",
"en": "Protect highlights",
"ja": "ハイライトを抑える"
@@ -4798,14 +4798,14 @@
},
{
"zh": "原始 = 一个输出像素对一个屏幕像素",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "原始 = 一個輸出像素對一個螢幕像素",
"en": "Native = one output pixel per screen pixel",
"ja": "原寸 = 出力 1 ピクセルを画面 1 ピクセルに"
},
{
"zh": "原始像素",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "原始像素",
"en": "Native pixels",
"ja": "原寸ピクセル"
@@ -4847,7 +4847,7 @@
},
{
"zh": "原生采集先确认有效信号;请在设备列表选择对应的 HDMI/SDI 输入,支持自动检测的卡建议选择自动。Driver 保留驱动当前输入。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "原生擷取會先確認有效訊號;請在裝置清單選擇對應的 HDMI/SDI 輸入,支援自動偵測的卡建議選擇自動。Driver 保留驅動程式目前輸入。",
"en": "Native capture first verifies a valid signal. Select the matching HDMI/SDI connector and use Auto when supported. Driver keeps the current driver input.",
"ja": "ネイティブキャプチャは最初に有効な信号を確認します。該当する HDMI/SDI 入力を選択し、対応カードでは自動検出を使用してください。Driver は現在のドライバー入力を維持します。"
@@ -4861,14 +4861,14 @@
},
{
"zh": "原画 / 增强对比",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "原畫 / 增強對比",
"en": "Original / enhanced comparison",
"ja": "オリジナル / 補正後の比較"
},
{
"zh": "原画保护 %1%",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "原畫保護 %1%",
"en": "Original restore %1%",
"ja": "オリジナル保護 %1%"
@@ -4889,7 +4889,7 @@
},
{
"zh": "去朦胧",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "去朦朧",
"en": "Dehaze",
"ja": "かすみの除去"
@@ -4903,7 +4903,7 @@
},
{
"zh": "去配对",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "去配對",
"en": "Pair",
"ja": "ペアリングへ"
@@ -4952,28 +4952,28 @@
},
{
"zh": "参数化亮调",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "參數化亮調",
"en": "Parametric lights",
"ja": "パラメトリック ライト"
},
{
"zh": "参数化暗调",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "參數化暗調",
"en": "Parametric darks",
"ja": "パラメトリック ダーク"
},
{
"zh": "参数化阴影",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "參數化陰影",
"en": "Parametric shadows",
"ja": "パラメトリック シャドウ"
},
{
"zh": "参数化高光",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "參數化高光",
"en": "Parametric highlights",
"ja": "パラメトリック ハイライト"
@@ -5015,21 +5015,21 @@
},
{
"zh": "发现 {} 台 PS5。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "發現 {} 台 PS5。",
"en": "Found {} PS5 consoles.",
"ja": "PS5 が {} 台見つかりました。"
},
{
"zh": "发现主机,但无法确认是已配对的这一台。保留原地址,可核对后手动修改。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "發現主機,但無法確認是已配對的這一台。保留原地址,可核對後手動修改。",
"en": "A host was found, but it cannot be confirmed as the paired one. The old address is kept; check it and change it by hand if needed.",
"ja": "ホストが見つかりましたが、ペアリング済みのものか確認できません。元のアドレスを保持しています。確認のうえ必要なら手動で変更してください。"
},
{
"zh": "发现多台 PS5,请填写要配对的主机 IP,避免选错主机。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "發現多台 PS5,請填寫要配對的主機 IP,避免選錯主機。",
"en": "Several PS5 consoles found; enter the IP of the one to pair so the wrong console is not picked.",
"ja": "PS5 が複数見つかりました。誤った本体を選ばないよう、ペアリングする本体の IP を入力してください。"
@@ -5050,14 +5050,14 @@
},
{
"zh": "发给 PS5 的带宽请求,主机不保证达到",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "發給 PS5 的帶寬請求,主機不保證達到",
"en": "Bandwidth requested from the PS5; the console does not guarantee it",
"ja": "PS5 に要求する帯域幅です。本体が達成するとは限りません"
},
{
"zh": "取消",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "取消",
"en": "Cancel",
"ja": "キャンセル"
@@ -5071,7 +5071,7 @@
},
{
"zh": "取消启动默认",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "取消啟動預設",
"en": "Remove startup default",
"ja": "起動時の既定を解除"
@@ -5085,7 +5085,7 @@
},
{
"zh": "取消操作",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "取消操作",
"en": "Cancel",
"ja": "操作をキャンセル"
@@ -5099,7 +5099,7 @@
},
{
"zh": "另存为",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "另存為",
"en": "Save as",
"ja": "名前を付けて保存"
@@ -5120,14 +5120,14 @@
},
{
"zh": "只列出当前分辨率和帧率下的像素格式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "只列出目前解析度與幀率下的像素格式",
"en": "Only pixel formats available at the current resolution and frame rate",
"ja": "現在の解像度とフレームレートで使えるピクセルフォーマットだけを表示します"
},
{
"zh": "只删除本机保存的这台主机;以后需要重新配对",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "只刪除本機儲存的這台主機;以後需要重新配對",
"en": "Removes only this host from this PC; you will need to pair again later",
"ja": "この PC に保存したこのホストだけを削除します。次回は再ペアリングが必要です"
@@ -5148,7 +5148,7 @@
},
{
"zh": "只在这个亮度以下的暗部生效",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "只在這個亮度以下的暗部生效",
"en": "Only shadows below this level are lifted",
"ja": "この輝度以下の暗部にのみ効く"
@@ -5169,7 +5169,7 @@
},
{
"zh": "只清影片记忆,不动显示设备记忆",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "只清影片記憶,不動顯示裝置記憶",
"en": "Clear film memory; keep display memory",
"ja": "作品の記憶だけを消去し、ディスプレイの記憶は保持します"
@@ -5190,28 +5190,28 @@
},
{
"zh": "只看原画",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "只看原畫",
"en": "Original only",
"ja": "オリジナルのみ"
},
{
"zh": "只能打开本地文件",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "只能開啟本地檔案",
"en": "Only local files can be opened",
"ja": "開けるのはローカルファイルだけです"
},
{
"zh": "只连接明确选中的输入,默认不监听",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "只連接明確選中的輸入,預設不監聽",
"en": "Connects only the input you select explicitly; no monitoring by default",
"ja": "明示的に選んだ入力だけを接続します。既定ではモニターしません"
},
{
"zh": "可以保存",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "可以儲存",
"en": "Can be saved",
"ja": "保存可能"
@@ -5232,21 +5232,21 @@
},
{
"zh": "可变刷新 · 当前屏幕不可用",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "可變更新 · 目前螢幕不可用",
"en": "Variable refresh · unavailable on this display",
"ja": "可変リフレッシュ · このディスプレイでは使用不可"
},
{
"zh": "可变刷新 · 生效中",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "可變更新 · 生效中",
"en": "Variable refresh · active",
"ja": "可変リフレッシュ · 動作中"
},
{
"zh": "可变刷新 · 等待驱动确认",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "可變更新率 · 等待驅動確認",
"en": "Variable refresh · awaiting driver confirmation",
"ja": "可変リフレッシュ · ドライバーの確認待ち"
@@ -5260,7 +5260,7 @@
},
{
"zh": "可用",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "可用",
"en": "Available",
"ja": "使用可"
@@ -5330,7 +5330,7 @@
},
{
"zh": "名称会显示在极简模式和导出页的预设菜单里",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "名稱會顯示在極簡模式和匯出頁的預設選單裡",
"en": "The name appears in the preset menus of Minimal mode and the Export page",
"ja": "名前はシンプルモードと書き出し画面のプリセットメニューに表示されます"
@@ -5344,7 +5344,7 @@
},
{
"zh": "后台也转发手柄",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "背景也轉發手把",
"en": "Forward the controller in the background",
"ja": "バックグラウンドでもコントローラーを転送"
@@ -5358,7 +5358,7 @@
},
{
"zh": "后端告警: %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "後端告警: %1",
"en": "Backend warning: %1",
"ja": "バックエンドの警告:%1"
@@ -5421,14 +5421,14 @@
},
{
"zh": "启动默认",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "啟動預設",
"en": "Startup default",
"ja": "起動時の既定"
},
{
"zh": "启动默认预设保存失败",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "啟動預設預設儲存失敗",
"en": "Could not save the startup default preset",
"ja": "起動時の既定プリセットを保存できませんでした"
@@ -5456,21 +5456,21 @@
},
{
"zh": "呈现",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "呈現",
"en": "Present",
"ja": "表示"
},
{
"zh": "呈现 CPU P95: %1 ms",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "呈現 CPU P95: %1 ms",
"en": "Present CPU P95: %1 ms",
"ja": "表示 CPU P95:%1 ms"
},
{
"zh": "和「PS5 串流」共用配对",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "和「PS5 串流」共用配對",
"en": "Shares pairings with PS5 streaming",
"ja": "「PS5 ストリーミング」とペアリングを共有"
@@ -5484,14 +5484,14 @@
},
{
"zh": "唤醒",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "喚醒",
"en": "Wake",
"ja": "起動"
},
{
"zh": "唤醒失败({});确认 PS5 处于待机而不是关机。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "喚醒失敗({});確認 PS5 處於待機而不是關機。",
"en": "Wake failed ({}); make sure the PS5 is in rest mode, not powered off.",
"ja": "起動に失敗しました({})。PS5 が電源オフではなくレストモードか確認してください。"
@@ -5568,7 +5568,7 @@
},
{
"zh": "图片 (*.png *.jpg *.jpeg)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "圖片 (*.png *.jpg *.jpeg)",
"en": "Images (*.png *.jpg *.jpeg)",
"ja": "画像 (*.png *.jpg *.jpeg)"
@@ -5589,7 +5589,7 @@
},
{
"zh": "图片保存未确认完成,请查看诊断",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "圖片儲存未確認完成,請查看診斷",
"en": "Image save not confirmed as complete; see diagnostics",
"ja": "画像の保存完了を確認できません。診断を確認してください"
@@ -5610,14 +5610,14 @@
},
{
"zh": "图片导出只接受列表模式;请切回列表模式再导出",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "圖片匯出只接受列表模式;請切回列表模式再匯出",
"en": "Image export works in list mode only; switch back to list mode to export",
"ja": "画像の書き出しはリストモードのみです。リストモードに戻して書き出してください"
},
{
"zh": "图片导出完成:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "圖片匯出完成:%1",
"en": "Image export finished: %1",
"ja": "画像の書き出しが完了しました:%1"
@@ -5645,7 +5645,7 @@
},
{
"zh": "图片未导出:%1(%2)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "圖片未匯出:%1(%2)",
"en": "Image not exported: %1 (%2)",
"ja": "画像を書き出せませんでした:%1(%2)"
@@ -5673,21 +5673,21 @@
},
{
"zh": "在 Sony 网页完成登录,复制最终回调地址,再点“提交登录结果”。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "在 Sony 網頁完成登入,複製最終回調地址,再點“提交登入結果”。",
"en": "Sign in on the Sony web page, copy the final callback URL, then click \"Submit sign-in result\".",
"ja": "Sony の Web ページでサインインし、最後のコールバック URL をコピーしてから「サインイン結果を送信」を押してください。"
},
{
"zh": "在 Sony 网页登录后复制回调地址再提交;软件不接触密码",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "在 Sony 網頁登入後複製回調地址再提交;軟體不接觸密碼",
"en": "Sign in on the Sony page, then copy the callback URL and submit it; the app never sees your password",
"ja": "Sony のページでサインイン後、コールバック URL をコピーして送信します。アプリはパスワードに触れません"
},
{
"zh": "在主机上打开 Sunshine 网页(https://主机IP:47990),进入「PIN」页,输入下面的数字并提交:",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "在主機上開啟 Sunshine 網頁(https://主機IP:47990),進入「PIN」頁,輸入下面的數字並提交:",
"en": "On the host, open the Sunshine web page (https://host-IP:47990), go to the PIN page, enter the number below and submit:",
"ja": "ホストで Sunshine の Web ページ(https://ホストIP:47990)を開き、「PIN」ページで下の数字を入力して送信してください:"
@@ -5701,7 +5701,7 @@
},
{
"zh": "在手机或浏览器打开 ",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "在手機或瀏覽器開啟 ",
"en": "On your phone or browser, open ",
"ja": "スマートフォンまたはブラウザーで開く "
@@ -5715,7 +5715,7 @@
},
{
"zh": "在浏览器打开登录页",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "在瀏覽器開啟登入頁",
"en": "Open the sign-in page in the browser",
"ja": "ブラウザーでサインインページを開く"
@@ -5729,7 +5729,7 @@
},
{
"zh": "在画面上按住左键拖动分割线:左边原画、右边增强。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "在畫面上按住左鍵拖曳分割線:左邊原畫、右邊增強。",
"en": "Hold the left button on the picture and drag the divider: original on the left, enhanced on the right.",
"ja": "映像上で左ボタンを押したまま分割線をドラッグ:左がオリジナル、右が補正後です。"
@@ -5743,14 +5743,14 @@
},
{
"zh": "在线",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "在線",
"en": "Online",
"ja": "オンライン"
},
{
"zh": "在线 · 有游戏在运行",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "在線 · 有遊戲在執行",
"en": "Online · a game is running",
"ja": "オンライン · ゲーム実行中"
@@ -5792,42 +5792,42 @@
},
{
"zh": "基础设置",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "基礎設定",
"en": "Basic controls",
"ja": "基本設定"
},
{
"zh": "填充裁切",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "填充裁切",
"en": "Fill and crop",
"ja": "フィル(切り取り)"
},
{
"zh": "填满屏幕",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "填滿螢幕",
"en": "Fill screen",
"ja": "画面全体に表示"
},
{
"zh": "填满屏幕支持键盘和手柄;需要精确鼠标穿透时请选择贴合原窗口",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "填滿螢幕支援鍵盤和手把;需要精確滑鼠穿透時請選擇貼合原視窗",
"en": "Fill screen supports keyboard and gamepad. Choose original-window alignment for precise mouse passthrough.",
"ja": "画面全体に表示する場合はキーボードとゲームパッドを使用できます。正確なマウス透過には元のウィンドウに合わせてください。"
},
{
"zh": "填满窗口",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "填滿視窗",
"en": "Fill the window",
"ja": "ウィンドウいっぱい"
},
{
"zh": "填满窗口,超出部分裁掉",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "填滿視窗,超出部分裁掉",
"en": "Fill the window and crop what overflows",
"ja": "ウィンドウいっぱいに表示し、はみ出す部分を切り取る"
@@ -5841,14 +5841,14 @@
},
{
"zh": "增强、补帧和导出都在「%1」上运行;切换后重新打开视频生效",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "增強、補幀和匯出都在「%1」上執行;切換後重新開啟影片生效",
"en": "Enhancement, frame generation and export run on \"%1\"; reopen the video after switching",
"ja": "補正・フレーム生成・書き出しは「%1」で実行します。切り替え後は動画を開き直してください"
},
{
"zh": "增强前底图",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "增強前底圖",
"en": "Before enhancement",
"ja": "補正前のベース"
@@ -5890,14 +5890,14 @@
},
{
"zh": "增强链 GPU 耗时(最近一秒平均)占一个源帧时间(",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPerfOrbs.qml",
"zh-TW": "增強鏈 GPU 耗時(最近一秒平均)占一個源幀時間(",
"en": "Enhancement chain GPU time (last-second average) as a share of one source frame (",
"ja": "補正チェーンの GPU 時間(直近 1 秒の平均)がソース 1 フレームの時間("
},
{
"zh": "增强链总耗时(最近一秒平均,与 1.4.4 相同口径),环 = 占源帧预算",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPerfOrbs.qml",
"zh-TW": "增強鏈總耗時(最近一秒平均,與 1.4.4 相同口徑),環 = 占源幀預算",
"en": "Total enhancement chain time (last-second average, measured as in 1.4.4); the ring = share of the source frame budget",
"ja": "補正チェーンの合計時間(直近 1 秒の平均、1.4.4 と同じ基準)。リング = ソースフレーム予算に対する割合"
@@ -5911,7 +5911,7 @@
},
{
"zh": "声道",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "聲道",
"en": "Channels",
"ja": "チャンネル"
@@ -5925,7 +5925,7 @@
},
{
"zh": "声音同步",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "聲音同步",
"en": "Audio sync",
"ja": "音声の同期"
@@ -5939,14 +5939,14 @@
},
{
"zh": "处理 CPU P95: %1 ms",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "處理 CPU P95: %1 ms",
"en": "Processing CPU P95: %1 ms",
"ja": "処理 CPU P95:%1 ms"
},
{
"zh": "处理中 · ",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "處理中 · ",
"en": "Processing · ",
"ja": "処理中 · "
@@ -5960,35 +5960,35 @@
},
{
"zh": "处理耗时",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPerfOrbs.qml",
"zh-TW": "處理耗時",
"en": "Processing time",
"ja": "処理時間"
},
{
"zh": "处理链中没有 NR 保护节点,未更改设置",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "處理鏈中沒有 NR 保護節點,未更改設定",
"en": "The chain has no NR protection node; settings unchanged",
"ja": "処理チェーンに NR 保護ノードがないため、設定は変更していません"
},
{
"zh": "处理链中没有调色节点",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "處理鏈中沒有調色節點",
"en": "The chain has no color node",
"ja": "処理チェーンにカラー調整ノードがありません"
},
{
"zh": "处理链中没有调色节点,无法使用 LUT",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "處理鏈中沒有調色節點,無法使用 LUT",
"en": "The chain has no color node, so a LUT cannot be used",
"ja": "処理チェーンにカラー調整ノードがないため、LUT を使えません"
},
{
"zh": "处理链中没有调色节点,未更改设置",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "處理鏈中沒有調色節點,未更改設定",
"en": "The chain has no color node; settings unchanged",
"ja": "処理チェーンにカラー調整ノードがないため、設定は変更していません"
@@ -6009,7 +6009,7 @@
},
{
"zh": "复制",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "複製",
"en": "Copy",
"ja": "コピー"
@@ -6051,7 +6051,7 @@
},
{
"zh": "复制失败:预设数量可能已达上限",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "複製失敗:預設數量可能已達上限",
"en": "Copy failed: the preset limit may have been reached",
"ja": "コピーに失敗しました:プリセット数が上限に達している可能性があります"
@@ -6093,14 +6093,14 @@
},
{
"zh": "外挂",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "外掛",
"en": "External",
"ja": "外部"
},
{
"zh": "外挂字幕",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "外掛字幕",
"en": "External subtitles",
"ja": "外部字幕"
@@ -6114,14 +6114,14 @@
},
{
"zh": "外部字幕加载失败:%1 · %2",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "外部字幕載入失敗:%1 · %2",
"en": "External subtitle loading failed: %1 · %2",
"ja": "外部字幕の読み込みに失敗:%1 · %2"
},
{
"zh": "多声道片源混成双声道再输出(耳机);关闭时按设备声道布局映射",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "多聲道片源混成雙聲道再輸出(耳機);關閉時按裝置聲道布局映射",
"en": "Mix multichannel sources down to stereo (headphones); when off, channels follow the device layout",
"ja": "マルチチャンネルのソースをステレオにまとめて出力(ヘッドホン向け)。オフ時はデバイスのチャンネル配置に従います"
@@ -6142,7 +6142,7 @@
},
{
"zh": "夜里关灯看:柔和一点,同时保留暗部细节。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "夜裡關燈看:柔和一點,同時保留暗部細節。",
"en": "Softer viewing in a dark room while retaining shadow detail.",
"ja": "暗い部屋でも見やすく、暗部の細部を保ちます。"
@@ -6219,7 +6219,7 @@
},
{
"zh": "如果要开启 DLSS5(NR),建议帧率设置 60,减少 DLSS5 需要处理的画面量,减轻负担",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "如果要開啟 DLSS5(NR),建議幀率設定 60,減少 DLSS5 需要處理的畫面量,減輕負擔",
"en": "If you turn on DLSS5 (NR), set the frame rate limit to 60: DLSS5 then has fewer frames to process and less load",
"ja": "DLSS5(NR)を使う場合はフレームレート上限を 60 にしてください。DLSS5 が処理するフレームが減り、負荷が軽くなります"
@@ -6240,21 +6240,21 @@
},
{
"zh": "媒体文件 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.jpg *.jpeg *.png *.bmp *.webp);;所有文件 (*)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "媒體檔案 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.jpg *.jpeg *.png *.bmp *.webp);;所有檔案 (*)",
"en": "Media files (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.jpg *.jpeg *.png *.bmp *.webp);;All files (*)",
"ja": "メディアファイル (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.jpg *.jpeg *.png *.bmp *.webp);;すべてのファイル (*)"
},
{
"zh": "媒体文件 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.mts *.m4v *.wmv *.mpg *.mpeg *.vob *.flv *.ogv *.asf *.3gp *.jpg *.jpeg *.png *.bmp *.webp);;所有文件 (*)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "媒體檔案 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.mts *.m4v *.wmv *.mpg *.mpeg *.vob *.flv *.ogv *.asf *.3gp *.jpg *.jpeg *.png *.bmp *.webp);;所有檔案 (*)",
"en": "Media files (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.mts *.m4v *.wmv *.mpg *.mpeg *.vob *.flv *.ogv *.asf *.3gp *.jpg *.jpeg *.png *.bmp *.webp);;All files (*)",
"ja": "メディアファイル (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.mts *.m4v *.wmv *.mpg *.mpeg *.vob *.flv *.ogv *.asf *.3gp *.jpg *.jpeg *.png *.bmp *.webp);;すべてのファイル (*)"
},
{
"zh": "字体",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "字型",
"en": "Font",
"ja": "フォント"
@@ -6268,7 +6268,7 @@
},
{
"zh": "字号",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "字號",
"en": "Font size",
"ja": "文字サイズ"
@@ -6282,28 +6282,28 @@
},
{
"zh": "字幕 %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "字幕 %1",
"en": "Subtitles %1",
"ja": "字幕 %1"
},
{
"zh": "字幕原字体",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "字幕原字型",
"en": "Subtitle's own font",
"ja": "字幕本来のフォント"
},
{
"zh": "字幕将在视频缓冲好后读取",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "字幕將在影片緩衝好後讀取",
"en": "Subtitles will load once the video is buffered",
"ja": "動画のバッファーが整ってから字幕を読み込みます"
},
{
"zh": "字幕延时 %1 ms",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "字幕延時 %1 ms",
"en": "Subtitle delay %1 ms",
"ja": "字幕の遅延 %1 ms"
@@ -6331,7 +6331,7 @@
},
{
"zh": "字幕文件 (*.srt *.ass *.ssa *.vtt *.sup *.pgs *.idx *.sub *.smi *.sami *.sbv *.mpl *.stl *.txt);;所有文件 (*.*)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "字幕檔案 (*.srt *.ass *.ssa *.vtt *.sup *.pgs *.idx *.sub *.smi *.sami *.sbv *.mpl *.stl *.txt);;所有檔案 (*.*)",
"en": "Subtitle files (*.srt *.ass *.ssa *.vtt *.sup *.pgs *.idx *.sub *.smi *.sami *.sbv *.mpl *.stl *.txt);;All files (*.*)",
"ja": "字幕ファイル (*.srt *.ass *.ssa *.vtt *.sup *.pgs *.idx *.sub *.smi *.sami *.sbv *.mpl *.stl *.txt);;すべてのファイル (*.*)"
@@ -6366,7 +6366,7 @@
},
{
"zh": "字幕设置",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "字幕設定",
"en": "Subtitle settings",
"ja": "字幕設定"
@@ -6380,7 +6380,7 @@
},
{
"zh": "字幕轨",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "字幕軌",
"en": "Subtitle tracks",
"ja": "字幕トラック"
@@ -6401,49 +6401,49 @@
},
{
"zh": "字幕:关",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "字幕:關",
"en": "Subtitles: off",
"ja": "字幕:オフ"
},
{
"zh": "字幕:开",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "字幕:開",
"en": "Subtitles: on",
"ja": "字幕:オン"
},
{
"zh": "安全",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "安全",
"en": "Within range",
"ja": "範囲内"
},
{
"zh": "宋体",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "宋體",
"en": "SimSun",
"ja": "明朝体"
},
{
"zh": "完全 · Full",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "完全 · Full",
"en": "Full",
"ja": "フル · Full"
},
{
"zh": "完成",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "完成",
"en": "Done",
"ja": "完了"
},
{
"zh": "完成 %1 张,失败 %2 张",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "完成 %1 張,失敗 %2 張",
"en": "%1 done, %2 failed",
"ja": "完了 %1 枚、失敗 %2 枚"
@@ -6499,14 +6499,14 @@
},
{
"zh": "实时预览,设置对所有文件生效",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "即時預覽,設定對所有檔案生效",
"en": "Live preview; settings apply to every file",
"ja": "リアルタイムプレビュー。設定はすべてのファイルに適用"
},
{
"zh": "实际运行:FSR %1 · 2X",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "實際執行:FSR %1 · 2X",
"en": "Actually running: FSR %1 · 2X",
"ja": "実際の動作:FSR %1 · 2X"
@@ -6548,35 +6548,35 @@
},
{
"zh": "对比时补帧暂停,关闭对比后恢复",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "對比時補幀暫停,關閉對比後恢復",
"en": "Frame generation pauses while comparing and resumes when comparison is off",
"ja": "比較中はフレーム生成を一時停止し、比較をオフにすると再開します"
},
{
"zh": "对比模式下补帧暂停(对比只能用真实帧),关闭对比后自动恢复",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "對比模式下補幀暫停(對比只能用真實幀),關閉對比後自動恢復",
"en": "Frame generation pauses in compare mode (comparison can only use real frames) and resumes automatically when it is off",
"ja": "比較モード中はフレーム生成を一時停止します(比較は実フレームでのみ可能)。比較をオフにすると自動で再開します"
},
{
"zh": "对照底图",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "對照底圖",
"en": "Reference base",
"ja": "比較用ベース"
},
{
"zh": "导入",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "匯入",
"en": "Import",
"ja": "インポート"
},
{
"zh": "导入 .cube LUT",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "匯入 .cube LUT",
"en": "Import .cube LUT",
"ja": ".cube LUT をインポート"
@@ -6597,7 +6597,7 @@
},
{
"zh": "导入失败:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "匯入失敗:%1",
"en": "Import failed: %1",
"ja": "インポートに失敗しました:%1"
@@ -6611,7 +6611,7 @@
},
{
"zh": "导入文件夹到播放列表",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "匯入資料夾至播放清單",
"en": "Import folder into playlist",
"ja": "プレイリストにフォルダーを追加"
@@ -6667,28 +6667,28 @@
},
{
"zh": "导入预设",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "匯入預設",
"en": "Import preset",
"ja": "プリセットをインポート"
},
{
"zh": "导入颜色预设",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "匯入顏色預設",
"en": "Import color preset",
"ja": "カラープリセットをインポート"
},
{
"zh": "导入颜色预设失败:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "匯入顏色預設失敗:%1",
"en": "Could not import the color preset: %1",
"ja": "カラープリセットをインポートできませんでした:%1"
},
{
"zh": "导出",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ExportPage.qml",
"zh-TW": "匯出",
"en": "Export",
"ja": "書き出し"
@@ -6751,7 +6751,7 @@
},
{
"zh": "导出失败:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "匯出失敗:%1",
"en": "Export failed: %1",
"ja": "書き出しに失敗しました:%1"
@@ -6863,7 +6863,7 @@
},
{
"zh": "导出设置无效:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/QmlPlayerBridge_p.h",
"zh-TW": "匯出設定無效:%1",
"en": "Invalid export settings: %1",
"ja": "書き出し設定が不正です:%1"
@@ -6884,21 +6884,21 @@
},
{
"zh": "导出页和极简模式都从这里的预设中选择",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "匯出頁和極簡模式都從這裡的預設中選擇",
"en": "The Export page and Minimal mode both pick from these presets",
"ja": "書き出し画面とシンプルモードは、ここにあるプリセットから選びます"
},
{
"zh": "导出预设",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "匯出預設",
"en": "Export preset",
"ja": "プリセットを書き出し"
},
{
"zh": "导出预设已不存在,请重新选择",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/QmlPlayerBridge_p.h",
"zh-TW": "匯出預設已不存在,請重新選擇",
"en": "The export preset no longer exists; choose again",
"ja": "書き出し用プリセットが見つかりません。選び直してください"
@@ -6912,14 +6912,14 @@
},
{
"zh": "导出颜色预设",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "匯出顏色預設",
"en": "Export color preset",
"ja": "カラープリセットを書き出し"
},
{
"zh": "导出颜色预设失败:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "匯出顏色預設失敗:%1",
"en": "Could not export the color preset: %1",
"ja": "カラープリセットを書き出せませんでした:%1"
@@ -6933,14 +6933,14 @@
},
{
"zh": "将保存的内容 · 当前正在使用的",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "將儲存的內容 · 當前正在使用的",
"en": "What will be saved · what is in use now",
"ja": "保存される内容 · 現在使用中のもの"
},
{
"zh": "将手柄平放并保持静止:采集 120 个稳定样本完成校准;10 秒内不稳定则保留原校准。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "將手把平放並保持靜止:擷取 120 個穩定樣本完成校準;10 秒內不穩定則保留原校準。",
"en": "Lay the controller flat and keep it still: 120 steady samples complete the calibration; if it is not steady within 10 seconds the old calibration is kept.",
"ja": "コントローラーを平らに置いて静止させてください。安定したサンプルを 120 個集めると補正が完了します。10 秒以内に安定しなければ元の補正を保持します。"
@@ -6968,21 +6968,21 @@
},
{
"zh": "尚未打开音频输出",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "尚未開啟音訊輸出",
"en": "Audio output not opened yet",
"ja": "音声出力はまだ開いていません"
},
{
"zh": "尝试视频设备内置音频",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "嘗試影片裝置內建音訊",
"en": "Try the video device's own audio",
"ja": "映像デバイス内蔵の音声を試す"
},
{
"zh": "局域网 Remote Play · 凭据加密保存在本机",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "區域網路 Remote Play · 憑據加密儲存在本機",
"en": "LAN Remote Play · credentials stored encrypted on this PC",
"ja": "LAN リモートプレイ · 認証情報はこの PC に暗号化して保存"
@@ -7017,14 +7017,14 @@
},
{
"zh": "屏幕 %1 Hz 最多显示约 %2X",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "螢幕 %1 Hz 最多顯示約 %2X",
"en": "A %1 Hz display shows at most about %2X",
"ja": "%1 Hz の画面で表示できるのは最大約 %2X"
},
{
"zh": "屏幕可变刷新生效中",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "螢幕可變更新生效中",
"en": "Display variable refresh active",
"ja": "ディスプレイの可変リフレッシュ動作中"
@@ -7038,7 +7038,7 @@
},
{
"zh": "屏幕捕获 · %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "螢幕擷取 · %1",
"en": "Screen capture · %1",
"ja": "画面キャプチャー · %1"
@@ -7052,21 +7052,21 @@
},
{
"zh": "屏幕支持可变刷新,但当前显示模式不可用;请检查连接、刷新率及驱动设置",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "螢幕支援可變更新率,但目前顯示模式不可用;請檢查連接、更新率及驅動設定",
"en": "The display supports VRR, but it is unavailable in the current display mode. Check the connection, refresh rate and driver settings.",
"ja": "画面は VRR 対応ですが現在の表示モードでは使用できません。接続、リフレッシュレート、ドライバー設定を確認してください。"
},
{
"zh": "屏幕正处于可变刷新(驱动已开启)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "螢幕正處於可變更新(驅動程式已開啟)",
"en": "The display is in variable refresh (enabled by the driver)",
"ja": "ディスプレイは可変リフレッシュ中(ドライバーで有効)"
},
{
"zh": "屏幕跟着画面刷新:不撕裂,也几乎不用等刷新",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "螢幕跟著畫面更新:不撕裂,也幾乎不用等更新",
"en": "The display refreshes when each frame arrives: no tearing and almost no waiting",
"ja": "フレームが届いた時点で画面を更新:ティアリングなし、待ち時間もほぼなし"
@@ -7101,21 +7101,21 @@
},
{
"zh": "展开本卡片并播放 HDR 输出时测量,每秒最多 4 次",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "展開本卡片並播放 HDR 輸出時測量,每秒最多 4 次",
"en": "Expand this card during HDR playback to sample, up to 4 times per second",
"ja": "このカードを開いて HDR 再生すると、毎秒最大 4 回サンプリングします"
},
{
"zh": "峰值 ",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "峰值 ",
"en": "Peak ",
"ja": "ピーク "
},
{
"zh": "峰值上限 (nit)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "峰值上限 (nit)",
"en": "Peak cap (nit)",
"ja": "ピーク上限 (nit)"
@@ -7129,7 +7129,7 @@
},
{
"zh": "左 / 上 / 右 / 下,按源像素",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "左 / 上 / 右 / 下,按源像素",
"en": "Left / top / right / bottom, in source pixels",
"ja": "左 / 上 / 右 / 下、ソースのピクセル単位"
@@ -7150,14 +7150,14 @@
},
{
"zh": "已保存",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "已儲存",
"en": "Saved",
"ja": "保存済み"
},
{
"zh": "已保存主机",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "已儲存主機",
"en": "Saved host",
"ja": "保存済みのホスト"
@@ -7171,21 +7171,21 @@
},
{
"zh": "已保存的设备(未连接)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "已儲存的裝置(未連接)",
"en": "Saved device (not connected)",
"ja": "保存済みのデバイス(未接続)"
},
{
"zh": "已保存颜色预设:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "已儲存顏色預設:%1",
"en": "Color preset saved: %1",
"ja": "カラープリセットを保存しました:%1"
},
{
"zh": "已停止",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "已停止",
"en": "Stopped",
"ja": "停止中"
@@ -7206,7 +7206,7 @@
},
{
"zh": "已关闭",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "已關閉",
"en": "Off",
"ja": "オフ"
@@ -7220,14 +7220,14 @@
},
{
"zh": "已关闭当前硬件或包不支持的效果,参数仍保留:",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "已關閉目前硬體或套件不支援的效果,參數仍保留:",
"en": "Unavailable effects have been disabled; their parameters are preserved: ",
"ja": "非対応の効果を無効にしました。設定値は保持されています:"
},
{
"zh": "已关闭正在播放的内容,显卡全部留给导出",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Recording.cpp",
"zh-TW": "已關閉正在播放的內容,顯示卡全部留給匯出",
"en": "Closed what was playing; the whole GPU goes to the export",
"ja": "再生中のコンテンツを閉じ、GPU をすべて書き出しに回しました"
@@ -7248,7 +7248,7 @@
},
{
"zh": "已刷新显示器状态:系统 HDR %1 · 可变刷新 %2",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "已重新整理顯示器狀態:系統 HDR %1 · 可變更新 %2",
"en": "Display state refreshed: Windows HDR %1 · variable refresh %2",
"ja": "ディスプレイの状態を更新しました:システム HDR %1 · 可変リフレッシュ %2"
@@ -7262,21 +7262,21 @@
},
{
"zh": "已加载保存的主机,直接点“连接”,无需重新填写 8 位配对码。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "已載入儲存的主機,直接點“連接”,無需重新填寫 8 位配對碼。",
"en": "Loaded the saved host; just click Connect, no need to enter the 8-digit pairing code again.",
"ja": "保存済みのホストを読み込みました。「接続」を押すだけで、8 桁のペアリングコードの再入力は不要です。"
},
{
"zh": "已加载外部字幕:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "已載入外部字幕:%1",
"en": "External subtitles loaded: %1",
"ja": "外部字幕を読み込みました:%1"
},
{
"zh": "已发送唤醒请求,等待 PS5 开机后再连接。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "已發送喚醒請求,等待 PS5 開機後再連接。",
"en": "Wake request sent; connect once the PS5 has started.",
"ja": "起動要求を送信しました。PS5 が起動してから接続します。"
@@ -7304,21 +7304,21 @@
},
{
"zh": "已取消启动默认预设",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "已取消啟動預設預設",
"en": "Startup default preset removed",
"ja": "起動時の既定プリセットを解除しました"
},
{
"zh": "已取消唤醒",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "已取消喚醒",
"en": "Wake cancelled",
"ja": "起動をキャンセルしました"
},
{
"zh": "已取消查找",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "已取消查找",
"en": "Search cancelled",
"ja": "検索をキャンセルしました"
@@ -7332,7 +7332,7 @@
},
{
"zh": "已取消配对",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "已取消配對",
"en": "Pairing cancelled",
"ja": "ペアリングをキャンセルしました"
@@ -7346,21 +7346,21 @@
},
{
"zh": "已取消:完成 %1 / %2",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "已取消:完成 %1 / %2",
"en": "Cancelled: %1 / %2 done",
"ja": "キャンセル:%1 / %2 完了"
},
{
"zh": "已启用",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "已啟用",
"en": "Enabled",
"ja": "有効"
},
{
"zh": "已启用(HDR10)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "已啟用(HDR10)",
"en": "Enabled (HDR10)",
"ja": "有効(HDR10)"
@@ -7374,35 +7374,35 @@
},
{
"zh": "已在「采集卡」里打开 PS5 手柄控制:连接采集卡时只用远程游玩传手柄",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "已在「擷取卡」裡打開 PS5 手把控制:連接擷取卡時只用遠程遊玩傳手把",
"en": "PS5 controller control is on under Capture card: with the capture card connected, Remote Play carries only the controller",
"ja": "「キャプチャーカード」で PS5 コントローラー操作がオンです:キャプチャーカード接続中はリモートプレイでコントローラーだけを送ります"
},
{
"zh": "已复制调色参数",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "已複製調色參數",
"en": "Color settings copied",
"ja": "カラー設定をコピーしました"
},
{
"zh": "已套用该显示设备的 HDR 曲线配置",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "已套用該顯示裝置的 HDR 曲線設定",
"en": "Restored this display's HDR curve",
"ja": "このディスプレイの HDR カーブを復元しました"
},
{
"zh": "已套用这部影片上次的曲线设置",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "已套用這部影片上次的曲線設定",
"en": "Restored this film's previous curve",
"ja": "この作品の前回のカーブを復元しました"
},
{
"zh": "已存在同名颜色预设",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "已存在同名顏色預設",
"en": "A color preset with this name already exists",
"ja": "同じ名前のカラープリセットがすでにあります"
@@ -7423,35 +7423,35 @@
},
{
"zh": "已导入并使用 LUT:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "已匯入並使用 LUT:%1",
"en": "LUT imported and in use: %1",
"ja": "LUT をインポートして使用中:%1"
},
{
"zh": "已导入预设:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "已匯入預設:%1",
"en": "Preset imported: %1",
"ja": "プリセットをインポートしました:%1"
},
{
"zh": "已导入颜色预设:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "已匯入顏色預設:%1",
"en": "Color preset imported: %1",
"ja": "カラープリセットをインポートしました:%1"
},
{
"zh": "已导出颜色预设",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "已匯出顏色預設",
"en": "Color preset exported",
"ja": "カラープリセットを書き出しました"
},
{
"zh": "已开启",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "已開啟",
"en": "On",
"ja": "オン"
@@ -7465,28 +7465,28 @@
},
{
"zh": "已开启,将在播放时请求可变刷新;是否生效以驱动报告为准",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "已開啟,將在播放時請求可變更新率;是否生效以驅動回報為準",
"en": "Enabled. VRR will be requested during playback; activation is confirmed by the driver.",
"ja": "有効です。再生時に VRR を要求します。動作状態はドライバーの報告で確認します。"
},
{
"zh": "已开启:%1",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProStatusSummary.qml",
"zh-TW": "已開啟:%1",
"en": "Enabled: %1",
"ja": "有効:%1"
},
{
"zh": "已按片源自动选档:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "已按片源自動選檔:%1",
"en": "Selected from source metadata: %1",
"ja": "ソース情報から選択しました:%1"
},
{
"zh": "已接入",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "已接入",
"en": "Connected",
"ja": "接続済み"
@@ -7507,28 +7507,28 @@
},
{
"zh": "已暂停:画面停在当前帧,不再处理新画面;点播放继续",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "已暫停:畫面停在當前幀,不再處理新畫面;點播放繼續",
"en": "Paused: the picture holds on the current frame and no new frames are processed; press play to continue",
"ja": "一時停止中:映像は現在のフレームで止まり、新しいフレームは処理しません。再生を押すと続行します"
},
{
"zh": "已有一个自动对齐在进行",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "已有一個自動對齊在進行",
"en": "An automatic alignment is already running",
"ja": "自動調整がすでに実行中です"
},
{
"zh": "已有一批图片在处理",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "已有一批圖片在處理",
"en": "A batch of images is already being processed",
"ja": "画像のバッチをすでに処理中です"
},
{
"zh": "已有同名预设,换一个名称才能保存",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "已有同名預設,換一個名稱才能儲存",
"en": "A preset with this name already exists; choose another name to save",
"ja": "同じ名前のプリセットがあります。別の名前にすると保存できます"
@@ -7542,35 +7542,35 @@
},
{
"zh": "已清除影片记忆",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "已清除影片記憶",
"en": "Film memory cleared",
"ja": "作品の記憶を消去しました"
},
{
"zh": "已清除显示设备记忆",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "已清除顯示裝置記憶",
"en": "Display memory cleared",
"ja": "ディスプレイの記憶を消去しました"
},
{
"zh": "已生效:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "已生效:%1",
"en": "Active: %1",
"ja": "適用済み:%1"
},
{
"zh": "已生效:%1(抖音直播伴侣运行中,暂不使用实时)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "已生效:%1(抖音直播伴侶執行中,暫不使用即時)",
"en": "Active: %1 (Douyin Live Companion is running, so Realtime is not used for now)",
"ja": "適用済み:%1(抖音直播伴侶の実行中はリアルタイムを使用しません)"
},
{
"zh": "已登录",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "已登入",
"en": "Signed in",
"ja": "サインイン済み"
@@ -7598,14 +7598,14 @@
},
{
"zh": "已结束 PS5 手柄控制:PS5 同一时间只允许一个远程游玩连接",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "已結束 PS5 手把控制:PS5 同一時間只允許一個遠程遊玩連線",
"en": "PS5 controller control ended: a PS5 allows one Remote Play connection at a time",
"ja": "PS5 コントローラー操作を終了しました:PS5 のリモートプレイ接続は同時に 1 つだけです"
},
{
"zh": "已继续",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "已繼續",
"en": "Resumed",
"ja": "再開しました"
@@ -7626,14 +7626,14 @@
},
{
"zh": "已记住 %1 台显示设备的曲线配置,切换显示器时自动套用",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "已記住 %1 台顯示裝置的曲線設定,切換顯示器時自動套用",
"en": "Curves saved for %1 displays; restored when switching displays",
"ja": "%1 台のカーブを記憶済み。ディスプレイの切り替え時に復元します"
},
{
"zh": "已记住 %1 部影片,下次播放自动套用",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "已記住 %1 部影片,下次播放自動套用",
"en": "Curves saved for %1 films; restored on next playback",
"ja": "%1 本のカーブを記憶済み。次回再生時に復元します"
@@ -7647,14 +7647,14 @@
},
{
"zh": "已设为启动默认预设",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "已設為啟動預設預設",
"en": "Set as the startup default preset",
"ja": "起動時の既定プリセットに設定しました"
},
{
"zh": "已请求",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "已請求",
"en": "Requested",
"ja": "要求済み"
@@ -7668,7 +7668,7 @@
},
{
"zh": "已请求可变刷新,驱动尚未确认生效;可检查窗口/全屏 G-SYNC 设置,当前状态不代表驱动已关闭",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "已請求可變更新率,驅動尚未確認生效;可檢查視窗/全螢幕 G-SYNC 設定,目前狀態不代表驅動已關閉",
"en": "VRR presentation requested; the driver has not confirmed activation. Check windowed/fullscreen G-SYNC settings. This does not mean the driver setting is off.",
"ja": "VRR 表示を要求しましたが、ドライバーはまだ動作を確認していません。ウィンドウ/全画面の G-SYNC 設定を確認できます。この状態は設定がオフという意味ではありません。"
@@ -7682,7 +7682,7 @@
},
{
"zh": "已连接",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "已連接",
"en": "Connected",
"ja": "接続済み"
@@ -7710,14 +7710,14 @@
},
{
"zh": "已配对",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "已配對",
"en": "Paired",
"ja": "ペアリング済み"
},
{
"zh": "已释放键盘和鼠标(点击画面重新捕获)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "已釋放鍵盤和滑鼠(點擊畫面重新擷取)",
"en": "Keyboard and mouse released (click the picture to capture again)",
"ja": "キーボードとマウスを解放しました(映像をクリックすると再度キャプチャー)"
@@ -7738,7 +7738,7 @@
},
{
"zh": "帧: 已处理 %1 生成 %2",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "幀: 已處理 %1 生成 %2",
"en": "Frames: processed %1, generated %2",
"ja": "フレーム:処理 %1、生成 %2"
@@ -7752,14 +7752,14 @@
},
{
"zh": "帧率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "幀率",
"en": "Frame rate",
"ja": "フレームレート"
},
{
"zh": "帧率上限",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "幀率上限",
"en": "Frame rate cap",
"ja": "フレームレート上限"
@@ -7822,7 +7822,7 @@
},
{
"zh": "应用设置并重连",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "應用設定並重連",
"en": "Apply settings and reconnect",
"ja": "設定を適用して再接続"
@@ -7836,7 +7836,7 @@
},
{
"zh": "底部距离",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "底部距離",
"en": "Distance from bottom",
"ja": "下端からの距離"
@@ -7892,28 +7892,28 @@
},
{
"zh": "开始串流",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "開始串流",
"en": "Start streaming",
"ja": "ストリーミング開始"
},
{
"zh": "开始写入后按已写入量推算",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "開始寫入後按已寫入量推算",
"en": "Estimated from what has been written once writing starts",
"ja": "書き込み開始後、書き込み量から推定"
},
{
"zh": "开始后 Veyra 在这块屏幕上全屏,键鼠和手柄直接操作屏幕上的程序;%1 调整画面,%2 退出",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "開始後 Veyra 在此螢幕全螢幕顯示,鍵鼠與手把直接操作螢幕上的程式;%1 調整畫面,%2 退出",
"en": "Veyra opens fullscreen on this display. Keyboard, mouse and controller operate its programs; %1 adjusts the picture and %2 exits.",
"ja": "この画面で全画面表示し、キーボード・マウス・コントローラーで背後のアプリを操作します。%1 で画面調整、%2 で解除。"
},
{
"zh": "开始后键鼠交给主机;Ctrl+Alt+Shift+Z 释放,+Q 断开,+S 统计",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "開始後鍵鼠交給主機;Ctrl+Alt+Shift+Z 釋放,+Q 斷開,+S 統計",
"en": "Once started, keyboard and mouse go to the host; Ctrl+Alt+Shift+Z releases, +Q disconnects, +S shows stats",
"ja": "開始後はキーボードとマウスをホストに渡します。Ctrl+Alt+Shift+Z で解放、+Q で切断、+S で統計"
@@ -7934,7 +7934,7 @@
},
{
"zh": "开始捕获",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "開始擷取",
"en": "Start capture",
"ja": "キャプチャー開始"
@@ -7948,7 +7948,7 @@
},
{
"zh": "开播自动选档",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "開播自動選檔",
"en": "Auto-select on playback",
"ja": "再生時に自動選択"
@@ -7969,63 +7969,63 @@
},
{
"zh": "引擎拒绝切换,存档回退失败:",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "引擎拒絕切換,存檔回退失敗:",
"en": "The engine refused the switch and the saved state could not be restored: ",
"ja": "エンジンが切り替えを拒否し、保存状態に戻せませんでした:"
},
{
"zh": "引擎未接受 AMD 性能档,原设置保留",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "引擎未接受 AMD 性能檔,原設定保留",
"en": "The engine did not accept AMD performance mode; previous setting kept",
"ja": "エンジンが AMD パフォーマンスを受け付けなかったため、元の設定のままです"
},
{
"zh": "引擎未接受 DLSS 性能模式,原设置保留",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "引擎未接受 DLSS 效能模式,原設定保留",
"en": "The engine did not accept the DLSS performance mode; the previous setting is kept",
"ja": "エンジンが DLSS パフォーマンスモードを受け付けませんでした。元の設定を維持します"
},
{
"zh": "引擎未接受光流配置,原设置保留",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "引擎未接受光流設定,原設定保留",
"en": "The engine did not accept the optical flow settings; previous settings kept",
"ja": "エンジンがオプティカルフロー設定を受け付けなかったため、元の設定のままです"
},
{
"zh": "引擎未接受内容节奏,原设置保留",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "引擎未接受內容節奏,原設定保留",
"en": "The engine did not accept content pacing; previous setting kept",
"ja": "エンジンがコンテンツのペーシングを受け付けなかったため、元の設定のままです"
},
{
"zh": "引擎未接受模式设置,当前配置不变",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "引擎未接受模式設定,當前設定不變",
"en": "The engine did not accept the mode; current configuration unchanged",
"ja": "エンジンがモード設定を受け付けなかったため、現在の構成のままです"
},
{
"zh": "引擎未接受设置,已保留原状态",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/QmlPlayerBridge_p.h",
"zh-TW": "引擎未接受設定,已保留原狀態",
"en": "The engine did not accept the settings; previous state kept",
"ja": "エンジンが設定を受け付けなかったため、元の状態のままです"
},
{
"zh": "引擎未接受边缘神盾,原设置保留",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "引擎未接受邊緣神盾,原設定保留",
"en": "The engine did not accept Edge Aegis; previous setting kept",
"ja": "エンジンがエッジイージスを受け付けなかったため、元の設定のままです"
},
{
"zh": "引擎未接受运动估算质量,原设置保留",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "引擎未接受運動估算品質,原設定保留",
"en": "The engine did not accept the motion estimation quality; previous setting kept",
"ja": "エンジンが動き推定の品質を受け付けなかったため、元の設定のままです"
@@ -8039,28 +8039,28 @@
},
{
"zh": "弱",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "弱",
"en": "Weak",
"ja": "弱"
},
{
"zh": "强",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "強",
"en": "Strong",
"ja": "強"
},
{
"zh": "强制 PCM",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "強制 PCM",
"en": "Force PCM",
"ja": "PCM を強制"
},
{
"zh": "强制 SDR 预览",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "強制 SDR 預覽",
"en": "Force SDR preview",
"ja": "SDR プレビューを強制"
@@ -8088,7 +8088,7 @@
},
{
"zh": "强化冲击",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "強化衝擊",
"en": "Punch",
"ja": "メリハリ"
@@ -8102,7 +8102,7 @@
},
{
"zh": "强度 ",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "強度 ",
"en": "Strength ",
"ja": "強度 "
@@ -8144,7 +8144,7 @@
},
{
"zh": "当前 XeSS 模块未匹配 3X / 4X 解锁版本;2X 可用,请在组件页核对版本",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "當前 XeSS 模塊未匹配 3X / 4X 解鎖版本;2X 可用,請在組件頁核對版本",
"en": "The current XeSS module does not match the 3X / 4X unlock version; 2X works. Check the version on the components page",
"ja": "現在の XeSS モジュールは 3X / 4X アンロック版と一致しません。2X は使えます。コンポーネント画面でバージョンを確認してください"
@@ -8158,7 +8158,7 @@
},
{
"zh": "当前不可用",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "目前不可用",
"en": "Unavailable now",
"ja": "現在は使用不可"
@@ -8179,14 +8179,14 @@
},
{
"zh": "当前偏差",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "當前偏差",
"en": "Current offset",
"ja": "現在のずれ"
},
{
"zh": "当前包缺少此功能的运行组件",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Hardware.cpp",
"zh-TW": "目前套件缺少此功能的執行元件",
"en": "This package lacks the runtime components for this feature",
"ja": "このパッケージに必要なランタイムがありません"
@@ -8200,7 +8200,7 @@
},
{
"zh": "当前屏幕不支持可变刷新",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "目前螢幕不支援可變更新",
"en": "This display does not support variable refresh",
"ja": "このディスプレイは可変リフレッシュに対応していません"
@@ -8214,14 +8214,14 @@
},
{
"zh": "当前帧率 %1 fps 超出屏幕刷新率 %2 Hz,建议关闭补帧来获得更好的延迟体验",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "目前幀率 %1 fps 超出螢幕更新率 %2 Hz,建議關閉補幀來獲得更好的延遲體驗",
"en": "Current frame rate %1 fps exceeds the %2 Hz refresh rate; turn frame generation off for lower latency",
"ja": "現在のフレームレート %1 fps が画面のリフレッシュレート %2 Hz を超えています。遅延を抑えるにはフレーム生成をオフにしてください"
},
{
"zh": "当前帧率 %1 fps 超出屏幕刷新率 %2 Hz,建议降至 %3X 来获得更好的延迟体验",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "目前幀率 %1 fps 超出螢幕更新率 %2 Hz,建議降至 %3X 來獲得更好的延遲體驗",
"en": "Current frame rate %1 fps exceeds the %2 Hz refresh rate; lower it to %3X for lower latency",
"ja": "現在のフレームレート %1 fps が画面のリフレッシュレート %2 Hz を超えています。遅延を抑えるには %3X に下げてください"
@@ -8242,7 +8242,7 @@
},
{
"zh": "当前播放设置",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "當前播放設定",
"en": "Current playback settings",
"ja": "現在の再生設定"
@@ -8270,28 +8270,28 @@
},
{
"zh": "当前源没有可选音轨。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "當前源沒有可選音軌。",
"en": "This source has no selectable audio tracks.",
"ja": "このソースには選択できる音声トラックがありません。"
},
{
"zh": "当前片源没有字幕",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "當前片源沒有字幕",
"en": "This source has no subtitles",
"ja": "このソースには字幕がありません"
},
{
"zh": "当前生效:整档预设「%1」",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "當前生效:整檔預設「%1」",
"en": "Active preset: %1",
"ja": "適用中のプリセット:%1"
},
{
"zh": "当前生效:自定义微调(未匹配任何整档预设)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "當前生效:自定義微調(未匹配任何整檔預設)",
"en": "Active: custom adjustments (no matching preset)",
"ja": "適用中:カスタム調整(一致するプリセットなし)"
@@ -8305,14 +8305,14 @@
},
{
"zh": "当前硬件或包不支持所选效果,请查看组件页",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/QmlPlayerBridge_p.h",
"zh-TW": "目前硬體或套件不支援所選效果,請查看元件頁",
"en": "The hardware or package does not support this effect; check Components",
"ja": "選択した効果は現在の GPU またはパッケージに対応していません。コンポーネントを確認してください"
},
{
"zh": "当前组合:内容 %1 · 环境 %2",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "當前組合:內容 %1 · 環境 %2",
"en": "Current combination: content %1 · environment %2",
"ja": "現在の組み合わせ:内容 %1 · 環境 %2"
@@ -8333,7 +8333,7 @@
},
{
"zh": "当前配置未启用自动 NR,保留固定 1080p 档",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "目前設定未啟用自動 NR,保留固定 1080p 檔",
"en": "Auto NR is inactive for this configuration; keeping the fixed 1080p policy",
"ja": "現在の設定では自動 NR は無効です。固定 1080p 設定を維持します"
@@ -8459,7 +8459,7 @@
},
{
"zh": "录制目录不存在:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "錄製資料夾不存在:%1",
"en": "The recording folder does not exist: %1",
"ja": "録画フォルダが存在しません:%1"
@@ -8515,7 +8515,7 @@
},
{
"zh": "待机",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "待機",
"en": "Standby",
"ja": "待機"
@@ -8536,14 +8536,14 @@
},
{
"zh": "快捷键 B",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "快速鍵 B",
"en": "Shortcut B",
"ja": "ショートカット B"
},
{
"zh": "快捷键保存失败",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "快速鍵儲存失敗",
"en": "Could not save the shortcut",
"ja": "ショートカットを保存できませんでした"
@@ -8557,7 +8557,7 @@
},
{
"zh": "总体强度",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "總體強度",
"en": "Overall strength",
"ja": "全体の強度"
@@ -8571,28 +8571,28 @@
},
{
"zh": "恒定质量:大小取决于画面,开始后按已写入量推算",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "恒定品質:大小取決於畫面,開始後按已寫入量推算",
"en": "Constant quality: size depends on the picture; estimated from what has been written once started",
"ja": "固定品質:サイズは映像によって決まります。開始後に書き込み量から推定します"
},
{
"zh": "恢复中",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "恢復中",
"en": "Recovering",
"ja": "復旧中"
},
{
"zh": "恢复默认",
- "src": "qml/DialogHost.qml",
+ "src": "qml/NrLayerEditor.qml",
"zh-TW": "恢復預設",
"en": "Reset to default",
"ja": "既定に戻す"
},
{
"zh": "我的屏能到多少 nit;0 = 自动",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "我的屏能到多少 nit;0 = 自動",
"en": "Display peak in nits; 0 = automatic",
"ja": "ディスプレイのピーク輝度(nit)。0 = 自動"
@@ -8613,21 +8613,21 @@
},
{
"zh": "截图保存到:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "截圖儲存到:%1",
"en": "Screenshots are saved to: %1",
"ja": "スクリーンショットの保存先:%1"
},
{
"zh": "截图目录不可用:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "截圖目錄不可用:%1",
"en": "Screenshot folder unavailable: %1",
"ja": "スクリーンショットの保存先を使用できません:%1"
},
{
"zh": "截图目录不存在:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "截圖目錄不存在:%1",
"en": "Screenshot folder does not exist: %1",
"ja": "スクリーンショットの保存先が存在しません:%1"
@@ -8655,14 +8655,14 @@
},
{
"zh": "所选补帧后端的倍率已调整为 %1X",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "所選補幀後端的倍率已調整為 %1X",
"en": "The selected frame-generation backend adjusted the multiplier to %1X.",
"ja": "選択したフレーム生成方式の倍率を %1X に調整しました。"
},
{
"zh": "所选设备不可用,已回落到系统默认:",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "所選裝置不可用,已回落到系統預設:",
"en": "The selected device is unavailable; fell back to the system default: ",
"ja": "選択したデバイスを使用できないため、システムの既定に切り替えました:"
@@ -8697,7 +8697,7 @@
},
{
"zh": "手动",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "手動",
"en": "Manual",
"ja": "手動"
@@ -8711,14 +8711,14 @@
},
{
"zh": "手动偏移",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "手動偏移",
"en": "Manual offset",
"ja": "手動オフセット"
},
{
"zh": "手动偏移 · 实时输入时生效",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "手動偏移 · 即時輸入時生效",
"en": "Manual offset · applies to live input",
"ja": "手動オフセット · ライブ入力時に有効"
@@ -8739,14 +8739,14 @@
},
{
"zh": "手动添加",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "手動添加",
"en": "Add manually",
"ja": "手動で追加"
},
{
"zh": "手动选择最多 64 条;保留全部不限制轨道数量",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "手動選擇最多 64 條;保留全部不限制軌道數量",
"en": "Up to 64 when choosing by hand; Keep all has no track limit",
"ja": "手動選択は最大 64 本。「すべて保持」はトラック数の制限なし"
@@ -8760,28 +8760,28 @@
},
{
"zh": "手柄",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "手把",
"en": "Controller",
"ja": "コントローラー"
},
{
"zh": "手柄支持陀螺仪",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "手把支援陀螺儀",
"en": "Controller supports gyro",
"ja": "コントローラーはジャイロ対応"
},
{
"zh": "手柄没有陀螺仪",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "手把沒有陀螺儀",
"en": "Controller has no gyro",
"ja": "コントローラーにジャイロはありません"
},
{
"zh": "打开",
- "src": "qml/DialogHost.qml",
+ "src": "qml/NetworkSourceDialog.qml",
"zh-TW": "開啟",
"en": "Open",
"ja": "開く"
@@ -8823,14 +8823,14 @@
},
{
"zh": "打开新文件时自动选第二条可用字幕",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "開啟新檔案時自動選第二條可用字幕",
"en": "Pick the second available subtitle track automatically when opening a new file",
"ja": "新しいファイルを開くと 2 番目の字幕を自動で選択"
},
{
"zh": "打开旧版格式列表",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "開啟舊版格式清單",
"en": "Open legacy format list",
"ja": "従来の形式一覧を開く"
@@ -8851,7 +8851,7 @@
},
{
"zh": "打开片子时按片源自动选一次;有影片记忆时以记忆为准",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "開啟片子時按片源自動選一次;有影片記憶時以記憶為準",
"en": "Select once when a film opens; remembered film settings take priority",
"ja": "作品を開くときに一度選択します。作品の記憶がある場合はそちらを優先します。"
@@ -8879,21 +8879,21 @@
},
{
"zh": "打开视频后显示可用字幕",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "開啟影片後顯示可用字幕",
"en": "Available subtitles appear once a video is open",
"ja": "動画を開くと使える字幕が表示されます"
},
{
"zh": "打开视频或图片",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "開啟影片或圖片",
"en": "Open a video or image",
"ja": "動画または画像を開く"
},
{
"zh": "打开超时",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "開啟超時",
"en": "Opening timed out",
"ja": "開くのがタイムアウトしました"
@@ -8928,7 +8928,7 @@
},
{
"zh": "找不到美乐威运行库 LibMWCapture.dll(应在软件的 runtime\\magewell 文件夹里,或装美乐威驱动/SDK)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "找不到美樂威執行庫 LibMWCapture.dll(應在軟體的 runtime\\magewell 資料夾裡,或裝美樂威驅動/SDK)",
"en": "Magewell runtime LibMWCapture.dll not found (it should be in the app's runtime\\magewell folder, or install the Magewell driver/SDK)",
"ja": "Magewell のランタイム LibMWCapture.dll が見つかりません(アプリの runtime\\magewell フォルダーにあるはずです。または Magewell のドライバー/SDK をインストールしてください)"
@@ -8942,7 +8942,7 @@
},
{
"zh": "把一个窗口或整块显示器作为片源",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "把一個視窗或整塊顯示器作為片源",
"en": "Use a window or a whole display as the source",
"ja": "ウィンドウまたはディスプレイ全体をソースにする"
@@ -8963,14 +8963,14 @@
},
{
"zh": "把电脑手柄当作主机上的 Xbox 手柄(1 号)",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "把電腦手把當作主機上的 Xbox 手把(1 號)",
"en": "Use this PC's controller as Xbox controller 1 on the console",
"ja": "この PC のコントローラーを本体の Xbox コントローラー(1 番)として使う"
},
{
"zh": "把电脑手柄当作主机上的手柄",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "把電腦手把當作主機上的手把",
"en": "Use this PC's controller as a controller on the console",
"ja": "この PC のコントローラーを本体のコントローラーとして使う"
@@ -8998,7 +8998,7 @@
},
{
"zh": "抗锯齿 2",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "抗鋸齒 2",
"en": "Anti-aliasing 2",
"ja": "アンチエイリアス 2"
@@ -9012,21 +9012,21 @@
},
{
"zh": "抬升范围 (nit)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "抬升範圍 (nit)",
"en": "Lift range (nit)",
"ja": "持ち上げ範圍 (nit)"
},
{
"zh": "拉亮暗部",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "拉亮暗部",
"en": "Lift shadows",
"ja": "暗部を持ち上げる"
},
{
"zh": "拉伸铺满",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "拉伸鋪滿",
"en": "Stretch to fill",
"ja": "引き伸ばして全体表示"
@@ -9061,7 +9061,7 @@
},
{
"zh": "按住 V 查看原画",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "按住 V 查看原畫",
"en": "Hold V to see the original",
"ja": "V を押している間オリジナルを表示"
@@ -9089,42 +9089,42 @@
},
{
"zh": "按显示设备记忆",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "按顯示裝置記憶",
"en": "Remember per display",
"ja": "ディスプレイごとに記憶"
},
{
"zh": "按片源自动选档",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "按片源自動選檔",
"en": "Select from source",
"ja": "ソースから自動選択"
},
{
"zh": "按键可在 设置 → 快捷键 里改",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "按鍵可在 設定 → 快速鍵 裡改",
"en": "Keys can be changed under Settings → Shortcuts",
"ja": "キーは 設定 → ショートカット で変更できます"
},
{
"zh": "按音轨自动对齐",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "按音軌自動對齊",
"en": "Auto-align by audio track",
"ja": "音声トラックで自動調整"
},
{
"zh": "捕获已结束,已退出游戏模式",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "擷取已結束,已退出遊戲模式",
"en": "The capture ended; game mode was left",
"ja": "キャプチャが終了したため、ゲームモードを終了しました"
},
{
"zh": "捕获目标",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "擷取目標",
"en": "Capture target",
"ja": "キャプチャー対象"
@@ -9152,63 +9152,63 @@
},
{
"zh": "描边",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "描邊",
"en": "Outline",
"ja": "縁取り"
},
{
"zh": "提交",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "提交",
"en": "Submit",
"ja": "送信"
},
{
"zh": "提交 %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "提交 %1",
"en": "Submit %1",
"ja": "送信 %1"
},
{
"zh": "提交 FPS: %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "提交 FPS: %1",
"en": "Submit FPS: %1",
"ja": "送信 FPS:%1"
},
{
"zh": "提交帧率",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "提交幀率",
"en": "Submit rate",
"ja": "送信フレームレート"
},
{
"zh": "提交登录结果",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "提交登入結果",
"en": "Submit sign-in result",
"ja": "サインイン結果を送信"
},
{
"zh": "提亮暗部与中间调,保留高光峰值。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "提亮暗部與中間調,保留高光峰值。",
"en": "Lifts shadows and midtones while keeping the highlight peak.",
"ja": "暗部と中間調を明るくし、ハイライトのピークを保ちます。"
},
{
"zh": "提亮补偿",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "提亮補償",
"en": "Bright-room compensation",
"ja": "明るい部屋向け補正"
},
{
"zh": "提示音设置保存失败",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "提示音設定儲存失敗",
"en": "Could not save the sound setting",
"ja": "通知音の設定を保存できませんでした"
@@ -9222,7 +9222,7 @@
},
{
"zh": "搜索完成,未发现 PS5;确认同一局域网,或手动填写 IP。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "搜索完成,未發現 PS5;確認同一區域網路,或手動填寫 IP。",
"en": "Search finished; no PS5 found. Make sure it is on the same LAN, or enter the IP by hand.",
"ja": "検索が完了しましたが、PS5 は見つかりませんでした。同じ LAN にあるか確認するか、IP を手入力してください。"
@@ -9321,7 +9321,7 @@
},
{
"zh": "播放地址",
- "src": "qml/DialogHost.qml",
+ "src": "qml/NetworkSourceDialog.qml",
"zh-TW": "播放位址",
"en": "Open media URL",
"ja": "URL を開く"
@@ -9384,14 +9384,14 @@
},
{
"zh": "播放速度 %1×",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "播放速度 %1×",
"en": "Playback speed %1×",
"ja": "再生速度 %1×"
},
{
"zh": "操作失败;请检查网络、输入和可用磁盘空间。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "操作失敗;請檢查網路、輸入和可用磁盤空間。",
"en": "The operation failed; check the network, input and free disk space.",
"ja": "操作に失敗しました。ネットワーク、入力、ディスクの空き容量を確認してください。"
@@ -9412,14 +9412,14 @@
},
{
"zh": "收到 HDR 也按 SDR 预览,立即生效",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "收到 HDR 也按 SDR 預覽,立即生效",
"en": "Preview HDR as SDR too; takes effect immediately",
"ja": "HDR を受信しても SDR でプレビュー。すぐに反映"
},
{
"zh": "收到黑帧 · 检查输入制式",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "收到黑幀 · 檢查輸入制式",
"en": "Black frames received · Check the input mode",
"ja": "黒いフレームを受信 · 入力モードを確認"
@@ -9433,28 +9433,28 @@
},
{
"zh": "改动会实时显示在这里。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "改動會即時顯示在這裡。",
"en": "Changes show here live.",
"ja": "変更はここにリアルタイムで表示されます。"
},
{
"zh": "改动曲线后会按当前显示器记住,换设备时自动套用",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "改動曲線後會按當前顯示器記住,換裝置時自動套用",
"en": "Curve edits are saved for this display and restored when you switch back",
"ja": "カーブの変更を現在のディスプレイに保存し、戻したときに復元します"
},
{
"zh": "改动曲线后按影片记住,下次自动套用",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "改動曲線後按影片記住,下次自動套用",
"en": "Curve edits are saved for the film and restored next time",
"ja": "カーブの変更を作品ごとに保存し、次回復元します"
},
{
"zh": "改名失败:名称不能为空、超过48字或与已有预设重复",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "改名失敗:名稱不能為空、超過48字或與已有預設重複",
"en": "Rename failed: the name cannot be empty, longer than 48 characters, or the same as another preset",
"ja": "名前の変更に失敗しました:空、48 文字超、または既存のプリセットと同じ名前にはできません"
@@ -9475,42 +9475,42 @@
},
{
"zh": "效果参数无效,未提交;详见诊断日志",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/QmlPlayerBridge_p.h",
"zh-TW": "效果參數無效,未提交;詳見診斷日誌",
"en": "Invalid effect settings, not submitted; see the diagnostic log",
"ja": "エフェクトの設定が不正なため送信していません。診断ログを確認してください"
},
{
"zh": "效果链",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "效果鏈",
"en": "Effect chain",
"ja": "エフェクトチェーン"
},
{
"zh": "效果链已满",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "效果鏈已滿",
"en": "The effect chain is full",
"ja": "エフェクトチェーンがいっぱいです"
},
{
"zh": "数值超出范围",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "數值超出範圍",
"en": "Value out of range",
"ja": "値が範囲外です"
},
{
"zh": "数值越大,高光过渡越平缓",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "數值越大,高光過渡越平緩",
"en": "Higher values give a gentler highlight transition",
"ja": "値が大きいほどハイライトの変化が緩やかになります"
},
{
"zh": "整体亮暗",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "整體亮暗",
"en": "Overall brightness",
"ja": "全体の明るさ"
@@ -9524,7 +9524,7 @@
},
{
"zh": "整体观感",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "整體觀感",
"en": "Brightness balance",
"ja": "明るさのバランス"
@@ -9545,21 +9545,21 @@
},
{
"zh": "整档预设",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "整檔預設",
"en": "Full presets",
"ja": "全体プリセット"
},
{
"zh": "整片偏暗、只有少量亮点",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "整片偏暗、只有少量亮點",
"en": "Mostly dark with a few bright highlights",
"ja": "全体的に暗く、明るい部分が少ない作品"
},
{
"zh": "整片偏暗,且超出显示设备能力",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "整片偏暗,且超出顯示裝置能力",
"en": "Mostly dark with highlights beyond the display capability",
"ja": "全体的に暗く、ハイライトがディスプレイの能力を超える作品"
@@ -9573,7 +9573,7 @@
},
{
"zh": "文件不存在",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "檔案不存在",
"en": "The file does not exist",
"ja": "ファイルが存在しません"
@@ -9643,7 +9643,7 @@
},
{
"zh": "文本字幕 · PGS/SUP · VobSub(IDX+SUB)",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "文字字幕 · PGS/SUP · VobSub(IDX+SUB)",
"en": "Text · PGS/SUP · VobSub (IDX+SUB)",
"ja": "テキスト字幕 · PGS/SUP · VobSub(IDX+SUB)"
@@ -9657,7 +9657,7 @@
},
{
"zh": "断开",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "斷開",
"en": "Disconnect",
"ja": "切断"
@@ -9692,21 +9692,21 @@
},
{
"zh": "无",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SettingsPage.qml",
"zh-TW": "無",
"en": "None",
"ja": "なし"
},
{
"zh": "无效的按键",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "無效的按鍵",
"en": "Invalid key",
"ja": "無効なキー"
},
{
"zh": "无效编辑模式",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "無效編輯模式",
"en": "Invalid edit mode",
"ja": "無効な編集モード"
@@ -9762,7 +9762,7 @@
},
{
"zh": "无法分配配对存档,请重试。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "無法分配配對存檔,請重試。",
"en": "Could not allocate the pairing record; try again.",
"ja": "ペアリング記録を確保できませんでした。再試行してください。"
@@ -9895,7 +9895,7 @@
},
{
"zh": "无法打开",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "無法開啟",
"en": "Could not open",
"ja": "開けません"
@@ -9909,28 +9909,28 @@
},
{
"zh": "无法打开数据目录",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "無法開啟資料目錄",
"en": "Could not open the data folder",
"ja": "データフォルダーを開けません"
},
{
"zh": "无法打开浏览器",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "無法開啟瀏覽器",
"en": "Could not open the browser",
"ja": "ブラウザーを開けませんでした"
},
{
"zh": "无法打开浏览器,请检查默认浏览器设置。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "無法開啟瀏覽器,請檢查預設瀏覽器設定。",
"en": "Could not open the browser; check the default browser setting.",
"ja": "ブラウザーを開けません。既定のブラウザーの設定を確認してください。"
},
{
"zh": "无法打开目录:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "無法開啟目錄:%1",
"en": "Could not open the folder: %1",
"ja": "フォルダーを開けません:%1"
@@ -9972,28 +9972,28 @@
},
{
"zh": "无法检测",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "無法偵測",
"en": "Cannot detect",
"ja": "検出できません"
},
{
"zh": "无法检测屏幕是否支持(目前只支持 NVIDIA 显卡)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "無法偵測螢幕是否支援(目前只支援 NVIDIA 顯示卡)",
"en": "Cannot detect whether the display supports it (NVIDIA GPUs only for now)",
"ja": "ディスプレイの対応を検出できません(現在は NVIDIA GPU のみ)"
},
{
"zh": "无法添加文件:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "無法添加檔案:%1",
"en": "Could not add file: %1",
"ja": "ファイルを追加できません:%1"
},
{
"zh": "无法生成采集连接参数",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "無法生成擷取連接參數",
"en": "Could not build the capture connection parameters",
"ja": "キャプチャー接続のパラメーターを生成できませんでした"
@@ -10042,7 +10042,7 @@
},
{
"zh": "无法读取远程游玩目录;原有配对文件不会被改动。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "無法讀取遠程遊玩目錄;原有配對檔案不會被改動。",
"en": "Could not read the Remote Play folder; existing pairing files are left untouched.",
"ja": "リモートプレイのフォルダーを読み取れません。既存のペアリングファイルは変更しません。"
@@ -10063,7 +10063,7 @@
},
{
"zh": "无陀螺仪",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "無陀螺儀",
"en": "no gyro",
"ja": "ジャイロなし"
@@ -10077,7 +10077,7 @@
},
{
"zh": "日志目录不可用",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "日誌目錄不可用",
"en": "Log folder unavailable",
"ja": "ログフォルダーを使用できません"
@@ -10098,7 +10098,7 @@
},
{
"zh": "旧版格式选择",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "舊版格式選擇",
"en": "Legacy format selection",
"ja": "従来の形式選択"
@@ -10133,7 +10133,7 @@
},
{
"zh": "时间",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "時間",
"en": "Time",
"ja": "時間"
@@ -10154,7 +10154,7 @@
},
{
"zh": "明亮环境",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "明亮環境",
"en": "Bright room",
"ja": "明るい部屋"
@@ -10259,7 +10259,7 @@
},
{
"zh": "显示全部可用帧率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "顯示全部可用幀率",
"en": "Show all available frame rates",
"ja": "利用可能なフレームレートをすべて表示"
@@ -10329,7 +10329,7 @@
},
{
"zh": "显示器",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "顯示器",
"en": "Display",
"ja": "ディスプレイ"
@@ -10343,28 +10343,28 @@
},
{
"zh": "显示在主字幕上方",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "顯示在主字幕上方",
"en": "Shown above the main subtitles",
"ja": "メイン字幕の上に表示"
},
{
"zh": "显示字幕",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "顯示字幕",
"en": "Show subtitles",
"ja": "字幕を表示"
},
{
"zh": "显示峰值",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "顯示峰值",
"en": "Display peak",
"ja": "ディスプレイのピーク"
},
{
"zh": "显示帧率",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "顯示幀率",
"en": "Show frame rate",
"ja": "フレームレートを表示"
@@ -10406,21 +10406,21 @@
},
{
"zh": "显示鼠标指针",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "顯示滑鼠指標",
"en": "Show mouse pointer",
"ja": "マウスポインターを表示"
},
{
"zh": "晚点 P95",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "晚點 P95",
"en": "Late P95",
"ja": "遅延 P95"
},
{
"zh": "晚点: 当前 %1 ms / P95 %2 ms",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "晚點: 當前 %1 ms / P95 %2 ms",
"en": "Late: now %1 ms / P95 %2 ms",
"ja": "遅延:現在 %1 ms / P95 %2 ms"
@@ -10462,7 +10462,7 @@
},
{
"zh": "暗亮双修",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "暗亮雙修",
"en": "Shadows and highlights",
"ja": "暗部とハイライト"
@@ -10476,28 +10476,28 @@
},
{
"zh": "暗场多",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "暗場多",
"en": "Mostly dark",
"ja": "暗い場面が多い"
},
{
"zh": "暗场很暗、亮场又很亮的片子:两头都照顾。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "暗場很暗、亮場又很亮的片子:兩頭都照顧。",
"en": "For content with deep shadows and bright highlights.",
"ja": "暗部が深く、ハイライトが明るい映像向け。"
},
{
"zh": "暗场提亮",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "暗场提亮",
"en": "Lift dark scenes",
"ja": "Lift dark scenes"
},
{
"zh": "暗室观影",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "暗室觀影",
"en": "Dark room",
"ja": "暗い部屋"
@@ -10511,7 +10511,7 @@
},
{
"zh": "暗部抬升",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "暗部抬升",
"en": "Shadow lift",
"ja": "暗部持ち上げ"
@@ -10525,14 +10525,14 @@
},
{
"zh": "暗部提亮",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "暗部提亮",
"en": "Shadow brightness",
"ja": "暗部の明るさ"
},
{
"zh": "曝光(EV)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "曝光(EV)",
"en": "Exposure (EV)",
"ja": "露光量(EV)"
@@ -10546,49 +10546,49 @@
},
{
"zh": "曲线作用于 HDR10 或 scRGB 输出,也适用于 RTX Video HDR 转换后的画面。低亮度画面可能不会触及高光阈值。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "曲線作用於 HDR10 或 scRGB 輸出,也適用於 RTX Video HDR 轉換後的畫面。低亮度畫面可能不會觸及高光閾值。",
"en": "Applies to HDR10 or scRGB output, including RTX Video HDR conversion. Dim images may not reach the highlight thresholds.",
"ja": "HDR10/scRGB 出力と RTX Video HDR の変換結果に適用されます。暗い映像ではハイライトのしきい値に届かない場合があります。"
},
{
"zh": "曲线保持原样,HDR10 元数据跟随片源。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "曲線保持原樣,HDR10 中繼資料跟隨片源。",
"en": "Keeps the original curve and follows source HDR10 metadata.",
"ja": "カーブは元のまま、HDR10 メタデータはソースに追従します。"
},
{
"zh": "曲线图、读数与提示",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "曲線圖、讀數與提示",
"en": "Curve, readings and guidance",
"ja": "カーブ・測定値・案内"
},
{
"zh": "曲线未开启",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "曲線未開啟",
"en": "Curve is off",
"ja": "カーブはオフです"
},
{
"zh": "曲线未设「峰值上限」,不会有像素被压平。滚降区 %1% · 暗部提升区 %2%",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "曲線未設「峰值上限」,不會有像素被壓平。滾降區 %1% · 暗部提升區 %2%",
"en": "No peak cap; no hard clipping. Highlight compression %1% · shadow lift %2%",
"ja": "ピーク上限なし。ハードクリップなし。ハイライト圧縮 %1% · 暗部持ち上げ %2%"
},
{
"zh": "曲线没有设硬上限,不会裁剪片源峰值",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "曲線沒有設硬上限,不會裁剪片源峰值",
"en": "No hard cap is set on the curve",
"ja": "カーブにハード上限が設定されていません"
},
{
"zh": "曲线生效时会约束内容亮度提示;SDR 输入默认不发送,手动填写除外。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "曲線生效時會約束內容亮度提示;SDR 輸入預設不發送,手動填寫除外。",
"en": "The curve bounds content-light hints. SDR input sends none by default, unless entered manually.",
"ja": "カーブに応じてコンテンツ輝度のヒントを制限します。SDR 入力では手動指定がない限り送信しません。"
@@ -10602,7 +10602,7 @@
},
{
"zh": "最多 4 个保护区域,请先删除一个",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "最多 4 個保護區域,請先刪除一個",
"en": "At most 4 protected areas; delete one first",
"ja": "保護領域は最大 4 個です。先に 1 つ削除してください"
@@ -10637,7 +10637,7 @@
},
{
"zh": "最小",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "最小",
"en": "Minimum",
"ja": "最小"
@@ -10665,21 +10665,21 @@
},
{
"zh": "有效目标 %1 fps",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "有效目標 %1 fps",
"en": "Effective target %1 fps",
"ja": "実効目標 %1 fps"
},
{
"zh": "有配对存档无法读取或解密,详情见日志。请使用原 Windows 账户;不要删除原件。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "有配對存檔無法讀取或解密,詳情見日誌。請使用原 Windows 賬戶;不要刪除原件。",
"en": "A pairing record cannot be read or decrypted; details in the log. Use the original Windows account and do not delete the original.",
"ja": "ペアリング記録を読み取れないか、復号できません。詳細はログを参照してください。元の Windows アカウントを使い、元のファイルは削除しないでください。"
},
{
"zh": "有陀螺仪",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "有陀螺儀",
"en": "gyro",
"ja": "ジャイロあり"
@@ -10693,7 +10693,7 @@
},
{
"zh": "有限 · Limited",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "有限 · Limited",
"en": "Limited",
"ja": "リミテッド · Limited"
@@ -10721,14 +10721,14 @@
},
{
"zh": "未启用",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "未啟用",
"en": "Not enabled",
"ja": "無効"
},
{
"zh": "未启用子功能",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "未啟用子功能",
"en": "No function switched on",
"ja": "機能がオンになっていません"
@@ -10763,21 +10763,21 @@
},
{
"zh": "未找到 VFG 运行组件,请在组件页核对路径",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "未找到 VFG 執行組件,請在組件頁核對路徑",
"en": "VFG runtime components were not found. Check their paths on the Components page.",
"ja": "VFG ランタイムが見つかりません。コンポーネントページでパスをご確認ください。"
},
{
"zh": "未找到可捕获的窗口或显示器",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "未找到可擷取的視窗或顯示器",
"en": "No window or display found to capture",
"ja": "キャプチャーできるウィンドウやディスプレイが見つかりません"
},
{
"zh": "未找到采集设备。连接后点击刷新。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "未找到擷取裝置。連接後點擊刷新。",
"en": "No capture device found. Connect one and click Refresh.",
"ja": "キャプチャーデバイスが見つかりません。接続してから「更新」を押してください。"
@@ -10805,35 +10805,35 @@
},
{
"zh": "未检测到人脸",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "未偵測到人臉",
"en": "No face detected",
"ja": "顔が検出されていません"
},
{
"zh": "未检测到手柄",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "未偵測到手把",
"en": "No controller detected",
"ja": "コントローラーが見つかりません"
},
{
"zh": "未检测到采集设备",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "未檢測到擷取裝置",
"en": "No capture device detected",
"ja": "キャプチャーデバイスが検出されません"
},
{
"zh": "未测",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "未測",
"en": "N/A",
"ja": "未計測"
},
{
"zh": "未测量",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "未測量",
"en": "Not measured",
"ja": "未計測"
@@ -10861,7 +10861,7 @@
},
{
"zh": "未登录",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "未登入",
"en": "Not signed in",
"ja": "未サインイン"
@@ -10903,14 +10903,14 @@
},
{
"zh": "未知的效果: %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "未知的效果: %1",
"en": "Unknown effect: %1",
"ja": "不明なエフェクト:%1"
},
{
"zh": "未知补帧后端",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "未知補幀後端",
"en": "Unknown frame generation backend",
"ja": "不明なフレーム生成方式"
@@ -10931,7 +10931,7 @@
},
{
"zh": "未补帧",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "未補幀",
"en": "No FG",
"ja": "FG なし"
@@ -10945,14 +10945,14 @@
},
{
"zh": "未触及",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "未觸及",
"en": "Not reached",
"ja": "未到達"
},
{
"zh": "未设上限",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "未設上限",
"en": "No cap",
"ja": "上限なし"
@@ -10973,28 +10973,28 @@
},
{
"zh": "未连接",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "未連接",
"en": "Not connected",
"ja": "未接続"
},
{
"zh": "未选择目标",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "未選擇目標",
"en": "No target selected",
"ja": "対象が選ばれていません"
},
{
"zh": "未选择设备",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "未選擇裝置",
"en": "No device selected",
"ja": "デバイスが選ばれていません"
},
{
"zh": "未配对",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "未配對",
"en": "Not paired",
"ja": "未ペアリング"
@@ -11008,7 +11008,7 @@
},
{
"zh": "本机屏幕分辨率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "本機螢幕解析度",
"en": "This PC's screen resolution",
"ja": "この PC の画面解像度"
@@ -11092,7 +11092,7 @@
},
{
"zh": "查找",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "查找",
"en": "Search",
"ja": "検索"
@@ -11113,7 +11113,7 @@
},
{
"zh": "标准",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "標準",
"en": "Standard",
"ja": "標準"
@@ -11127,21 +11127,21 @@
},
{
"zh": "校准中…",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "校準中…",
"en": "Calibrating…",
"ja": "補正中…"
},
{
"zh": "样式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "樣式",
"en": "Style",
"ja": "スタイル"
},
{
"zh": "格式与画面",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "格式與畫面",
"en": "Format and picture",
"ja": "フォーマットと映像"
@@ -11155,14 +11155,14 @@
},
{
"zh": "检查中…",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "檢查中…",
"en": "Checking…",
"ja": "確認中…"
},
{
"zh": "检查并选择",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "檢查並選擇",
"en": "Check and select",
"ja": "確認して選択"
@@ -11190,7 +11190,7 @@
},
{
"zh": "检测到 %1 张人脸",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "偵測到 %1 張人臉",
"en": "%1 face(s) detected",
"ja": "%1 人の顔を検出"
@@ -11225,21 +11225,21 @@
},
{
"zh": "检测到 RivaTuner(小飞机 OSD)注入了 Veyra。请把 设置 → 监控软件兼容 设为“自动”并在小飞机运行时重启 Veyra:界面改用兼容绘制,OSD 只显示在视频上",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/QmlPlayerBridge_p.h",
"zh-TW": "偵測到 RivaTuner(小飛機 OSD)注入了 Veyra。請把 設定 → 監控軟體相容 設為「自動」,並在小飛機執行時重新啟動 Veyra:介面改用相容繪製,OSD 只顯示在影片上",
"en": "RivaTuner (RTSS OSD) is injected into Veyra. Set Settings → Monitoring overlay compatibility to Auto and restart Veyra while RTSS is running: the interface uses compatible drawing and the OSD shows on the video only",
"ja": "RivaTuner(RTSS OSD)が Veyra に挿入されています。設定 → モニタリングソフト互換 を「自動」にし、RTSS の実行中に Veyra を再起動してください。インターフェースが互換描画になり、OSD は映像にだけ表示されます"
},
{
"zh": "检测到抖音直播伴侣:GPU 优先级暂时从“实时”降为“高”,避免两个程序争用显卡时卡死;直播伴侣退出后自动恢复",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "偵測到抖音直播伴侶:GPU 優先級暫時從「即時」降為「高」,避免兩個程式爭用顯示卡時卡死;直播伴侶結束後自動恢復",
"en": "Douyin Live Companion detected: GPU priority is lowered from Realtime to High for now, so the two programs do not hang while sharing the GPU; it returns when the companion exits",
"ja": "抖音直播伴侶を検出しました。2 つのプログラムが GPU を取り合ってフリーズしないよう、GPU 優先度を一時的に「リアルタイム」から「高」に下げます。直播伴侶を終了すると自動で戻ります"
},
{
"zh": "检测到独占全屏的游戏:Windows 不允许其它窗口盖在它上面,请把游戏改成无边框窗口或窗口化",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "偵測到獨佔全螢幕的遊戲:Windows 不允許其他視窗蓋在它上面,請把遊戲改成無邊框視窗或視窗化",
"en": "An exclusive-fullscreen game is running: Windows lets no other window cover it. Switch the game to borderless or windowed mode",
"ja": "排他的フルスクリーンのゲームを検出しました。Windows は他のウィンドウを重ねられません。ゲームをボーダーレスまたはウィンドウモードにしてください"
@@ -11330,14 +11330,14 @@
},
{
"zh": "模式参数无效,未切换",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "模式參數無效,未切換",
"en": "Invalid mode settings; not switched",
"ja": "モードの設定が無効なため、切り替えていません"
},
{
"zh": "模式配置无效,未切换",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "模式設定無效,未切換",
"en": "Invalid mode configuration; not switched",
"ja": "モードの構成が無効なため、切り替えていません"
@@ -11351,7 +11351,7 @@
},
{
"zh": "正值延后音频",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProAudioPanel.qml",
"zh-TW": "正值延後音訊",
"en": "Positive values delay the audio",
"ja": "正の値で音声を遅らせる"
@@ -11365,7 +11365,7 @@
},
{
"zh": "正在保存:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "正在儲存:%1",
"en": "Saving: %1",
"ja": "保存中:%1"
@@ -11400,7 +11400,7 @@
},
{
"zh": "正在加载外部字幕:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "正在載入外部字幕:%1",
"en": "Loading external subtitles: %1",
"ja": "外部字幕を読み込み中:%1"
@@ -11442,14 +11442,14 @@
},
{
"zh": "正在处理 %1 / %2:%3",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "正在處理 %1 / %2:%3",
"en": "Processing %1 / %2: %3",
"ja": "処理中 %1 / %2:%3"
},
{
"zh": "正在处理…可随时取消",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "正在處理…可隨時取消",
"en": "Processing… you can cancel at any time",
"ja": "処理中…いつでもキャンセルできます"
@@ -11491,14 +11491,14 @@
},
{
"zh": "正在开始屏幕捕获…",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "正在開始螢幕擷取…",
"en": "Starting screen capture…",
"ja": "画面キャプチャーを開始中…"
},
{
"zh": "正在恢复",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "正在恢復",
"en": "Recovering",
"ja": "復旧中"
@@ -11512,14 +11512,14 @@
},
{
"zh": "正在打开采集设备 · %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "正在開啟擷取裝置 · %1",
"en": "Opening the capture device · %1",
"ja": "キャプチャーデバイスを開いています · %1"
},
{
"zh": "正在打开采集设备…",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "正在開啟擷取裝置…",
"en": "Opening the capture device…",
"ja": "キャプチャーデバイスを開いています…"
@@ -11568,14 +11568,14 @@
},
{
"zh": "正在收帧",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "正在接收影格",
"en": "Receiving frames",
"ja": "フレームを受信中"
},
{
"zh": "正在更新",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "正在更新",
"en": "Updating",
"ja": "更新中"
@@ -11589,14 +11589,14 @@
},
{
"zh": "正在查询…当前播放继续",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "正在查詢…當前播放繼續",
"en": "Checking… playback continues",
"ja": "確認中…再生は続行しています"
},
{
"zh": "正在查询采集设备…当前播放继续",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "正在查詢擷取裝置…當前播放繼續",
"en": "Looking up capture devices… playback continues",
"ja": "キャプチャーデバイスを確認中…再生は続行しています"
@@ -11638,14 +11638,14 @@
},
{
"zh": "正在自动对齐",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "正在自動對齊",
"en": "Auto-aligning",
"ja": "自動調整中"
},
{
"zh": "正在自动对齐:分析音轨(最多前 30 分钟)…",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "正在自動對齊:分析音軌(最多前 30 分鐘)…",
"en": "Auto-aligning: analyzing the audio track (first 30 minutes at most)…",
"ja": "自動調整中:音声トラックを分析しています(最大で最初の 30 分)…"
@@ -11673,7 +11673,7 @@
},
{
"zh": "正在读取设备支持的格式…",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "正在讀取裝置支援的格式…",
"en": "Reading the formats the device supports…",
"ja": "デバイスが対応するフォーマットを読み込み中…"
@@ -11687,7 +11687,7 @@
},
{
"zh": "正在连接 %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "正在連接 %1",
"en": "Connecting to %1",
"ja": "%1 に接続中"
@@ -11701,21 +11701,21 @@
},
{
"zh": "正在连接 PS5 · %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "正在連接 PS5 · %1",
"en": "Connecting to PS5 · %1",
"ja": "PS5 に接続中 · %1"
},
{
"zh": "正在连接 PS5…",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "正在連接 PS5…",
"en": "Connecting to PS5…",
"ja": "PS5 に接続中…"
},
{
"zh": "正在连接 Xbox · %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "正在連接 Xbox · %1",
"en": "Connecting to Xbox · %1",
"ja": "Xbox に接続中 · %1"
@@ -11757,7 +11757,7 @@
},
{
"zh": "正常",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "正常",
"en": "Normal",
"ja": "正常"
@@ -11771,28 +11771,28 @@
},
{
"zh": "此版本不含 PC 串流",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "此版本不含 PC 串流",
"en": "This version does not include PC streaming",
"ja": "このバージョンには PC ストリーミングが含まれていません"
},
{
"zh": "此版本不含 PS5 串流",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "此版本不含 PS5 串流",
"en": "This version does not include PS5 streaming",
"ja": "このバージョンには PS5 ストリーミングが含まれていません"
},
{
"zh": "此版本不含 Xbox 串流",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "此版本不含 Xbox 串流",
"en": "This version does not include Xbox streaming",
"ja": "このバージョンには Xbox ストリーミングが含まれていません"
},
{
"zh": "此版本未包含 PS5 远程游玩组件。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "此版本未包含 PS5 遠程遊玩組件。",
"en": "This version does not include the PS5 Remote Play component.",
"ja": "このバージョンには PS5 リモートプレイのコンポーネントが含まれていません。"
@@ -11806,7 +11806,7 @@
},
{
"zh": "此软件包没有附带性能模式所需的 DLSS 帧生成 310.9.16 运行库",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "此軟體包沒有附帶效能模式所需的 DLSS 幀生成 310.9.16 執行庫",
"en": "This package does not include the DLSS Frame Generation 310.9.16 runtime the performance mode needs",
"ja": "このパッケージにはパフォーマンスモードに必要な DLSS フレーム生成 310.9.16 ランタイムが含まれていません"
@@ -11820,21 +11820,21 @@
},
{
"zh": "残差",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "殘差",
"en": "Residual",
"ja": "残差"
},
{
"zh": "母版峰值 (nit)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "母版峰值 (nit)",
"en": "Mastering peak (nit)",
"ja": "マスタリングピーク (nit)"
},
{
"zh": "母版峰值偏低(老片 / 转制片)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "母版峰值偏低(老片 / 轉制片)",
"en": "Low mastering peak (older or converted title)",
"ja": "マスタリングのピークが低い作品(旧作・変換版)"
@@ -11876,7 +11876,7 @@
},
{
"zh": "没有可保存的画面",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "沒有可儲存的畫面",
"en": "No picture to save",
"ja": "保存できる映像がありません"
@@ -11897,7 +11897,7 @@
},
{
"zh": "没有可用的主字幕,无法自动对齐",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "沒有可用的主字幕,無法自動對齊",
"en": "No main subtitles available, so auto-alignment is not possible",
"ja": "メイン字幕がないため、自動調整できません"
@@ -11946,21 +11946,21 @@
},
{
"zh": "没有正在播放的画面,无法录制",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Recording.cpp",
"zh-TW": "沒有正在播放的畫面,無法錄製",
"en": "Nothing is playing, so there is nothing to record",
"ja": "再生中の映像がないため録画できません"
},
{
"zh": "没有正在播放的画面,无法截图",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "沒有正在播放的畫面,無法截圖",
"en": "Nothing is playing, so no screenshot can be taken",
"ja": "再生中の映像がないため、スクリーンショットを撮れません"
},
{
"zh": "没有正在显示的字幕",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "沒有正在顯示的字幕",
"en": "No subtitles on screen",
"ja": "表示中の字幕はありません"
@@ -11995,21 +11995,21 @@
},
{
"zh": "没能继续上次的 PC 串流,请在 PC 串流窗口里重新选择",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "沒能繼續上次的 PC 串流,請在 PC 串流視窗裡重新選擇",
"en": "Could not continue the last PC stream; choose again in the PC streaming window",
"ja": "前回の PC ストリーミングを再開できませんでした。PC ストリーミングのウィンドウで選び直してください"
},
{
"zh": "没能继续上次的 PS5 串流:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "沒能繼續上次的 PS5 串流:%1",
"en": "Could not continue the last PS5 stream: %1",
"ja": "前回の PS5 ストリーミングを再開できませんでした:%1"
},
{
"zh": "没能继续上次的 Xbox 串流,请在 Xbox 串流窗口里重新选择",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "沒能繼續上次的 Xbox 串流,請在 Xbox 串流視窗裡重新選擇",
"en": "Could not continue the last Xbox stream; choose again in the Xbox streaming window",
"ja": "前回の Xbox ストリーミングを再開できませんでした。Xbox ストリーミングのウィンドウで選び直してください"
@@ -12044,7 +12044,7 @@
},
{
"zh": "混合",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "混合",
"en": "Blending",
"ja": "ブレンド"
@@ -12058,7 +12058,7 @@
},
{
"zh": "添加",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ExportPage.qml",
"zh-TW": "添加",
"en": "Add",
"ja": "追加"
@@ -12093,7 +12093,7 @@
},
{
"zh": "添加文件到播放列表",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "新增檔案至播放清單",
"en": "Add files to playlist",
"ja": "プレイリストにファイルを追加"
@@ -12114,7 +12114,7 @@
},
{
"zh": "清晰度",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "清晰度",
"en": "Clarity",
"ja": "明瞭度"
@@ -12142,28 +12142,28 @@
},
{
"zh": "清除影片记忆",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "清除影片記憶",
"en": "Clear film memory",
"ja": "作品の記憶を消去"
},
{
"zh": "清除记忆",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "清除記憶",
"en": "Clear memory",
"ja": "記憶を消去"
},
{
"zh": "游戏",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "遊戲",
"en": "Game",
"ja": "ゲーム"
},
{
"zh": "游戏与程序 · ",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "遊戲與程式 · ",
"en": "Games and programs · ",
"ja": "ゲームとプログラム · "
@@ -12177,21 +12177,21 @@
},
{
"zh": "游戏模式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "遊戲模式",
"en": "Game mode",
"ja": "ゲームモード"
},
{
"zh": "游戏模式不裁剪;贴合原窗口时画面与鼠标位置一一对应",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "遊戲模式不裁剪;貼合原視窗時畫面與滑鼠位置一一對應",
"en": "Game mode does not crop the source. Original-window alignment preserves exact mouse positions.",
"ja": "ゲームモードではソースを切り抜きません。元のウィンドウに合わせると映像とマウス位置が一致します。"
},
{
"zh": "游戏模式用真实指针,画面里不再画一个",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "遊戲模式使用真實指標,畫面裡不再畫一個",
"en": "Game mode uses the real pointer, so the picture does not draw a second one",
"ja": "ゲームモードでは実際のポインターを使い、映像には描きません"
@@ -12226,14 +12226,14 @@
},
{
"zh": "源 %1 fps",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "源 %1 fps",
"en": "Source %1 fps",
"ja": "ソース %1 fps"
},
{
"zh": "源: %1x%2 旋转 %3° 标称 %4 fps",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "源: %1x%2 旋轉 %3° 標稱 %4 fps",
"en": "Source: %1x%2 rotated %3° nominal %4 fps",
"ja": "ソース:%1x%2 回転 %3° 公称 %4 fps"
@@ -12289,7 +12289,7 @@
},
{
"zh": "滚降强度 (%)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "滾降強度 (%)",
"en": "Roll-off strength (%)",
"ja": "壓縮の強さ (%)"
@@ -12359,21 +12359,21 @@
},
{
"zh": "片源最亮 %1 nit,曲线硬上限 %2 nit:%3",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "片源最亮 %1 nit,曲線硬上限 %2 nit:%3",
"en": "Declared source peak %1 nit, curve cap %2 nit: %3",
"ja": "ソースの公称ピーク %1 nit、カーブ上限 %2 nit:%3"
},
{
"zh": "片源没有携带亮度信息",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "片源沒有攜帶亮度資訊",
"en": "No luminance metadata in the source",
"ja": "ソースに輝度情報がありません"
},
{
"zh": "片源没有携带亮度信息(抓屏 / 串流),无法自动选档",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "片源沒有攜帶亮度資訊(抓屏 / 串流),無法自動選檔",
"en": "No luminance metadata (capture/stream); automatic selection is unavailable",
"ja": "輝度情報がないため(キャプチャー/配信)、自動選択はできません"
@@ -12394,7 +12394,7 @@
},
{
"zh": "状态: %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "狀態: %1",
"en": "Status: %1",
"ja": "状態:%1"
@@ -12408,42 +12408,42 @@
},
{
"zh": "环境光补偿:屋里亮(开灯/白天)就补偿一点,屋里暗(关灯)就不补偿",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "環境光補償:屋裡亮(開燈/白天)就補償一點,屋裡暗(關燈)就不補償",
"en": "Ambient compensation: add some in a bright room; use none in a dark room",
"ja": "環境光補正:明るい部屋では補正し、暗い部屋では補正しません"
},
{
"zh": "生效中",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "生效中",
"en": "Active",
"ja": "有効"
},
{
"zh": "生效中:NVIDIA DLSS 帧生成性能模式(测试版)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "生效中:NVIDIA DLSS 幀生成效能模式(測試版)",
"en": "Active: NVIDIA DLSS Frame Generation performance mode (beta)",
"ja": "動作中:NVIDIA DLSS フレーム生成パフォーマンスモード(ベータ)"
},
{
"zh": "生效中:屏幕跟着画面刷新",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "生效中:螢幕跟著畫面更新",
"en": "Active: the display refreshes with each frame",
"ja": "動作中:画面がフレームに合わせて更新"
},
{
"zh": "生效:{}p / {} fps / {} / 请求 {} Mbps · 实收视频 {:.1f} Mbps",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "生效:{}p / {} fps / {} / 請求 {} Mbps · 實收影片 {:.1f} Mbps",
"en": "Active: {}p / {} fps / {} / requested {} Mbps · video received {:.1f} Mbps",
"ja": "適用中:{}p / {} fps / {} / 要求 {} Mbps · 実受信 {:.1f} Mbps"
},
{
"zh": "用你的 Xbox(微软)账号在微软的页面登录,软件看不到密码",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "用你的 Xbox(微軟)帳號在微軟的頁面登入,軟體看不到密碼",
"en": "Sign in on Microsoft's page with your Xbox (Microsoft) account; the app never sees the password",
"ja": "Microsoft のページで Xbox(Microsoft)アカウントにサインインします。アプリはパスワードを見ません"
@@ -12457,7 +12457,7 @@
},
{
"zh": "用远程游玩控制 PS5",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "用遠程遊玩控制 PS5",
"en": "Control the PS5 through Remote Play",
"ja": "リモートプレイで PS5 を操作"
@@ -12499,14 +12499,14 @@
},
{
"zh": "画面",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "畫面",
"en": "Picture",
"ja": "映像"
},
{
"zh": "画面上下翻转",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "畫面上下翻轉",
"en": "Flip vertically",
"ja": "上下反転"
@@ -12520,7 +12520,7 @@
},
{
"zh": "画面偏灰、平淡的老片或转制片:提高对比观感。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "畫面偏灰、平淡的老片或轉製片:提高對比觀感。",
"en": "Adds contrast to flat or faded transfers.",
"ja": "平坦な映像のコントラスト感を高めます。"
@@ -12541,21 +12541,21 @@
},
{
"zh": "画面和声音来自采集卡,手柄经 PS5 远程游玩发给主机。把处理后的画面再串流给掌机或别的电脑时,用那边的手柄玩 PS5",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "畫面和聲音來自擷取卡,手把經 PS5 遠程遊玩發給主機。把處理後的畫面再串流給掌機或別的電腦時,用那邊的手把玩 PS5",
"en": "Picture and sound come from the capture card; the controller goes to the console through PS5 Remote Play. When this picture is re-streamed to a handheld or another PC, play the PS5 with the controller there",
"ja": "映像と音声はキャプチャーカードから、コントローラーは PS5 リモートプレイで本体へ送ります。処理した映像を携帯機や別の PC に再ストリーミングするとき、そちらのコントローラーで PS5 を遊べます"
},
{
"zh": "画面在主窗口播放",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "畫面在主視窗播放",
"en": "The picture plays in the main window",
"ja": "映像はメインウィンドウで再生されます"
},
{
"zh": "画面对比 · 补帧暂停",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "畫面對比 · 補幀暫停",
"en": "Image comparison · frame generation paused",
"ja": "映像比較 · フレーム生成は一時停止中"
@@ -12576,21 +12576,21 @@
},
{
"zh": "画面抽样统计",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "畫面抽樣統計",
"en": "Image sample statistics",
"ja": "映像のサンプル統計"
},
{
"zh": "画面比例",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "畫面比例",
"en": "Aspect ratio",
"ja": "アスペクト比"
},
{
"zh": "画面用采集卡",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "畫面用擷取卡",
"en": "Picture from a capture card",
"ja": "映像はキャプチャーカード"
@@ -12709,35 +12709,35 @@
},
{
"zh": "登录",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "登入",
"en": "Sign in",
"ja": "サインイン"
},
{
"zh": "登录 PIN",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "登入 PIN",
"en": "Sign-in PIN",
"ja": "サインイン PIN"
},
{
"zh": "登录 PIN 必须为数字。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "登入 PIN 必須為數字。",
"en": "The sign-in PIN must be digits.",
"ja": "サインイン PIN は数字で入力してください。"
},
{
"zh": "登录 PSN",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "登入 PSN",
"en": "Sign in to PSN",
"ja": "PSN にサインイン"
},
{
"zh": "登录信息加密保存在本机;退出会删除它",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "登入資訊加密儲存在本機;退出會刪除它",
"en": "Sign-in data is stored encrypted on this PC; signing out deletes it",
"ja": "サインイン情報はこの PC に暗号化して保存されます。サインアウトすると削除されます"
@@ -12765,14 +12765,14 @@
},
{
"zh": "白天或亮环境看片:整体提亮一些。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "白天或亮環境看片:整體提亮一些。",
"en": "Raises overall brightness for a bright viewing environment.",
"ja": "明るい視聴環境に合わせて全体を明るくします。"
},
{
"zh": "白色",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "白色",
"en": "White",
"ja": "白"
@@ -12800,14 +12800,14 @@
},
{
"zh": "目前只支持 RTX 50 系列:40/30 系的多帧解锁只适用于原版运行库",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "目前只支援 RTX 50 系列:40/30 系的多幀解鎖只適用於原版執行庫",
"en": "RTX 50 series only for now: the RTX 40/30 multi-frame unlock works with the standard runtime only",
"ja": "現在は RTX 50 シリーズのみ対応:RTX 40/30 のマルチフレーム解除は標準ランタイムでのみ動作します"
},
{
"zh": "目标",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "目標",
"en": "Target",
"ja": "対象"
@@ -12821,7 +12821,7 @@
},
{
"zh": "目标已失效",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "目標已失效",
"en": "The target is no longer valid",
"ja": "対象が無効になりました"
@@ -12835,7 +12835,7 @@
},
{
"zh": "目标文件已存在,请换一个文件名",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "目標檔案已存在,請換一個檔名",
"en": "The target file already exists; choose another file name",
"ja": "保存先のファイルがすでに存在します。別のファイル名にしてください"
@@ -12849,7 +12849,7 @@
},
{
"zh": "目标行数",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "目標行數",
"en": "Target lines",
"ja": "目標の行数"
@@ -12863,14 +12863,14 @@
},
{
"zh": "直接打开 HTTP、HTTPS 或 RTSP 视频流,例如 IPTV 或摄像机地址",
- "src": "qml/DialogHost.qml",
+ "src": "qml/NetworkSourceDialog.qml",
"zh-TW": "直接開啟 HTTP、HTTPS 或 RTSP 影片串流,例如 IPTV 或攝影機位址",
"en": "Open an HTTP, HTTPS or RTSP media stream, such as IPTV or a camera feed.",
"ja": "IPTV やカメラなどの HTTP、HTTPS、RTSP メディアストリームを開きます。"
},
{
"zh": "直接查看完整格式列表,包含被常用帧率筛选隐藏的模式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "直接查看完整格式清單,包含被常用影格率篩選隱藏的模式",
"en": "View the full list, including modes hidden by the common frame rate filter",
"ja": "一般的なレートのフィルターで隠れるモードも含め、形式の全一覧を表示します"
@@ -12926,7 +12926,7 @@
},
{
"zh": "码率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "位元率",
"en": "Bitrate",
"ja": "ビットレート"
@@ -12975,7 +12975,7 @@
},
{
"zh": "磨皮 %1%",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "磨皮 %1%",
"en": "Smoothing %1%",
"ja": "美肌 %1%"
@@ -13003,7 +13003,7 @@
},
{
"zh": "离线",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "離線",
"en": "Offline",
"ja": "オフライン"
@@ -13031,21 +13031,21 @@
},
{
"zh": "空",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "空",
"en": "Empty",
"ja": "空"
},
{
"zh": "窗口",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "視窗",
"en": "Window",
"ja": "ウィンドウ"
},
{
"zh": "窗口只能用 Windows Graphics Capture",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "視窗只能用 Windows Graphics Capture",
"en": "Windows can only be captured with Windows Graphics Capture",
"ja": "ウィンドウのキャプチャーには Windows Graphics Capture のみ使用できます"
@@ -13080,14 +13080,14 @@
},
{
"zh": "立体声",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "立體聲",
"en": "Stereo",
"ja": "ステレオ"
},
{
"zh": "立体声下混",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "立體聲下混",
"en": "Stereo downmix",
"ja": "ステレオダウンミックス"
@@ -13101,7 +13101,7 @@
},
{
"zh": "端点已打开",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "端點已開啟",
"en": "Endpoint open",
"ja": "エンドポイントを開きました"
@@ -13115,7 +13115,7 @@
},
{
"zh": "等待信号",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "等待信號",
"en": "Waiting for signal",
"ja": "信号待ち"
@@ -13157,14 +13157,14 @@
},
{
"zh": "等线",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "等線",
"en": "DengXian",
"ja": "等線"
},
{
"zh": "简",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "簡",
"en": "简",
"ja": "简"
@@ -13185,7 +13185,7 @@
},
{
"zh": "管理预设",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "管理預設",
"en": "Manage presets",
"ja": "プリセットを管理"
@@ -13199,14 +13199,14 @@
},
{
"zh": "类型",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ExportPage.qml",
"zh-TW": "類型",
"en": "Type",
"ja": "種類"
},
{
"zh": "粗",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "粗",
"en": "Coarse",
"ja": "粗い"
@@ -13227,7 +13227,7 @@
},
{
"zh": "精细:按位置还原色度,放大用双三次;不是 AI 超分",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "精細:按位置還原色度,放大用雙三次;不是 AI 超解析",
"en": "Fine: restores chroma by position and scales up bicubically; not AI super resolution",
"ja": "精細:位置に合わせて色差を復元し、拡大はバイキュービック。AI 超解像ではありません"
@@ -13248,28 +13248,28 @@
},
{
"zh": "系统不支持调整 GPU 优先级",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "系統不支援調整 GPU 優先級",
"en": "GPU priority adjustment is unavailable",
"ja": "GPU 優先度の変更は利用できません"
},
{
"zh": "系统报告:峰值 %1、全屏 %2、黑位 %3 nit",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "系統報告:峰值 %1、全螢幕 %2、黑位 %3 nit",
"en": "System report: peak %1, full frame %2, black %3 nit",
"ja": "システム報告:ピーク %1、全画面 %2、黒 %3 nit"
},
{
"zh": "系统数值不是实测;不符时可手动填写峰值",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "系統數值不是實測;不符時可手動填寫峰值",
"en": "System values are not measurements; enter a peak manually if needed",
"ja": "システム値は実測値ではありません。必要に応じてピークを手動入力してください"
},
{
"zh": "系统未接受设置,当前:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "系統未接受設定,目前:%1",
"en": "Setting was not accepted; current: %1",
"ja": "設定が受理されませんでした。現在:%1"
@@ -13353,7 +13353,7 @@
},
{
"zh": "繁",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "繁",
"en": "繁",
"ja": "繁"
@@ -13388,14 +13388,14 @@
},
{
"zh": "约 %1(视频 %2 Mbps × %3,音轨另计)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "約 %1(影片 %2 Mbps × %3,音軌另計)",
"en": "About %1 (video %2 Mbps × %3, audio extra)",
"ja": "約 %1(映像 %2 Mbps × %3、音声は別)"
},
{
"zh": "纹理",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "紋理",
"en": "Texture",
"ja": "テクスチャ"
@@ -13416,7 +13416,7 @@
},
{
"zh": "细",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "細",
"en": "Thin",
"ja": "細い"
@@ -13465,21 +13465,21 @@
},
{
"zh": "缓冲 %1 s",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "緩衝 %1 s",
"en": "Buffer %1 s",
"ja": "バッファー %1 s"
},
{
"zh": "缓冲中",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "緩衝中",
"en": "Buffering",
"ja": "バッファー中"
},
{
"zh": "编码",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "編碼",
"en": "Codec",
"ja": "コーデック"
@@ -13563,7 +13563,7 @@
},
{
"zh": "网络视频 · %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "網路影片 · %1",
"en": "Network video · %1",
"ja": "ネットワーク動画 · %1"
@@ -13584,7 +13584,7 @@
},
{
"zh": "美乐威低延迟模式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "美樂威低延遲模式",
"en": "Magewell low-latency mode",
"ja": "Magewell 低遅延モード"
@@ -13605,35 +13605,35 @@
},
{
"zh": "美颜 2",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "美顏 2",
"en": "Beauty 2",
"ja": "美顔 2"
},
{
"zh": "美颜 3",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "美顏 3",
"en": "Beauty 3",
"ja": "美顔 3"
},
{
"zh": "美颜 4",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "美顏 4",
"en": "Beauty 4",
"ja": "美顔 4"
},
{
"zh": "美颜 5",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "美顏 5",
"en": "Beauty 5",
"ja": "美顔 5"
},
{
"zh": "美颜 6",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "美顏 6",
"en": "Beauty 6",
"ja": "美顔 6"
@@ -13703,7 +13703,7 @@
},
{
"zh": "老片平淡",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "老片平淡",
"en": "Flat older transfer",
"ja": "平坦な旧作"
@@ -13738,7 +13738,7 @@
},
{
"zh": "背景条",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "背景條",
"en": "Background bar",
"ja": "背景バー"
@@ -13752,7 +13752,7 @@
},
{
"zh": "自动",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "自動",
"en": "Auto",
"ja": "自動"
@@ -13773,21 +13773,21 @@
},
{
"zh": "自动 NR 仅支持一至两层列表的第一层",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "自動 NR 僅支援一至兩層列表的第一層",
"en": "Auto NR supports the first layer of a one- or two-layer list",
"ja": "自動 NR は 1~2 層のリストの最初の層に対応します"
},
{
"zh": "自动 NR 实例池不可用,保留固定 1080p 档",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "自動 NR 執行個體池無法使用,保留固定 1080p 檔",
"en": "Auto NR instance pool unavailable; keeping the fixed 1080p policy",
"ja": "自動 NR のインスタンスプールを使用できません。固定 1080p 設定を維持します"
},
{
"zh": "自动 NR 当前仅验证 RTX 5070",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Hardware.cpp",
"zh-TW": "自動 NR 目前僅驗證 RTX 5070",
"en": "Auto NR is currently verified only on RTX 5070",
"ja": "自動 NR は現在 RTX 5070 のみで検証済みです"
@@ -13822,14 +13822,14 @@
},
{
"zh": "自动估算",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "自動估算",
"en": "Auto estimate",
"ja": "自動推定"
},
{
"zh": "自动估算 · 采集卡 / PS5 实时输入时生效",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "自動估算 · 擷取卡 / PS5 即時輸入時生效",
"en": "Auto estimate · applies to live capture card / PS5 input",
"ja": "自動推定 · キャプチャーカード / PS5 のライブ入力時に有効"
@@ -13857,14 +13857,14 @@
},
{
"zh": "自动对齐",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "自動對齊",
"en": "Auto-align",
"ja": "自動調整"
},
{
"zh": "自动对齐:%1(Z/X 可微调)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "自動對齊:%1(Z/X 可微調)",
"en": "Auto-align: %1 (Z/X to fine-tune)",
"ja": "自動調整:%1(Z/X で微調整)"
@@ -13878,14 +13878,14 @@
},
{
"zh": "自动捕获键盘鼠标",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "自動擷取鍵盤滑鼠",
"en": "Capture keyboard and mouse automatically",
"ja": "キーボードとマウスを自動でキャプチャー"
},
{
"zh": "自动显示同步",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "自動顯示同步",
"en": "Automatic display sync",
"ja": "自動ディスプレイ同期"
@@ -13969,28 +13969,28 @@
},
{
"zh": "自动(推荐):不撕裂,也不等待垂直同步,每次刷新显示最新一帧,延迟最低 · 垂直同步:每帧都等到刷新才显示,比自动多等最多一个刷新 · 允许撕裂:可能出现撕裂线",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPresentationRows.qml",
"zh-TW": "自動(推薦):不撕裂,也不等待垂直同步,每次更新顯示最新一幀,延遲最低 · 垂直同步:每幀都等到更新才顯示,比自動多等最多一次更新 · 允許撕裂:可能出現撕裂線",
"en": "Auto (recommended): no tearing and no VSync wait; each refresh shows the newest frame for the lowest latency · VSync: every frame waits for a refresh, at most one refresh longer than Auto · Allow tearing: tear lines may appear",
"ja": "自動(推奨):ティアリングなし、垂直同期を待たず、毎回のリフレッシュで最新フレームを表示し遅延が最小 · 垂直同期:全フレームがリフレッシュを待って表示され、自動より最大 1 リフレッシュ分長く待つ · ティアリングを許可:ティアリングが発生する場合あり"
},
{
"zh": "自动(独立显卡)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "自動(獨立顯示卡)",
"en": "Auto (discrete GPU)",
"ja": "自動(専用 GPU)"
},
{
"zh": "自动:1080p 及以下 2 帧,更高 3 帧;最小 1 帧延迟最低但可能丢帧",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "自動:1080p 及以下 2 幀,更高 3 幀;最小 1 幀延遲最低但可能丟幀",
"en": "Auto: 2 frames at 1080p and below, 3 above; 1 frame has the lowest latency but may drop frames",
"ja": "自動:1080p 以下は 2 フレーム、それ以上は 3 フレーム。1 フレームは遅延が最小ですがフレーム落ちすることがあります"
},
{
"zh": "自动:优先 HEVC,主机不支持时用 H.264",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "自動:優先 HEVC,主機不支援時用 H.264",
"en": "Auto: HEVC first, H.264 when the host does not support it",
"ja": "自動:HEVC を優先し、ホストが非対応なら H.264"
@@ -14011,7 +14011,7 @@
},
{
"zh": "自定义上限",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPresentationRows.qml",
"zh-TW": "自定義上限",
"en": "Custom cap",
"ja": "カスタム上限"
@@ -14025,7 +14025,7 @@
},
{
"zh": "自定义分辨率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "自訂解析度",
"en": "Custom resolution",
"ja": "カスタム解像度"
@@ -14039,7 +14039,7 @@
},
{
"zh": "自定义:已用下面的滑块微调过。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "自訂:已用下面的滑桿微調過。",
"en": "Custom: adjusted with the sliders below.",
"ja": "カスタム:下のスライダーで調整済み。"
@@ -14053,7 +14053,7 @@
},
{
"zh": "自然饱和度",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "自然飽和度",
"en": "Vibrance",
"ja": "自然な彩度"
@@ -14067,14 +14067,14 @@
},
{
"zh": "自由组合",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "自由組合",
"en": "Combine content and room",
"ja": "内容と環境を組み合わせる"
},
{
"zh": "至少选择一项内容",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "至少選擇一項內容",
"en": "Choose at least one item",
"ja": "少なくとも 1 項目を選んでください"
@@ -14095,7 +14095,7 @@
},
{
"zh": "色彩: %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "色彩: %1",
"en": "Color: %1",
"ja": "カラー:%1"
@@ -14179,7 +14179,7 @@
},
{
"zh": "色温(相对)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "色溫(相對)",
"en": "Temperature (relative)",
"ja": "色温度(相対)"
@@ -14214,7 +14214,7 @@
},
{
"zh": "色调",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "色調",
"en": "Tint",
"ja": "色かぶり補正"
@@ -14228,7 +14228,7 @@
},
{
"zh": "节点参数无效,未提交",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/QmlPlayerBridge_p.h",
"zh-TW": "節點參數無效,未提交",
"en": "Invalid node settings, not submitted",
"ja": "ノードの設定が不正なため送信していません"
@@ -14312,7 +14312,7 @@
},
{
"zh": "节点模式已取消 NR 保护区域;请在列表模式使用全局保护",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "節點模式已取消 NR 保護區域;請在列表模式使用全域保護",
"en": "Node mode no longer has NR protected areas; use global protection in list mode",
"ja": "ノードモードでは NR 保護領域を廃止しました。リストモードの全体保護を使ってください"
@@ -14326,7 +14326,7 @@
},
{
"zh": "节点模式请用节点的复制",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "節點模式請用節點的複製",
"en": "In node mode, copy the node instead",
"ja": "ノードモードではノードのコピーを使ってください"
@@ -14375,7 +14375,7 @@
},
{
"zh": "节点预设尚未接入导出执行器",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/QmlPlayerBridge_p.h",
"zh-TW": "節點預設尚未接入匯出執行器",
"en": "Node presets are not wired to the export executor yet",
"ja": "ノードのプリセットはまだ書き出しに対応していません"
@@ -14438,7 +14438,7 @@
},
{
"zh": "补帧 %1X · %2",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "補幀 %1X · %2",
"en": "Frame generation %1X · %2",
"ja": "フレーム生成 %1X · %2"
@@ -14459,7 +14459,7 @@
},
{
"zh": "补帧倍率超出当前后端范围",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "補幀倍率超出當前後端範圍",
"en": "The frame generation multiplier is outside the current backend's range",
"ja": "フレーム生成の倍率が現在の方式の範囲外です"
@@ -14480,21 +14480,21 @@
},
{
"zh": "补帧后端切换未被接受,原设置保留",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "補幀後端切換未被接受,原設定保留",
"en": "The frame generation backend change was not accepted; previous setting kept",
"ja": "フレーム生成方式の変更が受け付けられなかったため、元の設定のままです"
},
{
"zh": "补帧固定为最后一步,不能删除",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "補幀固定為最後一步,不能刪除",
"en": "Frame generation is fixed as the last step and cannot be deleted",
"ja": "フレーム生成は最後の処理に固定されており、削除できません"
},
{
"zh": "补帧固定为最后一步,不能拖动",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "補幀固定為最後一步,不能拖曳",
"en": "Frame generation is fixed as the last step and cannot be dragged",
"ja": "フレーム生成は最後の処理に固定されており、移動できません"
@@ -14522,7 +14522,7 @@
},
{
"zh": "补帧暂停",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "補幀暫停",
"en": "Frame generation paused",
"ja": "フレーム生成一時停止"
@@ -14536,7 +14536,7 @@
},
{
"zh": "补帧路径固定 HDR10;需要 Windows HDR 开启",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "補幀路徑固定 HDR10;需要 Windows HDR 開啟",
"en": "The frame generation path is fixed to HDR10; Windows HDR must be on",
"ja": "フレーム生成の経路は HDR10 に固定されています。Windows の HDR をオンにする必要があります"
@@ -14550,7 +14550,7 @@
},
{
"zh": "补帧选择未被接受,保留原设置;请检查倍率和后端能力",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "補幀選擇未被接受,保留原設定;請檢查倍率和後端能力",
"en": "The frame generation choice was not accepted; previous setting kept. Check the multiplier and backend capability",
"ja": "フレーム生成の選択が受け付けられなかったため、元の設定のままです。倍率と方式の対応範囲を確認してください"
@@ -14564,7 +14564,7 @@
},
{
"zh": "裁剪(像素)",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "裁剪(像素)",
"en": "Crop (pixels)",
"ja": "切り取り(ピクセル)"
@@ -14655,7 +14655,7 @@
},
{
"zh": "视频文件 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts);;所有文件 (*)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "影片檔案 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts);;所有檔案 (*)",
"en": "Video files (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts);;All files (*)",
"ja": "動画ファイル (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts);;すべてのファイル (*)"
@@ -14683,7 +14683,7 @@
},
{
"zh": "视频设备内置音频(已检测)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "影片裝置內建音訊(已檢測)",
"en": "Video device's own audio (detected)",
"ja": "映像デバイス内蔵の音声(検出済み)"
@@ -14697,7 +14697,7 @@
},
{
"zh": "视频输入设备",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "影片輸入裝置",
"en": "Video input device",
"ja": "映像入力デバイス"
@@ -14732,7 +14732,7 @@
},
{
"zh": "解码",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "解碼",
"en": "Decode",
"ja": "デコード"
@@ -14746,14 +14746,14 @@
},
{
"zh": "触及硬上限 %1% · 高光压缩区 %2% · 暗部提升区 %3%",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "觸及硬上限 %1% · 高光壓縮區 %2% · 暗部提升區 %3%",
"en": "At hard cap %1% · highlight compression %2% · shadow lift %3%",
"ja": "ハード上限 %1% · ハイライト圧縮 %2% · 暗部持ち上げ %3%"
},
{
"zh": "让主机切换到串流分辨率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "讓主機切換到串流解析度",
"en": "Have the host switch to the stream resolution",
"ja": "ホストをストリーミング解像度に切り替える"
@@ -14774,42 +14774,42 @@
},
{
"zh": "记住每部影片",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "記住每部影片",
"en": "Remember each film",
"ja": "作品ごとに記憶"
},
{
"zh": "记忆与自动化",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "記憶與自動化",
"en": "Memory and automation",
"ja": "記憶と自動化"
},
{
"zh": "设为启动默认",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "設為啟動預設",
"en": "Set as startup default",
"ja": "起動時の既定にする"
},
{
"zh": "设备",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "裝置",
"en": "Device",
"ja": "デバイス"
},
{
"zh": "设备属性",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "裝置屬性",
"en": "Device properties",
"ja": "デバイスのプロパティ"
},
{
"zh": "设备帧率 FPS",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "裝置幀率 FPS",
"en": "Device frame rate (FPS)",
"ja": "デバイスのフレームレート FPS"
@@ -14830,21 +14830,21 @@
},
{
"zh": "设备未连接",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "裝置未連接",
"en": "Device not connected",
"ja": "デバイスが接続されていません"
},
{
"zh": "设备查询或驱动设置尚未完成",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "裝置查詢或驅動設定尚未完成",
"en": "Wait for the device query or driver settings to finish",
"ja": "デバイスの検索またはドライバー設定が完了するまでお待ちください"
},
{
"zh": "设备缓冲",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "裝置緩衝",
"en": "Device buffers",
"ja": "デバイスのバッファー"
@@ -14865,7 +14865,7 @@
},
{
"zh": "设置",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ExportPage.qml",
"zh-TW": "設定",
"en": "Settings",
"ja": "設定"
@@ -14900,7 +14900,7 @@
},
{
"zh": "设置已保存,请等待导出结束后重启软件",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Recording.cpp",
"zh-TW": "設定已儲存,請等待匯出結束後重新啟動軟體",
"en": "Settings saved. Restart after the export finishes.",
"ja": "設定を保存しました。書き出し完了後に再起動してください。"
@@ -14928,7 +14928,7 @@
},
{
"zh": "识别 %1 fps 内容",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "辨識 %1 fps 內容",
"en": "Detect %1 fps content",
"ja": "%1 fps のコンテンツを検出"
@@ -14970,14 +14970,14 @@
},
{
"zh": "诊断信息已复制",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "診斷資訊已複製",
"en": "Diagnostics copied",
"ja": "診断情報をコピーしました"
},
{
"zh": "诊断信息已复制,可直接粘贴到反馈里",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "診斷資訊已複製,可直接貼上到反饋裡",
"en": "Diagnostics copied; paste them straight into your report",
"ja": "診断情報をコピーしました。そのまま報告に貼り付けられます"
@@ -14991,7 +14991,7 @@
},
{
"zh": "该字幕轨没有可显示的内容",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Subtitles.cpp",
"zh-TW": "該字幕軌沒有可顯示的內容",
"en": "This subtitle track has nothing to show",
"ja": "この字幕トラックには表示できる内容がありません"
@@ -15005,7 +15005,7 @@
},
{
"zh": "该文件没有可选轨道",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "該檔案沒有可選軌道",
"en": "This file has no selectable tracks",
"ja": "このファイルには選択できるトラックがありません"
@@ -15019,14 +15019,14 @@
},
{
"zh": "该格式比低延迟格式多一道处理环节,高分辨率/高帧率下建议优先低延迟格式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "該格式比低延遲格式多一道處理環節,高解析度/高幀率下建議優先低延遲格式",
"en": "This format has one more processing step than the low-latency format; at high resolution / frame rate prefer the low-latency format",
"ja": "このフォーマットは低遅延フォーマットより処理が 1 段多くなります。高解像度・高フレームレートでは低遅延フォーマットを推奨します"
},
{
"zh": "该类型节点已达上限(含禁用和未连接节点)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "該類型節點已達上限(含停用和未連接節點)",
"en": "This node type has reached its limit (including disabled and unconnected nodes)",
"ja": "この種類のノードは上限に達しています(無効・未接続のノードを含む)"
@@ -15040,14 +15040,14 @@
},
{
"zh": "请先切换到要保存的编辑模式",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "請先切換到要儲存的編輯模式",
"en": "Switch to the edit mode you want to save first",
"ja": "先に保存したい編集モードに切り替えてください"
},
{
"zh": "请先切换到预设对应的编辑模式",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "請先切換到預設對應的編輯模式",
"en": "Switch to the edit mode the preset belongs to first",
"ja": "先にプリセットに対応する編集モードに切り替えてください"
@@ -15061,56 +15061,56 @@
},
{
"zh": "请先完成配对,并填写有效主机地址。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "請先完成配對,並填寫有效主機地址。",
"en": "Finish pairing and enter a valid host address first.",
"ja": "先にペアリングを完了し、有効なホストのアドレスを入力してください。"
},
{
"zh": "请先打开视频,再在画面上绘制保护区域",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "請先開啟影片,再在畫面上繪制保護區域",
"en": "Open a video first, then draw protected areas on the picture",
"ja": "先に動画を開いてから、映像上に保護領域を描いてください"
},
{
"zh": "请先添加 RTX Video HDR 节点",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "請先添加 RTX Video HDR 節點",
"en": "Add an RTX Video HDR node first",
"ja": "先に RTX Video HDR ノードを追加してください"
},
{
"zh": "请先添加抗锯齿节点",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "請先添加抗鋸齒節點",
"en": "Add an anti-aliasing node first",
"ja": "先にアンチエイリアスのノードを追加してください"
},
{
"zh": "请先添加补帧节点",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "請先添加補幀節點",
"en": "Add a frame generation node first",
"ja": "先にフレーム生成ノードを追加してください"
},
{
"zh": "请先添加要导出的文件",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Recording.cpp",
"zh-TW": "請先添加要匯出的檔案",
"en": "Add the files to export first",
"ja": "先に書き出すファイルを追加してください"
},
{
"zh": "请先添加超分节点",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "請先添加超解析節點",
"en": "Add a super resolution node first",
"ja": "先に超解像ノードを追加してください"
},
{
"zh": "请先点登录 PSN,完成网页授权后再提交。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "請先點登入 PSN,完成網頁授權後再提交。",
"en": "Click Sign in to PSN, finish the web authorization, then submit.",
"ja": "先に「PSN にサインイン」を押し、Web での認証を完了してから送信してください。"
@@ -15124,35 +15124,35 @@
},
{
"zh": "请先连接串流及带陀螺仪的电脑手柄。仅观看模式不使用电脑手柄。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "請先連接串流及帶陀螺儀的電腦手把。僅觀看模式不使用電腦手把。",
"en": "Connect the stream and a PC controller with a gyro first. View-only mode does not use the PC controller.",
"ja": "先にストリーミングとジャイロ付きの PC コントローラーを接続してください。視聴のみモードでは PC のコントローラーは使いません。"
},
{
"zh": "请先选择分辨率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "請先選擇解析度",
"en": "Choose a resolution first",
"ja": "先に解像度を選択してください"
},
{
"zh": "请先选择分辨率和像素格式",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "請先選擇解析度和像素格式",
"en": "Choose a resolution and pixel format first",
"ja": "先に解像度とピクセル形式を選択してください"
},
{
"zh": "请先选择设备并等待查询完成",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "請先選擇裝置並等待查詢完成",
"en": "Select a device and wait for the query to finish",
"ja": "デバイスを選択し、検索が完了するまでお待ちください"
},
{
"zh": "请先选择采集设备和格式",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "請先選擇擷取裝置和格式",
"en": "Choose a capture device and format first",
"ja": "先にキャプチャーデバイスとフォーマットを選んでください"
@@ -15166,7 +15166,7 @@
},
{
"zh": "请在设备列表选择对应的 HDMI/SDI 输入口;Driver 保留驱动当前输入。支持自动检测的卡建议选择自动,信号未锁定时会明确提示。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "請在裝置清單選擇對應的 HDMI/SDI 輸入埠;Driver 保留驅動程式目前輸入。支援自動偵測的卡建議選擇自動,訊號未鎖定時會明確提示。",
"en": "Select the matching HDMI/SDI connector in the device list. Driver keeps the current driver input. Use Auto on cards supporting signal detection; an unlocked signal is reported explicitly.",
"ja": "デバイス一覧で該当する HDMI/SDI 入力を選択してください。Driver は現在のドライバー入力を維持します。対応カードでは自動検出を推奨し、信号がロックされない場合は明示します。"
@@ -15180,7 +15180,7 @@
},
{
"zh": "请填写有效主机地址、Account ID 和 8 位配对码。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "請填寫有效主機地址、Account ID 和 8 位配對碼。",
"en": "Enter a valid host address, Account ID and 8-digit pairing code.",
"ja": "有効なホストのアドレス、Account ID、8 桁のペアリングコードを入力してください。"
@@ -15194,28 +15194,28 @@
},
{
"zh": "请求码率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "請求位元率",
"en": "Requested bitrate",
"ja": "要求ビットレート"
},
{
"zh": "请等待当前图片导出完成",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "請等待當前圖片匯出完成",
"en": "Wait for the current image export to finish",
"ja": "現在の画像の書き出しが終わるまでお待ちください"
},
{
"zh": "请等待连接结束并断开采集,再打开驱动设置",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "請等待連接完成並中斷擷取,再開啟驅動設定",
"en": "Wait for the connection to finish, then disconnect capture before opening driver settings",
"ja": "接続が完了してからキャプチャを切断し、ドライバー設定を開いてください"
},
{
"zh": "请等待采集设备查询完成后再切换接口",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "請等待擷取裝置查詢完成後再切換介面",
"en": "Wait for device discovery to finish before switching interfaces.",
"ja": "デバイスの検索が完了してから切り替えてください。"
@@ -15229,56 +15229,56 @@
},
{
"zh": "请输入有效的 HTTP、HTTPS 或 RTSP 视频地址",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "請輸入有效的 HTTP、HTTPS 或 RTSP 影片位址",
"en": "Enter a valid HTTP, HTTPS or RTSP media URL.",
"ja": "有効な HTTP、HTTPS、RTSP メディア URL を入力してください。"
},
{
"zh": "请选择",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "請選擇",
"en": "Choose",
"ja": "選択してください"
},
{
"zh": "请选择 BMD 原生设备;若列表中没有,请安装 Desktop Video 驱动。多个设备不会自动猜选。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "請選擇 BMD 原生裝置;若清單中沒有,請安裝 Desktop Video 驅動。多個裝置不會自動猜選。",
"en": "Select a native BMD device. If none is listed, install Desktop Video. Multiple devices are never selected by guesswork.",
"ja": "BMD ネイティブデバイスを選んでください。表示されない場合は Desktop Video をインストールしてください。複数のデバイスは自動で推測選択しません。"
},
{
"zh": "请选择与输入信号一致的格式。驱动默认格式不代表检测到的信号。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "請選擇與輸入訊號一致的格式。驅動預設格式不代表偵測到的訊號。",
"en": "Choose a format that matches the input signal. The driver default is not a detected signal format.",
"ja": "入力信号に合う形式を選んでください。ドライバーの既定値は信号検出の結果ではありません。"
},
{
"zh": "请选择像素格式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "請選擇像素格式",
"en": "Choose a pixel format",
"ja": "ピクセルフォーマットを選んでください"
},
{
"zh": "请选择分辨率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "請選擇解析度",
"en": "Choose a resolution",
"ja": "解像度を選んでください"
},
{
"zh": "请选择图片和已存在的输出目录",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "請選擇圖片和已存在的輸出目錄",
"en": "Choose images and an existing output folder",
"ja": "画像と既存の出力フォルダーを選んでください"
},
{
"zh": "请选择帧率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "請選擇幀率",
"en": "Choose a frame rate",
"ja": "フレームレートを選んでください"
@@ -15341,7 +15341,7 @@
},
{
"zh": "读取采集格式失败:%1(0x%2)。请检查设备占用与驱动后重试。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "讀取擷取格式失敗:%1(0x%2)。請檢查裝置占用與驅動後重試。",
"en": "Failed to read capture formats: %1 (0x%2). Check whether the device is in use and check its driver, then retry.",
"ja": "キャプチャ形式を読み取れません:%1(0x%2)。デバイスの使用状況とドライバーを確認して再試行してください。"
@@ -15355,28 +15355,28 @@
},
{
"zh": "谁按键就用谁:本机手柄、串流软件建的虚拟手柄都可以",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "誰按鍵就用誰:本機手把、串流軟體建的虛擬手把都可以",
"en": "Whichever controller pressed a button last is used: a controller on this PC or a virtual one made by streaming software",
"ja": "最後にボタンを押したコントローラーを使います:この PC のコントローラーでも、ストリーミングソフトが作る仮想コントローラーでも可"
},
{
"zh": "调度等待 P95",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "調度等待 P95",
"en": "Scheduling wait P95",
"ja": "スケジュール待ち P95"
},
{
"zh": "调度等待 P95: %1 ms",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "調度等待 P95: %1 ms",
"en": "Scheduling wait P95: %1 ms",
"ja": "スケジュール待ち P95:%1 ms"
},
{
"zh": "调度降档",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "調度降檔",
"en": "Scheduling stepped down",
"ja": "スケジュールを段階的に下げました"
@@ -15390,14 +15390,14 @@
},
{
"zh": "调整中",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "調整中",
"en": "Adjusting",
"ja": "調整中"
},
{
"zh": "调整力度;0% 关闭曲线",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "調整力度;0% 關閉曲線",
"en": "Adjustment amount; 0% disables the curve",
"ja": "調整の強さ。0% でカーブを無効にします"
@@ -15418,49 +15418,49 @@
},
{
"zh": "调色值必须是有限数值",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "調色值必須是有限數值",
"en": "Color values must be finite numbers",
"ja": "カラーの値は有限の数値である必要があります"
},
{
"zh": "调色参数",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "調色參數",
"en": "Color settings",
"ja": "カラー設定"
},
{
"zh": "调色参数被拒绝:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "調色參數被拒絕:%1",
"en": "Color settings rejected: %1",
"ja": "カラー設定が拒否されました:%1"
},
{
"zh": "负值 = 声音提前",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "負值 = 聲音提前",
"en": "Negative = sound earlier",
"ja": "負の値 = 音を早める"
},
{
"zh": "负载预算",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPerfOrbs.qml",
"zh-TW": "負載預算",
"en": "Load budget",
"ja": "負荷予算"
},
{
"zh": "账号",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "帳號",
"en": "Account",
"ja": "アカウント"
},
{
"zh": "账号数字 ID 或 8 字节 Base64,不是昵称;登录 PSN 后自动填入",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "帳號數字 ID 或 8 字節 Base64,不是昵稱;登入 PSN 後自動填入",
"en": "The account's numeric ID or 8-byte Base64, not the nickname; filled in automatically after signing in to PSN",
"ja": "アカウントの数値 ID または 8 バイトの Base64 で、ニックネームではありません。PSN にサインインすると自動で入力されます"
@@ -15488,14 +15488,14 @@
},
{
"zh": "贴合原窗口",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "貼合原視窗",
"en": "Align to source window",
"ja": "元のウィンドウに合わせる"
},
{
"zh": "贴合原窗口时可精确穿透鼠标;填满或拉伸支持键盘和手柄,鼠标点击会被拦截以免错位。%1 调整画面,%2 退出;独占全屏请改为无边框窗口",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "貼合原視窗時可精確穿透滑鼠;填滿或拉伸支援鍵盤和手把,滑鼠點擊會被攔截以免錯位。%1 調整畫面,%2 退出;獨佔全螢幕請改為無邊框視窗",
"en": "Original-window alignment supports precise mouse passthrough. Fill/stretch supports keyboard and gamepad; mouse clicks are blocked to prevent misalignment. %1 adjusts the picture; %2 exits. Use borderless instead of exclusive fullscreen.",
"ja": "元のウィンドウに合わせると正確なマウス透過を利用できます。塗りつぶし・引き伸ばしではキーボードとゲームパッドに対応し、位置ずれを防ぐためマウスクリックを遮断します。%1 で画面調整、%2 で終了。排他全画面ではなくボーダーレスにしてください。"
@@ -15579,7 +15579,7 @@
},
{
"zh": "超过上限的亮度需要压缩;是否触及硬上限以抽样读数为准",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "超過上限的亮度需要壓縮;是否觸及硬上限以抽樣讀數為準",
"en": "Brightness beyond the cap needs compression; use the sample reading to check hard clipping",
"ja": "上限を超える輝度は圧縮が必要です。実際のクリップはサンプル値で確認してください。"
@@ -15628,7 +15628,7 @@
},
{
"zh": "跟随",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "跟隨",
"en": "Follow",
"ja": "追従"
@@ -15670,7 +15670,7 @@
},
{
"zh": "跟随系统默认",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "跟隨系統預設",
"en": "Follow the system default",
"ja": "システムの既定に従う"
@@ -15684,7 +15684,7 @@
},
{
"zh": "跟随驱动输入",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "沿用驅動輸入",
"en": "Driver input",
"ja": "ドライバーの入力設定"
@@ -15733,7 +15733,7 @@
},
{
"zh": "转为 SDR 显示",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "轉為 SDR 顯示",
"en": "Show as SDR",
"ja": "SDR で表示"
@@ -15775,14 +15775,14 @@
},
{
"zh": "软件估算补偿 ",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "軟體估算補償 ",
"en": "Estimated compensation ",
"ja": "ソフトウェア推定の補正 "
},
{
"zh": "软件内测得的音画偏差,不是扬声器实测;只在采集卡 / PS5 实时输入时有",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "軟體內測得的音畫偏差,不是揚聲器實測;只在擷取卡 / PS5 即時輸入時有",
"en": "Audio/video offset measured inside the app, not at the speakers; only for live capture card / PS5 input",
"ja": "アプリ内で測定した音声と映像のずれで、スピーカーでの実測ではありません。キャプチャーカード / PS5 のライブ入力時のみ"
@@ -15831,7 +15831,7 @@
},
{
"zh": "轻微",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "輕微",
"en": "Slight",
"ja": "わずか"
@@ -15866,7 +15866,7 @@
},
{
"zh": "输入原画",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "輸入原畫",
"en": "Input original",
"ja": "入力のオリジナル"
@@ -15901,7 +15901,7 @@
},
{
"zh": "输入色彩(SDR / HDR)",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "輸入色彩(SDR / HDR)",
"en": "Input color (SDR / HDR)",
"ja": "入力の色(SDR / HDR)"
@@ -15915,21 +15915,21 @@
},
{
"zh": "输入范围",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "輸入範圍",
"en": "Input range",
"ja": "入力範囲"
},
{
"zh": "输入选择",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "輸入選擇",
"en": "Select input",
"ja": "入力を選択"
},
{
"zh": "输出",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "輸出",
"en": "Output",
"ja": "出力"
@@ -15957,7 +15957,7 @@
},
{
"zh": "输出上限需在 1–1000 fps 之间",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/FrameGeneration.cpp",
"zh-TW": "輸出上限需在 1–1000 fps 之間",
"en": "The output cap must be between 1 and 1000 fps",
"ja": "出力上限は 1–1000 fps の範囲で指定してください"
@@ -15999,7 +15999,7 @@
},
{
"zh": "输出已存在,不覆盖",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "輸出已存在,不覆蓋",
"en": "The output already exists; not overwriting",
"ja": "出力がすでに存在するため上書きしません"
@@ -16034,7 +16034,7 @@
},
{
"zh": "输出设备",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "輸出裝置",
"en": "Output device",
"ja": "出力デバイス"
@@ -16069,21 +16069,21 @@
},
{
"zh": "输出限帧 · %1 fps",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "輸出限幀 · %1 fps",
"en": "Output cap · %1 fps",
"ja": "出力制限 · %1 fps"
},
{
"zh": "输出限帧 · 当前未生效",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "輸出限幀 · 目前未生效",
"en": "Output cap · currently inactive",
"ja": "出力制限 · 現在無効"
},
{
"zh": "输出限帧 · 跟随屏幕",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "輸出限幀 · 跟隨螢幕",
"en": "Output cap · follow display",
"ja": "出力制限 · ディスプレイに合わせる"
@@ -16132,21 +16132,21 @@
},
{
"zh": "运算显卡已切换为「%1」,重新打开视频后生效",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "運算顯示卡已切換為「%1」,重新開啟影片後生效",
"en": "Compute GPU switched to \"%1\"; it applies after reopening the video",
"ja": "処理用 GPU を「%1」に切り替えました。動画を開き直すと反映されます"
},
{
"zh": "运算显卡已恢复默认(性能最强的显卡),重新打开视频后生效",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "運算顯示卡已恢復預設(效能最強的顯示卡),重新開啟影片後生效",
"en": "Compute GPU back to the default (the most powerful GPU); it applies after reopening the video",
"ja": "処理用 GPU を既定(最も高性能な GPU)に戻しました。動画を開き直すと反映されます"
},
{
"zh": "运行中",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "執行中",
"en": "Running",
"ja": "実行中"
@@ -16223,21 +16223,21 @@
},
{
"zh": "还没有主机。在要被串流的电脑上安装 Sunshine(官网 app.lizardbyte.dev/Sunshine,软件不自带),",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "還沒有主機。在要被串流的電腦上安裝 Sunshine(官網 app.lizardbyte.dev/Sunshine,軟體不內建),",
"en": "No hosts yet. Install Sunshine on the PC you want to stream (official site app.lizardbyte.dev/Sunshine; not bundled with this app),",
"ja": "ホストがまだありません。ストリーミングしたい PC に Sunshine をインストールし(公式サイト app.lizardbyte.dev/Sunshine、本アプリには同梱していません)、"
},
{
"zh": "还没有可以继续的片源",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "還沒有可以繼續的片源",
"en": "No source to continue yet",
"ja": "続きから再生できるソースはまだありません"
},
{
"zh": "还没有配对的 PS5,先在「PS5 串流」里配对一次",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "還沒有配對的 PS5,先在「PS5 串流」裡配對一次",
"en": "No PS5 is paired yet. Pair one once under PS5 streaming",
"ja": "ペアリング済みの PS5 がありません。先に「PS5 ストリーミング」で一度ペアリングしてください"
@@ -16251,7 +16251,7 @@
},
{
"zh": "还没有采集记录",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "還沒有擷取記錄",
"en": "No capture history yet",
"ja": "キャプチャーの履歴はまだありません"
@@ -16265,14 +16265,14 @@
},
{
"zh": "这个模式还没有预设。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "這個模式還沒有預設。",
"en": "This mode has no presets yet.",
"ja": "このモードにはまだプリセットがありません。"
},
{
"zh": "这个语言的翻译没有找到,界面保持简体中文",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "這個語言的翻譯沒有找到,介面保持簡體中文",
"en": "No translation found for this language; the interface stays in Simplified Chinese",
"ja": "この言語の翻訳が見つからないため、表示は簡体字中国語のままです"
@@ -16314,14 +16314,14 @@
},
{
"zh": "这台主机没有报告 10 位编码能力",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "這台主機沒有報告 10 位編碼能力",
"en": "This host did not report 10-bit encoding support",
"ja": "このホストは 10bit エンコードの対応を報告していません"
},
{
"zh": "这台主机还没有和本机配对。点「配对」,在主机的 Sunshine 网页里输入软件给出的 PIN。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "這台主機還沒有和本機配對。點「配對」,在主機的 Sunshine 網頁裡輸入軟體給出的 PIN。",
"en": "This host is not paired with this PC yet. Click Pair and enter the PIN the app shows in the host's Sunshine web page.",
"ja": "このホストはまだこの PC とペアリングされていません。「ペアリング」を押し、ホストの Sunshine の Web ページでアプリに表示された PIN を入力してください。"
@@ -16363,14 +16363,14 @@
},
{
"zh": "这是字幕预览,",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "這是字幕預覽,",
"en": "This is a subtitle preview.",
"ja": "これは字幕のプレビューです。"
},
{
"zh": "这条曲线目前也等同于整档预设「%1」",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "這條曲線目前也等同於整檔預設「%1」",
"en": "This curve also matches the full preset %1",
"ja": "このカーブは全体プリセット %1 とも一致します"
@@ -16384,7 +16384,7 @@
},
{
"zh": "这里是「基础设置」里 暗部提亮、整体观感、高光保护 这三项的精确数值版(强度与显示峰值不在此列,它们本身就是直接调节)。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "這裡是「基礎設定」裡 暗部提亮、整體觀感、高光保護 這三項的精確數值版(強度與顯示峰值不在此列,它們本身就是直接調節)。",
"en": "Exact values for the three basic controls: shadows, brightness balance and highlight protection. Overall strength and display peak are already direct controls.",
"ja": "基本設定の暗部・明るさのバランス・ハイライト保護を数値で調整します。全体の強度とディスプレイのピークは直接調整する項目のため、ここには含まれません。"
@@ -16426,14 +16426,14 @@
},
{
"zh": "连接",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "連接",
"en": "Connect",
"ja": "接続"
},
{
"zh": "连接中",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "連接中",
"en": "Connecting",
"ja": "接続中"
@@ -16447,7 +16447,7 @@
},
{
"zh": "连接串流及电脑手柄后可校准",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "連接串流及電腦手把後可校準",
"en": "Can be calibrated once the stream and a PC controller are connected",
"ja": "ストリーミングと PC コントローラーを接続すると補正できます"
@@ -16461,14 +16461,14 @@
},
{
"zh": "连接后使用当前增强设置。格式与音频变更需要重新连接。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "連接後使用當前增強設定。格式與音訊變更需要重新連接。",
"en": "Uses the current enhancement settings once connected. Format and audio changes need a reconnect.",
"ja": "接続後は現在の補正設定を使います。フォーマットや音声の変更には再接続が必要です。"
},
{
"zh": "连接后在主窗口显示画面",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "連接後在主視窗顯示畫面",
"en": "Shows the picture in the main window once connected",
"ja": "接続後、メインウィンドウに映像を表示"
@@ -16482,14 +16482,14 @@
},
{
"zh": "连接已开始。需要登录 PIN 时在下方提交。关闭面板不停止串流。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "連接已開始。需要登入 PIN 時在下方提交。關閉面板不停止串流。",
"en": "Connection started. Submit the sign-in PIN below if asked. Closing the panel does not stop streaming.",
"ja": "接続を開始しました。サインイン PIN が必要な場合は下で送信してください。パネルを閉じてもストリーミングは止まりません。"
},
{
"zh": "连接并开始",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "連接並開始",
"en": "Connect and start",
"ja": "接続して開始"
@@ -16510,14 +16510,14 @@
},
{
"zh": "连接设备后,先关闭增强确认基础画面,再按需开启",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "連接裝置後,先關閉增強確認基礎畫面,再按需開啟",
"en": "After connecting the device, turn enhancement off to check the base picture first, then turn on what you need",
"ja": "デバイスを接続したら、まず補正をオフにして元の映像を確認し、必要に応じてオンにしてください"
},
{
"zh": "退出",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "退出",
"en": "Quit",
"ja": "終了"
@@ -16531,28 +16531,28 @@
},
{
"zh": "退出游戏",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "退出遊戲",
"en": "Quit game",
"ja": "ゲームを終了"
},
{
"zh": "退出登录",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "登出",
"en": "Sign out",
"ja": "サインアウト"
},
{
"zh": "适应",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "適應",
"en": "Fit",
"ja": "フィット"
},
{
"zh": "适应窗口",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "適應視窗",
"en": "Fit to window",
"ja": "ウィンドウに合わせる"
@@ -16573,35 +16573,35 @@
},
{
"zh": "选择导出目录",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Recording.cpp",
"zh-TW": "選擇匯出目錄",
"en": "Choose export folder",
"ja": "書き出し先フォルダーを選択"
},
{
"zh": "选择录制保存位置",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Recording.cpp",
"zh-TW": "選擇錄製儲存位置",
"en": "Choose the recording folder",
"ja": "録画の保存先を選択"
},
{
"zh": "选择截图目录",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "選擇截圖目錄",
"en": "Choose screenshot folder",
"ja": "スクリーンショットの保存先を選択"
},
{
"zh": "选择要处理的图片",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "選擇要處理的圖片",
"en": "Choose images to process",
"ja": "処理する画像を選択"
},
{
"zh": "选择设备和格式后连接",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "選擇裝置和格式後連接",
"en": "Choose a device and format, then connect",
"ja": "デバイスとフォーマットを選んでから接続"
@@ -16615,14 +16615,14 @@
},
{
"zh": "选档方式:两种选法写的是同一条曲线,切换只影响界面上怎么叫它",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "選檔方式:兩種選法寫的是同一條曲線,切換只影響介面上怎麼叫它",
"en": "Both selection modes edit the same curve; switching changes only how it is shown",
"ja": "どちらの選択方法も同じカーブを編集します。切り替えても表示方法が変わるだけです。"
},
{
"zh": "选项",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "選項",
"en": "Options",
"ja": "オプション"
@@ -16643,21 +16643,21 @@
},
{
"zh": "部分采集能力读取失败(%1,0x%2);当前列表可能不完整,请刷新重试。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "部分擷取能力讀取失敗(%1,0x%2);目前清單可能不完整,請重新整理再試。",
"en": "Some capture capabilities could not be read (%1, 0x%2). The list may be incomplete; refresh to retry.",
"ja": "一部のキャプチャ能力を読み取れませんでした(%1、0x%2)。一覧が不完全な可能性があります。更新して再試行してください。"
},
{
"zh": "配对",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "配對",
"en": "Pair",
"ja": "ペアリング"
},
{
"zh": "配对…",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "配對…",
"en": "Pair…",
"ja": "ペアリング…"
@@ -16678,21 +16678,21 @@
},
{
"zh": "配对失败({}),检查 PS5 配对码、Account ID 与网络。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "配對失敗({}),檢查 PS5 配對碼、Account ID 與網路。",
"en": "Pairing failed ({}); check the PS5 pairing code, Account ID and network.",
"ja": "ペアリングに失敗しました({})。PS5 のペアリングコード、Account ID、ネットワークを確認してください。"
},
{
"zh": "配对已删除。现有串流会保留;下次连接需选择其他主机或重新配对。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "配對已刪除。現有串流會保留;下次連接需選擇其他主機或重新配對。",
"en": "Pairing removed. The current stream is kept; next time choose another host or pair again.",
"ja": "ペアリングを削除しました。現在のストリーミングは継続します。次回は別のホストを選ぶか再ペアリングが必要です。"
},
{
"zh": "配对并保存",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "配對並儲存",
"en": "Pair and save",
"ja": "ペアリングして保存"
@@ -16706,42 +16706,42 @@
},
{
"zh": "配对成功并已加密保存;现在可以连接。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "配對成功並已加密儲存;現在可以連接。",
"en": "Paired and saved encrypted; you can connect now.",
"ja": "ペアリングして暗号化保存しました。接続できます。"
},
{
"zh": "配对成功,但保存失败;请检查用户目录权限。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "配對成功,但儲存失敗;請檢查使用者目錄權限。",
"en": "Paired, but saving failed; check the user folder permissions.",
"ja": "ペアリングしましたが保存に失敗しました。ユーザーフォルダーの権限を確認してください。"
},
{
"zh": "配对(首次)",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "配對(首次)",
"en": "Pair (first time)",
"ja": "ペアリング(初回)"
},
{
"zh": "配置驱动公开的输入与视频属性;其他采集应用占用设备时请先关闭",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "設定驅動提供的輸入與視訊屬性;請先關閉佔用裝置的其他擷取程式",
"en": "Configure the input and video properties exposed by the driver. Close other capture applications using the device first.",
"ja": "ドライバーが提供する入力と映像のプロパティを設定します。デバイスを使用中の他のキャプチャアプリを先に閉じてください。"
},
{
"zh": "采样",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "取樣",
"en": "Sampling",
"ja": "サンプリング"
},
{
"zh": "采样中",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "取樣中",
"en": "Sampling",
"ja": "サンプリング中"
@@ -16762,14 +16762,14 @@
},
{
"zh": "采集",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "擷取",
"en": "Capture",
"ja": "キャプチャー"
},
{
"zh": "采集 60→30",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "擷取 60→30",
"en": "Capture 60→30",
"ja": "キャプチャ 60→30"
@@ -16783,7 +16783,7 @@
},
{
"zh": "采集: 接收 %1 丢弃 %2 速率 %3 fps",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Export.cpp",
"zh-TW": "擷取: 接收 %1 丟棄 %2 速率 %3 fps",
"en": "Capture: received %1, dropped %2, rate %3 fps",
"ja": "キャプチャー:受信 %1、破棄 %2、レート %3 fps"
@@ -16811,7 +16811,7 @@
},
{
"zh": "采集卡",
- "src": "qml/CineBar.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "擷取卡",
"en": "Capture card",
"ja": "キャプチャーカード"
@@ -16825,7 +16825,7 @@
},
{
"zh": "采集卡 · %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "擷取卡 · %1",
"en": "Capture card · %1",
"ja": "キャプチャーカード · %1"
@@ -16839,7 +16839,7 @@
},
{
"zh": "采集卡收到 64 行就开始传,整帧更早到达(官方:1080p60 约省 5 ms,4K60 约省 15 ms)。开关后点「连接」重新连接生效",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "擷取卡收到 64 行就開始傳,整幀更早到達(官方:1080p60 約省 5 ms,4K60 約省 15 ms)。開關後點「連接」重新連接生效",
"en": "The card starts sending after 64 lines, so a whole frame arrives earlier (official: about 5 ms saved at 1080p60, about 15 ms at 4K60). After switching, click Connect to reconnect",
"ja": "カードは 64 ライン受信した時点で転送を始めるため、1 フレームが早く届きます(公式値:1080p60 で約 5 ms、4K60 で約 15 ms 短縮)。切り替え後は「接続」で再接続すると反映されます"
@@ -16860,7 +16860,7 @@
},
{
"zh": "采集卡设置",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "擷取卡設定",
"en": "Capture card settings",
"ja": "キャプチャーカード設定"
@@ -16895,14 +16895,14 @@
},
{
"zh": "采集卡连上后自动连接 PS5",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "擷取卡連上後自動連接 PS5",
"en": "Connects to the PS5 once the capture card is connected",
"ja": "キャプチャーカードの接続後に PS5 へ自動接続します"
},
{
"zh": "采集帧率请输入 1–1000 的数字(可带小数),或 0 沿用设备默认",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "擷取幀率請輸入 1–1000 的數字(可帶小數),或 0 沿用裝置預設",
"en": "Enter a capture frame rate from 1 to 1000 (decimals allowed), or 0 for the device default",
"ja": "キャプチャーのフレームレートは 1–1000 の数値(小数可)、またはデバイス既定の 0 を入力してください"
@@ -16916,14 +16916,14 @@
},
{
"zh": "采集接口已切换,请刷新并重新选择设备和格式",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "擷取介面已切換,請重新整理並選擇裝置及格式",
"en": "Capture interface changed. Refresh and reselect the device and format.",
"ja": "キャプチャのインターフェイスが変更されました。更新してデバイスと形式を選び直してください。"
},
{
"zh": "采集方式",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ScreenSourceDialog.qml",
"zh-TW": "擷取方式",
"en": "Capture method",
"ja": "キャプチャー方式"
@@ -16965,7 +16965,7 @@
},
{
"zh": "采集画面倒置时开启,立即生效",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "擷取畫面倒置時開啟,立即生效",
"en": "Turn on when the captured picture is upside down; takes effect immediately",
"ja": "キャプチャー映像が逆さまのときにオン。すぐに反映"
@@ -17014,7 +17014,7 @@
},
{
"zh": "采集设置保存失败,请检查配置目录是否可写",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "擷取設定儲存失敗,請檢查設定目錄是否可寫入",
"en": "Could not save capture settings. Check that the configuration folder is writable",
"ja": "キャプチャ設定を保存できません。設定フォルダーに書き込めるか確認してください"
@@ -17112,21 +17112,21 @@
},
{
"zh": "重连",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "重連",
"en": "Reconnect",
"ja": "再接続"
},
{
"zh": "重连 %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Playback.cpp",
"zh-TW": "重連 %1",
"en": "Reconnects %1",
"ja": "再接続 %1"
},
{
"zh": "重连中",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "重連中",
"en": "Reconnecting",
"ja": "再接続中"
@@ -17161,7 +17161,7 @@
},
{
"zh": "错误",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Status.cpp",
"zh-TW": "錯誤",
"en": "Error",
"ja": "エラー"
@@ -17189,7 +17189,7 @@
},
{
"zh": "长句自动缩小",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "長句自動縮小",
"en": "Shrink long lines automatically",
"ja": "長い行は自動で縮小"
@@ -17203,7 +17203,7 @@
},
{
"zh": "阈值 %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Enhancement.cpp",
"zh-TW": "閾值 %1",
"en": "threshold %1",
"ja": "しきい値 %1"
@@ -17217,7 +17217,7 @@
},
{
"zh": "队列输入文件不存在",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "佇列輸入檔案不存在",
"en": "The queued input file does not exist",
"ja": "キューの入力ファイルが存在しません"
@@ -17231,14 +17231,14 @@
},
{
"zh": "阴影色调",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "陰影色調",
"en": "Shadow tint",
"ja": "シャドウの色合い"
},
{
"zh": "陀螺仪",
- "src": "qml/DialogHost.qml",
+ "src": "qml/Ps5SourceDialog.qml",
"zh-TW": "陀螺儀",
"en": "Gyro",
"ja": "ジャイロ"
@@ -17294,7 +17294,7 @@
},
{
"zh": "需 1080p SDR 文件、SF 和 NVIDIA 光流;关闭超分、补帧、抗闪烁、调色、美颜及 HDR",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "需 1080p SDR 檔案、SF 與 NVIDIA 光流;關閉超解析度、補幀、抗閃爍、調色、美顏及 HDR",
"en": "Requires a 1080p SDR file, SF and NVIDIA optical flow; turn off upscaling, frame generation, anti-flicker, grading, beauty and HDR",
"ja": "1080p SDR ファイル、SF、NVIDIA 光フローが必要です。超解像、フレーム生成、ちらつき抑制、色調整、美顔、HDR をオフにしてください"
@@ -17315,63 +17315,63 @@
},
{
"zh": "需要 AMD HIP 7 驱动运行组件",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Hardware.cpp",
"zh-TW": "需要 AMD HIP 7 驅動執行元件",
"en": "Requires the AMD HIP 7 driver runtime",
"ja": "AMD HIP 7 ドライバーランタイムが必要です"
},
{
"zh": "需要 AMD RX 9000",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Hardware.cpp",
"zh-TW": "需要 AMD RX 9000",
"en": "Requires AMD RX 9000",
"ja": "AMD RX 9000 が必要です"
},
{
"zh": "需要 NVIDIA RTX 40 / 50(Ada / Blackwell)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Hardware.cpp",
"zh-TW": "需要 NVIDIA RTX 40 / 50(Ada / Blackwell)",
"en": "Requires NVIDIA RTX 40 / 50 (Ada / Blackwell)",
"ja": "NVIDIA RTX 40 / 50(Ada / Blackwell)が必要です"
},
{
"zh": "需要 NVIDIA RTX 50 / Blackwell",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Hardware.cpp",
"zh-TW": "需要 NVIDIA RTX 50 / Blackwell",
"en": "Requires NVIDIA RTX 50 / Blackwell",
"ja": "NVIDIA RTX 50 / Blackwell が必要です"
},
{
"zh": "需要 NVIDIA RTX 显卡",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Hardware.cpp",
"zh-TW": "需要 NVIDIA RTX 顯示卡",
"en": "Requires an NVIDIA RTX GPU",
"ja": "NVIDIA RTX GPU が必要です"
},
{
"zh": "需要 NVIDIA RTX 显卡及 NVOF 驱动",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Hardware.cpp",
"zh-TW": "需要 NVIDIA RTX 顯示卡及 NVOF 驅動",
"en": "Requires an NVIDIA RTX GPU and the NVOF driver",
"ja": "NVIDIA RTX GPU と NVOF ドライバーが必要です"
},
{
"zh": "需要 PIN",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "需要 PIN",
"en": "PIN needed",
"ja": "PIN が必要"
},
{
"zh": "需要主机显示器开启 HDR,且编码选 HEVC 或 AV1;本机需要硬件解码",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "需要主機顯示器開啟 HDR,且編碼選 HEVC 或 AV1;本機需要硬體解碼",
"en": "Needs HDR on for the host display and HEVC or AV1 as the codec; this PC needs hardware decoding",
"ja": "ホストのディスプレイで HDR をオンにし、コーデックを HEVC か AV1 にする必要があります。この PC にはハードウェアデコードが必要です"
},
{
"zh": "需要先配对才能唤醒。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "需要先配對才能喚醒。",
"en": "Pairing is needed before waking.",
"ja": "起動するには先にペアリングが必要です。"
@@ -17385,21 +17385,21 @@
},
{
"zh": "需要支持 DirectX 12 的硬件显卡",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Hardware.cpp",
"zh-TW": "需要支援 DirectX 12 的硬體顯示卡",
"en": "Requires a hardware GPU with DirectX 12 support",
"ja": "DirectX 12 対応のハードウェア GPU が必要です"
},
{
"zh": "需要直接媒体地址,普通网页或需要网页登录的页面不能直接播放。直播流通常无法拖动进度。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/NetworkSourceDialog.qml",
"zh-TW": "需要直接媒體位址,一般網頁或需要網頁登入的頁面無法直接播放。直播串流通常無法拖曳進度。",
"en": "Use a direct media URL. Ordinary web pages and pages requiring browser sign-in cannot be played directly. Live streams usually do not support seeking.",
"ja": "メディアの直接 URL が必要です。通常の Web ページやブラウザーでのログインが必要なページは直接再生できません。ライブ配信では通常シークできません。"
},
{
"zh": "需要系统显示事件才能测得真实值;取不到时显示未测",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "需要系統顯示事件才能測得真實值;取不到時顯示未測",
"en": "Real values need system display events; shows Not measured when they are unavailable",
"ja": "実際の値にはシステムの表示イベントが必要です。取得できない場合は「未計測」と表示します"
@@ -17434,35 +17434,35 @@
},
{
"zh": "静音",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "靜音",
"en": "Mute",
"ja": "ミュート"
},
{
"zh": "非官方:使用与 Greenlight 等开源客户端相同的方式连接微软的串流服务,不隶属于微软,微软随时可能改动导致失效。仅限你自己的账号和主机。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": "非官方:使用與 Greenlight 等開源客戶端相同的方式連接微軟的串流服務,不隸屬於微軟,微軟隨時可能改動導致失效。僅限你自己的帳號和主機。",
"en": "Unofficial: connects to Microsoft's streaming service the same way open-source clients such as Greenlight do. Not affiliated with Microsoft; it may stop working whenever Microsoft changes something. Only for your own account and console.",
"ja": "非公式:Greenlight などのオープンソースクライアントと同じ方法で Microsoft のストリーミングサービスに接続します。Microsoft とは無関係で、Microsoft の変更によりいつでも使えなくなる可能性があります。自分のアカウントと本体でのみ使用してください。"
},
{
"zh": "音画同步",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "音畫同步",
"en": "Audio/video sync",
"ja": "音声と映像の同期"
},
{
"zh": "音轨",
- "src": "qml/CineBar.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "音軌",
"en": "Audio tracks",
"ja": "音声トラック"
},
{
"zh": "音轨 %1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "音軌 %1",
"en": "Audio track %1",
"ja": "音声トラック %1"
@@ -17497,21 +17497,21 @@
},
{
"zh": "音量",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "音量",
"en": "Volume",
"ja": "音量"
},
{
"zh": "音频",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "音訊",
"en": "Audio",
"ja": "オーディオ"
},
{
"zh": "音频偏移",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProAudioPanel.qml",
"zh-TW": "音訊偏移",
"en": "Audio offset",
"ja": "音声オフセット"
@@ -17553,7 +17553,7 @@
},
{
"zh": "音频监听",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "音訊監聽",
"en": "Audio monitoring",
"ja": "音声モニター"
@@ -17574,7 +17574,7 @@
},
{
"zh": "音频设置",
- "src": "qml/DialogHost.qml",
+ "src": "qml/AudioSettingsDialog.qml",
"zh-TW": "音訊設定",
"en": "Audio settings",
"ja": "オーディオ設定"
@@ -17686,7 +17686,7 @@
},
{
"zh": "预计约 %1(按已写入 %2 推算)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/View.cpp",
"zh-TW": "預計約 %1(按已寫入 %2 推算)",
"en": "About %1 (estimated from %2 written)",
"ja": "約 %1(書き込み済み %2 から推定)"
@@ -17700,7 +17700,7 @@
},
{
"zh": "预设「%1」",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "預設「%1」",
"en": "Preset \"%1\"",
"ja": "プリセット「%1」"
@@ -17735,7 +17735,7 @@
},
{
"zh": "预设分开保存,互不影响;应用时只覆盖勾选的部分",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "預設分開儲存,互不影響;應用時只覆蓋勾選的部分",
"en": "Presets are saved separately and do not affect each other; applying one only overwrites the checked parts",
"ja": "プリセットは個別に保存され、互いに影響しません。適用時はチェックした部分だけを上書きします"
@@ -17756,7 +17756,7 @@
},
{
"zh": "预设参数无效,已保留原状态",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "預設參數無效,已保留原狀態",
"en": "Invalid preset settings; previous state kept",
"ja": "プリセットの設定が不正なため、元の状態のままです"
@@ -17770,7 +17770,7 @@
},
{
"zh": "预设名称",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "預設名稱",
"en": "Preset name",
"ja": "プリセット名"
@@ -17798,35 +17798,35 @@
},
{
"zh": "预设和",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "預設和",
"en": "Presets and",
"ja": "プリセットと"
},
{
"zh": "预设已删除",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "預設已刪除",
"en": "Preset deleted",
"ja": "プリセットを削除しました"
},
{
"zh": "预设已复制",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "預設已複製",
"en": "Preset copied",
"ja": "プリセットをコピーしました"
},
{
"zh": "预设已导出到:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Preferences.cpp",
"zh-TW": "預設已匯出到:%1",
"en": "Preset exported to: %1",
"ja": "プリセットを書き出しました:%1"
},
{
"zh": "预设已改名",
- "src": "qml/DialogHost.qml",
+ "src": "qml/ManagePresetsDialog.qml",
"zh-TW": "預設已改名",
"en": "Preset renamed",
"ja": "プリセットの名前を変更しました"
@@ -18064,7 +18064,7 @@
},
{
"zh": "预设引用的 LUT 不存在:%1,未应用",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "預設引用的 LUT 不存在:%1,未應用",
"en": "The LUT the preset refers to does not exist: %1; not applied",
"ja": "プリセットが参照する LUT が存在しません:%1。適用していません"
@@ -18155,7 +18155,7 @@
},
{
"zh": "预设需要一个名字",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SavePresetDialog.qml",
"zh-TW": "預設需要一個名字",
"en": "The preset needs a name",
"ja": "プリセットには名前が必要です"
@@ -18197,28 +18197,28 @@
},
{
"zh": "颜色预设不存在",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "顏色預設不存在",
"en": "The color preset does not exist",
"ja": "カラープリセットが存在しません"
},
{
"zh": "颜色预设保存失败:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "顏色預設儲存失敗:%1",
"en": "Could not save the color preset: %1",
"ja": "カラープリセットを保存できませんでした:%1"
},
{
"zh": "颜色预设名称需为 1–48 个字符",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "顏色預設名稱需為 1–48 個字符",
"en": "Color preset names must be 1–48 characters",
"ja": "カラープリセット名は 1–48 文字にしてください"
},
{
"zh": "颜色预设库无法读取:%1",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "顏色預設庫無法讀取:%1",
"en": "The color preset library cannot be read: %1",
"ja": "カラープリセットライブラリを読み取れません:%1"
@@ -18253,7 +18253,7 @@
},
{
"zh": "首次使用:PS5 设置 → 系统 → 远程游玩 → 关联设备,填写账号 ID 与 8 位配对码后配对。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/RemotePlay.cpp",
"zh-TW": "首次使用:PS5 設定 → 系統 → 遠程遊玩 → 關聯裝置,填寫帳號 ID 與 8 位配對碼後配對。",
"en": "First use: PS5 Settings → System → Remote Play → Link Device; enter the account ID and 8-digit pairing code, then pair.",
"ja": "初回:PS5 の 設定 → システム → リモートプレイ → 機器を登録する で、アカウント ID と 8 桁のペアリングコードを入力してペアリングします。"
@@ -18288,14 +18288,14 @@
},
{
"zh": "驱动未提供可解析的视频格式,请检查设备与驱动后刷新。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "驅動未提供可解析的視訊格式,請檢查裝置與驅動後重新整理。",
"en": "The driver provided no readable video formats. Check the device and driver, then refresh.",
"ja": "ドライバーから読み取れる映像形式が取得できません。デバイスとドライバーを確認して更新してください。"
},
{
"zh": "驱动未提供该分辨率,或尺寸不符合步进要求;原选择已保留。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "驅動未提供該解析度,或尺寸不符合步進要求;原選擇已保留。",
"en": "The driver does not offer this resolution, or its size violates granularity. The previous selection was kept.",
"ja": "ドライバーがこの解像度に対応していないか、サイズが刻みに合いません。以前の選択を保持しました。"
@@ -18309,14 +18309,14 @@
},
{
"zh": "驱动设置",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "驅動設定",
"en": "Driver settings",
"ja": "ドライバー設定"
},
{
"zh": "驱动设置已关闭。请核对所选格式与设备帧率,再连接。",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "驅動設定已關閉。請核對所選格式與裝置幀率,再連接。",
"en": "Driver settings are closed. Check the selected format and device frame rate before connecting.",
"ja": "ドライバー設定を閉じました。選択した形式とデバイスのフレームレートを確認してから接続してください。"
@@ -18337,7 +18337,7 @@
},
{
"zh": "驱动默认",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "驅動預設",
"en": "Driver default",
"ja": "ドライバーの既定"
@@ -18386,35 +18386,35 @@
},
{
"zh": "高光又亮又多",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "高光又亮又多",
"en": "Many strong highlights",
"ja": "明るいハイライトが多い"
},
{
"zh": "高光强",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "高光強",
"en": "Strong highlights",
"ja": "強いハイライト"
},
{
"zh": "高光很亮的片子(雪景/爆炸/演唱会):压住顶部,暗部不动。",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "高光很亮的片子(雪景/爆炸/演唱会):压住顶部,暗部不动。",
"en": "Films with very bright highlights (snow, explosions, concerts): rolls off the top end and leaves the shadows alone.",
"ja": "Films with very bright highlights (snow, explosions, concerts): rolls off the top end and leaves the shadows alone."
},
{
"zh": "高光起点 (nit)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "高光起點 (nit)",
"en": "Highlight start (nit)",
"ja": "ハイライト開始點 (nit)"
},
{
"zh": "高光预警",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "高光預警",
"en": "Highlight guidance",
"ja": "ハイライトの案内"
@@ -18428,7 +18428,7 @@
},
{
"zh": "高级设置:技术参数",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "高級設定:技術參數",
"en": "Advanced: precise parameters",
"ja": "詳細設定:数値パラメーター"
@@ -18449,7 +18449,7 @@
},
{
"zh": "黑体",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "黑體",
"en": "SimHei",
"ja": "ゴシック体"
@@ -18463,28 +18463,28 @@
},
{
"zh": "黑色",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Colour.cpp",
"zh-TW": "黑色",
"en": "Blacks",
"ja": "黒レベル"
},
{
"zh": "默认",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "預設",
"en": "Default",
"ja": "既定"
},
{
"zh": "默认 150 Mbps;有线千兆可以拉到 300–500,无线卡顿时调低。主机画面简单时实际码率会低于这里的上限",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "預設 150 Mbps;有線千兆可以拉到 300–500,無線卡頓時調低。主機畫面簡單時實際位元率會低於這裡的上限",
"en": "Default 150 Mbps; wired gigabit can go to 300–500, lower it if wireless stutters. When the host picture is simple, the actual bitrate stays below this cap",
"ja": "既定は 150 Mbps。有線ギガビットなら 300–500 まで上げられ、無線でカクつく場合は下げてください。ホストの映像が単純なときは実際のビットレートはこの上限より低くなります"
},
{
"zh": "默认保持字号;开启后超过目标行数才缩小",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "預設保持字號;開啟後超過目標行數才縮小",
"en": "Keeps the font size by default; when on, shrinks only beyond the target number of lines",
"ja": "既定では文字サイズを保ちます。オンにすると目標の行数を超えたときだけ縮小します"
@@ -18512,7 +18512,7 @@
},
{
"zh": "默认关闭。开启使用 DeckLink 原生接口,关闭使用 DirectShow。需安装 Desktop Video 驱动;切换后重新选择设备和格式并连接,不写入驱动永久配置。",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "預設關閉。開啟使用 DeckLink 原生介面,關閉使用 DirectShow。需要 Desktop Video 驅動;切換後重新選擇裝置及格式並連線,不寫入驅動永久設定。",
"en": "Off by default. On uses DeckLink; off uses DirectShow. Requires Desktop Video. Reselect the device and format, then reconnect. Driver preferences are not changed.",
"ja": "既定はオフです。オンで DeckLink、オフで DirectShow を使用します。Desktop Video が必要です。切り替え後にデバイスと形式を選び直して接続してください。ドライバーの永続設定は変更しません。"
@@ -18526,28 +18526,28 @@
},
{
"zh": "默认只列常用帧率:24、25、30、50、60、100、120、144、165、240(含 59.94 这类非整数帧率)。这张卡另外上报了 %1 个帧率",
- "src": "qml/DialogHost.qml",
+ "src": "qml/CaptureSourceDialog.qml",
"zh-TW": "預設只列常用幀率:24、25、30、50、60、100、120、144、165、240(含 59.94 這類非整數幀率)。這張卡另外回報了 %1 個幀率",
"en": "Only common frame rates are listed by default: 24, 25, 30, 50, 60, 100, 120, 144, 165, 240 (including non-integer rates such as 59.94). This card reports %1 more",
"ja": "既定では一般的なフレームレートのみ表示します:24、25、30、50、60、100、120、144、165、240(59.94 などの非整数レートを含む)。このカードはほかに %1 個のフレームレートを報告しています"
},
{
"zh": "默认只在本机出声",
- "src": "qml/DialogHost.qml",
+ "src": "qml/PcSourceDialog.qml",
"zh-TW": "預設只在本機出聲",
"en": "Sound plays only on this PC by default",
"ja": "既定ではこの PC でのみ音を出します"
},
{
"zh": "默认显示副字幕",
- "src": "qml/DialogHost.qml",
+ "src": "qml/SubtitleSettingsDialog.qml",
"zh-TW": "預設顯示副字幕",
"en": "Show secondary subtitles by default",
"ja": "サブ字幕を既定で表示"
},
{
"zh": "默认预设保存失败:",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Chain.cpp",
"zh-TW": "預設預設儲存失敗:",
"en": "Could not save the default preset: ",
"ja": "既定のプリセットを保存できませんでした:"
@@ -18603,7 +18603,7 @@
},
{
"zh": "(不建议使用)",
- "src": "src/ui/QmlPlayerBridge.cpp",
+ "src": "src/ui/bridge/Capture.cpp",
"zh-TW": "(不建議使用)",
"en": " (not recommended)",
"ja": "(非推奨)"
@@ -18659,7 +18659,7 @@
},
{
"zh": "(片源最亮 %1 nit、最亮帧平均 %2 nit)",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProDisplayPanel.qml",
"zh-TW": "(片源最亮 %1 nit、最亮幀平均 %2 nit)",
"en": "(Source peak %1 nit, maximum frame average %2 nit)",
"ja": "(ソースの最大輝度 %1 nit、最大フレーム平均 %2 nit)"
@@ -18680,14 +18680,14 @@
},
{
"zh": ",最忙的引擎类型,全系统),每秒采样;在 设置 → 通用与外观 中更换监控的显卡",
- "src": "qml/ProPage.qml",
+ "src": "qml/ProPerfOrbs.qml",
"zh-TW": ",最忙的引擎類型,全系統),每秒取樣;在 設定 → 通用與外觀 中更換監控的顯示卡",
"en": ", busiest engine type, whole system), sampled every second; change the monitored GPU under Settings → General and appearance",
"ja": "、最も負荷の高いエンジンの種類、システム全体)。毎秒サンプリング。監視する GPU は 設定 → 全般と外観 で変更できます"
},
{
"zh": ",输入下面的登录码:",
- "src": "qml/DialogHost.qml",
+ "src": "qml/XboxSourceDialog.qml",
"zh-TW": ",輸入下面的登入碼:",
"en": ", enter the sign-in code below:",
"ja": "、下のサインインコードを入力してください:"
diff --git a/qml/Veyra/AudioSettingsDialog.qml b/qml/Veyra/AudioSettingsDialog.qml
new file mode 100644
index 00000000..23ae4220
--- /dev/null
+++ b/qml/Veyra/AudioSettingsDialog.qml
@@ -0,0 +1,149 @@
+// audio dialog: source/settings logic is owned by this component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+DialogLayer {
+ key: "audio"
+ glyph: "music"
+ title: qsTr("音频设置")
+ dialogWidth: 560
+ actions: [{ label: qsTr("完成"), primary: true }]
+ onActionTriggered: dialogHost.close()
+
+ DialogSection { text: qsTr("音轨") }
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 6
+ Text {
+ visible: veyra.audioTracks.length === 0
+ text: qsTr("当前源没有可选音轨。")
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ }
+ Repeater {
+ model: veyra.audioTracks
+ delegate: Rectangle {
+ required property var modelData
+ Layout.fillWidth: true
+ implicitHeight: 52
+ radius: 12
+ color: Theme.card2
+ border.width: 1
+ border.color: veyra.selectedAudioTrack === modelData.index ? Theme.accent : Theme.stroke
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 12
+ anchors.rightMargin: 12
+ spacing: 12
+ // .trk .bars: the playing track's bars move (M39).
+ VEqBars {
+ objectName: "audio-track-bars-" + modelData.index
+ active: veyra.selectedAudioTrack === modelData.index && veyra.running && !veyra.paused
+ }
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 2
+ Text {
+ text: modelData.label
+ color: Theme.t1
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ }
+ Text {
+ text: modelData.channels > 0 ? modelData.channels + qsTr(" 声道") : ""
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ }
+ }
+ VIcon {
+ visible: veyra.selectedAudioTrack === modelData.index
+ name: "check"
+ color: Theme.accent
+ }
+ }
+ HoverHandler { cursorShape: Qt.PointingHandCursor }
+ TapHandler { onTapped: veyra.selectedAudioTrack = modelData.index }
+ }
+ }
+ }
+ DialogSection { text: qsTr("输出") }
+ DialogGroup {
+ VRow {
+ label: qsTr("音量")
+ value: Math.round(veyra.volume * 100) + "%"
+ VSlider {
+ implicitWidth: 170
+ from: 0; to: 1; value: veyra.volume; inputScale: 100
+ onMoved: veyra.volume = value
+ }
+ }
+ VRow {
+ label: qsTr("静音")
+ VSwitch {
+ checked: veyra.muted
+ onToggled: checked => veyra.muted = checked
+ }
+ }
+ }
+ DialogSection { text: qsTr("音画同步") }
+ DialogGroup {
+ VRow {
+ label: qsTr("声音同步")
+ hint: veyra.audioSyncMode === 0 ? (veyra.audioSyncLive ? qsTr("软件估算补偿 ") + veyra.audioCompensationMs.toFixed(0) + " ms" : qsTr("自动估算 · 采集卡 / PS5 实时输入时生效"))
+ : veyra.audioSyncMode === 1 ? qsTr("手动偏移 · 实时输入时生效") : qsTr("关闭补偿")
+ VSeg {
+ options: [{ id: "0", label: qsTr("自动估算") }, { id: "1", label: qsTr("手动") }, { id: "2", label: qsTr("关闭", "off") }]
+ current: String(veyra.audioSyncMode)
+ onPicked: id => veyra.audioSyncMode = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("手动偏移")
+ hint: qsTr("负值 = 声音提前")
+ value: veyra.audioOffsetMs + " ms"
+ VSlider {
+ implicitWidth: 170
+ center: true
+ from: -250; to: 250; value: veyra.audioOffsetMs; enabledControl: veyra.audioSyncMode === 1
+ onMoved: veyra.audioOffsetMs = Math.round(value / 10) * 10
+ }
+ }
+ VRow {
+ label: qsTr("当前偏差")
+ hint: qsTr("软件内测得的音画偏差,不是扬声器实测;只在采集卡 / PS5 实时输入时有")
+ value: veyra.audioSkewKnown ? (veyra.audioSkewMs >= 0 ? "+" : "") + veyra.audioSkewMs.toFixed(0) + " ms" : qsTr("未测")
+ }
+ }
+ DialogSection { text: qsTr("输出设备") }
+ DialogGroup {
+ VRow {
+ label: qsTr("输出设备")
+ hint: veyra.audioOutputStatus
+ VSelect {
+ objectName: "audio-device"
+ implicitWidth: 240
+ readonly property string chosen: veyra.preferences.audioDevice || ""
+ value: { const d = veyra.audioDevices.find(x => x.id === chosen); return d ? d.label : qsTr("跟随系统默认") }
+ options: veyra.audioDevices
+ onPicked: id => veyra.setPreference("audioDevice", id)
+ }
+ }
+ VRow {
+ label: qsTr("立体声下混")
+ hint: qsTr("多声道片源混成双声道再输出(耳机);关闭时按设备声道布局映射")
+ VSwitch {
+ objectName: "audio-stereo"
+ checked: veyra.preferences.audioForceStereo === true
+ onToggled: checked => veyra.setPreference("audioForceStereo", checked)
+ }
+ }
+ }
+ // The list is read when the dialog opens: devices come and go.
+ Connections {
+ target: dialogHost
+ function onDialogChanged() { if (dialogHost.dialog === "audio") veyra.refreshAudioDevices() }
+ }
+}
diff --git a/qml/Veyra/CaptureSourceDialog.qml b/qml/Veyra/CaptureSourceDialog.qml
new file mode 100644
index 00000000..5b9c5d1d
--- /dev/null
+++ b/qml/Veyra/CaptureSourceDialog.qml
@@ -0,0 +1,463 @@
+// capture dialog: source/settings logic is owned by this component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+DialogLayer {
+ required property var legacyPicker
+ id: captureDialog
+ objectName: "capture-dialog"
+ key: "capture"
+ glyph: "video"
+ title: qsTr("采集卡")
+ sub: qsTr("连接设备后,先关闭增强确认基础画面,再按需开启")
+ dialogWidth: 660
+ foot: qsTr("关闭其他占用同一采集卡的软件")
+ actions: [
+ { label: captureDialog.live ? qsTr("断开") : qsTr("取消") },
+ { label: qsTr("连接并开始"), primary: true, icon: "play" }
+ ]
+ onActionTriggered: label => {
+ if (label === qsTr("断开")) { veyra.stopPlayback(); return }
+ if (label !== qsTr("连接并开始")) { dialogHost.close(); return }
+ if (veyra.startCaptureSession()) { dialogHost.close(); dialogHost.startCapture() }
+ }
+ Connections {
+ target: dialogHost
+ function onDialogChanged() {
+ if (dialogHost.dialog !== "capture") return
+ veyra.refreshCaptureDevices()
+ // The PS5 手柄控制 host list is the PS5 dialog's saved pairings.
+ if (veyra.ps5Control.available === true) veyra.ps5Load()
+ }
+ }
+ function labelOf(list, id, fallback) { const f = list.find(x => String(x.id) === String(id)); return f ? f.label : fallback }
+ readonly property bool live: veyra.captureSignalLevel !== "idle"
+ readonly property var pc: veyra.ps5Control
+ readonly property bool pcOn: pc.available === true && pc.enabled === true
+ readonly property string pcTag: {
+ switch (pc.state) {
+ case "starting": return qsTr("连接中")
+ case "connected": return qsTr("已连接")
+ case "recovering": return qsTr("重连中")
+ case "pin": return qsTr("需要 PIN")
+ case "failed": return qsTr("已停止")
+ case "nopair": return qsTr("未配对")
+ default: return qsTr("未连接")
+ }
+ }
+ readonly property string pcStatus: {
+ switch (pc.state) {
+ case "starting": return qsTr("正在连接 PS5…")
+ case "connected": return pc.keepaliveFps >= 0 ? qsTr("PS5 手柄控制已连接 · 保活画面 %1 fps(收到即丢弃)").arg(pc.keepaliveFps) : qsTr("PS5 手柄控制已连接")
+ case "pin": return qsTr("PS5 要求输入登录 PIN")
+ case "recovering": case "failed": case "nopair": return pc.message || ""
+ default: return qsTr("采集卡连上后自动连接 PS5")
+ }
+ }
+
+ // dialogs.js .cap-prev: the picture and a signal line under it. The
+ // picture is the session's own poster still when the engine made one;
+ // there is no periodic frame grab here, because that would sit on the
+ // live capture path. The status line is live.
+ Rectangle {
+ objectName: "capture-preview"
+ Layout.fillWidth: true
+ Layout.topMargin: 4
+ implicitHeight: 180 + 34
+ radius: 10
+ color: Theme.videoBlack
+ border.width: 1
+ border.color: Theme.stroke
+ clip: true
+ Image {
+ id: capturePoster
+ objectName: "capture-preview-image"
+ anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top
+ anchors.margins: 1
+ height: 180
+ fillMode: Image.PreserveAspectCrop
+ source: captureDialog.live ? veyra.capturePreviewUrl : ""
+ visible: status === Image.Ready
+ }
+ Column {
+ anchors.horizontalCenter: parent.horizontalCenter
+ y: 90 - height / 2
+ spacing: 8
+ visible: !capturePoster.visible
+ VIcon { anchors.horizontalCenter: parent.horizontalCenter; name: "video"; size: 22; color: Theme.t3 }
+ Text {
+ text: captureDialog.live ? qsTr("画面在主窗口播放") : qsTr("连接后在主窗口显示画面")
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 12
+ }
+ }
+ RowLayout {
+ anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom
+ height: 34
+ anchors.leftMargin: 10; anchors.rightMargin: 10
+ spacing: 8
+ VTag {
+ objectName: "capture-signal"
+ text: veyra.captureSignalText
+ kind: veyra.captureSignalLevel === "ok" ? "ok" : veyra.captureSignalLevel === "warn" ? "warn" : ""
+ }
+ Text {
+ Layout.fillWidth: true
+ text: captureDialog.live
+ ? veyra.sourceSummary.replace("x", "×") + " · " + veyra.captureFps.toFixed(2) + " fps"
+ + (veyra.sourceFormatText.split(" · ").length > 2 ? " · " + veyra.sourceFormatText.split(" · ")[1] : "")
+ : (veyra.captureFormatLabel.length ? veyra.captureFormatLabel : qsTr("选择设备和格式后连接"))
+ color: Theme.t2
+ font.family: Theme.fontMono
+ font.pixelSize: 11
+ elide: Text.ElideRight
+ }
+ }
+ }
+
+ DialogSection { text: qsTr("设备") }
+ DialogGroup {
+ VRow {
+ label: qsTr("视频输入设备")
+ hint: veyra.captureQueryBusy ? qsTr("正在查询…当前播放继续") : (veyra.captureDevices.length === 0 ? qsTr("未检测到采集设备") : "")
+ RowLayout {
+ spacing: 6
+ VSelect {
+ objectName: "capture-device"
+ implicitWidth: 220
+ value: veyra.captureDeviceLabel
+ options: veyra.captureDevices
+ onPicked: id => veyra.captureDeviceId = id
+ }
+ // M38: the refresh icon becomes a spinner while the query runs.
+ Item {
+ implicitWidth: Theme.ctlHeight; implicitHeight: Theme.ctlHeight
+ VButton {
+ objectName: "capture-refresh"
+ anchors.fill: parent
+ visible: !veyra.captureQueryBusy
+ icon: true; ghost: true; iconName: "refresh"; tip: qsTr("刷新设备")
+ onClicked: veyra.refreshCaptureDevices()
+ }
+ VSpinner { anchors.centerIn: parent; visible: veyra.captureQueryBusy }
+ }
+ }
+ }
+ VRow {
+ objectName: "capture-legacy-entry"
+ label: qsTr("旧版格式选择")
+ hint: qsTr("直接查看完整格式列表,包含被常用帧率筛选隐藏的模式")
+ VButton {
+ objectName: "capture-legacy-open"
+ text: qsTr("打开旧版格式列表")
+ enabled: !veyra.captureQueryBusy && veyra.captureDeviceId.length > 0
+ onClicked: legacyPicker.open()
+ }
+ }
+ VRow {
+ label: qsTr("分辨率")
+ hint: qsTr("先选择分辨率,再选择该分辨率支持的帧率和像素格式")
+ VSelect {
+ objectName: "capture-resolution"
+ enabled: !veyra.captureQueryBusy
+ opacity: enabled ? 1 : 0.5
+ implicitWidth: 180
+ value: captureDialog.labelOf(veyra.captureResolutionOptions, veyra.captureResolutionId, veyra.captureResolutionOptions.length ? qsTr("请选择分辨率") : "—")
+ options: veyra.captureResolutionOptions
+ onPicked: id => veyra.captureResolutionId = id
+ }
+ }
+ VRow {
+ label: qsTr("自定义分辨率")
+ hint: qsTr("仅接受驱动尺寸范围与步进支持的值;连接时核对实际格式")
+ RowLayout {
+ spacing: 6
+ enabled: !veyra.captureQueryBusy && veyra.captureDeviceId.length > 0
+ DialogTextField { id: customCaptureResolution; objectName: "capture-custom-resolution"; implicitWidth: 140; text: "1920x1080" }
+ VButton { text: qsTr("检查并选择"); onClicked: veyra.captureResolutionId = customCaptureResolution.text }
+ }
+ }
+ VRow {
+ label: qsTr("帧率")
+ hint: qsTr("列出离散帧率及驱动范围内的候选;设备帧率填 0 时沿用此选择,连接时验证实际值")
+ VSelect {
+ objectName: "capture-frame-rate"
+ enabled: !veyra.captureQueryBusy && veyra.captureResolutionId.length > 0
+ opacity: enabled ? 1 : 0.5
+ implicitWidth: 280
+ value: captureDialog.labelOf(veyra.captureFrameRateOptions, veyra.captureFrameRateId, veyra.captureFrameRateOptions.length ? qsTr("请选择帧率") : "—")
+ options: veyra.captureFrameRateOptions
+ onPicked: id => veyra.captureFrameRateId = id
+ }
+ }
+ VRow {
+ // Some cards list every rate from 1 to 120 fps (logs(18)). The frame-rate menu
+ // shows the common rates the card offers; this lists the rest too.
+ objectName: "capture-all-rates-row"
+ visible: veyra.captureHiddenFrameRates > 0
+ label: qsTr("显示全部可用帧率")
+ hint: qsTr("默认只列常用帧率:24、25、30、50、60、100、120、144、165、240(含 59.94 这类非整数帧率)。这张卡另外上报了 %1 个帧率").arg(veyra.captureHiddenFrameRates)
+ VSwitch {
+ objectName: "capture-all-rates"
+ enabled: !veyra.captureQueryBusy
+ opacity: enabled ? 1 : 0.35
+ checked: veyra.preferences.captureShowAllFrameRates === true
+ onToggled: checked => veyra.setPreference("captureShowAllFrameRates", checked)
+ }
+ }
+ VRow {
+ label: qsTr("像素格式")
+ // Never search veyra.captureFormats here: a card can list 15000+ (logs(18)).
+ hint: veyra.captureFormatCostHint ? qsTr("该格式比低延迟格式多一道处理环节,高分辨率/高帧率下建议优先低延迟格式") : qsTr("只列出当前分辨率和帧率下的像素格式")
+ VSelect {
+ objectName: "capture-format"
+ enabled: !veyra.captureQueryBusy && veyra.captureResolutionId.length > 0 && veyra.captureFrameRateId.length > 0
+ opacity: enabled ? 1 : 0.5
+ implicitWidth: 220
+ value: captureDialog.labelOf(veyra.capturePixelOptions, veyra.capturePixelId, veyra.captureResolutionId.length ? qsTr("请选择像素格式") : qsTr("请先选择分辨率"))
+ options: veyra.capturePixelOptions
+ onPicked: id => veyra.capturePixelId = id
+ }
+ }
+ VRow {
+ objectName: "capture-driver-settings-row"
+ visible: veyra.captureDeviceId.length > 0
+ label: qsTr("驱动设置")
+ hint: captureDialog.live ? qsTr("先断开采集,再配置驱动")
+ : veyra.captureBlackmagicDevice
+ ? (veyra.preferences.blackmagicNativeCapture === true
+ ? qsTr("请在设备列表选择对应的 HDMI/SDI 输入口;Driver 保留驱动当前输入。支持自动检测的卡建议选择自动,信号未锁定时会明确提示。")
+ : qsTr("Blackmagic 两个条目可能属于同一张卡。DirectShow 黑屏可尝试下方原生采集开关;手动格式须匹配实际信号。"))
+ : qsTr("配置驱动公开的输入与视频属性;其他采集应用占用设备时请先关闭")
+ RowLayout {
+ spacing: 6
+ VButton {
+ objectName: "capture-driver-properties"
+ text: qsTr("设备属性"); ghost: true
+ enabled: !veyra.captureQueryBusy && !captureDialog.live && !veyra.liveOpeningText.length
+ onClicked: veyra.openCaptureDriverSettings(false)
+ }
+ VButton {
+ objectName: "capture-driver-input"
+ visible: veyra.captureBlackmagicDevice
+ text: qsTr("输入选择"); ghost: true
+ enabled: !veyra.captureQueryBusy && !captureDialog.live && !veyra.liveOpeningText.length
+ onClicked: veyra.openCaptureDriverSettings(true)
+ }
+ }
+ }
+ VRow {
+ objectName: "capture-blackmagic-native-row"
+ label: qsTr("Blackmagic 原生采集")
+ hint: qsTr("默认关闭。开启使用 DeckLink 原生接口,关闭使用 DirectShow。需安装 Desktop Video 驱动;切换后重新选择设备和格式并连接,不写入驱动永久配置。")
+ VSwitch {
+ objectName: "capture-blackmagic-native"
+ enabled: !veyra.captureQueryBusy && (veyra.captureBlackmagicDevice || veyra.preferences.blackmagicNativeCapture === true)
+ opacity: enabled ? 1 : 0.35
+ checked: veyra.preferences.blackmagicNativeCapture === true
+ onToggled: checked => veyra.setPreference("blackmagicNativeCapture", checked)
+ }
+ }
+ VRow {
+ objectName: "capture-magewell-row"
+ label: qsTr("美乐威低延迟模式")
+ hint: !veyra.captureMagewellDevice
+ ? qsTr("仅美乐威 Pro Capture(PCIe 内置卡)可用;USB Capture 系列不支持")
+ : (veyra.captureMagewellStatus.length > 0 ? veyra.captureMagewellStatus + " · " : "")
+ + qsTr("采集卡收到 64 行就开始传,整帧更早到达(官方:1080p60 约省 5 ms,4K60 约省 15 ms)。开关后点「连接」重新连接生效")
+ VSwitch {
+ objectName: "capture-magewell"
+ enabled: veyra.captureMagewellDevice
+ opacity: enabled ? 1 : 0.35
+ checked: veyra.captureMagewellDevice && veyra.preferences.magewellLowLatency === true
+ onToggled: checked => veyra.setPreference("magewellLowLatency", checked)
+ }
+ }
+ VRow {
+ label: qsTr("设备帧率 FPS")
+ hint: qsTr("0 = 沿用所选格式;设备返回其他帧率会报错,不在软件中偷偷丢帧")
+ DialogTextField {
+ objectName: "capture-fps"
+ implicitWidth: 100
+ text: String(veyra.captureRequestedFps)
+ onEdited: text => veyra.captureRequestedFps = Number(text)
+ // Take a valid rate as it is typed. Only a canonical number ("59.94", not
+ // "59.") so the field's binding never rewrites what is still being typed.
+ onTyped: text => {
+ const n = Number(text.trim())
+ if (text.trim().length > 0 && String(n) === text.trim() && (n === 0 || (n >= 1 && n <= 1000)))
+ veyra.captureRequestedFps = n
+ }
+ }
+ }
+ }
+ DialogSection { text: qsTr("音频") }
+ DialogGroup {
+ VRow {
+ label: qsTr("音频监听")
+ hint: qsTr("只连接明确选中的输入,默认不监听")
+ VSelect {
+ objectName: "capture-audio"
+ implicitWidth: 260
+ value: captureDialog.labelOf(veyra.captureAudioInputs, veyra.captureAudioChoice, qsTr("不监听音频"))
+ options: veyra.captureAudioInputs
+ onPicked: id => veyra.captureAudioChoice = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("Dolby / DTS 位流")
+ VSeg {
+ objectName: "capture-audio-ingress"
+ options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: qsTr("强制 PCM") }, { id: "2", label: qsTr("位流优先") }]
+ current: String(veyra.captureAudioIngress)
+ onPicked: id => veyra.captureAudioIngress = Number(id)
+ }
+ }
+ }
+ // PS5 手柄控制: the capture card stays the picture and the sound; PS5 Remote
+ // Play only carries the pad (also from a handheld this picture is re-streamed to).
+ DialogSection { visible: captureDialog.pc.available === true; text: qsTr("PS5 手柄控制") }
+ DialogGroup {
+ visible: captureDialog.pc.available === true
+ VRow {
+ label: qsTr("用远程游玩控制 PS5")
+ hint: qsTr("画面和声音来自采集卡,手柄经 PS5 远程游玩发给主机。把处理后的画面再串流给掌机或别的电脑时,用那边的手柄玩 PS5")
+ VSwitch {
+ objectName: "capture-ps5-control"
+ checked: captureDialog.pcOn
+ onToggled: checked => veyra.ps5ControlSet("enabled", checked)
+ }
+ }
+ VRow {
+ visible: captureDialog.pcOn
+ label: qsTr("PS5 主机")
+ hint: veyra.ps5Profiles.length === 0 ? qsTr("还没有配对的 PS5,先在「PS5 串流」里配对一次") : qsTr("和「PS5 串流」共用配对")
+ RowLayout {
+ spacing: 6
+ VSelect {
+ objectName: "capture-ps5-host"
+ visible: veyra.ps5Profiles.length > 0
+ implicitWidth: 170
+ value: { const p = veyra.ps5Profiles.find(x => x.id === veyra.ps5.profile); return p ? p.label : qsTr("请选择") }
+ options: veyra.ps5Profiles
+ onPicked: id => veyra.ps5SelectProfile(id)
+ }
+ VTag {
+ objectName: "capture-ps5-state"
+ Layout.alignment: Qt.AlignVCenter
+ text: captureDialog.pcTag
+ kind: captureDialog.pc.state === "connected" ? "ok"
+ : captureDialog.pc.state === "failed" || captureDialog.pc.state === "nopair" || captureDialog.pc.state === "pin" ? "warn" : ""
+ }
+ VButton {
+ objectName: "capture-ps5-restart"
+ visible: captureDialog.pc.state === "failed"
+ text: qsTr("重连"); ghost: true
+ onClicked: veyra.ps5ControlRestart()
+ }
+ VButton {
+ objectName: "capture-ps5-pair"
+ text: veyra.ps5Profiles.length === 0 ? qsTr("去配对") : qsTr("配对…")
+ ghost: true
+ onClicked: dialogHost.open("ps5")
+ }
+ }
+ }
+ VRow {
+ visible: captureDialog.pcOn && captureDialog.pc.state === "pin"
+ label: qsTr("登录 PIN")
+ hint: qsTr("PS5 提示时填写,不是 8 位配对码")
+ RowLayout {
+ spacing: 6
+ DialogTextField { id: controlPin; objectName: "capture-ps5-pin"; implicitWidth: 120 }
+ VButton { text: qsTr("提交"); ghost: true; onClicked: { veyra.ps5SendLoginPin(controlPin.text); controlPin.text = "" } }
+ }
+ }
+ VRow {
+ visible: captureDialog.pcOn
+ label: qsTr("后台也转发手柄")
+ hint: qsTr("再串流时建议打开:Veyra 不在前台也继续转发。打开后在这台电脑上用别的程序时,手柄也会操作 PS5")
+ VSwitch {
+ objectName: "capture-ps5-background"
+ checked: captureDialog.pc.background === true
+ onToggled: checked => veyra.ps5ControlSet("background", checked)
+ }
+ }
+ VRow {
+ visible: captureDialog.pcOn
+ label: qsTr("手柄")
+ hint: qsTr("谁按键就用谁:本机手柄、串流软件建的虚拟手柄都可以")
+ Text {
+ objectName: "capture-ps5-pad"
+ text: (captureDialog.pc.pad || "").length > 0
+ ? captureDialog.pc.pad + " · " + (captureDialog.pc.gyro === true ? qsTr("有陀螺仪") : qsTr("无陀螺仪"))
+ : captureDialog.pc.state === "off" || captureDialog.pc.state === "nopair" ? "—" : qsTr("未检测到手柄")
+ color: Theme.t1
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ elide: Text.ElideRight
+ width: Math.min(implicitWidth, 260)
+ }
+ }
+ }
+ DialogNote {
+ objectName: "capture-ps5-note"
+ visible: captureDialog.pcOn
+ text: (captureDialog.pcStatus.length > 0 ? captureDialog.pcStatus + "\n" : "")
+ + qsTr("PS5 仍会发一路 720p 30fps、约 5 Mbps 的保活画面,本机收到即丢弃;PS5 同一时间只允许一个远程游玩连接。再串流时记得打开上面的「音频监听」。")
+ }
+ DialogSection { text: qsTr("格式与画面") }
+ DialogGroup {
+ VRow {
+ label: qsTr("输入色彩(SDR / HDR)")
+ hint: qsTr("不确定就选「自动」。采集 HDR:采集格式选 P010,这里选「HDR · PQ」(游戏机、显卡的 HDR10 都是 PQ)。「HDR · HLG」用于广播信号。「SDR · 709」是普通画面。变更需重连")
+ VSeg {
+ objectName: "capture-color-space"
+ options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: "HDR · PQ" }, { id: "2", label: "HDR · HLG" }, { id: "3", label: "SDR · 709" }]
+ current: String(veyra.captureColorSpace)
+ onPicked: id => veyra.captureColorSpace = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("输入范围")
+ hint: qsTr("Limited = 16–235,Full = 0–255。画面发灰选「有限」,暗部全黑、亮部过曝选「完全」")
+ VSeg {
+ objectName: "capture-color-range"
+ options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: qsTr("有限 · Limited") }, { id: "2", label: qsTr("完全 · Full") }]
+ current: String(veyra.captureColorRange)
+ onPicked: id => veyra.captureColorRange = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("设备缓冲")
+ hint: qsTr("自动:1080p 及以下 2 帧,更高 3 帧;最小 1 帧延迟最低但可能丢帧")
+ VSeg {
+ objectName: "capture-buffer-mode"
+ options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: qsTr("最小") }, { id: "2", label: qsTr("驱动默认") }]
+ current: String(veyra.captureBufferMode)
+ onPicked: id => veyra.captureBufferMode = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("转为 SDR 显示")
+ hint: qsTr("收到 HDR 也按 SDR 预览,立即生效")
+ VSwitch {
+ objectName: "capture-force-sdr"
+ checked: veyra.captureForceSdr
+ onToggled: checked => veyra.captureForceSdr = checked
+ }
+ }
+ VRow {
+ label: qsTr("画面上下翻转")
+ hint: qsTr("采集画面倒置时开启,立即生效")
+ VSwitch {
+ objectName: "capture-flip-vertical"
+ checked: veyra.captureFlipVertical
+ onToggled: checked => veyra.captureFlipVertical = checked
+ }
+ }
+ }
+ DialogNote { visible: veyra.captureStatus.length > 0; text: veyra.captureStatus }
+}
diff --git a/qml/Veyra/DialogGroup.qml b/qml/Veyra/DialogGroup.qml
new file mode 100644
index 00000000..8ff16d0b
--- /dev/null
+++ b/qml/Veyra/DialogGroup.qml
@@ -0,0 +1,8 @@
+// Shared dialog presentation; extracted without changing geometry or motion.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+VGroup {
+ Layout.fillWidth: true
+}
diff --git a/qml/Veyra/DialogHost.qml b/qml/Veyra/DialogHost.qml
index 9c2eba04..2c14e6a5 100644
--- a/qml/Veyra/DialogHost.qml
+++ b/qml/Veyra/DialogHost.qml
@@ -1,24 +1,16 @@
-// The five dialogs, rebuilt from the design's dialogs.js.
-//
-// Each mirrors the design's structure: a header with a colour-plated icon and a
-// subtitle, a scrolling body of sections (a heading with a hairline, then a group
-// of label/control rows), and a footer with the actions.
-//
-// Scope: the dialog edits only what the engine actually carries. Device and screen
-// target lists come from the source's own enumeration; force-SDR and flip are real
-// settings. The format list, audio monitoring, bitstream passthrough, subtitle
-// style and remote-play detail are not wired to anything yet, and each says so on
-// the page instead of being drawn as a control that would do nothing.
+// Dialog routing and scrim. Each dialog owns its own editable content.
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
Item {
id: host
+ // Compatibility type used by the professional and node views.
+ component VTextField: DialogTextField {}
anchors.fill: parent
z: 100
- // Which dialog is showing: "" | capture | ps5 | moonlight | xbox | screen | subtitle | audio
+ // Active dialog: network/capture/ps5/moonlight/xbox/screen/subtitle/audio/save/manage.
property string dialog: ""
onDialogChanged: if (dialog !== "capture") legacyCapturePicker.close()
@@ -65,190 +57,10 @@ Item {
property real motionScale: 1
// --- shared chrome ----------------------------------------------------
- component DLayer: Rectangle {
- id: dlg
- property string title: ""
- property string sub: ""
- property string glyph: ""
- property int dialogWidth: 640
- property var actions: []
- // dialogs.js `foot`: a quiet note at the left of the button row.
- property string foot: ""
- default property alias body: bodyCol.data
- signal actionTriggered(string label)
- // Which dialog key shows this layer.
- property string key: ""
- readonly property bool shown: key.length > 0 && host.dialog === key
- // M17: .dlg scale .9 -> 1 and translate 0 14px -> 0 over .55s --spring inside the
- // scrim's .2s fade; closing runs the same back while the scrim fades out.
- property real motionS: 0.9
- property real motionDy: 14
- onShownChanged: { if (shown) { motionS = 0.9; motionDy = 14; enterAnim.restart() } else exitAnim.restart() }
- onMotionSChanged: if (shown) host.motionScale = motionS
- ParallelAnimation {
- id: enterAnim
- NumberAnimation { target: dlg; property: "motionS"; to: 1; duration: Theme.d(550); easing.bezierCurve: Theme.spring }
- NumberAnimation { target: dlg; property: "motionDy"; to: 0; duration: Theme.d(550); easing.bezierCurve: Theme.spring }
- }
- ParallelAnimation {
- id: exitAnim
- NumberAnimation { target: dlg; property: "motionS"; to: 0.9; duration: Theme.d(550); easing.bezierCurve: Theme.spring }
- NumberAnimation { target: dlg; property: "motionDy"; to: 14; duration: Theme.d(550); easing.bezierCurve: Theme.spring }
- }
- opacity: shown ? 1 : 0
- visible: opacity > 0
- // A closed dialog leaves the scene. Its live bindings (capture preview, fps text)
- // kept changing while hidden and Qt redrew the window for each change, ~40 times
- // a second during capture; OBS game capture then held the UI instead of the video.
- // Keyed on shown/opacity, never on visible: an item without a parent always
- // reads invisible, so "visible ? host : null" never brought a dialog back.
- parent: (shown || opacity > 0) ? host : null
- Behavior on opacity { NumberAnimation { duration: Theme.d(200) } }
- transform: [
- Scale { origin.x: dlg.width / 2; origin.y: dlg.height / 2; xScale: dlg.motionS; yScale: dlg.motionS },
- Translate { y: dlg.motionDy }
- ]
- // Cut out of the native video window (main.cpp syncVideoCovers). The flag,
- // not the objectName: each dialog below names itself for tests.
- objectName: "videoCover"
- readonly property bool videoCover: true
- property real coverRadius: 16
-
- // Centred by position, not anchors: the parent is null while closed.
- x: Math.round((host.width - width) / 2)
- y: Math.round((host.height - height) / 2)
- width: dialogWidth
- // Never taller than the window: the body scrolls instead of the panel
- // being cut off at the top and bottom of a small window.
- // Header and footer each carry 16px margins top and bottom (64 in all); the
- // old +40 left every body 24px short, so short dialogs hid their last row.
- implicitHeight: Math.min(720, host.height - 24, header.height + bodyScroll.contentHeight + footer.height + 64)
- height: implicitHeight
- // Swallow presses on the panel itself so they never reach the scrim
- // below (a passive tap on a control used to close the whole dialog).
- MouseArea { anchors.fill: parent; acceptedButtons: Qt.AllButtons; z: -1 }
- radius: 16
- color: Theme.dialog
- border.width: 1
- border.color: Theme.stroke2
-
- ColumnLayout {
- anchors.fill: parent
- spacing: 0
-
- RowLayout {
- id: header
- Layout.fillWidth: true
- Layout.margins: 16
- spacing: 12
- Rectangle {
- implicitWidth: 34; implicitHeight: 34; radius: 10
- color: Qt.rgba(1, 1, 1, 0.06)
- VIcon { anchors.centerIn: parent; name: dlg.glyph }
- }
- ColumnLayout {
- Layout.fillWidth: true
- spacing: 2
- Text {
- // Fill: without a subtitle this is the column's only child, and
- // its natural width would cap the column and pull the close
- // button in beside the title.
- Layout.fillWidth: true
- elide: Text.ElideRight
- text: dlg.title
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsH2
- font.weight: Font.DemiBold; font.variableAxes: Theme.axesDemiBold
- }
- Text {
- Layout.fillWidth: true
- visible: dlg.sub.length > 0
- text: dlg.sub
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 12
- wrapMode: Text.WordWrap
- }
- }
- VButton { icon: true; iconName: "x"; ghost: true; onClicked: host.close() }
- }
-
- Flickable {
- id: bodyScroll
- Layout.fillWidth: true
- Layout.fillHeight: true
- Layout.leftMargin: 20
- Layout.rightMargin: 20
- contentHeight: bodyCol.implicitHeight
- clip: true
- ScrollBar.vertical: VScrollBar { }
- ColumnLayout {
- id: bodyCol
- // Keep the groups clear of the overlaid scroll bar.
- width: parent.width - (bodyScroll.contentHeight > bodyScroll.height ? 12 : 0)
- spacing: 0
- }
- }
-
- RowLayout {
- id: footer
- Layout.fillWidth: true
- Layout.margins: 16
- spacing: 8
- Text {
- objectName: "dialog-foot"
- Layout.fillWidth: true
- visible: dlg.foot.length > 0
- text: dlg.foot
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 11
- elide: Text.ElideRight
- }
- Item { Layout.fillWidth: true; visible: dlg.foot.length === 0 }
- Repeater {
- model: dlg.actions
- delegate: VButton {
- required property var modelData
- text: modelData.label
- iconName: modelData.icon || ""
- primary: modelData.primary === true
- onClicked: dlg.actionTriggered(modelData.label)
- }
- }
- }
- }
- }
-
- DLayer {
+ NetworkSourceDialog {
id: networkDialog
- objectName: "network-dialog"
- key: "network"
- glyph: "cast"
- title: qsTr("播放地址")
- sub: qsTr("直接打开 HTTP、HTTPS 或 RTSP 视频流,例如 IPTV 或摄像机地址")
- dialogWidth: 640
- actions: [{label:qsTr("取消")},{label:qsTr("打开"),primary:true,icon:"play"}]
- onActionTriggered: label => {
- if(label!==qsTr("打开")){host.close();return}
- if(veyra.openNetworkAddress(networkAddress.text))host.close()
- }
- VTextField {
- id: networkAddress
- objectName: "network-address"
- Layout.fillWidth: true
- placeholder: "https://… / rtsp://…"
- }
- Text {
- Layout.fillWidth: true
- text: qsTr("需要直接媒体地址,普通网页或需要网页登录的页面不能直接播放。直播流通常无法拖动进度。")
- wrapMode: Text.Wrap
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 12
- }
+ dialogHost: host
}
// --- 采集卡 -----------------------------------------------------------
@@ -256,2022 +68,67 @@ Item {
// queried asynchronously, only an explicitly chosen audio input is opened,
// and the choice is remembered for "继续上次采集". Resolution, frame rate and
// pixel format are three views of that one saved format key.
- DLayer {
+ CaptureSourceDialog {
id: captureDialog
- objectName: "capture-dialog"
- key: "capture"
- glyph: "video"
- title: qsTr("采集卡")
- sub: qsTr("连接设备后,先关闭增强确认基础画面,再按需开启")
- dialogWidth: 660
- foot: qsTr("关闭其他占用同一采集卡的软件")
- actions: [
- { label: captureDialog.live ? qsTr("断开") : qsTr("取消") },
- { label: qsTr("连接并开始"), primary: true, icon: "play" }
- ]
- onActionTriggered: label => {
- if (label === qsTr("断开")) { veyra.stopPlayback(); return }
- if (label !== qsTr("连接并开始")) { host.close(); return }
- if (veyra.startCaptureSession()) { host.close(); host.startCapture() }
- }
- Connections {
- target: host
- function onDialogChanged() {
- if (host.dialog !== "capture") return
- veyra.refreshCaptureDevices()
- // The PS5 手柄控制 host list is the PS5 dialog's saved pairings.
- if (veyra.ps5Control.available === true) veyra.ps5Load()
- }
- }
- function labelOf(list, id, fallback) { const f = list.find(x => String(x.id) === String(id)); return f ? f.label : fallback }
- readonly property bool live: veyra.captureSignalLevel !== "idle"
- readonly property var pc: veyra.ps5Control
- readonly property bool pcOn: pc.available === true && pc.enabled === true
- readonly property string pcTag: {
- switch (pc.state) {
- case "starting": return qsTr("连接中")
- case "connected": return qsTr("已连接")
- case "recovering": return qsTr("重连中")
- case "pin": return qsTr("需要 PIN")
- case "failed": return qsTr("已停止")
- case "nopair": return qsTr("未配对")
- default: return qsTr("未连接")
- }
- }
- readonly property string pcStatus: {
- switch (pc.state) {
- case "starting": return qsTr("正在连接 PS5…")
- case "connected": return pc.keepaliveFps >= 0 ? qsTr("PS5 手柄控制已连接 · 保活画面 %1 fps(收到即丢弃)").arg(pc.keepaliveFps) : qsTr("PS5 手柄控制已连接")
- case "pin": return qsTr("PS5 要求输入登录 PIN")
- case "recovering": case "failed": case "nopair": return pc.message || ""
- default: return qsTr("采集卡连上后自动连接 PS5")
- }
- }
-
- // dialogs.js .cap-prev: the picture and a signal line under it. The
- // picture is the session's own poster still when the engine made one;
- // there is no periodic frame grab here, because that would sit on the
- // live capture path. The status line is live.
- Rectangle {
- objectName: "capture-preview"
- Layout.fillWidth: true
- Layout.topMargin: 4
- implicitHeight: 180 + 34
- radius: 10
- color: Theme.videoBlack
- border.width: 1
- border.color: Theme.stroke
- clip: true
- Image {
- id: capturePoster
- objectName: "capture-preview-image"
- anchors.left: parent.left; anchors.right: parent.right; anchors.top: parent.top
- anchors.margins: 1
- height: 180
- fillMode: Image.PreserveAspectCrop
- source: captureDialog.live ? veyra.capturePreviewUrl : ""
- visible: status === Image.Ready
- }
- Column {
- anchors.horizontalCenter: parent.horizontalCenter
- y: 90 - height / 2
- spacing: 8
- visible: !capturePoster.visible
- VIcon { anchors.horizontalCenter: parent.horizontalCenter; name: "video"; size: 22; color: Theme.t3 }
- Text {
- text: captureDialog.live ? qsTr("画面在主窗口播放") : qsTr("连接后在主窗口显示画面")
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 12
- }
- }
- RowLayout {
- anchors.left: parent.left; anchors.right: parent.right; anchors.bottom: parent.bottom
- height: 34
- anchors.leftMargin: 10; anchors.rightMargin: 10
- spacing: 8
- VTag {
- objectName: "capture-signal"
- text: veyra.captureSignalText
- kind: veyra.captureSignalLevel === "ok" ? "ok" : veyra.captureSignalLevel === "warn" ? "warn" : ""
- }
- Text {
- Layout.fillWidth: true
- text: captureDialog.live
- ? veyra.sourceSummary.replace("x", "×") + " · " + veyra.captureFps.toFixed(2) + " fps"
- + (veyra.sourceFormatText.split(" · ").length > 2 ? " · " + veyra.sourceFormatText.split(" · ")[1] : "")
- : (veyra.captureFormatLabel.length ? veyra.captureFormatLabel : qsTr("选择设备和格式后连接"))
- color: Theme.t2
- font.family: Theme.fontMono
- font.pixelSize: 11
- elide: Text.ElideRight
- }
- }
- }
-
- DSection { text: qsTr("设备") }
- DGroup {
- VRow {
- label: qsTr("视频输入设备")
- hint: veyra.captureQueryBusy ? qsTr("正在查询…当前播放继续") : (veyra.captureDevices.length === 0 ? qsTr("未检测到采集设备") : "")
- RowLayout {
- spacing: 6
- VSelect {
- objectName: "capture-device"
- implicitWidth: 220
- value: veyra.captureDeviceLabel
- options: veyra.captureDevices
- onPicked: id => veyra.captureDeviceId = id
- }
- // M38: the refresh icon becomes a spinner while the query runs.
- Item {
- implicitWidth: Theme.ctlHeight; implicitHeight: Theme.ctlHeight
- VButton {
- objectName: "capture-refresh"
- anchors.fill: parent
- visible: !veyra.captureQueryBusy
- icon: true; ghost: true; iconName: "refresh"; tip: qsTr("刷新设备")
- onClicked: veyra.refreshCaptureDevices()
- }
- VSpinner { anchors.centerIn: parent; visible: veyra.captureQueryBusy }
- }
- }
- }
- VRow {
- objectName: "capture-legacy-entry"
- label: qsTr("旧版格式选择")
- hint: qsTr("直接查看完整格式列表,包含被常用帧率筛选隐藏的模式")
- VButton {
- objectName: "capture-legacy-open"
- text: qsTr("打开旧版格式列表")
- enabled: !veyra.captureQueryBusy && veyra.captureDeviceId.length > 0
- onClicked: legacyCapturePicker.open()
- }
- }
- VRow {
- label: qsTr("分辨率")
- hint: qsTr("先选择分辨率,再选择该分辨率支持的帧率和像素格式")
- VSelect {
- objectName: "capture-resolution"
- enabled: !veyra.captureQueryBusy
- opacity: enabled ? 1 : 0.5
- implicitWidth: 180
- value: captureDialog.labelOf(veyra.captureResolutionOptions, veyra.captureResolutionId, veyra.captureResolutionOptions.length ? qsTr("请选择分辨率") : "—")
- options: veyra.captureResolutionOptions
- onPicked: id => veyra.captureResolutionId = id
- }
- }
- VRow {
- label: qsTr("自定义分辨率")
- hint: qsTr("仅接受驱动尺寸范围与步进支持的值;连接时核对实际格式")
- RowLayout {
- spacing: 6
- enabled: !veyra.captureQueryBusy && veyra.captureDeviceId.length > 0
- VTextField { id: customCaptureResolution; objectName: "capture-custom-resolution"; implicitWidth: 140; text: "1920x1080" }
- VButton { text: qsTr("检查并选择"); onClicked: veyra.captureResolutionId = customCaptureResolution.text }
- }
- }
- VRow {
- label: qsTr("帧率")
- hint: qsTr("列出离散帧率及驱动范围内的候选;设备帧率填 0 时沿用此选择,连接时验证实际值")
- VSelect {
- objectName: "capture-frame-rate"
- enabled: !veyra.captureQueryBusy && veyra.captureResolutionId.length > 0
- opacity: enabled ? 1 : 0.5
- implicitWidth: 280
- value: captureDialog.labelOf(veyra.captureFrameRateOptions, veyra.captureFrameRateId, veyra.captureFrameRateOptions.length ? qsTr("请选择帧率") : "—")
- options: veyra.captureFrameRateOptions
- onPicked: id => veyra.captureFrameRateId = id
- }
- }
- VRow {
- // Some cards list every rate from 1 to 120 fps (logs(18)). The frame-rate menu
- // shows the common rates the card offers; this lists the rest too.
- objectName: "capture-all-rates-row"
- visible: veyra.captureHiddenFrameRates > 0
- label: qsTr("显示全部可用帧率")
- hint: qsTr("默认只列常用帧率:24、25、30、50、60、100、120、144、165、240(含 59.94 这类非整数帧率)。这张卡另外上报了 %1 个帧率").arg(veyra.captureHiddenFrameRates)
- VSwitch {
- objectName: "capture-all-rates"
- enabled: !veyra.captureQueryBusy
- opacity: enabled ? 1 : 0.35
- checked: veyra.preferences.captureShowAllFrameRates === true
- onToggled: checked => veyra.setPreference("captureShowAllFrameRates", checked)
- }
- }
- VRow {
- label: qsTr("像素格式")
- // Never search veyra.captureFormats here: a card can list 15000+ (logs(18)).
- hint: veyra.captureFormatCostHint ? qsTr("该格式比低延迟格式多一道处理环节,高分辨率/高帧率下建议优先低延迟格式") : qsTr("只列出当前分辨率和帧率下的像素格式")
- VSelect {
- objectName: "capture-format"
- enabled: !veyra.captureQueryBusy && veyra.captureResolutionId.length > 0 && veyra.captureFrameRateId.length > 0
- opacity: enabled ? 1 : 0.5
- implicitWidth: 220
- value: captureDialog.labelOf(veyra.capturePixelOptions, veyra.capturePixelId, veyra.captureResolutionId.length ? qsTr("请选择像素格式") : qsTr("请先选择分辨率"))
- options: veyra.capturePixelOptions
- onPicked: id => veyra.capturePixelId = id
- }
- }
- VRow {
- objectName: "capture-driver-settings-row"
- visible: veyra.captureDeviceId.length > 0
- label: qsTr("驱动设置")
- hint: captureDialog.live ? qsTr("先断开采集,再配置驱动")
- : veyra.captureBlackmagicDevice
- ? (veyra.preferences.blackmagicNativeCapture === true
- ? qsTr("请在设备列表选择对应的 HDMI/SDI 输入口;Driver 保留驱动当前输入。支持自动检测的卡建议选择自动,信号未锁定时会明确提示。")
- : qsTr("Blackmagic 两个条目可能属于同一张卡。DirectShow 黑屏可尝试下方原生采集开关;手动格式须匹配实际信号。"))
- : qsTr("配置驱动公开的输入与视频属性;其他采集应用占用设备时请先关闭")
- RowLayout {
- spacing: 6
- VButton {
- objectName: "capture-driver-properties"
- text: qsTr("设备属性"); ghost: true
- enabled: !veyra.captureQueryBusy && !captureDialog.live && !veyra.liveOpeningText.length
- onClicked: veyra.openCaptureDriverSettings(false)
- }
- VButton {
- objectName: "capture-driver-input"
- visible: veyra.captureBlackmagicDevice
- text: qsTr("输入选择"); ghost: true
- enabled: !veyra.captureQueryBusy && !captureDialog.live && !veyra.liveOpeningText.length
- onClicked: veyra.openCaptureDriverSettings(true)
- }
- }
- }
- VRow {
- objectName: "capture-blackmagic-native-row"
- label: qsTr("Blackmagic 原生采集")
- hint: qsTr("默认关闭。开启使用 DeckLink 原生接口,关闭使用 DirectShow。需安装 Desktop Video 驱动;切换后重新选择设备和格式并连接,不写入驱动永久配置。")
- VSwitch {
- objectName: "capture-blackmagic-native"
- enabled: !veyra.captureQueryBusy && (veyra.captureBlackmagicDevice || veyra.preferences.blackmagicNativeCapture === true)
- opacity: enabled ? 1 : 0.35
- checked: veyra.preferences.blackmagicNativeCapture === true
- onToggled: checked => veyra.setPreference("blackmagicNativeCapture", checked)
- }
- }
- VRow {
- objectName: "capture-magewell-row"
- label: qsTr("美乐威低延迟模式")
- hint: !veyra.captureMagewellDevice
- ? qsTr("仅美乐威 Pro Capture(PCIe 内置卡)可用;USB Capture 系列不支持")
- : (veyra.captureMagewellStatus.length > 0 ? veyra.captureMagewellStatus + " · " : "")
- + qsTr("采集卡收到 64 行就开始传,整帧更早到达(官方:1080p60 约省 5 ms,4K60 约省 15 ms)。开关后点「连接」重新连接生效")
- VSwitch {
- objectName: "capture-magewell"
- enabled: veyra.captureMagewellDevice
- opacity: enabled ? 1 : 0.35
- checked: veyra.captureMagewellDevice && veyra.preferences.magewellLowLatency === true
- onToggled: checked => veyra.setPreference("magewellLowLatency", checked)
- }
- }
- VRow {
- label: qsTr("设备帧率 FPS")
- hint: qsTr("0 = 沿用所选格式;设备返回其他帧率会报错,不在软件中偷偷丢帧")
- VTextField {
- objectName: "capture-fps"
- implicitWidth: 100
- text: String(veyra.captureRequestedFps)
- onEdited: text => veyra.captureRequestedFps = Number(text)
- // Take a valid rate as it is typed. Only a canonical number ("59.94", not
- // "59.") so the field's binding never rewrites what is still being typed.
- onTyped: text => {
- const n = Number(text.trim())
- if (text.trim().length > 0 && String(n) === text.trim() && (n === 0 || (n >= 1 && n <= 1000)))
- veyra.captureRequestedFps = n
- }
- }
- }
- }
- DSection { text: qsTr("音频") }
- DGroup {
- VRow {
- label: qsTr("音频监听")
- hint: qsTr("只连接明确选中的输入,默认不监听")
- VSelect {
- objectName: "capture-audio"
- implicitWidth: 260
- value: captureDialog.labelOf(veyra.captureAudioInputs, veyra.captureAudioChoice, qsTr("不监听音频"))
- options: veyra.captureAudioInputs
- onPicked: id => veyra.captureAudioChoice = Number(id)
- }
- }
- VRow {
- label: qsTr("Dolby / DTS 位流")
- VSeg {
- objectName: "capture-audio-ingress"
- options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: qsTr("强制 PCM") }, { id: "2", label: qsTr("位流优先") }]
- current: String(veyra.captureAudioIngress)
- onPicked: id => veyra.captureAudioIngress = Number(id)
- }
- }
- }
- // PS5 手柄控制: the capture card stays the picture and the sound; PS5 Remote
- // Play only carries the pad (also from a handheld this picture is re-streamed to).
- DSection { visible: captureDialog.pc.available === true; text: qsTr("PS5 手柄控制") }
- DGroup {
- visible: captureDialog.pc.available === true
- VRow {
- label: qsTr("用远程游玩控制 PS5")
- hint: qsTr("画面和声音来自采集卡,手柄经 PS5 远程游玩发给主机。把处理后的画面再串流给掌机或别的电脑时,用那边的手柄玩 PS5")
- VSwitch {
- objectName: "capture-ps5-control"
- checked: captureDialog.pcOn
- onToggled: checked => veyra.ps5ControlSet("enabled", checked)
- }
- }
- VRow {
- visible: captureDialog.pcOn
- label: qsTr("PS5 主机")
- hint: veyra.ps5Profiles.length === 0 ? qsTr("还没有配对的 PS5,先在「PS5 串流」里配对一次") : qsTr("和「PS5 串流」共用配对")
- RowLayout {
- spacing: 6
- VSelect {
- objectName: "capture-ps5-host"
- visible: veyra.ps5Profiles.length > 0
- implicitWidth: 170
- value: { const p = veyra.ps5Profiles.find(x => x.id === veyra.ps5.profile); return p ? p.label : qsTr("请选择") }
- options: veyra.ps5Profiles
- onPicked: id => veyra.ps5SelectProfile(id)
- }
- VTag {
- objectName: "capture-ps5-state"
- Layout.alignment: Qt.AlignVCenter
- text: captureDialog.pcTag
- kind: captureDialog.pc.state === "connected" ? "ok"
- : captureDialog.pc.state === "failed" || captureDialog.pc.state === "nopair" || captureDialog.pc.state === "pin" ? "warn" : ""
- }
- VButton {
- objectName: "capture-ps5-restart"
- visible: captureDialog.pc.state === "failed"
- text: qsTr("重连"); ghost: true
- onClicked: veyra.ps5ControlRestart()
- }
- VButton {
- objectName: "capture-ps5-pair"
- text: veyra.ps5Profiles.length === 0 ? qsTr("去配对") : qsTr("配对…")
- ghost: true
- onClicked: host.open("ps5")
- }
- }
- }
- VRow {
- visible: captureDialog.pcOn && captureDialog.pc.state === "pin"
- label: qsTr("登录 PIN")
- hint: qsTr("PS5 提示时填写,不是 8 位配对码")
- RowLayout {
- spacing: 6
- VTextField { id: controlPin; objectName: "capture-ps5-pin"; implicitWidth: 120 }
- VButton { text: qsTr("提交"); ghost: true; onClicked: { veyra.ps5SendLoginPin(controlPin.text); controlPin.text = "" } }
- }
- }
- VRow {
- visible: captureDialog.pcOn
- label: qsTr("后台也转发手柄")
- hint: qsTr("再串流时建议打开:Veyra 不在前台也继续转发。打开后在这台电脑上用别的程序时,手柄也会操作 PS5")
- VSwitch {
- objectName: "capture-ps5-background"
- checked: captureDialog.pc.background === true
- onToggled: checked => veyra.ps5ControlSet("background", checked)
- }
- }
- VRow {
- visible: captureDialog.pcOn
- label: qsTr("手柄")
- hint: qsTr("谁按键就用谁:本机手柄、串流软件建的虚拟手柄都可以")
- Text {
- objectName: "capture-ps5-pad"
- text: (captureDialog.pc.pad || "").length > 0
- ? captureDialog.pc.pad + " · " + (captureDialog.pc.gyro === true ? qsTr("有陀螺仪") : qsTr("无陀螺仪"))
- : captureDialog.pc.state === "off" || captureDialog.pc.state === "nopair" ? "—" : qsTr("未检测到手柄")
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- elide: Text.ElideRight
- width: Math.min(implicitWidth, 260)
- }
- }
- }
- DNote {
- objectName: "capture-ps5-note"
- visible: captureDialog.pcOn
- text: (captureDialog.pcStatus.length > 0 ? captureDialog.pcStatus + "\n" : "")
- + qsTr("PS5 仍会发一路 720p 30fps、约 5 Mbps 的保活画面,本机收到即丢弃;PS5 同一时间只允许一个远程游玩连接。再串流时记得打开上面的「音频监听」。")
- }
- DSection { text: qsTr("格式与画面") }
- DGroup {
- VRow {
- label: qsTr("输入色彩(SDR / HDR)")
- hint: qsTr("不确定就选「自动」。采集 HDR:采集格式选 P010,这里选「HDR · PQ」(游戏机、显卡的 HDR10 都是 PQ)。「HDR · HLG」用于广播信号。「SDR · 709」是普通画面。变更需重连")
- VSeg {
- objectName: "capture-color-space"
- options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: "HDR · PQ" }, { id: "2", label: "HDR · HLG" }, { id: "3", label: "SDR · 709" }]
- current: String(veyra.captureColorSpace)
- onPicked: id => veyra.captureColorSpace = Number(id)
- }
- }
- VRow {
- label: qsTr("输入范围")
- hint: qsTr("Limited = 16–235,Full = 0–255。画面发灰选「有限」,暗部全黑、亮部过曝选「完全」")
- VSeg {
- objectName: "capture-color-range"
- options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: qsTr("有限 · Limited") }, { id: "2", label: qsTr("完全 · Full") }]
- current: String(veyra.captureColorRange)
- onPicked: id => veyra.captureColorRange = Number(id)
- }
- }
- VRow {
- label: qsTr("设备缓冲")
- hint: qsTr("自动:1080p 及以下 2 帧,更高 3 帧;最小 1 帧延迟最低但可能丢帧")
- VSeg {
- objectName: "capture-buffer-mode"
- options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: qsTr("最小") }, { id: "2", label: qsTr("驱动默认") }]
- current: String(veyra.captureBufferMode)
- onPicked: id => veyra.captureBufferMode = Number(id)
- }
- }
- VRow {
- label: qsTr("转为 SDR 显示")
- hint: qsTr("收到 HDR 也按 SDR 预览,立即生效")
- VSwitch {
- objectName: "capture-force-sdr"
- checked: veyra.captureForceSdr
- onToggled: checked => veyra.captureForceSdr = checked
- }
- }
- VRow {
- label: qsTr("画面上下翻转")
- hint: qsTr("采集画面倒置时开启,立即生效")
- VSwitch {
- objectName: "capture-flip-vertical"
- checked: veyra.captureFlipVertical
- onToggled: checked => veyra.captureFlipVertical = checked
- }
- }
- }
- DNote { visible: veyra.captureStatus.length > 0; text: veyra.captureStatus }
+ dialogHost: host
+ legacyPicker: legacyCapturePicker
}
// --- PS5 串流 ---------------------------------------------------------
// The 1.4.4 Remote Play panel: saved pairings are encrypted in the user's
// %LOCALAPPDATA%\Veyra\remoteplay and shared with 1.4.4.
- DLayer {
+ Ps5SourceDialog {
id: ps5Dialog
- objectName: "ps5-dialog"
- key: "ps5"
- glyph: "gamepad"
- title: qsTr("PS5 串流")
- sub: qsTr("局域网 Remote Play · 凭据加密保存在本机")
- dialogWidth: 680
- actions: [
- { label: veyra.ps5.active ? qsTr("断开") : qsTr("取消") },
- { label: veyra.ps5.active ? qsTr("应用设置并重连") : qsTr("连接"), primary: true }
- ]
- onActionTriggered: label => {
- if (label === qsTr("断开")) { veyra.ps5Cancel(); return }
- if (label === qsTr("取消")) { if (veyra.ps5.busy) veyra.ps5Cancel(); else host.close(); return }
- if (veyra.ps5Connect()) { host.close(); host.startPs5() }
- }
- Connections {
- target: host
- function onDialogChanged() { if (host.dialog === "ps5") veyra.ps5Load() }
- }
- readonly property var qualities: [{ id: "0", label: "720p · 30 fps" }, { id: "1", label: "720p · 60 fps" }, { id: "2", label: "1080p · 30 fps" }, { id: "3", label: "1080p · 60 fps" }]
- readonly property var bitrates: [5, 10, 15, 20, 30, 50, 80, 100].map((m, i) => ({ id: String(i), label: m + " Mbps" }))
-
- DSection { text: qsTr("主机") }
- DGroup {
- VRow {
- visible: veyra.ps5Profiles.length > 0
- label: qsTr("已保存主机")
- VSelect {
- objectName: "ps5-profile"
- implicitWidth: 220
- value: { const p = veyra.ps5Profiles.find(x => x.id === veyra.ps5.profile); return p ? p.label : qsTr("请选择") }
- options: veyra.ps5Profiles
- onPicked: id => veyra.ps5SelectProfile(id)
- }
- }
- VRow {
- label: qsTr("主机地址")
- hint: qsTr("PS5 设置 → 网络 → 连接状态;找不到时可手填 IP")
- RowLayout {
- spacing: 6
- VTextField { objectName: "ps5-host"; implicitWidth: 170; placeholder: "192.168.1.x"; text: veyra.ps5.host || ""; onEdited: text => veyra.ps5Set("host", text) }
- VSpinner { visible: veyra.ps5.busy === true; Layout.alignment: Qt.AlignVCenter }
- VButton { text: qsTr("查找"); ghost: true; enabled: !veyra.ps5.busy; onClicked: veyra.ps5Scan() }
- VButton { text: qsTr("唤醒"); ghost: true; enabled: !veyra.ps5.busy && veyra.ps5.profile.length > 0; onClicked: veyra.ps5Wake() }
- }
- }
- }
- DSection { text: qsTr("配对(首次)") }
- DGroup {
- VRow {
- label: "PSN Account ID"
- hint: qsTr("账号数字 ID 或 8 字节 Base64,不是昵称;登录 PSN 后自动填入")
- VTextField { implicitWidth: 240; text: veyra.ps5.account || ""; onEdited: text => veyra.ps5Set("account", text) }
- }
- VRow {
- label: qsTr("8 位配对码")
- hint: qsTr("PS5 设置 → 系统 → 远程游玩 → 关联设备")
- RowLayout {
- spacing: 6
- VTextField { id: pairPin; implicitWidth: 120; placeholder: "••••••••" }
- VButton { text: qsTr("配对并保存"); enabled: !veyra.ps5.busy; onClicked: { veyra.ps5Pair(pairPin.text); pairPin.text = "" } }
- }
- }
- VRow {
- label: qsTr("删除配对")
- hint: qsTr("只删除本机保存的这台主机;以后需要重新配对")
- VButton { text: qsTr("删除"); ghost: true; enabled: !veyra.ps5.busy && veyra.ps5.profile.length > 0; onClicked: veyra.ps5Forget() }
- }
- }
- DSection { text: qsTr("PSN 账号") }
- DGroup {
- VRow {
- label: veyra.ps5.psnReady ? qsTr("已登录") : qsTr("未登录")
- hint: qsTr("在 Sony 网页登录后复制回调地址再提交;软件不接触密码")
- RowLayout {
- spacing: 6
- VButton { text: qsTr("登录 PSN"); ghost: true; enabled: !veyra.ps5.busy; onClicked: veyra.ps5PsnLogin() }
- VButton { text: qsTr("提交登录结果"); ghost: true; enabled: !veyra.ps5.busy; onClicked: veyra.ps5PsnComplete() }
- VButton { text: qsTr("退出"); ghost: true; enabled: !veyra.ps5.busy && veyra.ps5.psnReady; onClicked: veyra.ps5PsnForget() }
- }
- }
- }
- DSection { text: qsTr("串流(重连生效)") }
- DGroup {
- VRow {
- label: qsTr("分辨率与帧率")
- VSelect { implicitWidth: 170; value: ps5Dialog.qualities[veyra.ps5.quality || 0].label; options: ps5Dialog.qualities; onPicked: id => veyra.ps5Set("quality", Number(id)) }
- }
- VRow {
- label: qsTr("编码")
- hint: qsTr("HDR 需要 PS5 实际输出 HDR 且 Windows HDR 开启")
- VSeg {
- options: [{ id: "0", label: "H.264" }, { id: "1", label: "H.265" }, { id: "2", label: "H.265 HDR" }]
- current: String(veyra.ps5.codec || 0)
- onPicked: id => veyra.ps5Set("codec", Number(id))
- }
- }
- VRow {
- label: qsTr("请求码率")
- hint: qsTr("发给 PS5 的带宽请求,主机不保证达到")
- VSelect { implicitWidth: 130; value: ps5Dialog.bitrates[veyra.ps5.bitrate || 0].label; options: ps5Dialog.bitrates; onPicked: id => veyra.ps5Set("bitrate", Number(id)) }
- }
- VRow {
- label: qsTr("解码")
- VSeg {
- options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: qsTr("CPU 软件") }, { id: "2", label: qsTr("D3D12VA 硬件") }]
- current: String(veyra.ps5.decode || 0)
- onPicked: id => veyra.ps5Set("decode", Number(id))
- }
- }
- VRow {
- label: qsTr("采样")
- hint: qsTr("精细:按位置还原色度,放大用双三次;不是 AI 超分")
- VSeg {
- options: [{ id: "0", label: qsTr("兼容") }, { id: "1", label: qsTr("精细") }]
- current: String(veyra.ps5.sampling === undefined ? 1 : veyra.ps5.sampling)
- onPicked: id => veyra.ps5Set("sampling", Number(id))
- }
- }
- VRow {
- label: qsTr("仅观看")
- hint: qsTr("不向 PS5 转发电脑手柄输入")
- VSwitch { checked: veyra.ps5.viewOnly === true; onToggled: checked => veyra.ps5Set("viewOnly", checked) }
- }
- // The mirror of 仅观看: only the pad, the picture from a capture card.
- VRow {
- visible: veyra.ps5Control.available === true
- label: qsTr("画面用采集卡")
- hint: veyra.ps5Control.enabled === true
- ? qsTr("已在「采集卡」里打开 PS5 手柄控制:连接采集卡时只用远程游玩传手柄")
- : qsTr("PS5 的 HDMI 接了采集卡时,可以只用远程游玩传手柄、画面用采集卡原画(可 4K/HDR),也方便再串流给掌机")
- VButton { objectName: "ps5-open-capture"; text: qsTr("采集卡设置"); ghost: true; onClicked: host.open("capture") }
- }
- VRow {
- label: qsTr("陀螺仪")
- hint: veyra.ps5.controller ? (veyra.ps5.gyro ? qsTr("手柄支持陀螺仪") : qsTr("手柄没有陀螺仪")) : qsTr("连接串流及电脑手柄后可校准")
- VButton { text: veyra.ps5.calibrating ? qsTr("校准中…") : qsTr("校准"); ghost: true; onClicked: veyra.ps5Calibrate() }
- }
- }
- DSection { text: qsTr("登录 PIN") }
- DGroup {
- VRow {
- label: qsTr("PS5 提示时填写")
- hint: qsTr("不是 8 位配对码")
- RowLayout {
- spacing: 6
- VTextField { id: loginPin; implicitWidth: 120 }
- VButton { text: qsTr("提交"); ghost: true; onClicked: { veyra.ps5SendLoginPin(loginPin.text); loginPin.text = "" } }
- }
- }
- }
- DNote { visible: (veyra.ps5.status || "").length > 0; text: (veyra.ps5.busy ? qsTr("处理中 · ") : "") + (veyra.ps5.status || "") }
+ dialogHost: host
}
// --- PC 串流(Sunshine / GameStream) ----------------------------------
// Hosts, pairing, the host's apps and the stream-core settings. The effect chain is not here: once
// connected, the picture goes through the software's own pages like any other source.
- DLayer {
+ PcSourceDialog {
id: mlDialog
- objectName: "moonlight-dialog"
- key: "moonlight"
- glyph: "cast"
- title: qsTr("PC 串流")
- sub: qsTr("串流另一台电脑(Sunshine 主机)· 增强与调色沿用软件自己的处理链")
- dialogWidth: 760
- readonly property var ml: veyra.moonlight
- readonly property var st: ml ? ml.state : ({})
- readonly property var hostList: ml ? ml.hosts : []
- readonly property var appList: ml ? ml.apps : []
- readonly property var cfg: st.settings || ({})
- property int pickedApp: -1
- readonly property int effectiveApp: pickedApp >= 0 ? pickedApp
- : (st.runningApp > 0 ? st.runningApp : (appList.length > 0 ? appList[0].id : -1))
- readonly property bool canStart: !!st.paired && !!st.online && !st.busy && effectiveApp >= 0 && !st.streaming
- actions: st.streaming ? [
- { label: qsTr("关闭") },
- { label: qsTr("断开"), primary: true }
- ] : [
- { label: st.busy ? qsTr("取消操作") : qsTr("关闭") },
- { label: qsTr("开始串流"), primary: true, icon: "play" }
- ]
- onActionTriggered: label => {
- if (label === qsTr("断开")) { veyra.moonlightDisconnect(); host.close(); return }
- if (label === qsTr("取消操作")) { ml.cancel(); return }
- if (label === qsTr("关闭")) { host.close(); return }
- if (canStart) ml.connectStream(effectiveApp)
- }
- Connections {
- target: mlDialog
- function onShownChanged() {
- if (!mlDialog.ml) return
- if (mlDialog.shown) { mlDialog.pickedApp = -1; mlDialog.ml.load() }
- else mlDialog.ml.unload()
- }
- }
- Connections {
- target: mlDialog.ml
- function onStarted() { host.close(); host.startMoonlight() }
- }
- readonly property var resolutions: [
- { id: "720p", label: "720p · 1280×720" }, { id: "1080p", label: "1080p · 1920×1080" },
- { id: "1440p", label: "1440p · 2560×1440" }, { id: "4k", label: "4K · 3840×2160" },
- { id: "native", label: qsTr("本机屏幕分辨率") }]
- readonly property var rates: [30, 60, 90, 120, 144].map(v => ({ id: String(v), label: v + " fps" }))
- function labelOf(list, id, fallback) { const f = list.find(x => String(x.id) === String(id)); return f ? f.label : fallback }
- function stateText(s) {
- return s === "online" ? qsTr("在线") : s === "unpaired" ? qsTr("未配对") : s === "busy" ? qsTr("在线 · 有游戏在运行")
- : s === "checking" ? qsTr("检查中…") : qsTr("离线")
- }
-
- DSection { text: qsTr("主机") }
- DNote {
- visible: mlDialog.hostList.length === 0
- text: qsTr("还没有主机。在要被串流的电脑上安装 Sunshine(官网 app.lizardbyte.dev/Sunshine,软件不自带),")
- + qsTr("两台电脑接在同一个局域网,这里会自动出现;也可以在下面手填它的 IP。首次使用需要配对。")
- }
- Repeater {
- model: mlDialog.hostList
- delegate: Rectangle {
- id: hostRow
- required property var modelData
- Layout.fillWidth: true
- Layout.topMargin: 6
- implicitHeight: 54
- radius: 11
- color: modelData.selected ? Theme.accentSoft : (hostHover.hovered ? Theme.card3 : Theme.card2)
- border.width: 1
- border.color: modelData.selected ? Theme.accent : Theme.stroke
- objectName: "moonlight-host-" + modelData.id
- HoverHandler { id: hostHover; cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: mlDialog.ml.select(hostRow.modelData.id) }
- RowLayout {
- anchors.fill: parent
- anchors.leftMargin: 14
- anchors.rightMargin: 10
- spacing: 12
- VDot {
- warn: hostRow.modelData.state === "unpaired"
- off: hostRow.modelData.state === "offline" || hostRow.modelData.state === "checking"
- Layout.alignment: Qt.AlignVCenter
- }
- ColumnLayout {
- Layout.fillWidth: true
- spacing: 1
- Text {
- Layout.fillWidth: true
- text: hostRow.modelData.name
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- font.weight: Font.Medium
- elide: Text.ElideRight
- }
- Text {
- Layout.fillWidth: true
- text: hostRow.modelData.address + " · " + mlDialog.stateText(hostRow.modelData.state)
- + (hostRow.modelData.gpu.length > 0 ? " · " + hostRow.modelData.gpu : "")
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- elide: Text.ElideRight
- }
- }
- VTag { visible: hostRow.modelData.paired; text: qsTr("已配对"); kind: "ok" }
- VButton {
- visible: !hostRow.modelData.paired && hostRow.modelData.state !== "offline"
- objectName: "moonlight-pair-" + hostRow.modelData.id
- text: qsTr("配对")
- primary: true
- enabled: !mlDialog.st.busy
- onClicked: mlDialog.ml.pair(hostRow.modelData.id)
- }
- VButton {
- text: qsTr("删除")
- ghost: true
- enabled: !mlDialog.st.busy
- onClicked: mlDialog.ml.forget(hostRow.modelData.id)
- }
- }
- }
- }
- DGroup {
- VRow {
- label: qsTr("手动添加")
- hint: qsTr("IP 或主机名,端口不是 47989 时写成 192.168.1.20:47989")
- RowLayout {
- spacing: 6
- VTextField { id: mlAddress; objectName: "moonlight-address"; implicitWidth: 190; placeholder: "192.168.1.x"; onEdited: text => { if (text.length > 0) { mlDialog.ml.addHost(text); mlAddress.text = "" } } }
- VSpinner { visible: mlDialog.st.busy === true; Layout.alignment: Qt.AlignVCenter }
- VButton { text: qsTr("添加"); ghost: true; enabled: !mlDialog.st.busy && mlAddress.text.length > 0; onClicked: { mlDialog.ml.addHost(mlAddress.text); mlAddress.text = "" } }
- VButton { text: qsTr("刷新"); ghost: true; enabled: !mlDialog.st.busy; onClicked: mlDialog.ml.refresh() }
- }
- }
- }
- // The PIN the user types into the host's Sunshine page.
- Rectangle {
- visible: mlDialog.st.pairing === true
- objectName: "moonlight-pin-box"
- Layout.fillWidth: true
- Layout.topMargin: 8
- implicitHeight: pinCol.implicitHeight + 28
- radius: 11
- color: Theme.accentSoft
- border.width: 1
- border.color: Theme.accent
- ColumnLayout {
- id: pinCol
- anchors.fill: parent
- anchors.margins: 14
- spacing: 6
- Text {
- Layout.fillWidth: true
- text: qsTr("在主机上打开 Sunshine 网页(https://主机IP:47990),进入「PIN」页,输入下面的数字并提交:")
- color: Theme.t2
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- wrapMode: Text.WordWrap
- }
- Text {
- objectName: "moonlight-pin"
- Layout.alignment: Qt.AlignHCenter
- text: mlDialog.st.pin || ""
- color: Theme.t1
- font.family: Theme.fontMono
- font.pixelSize: 34
- font.letterSpacing: 10
- }
- }
- }
-
- DSection { visible: !!mlDialog.st.paired; text: qsTr("游戏与程序 · ") + (mlDialog.st.hostName || "") }
- DNote {
- visible: !!mlDialog.st.selected && !mlDialog.st.paired && !mlDialog.st.pairing
- text: qsTr("这台主机还没有和本机配对。点「配对」,在主机的 Sunshine 网页里输入软件给出的 PIN。")
- }
- DNote {
- visible: !!mlDialog.st.paired && !mlDialog.st.online
- text: qsTr("主机现在连不上(离线、休眠,或地址变了)。开机后点「刷新」。")
- }
- Flow {
- visible: !!mlDialog.st.paired && !!mlDialog.st.online
- Layout.fillWidth: true
- spacing: 8
- Repeater {
- model: mlDialog.appList
- delegate: Rectangle {
- id: appCard
- required property var modelData
- readonly property bool picked: mlDialog.effectiveApp === modelData.id
- objectName: "moonlight-app-" + modelData.id
- width: 168
- height: 64
- radius: 11
- color: picked ? Theme.accentSoft : (appHover.hovered ? Theme.card3 : Theme.card2)
- border.width: 1
- border.color: picked ? Theme.accent : Theme.stroke
- HoverHandler { id: appHover; cursorShape: Qt.PointingHandCursor }
- TapHandler {
- onTapped: mlDialog.pickedApp = appCard.modelData.id
- onDoubleTapped: { mlDialog.pickedApp = appCard.modelData.id; if (mlDialog.canStart) mlDialog.ml.connectStream(appCard.modelData.id) }
- }
- ColumnLayout {
- anchors.fill: parent
- anchors.margins: 11
- spacing: 4
- Text {
- Layout.fillWidth: true
- text: appCard.modelData.name
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- font.weight: Font.Medium
- elide: Text.ElideRight
- }
- RowLayout {
- spacing: 6
- VTag { visible: appCard.modelData.running; text: qsTr("运行中"); kind: "acc" }
- VTag { visible: appCard.modelData.hdr; text: "HDR" }
- }
- }
- }
- }
- }
- RowLayout {
- visible: !!mlDialog.st.paired && !!mlDialog.st.online && mlDialog.st.runningApp > 0
- Layout.fillWidth: true
- Layout.topMargin: 8
- spacing: 8
- Text {
- Layout.fillWidth: true
- text: qsTr("主机上有游戏在运行。断开串流不会结束它;选它并开始即可继续。")
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- wrapMode: Text.WordWrap
- }
- VButton { objectName: "moonlight-quit-app"; text: qsTr("退出游戏"); ghost: true; enabled: !mlDialog.st.busy; onClicked: mlDialog.ml.quitApp() }
- }
-
- DSection { text: qsTr("串流设置(只影响串流本身,按主机保存)") }
- DGroup {
- VRow {
- label: qsTr("分辨率")
- hint: qsTr("主机按这个尺寸编码;软件的超分与增强在收到之后再做")
- VSelect { objectName: "moonlight-res"; implicitWidth: 190; value: mlDialog.labelOf(mlDialog.resolutions, mlDialog.cfg.res, "1080p · 1920×1080"); options: mlDialog.resolutions; onPicked: id => mlDialog.ml.set("res", id) }
- }
- VRow {
- label: qsTr("帧率")
- VSelect { objectName: "moonlight-fps"; implicitWidth: 130; value: (mlDialog.cfg.fps || 60) + " fps"; options: mlDialog.rates; onPicked: id => mlDialog.ml.set("fps", Number(id)) }
- }
- VRow {
- label: qsTr("码率")
- hint: qsTr("默认 150 Mbps;有线千兆可以拉到 300–500,无线卡顿时调低。主机画面简单时实际码率会低于这里的上限")
- RowLayout {
- spacing: 10
- VSlider {
- id: bitrateSlider
- objectName: "moonlight-bitrate"
- implicitWidth: 170
- from: 5; to: 500
- live: false
- value: mlDialog.cfg.bitrate || 150
- onMoved: v => mlDialog.ml.set("bitrate", Math.max(5, Math.round(v / 5) * 5))
- }
- VSliderValue {
- Layout.preferredWidth: 72
- slider: bitrateSlider
- horizontalAlignment: Text.AlignLeft
- text: Math.max(5, Math.round((bitrateSlider.dragging ? bitrateSlider.dragValue : bitrateSlider.value) / 5) * 5) + " Mbps"
- }
- }
- }
- VRow {
- label: qsTr("编码")
- hint: mlDialog.cfg.codec === 3 ? qsTr("AV1 需要主机显卡能编码、本机显卡能解码") : qsTr("自动:优先 HEVC,主机不支持时用 H.264")
- VSeg {
- objectName: "moonlight-codec"
- options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: "H.264" }, { id: "2", label: "HEVC" }, { id: "3", label: "AV1" }]
- current: String(mlDialog.cfg.codec || 0)
- onPicked: id => mlDialog.ml.set("codec", Number(id))
- }
- }
- VRow {
- label: "HDR"
- hint: mlDialog.st.hdrHost ? qsTr("需要主机显示器开启 HDR,且编码选 HEVC 或 AV1;本机需要硬件解码") : qsTr("这台主机没有报告 10 位编码能力")
- VSwitch { objectName: "moonlight-hdr"; enabled: !!mlDialog.st.hdrHost || mlDialog.cfg.hdr === true; checked: mlDialog.cfg.hdr === true; onToggled: checked => mlDialog.ml.set("hdr", checked) }
- }
- VRow {
- label: qsTr("声道")
- VSeg {
- objectName: "moonlight-audio"
- options: [{ id: "2", label: qsTr("立体声") }, { id: "6", label: "5.1" }, { id: "8", label: "7.1" }]
- current: String(mlDialog.cfg.audio || 2)
- onPicked: id => mlDialog.ml.set("audio", Number(id))
- }
- }
- VRow {
- label: qsTr("手柄")
- hint: qsTr("把电脑手柄当作主机上的 Xbox 手柄(1 号)")
- VSwitch { objectName: "moonlight-gamepad"; checked: mlDialog.cfg.gamepad !== false; onToggled: checked => mlDialog.ml.set("gamepad", checked) }
- }
- VRow {
- label: qsTr("自动捕获键盘鼠标")
- hint: qsTr("开始后键鼠交给主机;Ctrl+Alt+Shift+Z 释放,+Q 断开,+S 统计")
- VSwitch { objectName: "moonlight-capture"; checked: mlDialog.cfg.captureInput !== false; onToggled: checked => mlDialog.ml.set("captureInput", checked) }
- }
- VRow {
- label: qsTr("让主机切换到串流分辨率")
- hint: qsTr("关闭时主机保持自己的分辨率,画面由主机缩放")
- VSwitch { objectName: "moonlight-sops"; checked: mlDialog.cfg.sops === true; onToggled: checked => mlDialog.ml.set("sops", checked) }
- }
- VRow {
- label: qsTr("主机同时出声")
- hint: qsTr("默认只在本机出声")
- VSwitch { objectName: "moonlight-hostaudio"; checked: mlDialog.cfg.hostAudio === true; onToggled: checked => mlDialog.ml.set("hostAudio", checked) }
- }
- }
- DNote { objectName: "moonlight-status"; visible: (mlDialog.st.status || "").length > 0; text: (mlDialog.st.busy ? qsTr("处理中 · ") : "") + (mlDialog.st.status || "") }
+ dialogHost: host
}
// --- Xbox 串流(非官方) ---------------------------------------------------
// Sign in with the Xbox (Microsoft) account on Microsoft's own page via a device code, pick a console,
// start. The software never sees the password; only a refresh token is kept, encrypted for this user.
- DLayer {
+ XboxSourceDialog {
id: xbDialog
- objectName: "xbox-dialog"
- key: "xbox"
- glyph: "gamepad"
- title: qsTr("Xbox 串流")
- sub: qsTr("串流你自己的 Xbox 主机 · 非官方实验功能 · 增强与调色沿用软件自己的处理链")
- dialogWidth: 680
- readonly property var xb: veyra.xbox
- readonly property var st: xb ? xb.state : ({})
- readonly property var list: xb ? xb.consoles : []
- actions: st.streaming ? [
- { label: qsTr("关闭") },
- { label: qsTr("断开"), primary: true }
- ] : !st.signedIn ? [
- { label: st.busy ? qsTr("取消操作") : qsTr("关闭") }
- ] : [
- { label: st.busy ? qsTr("取消操作") : qsTr("关闭") },
- { label: qsTr("开始串流"), primary: true, icon: "play" }
- ]
- onActionTriggered: label => {
- if (label === qsTr("断开")) { veyra.xboxDisconnect(); host.close(); return }
- if (label === qsTr("取消操作")) { xb.cancel(); return }
- if (label === qsTr("关闭")) { host.close(); return }
- if (st.signedIn && !st.busy && (st.selected || "").length > 0) xb.connectStream()
- }
- Connections {
- target: xbDialog
- function onShownChanged() { if (xbDialog.shown && xbDialog.xb) xbDialog.xb.load() }
- }
- Connections {
- target: xbDialog.xb
- function onStarted() { host.close(); host.startXbox() }
- }
-
- DNote {
- text: qsTr("非官方:使用与 Greenlight 等开源客户端相同的方式连接微软的串流服务,不隶属于微软,微软随时可能改动导致失效。仅限你自己的账号和主机。")
- }
- DSection { text: qsTr("账号") }
- DGroup {
- VRow {
- label: xbDialog.st.signedIn ? qsTr("已登录") : qsTr("未登录")
- hint: xbDialog.st.signedIn ? qsTr("登录信息加密保存在本机;退出会删除它") : qsTr("用你的 Xbox(微软)账号在微软的页面登录,软件看不到密码")
- RowLayout {
- spacing: 6
- VSpinner { visible: xbDialog.st.busy === true; Layout.alignment: Qt.AlignVCenter }
- VButton { objectName: "xbox-signin"; visible: !xbDialog.st.signedIn; text: qsTr("登录"); primary: true; enabled: !xbDialog.st.busy; onClicked: xbDialog.xb.signIn() }
- VButton { visible: xbDialog.st.signedIn; text: qsTr("退出登录"); ghost: true; enabled: !xbDialog.st.busy; onClicked: xbDialog.xb.signOut() }
- }
- }
- }
- // The device code, large, with the page to type it into.
- Rectangle {
- visible: (xbDialog.st.code || "").length > 0
- objectName: "xbox-code-box"
- Layout.fillWidth: true
- Layout.topMargin: 8
- implicitHeight: codeCol.implicitHeight + 28
- radius: 11
- color: Theme.accentSoft
- border.width: 1
- border.color: Theme.accent
- ColumnLayout {
- id: codeCol
- anchors.fill: parent
- anchors.margins: 14
- spacing: 8
- Text {
- Layout.fillWidth: true
- text: qsTr("在手机或浏览器打开 ") + (xbDialog.st.verificationUri || "https://www.microsoft.com/link") + qsTr(",输入下面的登录码:")
- color: Theme.t2
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- wrapMode: Text.WordWrap
- }
- Text {
- objectName: "xbox-code"
- Layout.alignment: Qt.AlignHCenter
- text: xbDialog.st.code || ""
- color: Theme.t1
- font.family: Theme.fontMono
- font.pixelSize: 30
- font.letterSpacing: 4
- }
- VButton { Layout.alignment: Qt.AlignHCenter; text: qsTr("在浏览器打开登录页"); ghost: true; onClicked: xbDialog.xb.openSignInPage() }
- }
- }
-
- DSection { visible: !!xbDialog.st.signedIn; text: qsTr("主机") }
- Repeater {
- model: xbDialog.st.signedIn ? xbDialog.list : []
- delegate: Rectangle {
- id: consoleRow
- required property var modelData
- readonly property bool picked: xbDialog.st.selected === modelData.id
- objectName: "xbox-console-" + modelData.id
- Layout.fillWidth: true
- Layout.topMargin: 6
- implicitHeight: 54
- radius: 11
- color: picked ? Theme.accentSoft : (consoleHover.hovered ? Theme.card3 : Theme.card2)
- border.width: 1
- border.color: picked ? Theme.accent : Theme.stroke
- HoverHandler { id: consoleHover; cursorShape: Qt.PointingHandCursor }
- TapHandler {
- onTapped: xbDialog.xb.select(consoleRow.modelData.id)
- onDoubleTapped: { xbDialog.xb.select(consoleRow.modelData.id); if (!xbDialog.st.busy) xbDialog.xb.connectStream() }
- }
- RowLayout {
- anchors.fill: parent
- anchors.leftMargin: 14
- anchors.rightMargin: 12
- spacing: 12
- VDot { off: consoleRow.modelData.power === qsTr("关机"); warn: consoleRow.modelData.power === qsTr("正在更新"); Layout.alignment: Qt.AlignVCenter }
- ColumnLayout {
- Layout.fillWidth: true
- spacing: 1
- Text { Layout.fillWidth: true; text: consoleRow.modelData.name; color: Theme.t1; font.family: Theme.fontUi; font.pixelSize: Theme.fsBody; font.weight: Font.Medium; elide: Text.ElideRight }
- Text { Layout.fillWidth: true; text: consoleRow.modelData.type + " · " + consoleRow.modelData.power; color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: Theme.fsSmall; elide: Text.ElideRight }
- }
- }
- }
- }
- DGroup {
- visible: !!xbDialog.st.signedIn
- VRow {
- label: qsTr("主机列表")
- hint: qsTr("主机要用同一个账号登录,并在 设置 → 设备和连接 → 远程功能 里启用远程功能")
- VButton { text: qsTr("刷新"); ghost: true; enabled: !xbDialog.st.busy; onClicked: xbDialog.xb.refresh() }
- }
- VRow {
- label: qsTr("手柄")
- hint: qsTr("把电脑手柄当作主机上的手柄")
- VSwitch { objectName: "xbox-gamepad"; checked: xbDialog.st.gamepad !== false; onToggled: checked => xbDialog.xb.set("gamepad", checked) }
- }
- }
- DNote { objectName: "xbox-status"; visible: (xbDialog.st.status || "").length > 0; text: (xbDialog.st.busy ? qsTr("处理中 · ") : "") + (xbDialog.st.status || "") }
+ dialogHost: host
}
// --- 屏幕捕获 ---------------------------------------------------------
- DLayer {
+ ScreenSourceDialog {
id: screenDialog
- objectName: "screen-dialog"
- key: "screen"
- glyph: "monitor"
- title: qsTr("屏幕捕获")
- sub: qsTr("把一个窗口或整块显示器作为片源")
- dialogWidth: 700
- actions: [
- { label: qsTr("取消") },
- { label: qsTr("开始捕获"), primary: true }
- ]
- onActionTriggered: label => {
- if (label !== qsTr("开始捕获")) { host.close(); return }
- if (veyra.startScreenCapture()) { host.close(); host.startScreen() }
- }
- Connections {
- target: host
- function onDialogChanged() { if (host.dialog === "screen") veyra.refreshCaptureTargets() }
- }
- readonly property var o: veyra.screenOptions
-
- DSection { text: qsTr("目标") }
- DGroup {
- VRow {
- label: qsTr("类型")
- VSeg {
- objectName: "screen-kind"
- options: [{ id: "0", label: qsTr("窗口") }, { id: "1", label: qsTr("显示器") }]
- current: String(screenDialog.o.kind)
- onPicked: id => veyra.setScreenOption("kind", Number(id))
- }
- }
- VRow {
- label: qsTr("捕获目标")
- hint: veyra.screenTargets.length === 0 ? qsTr("未找到可捕获的窗口或显示器") : ""
- RowLayout {
- spacing: 6
- VSelect {
- objectName: "screen-target"
- implicitWidth: 300
- value: veyra.screenTargetLabel
- options: veyra.screenTargets
- onPicked: id => veyra.screenTargetId = id
- }
- VButton { text: qsTr("刷新"); ghost: true; onClicked: veyra.refreshCaptureTargets() }
- }
- }
- }
- DSection { text: qsTr("游戏") }
- DGroup {
- VRow {
- label: qsTr("游戏模式")
- hint: screenDialog.o.kind === 1
- ? qsTr("开始后 Veyra 在这块屏幕上全屏,键鼠和手柄直接操作屏幕上的程序;%1 调整画面,%2 退出").arg(veyra.shortcuts.gamePanel).arg(veyra.shortcuts.gameExit)
- : qsTr("贴合原窗口时可精确穿透鼠标;填满或拉伸支持键盘和手柄,鼠标点击会被拦截以免错位。%1 调整画面,%2 退出;独占全屏请改为无边框窗口").arg(veyra.shortcuts.gamePanel).arg(veyra.shortcuts.gameExit)
- VSwitch {
- objectName: "screen-game-mode"
- checked: screenDialog.o.passthrough === true
- onToggled: checked => veyra.setScreenOption("passthrough", checked)
- }
- }
- }
- DSection { text: qsTr("采集") }
- DGroup {
- VRow {
- label: qsTr("采集方式")
- hint: screenDialog.o.kind === 1 ? qsTr("DXGI 为显示器兼容方式,无鼠标指针;捕获显示器时不显示黄色边框,Veyra 自己也不会出现在截图和录屏里") : qsTr("窗口只能用 Windows Graphics Capture")
- VSeg {
- enabled: screenDialog.o.kind === 1
- opacity: enabled ? 1 : 0.5
- options: [{ id: "0", label: "WGC" }, { id: "1", label: "DXGI" }]
- current: String(screenDialog.o.method)
- onPicked: id => veyra.setScreenOption("method", Number(id))
- }
- }
- VRow {
- label: qsTr("帧率上限")
- hint: qsTr("如果要开启 DLSS5(NR),建议帧率设置 60,减少 DLSS5 需要处理的画面量,减轻负担")
- hintColor: Theme.err
- hintBelow: true
- VSeg {
- options: [{ id: "0", label: qsTr("跟随") }, { id: "1", label: "30" }, { id: "2", label: "60" }, { id: "3", label: "120" }, { id: "4", label: "144" }, { id: "5", label: "240" }]
- current: String(screenDialog.o.fps)
- onPicked: id => veyra.setScreenOption("fps", Number(id))
- }
- }
- VRow {
- label: qsTr("显示鼠标指针")
- hint: screenDialog.o.passthrough === true ? qsTr("游戏模式用真实指针,画面里不再画一个") : ""
- VSwitch {
- enabled: screenDialog.o.method === 0 && screenDialog.o.passthrough !== true
- opacity: enabled ? 1 : 0.5
- checked: screenDialog.o.cursor === true && screenDialog.o.passthrough !== true
- onToggled: checked => veyra.setScreenOption("cursor", checked)
- }
- }
- VRow {
- label: qsTr("裁剪(像素)")
- hint: screenDialog.o.passthrough === true ? qsTr("游戏模式不裁剪;贴合原窗口时画面与鼠标位置一一对应") : qsTr("左 / 上 / 右 / 下,按源像素")
- RowLayout {
- spacing: 4
- enabled: screenDialog.o.passthrough !== true
- opacity: enabled ? 1 : 0.5
- Repeater {
- model: ["left", "top", "right", "bottom"]
- delegate: VTextField {
- required property string modelData
- implicitWidth: 58
- text: String(screenDialog.o[modelData])
- onEdited: text => veyra.setScreenOption(modelData, Number(text))
- }
- }
- }
- }
- VRow {
- label: qsTr("画面")
- hint: screenDialog.o.passthrough === true ? qsTr("填满屏幕支持键盘和手柄;需要精确鼠标穿透时请选择贴合原窗口") : ""
- VSeg {
- options: [{ id: "fit", label: screenDialog.o.passthrough === true ? qsTr("贴合原窗口") : qsTr("适应窗口") },
- { id: "fill", label: screenDialog.o.passthrough === true ? qsTr("填满屏幕") : qsTr("填满窗口") }]
- current: screenDialog.o.fill ? "fill" : "fit"
- onPicked: id => veyra.setScreenOption("fill", id === "fill")
- }
- }
- }
+ dialogHost: host
}
// --- 字幕设置 ---------------------------------------------------------
- DLayer {
+ SubtitleSettingsDialog {
id: subtitleDialog
- objectName: "subtitle-dialog"
- key: "subtitle"
- glyph: "type"
- title: qsTr("字幕设置")
- sub: qsTr("实时预览,设置对所有文件生效")
- dialogWidth: 620
- actions: [{ label: qsTr("恢复默认") }, { label: qsTr("完成"), primary: true }]
- onActionTriggered: label => {
- if (label !== qsTr("恢复默认")) { host.close(); return }
- // The look only: tracks and the timing offset belong to the file.
- const defaults = { subtitleEnabled: true, subtitleSize: 22, subtitleFont: 0, subtitleOutline: 2,
- subtitleBackground: false, subtitleMargin: 0, subtitleFit: false, subtitleLines: 2 }
- for (const key in defaults) veyra.setPreference(key, defaults[key])
- veyra.logUi("ui-subtitle", "style reset to defaults")
- }
-
- readonly property var prefs: veyra.preferences
- function pref(key, fallback) { return prefs[key] !== undefined ? prefs[key] : fallback }
- readonly property var trackOptions: [{ id: "-1", label: qsTr("关闭", "off") }]
- .concat(veyra.subtitleTracks.map(t => ({ id: String(t.index), label: t.label + " · " + t.note, disabled: !t.usable })))
- function trackLabel(index) {
- const t = veyra.subtitleTracks.find(x => x.index === index)
- return t ? t.label : qsTr("关闭", "off")
- }
-
- // dialogs.js .sub-prev: a sample line over the picture, drawn with the
- // current style so every change shows at once.
- Rectangle {
- id: subPreview
- objectName: "subtitle-preview"
- Layout.fillWidth: true
- Layout.topMargin: 4
- implicitHeight: 180
- radius: 10
- border.width: 1
- border.color: Theme.stroke
- clip: true
- gradient: Gradient {
- GradientStop { position: 0; color: "#1B2230" }
- GradientStop { position: 1; color: "#0B0C10" }
- }
- readonly property real scaleFactor: height / 540
- Image {
- anchors.fill: parent
- anchors.margins: 1
- fillMode: Image.PreserveAspectCrop
- asynchronous: true
- visible: status === Image.Ready
- source: subtitleDialog.shown && veyra.hasSource && !veyra.isCapture && veyra.duration > 0
- ? "image://veyra-thumb/" + veyra.thumbnailGeneration + "/" + Math.floor(veyra.position / 2) * 2000 : ""
- }
- Column {
- objectName: "subtitle-preview-lines"
- visible: subtitleDialog.pref("subtitleEnabled", true)
- anchors.horizontalCenter: parent.horizontalCenter
- anchors.bottom: parent.bottom
- anchors.bottomMargin: 12 + subtitleDialog.pref("subtitleMargin", 0) * subPreview.scaleFactor
- spacing: 2
- Repeater {
- model: veyra.subtitleText.length > 0 ? veyra.subtitleText.split("\n").slice(0, 2)
- : [qsTr("这是字幕预览,"), qsTr("改动会实时显示在这里。")]
- delegate: Rectangle {
- required property string modelData
- anchors.horizontalCenter: parent.horizontalCenter
- width: line.implicitWidth + 16
- height: line.implicitHeight + 2
- radius: 4
- color: subtitleDialog.pref("subtitleBackground", false) ? Qt.rgba(0, 0, 0, 0.6) : "transparent"
- Text {
- id: line
- anchors.centerIn: parent
- text: modelData
- color: "#FFFFFF"
- readonly property var families: ["", "SimHei", "SimSun", "DengXian", "Arial", "Segoe UI"]
- font.family: families[subtitleDialog.pref("subtitleFont", 0)] || Theme.fontUi
- font.pixelSize: Math.max(12, subtitleDialog.pref("subtitleSize", 22) * 0.8)
- font.weight: Font.DemiBold
- style: subtitleDialog.pref("subtitleOutline", 2) > 0 ? Text.Outline : Text.Normal
- styleColor: Qt.rgba(0, 0, 0, subtitleDialog.pref("subtitleOutline", 2) >= 3 ? 1 : 0.85)
- }
- }
- }
- }
- }
-
- DSection { text: qsTr("字幕轨") }
- DGroup {
- VRow {
- label: qsTr("主字幕")
- hint: veyra.subtitleTracks.length === 0 ? (veyra.subtitleStatus.length > 0 ? veyra.subtitleStatus : (veyra.hasSource ? qsTr("当前片源没有字幕") : qsTr("打开视频后显示可用字幕"))) : ""
- VSelect {
- objectName: "subtitle-primary"
- implicitWidth: 220
- value: subtitleDialog.trackLabel(veyra.subtitlePrimary)
- options: subtitleDialog.trackOptions
- onPicked: id => veyra.subtitlePrimary = Number(id)
- }
- }
- VRow {
- label: qsTr("副字幕(双语)")
- hint: qsTr("显示在主字幕上方")
- VSelect {
- objectName: "subtitle-secondary"
- implicitWidth: 220
- value: subtitleDialog.trackLabel(veyra.subtitleSecondary)
- options: subtitleDialog.trackOptions
- onPicked: id => veyra.subtitleSecondary = Number(id)
- }
- }
- VRow {
- label: qsTr("外挂字幕")
- hint: qsTr("文本字幕 · PGS/SUP · VobSub(IDX+SUB)")
- VButton { objectName: "subtitle-load"; text: qsTr("加载文件…"); onClicked: veyra.loadSubtitleDialog() }
- }
- VRow {
- label: qsTr("默认显示副字幕")
- hint: qsTr("打开新文件时自动选第二条可用字幕")
- VSwitch {
- checked: subtitleDialog.pref("subtitleSecondLanguage", false)
- onToggled: checked => veyra.setPreference("subtitleSecondLanguage", checked)
- }
- }
- }
- DSection { text: qsTr("时间") }
- DGroup {
- VRow {
- label: qsTr("主字幕延时")
- hint: qsTr("Z / X 微调 50 ms,Shift 为 1 s;正值 = 字幕推后")
- // .stepper: − value +, 50 ms a step; the value can be typed.
- RowLayout {
- objectName: "subtitle-delay-stepper"
- spacing: 4
- VButton { objectName: "subtitle-delay-minus"; icon: true; iconName: "minus"; implicitWidth: 28; implicitHeight: 28; onClicked: veyra.nudgeSubtitle(-50) }
- VTextField {
- objectName: "subtitle-delay-value"
- implicitWidth: 86
- text: veyra.subtitleOffsetMs + " ms"
- onEdited: text => { const v = parseInt(text); if (isFinite(v)) veyra.subtitleOffsetMs = v }
- }
- VButton { objectName: "subtitle-delay-plus"; icon: true; iconName: "plus"; implicitWidth: 28; implicitHeight: 28; onClicked: veyra.nudgeSubtitle(50) }
- }
- }
- VRow {
- label: qsTr("按音轨自动对齐")
- hint: veyra.subtitleStatus.length > 0 ? veyra.subtitleStatus : qsTr("分析前 30 分钟的人声与字幕时间")
- VButton {
- text: veyra.subtitleAligning ? qsTr("分析中…") : qsTr("自动对齐")
- enabled: !veyra.subtitleAligning && veyra.subtitlePrimary >= 0
- onClicked: veyra.autoAlignSubtitle()
- }
- }
- }
- DSection { text: qsTr("样式") }
- DGroup {
- VRow {
- label: qsTr("显示字幕")
- hint: qsTr("快捷键 B")
- VSwitch {
- objectName: "subtitle-enabled"
- checked: subtitleDialog.pref("subtitleEnabled", true)
- onToggled: checked => veyra.setPreference("subtitleEnabled", checked)
- }
- }
- VRow {
- label: qsTr("字号")
- value: subtitleDialog.pref("subtitleSize", 22) + " px"
- VSlider {
- objectName: "subtitle-size"
- implicitWidth: 170
- from: 16; to: 56; value: subtitleDialog.pref("subtitleSize", 22)
- onMoved: veyra.setPreference("subtitleSize", Math.round(value))
- }
- }
- VRow {
- label: qsTr("字体")
- VSelect {
- objectName: "subtitle-font"
- implicitWidth: 170
- readonly property var names: [qsTr("字幕原字体"), qsTr("黑体"), qsTr("宋体"), qsTr("等线"), "Arial", "Segoe UI"]
- value: names[subtitleDialog.pref("subtitleFont", 0)]
- options: names.map((n, i) => ({ id: String(i), label: n }))
- onPicked: id => veyra.setPreference("subtitleFont", Number(id))
- }
- }
- VRow {
- label: qsTr("描边")
- VSeg {
- objectName: "subtitle-outline"
- options: [{ id: "0", label: qsTr("无") }, { id: "1", label: qsTr("细") }, { id: "2", label: qsTr("标准") }, { id: "3", label: qsTr("粗") }]
- current: String(subtitleDialog.pref("subtitleOutline", 2))
- onPicked: id => veyra.setPreference("subtitleOutline", Number(id))
- }
- }
- VRow {
- label: qsTr("背景条")
- VSwitch {
- checked: subtitleDialog.pref("subtitleBackground", false)
- onToggled: checked => veyra.setPreference("subtitleBackground", checked)
- }
- }
- VRow {
- label: qsTr("底部距离")
- value: subtitleDialog.pref("subtitleMargin", 0) + " px"
- VSlider {
- objectName: "subtitle-margin"
- implicitWidth: 170
- from: 0; to: 240; value: subtitleDialog.pref("subtitleMargin", 0)
- onMoved: veyra.setPreference("subtitleMargin", Math.round(value))
- }
- }
- VRow {
- label: qsTr("长句自动缩小")
- hint: qsTr("默认保持字号;开启后超过目标行数才缩小")
- VSwitch {
- checked: subtitleDialog.pref("subtitleFit", false)
- onToggled: checked => veyra.setPreference("subtitleFit", checked)
- }
- }
- VRow {
- visible: subtitleDialog.pref("subtitleFit", false)
- label: qsTr("目标行数")
- value: String(subtitleDialog.pref("subtitleLines", 2))
- VSlider {
- implicitWidth: 170
- from: 1; to: 8; value: subtitleDialog.pref("subtitleLines", 2)
- onMoved: veyra.setPreference("subtitleLines", Math.round(value))
- }
- }
- }
+ dialogHost: host
}
// --- 音频设置 ---------------------------------------------------------
- DLayer {
- key: "audio"
- glyph: "music"
- title: qsTr("音频设置")
- dialogWidth: 560
- actions: [{ label: qsTr("完成"), primary: true }]
- onActionTriggered: host.close()
-
- DSection { text: qsTr("音轨") }
- ColumnLayout {
- Layout.fillWidth: true
- spacing: 6
- Text {
- visible: veyra.audioTracks.length === 0
- text: qsTr("当前源没有可选音轨。")
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- }
- Repeater {
- model: veyra.audioTracks
- delegate: Rectangle {
- required property var modelData
- Layout.fillWidth: true
- implicitHeight: 52
- radius: 12
- color: Theme.card2
- border.width: 1
- border.color: veyra.selectedAudioTrack === modelData.index ? Theme.accent : Theme.stroke
- RowLayout {
- anchors.fill: parent
- anchors.leftMargin: 12
- anchors.rightMargin: 12
- spacing: 12
- // .trk .bars: the playing track's bars move (M39).
- VEqBars {
- objectName: "audio-track-bars-" + modelData.index
- active: veyra.selectedAudioTrack === modelData.index && veyra.running && !veyra.paused
- }
- ColumnLayout {
- Layout.fillWidth: true
- spacing: 2
- Text {
- text: modelData.label
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- }
- Text {
- text: modelData.channels > 0 ? modelData.channels + qsTr(" 声道") : ""
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 11
- }
- }
- VIcon {
- visible: veyra.selectedAudioTrack === modelData.index
- name: "check"
- color: Theme.accent
- }
- }
- HoverHandler { cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: veyra.selectedAudioTrack = modelData.index }
- }
- }
- }
- DSection { text: qsTr("输出") }
- DGroup {
- VRow {
- label: qsTr("音量")
- value: Math.round(veyra.volume * 100) + "%"
- VSlider {
- implicitWidth: 170
- from: 0; to: 1; value: veyra.volume; inputScale: 100
- onMoved: veyra.volume = value
- }
- }
- VRow {
- label: qsTr("静音")
- VSwitch {
- checked: veyra.muted
- onToggled: checked => veyra.muted = checked
- }
- }
- }
- DSection { text: qsTr("音画同步") }
- DGroup {
- VRow {
- label: qsTr("声音同步")
- hint: veyra.audioSyncMode === 0 ? (veyra.audioSyncLive ? qsTr("软件估算补偿 ") + veyra.audioCompensationMs.toFixed(0) + " ms" : qsTr("自动估算 · 采集卡 / PS5 实时输入时生效"))
- : veyra.audioSyncMode === 1 ? qsTr("手动偏移 · 实时输入时生效") : qsTr("关闭补偿")
- VSeg {
- options: [{ id: "0", label: qsTr("自动估算") }, { id: "1", label: qsTr("手动") }, { id: "2", label: qsTr("关闭", "off") }]
- current: String(veyra.audioSyncMode)
- onPicked: id => veyra.audioSyncMode = Number(id)
- }
- }
- VRow {
- label: qsTr("手动偏移")
- hint: qsTr("负值 = 声音提前")
- value: veyra.audioOffsetMs + " ms"
- VSlider {
- implicitWidth: 170
- center: true
- from: -250; to: 250; value: veyra.audioOffsetMs; enabledControl: veyra.audioSyncMode === 1
- onMoved: veyra.audioOffsetMs = Math.round(value / 10) * 10
- }
- }
- VRow {
- label: qsTr("当前偏差")
- hint: qsTr("软件内测得的音画偏差,不是扬声器实测;只在采集卡 / PS5 实时输入时有")
- value: veyra.audioSkewKnown ? (veyra.audioSkewMs >= 0 ? "+" : "") + veyra.audioSkewMs.toFixed(0) + " ms" : qsTr("未测")
- }
- }
- DSection { text: qsTr("输出设备") }
- DGroup {
- VRow {
- label: qsTr("输出设备")
- hint: veyra.audioOutputStatus
- VSelect {
- objectName: "audio-device"
- implicitWidth: 240
- readonly property string chosen: veyra.preferences.audioDevice || ""
- value: { const d = veyra.audioDevices.find(x => x.id === chosen); return d ? d.label : qsTr("跟随系统默认") }
- options: veyra.audioDevices
- onPicked: id => veyra.setPreference("audioDevice", id)
- }
- }
- VRow {
- label: qsTr("立体声下混")
- hint: qsTr("多声道片源混成双声道再输出(耳机);关闭时按设备声道布局映射")
- VSwitch {
- objectName: "audio-stereo"
- checked: veyra.preferences.audioForceStereo === true
- onToggled: checked => veyra.setPreference("audioForceStereo", checked)
- }
- }
- }
- // The list is read when the dialog opens: devices come and go.
- Connections {
- target: host
- function onDialogChanged() { if (host.dialog === "audio") veyra.refreshAudioDevices() }
- }
+ AudioSettingsDialog {
+ dialogHost: host
}
// --- 另存为预设 -------------------------------------------------------
// The design lists every part that will be saved before asking for a name, so
// the user can see what they are about to store.
- DLayer {
+ SavePresetDialog {
id: saveDialog
- objectName: "preset-save-dialog"
- key: "save"
- glyph: "plus"
- readonly property string kindLabel: veyra.nodeMode === 1 ? qsTr("节点") : qsTr("列表")
- title: qsTr("另存为") + kindLabel + qsTr("预设")
- sub: kindLabel + qsTr("预设和") + (veyra.nodeMode === 1 ? qsTr("列表") : qsTr("节点")) + qsTr("预设分开保存,互不影响;应用时只覆盖勾选的部分")
- dialogWidth: 580
- // presets.js currentItems: what the chain holds right now, one row per
- // node, with the parameters that matter.
- function nodeSummary(n) {
- switch (n.type) {
- case "sr": return veyra.srTargetLabel + (veyra.videoSrQuality > 0 ? qsTr(" · 质量 ") + veyra.videoSrQuality : "")
- case "nr": { const l = veyra.nrLayers.find(x => x.index === n.index); return l ? qsTr("强度 ") + l.intensity.toFixed(2) : "NR" }
- case "video-hdr": return qsTr("峰值 ") + (veyra.videoHdrParams.peakNits || 1000) + " nits"
- case "protection": return veyra.protectionRegions.length + qsTr(" / 4 个区域")
- case "color": return qsTr("调色参数")
- case "frame-generation": return veyra.fgMultiplier + "X · " + (veyra.fgBackendChoices.find(x => x.id === veyra.fgBackendName) || {label: "FG"}).label
- }
- return ""
- }
- function nodeLabel(n) {
- if (n.type !== "nr") return n.label
- let k = 0
- for (const m of veyra.chain) { if (m.type === "nr") ++k; if (m.index === n.index) break }
- return qsTr("NR 层 ") + k
- }
- readonly property bool nameTaken: presetNameField.text.trim().length > 0 &&
- veyra.presets.some(p => p.name === presetNameField.text.trim())
- property var chosen: ({})
- property var parts: []
- function resetForOpen() {
- const current = veyra.presetSaveParts
- const selected = {}
- for (const part of current) selected[part.id] = part.meaningful === true
- parts = current
- chosen = selected
- presetNameField.text = ""
- saveNote.text = ""
- saveAsDefault.checked = false
- }
- actions: [
- { label: qsTr("取消") },
- { label: qsTr("保存预设"), primary: true, icon: "check" }
- ]
- onActionTriggered: label => {
- if (label !== qsTr("保存预设")) { host.close(); return }
- const name = presetNameField.text.trim()
- if (name.length === 0) { saveNote.text = qsTr("预设需要一个名字"); return }
- let mask = 0
- const ids = ["chain", "color", "fg", "audio", "flow"]
- for (const part of parts) {
- const bit = ids.indexOf(part.id)
- if (bit >= 0 && chosen[part.id] === true) mask |= (1 << bit)
- }
- if (mask === 0) { saveNote.text = qsTr("至少选择一项内容"); return }
- if (veyra.savePresetAs(name, mask, veyra.nodeMode === 1)) {
- if (saveAsDefault.checked) {
- const saved = veyra.presets.find(p => p.name === name && p.nodeMode === (veyra.nodeMode === 1))
- if (saved) veyra.setDefaultPreset(saved.index)
- }
- host.close()
- }
- else saveNote.text = qsTr("保存失败:名称可能已存在")
- }
-
- // .namebox: the name first, with a live note under it.
- ColumnLayout {
- Layout.fillWidth: true
- Layout.topMargin: 4
- spacing: 6
- Text { text: qsTr("预设名称"); color: Theme.t2; font.family: Theme.fontUi; font.pixelSize: 12 }
- VTextField {
- id: presetNameField
- objectName: "preset-name"
- Layout.fillWidth: true
- placeholder: qsTr("例如:夜间游戏")
- }
- Text {
- objectName: "preset-name-hint"
- Layout.fillWidth: true
- text: saveDialog.nameTaken ? qsTr("已有同名预设,换一个名称才能保存")
- : presetNameField.text.trim().length > 0 ? qsTr("可以保存")
- : qsTr("名称会显示在极简模式和导出页的预设菜单里")
- color: saveDialog.nameTaken ? Theme.warn : Theme.ok
- font.family: Theme.fontUi
- font.pixelSize: 11
- }
- }
- DSection { text: qsTr("将保存的内容 · 当前正在使用的") + saveDialog.kindLabel + qsTr("设置") }
- // .savelist: every node, a green dot when it runs; the list dims when
- // the effect chain itself is not part of the preset.
- ColumnLayout {
- objectName: "preset-save-list"
- Layout.fillWidth: true
- spacing: 4
- opacity: saveDialog.chosen["chain"] === true ? 1 : 0.45
- Behavior on opacity { NumberAnimation { duration: Theme.d(200) } }
- Repeater {
- model: saveDialog.shown ? veyra.chain : []
- delegate: Rectangle {
- required property var modelData
- Layout.fillWidth: true
- implicitHeight: 34
- radius: 8
- color: Qt.rgba(1, 1, 1, 0.03)
- RowLayout {
- anchors.fill: parent
- anchors.leftMargin: 10
- anchors.rightMargin: 10
- spacing: 10
- Rectangle {
- implicitWidth: 7; implicitHeight: 7; radius: 3.5
- color: modelData.enabled ? Theme.ok : Qt.rgba(1, 1, 1, 0.25)
- }
- Text {
- Layout.preferredWidth: 110
- text: saveDialog.nodeLabel(modelData)
- color: modelData.enabled ? Theme.t1 : Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 12
- font.weight: Font.DemiBold; font.variableAxes: Theme.axesDemiBold
- elide: Text.ElideRight
- }
- Text {
- Layout.fillWidth: true
- text: saveDialog.nodeSummary(modelData)
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- elide: Text.ElideRight
- }
- VTag { visible: !modelData.enabled; text: qsTr("已关闭") }
- }
- }
- }
- }
- DSection { text: qsTr("选项") }
- DGroup {
- Repeater {
- model: saveDialog.shown ? saveDialog.parts : []
- delegate: VRow {
- required property var modelData
- label: qsTr("包含") + modelData.label
- hint: modelData.summary
- VSwitch {
- objectName: "preset-part-" + modelData.id
- // A part at its default is still offered, but starts off: a
- // preset that stored nothing would be a surprise.
- checked: saveDialog.chosen[modelData.id] === true
- onToggled: checked => {
- const c = Object.assign({}, saveDialog.chosen)
- c[modelData.id] = checked
- saveDialog.chosen = c
- }
- }
- }
- }
- VRow {
- label: qsTr("保存后设为启动默认")
- hint: qsTr("下次启动软件时自动应用这个预设")
- VSwitch { id: saveAsDefault; objectName: "preset-save-default"; checked: false; onToggled: v => checked = v }
- }
- }
- Text {
- id: saveNote
- objectName: "preset-save-error"
- Layout.fillWidth: true
- Layout.topMargin: 6
- text: ""
- color: Theme.warn
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- wrapMode: Text.WordWrap
- }
+ dialogHost: host
}
// --- 管理预设 ---------------------------------------------------------
- DLayer {
+ ManagePresetsDialog {
id: manageDialog
- key: "manage"
- glyph: "settings"
- title: qsTr("管理预设")
- sub: qsTr("导出页和极简模式都从这里的预设中选择")
- dialogWidth: 620
- property string mode: "list"
- property string feedback: ""
- property bool feedbackError: false
- function runAction(action, index, name) {
- let ok = false
- if (action === "rename") ok = veyra.renamePreset(index, name)
- else if (action === "duplicate") ok = veyra.duplicatePreset(index)
- else if (action === "delete") ok = veyra.deletePreset(index)
- else if (action === "default") ok = veyra.setDefaultPreset(index)
- feedbackError = !ok
- if (action === "rename")
- feedback = ok ? qsTr("预设已改名") : qsTr("改名失败:名称不能为空、超过48字或与已有预设重复")
- else if (action === "duplicate")
- feedback = ok ? qsTr("预设已复制") : qsTr("复制失败:预设数量可能已达上限")
- else if (action === "delete")
- feedback = ok ? qsTr("预设已删除") : qsTr("删除预设失败")
- else if (action === "default")
- feedback = ok ? (index < 0 ? qsTr("已取消启动默认预设") : qsTr("已设为启动默认预设")) : qsTr("启动默认预设保存失败")
- return ok
- }
- actions: [{ label: qsTr("完成"), primary: true }]
- onActionTriggered: host.close()
-
- ColumnLayout {
- Layout.fillWidth: true
- spacing: 8
- // presets.js manage: the mode toggle, then 导入 / 导出 on the right.
- RowLayout {
- Layout.fillWidth: true
- spacing: 8
- VSeg {
- objectName: "preset-manage-mode"
- options: [{ id: "list", label: qsTr("列表预设") }, { id: "node", label: qsTr("节点预设") }]
- current: manageDialog.mode
- onPicked: mode => { manageDialog.mode = mode; manageDialog.feedback = "" }
- }
- Item { Layout.fillWidth: true }
- VButton { objectName: "preset-import"; ghost: true; iconName: "import"; text: qsTr("导入"); onClicked: veyra.importPresetDialog() }
- VButton {
- id: presetExportBtn
- objectName: "preset-export"
- ghost: true; iconName: "upload"; text: qsTr("导出")
- enabled: presetRows.count > 0
- onClicked: presetExportMenu.openAt(presetExportBtn, "down")
- }
- }
- Text {
- visible: presetRows.count === 0
- text: qsTr("这个模式还没有预设。")
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- }
- Repeater {
- id: presetRows
- model: manageDialog.shown
- ? veyra.presets.filter(p => p.nodeMode === (manageDialog.mode === "node")) : []
- delegate: Rectangle {
- id: presetRow
- required property var modelData
- objectName: "preset-row-" + modelData.index
- Layout.fillWidth: true
- implicitHeight: 54
- radius: 12
- color: Theme.card2
- border.width: 1
- border.color: Theme.stroke
- readonly property bool isDefault: veyra.defaultPresetIndex === modelData.index
- // .prow.bye (M41): shrink and fade over .25s, then delete.
- property real motionS: 1
- scale: motionS
- ParallelAnimation {
- id: rowBye
- NumberAnimation { target: presetRow; property: "motionS"; to: 0.9; duration: Theme.d(250); easing.bezierCurve: Theme.easeOut }
- NumberAnimation { target: presetRow; property: "opacity"; to: 0; duration: Theme.d(250); easing.bezierCurve: Theme.easeOut }
- onFinished: manageDialog.runAction("delete", presetRow.modelData.index)
- }
- function remove() {
- if (Theme.d(250) <= 0) manageDialog.runAction("delete", modelData.index)
- else rowBye.restart()
- }
- RowLayout {
- anchors.fill: parent
- anchors.leftMargin: 10
- anchors.rightMargin: 8
- spacing: 8
- // .pico
- Rectangle {
- implicitWidth: 30; implicitHeight: 30; radius: 9
- color: Qt.rgba(1, 1, 1, 0.05)
- VIcon { anchors.centerIn: parent; name: modelData.nodeMode ? "nodes" : "layers"; size: 14; color: Theme.t2 }
- }
- ColumnLayout {
- Layout.fillWidth: true
- spacing: 2
- VTextField {
- id: presetNameEdit
- objectName: "preset-rename-" + modelData.index
- Layout.fillWidth: true
- enabled: !modelData.builtin
- text: modelData.name
- onEdited: name => {
- const trimmed = name.trim()
- if (trimmed === modelData.name) return
- if (!manageDialog.runAction("rename", modelData.index, trimmed)) {
- presetNameEdit.text = modelData.name
- }
- }
- }
- Text {
- Layout.fillWidth: true
- text: modelData.note.length > 0 ? modelData.note
- : (modelData.nodeMode ? qsTr("节点预设") : qsTr("列表预设"))
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 11
- elide: Text.ElideRight
- }
- }
- VTag { objectName: "preset-default-tag-" + modelData.index; visible: presetRow.isDefault; kind: "acc"; text: qsTr("启动默认") }
- VButton {
- objectName: "preset-default-" + modelData.index
- icon: true; ghost: true; iconName: "home"
- tip: presetRow.isDefault ? qsTr("取消启动默认") : qsTr("设为启动默认")
- onClicked: manageDialog.runAction("default", presetRow.isDefault ? -1 : modelData.index)
- }
- VButton {
- objectName: "preset-duplicate-" + modelData.index
- icon: true; ghost: true; iconName: "dup"
- tip: qsTr("复制")
- onClicked: manageDialog.runAction("duplicate", modelData.index)
- }
- VButton {
- objectName: "preset-delete-" + modelData.index
- icon: true; ghost: true; iconName: "trash"
- tip: qsTr("删除")
- enabled: !modelData.builtin
- onClicked: presetRow.remove()
- }
- }
- }
- }
- VMenu {
- id: presetExportMenu
- objectName: "preset-export-menu"
- title: qsTr("导出预设")
- items: veyra.presets.filter(p => p.nodeMode === (manageDialog.mode === "node"))
- .map(p => ({ label: p.name, note: p.note, icon: "upload", preset: p.index }))
- onPicked: (i, o) => veyra.exportPresetDialog(o.preset)
- }
- Text {
- objectName: "preset-manage-feedback"
- Layout.fillWidth: true
- visible: manageDialog.feedback.length > 0
- text: manageDialog.feedback
- color: manageDialog.feedbackError ? Theme.warn : Theme.t2
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- wrapMode: Text.WordWrap
- }
- }
+ dialogHost: host
}
// --- small building blocks the design's dialogs use --------------------
- component DSection: RowLayout {
- property string text: ""
- Layout.fillWidth: true
- Layout.topMargin: 14
- Layout.bottomMargin: 4
- spacing: 8
- VEyebrow { text: parent.text }
- Rectangle {
- Layout.fillWidth: true
- implicitHeight: 1
- color: Theme.stroke
- }
- }
-
- component DGroup: VGroup {
- Layout.fillWidth: true
- }
- component DNote: Rectangle {
- property string text: ""
- Layout.fillWidth: true
- Layout.topMargin: 8
- implicitHeight: noteText.implicitHeight + 18
- radius: 9
- color: Qt.rgba(0.961, 0.784, 0.294, 0.06)
- Text {
- id: noteText
- anchors.fill: parent
- anchors.margins: 9
- text: parent.text
- color: Theme.t2
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- wrapMode: Text.WordWrap
- }
- }
-
- component VTextField: Rectangle {
- property string placeholder: ""
- property alias text: field.text
- signal edited(string text)
- // Every keystroke. editingFinished alone needs Enter or a focus change: typing a
- // value and clicking 连接 (which takes no focus) or closing the dialog lost it.
- signal typed(string text)
- implicitHeight: 30
- radius: 9
- color: Qt.rgba(1, 1, 1, 0.04)
- border.width: 1
- border.color: field.activeFocus ? Theme.accent : Theme.stroke
- TextInput {
- id: field
- anchors.fill: parent
- anchors.leftMargin: 10
- anchors.rightMargin: 10
- verticalAlignment: TextInput.AlignVCenter
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- selectByMouse: true
- onEditingFinished: parent.edited(text)
- onTextEdited: parent.typed(text)
- }
- Text {
- anchors.verticalCenter: parent.verticalCenter
- anchors.left: parent.left
- anchors.leftMargin: 10
- visible: field.text.length === 0
- text: parent.placeholder
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- }
- }
}
diff --git a/qml/Veyra/DialogLayer.qml b/qml/Veyra/DialogLayer.qml
new file mode 100644
index 00000000..a44f32c9
--- /dev/null
+++ b/qml/Veyra/DialogLayer.qml
@@ -0,0 +1,162 @@
+// Shared dialog presentation; extracted without changing geometry or motion.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+Rectangle {
+ id: dlg
+ required property Item dialogHost
+ property string title: ""
+ property string sub: ""
+ property string glyph: ""
+ property int dialogWidth: 640
+ property var actions: []
+ // dialogs.js `foot`: a quiet note at the left of the button row.
+ property string foot: ""
+ default property alias body: bodyCol.data
+ signal actionTriggered(string label)
+
+ // Which dialog key shows this layer.
+ property string key: ""
+ readonly property bool shown: key.length > 0 && dialogHost.dialog === key
+ // M17: .dlg scale .9 -> 1 and translate 0 14px -> 0 over .55s --spring inside the
+ // scrim's .2s fade; closing runs the same back while the scrim fades out.
+ property real motionS: 0.9
+ property real motionDy: 14
+ onShownChanged: { if (shown) { motionS = 0.9; motionDy = 14; enterAnim.restart() } else exitAnim.restart() }
+ onMotionSChanged: if (shown) dialogHost.motionScale = motionS
+ ParallelAnimation {
+ id: enterAnim
+ NumberAnimation { target: dlg; property: "motionS"; to: 1; duration: Theme.d(550); easing.bezierCurve: Theme.spring }
+ NumberAnimation { target: dlg; property: "motionDy"; to: 0; duration: Theme.d(550); easing.bezierCurve: Theme.spring }
+ }
+ ParallelAnimation {
+ id: exitAnim
+ NumberAnimation { target: dlg; property: "motionS"; to: 0.9; duration: Theme.d(550); easing.bezierCurve: Theme.spring }
+ NumberAnimation { target: dlg; property: "motionDy"; to: 14; duration: Theme.d(550); easing.bezierCurve: Theme.spring }
+ }
+ opacity: shown ? 1 : 0
+ visible: opacity > 0
+ // A closed dialog leaves the scene. Its live bindings (capture preview, fps text)
+ // kept changing while hidden and Qt redrew the window for each change, ~40 times
+ // a second during capture; OBS game capture then held the UI instead of the video.
+ // Keyed on shown/opacity, never on visible: an item without a parent always
+ // reads invisible, so "visible ? host : null" never brought a dialog back.
+ parent: (shown || opacity > 0) ? dialogHost : null
+ Behavior on opacity { NumberAnimation { duration: Theme.d(200) } }
+ transform: [
+ Scale { origin.x: dlg.width / 2; origin.y: dlg.height / 2; xScale: dlg.motionS; yScale: dlg.motionS },
+ Translate { y: dlg.motionDy }
+ ]
+ // Cut out of the native video window (main.cpp syncVideoCovers). The flag,
+ // not the objectName: each dialog below names itself for tests.
+ objectName: "videoCover"
+ readonly property bool videoCover: true
+ property real coverRadius: 16
+
+ // Centred by position, not anchors: the parent is null while closed.
+ x: Math.round((dialogHost.width - width) / 2)
+ y: Math.round((dialogHost.height - height) / 2)
+ width: dialogWidth
+ // Never taller than the window: the body scrolls instead of the panel
+ // being cut off at the top and bottom of a small window.
+ // Header and footer each carry 16px margins top and bottom (64 in all); the
+ // old +40 left every body 24px short, so short dialogs hid their last row.
+ implicitHeight: Math.min(720, dialogHost.height - 24, header.height + bodyScroll.contentHeight + footer.height + 64)
+ height: implicitHeight
+ // Swallow presses on the panel itself so they never reach the scrim
+ // below (a passive tap on a control used to close the whole dialog).
+ MouseArea { anchors.fill: parent; acceptedButtons: Qt.AllButtons; z: -1 }
+ radius: 16
+ color: Theme.dialog
+ border.width: 1
+ border.color: Theme.stroke2
+
+ ColumnLayout {
+ anchors.fill: parent
+ spacing: 0
+
+ RowLayout {
+ id: header
+ Layout.fillWidth: true
+ Layout.margins: 16
+ spacing: 12
+ Rectangle {
+ implicitWidth: 34; implicitHeight: 34; radius: 10
+ color: Qt.rgba(1, 1, 1, 0.06)
+ VIcon { anchors.centerIn: parent; name: dlg.glyph }
+ }
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 2
+ Text {
+ // Fill: without a subtitle this is the column's only child, and
+ // its natural width would cap the column and pull the close
+ // button in beside the title.
+ Layout.fillWidth: true
+ elide: Text.ElideRight
+ text: dlg.title
+ color: Theme.t1
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsH2
+ font.weight: Font.DemiBold; font.variableAxes: Theme.axesDemiBold
+ }
+ Text {
+ Layout.fillWidth: true
+ visible: dlg.sub.length > 0
+ text: dlg.sub
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 12
+ wrapMode: Text.WordWrap
+ }
+ }
+ VButton { icon: true; iconName: "x"; ghost: true; onClicked: dialogHost.close() }
+ }
+
+ Flickable {
+ id: bodyScroll
+ Layout.fillWidth: true
+ Layout.fillHeight: true
+ Layout.leftMargin: 20
+ Layout.rightMargin: 20
+ contentHeight: bodyCol.implicitHeight
+ clip: true
+ ScrollBar.vertical: VScrollBar { }
+ ColumnLayout {
+ id: bodyCol
+ // Keep the groups clear of the overlaid scroll bar.
+ width: parent.width - (bodyScroll.contentHeight > bodyScroll.height ? 12 : 0)
+ spacing: 0
+ }
+ }
+
+ RowLayout {
+ id: footer
+ Layout.fillWidth: true
+ Layout.margins: 16
+ spacing: 8
+ Text {
+ objectName: "dialog-foot"
+ Layout.fillWidth: true
+ visible: dlg.foot.length > 0
+ text: dlg.foot
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ elide: Text.ElideRight
+ }
+ Item { Layout.fillWidth: true; visible: dlg.foot.length === 0 }
+ Repeater {
+ model: dlg.actions
+ delegate: VButton {
+ required property var modelData
+ text: modelData.label
+ iconName: modelData.icon || ""
+ primary: modelData.primary === true
+ onClicked: dlg.actionTriggered(modelData.label)
+ }
+ }
+ }
+ }
+}
diff --git a/qml/Veyra/DialogNote.qml b/qml/Veyra/DialogNote.qml
new file mode 100644
index 00000000..2c0cede5
--- /dev/null
+++ b/qml/Veyra/DialogNote.qml
@@ -0,0 +1,23 @@
+// Shared dialog presentation; extracted without changing geometry or motion.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+Rectangle {
+ property string text: ""
+ Layout.fillWidth: true
+ Layout.topMargin: 8
+ implicitHeight: noteText.implicitHeight + 18
+ radius: 9
+ color: Qt.rgba(0.961, 0.784, 0.294, 0.06)
+ Text {
+ id: noteText
+ anchors.fill: parent
+ anchors.margins: 9
+ text: parent.text
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ wrapMode: Text.WordWrap
+ }
+}
diff --git a/qml/Veyra/DialogSection.qml b/qml/Veyra/DialogSection.qml
new file mode 100644
index 00000000..b9a7ab9e
--- /dev/null
+++ b/qml/Veyra/DialogSection.qml
@@ -0,0 +1,18 @@
+// Shared dialog presentation; extracted without changing geometry or motion.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+RowLayout {
+ property string text: ""
+ Layout.fillWidth: true
+ Layout.topMargin: 14
+ Layout.bottomMargin: 4
+ spacing: 8
+ VEyebrow { text: parent.text }
+ Rectangle {
+ Layout.fillWidth: true
+ implicitHeight: 1
+ color: Theme.stroke
+ }
+}
diff --git a/qml/Veyra/DialogTextField.qml b/qml/Veyra/DialogTextField.qml
new file mode 100644
index 00000000..50672338
--- /dev/null
+++ b/qml/Veyra/DialogTextField.qml
@@ -0,0 +1,41 @@
+// Shared dialog presentation; extracted without changing geometry or motion.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+Rectangle {
+ property string placeholder: ""
+ property alias text: field.text
+ signal edited(string text)
+ // Every keystroke. editingFinished alone needs Enter or a focus change: typing a
+ // value and clicking 连接 (which takes no focus) or closing the dialog lost it.
+ signal typed(string text)
+ implicitHeight: 30
+ radius: 9
+ color: Qt.rgba(1, 1, 1, 0.04)
+ border.width: 1
+ border.color: field.activeFocus ? Theme.accent : Theme.stroke
+ TextInput {
+ id: field
+ anchors.fill: parent
+ anchors.leftMargin: 10
+ anchors.rightMargin: 10
+ verticalAlignment: TextInput.AlignVCenter
+ color: Theme.t1
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ selectByMouse: true
+ onEditingFinished: parent.edited(text)
+ onTextEdited: parent.typed(text)
+ }
+ Text {
+ anchors.verticalCenter: parent.verticalCenter
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+ visible: field.text.length === 0
+ text: parent.placeholder
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ }
+}
diff --git a/qml/Veyra/ManagePresetsDialog.qml b/qml/Veyra/ManagePresetsDialog.qml
new file mode 100644
index 00000000..81fd28d5
--- /dev/null
+++ b/qml/Veyra/ManagePresetsDialog.qml
@@ -0,0 +1,174 @@
+// manage dialog: source/settings logic is owned by this component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+DialogLayer {
+ id: manageDialog
+ key: "manage"
+ glyph: "settings"
+ title: qsTr("管理预设")
+ sub: qsTr("导出页和极简模式都从这里的预设中选择")
+ dialogWidth: 620
+ property string mode: "list"
+ property string feedback: ""
+ property bool feedbackError: false
+ function runAction(action, index, name) {
+ let ok = false
+ if (action === "rename") ok = veyra.renamePreset(index, name)
+ else if (action === "duplicate") ok = veyra.duplicatePreset(index)
+ else if (action === "delete") ok = veyra.deletePreset(index)
+ else if (action === "default") ok = veyra.setDefaultPreset(index)
+ feedbackError = !ok
+ if (action === "rename")
+ feedback = ok ? qsTr("预设已改名") : qsTr("改名失败:名称不能为空、超过48字或与已有预设重复")
+ else if (action === "duplicate")
+ feedback = ok ? qsTr("预设已复制") : qsTr("复制失败:预设数量可能已达上限")
+ else if (action === "delete")
+ feedback = ok ? qsTr("预设已删除") : qsTr("删除预设失败")
+ else if (action === "default")
+ feedback = ok ? (index < 0 ? qsTr("已取消启动默认预设") : qsTr("已设为启动默认预设")) : qsTr("启动默认预设保存失败")
+ return ok
+ }
+ actions: [{ label: qsTr("完成"), primary: true }]
+ onActionTriggered: dialogHost.close()
+
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 8
+ // presets.js manage: the mode toggle, then 导入 / 导出 on the right.
+ RowLayout {
+ Layout.fillWidth: true
+ spacing: 8
+ VSeg {
+ objectName: "preset-manage-mode"
+ options: [{ id: "list", label: qsTr("列表预设") }, { id: "node", label: qsTr("节点预设") }]
+ current: manageDialog.mode
+ onPicked: mode => { manageDialog.mode = mode; manageDialog.feedback = "" }
+ }
+ Item { Layout.fillWidth: true }
+ VButton { objectName: "preset-import"; ghost: true; iconName: "import"; text: qsTr("导入"); onClicked: veyra.importPresetDialog() }
+ VButton {
+ id: presetExportBtn
+ objectName: "preset-export"
+ ghost: true; iconName: "upload"; text: qsTr("导出")
+ enabled: presetRows.count > 0
+ onClicked: presetExportMenu.openAt(presetExportBtn, "down")
+ }
+ }
+ Text {
+ visible: presetRows.count === 0
+ text: qsTr("这个模式还没有预设。")
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ }
+ Repeater {
+ id: presetRows
+ model: manageDialog.shown
+ ? veyra.presets.filter(p => p.nodeMode === (manageDialog.mode === "node")) : []
+ delegate: Rectangle {
+ id: presetRow
+ required property var modelData
+ objectName: "preset-row-" + modelData.index
+ Layout.fillWidth: true
+ implicitHeight: 54
+ radius: 12
+ color: Theme.card2
+ border.width: 1
+ border.color: Theme.stroke
+ readonly property bool isDefault: veyra.defaultPresetIndex === modelData.index
+ // .prow.bye (M41): shrink and fade over .25s, then delete.
+ property real motionS: 1
+ scale: motionS
+ ParallelAnimation {
+ id: rowBye
+ NumberAnimation { target: presetRow; property: "motionS"; to: 0.9; duration: Theme.d(250); easing.bezierCurve: Theme.easeOut }
+ NumberAnimation { target: presetRow; property: "opacity"; to: 0; duration: Theme.d(250); easing.bezierCurve: Theme.easeOut }
+ onFinished: manageDialog.runAction("delete", presetRow.modelData.index)
+ }
+ function remove() {
+ if (Theme.d(250) <= 0) manageDialog.runAction("delete", modelData.index)
+ else rowBye.restart()
+ }
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 10
+ anchors.rightMargin: 8
+ spacing: 8
+ // .pico
+ Rectangle {
+ implicitWidth: 30; implicitHeight: 30; radius: 9
+ color: Qt.rgba(1, 1, 1, 0.05)
+ VIcon { anchors.centerIn: parent; name: modelData.nodeMode ? "nodes" : "layers"; size: 14; color: Theme.t2 }
+ }
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 2
+ DialogTextField {
+ id: presetNameEdit
+ objectName: "preset-rename-" + modelData.index
+ Layout.fillWidth: true
+ enabled: !modelData.builtin
+ text: modelData.name
+ onEdited: name => {
+ const trimmed = name.trim()
+ if (trimmed === modelData.name) return
+ if (!manageDialog.runAction("rename", modelData.index, trimmed)) {
+ presetNameEdit.text = modelData.name
+ }
+ }
+ }
+ Text {
+ Layout.fillWidth: true
+ text: modelData.note.length > 0 ? modelData.note
+ : (modelData.nodeMode ? qsTr("节点预设") : qsTr("列表预设"))
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ elide: Text.ElideRight
+ }
+ }
+ VTag { objectName: "preset-default-tag-" + modelData.index; visible: presetRow.isDefault; kind: "acc"; text: qsTr("启动默认") }
+ VButton {
+ objectName: "preset-default-" + modelData.index
+ icon: true; ghost: true; iconName: "home"
+ tip: presetRow.isDefault ? qsTr("取消启动默认") : qsTr("设为启动默认")
+ onClicked: manageDialog.runAction("default", presetRow.isDefault ? -1 : modelData.index)
+ }
+ VButton {
+ objectName: "preset-duplicate-" + modelData.index
+ icon: true; ghost: true; iconName: "dup"
+ tip: qsTr("复制")
+ onClicked: manageDialog.runAction("duplicate", modelData.index)
+ }
+ VButton {
+ objectName: "preset-delete-" + modelData.index
+ icon: true; ghost: true; iconName: "trash"
+ tip: qsTr("删除")
+ enabled: !modelData.builtin
+ onClicked: presetRow.remove()
+ }
+ }
+ }
+ }
+ VMenu {
+ id: presetExportMenu
+ objectName: "preset-export-menu"
+ title: qsTr("导出预设")
+ items: veyra.presets.filter(p => p.nodeMode === (manageDialog.mode === "node"))
+ .map(p => ({ label: p.name, note: p.note, icon: "upload", preset: p.index }))
+ onPicked: (i, o) => veyra.exportPresetDialog(o.preset)
+ }
+ Text {
+ objectName: "preset-manage-feedback"
+ Layout.fillWidth: true
+ visible: manageDialog.feedback.length > 0
+ text: manageDialog.feedback
+ color: manageDialog.feedbackError ? Theme.warn : Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ wrapMode: Text.WordWrap
+ }
+ }
+}
diff --git a/qml/Veyra/NetworkSourceDialog.qml b/qml/Veyra/NetworkSourceDialog.qml
new file mode 100644
index 00000000..73a62092
--- /dev/null
+++ b/qml/Veyra/NetworkSourceDialog.qml
@@ -0,0 +1,33 @@
+// network dialog: source/settings logic is owned by this component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+DialogLayer {
+ id: networkDialog
+ objectName: "network-dialog"
+ key: "network"
+ glyph: "cast"
+ title: qsTr("播放地址")
+ sub: qsTr("直接打开 HTTP、HTTPS 或 RTSP 视频流,例如 IPTV 或摄像机地址")
+ dialogWidth: 640
+ actions: [{label:qsTr("取消")},{label:qsTr("打开"),primary:true,icon:"play"}]
+ onActionTriggered: label => {
+ if(label!==qsTr("打开")){dialogHost.close();return}
+ if(veyra.openNetworkAddress(networkAddress.text))dialogHost.close()
+ }
+ DialogTextField {
+ id: networkAddress
+ objectName: "network-address"
+ Layout.fillWidth: true
+ placeholder: "https://… / rtsp://…"
+ }
+ Text {
+ Layout.fillWidth: true
+ text: qsTr("需要直接媒体地址,普通网页或需要网页登录的页面不能直接播放。直播流通常无法拖动进度。")
+ wrapMode: Text.Wrap
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 12
+ }
+}
diff --git a/qml/Veyra/PcSourceDialog.qml b/qml/Veyra/PcSourceDialog.qml
new file mode 100644
index 00000000..a16dca88
--- /dev/null
+++ b/qml/Veyra/PcSourceDialog.qml
@@ -0,0 +1,327 @@
+// moonlight dialog: source/settings logic is owned by this component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+DialogLayer {
+ id: mlDialog
+ objectName: "moonlight-dialog"
+ key: "moonlight"
+ glyph: "cast"
+ title: qsTr("PC 串流")
+ sub: qsTr("串流另一台电脑(Sunshine 主机)· 增强与调色沿用软件自己的处理链")
+ dialogWidth: 760
+ readonly property var ml: veyra.moonlight
+ readonly property var st: ml ? ml.state : ({})
+ readonly property var hostList: ml ? ml.hosts : []
+ readonly property var appList: ml ? ml.apps : []
+ readonly property var cfg: st.settings || ({})
+ property int pickedApp: -1
+ readonly property int effectiveApp: pickedApp >= 0 ? pickedApp
+ : (st.runningApp > 0 ? st.runningApp : (appList.length > 0 ? appList[0].id : -1))
+ readonly property bool canStart: !!st.paired && !!st.online && !st.busy && effectiveApp >= 0 && !st.streaming
+ actions: st.streaming ? [
+ { label: qsTr("关闭") },
+ { label: qsTr("断开"), primary: true }
+ ] : [
+ { label: st.busy ? qsTr("取消操作") : qsTr("关闭") },
+ { label: qsTr("开始串流"), primary: true, icon: "play" }
+ ]
+ onActionTriggered: label => {
+ if (label === qsTr("断开")) { veyra.moonlightDisconnect(); dialogHost.close(); return }
+ if (label === qsTr("取消操作")) { ml.cancel(); return }
+ if (label === qsTr("关闭")) { dialogHost.close(); return }
+ if (canStart) ml.connectStream(effectiveApp)
+ }
+ Connections {
+ target: mlDialog
+ function onShownChanged() {
+ if (!mlDialog.ml) return
+ if (mlDialog.shown) { mlDialog.pickedApp = -1; mlDialog.ml.load() }
+ else mlDialog.ml.unload()
+ }
+ }
+ Connections {
+ target: mlDialog.ml
+ function onStarted() { dialogHost.close(); dialogHost.startMoonlight() }
+ }
+ readonly property var resolutions: [
+ { id: "720p", label: "720p · 1280×720" }, { id: "1080p", label: "1080p · 1920×1080" },
+ { id: "1440p", label: "1440p · 2560×1440" }, { id: "4k", label: "4K · 3840×2160" },
+ { id: "native", label: qsTr("本机屏幕分辨率") }]
+ readonly property var rates: [30, 60, 90, 120, 144].map(v => ({ id: String(v), label: v + " fps" }))
+ function labelOf(list, id, fallback) { const f = list.find(x => String(x.id) === String(id)); return f ? f.label : fallback }
+ function stateText(s) {
+ return s === "online" ? qsTr("在线") : s === "unpaired" ? qsTr("未配对") : s === "busy" ? qsTr("在线 · 有游戏在运行")
+ : s === "checking" ? qsTr("检查中…") : qsTr("离线")
+ }
+
+ DialogSection { text: qsTr("主机") }
+ DialogNote {
+ visible: mlDialog.hostList.length === 0
+ text: qsTr("还没有主机。在要被串流的电脑上安装 Sunshine(官网 app.lizardbyte.dev/Sunshine,软件不自带),")
+ + qsTr("两台电脑接在同一个局域网,这里会自动出现;也可以在下面手填它的 IP。首次使用需要配对。")
+ }
+ Repeater {
+ model: mlDialog.hostList
+ delegate: Rectangle {
+ id: hostRow
+ required property var modelData
+ Layout.fillWidth: true
+ Layout.topMargin: 6
+ implicitHeight: 54
+ radius: 11
+ color: modelData.selected ? Theme.accentSoft : (hostHover.hovered ? Theme.card3 : Theme.card2)
+ border.width: 1
+ border.color: modelData.selected ? Theme.accent : Theme.stroke
+ objectName: "moonlight-host-" + modelData.id
+ HoverHandler { id: hostHover; cursorShape: Qt.PointingHandCursor }
+ TapHandler { onTapped: mlDialog.ml.select(hostRow.modelData.id) }
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 14
+ anchors.rightMargin: 10
+ spacing: 12
+ VDot {
+ warn: hostRow.modelData.state === "unpaired"
+ off: hostRow.modelData.state === "offline" || hostRow.modelData.state === "checking"
+ Layout.alignment: Qt.AlignVCenter
+ }
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 1
+ Text {
+ Layout.fillWidth: true
+ text: hostRow.modelData.name
+ color: Theme.t1
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ font.weight: Font.Medium
+ elide: Text.ElideRight
+ }
+ Text {
+ Layout.fillWidth: true
+ text: hostRow.modelData.address + " · " + mlDialog.stateText(hostRow.modelData.state)
+ + (hostRow.modelData.gpu.length > 0 ? " · " + hostRow.modelData.gpu : "")
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ elide: Text.ElideRight
+ }
+ }
+ VTag { visible: hostRow.modelData.paired; text: qsTr("已配对"); kind: "ok" }
+ VButton {
+ visible: !hostRow.modelData.paired && hostRow.modelData.state !== "offline"
+ objectName: "moonlight-pair-" + hostRow.modelData.id
+ text: qsTr("配对")
+ primary: true
+ enabled: !mlDialog.st.busy
+ onClicked: mlDialog.ml.pair(hostRow.modelData.id)
+ }
+ VButton {
+ text: qsTr("删除")
+ ghost: true
+ enabled: !mlDialog.st.busy
+ onClicked: mlDialog.ml.forget(hostRow.modelData.id)
+ }
+ }
+ }
+ }
+ DialogGroup {
+ VRow {
+ label: qsTr("手动添加")
+ hint: qsTr("IP 或主机名,端口不是 47989 时写成 192.168.1.20:47989")
+ RowLayout {
+ spacing: 6
+ DialogTextField { id: mlAddress; objectName: "moonlight-address"; implicitWidth: 190; placeholder: "192.168.1.x"; onEdited: text => { if (text.length > 0) { mlDialog.ml.addHost(text); mlAddress.text = "" } } }
+ VSpinner { visible: mlDialog.st.busy === true; Layout.alignment: Qt.AlignVCenter }
+ VButton { text: qsTr("添加"); ghost: true; enabled: !mlDialog.st.busy && mlAddress.text.length > 0; onClicked: { mlDialog.ml.addHost(mlAddress.text); mlAddress.text = "" } }
+ VButton { text: qsTr("刷新"); ghost: true; enabled: !mlDialog.st.busy; onClicked: mlDialog.ml.refresh() }
+ }
+ }
+ }
+ // The PIN the user types into the host's Sunshine page.
+ Rectangle {
+ visible: mlDialog.st.pairing === true
+ objectName: "moonlight-pin-box"
+ Layout.fillWidth: true
+ Layout.topMargin: 8
+ implicitHeight: pinCol.implicitHeight + 28
+ radius: 11
+ color: Theme.accentSoft
+ border.width: 1
+ border.color: Theme.accent
+ ColumnLayout {
+ id: pinCol
+ anchors.fill: parent
+ anchors.margins: 14
+ spacing: 6
+ Text {
+ Layout.fillWidth: true
+ text: qsTr("在主机上打开 Sunshine 网页(https://主机IP:47990),进入「PIN」页,输入下面的数字并提交:")
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ wrapMode: Text.WordWrap
+ }
+ Text {
+ objectName: "moonlight-pin"
+ Layout.alignment: Qt.AlignHCenter
+ text: mlDialog.st.pin || ""
+ color: Theme.t1
+ font.family: Theme.fontMono
+ font.pixelSize: 34
+ font.letterSpacing: 10
+ }
+ }
+ }
+
+ DialogSection { visible: !!mlDialog.st.paired; text: qsTr("游戏与程序 · ") + (mlDialog.st.hostName || "") }
+ DialogNote {
+ visible: !!mlDialog.st.selected && !mlDialog.st.paired && !mlDialog.st.pairing
+ text: qsTr("这台主机还没有和本机配对。点「配对」,在主机的 Sunshine 网页里输入软件给出的 PIN。")
+ }
+ DialogNote {
+ visible: !!mlDialog.st.paired && !mlDialog.st.online
+ text: qsTr("主机现在连不上(离线、休眠,或地址变了)。开机后点「刷新」。")
+ }
+ Flow {
+ visible: !!mlDialog.st.paired && !!mlDialog.st.online
+ Layout.fillWidth: true
+ spacing: 8
+ Repeater {
+ model: mlDialog.appList
+ delegate: Rectangle {
+ id: appCard
+ required property var modelData
+ readonly property bool picked: mlDialog.effectiveApp === modelData.id
+ objectName: "moonlight-app-" + modelData.id
+ width: 168
+ height: 64
+ radius: 11
+ color: picked ? Theme.accentSoft : (appHover.hovered ? Theme.card3 : Theme.card2)
+ border.width: 1
+ border.color: picked ? Theme.accent : Theme.stroke
+ HoverHandler { id: appHover; cursorShape: Qt.PointingHandCursor }
+ TapHandler {
+ onTapped: mlDialog.pickedApp = appCard.modelData.id
+ onDoubleTapped: { mlDialog.pickedApp = appCard.modelData.id; if (mlDialog.canStart) mlDialog.ml.connectStream(appCard.modelData.id) }
+ }
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: 11
+ spacing: 4
+ Text {
+ Layout.fillWidth: true
+ text: appCard.modelData.name
+ color: Theme.t1
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ font.weight: Font.Medium
+ elide: Text.ElideRight
+ }
+ RowLayout {
+ spacing: 6
+ VTag { visible: appCard.modelData.running; text: qsTr("运行中"); kind: "acc" }
+ VTag { visible: appCard.modelData.hdr; text: "HDR" }
+ }
+ }
+ }
+ }
+ }
+ RowLayout {
+ visible: !!mlDialog.st.paired && !!mlDialog.st.online && mlDialog.st.runningApp > 0
+ Layout.fillWidth: true
+ Layout.topMargin: 8
+ spacing: 8
+ Text {
+ Layout.fillWidth: true
+ text: qsTr("主机上有游戏在运行。断开串流不会结束它;选它并开始即可继续。")
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ wrapMode: Text.WordWrap
+ }
+ VButton { objectName: "moonlight-quit-app"; text: qsTr("退出游戏"); ghost: true; enabled: !mlDialog.st.busy; onClicked: mlDialog.ml.quitApp() }
+ }
+
+ DialogSection { text: qsTr("串流设置(只影响串流本身,按主机保存)") }
+ DialogGroup {
+ VRow {
+ label: qsTr("分辨率")
+ hint: qsTr("主机按这个尺寸编码;软件的超分与增强在收到之后再做")
+ VSelect { objectName: "moonlight-res"; implicitWidth: 190; value: mlDialog.labelOf(mlDialog.resolutions, mlDialog.cfg.res, "1080p · 1920×1080"); options: mlDialog.resolutions; onPicked: id => mlDialog.ml.set("res", id) }
+ }
+ VRow {
+ label: qsTr("帧率")
+ VSelect { objectName: "moonlight-fps"; implicitWidth: 130; value: (mlDialog.cfg.fps || 60) + " fps"; options: mlDialog.rates; onPicked: id => mlDialog.ml.set("fps", Number(id)) }
+ }
+ VRow {
+ label: qsTr("码率")
+ hint: qsTr("默认 150 Mbps;有线千兆可以拉到 300–500,无线卡顿时调低。主机画面简单时实际码率会低于这里的上限")
+ RowLayout {
+ spacing: 10
+ VSlider {
+ id: bitrateSlider
+ objectName: "moonlight-bitrate"
+ implicitWidth: 170
+ from: 5; to: 500
+ live: false
+ value: mlDialog.cfg.bitrate || 150
+ onMoved: v => mlDialog.ml.set("bitrate", Math.max(5, Math.round(v / 5) * 5))
+ }
+ VSliderValue {
+ Layout.preferredWidth: 72
+ slider: bitrateSlider
+ horizontalAlignment: Text.AlignLeft
+ text: Math.max(5, Math.round((bitrateSlider.dragging ? bitrateSlider.dragValue : bitrateSlider.value) / 5) * 5) + " Mbps"
+ }
+ }
+ }
+ VRow {
+ label: qsTr("编码")
+ hint: mlDialog.cfg.codec === 3 ? qsTr("AV1 需要主机显卡能编码、本机显卡能解码") : qsTr("自动:优先 HEVC,主机不支持时用 H.264")
+ VSeg {
+ objectName: "moonlight-codec"
+ options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: "H.264" }, { id: "2", label: "HEVC" }, { id: "3", label: "AV1" }]
+ current: String(mlDialog.cfg.codec || 0)
+ onPicked: id => mlDialog.ml.set("codec", Number(id))
+ }
+ }
+ VRow {
+ label: "HDR"
+ hint: mlDialog.st.hdrHost ? qsTr("需要主机显示器开启 HDR,且编码选 HEVC 或 AV1;本机需要硬件解码") : qsTr("这台主机没有报告 10 位编码能力")
+ VSwitch { objectName: "moonlight-hdr"; enabled: !!mlDialog.st.hdrHost || mlDialog.cfg.hdr === true; checked: mlDialog.cfg.hdr === true; onToggled: checked => mlDialog.ml.set("hdr", checked) }
+ }
+ VRow {
+ label: qsTr("声道")
+ VSeg {
+ objectName: "moonlight-audio"
+ options: [{ id: "2", label: qsTr("立体声") }, { id: "6", label: "5.1" }, { id: "8", label: "7.1" }]
+ current: String(mlDialog.cfg.audio || 2)
+ onPicked: id => mlDialog.ml.set("audio", Number(id))
+ }
+ }
+ VRow {
+ label: qsTr("手柄")
+ hint: qsTr("把电脑手柄当作主机上的 Xbox 手柄(1 号)")
+ VSwitch { objectName: "moonlight-gamepad"; checked: mlDialog.cfg.gamepad !== false; onToggled: checked => mlDialog.ml.set("gamepad", checked) }
+ }
+ VRow {
+ label: qsTr("自动捕获键盘鼠标")
+ hint: qsTr("开始后键鼠交给主机;Ctrl+Alt+Shift+Z 释放,+Q 断开,+S 统计")
+ VSwitch { objectName: "moonlight-capture"; checked: mlDialog.cfg.captureInput !== false; onToggled: checked => mlDialog.ml.set("captureInput", checked) }
+ }
+ VRow {
+ label: qsTr("让主机切换到串流分辨率")
+ hint: qsTr("关闭时主机保持自己的分辨率,画面由主机缩放")
+ VSwitch { objectName: "moonlight-sops"; checked: mlDialog.cfg.sops === true; onToggled: checked => mlDialog.ml.set("sops", checked) }
+ }
+ VRow {
+ label: qsTr("主机同时出声")
+ hint: qsTr("默认只在本机出声")
+ VSwitch { objectName: "moonlight-hostaudio"; checked: mlDialog.cfg.hostAudio === true; onToggled: checked => mlDialog.ml.set("hostAudio", checked) }
+ }
+ }
+ DialogNote { objectName: "moonlight-status"; visible: (mlDialog.st.status || "").length > 0; text: (mlDialog.st.busy ? qsTr("处理中 · ") : "") + (mlDialog.st.status || "") }
+}
diff --git a/qml/Veyra/ProAddLayerButton.qml b/qml/Veyra/ProAddLayerButton.qml
new file mode 100644
index 00000000..f0815d73
--- /dev/null
+++ b/qml/Veyra/ProAddLayerButton.qml
@@ -0,0 +1,82 @@
+// Professional-view reusable presentation component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtQuick.Shapes
+import QtQuick.Effects
+
+Rectangle {
+ id: addLayer
+ property string label: ""
+ property string note: ""
+ property bool full: false
+ signal add()
+ Layout.fillWidth: true
+ Layout.topMargin: 4
+ implicitHeight: 36
+ radius: 10
+ opacity: full ? 0.45 : 1
+ color: addHover.hovered && !full ? Theme.accentSoft : "transparent"
+ readonly property bool softwareRendering: (typeof vySoftwareUi !== "undefined" && vySoftwareUi)
+ || GraphicsInfo.api === GraphicsInfo.Software
+ readonly property color outline: addHover.hovered && !addLayer.full ? Theme.accent : Qt.rgba(1, 1, 1, 0.2)
+ Image {
+ anchors.fill: parent
+ visible: addLayer.softwareRendering
+ // Software Shape ignores empty clips. A cached image keeps
+ // this dashed path inside the inspector like the icons.
+ source: {
+ if (!visible || width <= 1 || height <= 1) return ""
+ const c = addLayer.outline
+ const paint = "rgb(" + Math.round(c.r * 255) + "," + Math.round(c.g * 255) + "," + Math.round(c.b * 255) + ")"
+ return "data:image/svg+xml;charset=utf-8," + encodeURIComponent(
+ '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">'
+ + '<rect x="0.5" y="0.5" width="' + (width-1) + '" height="' + (height-1)
+ + '" rx="10" fill="none" stroke="' + paint + '" stroke-opacity="' + c.a
+ + '" stroke-width="1" stroke-dasharray="5 4"/></svg>')
+ }
+ sourceSize.width: Math.max(1, Math.ceil(width * Screen.devicePixelRatio))
+ sourceSize.height: Math.max(1, Math.ceil(height * Screen.devicePixelRatio))
+ cache: true
+ }
+ Shape {
+ visible: !addLayer.softwareRendering
+ anchors.fill: parent
+ ShapePath {
+ strokeWidth: 1
+ strokeColor: addHover.hovered && !addLayer.full ? Theme.accent : Qt.rgba(1, 1, 1, 0.2)
+ fillColor: "transparent"
+ strokeStyle: ShapePath.DashLine
+ dashPattern: [5, 4]
+ PathRectangle {
+ x: 0; y: 0
+ width: addLayer.width
+ height: addLayer.height
+ radius: 10
+ }
+ }
+ }
+ Row {
+ anchors.centerIn: parent
+ spacing: 6
+ Text {
+ text: addLayer.label
+ color: addHover.hovered && !addLayer.full ? Theme.accent : Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ font.weight: Font.Medium
+ }
+ Text {
+ anchors.baseline: parent.children[0].baseline
+ text: addLayer.note
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ }
+ }
+ HoverHandler { id: addHover; cursorShape: addLayer.full ? Qt.ArrowCursor : Qt.PointingHandCursor }
+ TapHandler {
+ enabled: !addLayer.full
+ onTapped: addLayer.add()
+ }
+}
diff --git a/qml/Veyra/ProAudioPanel.qml b/qml/Veyra/ProAudioPanel.qml
new file mode 100644
index 00000000..2529729c
--- /dev/null
+++ b/qml/Veyra/ProAudioPanel.qml
@@ -0,0 +1,99 @@
+// Professional-view audioCol controls; settings remain in the shared bridge.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtQuick.Shapes
+import QtQuick.Effects
+
+ColumnLayout {
+ id: audioCol
+ Layout.fillWidth: true
+ spacing: 6
+ VGroup {
+ VRow {
+ label: qsTr("音量")
+ value: Math.round(veyra.volume * 100) + "%"
+ VSlider {
+ implicitWidth: 150
+ from: 0; to: 1; value: veyra.volume; inputScale: 100
+ onMoved: value => veyra.volume = value
+ }
+ }
+ VRow {
+ label: qsTr("静音")
+ VSwitch {
+ checked: veyra.muted
+ onToggled: checked => veyra.muted = checked
+ }
+ }
+ VRow {
+ label: qsTr("声音同步")
+ hint: veyra.audioSyncMode === 0 ? (veyra.audioSyncLive ? qsTr("软件估算补偿 ") + veyra.audioCompensationMs.toFixed(0) + " ms" : qsTr("自动估算 · 采集卡 / PS5 实时输入时生效"))
+ : veyra.audioSyncMode === 1 ? qsTr("手动偏移 · 实时输入时生效") : qsTr("关闭补偿")
+ VSeg {
+ options: [{ id: "0", label: qsTr("自动估算") }, { id: "1", label: qsTr("手动") }, { id: "2", label: qsTr("关闭", "off") }]
+ current: String(veyra.audioSyncMode)
+ onPicked: id => veyra.audioSyncMode = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("音频偏移")
+ hint: qsTr("正值延后音频")
+ value: veyra.audioOffsetMs + " ms"
+ VSlider {
+ implicitWidth: 150
+ center: true
+ from: -250; to: 250; value: veyra.audioOffsetMs; enabledControl: veyra.audioSyncMode === 1
+ onMoved: value => veyra.audioOffsetMs = Math.round(value)
+ }
+ }
+ }
+ VEyebrow { text: qsTr("音轨") }
+ Text {
+ visible: veyra.audioTracks.length === 0
+ text: qsTr("当前源没有可选音轨。")
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ }
+ Repeater {
+ model: veyra.audioTracks
+ delegate: Rectangle {
+ required property var modelData
+ Layout.fillWidth: true
+ implicitHeight: 44
+ radius: 12
+ color: Theme.card2
+ border.width: 1
+ border.color: veyra.selectedAudioTrack === modelData.index ? Theme.accent : Theme.stroke
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 12
+ anchors.rightMargin: 12
+ spacing: 12
+ VEqBars {
+ active: veyra.selectedAudioTrack === modelData.index && veyra.running && !veyra.paused
+ opacity: veyra.selectedAudioTrack === modelData.index ? 1 : 0.6
+ }
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 2
+ Text {
+ text: modelData.label
+ color: Theme.t1
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ }
+ Text {
+ text: modelData.channels > 0 ? modelData.channels + qsTr(" 声道") : ""
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ }
+ }
+ }
+ HoverHandler { cursorShape: Qt.PointingHandCursor }
+ TapHandler { onTapped: veyra.selectedAudioTrack = modelData.index }
+ }
+ }
+}
diff --git a/qml/Veyra/ProDisplayPanel.qml b/qml/Veyra/ProDisplayPanel.qml
new file mode 100644
index 00000000..c4c1b6c2
--- /dev/null
+++ b/qml/Veyra/ProDisplayPanel.qml
@@ -0,0 +1,698 @@
+// Professional-view displayCol controls; settings remain in the shared bridge.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtQuick.Shapes
+import QtQuick.Effects
+
+ColumnLayout {
+ id: displayCol
+ readonly property bool hdrMeterObserved: visible && hdrCurveAccordion.open && hdrReadAccordion.open && veyra.hdrCurve
+ Layout.fillWidth: true
+ spacing: 6
+ VGroup {
+ ProPresentationRows { }
+ VRow {
+ label: qsTr("原画 / 增强对比")
+ hint: (veyra.compareMode === 2 ? qsTr("在画面上按住左键拖动分割线:左边原画、右边增强。") : "") + (veyra.compareMode !== 0 ? qsTr("对比时补帧暂停,关闭对比后恢复") : "")
+ VSeg {
+ objectName: "display-compare"
+ options: [{ id: "0", label: qsTr("关闭", "off") }, { id: "2", label: qsTr("分屏") }, { id: "1", label: qsTr("只看原画") }]
+ current: String(veyra.compareMode)
+ onPicked: id => veyra.compareMode = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("对照底图")
+ hint: qsTr("低延迟 NR 先行时,“增强前底图”是原图缩放,不是独立超分对照")
+ visible: veyra.compareMode !== 0
+ VSeg {
+ objectName: "display-compare-base"
+ options: [{ id: "0", label: qsTr("输入原画") }, { id: "1", label: qsTr("增强前底图") }]
+ current: veyra.compareBase ? "1" : "0"
+ onPicked: id => veyra.compareBase = id === "1"
+ }
+ }
+ VRow {
+ label: qsTr("按住 V 查看原画")
+ hint: qsTr("按键可在 设置 → 快捷键 里改")
+ VSwitch {
+ objectName: "display-hold-compare"
+ checked: veyra.preferences.holdCompare !== false
+ onToggled: checked => veyra.setPreference("holdCompare", checked)
+ }
+ }
+ VRow {
+ label: qsTr("画面比例")
+ hint: veyra.aspectMode === 1 ? qsTr("原始 = 一个输出像素对一个屏幕像素") : veyra.aspectMode === 2 ? qsTr("填满窗口,超出部分裁掉") : ""
+ VSelect {
+ objectName: "display-aspect"
+ options: [{ id: "0", label: qsTr("适应") }, { id: "1", label: qsTr("原始像素") }, { id: "2", label: qsTr("填充裁切") }, { id: "3", label: qsTr("拉伸铺满") }, { id: "4", label: "16:9" }, { id: "5", label: "4:3" }, { id: "6", label: "21:9" }]
+ value: options[veyra.aspectMode].label
+ onPicked: id => veyra.aspectMode = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("强制 SDR 预览")
+ hint: qsTr("HDR 片源也按 SDR 显示;与采集卡的“转为 SDR 显示”是同一设置")
+ VSwitch {
+ objectName: "display-force-sdr"
+ checked: veyra.captureForceSdr
+ onToggled: checked => veyra.captureForceSdr = checked
+ }
+ }
+ VRow {
+ label: qsTr("HDR 输出格式")
+ hint: qsTr("补帧路径固定 HDR10;需要 Windows HDR 开启")
+ VSeg { objectName: "display-hdr-output"; options: [{id:"0",label:"HDR10"},{id:"1",label:qsTr("scRGB 浮点")}]; current: String(veyra.hdrOutputMode); onPicked: id => veyra.hdrOutputMode = Number(id) }
+ }
+
+ // HDR 亮度曲线: a static curve. Unlike a plain exposure the
+ // highlights are protected by construction.
+ VAccordion {
+ id: hdrCurveAccordion
+ objectName: "list-hdr-curve"
+ Layout.fillWidth: true
+ glyph: "sun"
+ hue: "#F5C84B"
+ title: qsTr("HDR 亮度曲线")
+ summary: veyra.hdrCurve ? qsTr("已开启") : qsTr("已关闭")
+ on: veyra.hdrCurve
+ onToggled: on => veyra.hdrCurve = on
+ // 曲线图(自定义):由 C++ 用与着色器相同的公式采样,
+ // 虚线是"不做任何处理"的参考线,橙线是当前曲线。
+
+ VAccordion {
+ id: hdrReadAccordion
+ objectName: "list-hdr-readgroup"
+ Layout.fillWidth: true
+ glyph: "activity"
+ hue: "#F5C84B"
+ Layout.topMargin: 8
+ enabledSwitch: false
+ open: true
+ title: qsTr("曲线图、读数与提示")
+ summary: qsTr("2 项")
+ // GPU 抽样统计:本卡可见且输出曲线生效时至多每秒 4 次。
+ VRow {
+ hintBelow: true
+ objectName: "list-hdrcurve-live"
+ label: qsTr("画面抽样统计")
+ hint: !veyra.hdrCurveCoverage.valid
+ ? qsTr("展开本卡片并播放 HDR 输出时测量,每秒最多 4 次")
+ : veyra.hdrPeakWarning.capNits === 0
+ ? qsTr("曲线未设「峰值上限」,不会有像素被压平。滚降区 %1% · 暗部提升区 %2%")
+ .arg(Number(veyra.hdrCurveCoverage.rollOff).toFixed(1))
+ .arg(Number(veyra.hdrCurveCoverage.lift).toFixed(1))
+ : veyra.hdrCurveCoverage.aboveCeiling <= 0.0
+ ? qsTr("上限 %1 nit 未被触及(滚降区 %2% · 暗部提升区 %3%)")
+ .arg(veyra.hdrPeakWarning.capNits)
+ .arg(Number(veyra.hdrCurveCoverage.rollOff).toFixed(1))
+ .arg(Number(veyra.hdrCurveCoverage.lift).toFixed(1))
+ : qsTr("触及硬上限 %1% · 高光压缩区 %2% · 暗部提升区 %3%")
+ .arg(Number(veyra.hdrCurveCoverage.aboveCeiling).toFixed(1))
+ .arg(Number(veyra.hdrCurveCoverage.rollOff).toFixed(1))
+ .arg(Number(veyra.hdrCurveCoverage.lift).toFixed(1))
+ value: !veyra.hdrCurveCoverage.valid ? qsTr("—")
+ : veyra.hdrPeakWarning.capNits === 0 ? qsTr("未设上限")
+ : veyra.hdrCurveCoverage.aboveCeiling > 5 ? qsTr("偏高")
+ : veyra.hdrCurveCoverage.aboveCeiling > 0 ? qsTr("轻微") : qsTr("未触及")
+ }
+ // 高光预警(自定义):片源峰值 vs 曲线生效后的硬上限。
+ VRow {
+ objectName: "list-hdrcurve-peakwarning"
+ label: qsTr("高光预警")
+ hint: !veyra.hdrSourceInfo.valid ? qsTr("片源没有携带亮度信息")
+ : !veyra.hdrPeakWarning.valid ? qsTr("曲线未开启")
+ : veyra.hdrPeakWarning.capNits === 0 ? qsTr("曲线没有设硬上限,不会裁剪片源峰值")
+ : qsTr("片源最亮 %1 nit,曲线硬上限 %2 nit:%3")
+ .arg(veyra.hdrPeakWarning.sourcePeakNits)
+ .arg(veyra.hdrPeakWarning.capNits)
+ .arg(veyra.hdrPeakWarning.clipped
+ ? qsTr("超过上限的亮度需要压缩;是否触及硬上限以抽样读数为准")
+ : qsTr("上限覆盖片源标注峰值;处理后的画面以抽样读数为准"))
+ value: !veyra.hdrSourceInfo.valid || !veyra.hdrPeakWarning.valid ? qsTr("—")
+ : veyra.hdrPeakWarning.clipped ? qsTr("会压缩") : qsTr("安全")
+ }
+ Canvas {
+ id: hdrCurveCanvas
+ Layout.fillWidth: true
+ Layout.preferredHeight: 92
+ onWidthChanged: requestPaint()
+ Component.onCompleted: requestPaint()
+ Connections {
+ target: veyra
+ function onSettingsChanged() { hdrCurveCanvas.requestPaint() }
+ }
+ onPaint: {
+ var ctx = getContext("2d");
+ var w = width, h = height;
+ ctx.clearRect(0, 0, w, h);
+ var g = veyra.hdrCurveGraph;
+ if (!g || !g.inputs || g.inputs.length < 2) return;
+ var minN = g.minNits, maxN = g.maxNits;
+ function px(n) {
+ var v = Math.max(n, minN) / minN;
+ return Math.log(v) / Math.log(maxN / minN);
+ }
+ // 参考线:未启用任何调整时曲线与它重合
+ ctx.strokeStyle = Theme.t3;
+ ctx.lineWidth = 1;
+ ctx.beginPath();
+ ctx.moveTo(0, h); ctx.lineTo(w, 0); ctx.stroke();
+ // 当前曲线
+ ctx.strokeStyle = g.enabled ? "#F5C84B" : Theme.t3;
+ ctx.lineWidth = 2;
+ ctx.beginPath();
+ for (var i = 0; i < g.inputs.length; ++i) {
+ var X = px(g.inputs[i]) * w;
+ var Y = h - px(g.outputs[i]) * h;
+ if (i === 0) ctx.moveTo(X, Y); else ctx.lineTo(X, Y);
+ }
+ ctx.stroke();
+ }
+ }
+ // 一键按片源选档(自定义):用片源自带的峰值 / 平均亮度
+ // 决定档位与强度,界面只解释理由,不做测量。
+ Text {
+ Layout.fillWidth: true
+ text: qsTr("曲线作用于 HDR10 或 scRGB 输出,也适用于 RTX Video HDR 转换后的画面。低亮度画面可能不会触及高光阈值。")
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ }
+ VAccordion {
+ objectName: "list-hdr-pickgroup"
+ Layout.fillWidth: true
+ glyph: "wand"
+ hue: "#A78BFA"
+ Layout.topMargin: 8
+ enabledSwitch: false
+ open: true
+ title: qsTr("一键选档")
+ summary: qsTr("4 项")
+ // 选档方式(自定义):整档预设 / 自由组合。两套写的是同一条曲线,
+ // 所以切换只影响界面,不影响存档或画面。
+ VRow {
+ hintBelow: true
+ label: qsTr("按片源自动选档")
+ hint: {
+ if (!veyra.hdrRecommendation.available)
+ return veyra.sourceIsSdr
+ ? qsTr("SDR 片源没有 HDR 亮度元数据;可手动选档,HDR 输出时生效。")
+ : qsTr("片源没有携带亮度信息(抓屏 / 串流),无法自动选档");
+ var r = veyra.hdrRecommendation.reason;
+ var why = r === "dark-content" ? qsTr("整片偏暗、只有少量亮点")
+ : r === "bright-content" ? qsTr("高光又亮又多")
+ : r === "narrow-range" ? qsTr("母版峰值偏低(老片 / 转制片)")
+ : r === "beyond-display" ? qsTr("内容亮度远超显示设备能力")
+ : r === "dark-and-bright" ? qsTr("整片偏暗,且超出显示设备能力")
+ : qsTr("亮度分布均衡");
+ var axes = veyra.hdrPresetMode === "axes";
+ var pick = axes
+ ? (r === "dark-content" ? qsTr("内容:暗场多")
+ : r === "bright-content" ? qsTr("内容:高光强")
+ : r === "beyond-display" ? qsTr("内容:高光强")
+ : r === "dark-and-bright" ? qsTr("内容:两头极端")
+ : r === "narrow-range" ? qsTr("内容:老片平淡")
+ : qsTr("内容:标准"))
+ : (r === "dark-content" ? qsTr("暗场提亮")
+ : r === "bright-content" ? qsTr("高光保护")
+ : r === "beyond-display" ? qsTr("高光保护")
+ : r === "dark-and-bright" ? qsTr("暗亮双修")
+ : r === "narrow-range" ? qsTr("强化冲击") : qsTr("标准"));
+ return why + qsTr(" → 建议 ") + pick
+ + qsTr("(片源最亮 %1 nit、最亮帧平均 %2 nit)")
+ .arg(veyra.hdrRecommendation.cllNits)
+ .arg(veyra.hdrRecommendation.fallNits);
+ }
+ VButton {
+
+
+ objectName: "list-hdrcurve-auto"
+ text: qsTr("一键推荐")
+ ghost: true
+ enabled: veyra.hdrRecommendation.available
+ onClicked: veyra.applyRecommendedHdrTuning()
+ }
+ }
+
+ Text {
+ Layout.fillWidth: true
+ visible: true
+ text: qsTr("选档方式:两种选法写的是同一条曲线,切换只影响界面上怎么叫它")
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ Flow {
+ objectName: "list-hdrcurve-mode"
+ Layout.fillWidth: true
+ visible: true
+ Layout.preferredHeight: implicitHeight
+ spacing: 6
+ Repeater {
+ model: [{id:"legacy",label:qsTr("整档预设")}, {id:"axes",label:qsTr("自由组合")}]
+ delegate: VButton {
+ required property var modelData
+ text: modelData.label
+ ghost: true
+ primary: veyra.hdrPresetMode === modelData.id
+ onClicked: veyra.hdrPresetMode = modelData.id
+ }
+ }
+ }
+
+ // One-click presets: pick the one that matches the film.
+ Flow {
+ visible: veyra.hdrPresetMode === "legacy"
+ Layout.fillWidth: true
+ Layout.preferredHeight: implicitHeight
+ spacing: 6
+ Repeater {
+ model: [{id:"standard",label:qsTr("标准")},
+ {id:"darkLift",label:qsTr("暗场提亮")},
+ {id:"highlightGuard",label:qsTr("高光保护")},
+ {id:"darkAndBright",label:qsTr("暗亮双修")},
+ {id:"brightRoom",label:qsTr("明亮环境")},
+ {id:"darkRoom",label:qsTr("暗室观影")},
+ {id:"punch",label:qsTr("强化冲击")}]
+ delegate: VButton {
+ required property var modelData
+ text: modelData.label
+ ghost: true
+ // 两套预设写的是同一条曲线,所以数值上可能同时匹配(「不补偿」时自由组合就等于整档预设)。
+ // 只让当前模式那一行点亮,免得看起来像两个模式同时生效。
+ primary: veyra.hdrAppliedFrom !== "axes" && veyra.hdrTuningPreset === modelData.id
+ onClicked: { veyra.hdrPresetMode = "legacy"; veyra.applyHdrTuningPreset(modelData.id) }
+ }
+ }
+ }
+ Text {
+ visible: veyra.hdrPresetMode === "legacy"
+ Layout.fillWidth: true
+ text: veyra.hdrTuningPreset === "darkLift" ? qsTr("提亮暗部与中间调,保留高光峰值。")
+ : veyra.hdrTuningPreset === "highlightGuard" ? qsTr("高光很亮的片子(雪景/爆炸/演唱会):压住顶部,暗部不动。")
+ : veyra.hdrTuningPreset === "darkAndBright" ? qsTr("暗场很暗、亮场又很亮的片子:两头都照顾。")
+ : veyra.hdrTuningPreset === "brightRoom" ? qsTr("白天或亮环境看片:整体提亮一些。")
+ : veyra.hdrTuningPreset === "darkRoom" ? qsTr("夜里关灯看:柔和一点,同时保留暗部细节。")
+ : veyra.hdrTuningPreset === "punch" ? qsTr("画面偏灰、平淡的老片或转制片:提高对比观感。")
+ : veyra.hdrTuningPreset === "standard" ? qsTr("曲线保持原样,HDR10 元数据跟随片源。")
+ : qsTr("自定义:已用下面的滑块微调过。")
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ Text {
+ Layout.fillWidth: true
+ visible: veyra.hdrPresetMode === "axes"
+ text: qsTr("内容:这部片子属于哪一类")
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ Flow {
+ objectName: "list-hdrcurve-content"
+ Layout.fillWidth: true
+ visible: veyra.hdrPresetMode === "axes"
+ Layout.preferredHeight: implicitHeight
+ spacing: 6
+ Repeater {
+ model: [{id:"standard",label:qsTr("标准")}, {id:"dark",label:qsTr("暗场多")}, {id:"highlight",label:qsTr("高光强")}, {id:"darkAndBright",label:qsTr("两头极端")}, {id:"punch",label:qsTr("老片平淡")}]
+ delegate: VButton {
+ required property var modelData
+ text: modelData.label
+ ghost: true
+ // 只按曲线实际等于哪个组合点亮:当前是整档预设(或手动微调过)时不亮任何一项,
+ // 与整档预设显示"自定义"的行为一致。
+ primary: veyra.hdrAppliedFrom === "axes" && veyra.hdrAxesMatch.content === modelData.id
+ onClicked: { veyra.hdrPresetMode = "axes"; veyra.applyHdrAxesPreset(modelData.id, veyra.hdrAxes.environment !== "" ? veyra.hdrAxes.environment : "compensate"); }
+ }
+ }
+ }
+ Text {
+ Layout.fillWidth: true
+ visible: veyra.hdrPresetMode === "axes"
+ text: qsTr("环境光补偿:屋里亮(开灯/白天)就补偿一点,屋里暗(关灯)就不补偿")
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ Flow {
+ objectName: "list-hdrcurve-environment"
+ Layout.fillWidth: true
+ visible: veyra.hdrPresetMode === "axes"
+ Layout.preferredHeight: implicitHeight
+ spacing: 6
+ Repeater {
+ model: [{id:"compensate",label:qsTr("提亮补偿")}, {id:"plain",label:qsTr("不补偿")}]
+ delegate: VButton {
+ required property var modelData
+ text: modelData.label
+ ghost: true
+ primary: veyra.hdrAppliedFrom === "axes" && veyra.hdrAxesMatch.environment === modelData.id
+ onClicked: { veyra.hdrPresetMode = "axes"; veyra.applyHdrAxesPreset(veyra.hdrAxesMatch.content !== "" ? veyra.hdrAxesMatch.content : (veyra.hdrAxes.content !== "" ? veyra.hdrAxes.content : "standard"), modelData.id); }
+ }
+ }
+ }
+ // 当前生效状态(自定义):整档预设模式下说明当前是哪一档;手动微调过
+ // (不匹配任何整档预设)时明确说"自定义",免得看起来像没生效。
+ Text {
+ Layout.fillWidth: true
+ visible: veyra.hdrPresetMode !== "axes"
+ objectName: "list-hdrcurve-active-preset"
+ text: veyra.hdrTuningPreset !== "custom"
+ ? qsTr("当前生效:整档预设「%1」").arg(
+ veyra.hdrTuningPreset === "darkLift" ? qsTr("暗场提亮")
+ : veyra.hdrTuningPreset === "highlightGuard" ? qsTr("高光保护")
+ : veyra.hdrTuningPreset === "darkAndBright" ? qsTr("暗亮双修")
+ : veyra.hdrTuningPreset === "brightRoom" ? qsTr("明亮环境")
+ : veyra.hdrTuningPreset === "darkRoom" ? qsTr("暗室观影")
+ : veyra.hdrTuningPreset === "punch" ? qsTr("强化冲击")
+ : qsTr("标准"))
+ : qsTr("当前生效:自定义微调(未匹配任何整档预设)")
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ // 当前组合(自定义):自由组合模式下说清楚现在选的是哪两项 —— 手动微调
+ // 过参数后没有匹配项,这一行仍然在,不会看起来像"没生效"。
+ Text {
+ Layout.fillWidth: true
+ visible: veyra.hdrPresetMode === "axes"
+ text: qsTr("当前组合:内容 %1 · 环境 %2").arg(
+ veyra.hdrAxes.content === "dark" ? qsTr("暗场多")
+ : veyra.hdrAxes.content === "highlight" ? qsTr("高光强")
+ : veyra.hdrAxes.content === "darkAndBright" ? qsTr("两头极端")
+ : veyra.hdrAxes.content === "punch" ? qsTr("老片平淡")
+ : qsTr("标准")).arg(
+ veyra.hdrAxes.environment === "compensate" ? qsTr("提亮补偿")
+ : qsTr("不补偿"))
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ // 等价说明(自定义):两套预设写的是同一条曲线,「不补偿」时两轴组合与
+ // 整档预设数值完全相同,所以这里把等价关系直接说出来,省得看起来像两个模式
+ // 同时生效。手动微调过的曲线不匹配任何整档预设,这句话自然消失。
+ Text {
+ Layout.fillWidth: true
+ objectName: "list-hdrcurve-equivalent"
+ visible: veyra.hdrPresetMode === "axes" && veyra.hdrTuningPreset !== "custom"
+ text: qsTr("这条曲线目前也等同于整档预设「%1」").arg(
+ veyra.hdrTuningPreset === "darkLift" ? qsTr("暗场提亮")
+ : veyra.hdrTuningPreset === "highlightGuard" ? qsTr("高光保护")
+ : veyra.hdrTuningPreset === "darkAndBright" ? qsTr("暗亮双修")
+ : veyra.hdrTuningPreset === "brightRoom" ? qsTr("明亮环境")
+ : veyra.hdrTuningPreset === "darkRoom" ? qsTr("暗室观影")
+ : veyra.hdrTuningPreset === "punch" ? qsTr("强化冲击")
+ : qsTr("标准"))
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ }
+ VAccordion {
+ objectName: "list-hdr-basegroup"
+ Layout.fillWidth: true
+ glyph: "sliders"
+ hue: "#4F7BFF"
+ Layout.topMargin: 8
+ enabledSwitch: false
+ open: true
+ title: qsTr("基础设置")
+ summary: qsTr("5 项")
+ VRow {
+ hintBelow: true
+ label: qsTr("总体强度")
+ hint: qsTr("调整力度;0% 关闭曲线")
+ value: veyra.hdrCurveStrength + "%"
+ VSlider {
+ objectName: "list-hdrcurve-strength"
+ implicitWidth: 120
+ valueFromModel: true
+ resettable: true; defaultValue: 100
+ from: 0; to: 200
+ value: veyra.hdrCurveStrength
+ onMoved: value => veyra.hdrCurveStrength = Math.round(value)
+ }
+ }
+
+ // 人话滑杆(自定义):技术参数翻译成三根好懂的滑杆,
+ // 精确参数仍在下面的「高级」里。
+ VRow {
+ hintBelow: true
+ label: qsTr("暗部提亮")
+ hint: qsTr("拉亮暗部")
+ // 档位只是快捷方式:同时给出真实参数,避免"碰一下跳值"的困惑。
+ value: (Number(veyra.hdrCurveParams.shadowLiftEv100 ?? 0) / 100).toFixed(2) + " EV"
+ VSlider {
+ objectName: "list-hdrcurve-dial-lift"
+ implicitWidth: 120
+ valueFromModel: true
+ resettable: true; defaultValue: 0
+ from: 0; to: 10
+ value: veyra.hdrDials.shadowLift
+ onMoved: value => veyra.setHdrDial("shadowLift", Math.round(value))
+ }
+ }
+ VRow {
+ hintBelow: true
+ label: qsTr("整体观感")
+ hint: qsTr("整体亮暗")
+ value: (veyra.hdrCurveParams.midGrayNits ?? "—") + " nit"
+ VSlider {
+ objectName: "list-hdrcurve-dial-brightness"
+ implicitWidth: 120
+ valueFromModel: true
+ resettable: true; defaultValue: 3
+ from: 0; to: 10
+ value: veyra.hdrDials.brightness
+ onMoved: value => veyra.setHdrDial("brightness", Math.round(value))
+ }
+ }
+ VRow {
+ hintBelow: true
+ label: qsTr("高光保护")
+ hint: qsTr("压住高光")
+ value: [qsTr("关"),qsTr("弱"),qsTr("中"),qsTr("强")][Math.max(0,Math.min(3,veyra.hdrDials.highlight))]
+ VSlider {
+ objectName: "list-hdrcurve-dial-highlight"
+ implicitWidth: 120
+ valueFromModel: true
+ resettable: true; defaultValue: 0
+ from: 0; to: 3
+ value: veyra.hdrDials.highlight
+ onMoved: value => veyra.setHdrDial("highlight", Math.round(value))
+ }
+ }
+ VRow {
+ hintBelow: true
+ label: qsTr("显示峰值")
+ hint: qsTr("我的屏能到多少 nit;0 = 自动")
+ value: veyra.hdrDisplayPeakNits > 0
+ ? (veyra.hdrDisplayPeakNits + " nit") : qsTr("自动")
+ VSlider {
+ objectName: "list-hdrcurve-displaypeak"
+ implicitWidth: 120
+ valueFromModel: true
+ resettable: true; defaultValue: 0
+ from: 0; to: 4000
+ value: veyra.hdrDisplayPeakNits
+ onMoved: value => veyra.hdrDisplayPeakNits = Math.round(value)
+ }
+ }
+
+ // The display's own report, kept at the card's foot like the author's section notes.
+ Text {
+ Layout.fillWidth: true
+ visible: veyra.hdrDisplayInfo.valid
+ text: qsTr("系统报告:峰值 %1、全屏 %2、黑位 %3 nit")
+ .arg(veyra.hdrDisplayInfo.peakNits)
+ .arg(veyra.hdrDisplayInfo.fullFrameNits)
+ .arg(Number(veyra.hdrDisplayInfo.minNits).toFixed(3))
+ + " · " + qsTr("系统数值不是实测;不符时可手动填写峰值")
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ }
+
+ // The two dials. Both scale the baseline the sliders below
+ // edit, which is why moving either of them keeps the preset
+ // above selected instead of falling back to "自定义".
+ // Advanced technical parameters (custom): the exact values behind the three
+ // dials above. Collapsed by default so the panel stays readable.
+ // Advanced parameters (custom): the exact values behind the three dials above,
+ // in the author's own collapsible-group style (label + chevron, no switch).
+ VAccordion {
+ objectName: "list-hdr-advanced"
+ Layout.fillWidth: true
+ glyph: "settings"
+ hue: "#8A93A6"
+ Layout.topMargin: 8
+ enabledSwitch: false
+ open: false
+ title: qsTr("高级设置:技术参数")
+ summary: qsTr("6 项")
+ Text {
+ Layout.fillWidth: true
+ text: qsTr("这里是「基础设置」里 暗部提亮、整体观感、高光保护 这三项的精确数值版(强度与显示峰值不在此列,它们本身就是直接调节)。")
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ Repeater {
+ model: [{key:"shadowLiftEv100",label:qsTr("暗部抬升"),from:-200,to:200,def:0,hint:qsTr("单位 0.01 EV:正值提亮暗部,负值压暗")},
+ {key:"shadowRangeNits",label:qsTr("抬升范围 (nit)"),from:1,to:100,def:10,hint:qsTr("只在这个亮度以下的暗部生效")},
+ {key:"midGrayNits",label:qsTr("中灰 (nit)"),from:100,to:500,def:203,hint:qsTr("203 = 中性;调高整体变亮,峰值不变")},
+ {key:"highlightStartNits",label:qsTr("高光起点 (nit)"),from:0,to:2000,def:0,hint:qsTr("0 = 不做高光滚降")},
+ {key:"rollOffPercent",label:qsTr("滚降强度 (%)"),from:10,to:200,def:100,hint:qsTr("数值越大,高光过渡越平缓")},
+ {key:"peakCapNits",label:qsTr("峰值上限 (nit)"),from:0,to:4000,def:0,hint:qsTr("0 = 不限制")}]
+ delegate: VRow {
+ hintBelow: true
+ required property var modelData
+ label: modelData.label
+ hint: modelData.hint || ""
+ value: String(veyra.hdrCurveParams[modelData.key] ?? "—")
+ VSlider {
+ objectName: "list-hdrcurve-" + modelData.key
+ implicitWidth: 120
+ valueFromModel: true
+ resettable: true; defaultValue: modelData.def
+ from: modelData.from; to: modelData.to
+ value: veyra.hdrCurveParams[modelData.key] ?? modelData.def
+ onMoved: value => veyra.setHdrCurveParameter(modelData.key, Math.round(value))
+ }
+ }
+ }
+ }
+ VAccordion {
+ objectName: "list-hdr-memory-group"
+ Layout.fillWidth: true
+ glyph: "clock"
+ hue: "#4FD1A5"
+ Layout.topMargin: 8
+ enabledSwitch: false
+ open: false
+ title: qsTr("记忆与自动化")
+ summary: qsTr("4 项")
+ // 记忆与自动化(自定义)
+ // 每台显示设备一套配置(自定义):按显示器身份记住曲线,
+ // 换设备(投影仪 / 电视)时自动套用那台设备上的设置。
+ VRow {
+ hintBelow: true
+ label: qsTr("按显示设备记忆")
+ hint: veyra.hdrDisplayProfileCount > 0
+ ? qsTr("已记住 %1 台显示设备的曲线配置,切换显示器时自动套用")
+ .arg(veyra.hdrDisplayProfileCount)
+ : qsTr("改动曲线后会按当前显示器记住,换设备时自动套用")
+ value: veyra.hdrDisplayProfileCount > 0 ? qsTr("已启用") : qsTr("—")
+ VButton {
+ objectName: "list-hdrcurve-forget"
+ text: qsTr("清除记忆")
+ ghost: true
+ enabled: veyra.hdrDisplayProfileCount > 0
+ onClicked: veyra.forgetHdrDisplayProfiles()
+ }
+ }
+ VRow {
+ hintBelow: true
+ label: qsTr("记住每部影片")
+ hint: veyra.hdrTitleCount > 0
+ ? qsTr("已记住 %1 部影片,下次播放自动套用").arg(veyra.hdrTitleCount)
+ : qsTr("改动曲线后按影片记住,下次自动套用")
+ value: veyra.hdrTitleMemory ? qsTr("已开启") : qsTr("已关闭")
+ VSwitch {
+ objectName: "list-hdrcurve-titlememory"
+ checked: veyra.hdrTitleMemory
+ onToggled: checked => veyra.hdrTitleMemory = checked
+ }
+ }
+ VRow {
+ hintBelow: true
+ label: qsTr("开播自动选档")
+ hint: qsTr("打开片子时按片源自动选一次;有影片记忆时以记忆为准")
+ value: veyra.hdrAutoRecommend ? qsTr("已开启") : qsTr("已关闭")
+ VSwitch {
+ objectName: "list-hdrcurve-autorecommend"
+ checked: veyra.hdrAutoRecommend
+ onToggled: checked => veyra.hdrAutoRecommend = checked
+ }
+ }
+ VRow {
+ hintBelow: true
+ label: qsTr("清除影片记忆")
+ hint: qsTr("只清影片记忆,不动显示设备记忆")
+ VButton {
+ objectName: "list-hdrcurve-forget-titles"
+ text: qsTr("清除")
+ ghost: true
+ enabled: veyra.hdrTitleCount > 0
+ onClicked: veyra.forgetHdrTitles()
+ }
+ }
+ }
+ }
+
+ VAccordion {
+ objectName: "list-hdr-metadata"
+ Layout.fillWidth: true
+ Layout.topMargin: 12
+ glyph: "sun"
+ hue: "#7FB2F5"
+ title: qsTr("HDR 元数据")
+ summary: veyra.hdrMetadataEnabled ? qsTr("已启用(HDR10)") : qsTr("已关闭")
+ on: veyra.hdrMetadataEnabled
+ onToggled: on => veyra.hdrMetadataEnabled = on
+ Text {
+ Layout.fillWidth: true
+ text: qsTr("HDR10 提示;系统或显示器可能忽略,让它的动态色调映射有依据。")
+ + qsTr("曲线生效时会约束内容亮度提示;SDR 输入默认不发送,手动填写除外。")
+ wrapMode: Text.WordWrap
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ }
+ Repeater {
+ model: [{key:"masteringPeakNits",label:qsTr("母版峰值 (nit)"),from:0,to:4000,def:0,hint:qsTr("0 = 跟随片源;实际效果取决于显示设备")},
+ {key:"maxCllNits",label:qsTr("MaxCLL (nit)"),from:0,to:4000,def:0,hint:qsTr("0 = 跟随片源")},
+ {key:"maxFallNits",label:qsTr("MaxFALL (nit)"),from:0,to:4000,def:0,hint:qsTr("0 = 跟随片源")}]
+ delegate: VRow {
+ required property var modelData
+ label: modelData.label
+ hint: modelData.hint || ""
+ value: String(veyra.hdrMetadataParams[modelData.key] ?? "—")
+ VSlider {
+ objectName: "list-hdrmeta-" + modelData.key
+ implicitWidth: 120
+ valueFromModel: true
+ resettable: true; defaultValue: modelData.def
+ from: modelData.from; to: modelData.to
+ value: veyra.hdrMetadataParams[modelData.key] ?? modelData.def
+ onMoved: value => veyra.setHdrMetadataParameter(modelData.key, Math.round(value))
+ }
+ }
+ }
+ }
+ }
+ VGroup {
+ VRow {
+ label: qsTr("提交帧率")
+ value: veyra.submitFpsKnown ? veyra.submitFps.toFixed(2) : qsTr("未测量")
+ }
+ VRow {
+ label: qsTr("显示帧率")
+ hint: qsTr("需要系统显示事件才能测得真实值;取不到时显示未测")
+ value: veyra.displayFpsKnown ? veyra.displayFps.toFixed(2) : qsTr("未测")
+ }
+ VRow {
+ label: qsTr("晚点 P95")
+ value: veyra.lateP95Ms.toFixed(2) + " ms"
+ }
+ VRow {
+ label: qsTr("调度等待 P95")
+ value: veyra.scheduleP95Ms.toFixed(2) + " ms"
+ }
+ }
+}
diff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qml
index e92fde46..a5a84ab4 100644
--- a/qml/Veyra/ProPage.qml
+++ b/qml/Veyra/ProPage.qml
@@ -25,7 +25,7 @@ VPage {
// to the left of the picture, with the performance orbs beside it. Both are cut
// out of the native video window like any other cover.
property bool overlay: false
- readonly property bool hdrMeterObserved: visible && tab === "display" && hdrCurveAccordion.open && hdrReadAccordion.open && veyra.hdrCurve
+ readonly property bool hdrMeterObserved: visible && tab === "display" && displayCol.hdrMeterObserved
onHdrMeterObservedChanged: veyra.observeHdrCoverage(hdrMeterObserved)
function overlayContains(x, y) {
const hit = item => x >= item.x && x <= item.x + item.width && y >= item.y && y <= item.y + item.height
@@ -129,241 +129,20 @@ VPage {
// The NR layer card wraps the shared editor (NrLayerEditor.qml).
// 显示同步 and 输出上限 (1.4.4 PresentationSettings), shared by the list 补帧
// page and the node editor's output box (ProPage.PresentationRows).
- component PresentationRows: ColumnLayout {
- Layout.fillWidth: true
- spacing: 0
- VRow {
- label: qsTr("显示同步")
- hint: qsTr("自动(推荐):不撕裂,也不等待垂直同步,每次刷新显示最新一帧,延迟最低 · 垂直同步:每帧都等到刷新才显示,比自动多等最多一个刷新 · 允许撕裂:可能出现撕裂线")
- VSeg {
- objectName: "presentation-display-sync"
- options: [{ id: "0", label: qsTr("允许撕裂") }, { id: "1", label: qsTr("垂直同步") }, { id: "2", label: qsTr("自动") }]
- current: String(veyra.displaySync)
- onPicked: id => veyra.displaySync = Number(id)
- }
- }
- // 可变刷新 (G-SYNC / FreeSync): the switch greys when the monitor cannot
- // do it. The state is read on events only; 刷新显示器状态 in the 信号
- // card asks the driver again.
- VRow {
- label: qsTr("可变刷新")
- hint: veyra.vrrHint
- VSwitch {
- objectName: "presentation-vrr"
- enabled: veyra.vrrState >= 2
- opacity: enabled ? 1 : 0.5
- checked: veyra.variableRefresh
- onToggled: checked => veyra.variableRefresh = checked
- }
- }
- VRow {
- label: qsTr("输出上限")
- enabled: !veyra.presentationOwned
- hint: veyra.presentationStatus
- VSeg {
- objectName: "presentation-output-rate"
- options: [{ id: "0", label: qsTr("关闭", "off") }, { id: "1", label: qsTr("跟随显示器") }, { id: "2", label: qsTr("自定义") }]
- current: String(veyra.outputRateMode)
- onPicked: id => veyra.outputRateMode = Number(id)
- }
- }
- VRow {
- label: qsTr("自定义上限")
- enabled: !veyra.presentationOwned
- visible: veyra.outputRateMode === 2
- RowLayout {
- spacing: 6
- DialogHost.VTextField {
- objectName: "presentation-custom-fps"
- implicitWidth: 90
- text: veyra.outputCustomFps.toFixed(3)
- onEdited: text => { const v = Number(text); if (isFinite(v)) veyra.outputCustomFps = v }
- }
- Text { text: "FPS"; color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: 11 }
- }
- }
- }
+ component PresentationRows: ProPresentationRows {}
// A performance orb: a ring filled to `fraction` (green under 70 %, amber
// under 100 %, red above), the value in the middle, the label under it.
// Shared with the node page as ProPage.PerfOrb.
- component PerfOrb: Item {
- id: orb
- property real fraction: 0
- property bool known: false
- property string value: "—"
- property string label: ""
- property string tip: ""
- property int size: 56
- // Compact (the node page's 40px bar): no label under the ring; the
- // tooltip names the orb instead.
- property bool showLabel: true
- readonly property color tone: !known ? Qt.rgba(1, 1, 1, 0.25)
- : fraction < 0.7 ? Theme.ok : fraction < 1.0 ? "#F2B941" : Theme.err
- implicitWidth: Math.max(size, labelText.implicitWidth)
- implicitHeight: showLabel ? size + 4 + labelText.implicitHeight : size
- // The ring is only a few dozen pixels across. Sub-percent changes do
- // not add visible information; the numeric label retains full precision.
- readonly property real shown: Math.round(telemetry.value * 100) / 100
- VTelemetryValue {
- id: telemetry
- targetValue: orb.known ? Math.min(1, Math.max(0, orb.fraction)) : 0
- animate: orb.visible && !Theme.reduced && (!veyra.paused || (typeof vyTest !== "undefined" && vyTest.disablePausedUiIdle === true))
- duration: 600
- }
- onShownChanged: ring.requestPaint()
- onToneChanged: ring.requestPaint()
- Canvas {
- id: ring
- width: orb.size; height: orb.size
- anchors.horizontalCenter: parent.horizontalCenter
- onPaint: {
- const c = getContext("2d"); c.reset()
- const r = width / 2 - 4, cx = width / 2, cy = height / 2
- c.lineWidth = 5; c.lineCap = "round"
- c.strokeStyle = Qt.rgba(1, 1, 1, 0.08)
- c.beginPath(); c.arc(cx, cy, r, 0, Math.PI * 2); c.stroke()
- if (orb.shown > 0.001) {
- c.strokeStyle = orb.tone
- c.shadowColor = orb.tone; c.shadowBlur = 8
- c.beginPath(); c.arc(cx, cy, r, -Math.PI / 2, -Math.PI / 2 + Math.PI * 2 * orb.shown); c.stroke()
- }
- }
- }
- Text {
- anchors.centerIn: ring
- width: orb.size - 12
- horizontalAlignment: Text.AlignHCenter
- text: orb.value
- color: orb.known ? Theme.t1 : Theme.t3
- font.family: Theme.fontMono
- font.pixelSize: orb.size >= 50 ? 11 : 9
- font.weight: Font.DemiBold; font.variableAxes: Theme.axesDemiBold
- fontSizeMode: Text.HorizontalFit; minimumPixelSize: 8
- }
- Text {
- id: labelText
- visible: orb.showLabel
- anchors.top: ring.bottom; anchors.topMargin: 4
- anchors.horizontalCenter: parent.horizontalCenter
- text: orb.label
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 10
- }
- HoverHandler { id: orbHover }
- ToolTip.visible: orbHover.hovered && (orb.tip.length > 0 || !orb.showLabel)
- ToolTip.text: (orb.showLabel ? "" : orb.label + ":") + orb.tip
- }
+ component PerfOrb: ProPerfOrb {}
// The three orbs every performance readout shows: total processing time
// against the source frame budget, GPU utilization, and whether the output
// keeps up with its target rate.
- component PerfOrbs: RowLayout {
- property int size: 56
- property bool showLabels: true
- spacing: 10
- PerfOrb {
- size: parent.size
- showLabel: parent.showLabels
- known: veyra.chainTotalMsKnown && veyra.stageBudgetMs > 0
- fraction: known ? veyra.chainTotalMs / veyra.stageBudgetMs : 0
- value: veyra.chainTotalMsKnown ? veyra.chainTotalMs.toFixed(1) + "ms" : "—"
- label: qsTr("处理耗时")
- tip: qsTr("增强链总耗时(最近一秒平均,与 1.4.4 相同口径),环 = 占源帧预算") + (veyra.stageBudgetMs > 0 ? " " + veyra.stageBudgetMs.toFixed(1) + " ms" : "") + qsTr(" 的比例")
- }
- PerfOrb {
- size: parent.size
- showLabel: parent.showLabels
- known: veyra.gpuUtilizationKnown
- fraction: veyra.gpuUtilization / 100
- value: known ? Math.round(veyra.gpuUtilization) + "%" : "—"
- label: qsTr("GPU 占用")
- tip: qsTr("Windows GPU 引擎占用率(") + (veyra.gpuMonitorName || qsTr("全部显卡")) + qsTr(",最忙的引擎类型,全系统),每秒采样;在 设置 → 通用与外观 中更换监控的显卡")
- }
- // How much of one source frame's time the enhancement chain uses (the plan's
- // "负载预算 = 耗时 / 预算"). It used to show output fps / target fps, which
- // reads 100% whenever the output keeps up, however light the load.
- PerfOrb {
- size: parent.size
- showLabel: parent.showLabels
- known: veyra.chainTotalMsKnown && veyra.stageBudgetMs > 0
- fraction: known ? veyra.chainTotalMs / veyra.stageBudgetMs : 0
- value: known ? Math.round(veyra.chainTotalMs / veyra.stageBudgetMs * 100) + "%" : "—"
- label: qsTr("负载预算")
- tip: qsTr("增强链 GPU 耗时(最近一秒平均)占一个源帧时间(") + veyra.stageBudgetMs.toFixed(1)
- + qsTr(" ms)的比例;超过 100% 就跟不上源帧率。当前状态:") + veyra.runStatus
- }
- }
+ component PerfOrbs: ProPerfOrbs {}
// The status light: 1.4.4's 当前状态 (正常 / 补帧调度降档 / 输出未达标 /
// 输入帧率不足 …) as a glowing strip with the detail beside it.
- component StatusLight: RowLayout {
- id: light
- spacing: 8
- readonly property color tone: veyra.runStatusLevel === "ok" ? Theme.ok
- : veyra.runStatusLevel === "warn" ? "#F2B941"
- : veyra.runStatusLevel === "err" ? Theme.err : Qt.rgba(1, 1, 1, 0.3)
- Item {
- Layout.fillWidth: true
- Layout.minimumWidth: 32
- Layout.preferredHeight: 4
- Rectangle {
- id: strip
- anchors.fill: parent
- radius: 2
- color: light.tone
- opacity: veyra.runStatusLevel === "idle" ? 0.35 : 0.9
- Behavior on color { enabled: strip.visible; ColorAnimation { duration: Theme.d(300) } }
- }
- // A sibling MultiEffect, not layer.effect: Qt recreates a layer's effect item on
- // a screen DPI change while it walks the parent's children, and the walk then touched
- // the deleted item (crash moving the window to a 200 % monitor, field 2026-10-01).
- MultiEffect {
- source: strip
- anchors.fill: strip
- visible: veyra.runStatusLevel !== "idle"
- opacity: strip.opacity
- shadowEnabled: true; shadowColor: light.tone; shadowBlur: 0.6; shadowVerticalOffset: 0; blurMax: 12; autoPaddingEnabled: true
- }
- }
- Text {
- objectName: "run-status"
- Layout.maximumWidth: Math.max(0, light.width - 40)
- Layout.preferredWidth: Math.min(implicitWidth, light.width * 0.75)
- text: veyra.runStatus + (veyra.runStatusDetail.length > 0 ? " · " + veyra.runStatusDetail : "")
- color: light.tone
- font.family: Theme.fontUi
- font.pixelSize: 11
- font.weight: Font.Medium
- horizontalAlignment: Text.AlignRight
- wrapMode: Text.Wrap
- maximumLineCount: 2
- elide: Text.ElideRight
- HoverHandler { id: statusHover }
- ToolTip.visible: statusHover.hovered
- ToolTip.delay: 400
- ToolTip.text: text
- }
- }
+ component StatusLight: ProStatusLight {}
- component StatusSummary: ColumnLayout {
- spacing: 5
- Text {
- objectName: "run-active-options"
- Layout.fillWidth: true
- visible: veyra.runOptions.length > 0
- text: qsTr("已开启:%1").arg(veyra.runOptions.join(";"))
- color: Theme.t2
- font.family: Theme.fontUi
- font.pixelSize: 11
- wrapMode: Text.Wrap
- maximumLineCount: 3
- elide: Text.ElideRight
- HoverHandler { id: optionsHover }
- ToolTip.visible: optionsHover.hovered
- ToolTip.delay: 400
- ToolTip.text: text
- }
- StatusLight { Layout.fillWidth: true }
- }
+ component StatusSummary: ProStatusSummary {}
component NrLayerCard: VAccordion {
id: card
@@ -469,81 +248,7 @@ VPage {
}
// .addlayer: the dashed button at the bottom of a layered stage (NR, beauty).
- component AddLayerButton: Rectangle {
- id: addLayer
- property string label: ""
- property string note: ""
- property bool full: false
- signal add()
- Layout.fillWidth: true
- Layout.topMargin: 4
- implicitHeight: 36
- radius: 10
- opacity: full ? 0.45 : 1
- color: addHover.hovered && !full ? Theme.accentSoft : "transparent"
- readonly property bool softwareRendering: (typeof vySoftwareUi !== "undefined" && vySoftwareUi)
- || GraphicsInfo.api === GraphicsInfo.Software
- readonly property color outline: addHover.hovered && !addLayer.full ? Theme.accent : Qt.rgba(1, 1, 1, 0.2)
- Image {
- anchors.fill: parent
- visible: addLayer.softwareRendering
- // Software Shape ignores empty clips. A cached image keeps
- // this dashed path inside the inspector like the icons.
- source: {
- if (!visible || width <= 1 || height <= 1) return ""
- const c = addLayer.outline
- const paint = "rgb(" + Math.round(c.r * 255) + "," + Math.round(c.g * 255) + "," + Math.round(c.b * 255) + ")"
- return "data:image/svg+xml;charset=utf-8," + encodeURIComponent(
- '<svg xmlns="http://www.w3.org/2000/svg" width="' + width + '" height="' + height + '">'
- + '<rect x="0.5" y="0.5" width="' + (width-1) + '" height="' + (height-1)
- + '" rx="10" fill="none" stroke="' + paint + '" stroke-opacity="' + c.a
- + '" stroke-width="1" stroke-dasharray="5 4"/></svg>')
- }
- sourceSize.width: Math.max(1, Math.ceil(width * Screen.devicePixelRatio))
- sourceSize.height: Math.max(1, Math.ceil(height * Screen.devicePixelRatio))
- cache: true
- }
- Shape {
- visible: !addLayer.softwareRendering
- anchors.fill: parent
- ShapePath {
- strokeWidth: 1
- strokeColor: addHover.hovered && !addLayer.full ? Theme.accent : Qt.rgba(1, 1, 1, 0.2)
- fillColor: "transparent"
- strokeStyle: ShapePath.DashLine
- dashPattern: [5, 4]
- PathRectangle {
- x: 0; y: 0
- width: addLayer.width
- height: addLayer.height
- radius: 10
- }
- }
- }
- Row {
- anchors.centerIn: parent
- spacing: 6
- Text {
- text: addLayer.label
- color: addHover.hovered && !addLayer.full ? Theme.accent : Theme.t2
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- font.weight: Font.Medium
- }
- Text {
- anchors.baseline: parent.children[0].baseline
- text: addLayer.note
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 11
- }
- }
- HoverHandler { id: addHover; cursorShape: addLayer.full ? Qt.ArrowCursor : Qt.PointingHandCursor }
- TapHandler {
- enabled: !addLayer.full
- onTapped: addLayer.add()
- }
- }
+ component AddLayerButton: ProAddLayerButton {}
// Source and output belong together; the transport stays clear for seeking.
Item {
@@ -2151,791 +1856,17 @@ VPage {
}
// --- 声音 -------------------------------------------------
- ColumnLayout {
+ ProAudioPanel {
id: audioCol
Layout.fillWidth: true
- spacing: 6
visible: root.tab === "audio"
- VGroup {
- VRow {
- label: qsTr("音量")
- value: Math.round(veyra.volume * 100) + "%"
- VSlider {
- implicitWidth: 150
- from: 0; to: 1; value: veyra.volume; inputScale: 100
- onMoved: value => veyra.volume = value
- }
- }
- VRow {
- label: qsTr("静音")
- VSwitch {
- checked: veyra.muted
- onToggled: checked => veyra.muted = checked
- }
- }
- VRow {
- label: qsTr("声音同步")
- hint: veyra.audioSyncMode === 0 ? (veyra.audioSyncLive ? qsTr("软件估算补偿 ") + veyra.audioCompensationMs.toFixed(0) + " ms" : qsTr("自动估算 · 采集卡 / PS5 实时输入时生效"))
- : veyra.audioSyncMode === 1 ? qsTr("手动偏移 · 实时输入时生效") : qsTr("关闭补偿")
- VSeg {
- options: [{ id: "0", label: qsTr("自动估算") }, { id: "1", label: qsTr("手动") }, { id: "2", label: qsTr("关闭", "off") }]
- current: String(veyra.audioSyncMode)
- onPicked: id => veyra.audioSyncMode = Number(id)
- }
- }
- VRow {
- label: qsTr("音频偏移")
- hint: qsTr("正值延后音频")
- value: veyra.audioOffsetMs + " ms"
- VSlider {
- implicitWidth: 150
- center: true
- from: -250; to: 250; value: veyra.audioOffsetMs; enabledControl: veyra.audioSyncMode === 1
- onMoved: value => veyra.audioOffsetMs = Math.round(value)
- }
- }
- }
- VEyebrow { text: qsTr("音轨") }
- Text {
- visible: veyra.audioTracks.length === 0
- text: qsTr("当前源没有可选音轨。")
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- }
- Repeater {
- model: veyra.audioTracks
- delegate: Rectangle {
- required property var modelData
- Layout.fillWidth: true
- implicitHeight: 44
- radius: 12
- color: Theme.card2
- border.width: 1
- border.color: veyra.selectedAudioTrack === modelData.index ? Theme.accent : Theme.stroke
- RowLayout {
- anchors.fill: parent
- anchors.leftMargin: 12
- anchors.rightMargin: 12
- spacing: 12
- VEqBars {
- active: veyra.selectedAudioTrack === modelData.index && veyra.running && !veyra.paused
- opacity: veyra.selectedAudioTrack === modelData.index ? 1 : 0.6
- }
- ColumnLayout {
- Layout.fillWidth: true
- spacing: 2
- Text {
- text: modelData.label
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- }
- Text {
- text: modelData.channels > 0 ? modelData.channels + qsTr(" 声道") : ""
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 11
- }
- }
- }
- HoverHandler { cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: veyra.selectedAudioTrack = modelData.index }
- }
- }
}
// --- 显示 -------------------------------------------------
- ColumnLayout {
+ ProDisplayPanel {
id: displayCol
Layout.fillWidth: true
- spacing: 6
visible: root.tab === "display"
- VGroup {
- PresentationRows { }
- VRow {
- label: qsTr("原画 / 增强对比")
- hint: (veyra.compareMode === 2 ? qsTr("在画面上按住左键拖动分割线:左边原画、右边增强。") : "") + (veyra.compareMode !== 0 ? qsTr("对比时补帧暂停,关闭对比后恢复") : "")
- VSeg {
- objectName: "display-compare"
- options: [{ id: "0", label: qsTr("关闭", "off") }, { id: "2", label: qsTr("分屏") }, { id: "1", label: qsTr("只看原画") }]
- current: String(veyra.compareMode)
- onPicked: id => veyra.compareMode = Number(id)
- }
- }
- VRow {
- label: qsTr("对照底图")
- hint: qsTr("低延迟 NR 先行时,“增强前底图”是原图缩放,不是独立超分对照")
- visible: veyra.compareMode !== 0
- VSeg {
- objectName: "display-compare-base"
- options: [{ id: "0", label: qsTr("输入原画") }, { id: "1", label: qsTr("增强前底图") }]
- current: veyra.compareBase ? "1" : "0"
- onPicked: id => veyra.compareBase = id === "1"
- }
- }
- VRow {
- label: qsTr("按住 V 查看原画")
- hint: qsTr("按键可在 设置 → 快捷键 里改")
- VSwitch {
- objectName: "display-hold-compare"
- checked: veyra.preferences.holdCompare !== false
- onToggled: checked => veyra.setPreference("holdCompare", checked)
- }
- }
- VRow {
- label: qsTr("画面比例")
- hint: veyra.aspectMode === 1 ? qsTr("原始 = 一个输出像素对一个屏幕像素") : veyra.aspectMode === 2 ? qsTr("填满窗口,超出部分裁掉") : ""
- VSelect {
- objectName: "display-aspect"
- options: [{ id: "0", label: qsTr("适应") }, { id: "1", label: qsTr("原始像素") }, { id: "2", label: qsTr("填充裁切") }, { id: "3", label: qsTr("拉伸铺满") }, { id: "4", label: "16:9" }, { id: "5", label: "4:3" }, { id: "6", label: "21:9" }]
- value: options[veyra.aspectMode].label
- onPicked: id => veyra.aspectMode = Number(id)
- }
- }
- VRow {
- label: qsTr("强制 SDR 预览")
- hint: qsTr("HDR 片源也按 SDR 显示;与采集卡的“转为 SDR 显示”是同一设置")
- VSwitch {
- objectName: "display-force-sdr"
- checked: veyra.captureForceSdr
- onToggled: checked => veyra.captureForceSdr = checked
- }
- }
- VRow {
- label: qsTr("HDR 输出格式")
- hint: qsTr("补帧路径固定 HDR10;需要 Windows HDR 开启")
- VSeg { objectName: "display-hdr-output"; options: [{id:"0",label:"HDR10"},{id:"1",label:qsTr("scRGB 浮点")}]; current: String(veyra.hdrOutputMode); onPicked: id => veyra.hdrOutputMode = Number(id) }
- }
-
- // HDR 亮度曲线: a static curve. Unlike a plain exposure the
- // highlights are protected by construction.
- VAccordion {
- id: hdrCurveAccordion
- objectName: "list-hdr-curve"
- Layout.fillWidth: true
- glyph: "sun"
- hue: "#F5C84B"
- title: qsTr("HDR 亮度曲线")
- summary: veyra.hdrCurve ? qsTr("已开启") : qsTr("已关闭")
- on: veyra.hdrCurve
- onToggled: on => veyra.hdrCurve = on
- // 曲线图(自定义):由 C++ 用与着色器相同的公式采样,
- // 虚线是"不做任何处理"的参考线,橙线是当前曲线。
-
- VAccordion {
- id: hdrReadAccordion
- objectName: "list-hdr-readgroup"
- Layout.fillWidth: true
- glyph: "activity"
- hue: "#F5C84B"
- Layout.topMargin: 8
- enabledSwitch: false
- open: true
- title: qsTr("曲线图、读数与提示")
- summary: qsTr("2 项")
- // GPU 抽样统计:本卡可见且输出曲线生效时至多每秒 4 次。
- VRow {
- hintBelow: true
- objectName: "list-hdrcurve-live"
- label: qsTr("画面抽样统计")
- hint: !veyra.hdrCurveCoverage.valid
- ? qsTr("展开本卡片并播放 HDR 输出时测量,每秒最多 4 次")
- : veyra.hdrPeakWarning.capNits === 0
- ? qsTr("曲线未设「峰值上限」,不会有像素被压平。滚降区 %1% · 暗部提升区 %2%")
- .arg(Number(veyra.hdrCurveCoverage.rollOff).toFixed(1))
- .arg(Number(veyra.hdrCurveCoverage.lift).toFixed(1))
- : veyra.hdrCurveCoverage.aboveCeiling <= 0.0
- ? qsTr("上限 %1 nit 未被触及(滚降区 %2% · 暗部提升区 %3%)")
- .arg(veyra.hdrPeakWarning.capNits)
- .arg(Number(veyra.hdrCurveCoverage.rollOff).toFixed(1))
- .arg(Number(veyra.hdrCurveCoverage.lift).toFixed(1))
- : qsTr("触及硬上限 %1% · 高光压缩区 %2% · 暗部提升区 %3%")
- .arg(Number(veyra.hdrCurveCoverage.aboveCeiling).toFixed(1))
- .arg(Number(veyra.hdrCurveCoverage.rollOff).toFixed(1))
- .arg(Number(veyra.hdrCurveCoverage.lift).toFixed(1))
- value: !veyra.hdrCurveCoverage.valid ? qsTr("—")
- : veyra.hdrPeakWarning.capNits === 0 ? qsTr("未设上限")
- : veyra.hdrCurveCoverage.aboveCeiling > 5 ? qsTr("偏高")
- : veyra.hdrCurveCoverage.aboveCeiling > 0 ? qsTr("轻微") : qsTr("未触及")
- }
- // 高光预警(自定义):片源峰值 vs 曲线生效后的硬上限。
- VRow {
- objectName: "list-hdrcurve-peakwarning"
- label: qsTr("高光预警")
- hint: !veyra.hdrSourceInfo.valid ? qsTr("片源没有携带亮度信息")
- : !veyra.hdrPeakWarning.valid ? qsTr("曲线未开启")
- : veyra.hdrPeakWarning.capNits === 0 ? qsTr("曲线没有设硬上限,不会裁剪片源峰值")
- : qsTr("片源最亮 %1 nit,曲线硬上限 %2 nit:%3")
- .arg(veyra.hdrPeakWarning.sourcePeakNits)
- .arg(veyra.hdrPeakWarning.capNits)
- .arg(veyra.hdrPeakWarning.clipped
- ? qsTr("超过上限的亮度需要压缩;是否触及硬上限以抽样读数为准")
- : qsTr("上限覆盖片源标注峰值;处理后的画面以抽样读数为准"))
- value: !veyra.hdrSourceInfo.valid || !veyra.hdrPeakWarning.valid ? qsTr("—")
- : veyra.hdrPeakWarning.clipped ? qsTr("会压缩") : qsTr("安全")
- }
- Canvas {
- id: hdrCurveCanvas
- Layout.fillWidth: true
- Layout.preferredHeight: 92
- onWidthChanged: requestPaint()
- Component.onCompleted: requestPaint()
- Connections {
- target: veyra
- function onSettingsChanged() { hdrCurveCanvas.requestPaint() }
- }
- onPaint: {
- var ctx = getContext("2d");
- var w = width, h = height;
- ctx.clearRect(0, 0, w, h);
- var g = veyra.hdrCurveGraph;
- if (!g || !g.inputs || g.inputs.length < 2) return;
- var minN = g.minNits, maxN = g.maxNits;
- function px(n) {
- var v = Math.max(n, minN) / minN;
- return Math.log(v) / Math.log(maxN / minN);
- }
- // 参考线:未启用任何调整时曲线与它重合
- ctx.strokeStyle = Theme.t3;
- ctx.lineWidth = 1;
- ctx.beginPath();
- ctx.moveTo(0, h); ctx.lineTo(w, 0); ctx.stroke();
- // 当前曲线
- ctx.strokeStyle = g.enabled ? "#F5C84B" : Theme.t3;
- ctx.lineWidth = 2;
- ctx.beginPath();
- for (var i = 0; i < g.inputs.length; ++i) {
- var X = px(g.inputs[i]) * w;
- var Y = h - px(g.outputs[i]) * h;
- if (i === 0) ctx.moveTo(X, Y); else ctx.lineTo(X, Y);
- }
- ctx.stroke();
- }
- }
- // 一键按片源选档(自定义):用片源自带的峰值 / 平均亮度
- // 决定档位与强度,界面只解释理由,不做测量。
- Text {
- Layout.fillWidth: true
- text: qsTr("曲线作用于 HDR10 或 scRGB 输出,也适用于 RTX Video HDR 转换后的画面。低亮度画面可能不会触及高光阈值。")
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- }
- VAccordion {
- objectName: "list-hdr-pickgroup"
- Layout.fillWidth: true
- glyph: "wand"
- hue: "#A78BFA"
- Layout.topMargin: 8
- enabledSwitch: false
- open: true
- title: qsTr("一键选档")
- summary: qsTr("4 项")
- // 选档方式(自定义):整档预设 / 自由组合。两套写的是同一条曲线,
- // 所以切换只影响界面,不影响存档或画面。
- VRow {
- hintBelow: true
- label: qsTr("按片源自动选档")
- hint: {
- if (!veyra.hdrRecommendation.available)
- return veyra.sourceIsSdr
- ? qsTr("SDR 片源没有 HDR 亮度元数据;可手动选档,HDR 输出时生效。")
- : qsTr("片源没有携带亮度信息(抓屏 / 串流),无法自动选档");
- var r = veyra.hdrRecommendation.reason;
- var why = r === "dark-content" ? qsTr("整片偏暗、只有少量亮点")
- : r === "bright-content" ? qsTr("高光又亮又多")
- : r === "narrow-range" ? qsTr("母版峰值偏低(老片 / 转制片)")
- : r === "beyond-display" ? qsTr("内容亮度远超显示设备能力")
- : r === "dark-and-bright" ? qsTr("整片偏暗,且超出显示设备能力")
- : qsTr("亮度分布均衡");
- var axes = veyra.hdrPresetMode === "axes";
- var pick = axes
- ? (r === "dark-content" ? qsTr("内容:暗场多")
- : r === "bright-content" ? qsTr("内容:高光强")
- : r === "beyond-display" ? qsTr("内容:高光强")
- : r === "dark-and-bright" ? qsTr("内容:两头极端")
- : r === "narrow-range" ? qsTr("内容:老片平淡")
- : qsTr("内容:标准"))
- : (r === "dark-content" ? qsTr("暗场提亮")
- : r === "bright-content" ? qsTr("高光保护")
- : r === "beyond-display" ? qsTr("高光保护")
- : r === "dark-and-bright" ? qsTr("暗亮双修")
- : r === "narrow-range" ? qsTr("强化冲击") : qsTr("标准"));
- return why + qsTr(" → 建议 ") + pick
- + qsTr("(片源最亮 %1 nit、最亮帧平均 %2 nit)")
- .arg(veyra.hdrRecommendation.cllNits)
- .arg(veyra.hdrRecommendation.fallNits);
- }
- VButton {
-
-
- objectName: "list-hdrcurve-auto"
- text: qsTr("一键推荐")
- ghost: true
- enabled: veyra.hdrRecommendation.available
- onClicked: veyra.applyRecommendedHdrTuning()
- }
- }
-
- Text {
- Layout.fillWidth: true
- visible: true
- text: qsTr("选档方式:两种选法写的是同一条曲线,切换只影响界面上怎么叫它")
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- Flow {
- objectName: "list-hdrcurve-mode"
- Layout.fillWidth: true
- visible: true
- Layout.preferredHeight: implicitHeight
- spacing: 6
- Repeater {
- model: [{id:"legacy",label:qsTr("整档预设")}, {id:"axes",label:qsTr("自由组合")}]
- delegate: VButton {
- required property var modelData
- text: modelData.label
- ghost: true
- primary: veyra.hdrPresetMode === modelData.id
- onClicked: veyra.hdrPresetMode = modelData.id
- }
- }
- }
-
- // One-click presets: pick the one that matches the film.
- Flow {
- visible: veyra.hdrPresetMode === "legacy"
- Layout.fillWidth: true
- Layout.preferredHeight: implicitHeight
- spacing: 6
- Repeater {
- model: [{id:"standard",label:qsTr("标准")},
- {id:"darkLift",label:qsTr("暗场提亮")},
- {id:"highlightGuard",label:qsTr("高光保护")},
- {id:"darkAndBright",label:qsTr("暗亮双修")},
- {id:"brightRoom",label:qsTr("明亮环境")},
- {id:"darkRoom",label:qsTr("暗室观影")},
- {id:"punch",label:qsTr("强化冲击")}]
- delegate: VButton {
- required property var modelData
- text: modelData.label
- ghost: true
- // 两套预设写的是同一条曲线,所以数值上可能同时匹配(「不补偿」时自由组合就等于整档预设)。
- // 只让当前模式那一行点亮,免得看起来像两个模式同时生效。
- primary: veyra.hdrAppliedFrom !== "axes" && veyra.hdrTuningPreset === modelData.id
- onClicked: { veyra.hdrPresetMode = "legacy"; veyra.applyHdrTuningPreset(modelData.id) }
- }
- }
- }
- Text {
- visible: veyra.hdrPresetMode === "legacy"
- Layout.fillWidth: true
- text: veyra.hdrTuningPreset === "darkLift" ? qsTr("提亮暗部与中间调,保留高光峰值。")
- : veyra.hdrTuningPreset === "highlightGuard" ? qsTr("高光很亮的片子(雪景/爆炸/演唱会):压住顶部,暗部不动。")
- : veyra.hdrTuningPreset === "darkAndBright" ? qsTr("暗场很暗、亮场又很亮的片子:两头都照顾。")
- : veyra.hdrTuningPreset === "brightRoom" ? qsTr("白天或亮环境看片:整体提亮一些。")
- : veyra.hdrTuningPreset === "darkRoom" ? qsTr("夜里关灯看:柔和一点,同时保留暗部细节。")
- : veyra.hdrTuningPreset === "punch" ? qsTr("画面偏灰、平淡的老片或转制片:提高对比观感。")
- : veyra.hdrTuningPreset === "standard" ? qsTr("曲线保持原样,HDR10 元数据跟随片源。")
- : qsTr("自定义:已用下面的滑块微调过。")
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- Text {
- Layout.fillWidth: true
- visible: veyra.hdrPresetMode === "axes"
- text: qsTr("内容:这部片子属于哪一类")
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- Flow {
- objectName: "list-hdrcurve-content"
- Layout.fillWidth: true
- visible: veyra.hdrPresetMode === "axes"
- Layout.preferredHeight: implicitHeight
- spacing: 6
- Repeater {
- model: [{id:"standard",label:qsTr("标准")}, {id:"dark",label:qsTr("暗场多")}, {id:"highlight",label:qsTr("高光强")}, {id:"darkAndBright",label:qsTr("两头极端")}, {id:"punch",label:qsTr("老片平淡")}]
- delegate: VButton {
- required property var modelData
- text: modelData.label
- ghost: true
- // 只按曲线实际等于哪个组合点亮:当前是整档预设(或手动微调过)时不亮任何一项,
- // 与整档预设显示"自定义"的行为一致。
- primary: veyra.hdrAppliedFrom === "axes" && veyra.hdrAxesMatch.content === modelData.id
- onClicked: { veyra.hdrPresetMode = "axes"; veyra.applyHdrAxesPreset(modelData.id, veyra.hdrAxes.environment !== "" ? veyra.hdrAxes.environment : "compensate"); }
- }
- }
- }
- Text {
- Layout.fillWidth: true
- visible: veyra.hdrPresetMode === "axes"
- text: qsTr("环境光补偿:屋里亮(开灯/白天)就补偿一点,屋里暗(关灯)就不补偿")
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- Flow {
- objectName: "list-hdrcurve-environment"
- Layout.fillWidth: true
- visible: veyra.hdrPresetMode === "axes"
- Layout.preferredHeight: implicitHeight
- spacing: 6
- Repeater {
- model: [{id:"compensate",label:qsTr("提亮补偿")}, {id:"plain",label:qsTr("不补偿")}]
- delegate: VButton {
- required property var modelData
- text: modelData.label
- ghost: true
- primary: veyra.hdrAppliedFrom === "axes" && veyra.hdrAxesMatch.environment === modelData.id
- onClicked: { veyra.hdrPresetMode = "axes"; veyra.applyHdrAxesPreset(veyra.hdrAxesMatch.content !== "" ? veyra.hdrAxesMatch.content : (veyra.hdrAxes.content !== "" ? veyra.hdrAxes.content : "standard"), modelData.id); }
- }
- }
- }
- // 当前生效状态(自定义):整档预设模式下说明当前是哪一档;手动微调过
- // (不匹配任何整档预设)时明确说"自定义",免得看起来像没生效。
- Text {
- Layout.fillWidth: true
- visible: veyra.hdrPresetMode !== "axes"
- objectName: "list-hdrcurve-active-preset"
- text: veyra.hdrTuningPreset !== "custom"
- ? qsTr("当前生效:整档预设「%1」").arg(
- veyra.hdrTuningPreset === "darkLift" ? qsTr("暗场提亮")
- : veyra.hdrTuningPreset === "highlightGuard" ? qsTr("高光保护")
- : veyra.hdrTuningPreset === "darkAndBright" ? qsTr("暗亮双修")
- : veyra.hdrTuningPreset === "brightRoom" ? qsTr("明亮环境")
- : veyra.hdrTuningPreset === "darkRoom" ? qsTr("暗室观影")
- : veyra.hdrTuningPreset === "punch" ? qsTr("强化冲击")
- : qsTr("标准"))
- : qsTr("当前生效:自定义微调(未匹配任何整档预设)")
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- // 当前组合(自定义):自由组合模式下说清楚现在选的是哪两项 —— 手动微调
- // 过参数后没有匹配项,这一行仍然在,不会看起来像"没生效"。
- Text {
- Layout.fillWidth: true
- visible: veyra.hdrPresetMode === "axes"
- text: qsTr("当前组合:内容 %1 · 环境 %2").arg(
- veyra.hdrAxes.content === "dark" ? qsTr("暗场多")
- : veyra.hdrAxes.content === "highlight" ? qsTr("高光强")
- : veyra.hdrAxes.content === "darkAndBright" ? qsTr("两头极端")
- : veyra.hdrAxes.content === "punch" ? qsTr("老片平淡")
- : qsTr("标准")).arg(
- veyra.hdrAxes.environment === "compensate" ? qsTr("提亮补偿")
- : qsTr("不补偿"))
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- // 等价说明(自定义):两套预设写的是同一条曲线,「不补偿」时两轴组合与
- // 整档预设数值完全相同,所以这里把等价关系直接说出来,省得看起来像两个模式
- // 同时生效。手动微调过的曲线不匹配任何整档预设,这句话自然消失。
- Text {
- Layout.fillWidth: true
- objectName: "list-hdrcurve-equivalent"
- visible: veyra.hdrPresetMode === "axes" && veyra.hdrTuningPreset !== "custom"
- text: qsTr("这条曲线目前也等同于整档预设「%1」").arg(
- veyra.hdrTuningPreset === "darkLift" ? qsTr("暗场提亮")
- : veyra.hdrTuningPreset === "highlightGuard" ? qsTr("高光保护")
- : veyra.hdrTuningPreset === "darkAndBright" ? qsTr("暗亮双修")
- : veyra.hdrTuningPreset === "brightRoom" ? qsTr("明亮环境")
- : veyra.hdrTuningPreset === "darkRoom" ? qsTr("暗室观影")
- : veyra.hdrTuningPreset === "punch" ? qsTr("强化冲击")
- : qsTr("标准"))
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- }
- VAccordion {
- objectName: "list-hdr-basegroup"
- Layout.fillWidth: true
- glyph: "sliders"
- hue: "#4F7BFF"
- Layout.topMargin: 8
- enabledSwitch: false
- open: true
- title: qsTr("基础设置")
- summary: qsTr("5 项")
- VRow {
- hintBelow: true
- label: qsTr("总体强度")
- hint: qsTr("调整力度;0% 关闭曲线")
- value: veyra.hdrCurveStrength + "%"
- VSlider {
- objectName: "list-hdrcurve-strength"
- implicitWidth: 120
- valueFromModel: true
- resettable: true; defaultValue: 100
- from: 0; to: 200
- value: veyra.hdrCurveStrength
- onMoved: value => veyra.hdrCurveStrength = Math.round(value)
- }
- }
-
- // 人话滑杆(自定义):技术参数翻译成三根好懂的滑杆,
- // 精确参数仍在下面的「高级」里。
- VRow {
- hintBelow: true
- label: qsTr("暗部提亮")
- hint: qsTr("拉亮暗部")
- // 档位只是快捷方式:同时给出真实参数,避免"碰一下跳值"的困惑。
- value: (Number(veyra.hdrCurveParams.shadowLiftEv100 ?? 0) / 100).toFixed(2) + " EV"
- VSlider {
- objectName: "list-hdrcurve-dial-lift"
- implicitWidth: 120
- valueFromModel: true
- resettable: true; defaultValue: 0
- from: 0; to: 10
- value: veyra.hdrDials.shadowLift
- onMoved: value => veyra.setHdrDial("shadowLift", Math.round(value))
- }
- }
- VRow {
- hintBelow: true
- label: qsTr("整体观感")
- hint: qsTr("整体亮暗")
- value: (veyra.hdrCurveParams.midGrayNits ?? "—") + " nit"
- VSlider {
- objectName: "list-hdrcurve-dial-brightness"
- implicitWidth: 120
- valueFromModel: true
- resettable: true; defaultValue: 3
- from: 0; to: 10
- value: veyra.hdrDials.brightness
- onMoved: value => veyra.setHdrDial("brightness", Math.round(value))
- }
- }
- VRow {
- hintBelow: true
- label: qsTr("高光保护")
- hint: qsTr("压住高光")
- value: [qsTr("关"),qsTr("弱"),qsTr("中"),qsTr("强")][Math.max(0,Math.min(3,veyra.hdrDials.highlight))]
- VSlider {
- objectName: "list-hdrcurve-dial-highlight"
- implicitWidth: 120
- valueFromModel: true
- resettable: true; defaultValue: 0
- from: 0; to: 3
- value: veyra.hdrDials.highlight
- onMoved: value => veyra.setHdrDial("highlight", Math.round(value))
- }
- }
- VRow {
- hintBelow: true
- label: qsTr("显示峰值")
- hint: qsTr("我的屏能到多少 nit;0 = 自动")
- value: veyra.hdrDisplayPeakNits > 0
- ? (veyra.hdrDisplayPeakNits + " nit") : qsTr("自动")
- VSlider {
- objectName: "list-hdrcurve-displaypeak"
- implicitWidth: 120
- valueFromModel: true
- resettable: true; defaultValue: 0
- from: 0; to: 4000
- value: veyra.hdrDisplayPeakNits
- onMoved: value => veyra.hdrDisplayPeakNits = Math.round(value)
- }
- }
-
- // The display's own report, kept at the card's foot like the author's section notes.
- Text {
- Layout.fillWidth: true
- visible: veyra.hdrDisplayInfo.valid
- text: qsTr("系统报告:峰值 %1、全屏 %2、黑位 %3 nit")
- .arg(veyra.hdrDisplayInfo.peakNits)
- .arg(veyra.hdrDisplayInfo.fullFrameNits)
- .arg(Number(veyra.hdrDisplayInfo.minNits).toFixed(3))
- + " · " + qsTr("系统数值不是实测;不符时可手动填写峰值")
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- }
-
- // The two dials. Both scale the baseline the sliders below
- // edit, which is why moving either of them keeps the preset
- // above selected instead of falling back to "自定义".
- // Advanced technical parameters (custom): the exact values behind the three
- // dials above. Collapsed by default so the panel stays readable.
- // Advanced parameters (custom): the exact values behind the three dials above,
- // in the author's own collapsible-group style (label + chevron, no switch).
- VAccordion {
- objectName: "list-hdr-advanced"
- Layout.fillWidth: true
- glyph: "settings"
- hue: "#8A93A6"
- Layout.topMargin: 8
- enabledSwitch: false
- open: false
- title: qsTr("高级设置:技术参数")
- summary: qsTr("6 项")
- Text {
- Layout.fillWidth: true
- text: qsTr("这里是「基础设置」里 暗部提亮、整体观感、高光保护 这三项的精确数值版(强度与显示峰值不在此列,它们本身就是直接调节)。")
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- Repeater {
- model: [{key:"shadowLiftEv100",label:qsTr("暗部抬升"),from:-200,to:200,def:0,hint:qsTr("单位 0.01 EV:正值提亮暗部,负值压暗")},
- {key:"shadowRangeNits",label:qsTr("抬升范围 (nit)"),from:1,to:100,def:10,hint:qsTr("只在这个亮度以下的暗部生效")},
- {key:"midGrayNits",label:qsTr("中灰 (nit)"),from:100,to:500,def:203,hint:qsTr("203 = 中性;调高整体变亮,峰值不变")},
- {key:"highlightStartNits",label:qsTr("高光起点 (nit)"),from:0,to:2000,def:0,hint:qsTr("0 = 不做高光滚降")},
- {key:"rollOffPercent",label:qsTr("滚降强度 (%)"),from:10,to:200,def:100,hint:qsTr("数值越大,高光过渡越平缓")},
- {key:"peakCapNits",label:qsTr("峰值上限 (nit)"),from:0,to:4000,def:0,hint:qsTr("0 = 不限制")}]
- delegate: VRow {
- hintBelow: true
- required property var modelData
- label: modelData.label
- hint: modelData.hint || ""
- value: String(veyra.hdrCurveParams[modelData.key] ?? "—")
- VSlider {
- objectName: "list-hdrcurve-" + modelData.key
- implicitWidth: 120
- valueFromModel: true
- resettable: true; defaultValue: modelData.def
- from: modelData.from; to: modelData.to
- value: veyra.hdrCurveParams[modelData.key] ?? modelData.def
- onMoved: value => veyra.setHdrCurveParameter(modelData.key, Math.round(value))
- }
- }
- }
- }
- VAccordion {
- objectName: "list-hdr-memory-group"
- Layout.fillWidth: true
- glyph: "clock"
- hue: "#4FD1A5"
- Layout.topMargin: 8
- enabledSwitch: false
- open: false
- title: qsTr("记忆与自动化")
- summary: qsTr("4 项")
- // 记忆与自动化(自定义)
- // 每台显示设备一套配置(自定义):按显示器身份记住曲线,
- // 换设备(投影仪 / 电视)时自动套用那台设备上的设置。
- VRow {
- hintBelow: true
- label: qsTr("按显示设备记忆")
- hint: veyra.hdrDisplayProfileCount > 0
- ? qsTr("已记住 %1 台显示设备的曲线配置,切换显示器时自动套用")
- .arg(veyra.hdrDisplayProfileCount)
- : qsTr("改动曲线后会按当前显示器记住,换设备时自动套用")
- value: veyra.hdrDisplayProfileCount > 0 ? qsTr("已启用") : qsTr("—")
- VButton {
- objectName: "list-hdrcurve-forget"
- text: qsTr("清除记忆")
- ghost: true
- enabled: veyra.hdrDisplayProfileCount > 0
- onClicked: veyra.forgetHdrDisplayProfiles()
- }
- }
- VRow {
- hintBelow: true
- label: qsTr("记住每部影片")
- hint: veyra.hdrTitleCount > 0
- ? qsTr("已记住 %1 部影片,下次播放自动套用").arg(veyra.hdrTitleCount)
- : qsTr("改动曲线后按影片记住,下次自动套用")
- value: veyra.hdrTitleMemory ? qsTr("已开启") : qsTr("已关闭")
- VSwitch {
- objectName: "list-hdrcurve-titlememory"
- checked: veyra.hdrTitleMemory
- onToggled: checked => veyra.hdrTitleMemory = checked
- }
- }
- VRow {
- hintBelow: true
- label: qsTr("开播自动选档")
- hint: qsTr("打开片子时按片源自动选一次;有影片记忆时以记忆为准")
- value: veyra.hdrAutoRecommend ? qsTr("已开启") : qsTr("已关闭")
- VSwitch {
- objectName: "list-hdrcurve-autorecommend"
- checked: veyra.hdrAutoRecommend
- onToggled: checked => veyra.hdrAutoRecommend = checked
- }
- }
- VRow {
- hintBelow: true
- label: qsTr("清除影片记忆")
- hint: qsTr("只清影片记忆,不动显示设备记忆")
- VButton {
- objectName: "list-hdrcurve-forget-titles"
- text: qsTr("清除")
- ghost: true
- enabled: veyra.hdrTitleCount > 0
- onClicked: veyra.forgetHdrTitles()
- }
- }
- }
- }
-
- VAccordion {
- objectName: "list-hdr-metadata"
- Layout.fillWidth: true
- Layout.topMargin: 12
- glyph: "sun"
- hue: "#7FB2F5"
- title: qsTr("HDR 元数据")
- summary: veyra.hdrMetadataEnabled ? qsTr("已启用(HDR10)") : qsTr("已关闭")
- on: veyra.hdrMetadataEnabled
- onToggled: on => veyra.hdrMetadataEnabled = on
- Text {
- Layout.fillWidth: true
- text: qsTr("HDR10 提示;系统或显示器可能忽略,让它的动态色调映射有依据。")
- + qsTr("曲线生效时会约束内容亮度提示;SDR 输入默认不发送,手动填写除外。")
- wrapMode: Text.WordWrap
- color: Theme.t3
- font.family: Theme.fontUi; font.pixelSize: 11
- }
- Repeater {
- model: [{key:"masteringPeakNits",label:qsTr("母版峰值 (nit)"),from:0,to:4000,def:0,hint:qsTr("0 = 跟随片源;实际效果取决于显示设备")},
- {key:"maxCllNits",label:qsTr("MaxCLL (nit)"),from:0,to:4000,def:0,hint:qsTr("0 = 跟随片源")},
- {key:"maxFallNits",label:qsTr("MaxFALL (nit)"),from:0,to:4000,def:0,hint:qsTr("0 = 跟随片源")}]
- delegate: VRow {
- required property var modelData
- label: modelData.label
- hint: modelData.hint || ""
- value: String(veyra.hdrMetadataParams[modelData.key] ?? "—")
- VSlider {
- objectName: "list-hdrmeta-" + modelData.key
- implicitWidth: 120
- valueFromModel: true
- resettable: true; defaultValue: modelData.def
- from: modelData.from; to: modelData.to
- value: veyra.hdrMetadataParams[modelData.key] ?? modelData.def
- onMoved: value => veyra.setHdrMetadataParameter(modelData.key, Math.round(value))
- }
- }
- }
- }
- }
- VGroup {
- VRow {
- label: qsTr("提交帧率")
- value: veyra.submitFpsKnown ? veyra.submitFps.toFixed(2) : qsTr("未测量")
- }
- VRow {
- label: qsTr("显示帧率")
- hint: qsTr("需要系统显示事件才能测得真实值;取不到时显示未测")
- value: veyra.displayFpsKnown ? veyra.displayFps.toFixed(2) : qsTr("未测")
- }
- VRow {
- label: qsTr("晚点 P95")
- value: veyra.lateP95Ms.toFixed(2) + " ms"
- }
- VRow {
- label: qsTr("调度等待 P95")
- value: veyra.scheduleP95Ms.toFixed(2) + " ms"
- }
- }
}
Item { Layout.preferredHeight: 12 }
diff --git a/qml/Veyra/ProPerfOrb.qml b/qml/Veyra/ProPerfOrb.qml
new file mode 100644
index 00000000..4954fca2
--- /dev/null
+++ b/qml/Veyra/ProPerfOrb.qml
@@ -0,0 +1,75 @@
+// Professional-view reusable presentation component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtQuick.Shapes
+import QtQuick.Effects
+
+Item {
+ id: orb
+ property real fraction: 0
+ property bool known: false
+ property string value: "—"
+ property string label: ""
+ property string tip: ""
+ property int size: 56
+ // Compact (the node page's 40px bar): no label under the ring; the
+ // tooltip names the orb instead.
+ property bool showLabel: true
+ readonly property color tone: !known ? Qt.rgba(1, 1, 1, 0.25)
+ : fraction < 0.7 ? Theme.ok : fraction < 1.0 ? "#F2B941" : Theme.err
+ implicitWidth: Math.max(size, labelText.implicitWidth)
+ implicitHeight: showLabel ? size + 4 + labelText.implicitHeight : size
+ // The ring is only a few dozen pixels across. Sub-percent changes do
+ // not add visible information; the numeric label retains full precision.
+ readonly property real shown: Math.round(telemetry.value * 100) / 100
+ VTelemetryValue {
+ id: telemetry
+ targetValue: orb.known ? Math.min(1, Math.max(0, orb.fraction)) : 0
+ animate: orb.visible && !Theme.reduced && (!veyra.paused || (typeof vyTest !== "undefined" && vyTest.disablePausedUiIdle === true))
+ duration: 600
+ }
+ onShownChanged: ring.requestPaint()
+ onToneChanged: ring.requestPaint()
+ Canvas {
+ id: ring
+ width: orb.size; height: orb.size
+ anchors.horizontalCenter: parent.horizontalCenter
+ onPaint: {
+ const c = getContext("2d"); c.reset()
+ const r = width / 2 - 4, cx = width / 2, cy = height / 2
+ c.lineWidth = 5; c.lineCap = "round"
+ c.strokeStyle = Qt.rgba(1, 1, 1, 0.08)
+ c.beginPath(); c.arc(cx, cy, r, 0, Math.PI * 2); c.stroke()
+ if (orb.shown > 0.001) {
+ c.strokeStyle = orb.tone
+ c.shadowColor = orb.tone; c.shadowBlur = 8
+ c.beginPath(); c.arc(cx, cy, r, -Math.PI / 2, -Math.PI / 2 + Math.PI * 2 * orb.shown); c.stroke()
+ }
+ }
+ }
+ Text {
+ anchors.centerIn: ring
+ width: orb.size - 12
+ horizontalAlignment: Text.AlignHCenter
+ text: orb.value
+ color: orb.known ? Theme.t1 : Theme.t3
+ font.family: Theme.fontMono
+ font.pixelSize: orb.size >= 50 ? 11 : 9
+ font.weight: Font.DemiBold; font.variableAxes: Theme.axesDemiBold
+ fontSizeMode: Text.HorizontalFit; minimumPixelSize: 8
+ }
+ Text {
+ id: labelText
+ visible: orb.showLabel
+ anchors.top: ring.bottom; anchors.topMargin: 4
+ anchors.horizontalCenter: parent.horizontalCenter
+ text: orb.label
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 10
+ }
+ HoverHandler { id: orbHover }
+ ToolTip.visible: orbHover.hovered && (orb.tip.length > 0 || !orb.showLabel)
+ ToolTip.text: (orb.showLabel ? "" : orb.label + ":") + orb.tip
+}
diff --git a/qml/Veyra/ProPerfOrbs.qml b/qml/Veyra/ProPerfOrbs.qml
new file mode 100644
index 00000000..65c52108
--- /dev/null
+++ b/qml/Veyra/ProPerfOrbs.qml
@@ -0,0 +1,43 @@
+// Professional-view reusable presentation component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtQuick.Shapes
+import QtQuick.Effects
+
+RowLayout {
+ property int size: 56
+ property bool showLabels: true
+ spacing: 10
+ ProPerfOrb {
+ size: parent.size
+ showLabel: parent.showLabels
+ known: veyra.chainTotalMsKnown && veyra.stageBudgetMs > 0
+ fraction: known ? veyra.chainTotalMs / veyra.stageBudgetMs : 0
+ value: veyra.chainTotalMsKnown ? veyra.chainTotalMs.toFixed(1) + "ms" : "—"
+ label: qsTr("处理耗时")
+ tip: qsTr("增强链总耗时(最近一秒平均,与 1.4.4 相同口径),环 = 占源帧预算") + (veyra.stageBudgetMs > 0 ? " " + veyra.stageBudgetMs.toFixed(1) + " ms" : "") + qsTr(" 的比例")
+ }
+ ProPerfOrb {
+ size: parent.size
+ showLabel: parent.showLabels
+ known: veyra.gpuUtilizationKnown
+ fraction: veyra.gpuUtilization / 100
+ value: known ? Math.round(veyra.gpuUtilization) + "%" : "—"
+ label: qsTr("GPU 占用")
+ tip: qsTr("Windows GPU 引擎占用率(") + (veyra.gpuMonitorName || qsTr("全部显卡")) + qsTr(",最忙的引擎类型,全系统),每秒采样;在 设置 → 通用与外观 中更换监控的显卡")
+ }
+ // How much of one source frame's time the enhancement chain uses (the plan's
+ // "负载预算 = 耗时 / 预算"). It used to show output fps / target fps, which
+ // reads 100% whenever the output keeps up, however light the load.
+ ProPerfOrb {
+ size: parent.size
+ showLabel: parent.showLabels
+ known: veyra.chainTotalMsKnown && veyra.stageBudgetMs > 0
+ fraction: known ? veyra.chainTotalMs / veyra.stageBudgetMs : 0
+ value: known ? Math.round(veyra.chainTotalMs / veyra.stageBudgetMs * 100) + "%" : "—"
+ label: qsTr("负载预算")
+ tip: qsTr("增强链 GPU 耗时(最近一秒平均)占一个源帧时间(") + veyra.stageBudgetMs.toFixed(1)
+ + qsTr(" ms)的比例;超过 100% 就跟不上源帧率。当前状态:") + veyra.runStatus
+ }
+}
diff --git a/qml/Veyra/ProPresentationRows.qml b/qml/Veyra/ProPresentationRows.qml
new file mode 100644
index 00000000..be1527e7
--- /dev/null
+++ b/qml/Veyra/ProPresentationRows.qml
@@ -0,0 +1,61 @@
+// Professional-view reusable presentation component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtQuick.Shapes
+import QtQuick.Effects
+
+ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 0
+ VRow {
+ label: qsTr("显示同步")
+ hint: qsTr("自动(推荐):不撕裂,也不等待垂直同步,每次刷新显示最新一帧,延迟最低 · 垂直同步:每帧都等到刷新才显示,比自动多等最多一个刷新 · 允许撕裂:可能出现撕裂线")
+ VSeg {
+ objectName: "presentation-display-sync"
+ options: [{ id: "0", label: qsTr("允许撕裂") }, { id: "1", label: qsTr("垂直同步") }, { id: "2", label: qsTr("自动") }]
+ current: String(veyra.displaySync)
+ onPicked: id => veyra.displaySync = Number(id)
+ }
+ }
+ // 可变刷新 (G-SYNC / FreeSync): the switch greys when the monitor cannot
+ // do it. The state is read on events only; 刷新显示器状态 in the 信号
+ // card asks the driver again.
+ VRow {
+ label: qsTr("可变刷新")
+ hint: veyra.vrrHint
+ VSwitch {
+ objectName: "presentation-vrr"
+ enabled: veyra.vrrState >= 2
+ opacity: enabled ? 1 : 0.5
+ checked: veyra.variableRefresh
+ onToggled: checked => veyra.variableRefresh = checked
+ }
+ }
+ VRow {
+ label: qsTr("输出上限")
+ enabled: !veyra.presentationOwned
+ hint: veyra.presentationStatus
+ VSeg {
+ objectName: "presentation-output-rate"
+ options: [{ id: "0", label: qsTr("关闭", "off") }, { id: "1", label: qsTr("跟随显示器") }, { id: "2", label: qsTr("自定义") }]
+ current: String(veyra.outputRateMode)
+ onPicked: id => veyra.outputRateMode = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("自定义上限")
+ enabled: !veyra.presentationOwned
+ visible: veyra.outputRateMode === 2
+ RowLayout {
+ spacing: 6
+ DialogHost.VTextField {
+ objectName: "presentation-custom-fps"
+ implicitWidth: 90
+ text: veyra.outputCustomFps.toFixed(3)
+ onEdited: text => { const v = Number(text); if (isFinite(v)) veyra.outputCustomFps = v }
+ }
+ Text { text: "FPS"; color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: 11 }
+ }
+ }
+}
diff --git a/qml/Veyra/ProStatusLight.qml b/qml/Veyra/ProStatusLight.qml
new file mode 100644
index 00000000..4b0da29e
--- /dev/null
+++ b/qml/Veyra/ProStatusLight.qml
@@ -0,0 +1,55 @@
+// Professional-view reusable presentation component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtQuick.Shapes
+import QtQuick.Effects
+
+RowLayout {
+ id: light
+ spacing: 8
+ readonly property color tone: veyra.runStatusLevel === "ok" ? Theme.ok
+ : veyra.runStatusLevel === "warn" ? "#F2B941"
+ : veyra.runStatusLevel === "err" ? Theme.err : Qt.rgba(1, 1, 1, 0.3)
+ Item {
+ Layout.fillWidth: true
+ Layout.minimumWidth: 32
+ Layout.preferredHeight: 4
+ Rectangle {
+ id: strip
+ anchors.fill: parent
+ radius: 2
+ color: light.tone
+ opacity: veyra.runStatusLevel === "idle" ? 0.35 : 0.9
+ Behavior on color { enabled: strip.visible; ColorAnimation { duration: Theme.d(300) } }
+ }
+ // A sibling MultiEffect, not layer.effect: Qt recreates a layer's effect item on
+ // a screen DPI change while it walks the parent's children, and the walk then touched
+ // the deleted item (crash moving the window to a 200 % monitor, field 2026-10-01).
+ MultiEffect {
+ source: strip
+ anchors.fill: strip
+ visible: veyra.runStatusLevel !== "idle"
+ opacity: strip.opacity
+ shadowEnabled: true; shadowColor: light.tone; shadowBlur: 0.6; shadowVerticalOffset: 0; blurMax: 12; autoPaddingEnabled: true
+ }
+ }
+ Text {
+ objectName: "run-status"
+ Layout.maximumWidth: Math.max(0, light.width - 40)
+ Layout.preferredWidth: Math.min(implicitWidth, light.width * 0.75)
+ text: veyra.runStatus + (veyra.runStatusDetail.length > 0 ? " · " + veyra.runStatusDetail : "")
+ color: light.tone
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ font.weight: Font.Medium
+ horizontalAlignment: Text.AlignRight
+ wrapMode: Text.Wrap
+ maximumLineCount: 2
+ elide: Text.ElideRight
+ HoverHandler { id: statusHover }
+ ToolTip.visible: statusHover.hovered
+ ToolTip.delay: 400
+ ToolTip.text: text
+ }
+}
diff --git a/qml/Veyra/ProStatusSummary.qml b/qml/Veyra/ProStatusSummary.qml
new file mode 100644
index 00000000..af9912a6
--- /dev/null
+++ b/qml/Veyra/ProStatusSummary.qml
@@ -0,0 +1,27 @@
+// Professional-view reusable presentation component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+import QtQuick.Shapes
+import QtQuick.Effects
+
+ColumnLayout {
+ spacing: 5
+ Text {
+ objectName: "run-active-options"
+ Layout.fillWidth: true
+ visible: veyra.runOptions.length > 0
+ text: qsTr("已开启:%1").arg(veyra.runOptions.join(";"))
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ wrapMode: Text.Wrap
+ maximumLineCount: 3
+ elide: Text.ElideRight
+ HoverHandler { id: optionsHover }
+ ToolTip.visible: optionsHover.hovered
+ ToolTip.delay: 400
+ ToolTip.text: text
+ }
+ ProStatusLight { Layout.fillWidth: true }
+}
diff --git a/qml/Veyra/Ps5SourceDialog.qml b/qml/Veyra/Ps5SourceDialog.qml
new file mode 100644
index 00000000..d35832b1
--- /dev/null
+++ b/qml/Veyra/Ps5SourceDialog.qml
@@ -0,0 +1,160 @@
+// ps5 dialog: source/settings logic is owned by this component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+DialogLayer {
+ id: ps5Dialog
+ objectName: "ps5-dialog"
+ key: "ps5"
+ glyph: "gamepad"
+ title: qsTr("PS5 串流")
+ sub: qsTr("局域网 Remote Play · 凭据加密保存在本机")
+ dialogWidth: 680
+ actions: [
+ { label: veyra.ps5.active ? qsTr("断开") : qsTr("取消") },
+ { label: veyra.ps5.active ? qsTr("应用设置并重连") : qsTr("连接"), primary: true }
+ ]
+ onActionTriggered: label => {
+ if (label === qsTr("断开")) { veyra.ps5Cancel(); return }
+ if (label === qsTr("取消")) { if (veyra.ps5.busy) veyra.ps5Cancel(); else dialogHost.close(); return }
+ if (veyra.ps5Connect()) { dialogHost.close(); dialogHost.startPs5() }
+ }
+ Connections {
+ target: dialogHost
+ function onDialogChanged() { if (dialogHost.dialog === "ps5") veyra.ps5Load() }
+ }
+ readonly property var qualities: [{ id: "0", label: "720p · 30 fps" }, { id: "1", label: "720p · 60 fps" }, { id: "2", label: "1080p · 30 fps" }, { id: "3", label: "1080p · 60 fps" }]
+ readonly property var bitrates: [5, 10, 15, 20, 30, 50, 80, 100].map((m, i) => ({ id: String(i), label: m + " Mbps" }))
+
+ DialogSection { text: qsTr("主机") }
+ DialogGroup {
+ VRow {
+ visible: veyra.ps5Profiles.length > 0
+ label: qsTr("已保存主机")
+ VSelect {
+ objectName: "ps5-profile"
+ implicitWidth: 220
+ value: { const p = veyra.ps5Profiles.find(x => x.id === veyra.ps5.profile); return p ? p.label : qsTr("请选择") }
+ options: veyra.ps5Profiles
+ onPicked: id => veyra.ps5SelectProfile(id)
+ }
+ }
+ VRow {
+ label: qsTr("主机地址")
+ hint: qsTr("PS5 设置 → 网络 → 连接状态;找不到时可手填 IP")
+ RowLayout {
+ spacing: 6
+ DialogTextField { objectName: "ps5-host"; implicitWidth: 170; placeholder: "192.168.1.x"; text: veyra.ps5.host || ""; onEdited: text => veyra.ps5Set("host", text) }
+ VSpinner { visible: veyra.ps5.busy === true; Layout.alignment: Qt.AlignVCenter }
+ VButton { text: qsTr("查找"); ghost: true; enabled: !veyra.ps5.busy; onClicked: veyra.ps5Scan() }
+ VButton { text: qsTr("唤醒"); ghost: true; enabled: !veyra.ps5.busy && veyra.ps5.profile.length > 0; onClicked: veyra.ps5Wake() }
+ }
+ }
+ }
+ DialogSection { text: qsTr("配对(首次)") }
+ DialogGroup {
+ VRow {
+ label: "PSN Account ID"
+ hint: qsTr("账号数字 ID 或 8 字节 Base64,不是昵称;登录 PSN 后自动填入")
+ DialogTextField { implicitWidth: 240; text: veyra.ps5.account || ""; onEdited: text => veyra.ps5Set("account", text) }
+ }
+ VRow {
+ label: qsTr("8 位配对码")
+ hint: qsTr("PS5 设置 → 系统 → 远程游玩 → 关联设备")
+ RowLayout {
+ spacing: 6
+ DialogTextField { id: pairPin; implicitWidth: 120; placeholder: "••••••••" }
+ VButton { text: qsTr("配对并保存"); enabled: !veyra.ps5.busy; onClicked: { veyra.ps5Pair(pairPin.text); pairPin.text = "" } }
+ }
+ }
+ VRow {
+ label: qsTr("删除配对")
+ hint: qsTr("只删除本机保存的这台主机;以后需要重新配对")
+ VButton { text: qsTr("删除"); ghost: true; enabled: !veyra.ps5.busy && veyra.ps5.profile.length > 0; onClicked: veyra.ps5Forget() }
+ }
+ }
+ DialogSection { text: qsTr("PSN 账号") }
+ DialogGroup {
+ VRow {
+ label: veyra.ps5.psnReady ? qsTr("已登录") : qsTr("未登录")
+ hint: qsTr("在 Sony 网页登录后复制回调地址再提交;软件不接触密码")
+ RowLayout {
+ spacing: 6
+ VButton { text: qsTr("登录 PSN"); ghost: true; enabled: !veyra.ps5.busy; onClicked: veyra.ps5PsnLogin() }
+ VButton { text: qsTr("提交登录结果"); ghost: true; enabled: !veyra.ps5.busy; onClicked: veyra.ps5PsnComplete() }
+ VButton { text: qsTr("退出"); ghost: true; enabled: !veyra.ps5.busy && veyra.ps5.psnReady; onClicked: veyra.ps5PsnForget() }
+ }
+ }
+ }
+ DialogSection { text: qsTr("串流(重连生效)") }
+ DialogGroup {
+ VRow {
+ label: qsTr("分辨率与帧率")
+ VSelect { implicitWidth: 170; value: ps5Dialog.qualities[veyra.ps5.quality || 0].label; options: ps5Dialog.qualities; onPicked: id => veyra.ps5Set("quality", Number(id)) }
+ }
+ VRow {
+ label: qsTr("编码")
+ hint: qsTr("HDR 需要 PS5 实际输出 HDR 且 Windows HDR 开启")
+ VSeg {
+ options: [{ id: "0", label: "H.264" }, { id: "1", label: "H.265" }, { id: "2", label: "H.265 HDR" }]
+ current: String(veyra.ps5.codec || 0)
+ onPicked: id => veyra.ps5Set("codec", Number(id))
+ }
+ }
+ VRow {
+ label: qsTr("请求码率")
+ hint: qsTr("发给 PS5 的带宽请求,主机不保证达到")
+ VSelect { implicitWidth: 130; value: ps5Dialog.bitrates[veyra.ps5.bitrate || 0].label; options: ps5Dialog.bitrates; onPicked: id => veyra.ps5Set("bitrate", Number(id)) }
+ }
+ VRow {
+ label: qsTr("解码")
+ VSeg {
+ options: [{ id: "0", label: qsTr("自动") }, { id: "1", label: qsTr("CPU 软件") }, { id: "2", label: qsTr("D3D12VA 硬件") }]
+ current: String(veyra.ps5.decode || 0)
+ onPicked: id => veyra.ps5Set("decode", Number(id))
+ }
+ }
+ VRow {
+ label: qsTr("采样")
+ hint: qsTr("精细:按位置还原色度,放大用双三次;不是 AI 超分")
+ VSeg {
+ options: [{ id: "0", label: qsTr("兼容") }, { id: "1", label: qsTr("精细") }]
+ current: String(veyra.ps5.sampling === undefined ? 1 : veyra.ps5.sampling)
+ onPicked: id => veyra.ps5Set("sampling", Number(id))
+ }
+ }
+ VRow {
+ label: qsTr("仅观看")
+ hint: qsTr("不向 PS5 转发电脑手柄输入")
+ VSwitch { checked: veyra.ps5.viewOnly === true; onToggled: checked => veyra.ps5Set("viewOnly", checked) }
+ }
+ // The mirror of 仅观看: only the pad, the picture from a capture card.
+ VRow {
+ visible: veyra.ps5Control.available === true
+ label: qsTr("画面用采集卡")
+ hint: veyra.ps5Control.enabled === true
+ ? qsTr("已在「采集卡」里打开 PS5 手柄控制:连接采集卡时只用远程游玩传手柄")
+ : qsTr("PS5 的 HDMI 接了采集卡时,可以只用远程游玩传手柄、画面用采集卡原画(可 4K/HDR),也方便再串流给掌机")
+ VButton { objectName: "ps5-open-capture"; text: qsTr("采集卡设置"); ghost: true; onClicked: dialogHost.open("capture") }
+ }
+ VRow {
+ label: qsTr("陀螺仪")
+ hint: veyra.ps5.controller ? (veyra.ps5.gyro ? qsTr("手柄支持陀螺仪") : qsTr("手柄没有陀螺仪")) : qsTr("连接串流及电脑手柄后可校准")
+ VButton { text: veyra.ps5.calibrating ? qsTr("校准中…") : qsTr("校准"); ghost: true; onClicked: veyra.ps5Calibrate() }
+ }
+ }
+ DialogSection { text: qsTr("登录 PIN") }
+ DialogGroup {
+ VRow {
+ label: qsTr("PS5 提示时填写")
+ hint: qsTr("不是 8 位配对码")
+ RowLayout {
+ spacing: 6
+ DialogTextField { id: loginPin; implicitWidth: 120 }
+ VButton { text: qsTr("提交"); ghost: true; onClicked: { veyra.ps5SendLoginPin(loginPin.text); loginPin.text = "" } }
+ }
+ }
+ }
+ DialogNote { visible: (veyra.ps5.status || "").length > 0; text: (veyra.ps5.busy ? qsTr("处理中 · ") : "") + (veyra.ps5.status || "") }
+}
diff --git a/qml/Veyra/SavePresetDialog.qml b/qml/Veyra/SavePresetDialog.qml
new file mode 100644
index 00000000..e1aa4856
--- /dev/null
+++ b/qml/Veyra/SavePresetDialog.qml
@@ -0,0 +1,180 @@
+// save dialog: source/settings logic is owned by this component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+DialogLayer {
+ id: saveDialog
+ objectName: "preset-save-dialog"
+ key: "save"
+ glyph: "plus"
+ readonly property string kindLabel: veyra.nodeMode === 1 ? qsTr("节点") : qsTr("列表")
+ title: qsTr("另存为") + kindLabel + qsTr("预设")
+ sub: kindLabel + qsTr("预设和") + (veyra.nodeMode === 1 ? qsTr("列表") : qsTr("节点")) + qsTr("预设分开保存,互不影响;应用时只覆盖勾选的部分")
+ dialogWidth: 580
+ // presets.js currentItems: what the chain holds right now, one row per
+ // node, with the parameters that matter.
+ function nodeSummary(n) {
+ switch (n.type) {
+ case "sr": return veyra.srTargetLabel + (veyra.videoSrQuality > 0 ? qsTr(" · 质量 ") + veyra.videoSrQuality : "")
+ case "nr": { const l = veyra.nrLayers.find(x => x.index === n.index); return l ? qsTr("强度 ") + l.intensity.toFixed(2) : "NR" }
+ case "video-hdr": return qsTr("峰值 ") + (veyra.videoHdrParams.peakNits || 1000) + " nits"
+ case "protection": return veyra.protectionRegions.length + qsTr(" / 4 个区域")
+ case "color": return qsTr("调色参数")
+ case "frame-generation": return veyra.fgMultiplier + "X · " + (veyra.fgBackendChoices.find(x => x.id === veyra.fgBackendName) || {label: "FG"}).label
+ }
+ return ""
+ }
+ function nodeLabel(n) {
+ if (n.type !== "nr") return n.label
+ let k = 0
+ for (const m of veyra.chain) { if (m.type === "nr") ++k; if (m.index === n.index) break }
+ return qsTr("NR 层 ") + k
+ }
+ readonly property bool nameTaken: presetNameField.text.trim().length > 0 &&
+ veyra.presets.some(p => p.name === presetNameField.text.trim())
+ property var chosen: ({})
+ property var parts: []
+ function resetForOpen() {
+ const current = veyra.presetSaveParts
+ const selected = {}
+ for (const part of current) selected[part.id] = part.meaningful === true
+ parts = current
+ chosen = selected
+ presetNameField.text = ""
+ saveNote.text = ""
+ saveAsDefault.checked = false
+ }
+ actions: [
+ { label: qsTr("取消") },
+ { label: qsTr("保存预设"), primary: true, icon: "check" }
+ ]
+ onActionTriggered: label => {
+ if (label !== qsTr("保存预设")) { dialogHost.close(); return }
+ const name = presetNameField.text.trim()
+ if (name.length === 0) { saveNote.text = qsTr("预设需要一个名字"); return }
+ let mask = 0
+ const ids = ["chain", "color", "fg", "audio", "flow"]
+ for (const part of parts) {
+ const bit = ids.indexOf(part.id)
+ if (bit >= 0 && chosen[part.id] === true) mask |= (1 << bit)
+ }
+ if (mask === 0) { saveNote.text = qsTr("至少选择一项内容"); return }
+ if (veyra.savePresetAs(name, mask, veyra.nodeMode === 1)) {
+ if (saveAsDefault.checked) {
+ const saved = veyra.presets.find(p => p.name === name && p.nodeMode === (veyra.nodeMode === 1))
+ if (saved) veyra.setDefaultPreset(saved.index)
+ }
+ dialogHost.close()
+ }
+ else saveNote.text = qsTr("保存失败:名称可能已存在")
+ }
+
+ // .namebox: the name first, with a live note under it.
+ ColumnLayout {
+ Layout.fillWidth: true
+ Layout.topMargin: 4
+ spacing: 6
+ Text { text: qsTr("预设名称"); color: Theme.t2; font.family: Theme.fontUi; font.pixelSize: 12 }
+ DialogTextField {
+ id: presetNameField
+ objectName: "preset-name"
+ Layout.fillWidth: true
+ placeholder: qsTr("例如:夜间游戏")
+ }
+ Text {
+ objectName: "preset-name-hint"
+ Layout.fillWidth: true
+ text: saveDialog.nameTaken ? qsTr("已有同名预设,换一个名称才能保存")
+ : presetNameField.text.trim().length > 0 ? qsTr("可以保存")
+ : qsTr("名称会显示在极简模式和导出页的预设菜单里")
+ color: saveDialog.nameTaken ? Theme.warn : Theme.ok
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ }
+ }
+ DialogSection { text: qsTr("将保存的内容 · 当前正在使用的") + saveDialog.kindLabel + qsTr("设置") }
+ // .savelist: every node, a green dot when it runs; the list dims when
+ // the effect chain itself is not part of the preset.
+ ColumnLayout {
+ objectName: "preset-save-list"
+ Layout.fillWidth: true
+ spacing: 4
+ opacity: saveDialog.chosen["chain"] === true ? 1 : 0.45
+ Behavior on opacity { NumberAnimation { duration: Theme.d(200) } }
+ Repeater {
+ model: saveDialog.shown ? veyra.chain : []
+ delegate: Rectangle {
+ required property var modelData
+ Layout.fillWidth: true
+ implicitHeight: 34
+ radius: 8
+ color: Qt.rgba(1, 1, 1, 0.03)
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 10
+ anchors.rightMargin: 10
+ spacing: 10
+ Rectangle {
+ implicitWidth: 7; implicitHeight: 7; radius: 3.5
+ color: modelData.enabled ? Theme.ok : Qt.rgba(1, 1, 1, 0.25)
+ }
+ Text {
+ Layout.preferredWidth: 110
+ text: saveDialog.nodeLabel(modelData)
+ color: modelData.enabled ? Theme.t1 : Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 12
+ font.weight: Font.DemiBold; font.variableAxes: Theme.axesDemiBold
+ elide: Text.ElideRight
+ }
+ Text {
+ Layout.fillWidth: true
+ text: saveDialog.nodeSummary(modelData)
+ color: Theme.t3
+ font.family: Theme.fontUi; font.pixelSize: 11
+ elide: Text.ElideRight
+ }
+ VTag { visible: !modelData.enabled; text: qsTr("已关闭") }
+ }
+ }
+ }
+ }
+ DialogSection { text: qsTr("选项") }
+ DialogGroup {
+ Repeater {
+ model: saveDialog.shown ? saveDialog.parts : []
+ delegate: VRow {
+ required property var modelData
+ label: qsTr("包含") + modelData.label
+ hint: modelData.summary
+ VSwitch {
+ objectName: "preset-part-" + modelData.id
+ // A part at its default is still offered, but starts off: a
+ // preset that stored nothing would be a surprise.
+ checked: saveDialog.chosen[modelData.id] === true
+ onToggled: checked => {
+ const c = Object.assign({}, saveDialog.chosen)
+ c[modelData.id] = checked
+ saveDialog.chosen = c
+ }
+ }
+ }
+ }
+ VRow {
+ label: qsTr("保存后设为启动默认")
+ hint: qsTr("下次启动软件时自动应用这个预设")
+ VSwitch { id: saveAsDefault; objectName: "preset-save-default"; checked: false; onToggled: v => checked = v }
+ }
+ }
+ Text {
+ id: saveNote
+ objectName: "preset-save-error"
+ Layout.fillWidth: true
+ Layout.topMargin: 6
+ text: ""
+ color: Theme.warn
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ wrapMode: Text.WordWrap
+ }
+}
diff --git a/qml/Veyra/ScreenSourceDialog.qml b/qml/Veyra/ScreenSourceDialog.qml
new file mode 100644
index 00000000..0d9da072
--- /dev/null
+++ b/qml/Veyra/ScreenSourceDialog.qml
@@ -0,0 +1,132 @@
+// screen dialog: source/settings logic is owned by this component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+DialogLayer {
+ id: screenDialog
+ objectName: "screen-dialog"
+ key: "screen"
+ glyph: "monitor"
+ title: qsTr("屏幕捕获")
+ sub: qsTr("把一个窗口或整块显示器作为片源")
+ dialogWidth: 700
+ actions: [
+ { label: qsTr("取消") },
+ { label: qsTr("开始捕获"), primary: true }
+ ]
+ onActionTriggered: label => {
+ if (label !== qsTr("开始捕获")) { dialogHost.close(); return }
+ if (veyra.startScreenCapture()) { dialogHost.close(); dialogHost.startScreen() }
+ }
+ Connections {
+ target: dialogHost
+ function onDialogChanged() { if (dialogHost.dialog === "screen") veyra.refreshCaptureTargets() }
+ }
+ readonly property var o: veyra.screenOptions
+
+ DialogSection { text: qsTr("目标") }
+ DialogGroup {
+ VRow {
+ label: qsTr("类型")
+ VSeg {
+ objectName: "screen-kind"
+ options: [{ id: "0", label: qsTr("窗口") }, { id: "1", label: qsTr("显示器") }]
+ current: String(screenDialog.o.kind)
+ onPicked: id => veyra.setScreenOption("kind", Number(id))
+ }
+ }
+ VRow {
+ label: qsTr("捕获目标")
+ hint: veyra.screenTargets.length === 0 ? qsTr("未找到可捕获的窗口或显示器") : ""
+ RowLayout {
+ spacing: 6
+ VSelect {
+ objectName: "screen-target"
+ implicitWidth: 300
+ value: veyra.screenTargetLabel
+ options: veyra.screenTargets
+ onPicked: id => veyra.screenTargetId = id
+ }
+ VButton { text: qsTr("刷新"); ghost: true; onClicked: veyra.refreshCaptureTargets() }
+ }
+ }
+ }
+ DialogSection { text: qsTr("游戏") }
+ DialogGroup {
+ VRow {
+ label: qsTr("游戏模式")
+ hint: screenDialog.o.kind === 1
+ ? qsTr("开始后 Veyra 在这块屏幕上全屏,键鼠和手柄直接操作屏幕上的程序;%1 调整画面,%2 退出").arg(veyra.shortcuts.gamePanel).arg(veyra.shortcuts.gameExit)
+ : qsTr("贴合原窗口时可精确穿透鼠标;填满或拉伸支持键盘和手柄,鼠标点击会被拦截以免错位。%1 调整画面,%2 退出;独占全屏请改为无边框窗口").arg(veyra.shortcuts.gamePanel).arg(veyra.shortcuts.gameExit)
+ VSwitch {
+ objectName: "screen-game-mode"
+ checked: screenDialog.o.passthrough === true
+ onToggled: checked => veyra.setScreenOption("passthrough", checked)
+ }
+ }
+ }
+ DialogSection { text: qsTr("采集") }
+ DialogGroup {
+ VRow {
+ label: qsTr("采集方式")
+ hint: screenDialog.o.kind === 1 ? qsTr("DXGI 为显示器兼容方式,无鼠标指针;捕获显示器时不显示黄色边框,Veyra 自己也不会出现在截图和录屏里") : qsTr("窗口只能用 Windows Graphics Capture")
+ VSeg {
+ enabled: screenDialog.o.kind === 1
+ opacity: enabled ? 1 : 0.5
+ options: [{ id: "0", label: "WGC" }, { id: "1", label: "DXGI" }]
+ current: String(screenDialog.o.method)
+ onPicked: id => veyra.setScreenOption("method", Number(id))
+ }
+ }
+ VRow {
+ label: qsTr("帧率上限")
+ hint: qsTr("如果要开启 DLSS5(NR),建议帧率设置 60,减少 DLSS5 需要处理的画面量,减轻负担")
+ hintColor: Theme.err
+ hintBelow: true
+ VSeg {
+ options: [{ id: "0", label: qsTr("跟随") }, { id: "1", label: "30" }, { id: "2", label: "60" }, { id: "3", label: "120" }, { id: "4", label: "144" }, { id: "5", label: "240" }]
+ current: String(screenDialog.o.fps)
+ onPicked: id => veyra.setScreenOption("fps", Number(id))
+ }
+ }
+ VRow {
+ label: qsTr("显示鼠标指针")
+ hint: screenDialog.o.passthrough === true ? qsTr("游戏模式用真实指针,画面里不再画一个") : ""
+ VSwitch {
+ enabled: screenDialog.o.method === 0 && screenDialog.o.passthrough !== true
+ opacity: enabled ? 1 : 0.5
+ checked: screenDialog.o.cursor === true && screenDialog.o.passthrough !== true
+ onToggled: checked => veyra.setScreenOption("cursor", checked)
+ }
+ }
+ VRow {
+ label: qsTr("裁剪(像素)")
+ hint: screenDialog.o.passthrough === true ? qsTr("游戏模式不裁剪;贴合原窗口时画面与鼠标位置一一对应") : qsTr("左 / 上 / 右 / 下,按源像素")
+ RowLayout {
+ spacing: 4
+ enabled: screenDialog.o.passthrough !== true
+ opacity: enabled ? 1 : 0.5
+ Repeater {
+ model: ["left", "top", "right", "bottom"]
+ delegate: DialogTextField {
+ required property string modelData
+ implicitWidth: 58
+ text: String(screenDialog.o[modelData])
+ onEdited: text => veyra.setScreenOption(modelData, Number(text))
+ }
+ }
+ }
+ }
+ VRow {
+ label: qsTr("画面")
+ hint: screenDialog.o.passthrough === true ? qsTr("填满屏幕支持键盘和手柄;需要精确鼠标穿透时请选择贴合原窗口") : ""
+ VSeg {
+ options: [{ id: "fit", label: screenDialog.o.passthrough === true ? qsTr("贴合原窗口") : qsTr("适应窗口") },
+ { id: "fill", label: screenDialog.o.passthrough === true ? qsTr("填满屏幕") : qsTr("填满窗口") }]
+ current: screenDialog.o.fill ? "fill" : "fit"
+ onPicked: id => veyra.setScreenOption("fill", id === "fill")
+ }
+ }
+ }
+}
diff --git a/qml/Veyra/SubtitleSettingsDialog.qml b/qml/Veyra/SubtitleSettingsDialog.qml
new file mode 100644
index 00000000..71bacde7
--- /dev/null
+++ b/qml/Veyra/SubtitleSettingsDialog.qml
@@ -0,0 +1,237 @@
+// subtitle dialog: source/settings logic is owned by this component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+DialogLayer {
+ id: subtitleDialog
+ objectName: "subtitle-dialog"
+ key: "subtitle"
+ glyph: "type"
+ title: qsTr("字幕设置")
+ sub: qsTr("实时预览,设置对所有文件生效")
+ dialogWidth: 620
+ actions: [{ label: qsTr("恢复默认") }, { label: qsTr("完成"), primary: true }]
+ onActionTriggered: label => {
+ if (label !== qsTr("恢复默认")) { dialogHost.close(); return }
+ // The look only: tracks and the timing offset belong to the file.
+ const defaults = { subtitleEnabled: true, subtitleSize: 22, subtitleFont: 0, subtitleOutline: 2,
+ subtitleBackground: false, subtitleMargin: 0, subtitleFit: false, subtitleLines: 2 }
+ for (const key in defaults) veyra.setPreference(key, defaults[key])
+ veyra.logUi("ui-subtitle", "style reset to defaults")
+ }
+
+ readonly property var prefs: veyra.preferences
+ function pref(key, fallback) { return prefs[key] !== undefined ? prefs[key] : fallback }
+ readonly property var trackOptions: [{ id: "-1", label: qsTr("关闭", "off") }]
+ .concat(veyra.subtitleTracks.map(t => ({ id: String(t.index), label: t.label + " · " + t.note, disabled: !t.usable })))
+ function trackLabel(index) {
+ const t = veyra.subtitleTracks.find(x => x.index === index)
+ return t ? t.label : qsTr("关闭", "off")
+ }
+
+ // dialogs.js .sub-prev: a sample line over the picture, drawn with the
+ // current style so every change shows at once.
+ Rectangle {
+ id: subPreview
+ objectName: "subtitle-preview"
+ Layout.fillWidth: true
+ Layout.topMargin: 4
+ implicitHeight: 180
+ radius: 10
+ border.width: 1
+ border.color: Theme.stroke
+ clip: true
+ gradient: Gradient {
+ GradientStop { position: 0; color: "#1B2230" }
+ GradientStop { position: 1; color: "#0B0C10" }
+ }
+ readonly property real scaleFactor: height / 540
+ Image {
+ anchors.fill: parent
+ anchors.margins: 1
+ fillMode: Image.PreserveAspectCrop
+ asynchronous: true
+ visible: status === Image.Ready
+ source: subtitleDialog.shown && veyra.hasSource && !veyra.isCapture && veyra.duration > 0
+ ? "image://veyra-thumb/" + veyra.thumbnailGeneration + "/" + Math.floor(veyra.position / 2) * 2000 : ""
+ }
+ Column {
+ objectName: "subtitle-preview-lines"
+ visible: subtitleDialog.pref("subtitleEnabled", true)
+ anchors.horizontalCenter: parent.horizontalCenter
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 12 + subtitleDialog.pref("subtitleMargin", 0) * subPreview.scaleFactor
+ spacing: 2
+ Repeater {
+ model: veyra.subtitleText.length > 0 ? veyra.subtitleText.split("\n").slice(0, 2)
+ : [qsTr("这是字幕预览,"), qsTr("改动会实时显示在这里。")]
+ delegate: Rectangle {
+ required property string modelData
+ anchors.horizontalCenter: parent.horizontalCenter
+ width: line.implicitWidth + 16
+ height: line.implicitHeight + 2
+ radius: 4
+ color: subtitleDialog.pref("subtitleBackground", false) ? Qt.rgba(0, 0, 0, 0.6) : "transparent"
+ Text {
+ id: line
+ anchors.centerIn: parent
+ text: modelData
+ color: "#FFFFFF"
+ readonly property var families: ["", "SimHei", "SimSun", "DengXian", "Arial", "Segoe UI"]
+ font.family: families[subtitleDialog.pref("subtitleFont", 0)] || Theme.fontUi
+ font.pixelSize: Math.max(12, subtitleDialog.pref("subtitleSize", 22) * 0.8)
+ font.weight: Font.DemiBold
+ style: subtitleDialog.pref("subtitleOutline", 2) > 0 ? Text.Outline : Text.Normal
+ styleColor: Qt.rgba(0, 0, 0, subtitleDialog.pref("subtitleOutline", 2) >= 3 ? 1 : 0.85)
+ }
+ }
+ }
+ }
+ }
+
+ DialogSection { text: qsTr("字幕轨") }
+ DialogGroup {
+ VRow {
+ label: qsTr("主字幕")
+ hint: veyra.subtitleTracks.length === 0 ? (veyra.subtitleStatus.length > 0 ? veyra.subtitleStatus : (veyra.hasSource ? qsTr("当前片源没有字幕") : qsTr("打开视频后显示可用字幕"))) : ""
+ VSelect {
+ objectName: "subtitle-primary"
+ implicitWidth: 220
+ value: subtitleDialog.trackLabel(veyra.subtitlePrimary)
+ options: subtitleDialog.trackOptions
+ onPicked: id => veyra.subtitlePrimary = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("副字幕(双语)")
+ hint: qsTr("显示在主字幕上方")
+ VSelect {
+ objectName: "subtitle-secondary"
+ implicitWidth: 220
+ value: subtitleDialog.trackLabel(veyra.subtitleSecondary)
+ options: subtitleDialog.trackOptions
+ onPicked: id => veyra.subtitleSecondary = Number(id)
+ }
+ }
+ VRow {
+ label: qsTr("外挂字幕")
+ hint: qsTr("文本字幕 · PGS/SUP · VobSub(IDX+SUB)")
+ VButton { objectName: "subtitle-load"; text: qsTr("加载文件…"); onClicked: veyra.loadSubtitleDialog() }
+ }
+ VRow {
+ label: qsTr("默认显示副字幕")
+ hint: qsTr("打开新文件时自动选第二条可用字幕")
+ VSwitch {
+ checked: subtitleDialog.pref("subtitleSecondLanguage", false)
+ onToggled: checked => veyra.setPreference("subtitleSecondLanguage", checked)
+ }
+ }
+ }
+ DialogSection { text: qsTr("时间") }
+ DialogGroup {
+ VRow {
+ label: qsTr("主字幕延时")
+ hint: qsTr("Z / X 微调 50 ms,Shift 为 1 s;正值 = 字幕推后")
+ // .stepper: − value +, 50 ms a step; the value can be typed.
+ RowLayout {
+ objectName: "subtitle-delay-stepper"
+ spacing: 4
+ VButton { objectName: "subtitle-delay-minus"; icon: true; iconName: "minus"; implicitWidth: 28; implicitHeight: 28; onClicked: veyra.nudgeSubtitle(-50) }
+ DialogTextField {
+ objectName: "subtitle-delay-value"
+ implicitWidth: 86
+ text: veyra.subtitleOffsetMs + " ms"
+ onEdited: text => { const v = parseInt(text); if (isFinite(v)) veyra.subtitleOffsetMs = v }
+ }
+ VButton { objectName: "subtitle-delay-plus"; icon: true; iconName: "plus"; implicitWidth: 28; implicitHeight: 28; onClicked: veyra.nudgeSubtitle(50) }
+ }
+ }
+ VRow {
+ label: qsTr("按音轨自动对齐")
+ hint: veyra.subtitleStatus.length > 0 ? veyra.subtitleStatus : qsTr("分析前 30 分钟的人声与字幕时间")
+ VButton {
+ text: veyra.subtitleAligning ? qsTr("分析中…") : qsTr("自动对齐")
+ enabled: !veyra.subtitleAligning && veyra.subtitlePrimary >= 0
+ onClicked: veyra.autoAlignSubtitle()
+ }
+ }
+ }
+ DialogSection { text: qsTr("样式") }
+ DialogGroup {
+ VRow {
+ label: qsTr("显示字幕")
+ hint: qsTr("快捷键 B")
+ VSwitch {
+ objectName: "subtitle-enabled"
+ checked: subtitleDialog.pref("subtitleEnabled", true)
+ onToggled: checked => veyra.setPreference("subtitleEnabled", checked)
+ }
+ }
+ VRow {
+ label: qsTr("字号")
+ value: subtitleDialog.pref("subtitleSize", 22) + " px"
+ VSlider {
+ objectName: "subtitle-size"
+ implicitWidth: 170
+ from: 16; to: 56; value: subtitleDialog.pref("subtitleSize", 22)
+ onMoved: veyra.setPreference("subtitleSize", Math.round(value))
+ }
+ }
+ VRow {
+ label: qsTr("字体")
+ VSelect {
+ objectName: "subtitle-font"
+ implicitWidth: 170
+ readonly property var names: [qsTr("字幕原字体"), qsTr("黑体"), qsTr("宋体"), qsTr("等线"), "Arial", "Segoe UI"]
+ value: names[subtitleDialog.pref("subtitleFont", 0)]
+ options: names.map((n, i) => ({ id: String(i), label: n }))
+ onPicked: id => veyra.setPreference("subtitleFont", Number(id))
+ }
+ }
+ VRow {
+ label: qsTr("描边")
+ VSeg {
+ objectName: "subtitle-outline"
+ options: [{ id: "0", label: qsTr("无") }, { id: "1", label: qsTr("细") }, { id: "2", label: qsTr("标准") }, { id: "3", label: qsTr("粗") }]
+ current: String(subtitleDialog.pref("subtitleOutline", 2))
+ onPicked: id => veyra.setPreference("subtitleOutline", Number(id))
+ }
+ }
+ VRow {
+ label: qsTr("背景条")
+ VSwitch {
+ checked: subtitleDialog.pref("subtitleBackground", false)
+ onToggled: checked => veyra.setPreference("subtitleBackground", checked)
+ }
+ }
+ VRow {
+ label: qsTr("底部距离")
+ value: subtitleDialog.pref("subtitleMargin", 0) + " px"
+ VSlider {
+ objectName: "subtitle-margin"
+ implicitWidth: 170
+ from: 0; to: 240; value: subtitleDialog.pref("subtitleMargin", 0)
+ onMoved: veyra.setPreference("subtitleMargin", Math.round(value))
+ }
+ }
+ VRow {
+ label: qsTr("长句自动缩小")
+ hint: qsTr("默认保持字号;开启后超过目标行数才缩小")
+ VSwitch {
+ checked: subtitleDialog.pref("subtitleFit", false)
+ onToggled: checked => veyra.setPreference("subtitleFit", checked)
+ }
+ }
+ VRow {
+ visible: subtitleDialog.pref("subtitleFit", false)
+ label: qsTr("目标行数")
+ value: String(subtitleDialog.pref("subtitleLines", 2))
+ VSlider {
+ implicitWidth: 170
+ from: 1; to: 8; value: subtitleDialog.pref("subtitleLines", 2)
+ onMoved: veyra.setPreference("subtitleLines", Math.round(value))
+ }
+ }
+ }
+}
diff --git a/qml/Veyra/XboxSourceDialog.qml b/qml/Veyra/XboxSourceDialog.qml
new file mode 100644
index 00000000..fc3ba8a0
--- /dev/null
+++ b/qml/Veyra/XboxSourceDialog.qml
@@ -0,0 +1,143 @@
+// xbox dialog: source/settings logic is owned by this component.
+import QtQuick
+import QtQuick.Controls
+import QtQuick.Layouts
+
+DialogLayer {
+ id: xbDialog
+ objectName: "xbox-dialog"
+ key: "xbox"
+ glyph: "gamepad"
+ title: qsTr("Xbox 串流")
+ sub: qsTr("串流你自己的 Xbox 主机 · 非官方实验功能 · 增强与调色沿用软件自己的处理链")
+ dialogWidth: 680
+ readonly property var xb: veyra.xbox
+ readonly property var st: xb ? xb.state : ({})
+ readonly property var list: xb ? xb.consoles : []
+ actions: st.streaming ? [
+ { label: qsTr("关闭") },
+ { label: qsTr("断开"), primary: true }
+ ] : !st.signedIn ? [
+ { label: st.busy ? qsTr("取消操作") : qsTr("关闭") }
+ ] : [
+ { label: st.busy ? qsTr("取消操作") : qsTr("关闭") },
+ { label: qsTr("开始串流"), primary: true, icon: "play" }
+ ]
+ onActionTriggered: label => {
+ if (label === qsTr("断开")) { veyra.xboxDisconnect(); dialogHost.close(); return }
+ if (label === qsTr("取消操作")) { xb.cancel(); return }
+ if (label === qsTr("关闭")) { dialogHost.close(); return }
+ if (st.signedIn && !st.busy && (st.selected || "").length > 0) xb.connectStream()
+ }
+ Connections {
+ target: xbDialog
+ function onShownChanged() { if (xbDialog.shown && xbDialog.xb) xbDialog.xb.load() }
+ }
+ Connections {
+ target: xbDialog.xb
+ function onStarted() { dialogHost.close(); dialogHost.startXbox() }
+ }
+
+ DialogNote {
+ text: qsTr("非官方:使用与 Greenlight 等开源客户端相同的方式连接微软的串流服务,不隶属于微软,微软随时可能改动导致失效。仅限你自己的账号和主机。")
+ }
+ DialogSection { text: qsTr("账号") }
+ DialogGroup {
+ VRow {
+ label: xbDialog.st.signedIn ? qsTr("已登录") : qsTr("未登录")
+ hint: xbDialog.st.signedIn ? qsTr("登录信息加密保存在本机;退出会删除它") : qsTr("用你的 Xbox(微软)账号在微软的页面登录,软件看不到密码")
+ RowLayout {
+ spacing: 6
+ VSpinner { visible: xbDialog.st.busy === true; Layout.alignment: Qt.AlignVCenter }
+ VButton { objectName: "xbox-signin"; visible: !xbDialog.st.signedIn; text: qsTr("登录"); primary: true; enabled: !xbDialog.st.busy; onClicked: xbDialog.xb.signIn() }
+ VButton { visible: xbDialog.st.signedIn; text: qsTr("退出登录"); ghost: true; enabled: !xbDialog.st.busy; onClicked: xbDialog.xb.signOut() }
+ }
+ }
+ }
+ // The device code, large, with the page to type it into.
+ Rectangle {
+ visible: (xbDialog.st.code || "").length > 0
+ objectName: "xbox-code-box"
+ Layout.fillWidth: true
+ Layout.topMargin: 8
+ implicitHeight: codeCol.implicitHeight + 28
+ radius: 11
+ color: Theme.accentSoft
+ border.width: 1
+ border.color: Theme.accent
+ ColumnLayout {
+ id: codeCol
+ anchors.fill: parent
+ anchors.margins: 14
+ spacing: 8
+ Text {
+ Layout.fillWidth: true
+ text: qsTr("在手机或浏览器打开 ") + (xbDialog.st.verificationUri || "https://www.microsoft.com/link") + qsTr(",输入下面的登录码:")
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ wrapMode: Text.WordWrap
+ }
+ Text {
+ objectName: "xbox-code"
+ Layout.alignment: Qt.AlignHCenter
+ text: xbDialog.st.code || ""
+ color: Theme.t1
+ font.family: Theme.fontMono
+ font.pixelSize: 30
+ font.letterSpacing: 4
+ }
+ VButton { Layout.alignment: Qt.AlignHCenter; text: qsTr("在浏览器打开登录页"); ghost: true; onClicked: xbDialog.xb.openSignInPage() }
+ }
+ }
+
+ DialogSection { visible: !!xbDialog.st.signedIn; text: qsTr("主机") }
+ Repeater {
+ model: xbDialog.st.signedIn ? xbDialog.list : []
+ delegate: Rectangle {
+ id: consoleRow
+ required property var modelData
+ readonly property bool picked: xbDialog.st.selected === modelData.id
+ objectName: "xbox-console-" + modelData.id
+ Layout.fillWidth: true
+ Layout.topMargin: 6
+ implicitHeight: 54
+ radius: 11
+ color: picked ? Theme.accentSoft : (consoleHover.hovered ? Theme.card3 : Theme.card2)
+ border.width: 1
+ border.color: picked ? Theme.accent : Theme.stroke
+ HoverHandler { id: consoleHover; cursorShape: Qt.PointingHandCursor }
+ TapHandler {
+ onTapped: xbDialog.xb.select(consoleRow.modelData.id)
+ onDoubleTapped: { xbDialog.xb.select(consoleRow.modelData.id); if (!xbDialog.st.busy) xbDialog.xb.connectStream() }
+ }
+ RowLayout {
+ anchors.fill: parent
+ anchors.leftMargin: 14
+ anchors.rightMargin: 12
+ spacing: 12
+ VDot { off: consoleRow.modelData.power === qsTr("关机"); warn: consoleRow.modelData.power === qsTr("正在更新"); Layout.alignment: Qt.AlignVCenter }
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 1
+ Text { Layout.fillWidth: true; text: consoleRow.modelData.name; color: Theme.t1; font.family: Theme.fontUi; font.pixelSize: Theme.fsBody; font.weight: Font.Medium; elide: Text.ElideRight }
+ Text { Layout.fillWidth: true; text: consoleRow.modelData.type + " · " + consoleRow.modelData.power; color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: Theme.fsSmall; elide: Text.ElideRight }
+ }
+ }
+ }
+ }
+ DialogGroup {
+ visible: !!xbDialog.st.signedIn
+ VRow {
+ label: qsTr("主机列表")
+ hint: qsTr("主机要用同一个账号登录,并在 设置 → 设备和连接 → 远程功能 里启用远程功能")
+ VButton { text: qsTr("刷新"); ghost: true; enabled: !xbDialog.st.busy; onClicked: xbDialog.xb.refresh() }
+ }
+ VRow {
+ label: qsTr("手柄")
+ hint: qsTr("把电脑手柄当作主机上的手柄")
+ VSwitch { objectName: "xbox-gamepad"; checked: xbDialog.st.gamepad !== false; onToggled: checked => xbDialog.xb.set("gamepad", checked) }
+ }
+ }
+ DialogNote { objectName: "xbox-status"; visible: (xbDialog.st.status || "").length > 0; text: (xbDialog.st.busy ? qsTr("处理中 · ") : "") + (xbDialog.st.status || "") }
+}
diff --git a/qml/Veyra/qmldir b/qml/Veyra/qmldir
index b35ea6d7..05a7c200 100644
--- a/qml/Veyra/qmldir
+++ b/qml/Veyra/qmldir
@@ -47,3 +47,31 @@ VEqBars 1.0 VEqBars.qml
VTelemetryValue 1.0 VTelemetryValue.qml
SponsorPanel 1.0 SponsorPanel.qml
RotateButton 1.0 RotateButton.qml
+
+
+# Professional-view reusable components
+ProPresentationRows 1.0 ProPresentationRows.qml
+ProPerfOrb 1.0 ProPerfOrb.qml
+ProPerfOrbs 1.0 ProPerfOrbs.qml
+ProStatusLight 1.0 ProStatusLight.qml
+ProStatusSummary 1.0 ProStatusSummary.qml
+ProAddLayerButton 1.0 ProAddLayerButton.qml
+ProAudioPanel 1.0 ProAudioPanel.qml
+ProDisplayPanel 1.0 ProDisplayPanel.qml
+
+# Dialog components
+DialogLayer 1.0 DialogLayer.qml
+DialogSection 1.0 DialogSection.qml
+DialogGroup 1.0 DialogGroup.qml
+DialogNote 1.0 DialogNote.qml
+DialogTextField 1.0 DialogTextField.qml
+NetworkSourceDialog 1.0 NetworkSourceDialog.qml
+CaptureSourceDialog 1.0 CaptureSourceDialog.qml
+Ps5SourceDialog 1.0 Ps5SourceDialog.qml
+PcSourceDialog 1.0 PcSourceDialog.qml
+XboxSourceDialog 1.0 XboxSourceDialog.qml
+ScreenSourceDialog 1.0 ScreenSourceDialog.qml
+SubtitleSettingsDialog 1.0 SubtitleSettingsDialog.qml
+AudioSettingsDialog 1.0 AudioSettingsDialog.qml
+SavePresetDialog 1.0 SavePresetDialog.qml
+ManagePresetsDialog 1.0 ManagePresetsDialog.qml
diff --git a/scripts/i18n/extract.py b/scripts/i18n/extract.py
index f21d115b..b65dc308 100644
--- a/scripts/i18n/extract.py
+++ b/scripts/i18n/extract.py
@@ -119,7 +119,10 @@ def collect():
for f in sorted((ROOT / 'qml/Veyra').glob('*.qml')):
for s, ctx in qml_strings(f.read_text(encoding='utf-8')):
add(s, 'qml/' + f.name, ctx)
- cpp = list((ROOT / 'src/ui').glob('*.cpp')) + list((ROOT / 'apps/veyra-qml').glob('*.cpp'))
+ cpp = list((ROOT / 'src/ui').rglob('*.cpp')) + list((ROOT / 'apps/veyra-qml').glob('*.cpp'))
+ # The bridge's private state/default strings moved out of its translation
+ # unit. Keep collecting exactly that source alongside its domain modules.
+ cpp += [ROOT / 'src/ui/QmlPlayerBridge_p.h']
for d in ('engine', 'source', 'gfx', 'pipeline', 'moonlight', 'xbox', 'remoteplay', 'sink', 'media', 'ngx', 'base'):
cpp += list((ROOT / 'src' / d).rglob('*.cpp'))
# Default member values (a status set in a class body) live in the headers.
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index a2a70772..0a3af697 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -1,948 +1,7 @@
-#include "veyra/media/FFmpegDeinterlacer.h"
-#include "veyra/ui/QmlPlayerBridge.h"
-#include "veyra/gfx/PresentSink.h"
-#include "veyra/gfx/NvidiaVrr.h"
-#include "veyra/media/NetworkInput.h"
-#include "veyra/ngx/DlssgLite.h"
-#include "veyra/RuntimePaths.h"
-#include "veyra/ui/GamePassthrough.h"
-#include <QAbstractNativeEventFilter>
-#include <QGuiApplication>
-#include <QScreen>
-#include <QtGui/qscreen_platform.h>
-#include <shellapi.h>
-#include <QElapsedTimer>
-#include <QScopedValueRollback>
-#include "veyra/ui/EffectAvailability.h"
-#include "veyra/engine/FrameGenerationSelection.h"
-#include "veyra/ui/QmlExportQueueModel.h"
-#include "veyra/ui/PlaylistModel.h"
-#include "veyra/ui/UpdateChecker.h"
-#include "veyra/ui/UiLanguage.h"
-#include <QQmlEngine>
-#include <QMetaMethod>
-#include <QMetaProperty>
-#include <QSet>
-
-#include <QRegion>
-#include <QCursor>
-#include <QScreen>
-#include <QWindow>
-#include <QPlatformSurfaceEvent>
-#include <QPointer>
-
-#include <QDateTime>
-#include <QDir>
-#include <QFileDialog>
-#include <QFileInfo>
-#include <QDesktopServices>
-#include <QStandardPaths>
-#include <QKeyEvent>
-#include <QKeySequence>
-#include <QCoreApplication>
-#include <QClipboard>
-#include <QGuiApplication>
-#include <QJsonDocument>
-#include <QJsonObject>
-#include <QJsonArray>
-#include <QHash>
-#include <QFile>
-#include <QSaveFile>
-#include <QTimer>
-#include <QBuffer>
-#include <QImage>
-#include <QImageReader>
-
-#include <algorithm>
-#include <cmath>
-#include <chrono>
-#include <limits>
-#include <optional>
-#include <span>
-#include <vector>
-
-#include "veyra/Log.h"
-#include "veyra/RuntimePaths.h"
-#include "veyra/pipeline/VfgBackend.h"
-#include "veyra/gfx/GpuSchedulingPriority.h"
-#include "veyra/engine/ColorLookStore.h"
-#include "veyra/engine/ColorLut.h"
-#include "veyra/engine/Subtitles.h"
-#include "veyra/engine/PlaybackRate.h"
-#include "veyra/sink/WasapiAudioSink.h"
-#include "veyra/source/CaptureFormatSelection.h"
-#include "veyra/source/CaptureCapabilityRange.h"
-#include "veyra/source/CaptureFormatRank.h"
-#include "veyra/source/CaptureColorOverride.h"
-#include "veyra/source/CaptureFrameRate.h"
-#include "veyra/source/MagewellCapture.h"
-#include "CapturePreferenceStore.h"
-#ifdef VEYRA_ENABLE_REMOTEPLAY
-// SDL3-static's system libraries (see CMakeLists: kept off the link line).
-#pragma comment(lib, "winmm.lib")
-#pragma comment(lib, "imm32.lib")
-#pragma comment(lib, "version.lib")
-#pragma comment(lib, "setupapi.lib")
-#pragma comment(lib, "dinput8.lib")
-#include "veyra/remoteplay/ControllerInput.h"
-#include "veyra/remoteplay/Discovery.h"
-#include "veyra/remoteplay/ProfileStore.h"
-#include "veyra/remoteplay/PsnAuth.h"
-#include "veyra/source/RemotePlaySource.h"
-#endif
-#ifdef VEYRA_ENABLE_XBOX
-#include "veyra/ui/XboxModel.h"
-#endif
-#ifdef VEYRA_ENABLE_MOONLIGHT
-#include "veyra/ui/MoonlightInputCapture.h"
-#include "veyra/ui/MoonlightModel.h"
-#endif
-#include <future>
-#include <functional>
-#include <map>
-#include <deque>
-#include "SubtitleOverlay.h"
-// GDI+ is only started here (the overlay draws with it); its headers expect
-// min/max, which NOMINMAX builds do not define as macros.
-#include <objidl.h>
-namespace Gdiplus { using std::min; using std::max; }
-#include <gdiplus.h>
-#pragma comment(lib, "gdiplus.lib")
-// 1.4.4's live status rules (正常 / 补帧调度降档 / 输出未达标 / 输入帧率不足).
-#include "LiveStatusHistory.h"
-// GPU utilization for the performance orb: the Windows "GPU Engine" counters,
-// the same source Task Manager reads.
-#include <pdh.h>
-#include <pdhmsg.h>
-#pragma comment(lib, "pdh.lib")
-#include <atomic>
-#include <set>
-#include <mutex>
-#include <thread>
-#include "veyra/pipeline/ColorGradeTables.h"
-#include "veyra/ui/PlaybackPowerGuard.h"
-#include "veyra/gfx/XessMfgUnlock.h"
-#include "veyra/gfx/D3D12DeviceContext.h"
-#include "veyra/gfx/PresentationHooks.h"
-#include <dxgi1_6.h>
-#include <wrl/client.h>
-#include "veyra/ngx/NrArchitecturePolicy.h"
-#include "veyra/ngx/FgCompatibilitySession.h"
-#include "veyra/source/CaptureCardSource.h"
-#include "veyra/source/DeckLinkCapture.h"
-#include "veyra/source/CaptureSignalProbe.h"
-#include "veyra/source/ScreenCaptureSource.h"
+// QML bridge: Core responsibilities.
+#include "QmlPlayerBridge_p.h"
namespace veyra::ui {
-namespace {
-QString utf8Of(std::string_view s) { return QString::fromUtf8(s.data(), int(s.size())); }
-QString utf8Of(const std::wstring& w) { return QString::fromWCharArray(w.c_str(), int(w.size())); }
-
-// Where crash and device-loss hints go: next to the log, where the crash handler in
-// apps/veyra-qml/main.cpp writes them too.
-QString lastFailurePath() {
- return QFileInfo(qApp->property("veyraLogFile").toString()).absolutePath() + QStringLiteral("/veyra-last-failure.txt");
-}
-
-// What the user can switch off, for the injected components named in `modules`
-// (RTSSHooks64.dll, see gfx::riskyInjections). Empty when none is known.
-QString injectionAdvice(const QString& modules) {
- QStringList parts;
- if (modules.contains(QStringLiteral("RTSSHooks64.dll"), Qt::CaseInsensitive) && !qApp->property("veyraSoftwareUi").toBool())
- parts << QCoreApplication::translate("QmlPlayerBridge", "检测到 RivaTuner(小飞机 OSD)注入了 Veyra。请把 设置 → 监控软件兼容 设为“自动”并在小飞机运行时重启 Veyra:界面改用兼容绘制,OSD 只显示在视频上");
- return parts.join(QStringLiteral(";"));
-}
-// Messages and fixed table labels shown to the user, in the interface language
-// (UiLanguage.h). Data that only passes through the UI - paths, device, preset and
-// LUT names - keeps utf8Of(), and so do log lines.
-QString uiText(const std::wstring& w) { return veyra::ui::i18n::text(w); }
-QString uiText(std::string_view s) { return veyra::ui::i18n::text(QString::fromUtf8(s.data(), int(s.size()))); }
-std::wstring wideOf(const QString& s) {
- return std::wstring(reinterpret_cast<const wchar_t*>(s.utf16()), size_t(s.size()));
-}
-QString mmss(double seconds) {
- if (!std::isfinite(seconds) || seconds < 0) seconds = 0;
- const int total = int(seconds);
- const int h = total / 3600, m = (total % 3600) / 60, s = total % 60;
- return h > 0 ? QStringLiteral("%1:%2:%3").arg(h).arg(m, 2, 10, QLatin1Char('0')).arg(s, 2, 10, QLatin1Char('0'))
- : QStringLiteral("%1:%2").arg(m).arg(s, 2, 10, QLatin1Char('0'));
-}
-void exportCompletionNotice(bool enabled,uint64_t event,const char* kind){
- const BOOL queued=enabled?MessageBeep(MB_OK):FALSE;
- veyra::log::info("export-notify",std::format("kind={} event={} soundEnabled={} systemSoundQueued={}",kind,event,enabled,queued!=FALSE));
-}
-bool exportFileClosed(const QString& path){
- HANDLE file=CreateFileW(wideOf(path).c_str(),GENERIC_READ,0,nullptr,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,nullptr);
- if(file==INVALID_HANDLE_VALUE)return false;
- CloseHandle(file);return true;
-}
-} // namespace
-
-static QVariantMap currentEffectCapabilities(bool refresh=false);
-static QString unavailableEffects(const engine::EnhancementSettings& settings);
-static QString disableUnavailableEffects(engine::ChainConfiguration& configuration);
-static ui::EffectGpu effectGpu();
-
-namespace {
-// WM_DISPLAYCHANGE reaches every top-level window when a display mode, refresh
-// rate or HDR state, or the set of screens, changes: the 可变刷新 state is then
-// read once more (DisplayStateService) instead of on a timer.
-struct DisplayChangeFilter final : QAbstractNativeEventFilter {
- bool* changed = nullptr;
- bool nativeEventFilter(const QByteArray& type, void* message, qintptr*) override {
- if (changed && type == "windows_generic_MSG" && static_cast<const MSG*>(message)->message == WM_DISPLAYCHANGE) *changed = true;
- return false;
- }
-};
-}
-
-struct QmlPlayerBridge::Impl {
- // Per-layer on/off before the NR master switch turned them all off.
- std::vector<bool> nrMasterRestore;
- std::vector<bool> beautyMasterRestore; // the same for the beauty group switch
- QQmlEngine* qmlEngine = nullptr;
- engine::EngineController& engine;
- PlayerUiFacade facade;
-
- // Last published snapshot and the revision it came from. Polling compares
- // revisions, so an unchanged snapshot costs one comparison per tick.
- engine::PlayerSnapshot snapshot;
- uint64_t publishedRevision = 0;
- bool haveSnapshot = false;
- bool openingSource = false;
- uint64_t openingSessionId = 0;
- uint64_t vramNoticeSession = 0; // the session the video-memory warning was shown for
-
- // The chain the UI edits, kept in step with the facade's pending settings.
- engine::EffectChain chain;
- engine::EffectChain acceptedChain;
- engine::NodeGraphLayout layout;
- engine::ChainGlobalSettings draftGlobals;
- const engine::EffectChain& activeRuntime() const {
- return chain.mode == engine::ChainMode::Node ? acceptedChain : chain;
- }
- void initializeDefaultNodePositions() {
- if (chain.mode != engine::ChainMode::Node) return;
- for (uint32_t i = 0; i < chain.nodeCount; ++i)
- if (chain.nodes[i].viewX == 0 && chain.nodes[i].viewY == 0) {
- chain.nodes[i].viewX = float(i % 4) * 260;
- chain.nodes[i].viewY = float(i / 4) * 300;
- }
- }
- void restoreConfiguration(const engine::ChainConfiguration& c) {
- draftGlobals = c.editor && c.editor->globals ? *c.editor->globals :
- static_cast<const engine::ChainGlobalSettings&>(c);
- acceptedChain = c.chain;
- chain = c.editor ? c.editor->nodes : c.chain;
- if (c.editor) layout = c.editor->layout;
- else if (chain.mode == engine::ChainMode::Node) layout.initialize(chain);
- selectedNr = c.selectedNr; selectedColour = c.selectedColour;
- // Resolve the old QML-only layout fallback once so duplication, wires
- // and saved coordinates use the same physical rectangles.
- if (!c.editor) initializeDefaultNodePositions();
- }
- engine::ChainValidation validation;
- engine::ChainSession session;
- engine::ChainSession savedSession;
- QTimer* sessionSaveTimer = nullptr;
- int selectedNr=-1;
- int nrIndex() const {
- if(selectedNr>=0&&uint32_t(selectedNr)<chain.nodeCount&&
- chain.nodes[selectedNr].type==engine::EffectType::NrEnhance)return selectedNr;
- for(uint32_t i=0;i<chain.nodeCount;++i)if(chain.nodes[i].type==engine::EffectType::NrEnhance)return int(i);
- return -1;
- }
- engine::ChainNode* nrNode(){const int i=nrIndex();return i>=0?&chain.nodes[i]:nullptr;}
- int selectedColour=-1;
- int colourIndex() const {
- if(selectedColour>=0&&uint32_t(selectedColour)<chain.nodeCount&&
- chain.nodes[selectedColour].type==engine::EffectType::Color)return selectedColour;
- for(uint32_t i=0;i<chain.nodeCount;++i)if(chain.nodes[i].type==engine::EffectType::Color)return int(i);
- return -1;
- }
-
- // The window the engine presents into, and the last file the UI opened.
- HWND videoWindow = nullptr;
- std::wstring sourceLabel;
- int thumbnailGeneration = 0;
- // The live source kind and label ("" for a file), for the page headers.
- QString liveKind, liveLabel;
- // A live open waiting for the 极简 switch to settle (openAfterCinema); the
- // generation lets a newer open or a stop cancel it.
- int liveOpenGen = 0;
- QString pendingLiveText;
- // 调色 history: each commit pushes the layer's previous state; a slider
- // drag (edits under 600 ms apart on one layer) is one step.
- struct ColourStep { int index = -1; engine::ColorSettings colour{}; };
- std::vector<ColourStep> colourUndo, colourRedo;
- std::optional<engine::ColorSettings> colourClip;
- qint64 colourLastPushMs = 0;
- int colourLastIndex = -1;
- bool colourReplaying = false;
- // Poster data URL cache, per session.
- uint64_t posterSession = 0;
- QString posterUrl;
-
- // Keeps the display and system awake while a video plays (AppShell rule: running,
- // not failed, not a still image, transport Playing). Acquired and released on
- // this GUI thread, as SetThreadExecutionState requires.
- PlaybackPowerGuard power;
- std::function<void()> preOpen;
-
- // Export progress is mirror state: the engine reports an export through a
- // progress callback, and there is no export status in PlayerSnapshot yet.
- bool exportRunning = false;
- std::wstring exportOutput;
- QString exportStatus;
- engine::PlayerOptions options;
-
- // The export job manager is the real thing: state, progress and encoded
- // counts come from its snapshot.
- engine::ExportJobManager exportJob;
- QmlExportQueueModel exportQueue{exportJob};
- int exportContainer=0;
- uint64_t exportNotifiedBatch=0;
- QString pendingFrameExport;
- qint64 pendingFrameDeadline=0;
- uint64_t imageCompletionEvent=0;
- engine::ExportJobSnapshot exportSnapshot;
- bool exportHevc = false;
- // Default: VBR at 8 Mbps (field request 2026-10-02); CQ stays one tap away.
- uint32_t exportBitrateMbps = 8;
- sink::ExportRateControl exportRateControl = sink::ExportRateControl::Vbr;
- int exportResolutionIndex = -1;
- double exportTrimStartSeconds = 0.0;
- double exportTrimEndSeconds = 0.0;
- std::wstring exportPresetName;
- QString initialPageOverride;
- QString currentPage;
- std::wstring captureDevice;
- QString screenTarget;
- QString remotePlayHost, remotePlayPin;
-
- QTimer* timer = nullptr;
-
- // Canvas positions of the fixed input / optical-flow / output boxes. They are
- // editor furniture, not chain nodes, so they live beside the preferences.
- std::filesystem::path anchorsFile;
- QVariantMap anchors;
- // Where the user's own files live (the facade resolves the same default).
- std::filesystem::path dataDir;
- PlaylistModel* playlist = nullptr;
- QString playlistPath;
- uint64_t playlistSession = 0, playlistCompletedSession = 0;
- // --- subtitles (ported from the Win32 shell, same semantics) ---
- std::unique_ptr<engine::SubtitleLoader> subLoader;
- // Embedded-subtitle scan of a file on a server (#48): reads only while playback has its own
- // buffer. The gate follows the engine's network statistics (tickSubtitles); null for local files.
- std::shared_ptr<std::atomic<bool>> subScanGate;
- bool subScanOpen = false;
- std::unique_ptr<engine::SubtitleLoader> subFileLoader;
- uint64_t subFileGeneration = 0;
- std::wstring subFilePath;
- uint64_t subGeneration = 0;
- std::vector<engine::SubtitleTrack> subTracks; // external files first, then the loader's
- size_t subExternal = 0; // user-loaded files at the front
- size_t subLoaded = 0; // loader tracks currently held
- int subPrimary = -1, subSecondary = -1;
- bool subPrimaryChosen = false, subSecondaryChosen = false;
- QString subStatus;
- QString subText;
- int subBottomInset = 0;
- HWND subOverlay = nullptr;
- bool subOverlayFailed = false;
- std::wstring subMedia;
- std::atomic<bool> subAligning{false}, subAlignReady{false};
- std::atomic<int> subAlignOffset{0};
- std::mutex subAlignMutex;
- std::wstring subAlignDetail;
- uint64_t subAlignGeneration = 0;
- int subAlignTrack = -1;
- // Declared after everything the worker touches, so it is joined first.
- std::jthread subAlignWorker;
- QVariantMap prefs;
- // Live recording state published by the engine (see LiveRecorder.h).
- QVariantMap recordingState;
- uint64_t recordingSaved = 0; // LiveRecorder's finished-file counter already announced
- // Custom: the display whose HDR curve is currently applied (see syncHdrDisplayProfile).
- QString hdrProfileDisplay;
- // Custom: the title whose curve is currently applied (see syncHdrTitleProfile).
- QString hdrTitleApplied;
- HMONITOR hdrIdentityMonitor=nullptr;
- QString hdrIdentityKey;
- bool hdrRestoring=false,hdrCoverageObserved=false,hdrMemoryDirty=false;
- QTimer* hdrMemorySaveTimer=nullptr;
- // Custom: how many remembered titles survive; the oldest fall off first.
- int kHdrTitleProfileLimit = 60;
- QString lastScreenshot;
- QString pendingScreenshot;
- qint64 pendingScreenshotDeadline=0;
- bool holdKeyDown = false;
- int positionTicks = 0;
- // A reopened file resumes here once its session is running.
- uint64_t resumeSession = 0;
- double resumeAt = 0;
- std::vector<sink::RenderEndpoint> audioEndpoints;
- // --- capture connection (P4-e) ---
- struct CaptureQuery { int kind = 0; std::wstring device,requestedResolution; std::vector<source::CaptureDevice> video, audio; std::vector<source::CaptureFormat> formats;source::CaptureFormatQueryInfo info; };
- std::future<CaptureQuery> captureQuery;
- std::optional<std::pair<int,std::wstring>> captureNextQuery;
- bool captureBusy = false, captureListed = false, captureResumePending = false;
- bool captureDriverSettingsOpen = false;
- std::wstring captureDriverFormatKey;
- int captureQueryKind = 0; // 0 device list, 1 formats, 2 formats then connect (continue)
- std::vector<source::CaptureDevice> captureVideo, captureAudio;
- std::vector<source::CaptureFormat> captureFormatList;
- // The capture dialog's lists are built once per input. QML re-reads a list property on
- // every element access (Qt 6 sequence references), so a getter that rebuilt the list
- // made `.find()` and VSelect quadratic: 15474 formats hung the interface (logs(18)).
- // Each cache is checked against what it was built from, not reset by captureChanged:
- // QML bindings receive a notify signal before any ordinary connection does.
- uint64_t captureFormatGeneration = 0; // bumped whenever captureFormatList is replaced
- int uiDeviceGeneration = 0; // interface scene graphs recreated after a lost device
- // One automatic capture-card reconnect after the GPU stopped completing work. Field
- // logs 56: after the hang and driver reset the session just ended; reconnecting by hand
- // ran smoothly again. A second GPU failure within ten minutes is left to the user.
- uint64_t gpuReconnectSession = 0;
- std::chrono::steady_clock::time_point gpuReconnectDue{}, gpuReconnectLast{};
- // Network sources (#48): damaged data is concealed or skipped without a word per packet;
- // the user hears about it once in a while, and about a successful reconnect.
- uint64_t netNoticeSession = 0, netLossReported = 0;
- uint32_t netReconnectsReported = 0;
- std::chrono::steady_clock::time_point netLossNoticeAt{};
- struct CaptureListCache { bool valid = false; uint64_t generation = 0; QString language; std::wstring a, b; QVariantList list; };
- CaptureListCache captureFormatsCache, captureResolutionCache, captureRateCache, capturePixelCache;
- // Settings → 组件与许可. Read once and on refreshComponentList(): the property used to
- // notify with every engine snapshot, so each 60 Hz tick re-read the manifest and
- // rebuilt the page's 49 rows (audit 2026-10-15 B5).
- QVariantList componentList; bool componentListRead = false;
- bool liveCompanionCap = false; // updateLiveCompanionCompat
- int captureHiddenRates = 0; // set with captureRateCache
- template <class Build> const QVariantList& captureList(CaptureListCache& cache, const std::wstring& a, const std::wstring& b, Build&& build) {
- const QString language = i18n::current();
- if (!cache.valid || cache.generation != captureFormatGeneration || cache.language != language || cache.a != a || cache.b != b) {
- cache.list = build();
- cache.valid = true; cache.generation = captureFormatGeneration; cache.language = language; cache.a = a; cache.b = b;
- }
- return cache.list;
- }
- std::wstring captureFormatKey;
- std::wstring captureResolutionChoice, captureRateChoice;
- std::wstring captureRequestedResolution;
- int captureAudioChoice = source::kCaptureAudioDisabled;
- bool captureAudioMissing = false;
- unsigned captureColor = 0;
- double captureFps = 0;
- QString captureStatus;
- ui::CapturePreferences capturePrefs;
- // --- PS5 Remote Play ---
- QVariantMap ps5Form;
- QString ps5Status;
- std::wstring ps5Profile; // file name inside profileDirectory()
- QVariantList ps5ProfileList;
- uint64_t psnLoginStarted = 0;
- bool ps5Watching = false;
- struct Ps5Outcome { std::wstring message; std::vector<std::pair<std::string, std::string>> hosts; std::wstring savedPath; std::string account; bool refreshProfiles = false; };
- std::mutex ps5Mutex;
- Ps5Outcome ps5Outcome;
- std::atomic<bool> ps5Done{false};
- bool ps5Busy = false;
- QTimer* controllerTimer = nullptr;
- // PS5 手柄控制 (capture card dialog).
- QTimer* ps5ControlTimer = nullptr;
- QVariantMap ps5ControlState;
- std::wstring ps5ControlProfile; // pairing (or test host) the session was started with
- QString ps5ControlNoticed; // state the last notice was shown for
- int ps5ControlTicks = 0;
- bool ps5ControlNoPair = false; // switched on without a pairing; cleared once pairings exist
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- remoteplay::ControllerInput controller;
- // One SDL pad reader shared by PS5 stream, PS5 手柄控制, PC and Xbox streaming.
- // Each user acquires it and only the last release stops it, so the timer of a
- // source that just ended never cuts off the pad the next source started using.
- enum PadUser : unsigned { PadPs5 = 1, PadPs5Control = 2, PadMoonlight = 4, PadXbox = 8 };
- unsigned padUsers = 0;
- bool acquirePad(unsigned user) {
- const bool ok = controller.start(); // no-op once initialized
- padUsers |= user;
- controller.setFollowLastPressed((padUsers & PadPs5Control) != 0);
- return ok;
- }
- void releasePad(unsigned user) {
- padUsers &= ~user;
- if (!padUsers) controller.stop();
- else controller.setFollowLastPressed((padUsers & PadPs5Control) != 0);
- }
-#endif
- std::jthread ps5Worker; // last: joined before what it touches
- // --- screen capture ---
- std::vector<source::ScreenCaptureTarget> screenList;
- bool screenFillActive = false;
- QSize screenFitClient, screenFitImage;
- double screenFitAspect = -1;
- // --- image batch ---
- QStringList imageFiles;
- QString imageFolder, imageTarget, imageStatus;
- int imageIndex = -1, imageDone = 0, imageFailures = 0, imageWaits = 0;
- uint64_t imageSession = 0;
- enum class ImagePhase { Idle, Opening, Saving } imagePhase = ImagePhase::Idle;
- sink::ActiveRenderEndpoint audioActive;
- int audioPollTicks = 0;
- // --- protection drawing (#8) ---
- QString protDraw; // "" | rect | ellipse
- HWND protOverlay = nullptr;
- // --- performance orbs / status light (#13) ---
- ui::live_status::DashboardHistory history;
- int historyTicks = 0;
- QString runStatus, runLevel, runDetail;
- QStringList runOptions;
- double effectiveOutputFps=-1;
- // FG output hint for the 倍率 row; 可变刷新 level (gfx::vrrLevel) of the
- // presenting monitor, or of the main window's monitor while idle.
- QString fgDisplayHint;
- int vrrState=0;
- // The shown monitor's Windows HDR (-1 unknown) and refresh rate.
- int displayHdr=-1;double displayRefreshHz=0;
- // 刷新显示器状态: the display generation it asked for, until the shown monitor
- // answers (displayChecking also covers any query in flight).
- bool displayChecking=false,displayRecheckPending=false,displayChanged=false;
- uint64_t displayRecheckGeneration=0;
- std::chrono::steady_clock::time_point displayRecheckSince{};
- DisplayChangeFilter displayChangeFilter;
- std::atomic<double> gpuUtil{-1.0};
- // Hardware adapters in Windows' high-performance order (discrete first). The
- // sampler only counts engines of the adapter whose LUID is in gpuMonitorLuid
- // (0: every adapter, the old behaviour, used only when none was found).
- struct GpuAdapter { QString id, name; uint32_t luidHigh = 0, luidLow = 0; };
- std::vector<GpuAdapter> gpuAdapters;
- std::atomic<uint64_t> gpuMonitorLuid{0};
- QString gpuMonitorName;
- // LUIDs that have "GPU Engine" counter instances. DXGI can list one physical GPU
- // twice (a virtual display driver such as GameViewer's exposes a second adapter
- // with the GPU's own name); only the real one has engines to measure.
- static std::set<uint64_t> gpuEngineLuids() {
- std::set<uint64_t> found;
- DWORD counterBytes = 0, instanceBytes = 0;
- if (PdhEnumObjectItemsW(nullptr, nullptr, L"GPU Engine", nullptr, &counterBytes, nullptr, &instanceBytes, PERF_DETAIL_WIZARD, 0) != PDH_MORE_DATA)
- return found;
- std::vector<wchar_t> counters(counterBytes + 1), instances(instanceBytes + 1);
- if (PdhEnumObjectItemsW(nullptr, nullptr, L"GPU Engine", counters.data(), &counterBytes, instances.data(), &instanceBytes, PERF_DETAIL_WIZARD, 0) != ERROR_SUCCESS)
- return found;
- for (const wchar_t* name = instances.data(); *name; name += wcslen(name) + 1) {
- unsigned high = 0, low = 0;
- if (const wchar_t* at = wcsstr(name, L"luid_"); at && swscanf_s(at, L"luid_0x%x_0x%x", &high, &low) == 2)
- found.insert(uint64_t(high) << 32 | low);
- }
- return found;
- }
- void enumerateGpuAdapters() {
- const auto measured = gpuEngineLuids();
- Microsoft::WRL::ComPtr<IDXGIFactory6> factory;
- if (FAILED(CreateDXGIFactory2(0, IID_PPV_ARGS(&factory)))) return;
- Microsoft::WRL::ComPtr<IDXGIAdapter1> adapter;
- for (UINT i = 0; SUCCEEDED(factory->EnumAdapterByGpuPreference(i, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(adapter.ReleaseAndGetAddressOf()))); ++i) {
- DXGI_ADAPTER_DESC1 d{};
- if (FAILED(adapter->GetDesc1(&d)) || (d.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) || d.VendorId == 0x1414) continue;
- const uint64_t luid = uint64_t(uint32_t(d.AdapterLuid.HighPart)) << 32 | d.AdapterLuid.LowPart;
- if (!measured.empty() && !measured.count(luid)) {
- veyra::log::info("perf", std::format("gpu adapter skipped (no engine counters) luid={:08X}:{:08X} {}", uint32_t(luid >> 32), uint32_t(luid),
- QString::fromWCharArray(d.Description).toStdString()));
- continue;
- }
- // LUIDs change at every boot, so the saved choice is vendor:device:subsystem,
- // with an ordinal for two identical cards.
- QString id = QStringLiteral("%1:%2:%3").arg(d.VendorId, 4, 16, QLatin1Char('0')).arg(d.DeviceId, 4, 16, QLatin1Char('0')).arg(d.SubSysId, 8, 16, QLatin1Char('0'));
- int same = 0;
- for (const auto& a : gpuAdapters) if (a.id.section('#', 0, 0) == id) ++same;
- if (same) id += QStringLiteral("#%1").arg(same);
- gpuAdapters.push_back({id, QString::fromWCharArray(d.Description).trimmed(), uint32_t(d.AdapterLuid.HighPart), d.AdapterLuid.LowPart});
- veyra::log::info("perf", std::format("gpu adapter {} id={} luid={:08X}:{:08X} dedicatedMiB={}", gpuAdapters.size() - 1,
- id.toStdString(), uint32_t(d.AdapterLuid.HighPart), d.AdapterLuid.LowPart, d.DedicatedVideoMemory >> 20));
- }
- }
- // 游戏模式: the native side, the capture it belongs to and what the UI reported.
- ui::GamePassthrough game;
- std::wstring gameModeUri; // the screen URI startScreenCapture opened in game mode
- uint64_t gameModeSessionId = 0; // its engine session once the open ran
- bool gameModeLive = false, gamePanelOpen = false, gameRefused = false;
- bool gameModeShown = false, passthroughShown = false, gameInputShown = false;
- QRectF gameVideoRect;
- QPointer<QWindow> gameWindow;
- HMONITOR gameMonitor = nullptr;
- // The monitored GPU also computes when 设置 -> "同时用这块显卡运算" is on
- // and a specific GPU (not 自动) is chosen; otherwise the default order.
- QString computeGpuName;
- uint64_t computeLuid = 0;
- void applyComputeGpu() {
- const QString wanted = prefString("monitorGpu");
- const GpuAdapter* chosen = nullptr;
- for (const auto& a : gpuAdapters) if (!wanted.isEmpty() && a.id == wanted) chosen = &a;
- const bool follow = prefBool("computeOnMonitorGpu", false) && chosen;
- computeLuid = follow ? (uint64_t(chosen->luidHigh) << 32 | chosen->luidLow) : 0;
- computeGpuName = follow ? chosen->name : QString();
- gfx::setPreferredAdapterLuid(computeLuid);
- veyra::log::info("perf", std::format("compute gpu follow={} wanted={} using={}", follow, wanted.isEmpty() ? "auto" : wanted.toStdString(),
- follow ? chosen->name.toStdString() : "default order (highest-performance adapter)"));
- }
- void resolveGpuMonitor() {
- const QString wanted = prefString("monitorGpu");
- const GpuAdapter* chosen = gpuAdapters.empty() ? nullptr : &gpuAdapters.front();
- for (const auto& a : gpuAdapters) if (!wanted.isEmpty() && a.id == wanted) chosen = &a;
- gpuMonitorLuid = chosen ? (uint64_t(chosen->luidHigh) << 32 | chosen->luidLow) : 0;
- gpuMonitorName = chosen ? chosen->name : QString();
- veyra::log::info("perf", std::format("gpu monitor wanted={} using={}", wanted.isEmpty() ? "auto" : wanted.toStdString(),
- chosen ? chosen->name.toStdString() : "all adapters"));
- }
- double gpuPublished = -2.0;
- double rateRatio = -1.0;
- std::deque<double> frameTimes; // frame interval ms, newest last
- // --- design gap: presentation, compare, aspect ---
- engine::PresentationSettings presentation;
- int compareMode = 0;
- bool compareBase = false;
- double compareSplit = 0.5;
- int aspectMode = 0, aspectApplied = 0;
- uint64_t aspectSession = 0;
- std::jthread gpuSampler; // joined before gpuUtil goes away
- std::filesystem::path prefsFile() const { return dataDir / L"qml-preferences.v1.json"; }
- void loadPrefs() {
- QFile file(QString::fromStdWString(prefsFile().wstring()));
- if (!file.exists()) return;
- if (!file.open(QIODevice::ReadOnly)) { veyra::log::warn("ui-prefs", "qml preferences unreadable; defaults used"); return; }
- QJsonParseError error{};
- const auto doc = QJsonDocument::fromJson(file.readAll(), &error);
- if (error.error != QJsonParseError::NoError || !doc.isObject()) {
- veyra::log::warn("ui-prefs", "qml preferences damaged; defaults used, file kept");
- return;
- }
- prefs = doc.object().toVariantMap();
- }
- bool savePrefs() {
- const QString path = QString::fromStdWString(prefsFile().wstring());
- // A fresh data directory may not exist yet: the first preference saved
- // on a new profile used to fail and was silently kept only in memory.
- std::error_code ec;
- std::filesystem::create_directories(prefsFile().parent_path(), ec);
- if(ec)return false;
- QSaveFile file(path);
- if (!file.open(QIODevice::WriteOnly)) return false;
- const auto bytes = QJsonDocument(QJsonObject::fromVariantMap(prefs)).toJson(QJsonDocument::Indented);
- if (file.write(bytes) != bytes.size()) return false;
- return file.commit();
- }
- int prefInt(const char* key, int fallback) const { return prefs.contains(key) ? prefs.value(key).toInt() : fallback; }
- bool prefBool(const char* key, bool fallback) const { return prefs.contains(key) ? prefs.value(key).toBool() : fallback; }
- QString prefString(const char* key) const { return prefs.value(key).toString(); }
- void restoreCaptureForm() {
- captureFps=capturePrefs.requestedFps;
- captureColor=capturePrefs.colorForDevice(captureDevice);
- captureAudioChoice=source::kCaptureAudioDisabled;
- captureAudioMissing=false;
- if(capturePrefs.audioMode==source::kCaptureAudioFromVideoDevice)captureAudioChoice=source::kCaptureAudioFromVideoDevice;
- else if(!capturePrefs.audioPath.empty()){
- captureAudioMissing=true;
- for(size_t k=0;k<captureAudio.size();++k)
- if(captureAudio[k].path==capturePrefs.audioPath&&captureAudio[k].wasapi==(capturePrefs.audioMode==source::kCaptureAudioWasapi)){
- captureAudioChoice=int(k);captureAudioMissing=false;break;
- }
- }
- }
- bool persistCaptureSelection(bool explicitFormat = false) {
- if(captureDevice.empty())return true; // Disconnecting a card must retain it.
- const bool sameDevice=capturePrefs.videoPath==captureDevice;
- capturePrefs.videoPath=captureDevice;
- // An unavailable saved type has no active selection. Editing another
- // control must retain its key until the user explicitly picks a new type.
- if(explicitFormat||!captureFormatKey.empty()||!sameDevice)capturePrefs.formatKey=captureFormatKey;
- if(explicitFormat){
- // A partial form is a deliberate choice too. Keep it without
- // upgrading capture-preferences.v1 or inventing a concrete format.
- prefs["captureDraftDevice"]=utf8Of(captureDevice);
- prefs["captureDraftResolution"]=utf8Of(captureResolutionChoice);
- prefs["captureDraftRate"]=utf8Of(captureRateChoice);
- if(!savePrefs())return false;
- }
- capturePrefs.colorOverride=captureColor;capturePrefs.requestedFps=captureFps;
- if(capturePrefs.deviceColors.size()<128||capturePrefs.deviceColors.contains(captureDevice))capturePrefs.deviceColors[captureDevice]=captureColor;
- if(!captureAudioMissing){
- const auto* audio=captureAudioChoice>=0&&size_t(captureAudioChoice)<captureAudio.size()?&captureAudio[size_t(captureAudioChoice)]:nullptr;
- capturePrefs.audioPath=audio?audio->path:std::wstring{};
- capturePrefs.audioMode=audio?(audio->wasapi?source::kCaptureAudioWasapi:0):captureAudioChoice;
- }
- if(ui::CapturePreferenceStore(dataDir).save(capturePrefs))return true;
- veyra::log::error("capture-ui","capture settings could not be saved");return false;
- }
- Impl(engine::EngineController& e, std::filesystem::path dataDirectory)
- : engine(e), facade(e, dataDirectory),
- dataDir(dataDirectory.empty() ? runtime::localDataDirectory() : dataDirectory) {
- if (!dataDirectory.empty()) anchorsFile = dataDirectory / L"node-anchors.json";
- if (!anchorsFile.empty()) {
- QFile file(QString::fromStdWString(anchorsFile.wstring()));
- if (file.open(QIODevice::ReadOnly)) anchors = QJsonDocument::fromJson(file.readAll()).object().toVariantMap();
- }
- // Same high-performance DXGI ordering as the engine. This only seeds a
- // fresh session; loading saved settings below preserves manual choices.
- gfx::ComPtr<IDXGIFactory6> factory;
- if(SUCCEEDED(CreateDXGIFactory2(0,IID_PPV_ARGS(&factory)))) {
- gfx::ComPtr<IDXGIAdapter1> adapter;
- for(UINT i=0;SUCCEEDED(factory->EnumAdapterByGpuPreference(i,DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE,IID_PPV_ARGS(&adapter)));++i) {
- DXGI_ADAPTER_DESC1 desc{};
- if(FAILED(adapter->GetDesc1(&desc))||(desc.Flags&DXGI_ADAPTER_FLAG_SOFTWARE))continue;
- auto initial=facade.pendingSettings();
- initial.nrRuntime=desc.VendorId==0x1002?engine::NrRuntime::LmxxfAmd:engine::NrRuntime::Ampere;
- if(desc.VendorId==0x1002||desc.VendorId==0x8086){
- initial.opticalFlowBackend=engine::OpticalFlowBackend::AmdFidelityFx;
- initial.videoSrQuality=engine::kVideoSrFsr;
- }
- initial.frameGenerationBackend=engine::defaultFrameGenerationBackend(desc.VendorId);
- facade.setPending(initial);
- veyra::log::info("nr-default",std::format("adapter={} selected={}",utf8Of(std::wstring(desc.Description)).toStdString(),engine::nrRuntimeName(initial.nrRuntime)));
- break;
- }
- }
- chain = engine::toChain(facade.pendingSettings());
- acceptedChain = chain;
- draftGlobals = engine::ChainGlobalSettings::capture(facade.pendingSettings());
- session = engine::ChainSession::initial(facade.pendingSettings());
- savedSession = session;
- validation = engine::validateChain(chain);
- options = engine::PlayerOptions::from(facade.pendingSettings());
- }
-
- std::optional<engine::EnhancementSettings> exportSettings(QString& error) const {
- if (chain.mode == engine::ChainMode::Node) {
- error = QObject::tr("节点链尚未接入导出执行器,请切换列表模式后导出");
- return std::nullopt;
- }
- auto settings = facade.pendingSettings();
- engine::fromChain(chain, settings);
- if (!exportPresetName.empty()) {
- const auto& entries = facade.presets().entries();
- const auto preset = std::find_if(entries.begin(), entries.end(), [this](const auto& entry) {
- return entry.name == exportPresetName;
- });
- if (preset == entries.end()) {
- error = QObject::tr("导出预设已不存在,请重新选择");
- return std::nullopt;
- }
- if (preset->kind != engine::ChainMode::List) {
- error = QObject::tr("节点预设尚未接入导出执行器");
- return std::nullopt;
- }
- engine::PresetLibrary::apply(*preset, settings);
- }
- settings.exportBitrateMbps = exportBitrateMbps;
- if (exportResolutionIndex >= 0) {
- settings.sr = exportResolutionIndex != 0;
- if (settings.sr) {
- switch (exportResolutionIndex) {
- case 1: settings.srTarget = pipeline::SrTarget::Qhd; break;
- case 2: settings.srTarget = pipeline::SrTarget::Uhd4K; break;
- case 3: settings.srTarget = pipeline::SrTarget::Uhd8K; break;
- case 4: settings.srTarget = pipeline::SrTarget::Uhd5K; break;
- case 5: settings.srTarget = pipeline::SrTarget::Uhd6K; break;
- case 6: settings.srTarget = pipeline::SrTarget::Uhd7K; break;
- default: break;
- }
- }
- }
- if (exportRateControl != sink::ExportRateControl::Cq && !exportBitrateMbps) {
- error = QObject::tr("CBR/VBR 需要指定码率");
- return std::nullopt;
- }
- if (const auto why = settings.validate(); !why.empty()) {
- veyra::log::warn("export-settings", std::format("invalid: {} bitrateMbps={}", why, settings.exportBitrateMbps));
- error = QObject::tr("导出设置无效:%1").arg(utf8Of(why));
- return std::nullopt;
- }
- if (const auto why = unavailableEffects(settings); !why.isEmpty()) {
- error = QObject::tr("导出设置无效:%1").arg(why);
- return std::nullopt;
- }
- if(settings.multiplier>1&&engine::presentSinkFrameGeneration(settings.frameGenerationBackend)){
- error=QObject::tr("XeSS 尚未提供可编码的补帧纹理,请为导出选择 FSR、DLSS 或 VFG 补帧");
- return std::nullopt;
- }
- return settings;
- }
-
- engine::ChainSession currentSession() const {
- auto current = session;
- current.active = chain.mode;
- current.initialized[size_t(chain.mode)] = true;
- current.configurations[size_t(chain.mode)] = engine::ChainConfiguration::capture(
- activeRuntime(), facade.pendingSettings(), nrIndex(), colourIndex());
- // Custom: the static HDR output tuning does not travel through the runtime
- // configuration yet, so take it straight from the draft globals at the point
- // the session is built. Without this the values took effect and then came
- // back as defaults on the next start.
- current.configurations[size_t(chain.mode)].hdrCurve = draftGlobals.hdrCurve;
- current.configurations[size_t(chain.mode)].hdrMetadata = draftGlobals.hdrMetadata;
- if (chain.mode == engine::ChainMode::Node) {
- auto document = std::make_shared<engine::NodeEditorDocument>();
- document->nodes = chain; document->layout = layout; document->globals = draftGlobals;
- current.configurations[size_t(chain.mode)].editor = std::move(document);
- }
- return current;
- }
-
- bool persistSession() {
- const auto current = currentSession();
- if (current == savedSession) return true;
- if (!facade.saveChainSession(current)) return false;
- session = savedSession = current;
- return true;
- }
-
- bool poll() {
- const auto before=facade.pendingSettings();
- auto frame = facade.poll();
- const auto restored=facade.pendingSettings();
- const bool fgRollback=before.frameGenerationBackend!=restored.frameGenerationBackend||before.multiplier!=restored.multiplier||before.vfgQuality!=restored.vfgQuality;
- const bool nrRollback=before.nrRuntime!=restored.nrRuntime;
- if(nrRollback) {
- for(auto* c:{&chain,&acceptedChain})for(uint32_t i=0;i<c->nodeCount;++i)
- if(c->nodes[i].type==engine::EffectType::NrEnhance)c->nodes[i].nr.runtime=restored.nrRuntime;
- }
- if(fgRollback){
- const auto restoreFg=[&](engine::EffectChain& value){
- if(restored.multiplier>1)value.fgMultiplier=restored.multiplier;
- for(uint32_t i=0;i<value.nodeCount;++i)
- if(value.nodes[i].type==engine::EffectType::FrameGeneration)value.nodes[i].enabled=restored.multiplier>1;
- };
- restoreFg(chain);restoreFg(acceptedChain);
- if(draftGlobals.fgBackend==before.frameGenerationBackend)draftGlobals.fgBackend=restored.frameGenerationBackend;
- if(draftGlobals.vfgQuality==before.vfgQuality)draftGlobals.vfgQuality=restored.vfgQuality;
- options=engine::PlayerOptions::from(restored,engine::runtimeOrder(acceptedChain));
- }
- if (!frame.changed && haveSnapshot) return fgRollback||nrRollback;
- snapshot = frame.snapshot;
- publishedRevision = frame.revision;
- haveSnapshot = true;
- if (openingSource && openingSessionId != 0 && snapshot.sessionId == openingSessionId &&
- (snapshot.running || snapshot.image || snapshot.failed ||
- snapshot.transport == engine::TransportState::Empty ||
- snapshot.transport == engine::TransportState::Stopping))
- openingSource = false;
- return fgRollback||nrRollback;
- }
-
- // The chain is the source of truth for the stage settings; every commit
- // writes it back over the struct so the two can never disagree.
- bool commit(engine::EnhancementSettings settings) {
- // Custom: the static HDR output tuning belongs to neither transaction, so
- // keep the draft globals in sync in BOTH modes. Only the node branch below
- // refreshed them, which is why a change made in list mode took effect and
- // then came back as a default after a restart (the session capture reads the
- // tuning from the draft globals).
- draftGlobals.hdrCurve = settings.hdrCurve;
- draftGlobals.hdrMetadata = settings.hdrMetadata;
- if (chain.mode == engine::ChainMode::Node) {
- const auto previous = facade.pendingSettings();
- const auto oldGlobals = draftGlobals;
- draftGlobals = engine::ChainGlobalSettings::capture(settings);
- // Non-node controls (e.g. audio) may still change while a wire is
- // incomplete. Keep runtime globals separate from that transaction.
- // Custom: HDR brightness is one of those controls - it is not part of a
- // node edit, so the restore below must not put the previous value back
- // (field report: a new target peak took effect and then reverted on the
- // next start, because this line overwrote it before the session was
- // captured).
- facade.setPending(settings);
- if (revalidate(true, &previous)) return true;
- draftGlobals = oldGlobals; facade.setPending(previous);
- revalidate();
- return false;
- }
- const auto& runtime = activeRuntime();
- engine::fromChain(runtime, settings);
- if (const auto reason = unavailableEffects(settings); !reason.isEmpty()) {
- veyra::log::warn("effect-availability", reason.toStdString());
- return false;
- }
- if(!facade.applySettings(settings,engine::runtimeOrder(runtime)))return false;
- options = engine::PlayerOptions::from(settings,engine::runtimeOrder(runtime));
- return true;
- }
-
- bool revalidate(bool apply=false, const engine::EnhancementSettings* prior=nullptr) {
- auto projected = std::make_unique<engine::EffectChain>(chain);
- bool incomplete = false;
- if (chain.mode == engine::ChainMode::Node) {
- validation = layout.validate(chain);
- if (!validation.accepted) return false;
- // Even detached controls must obey the persistent parameter contract.
- auto check = std::make_unique<engine::ChainConfiguration>(
- engine::ChainConfiguration::capture(acceptedChain, facade.pendingSettings()));
- auto document = std::make_shared<engine::NodeEditorDocument>();
- document->nodes = chain; document->layout = layout; document->globals = draftGlobals; check->editor = document;
- if (!check->valid()) { validation = {false, "节点参数无效,未提交"}; return false; }
- validation = layout.project(chain, *projected);
- if (!validation.accepted) {
- uint32_t end = layout.inputNext;
- while (end > engine::NodeGraphLayout::Output)
- end = layout.next[size_t(layout.indexOf(chain, end))];
- // Incomplete wires are editable/savable. A complete but illegal
- // path is rejected atomically by the caller, never auto-sorted.
- if (end != engine::NodeGraphLayout::Input) return false;
- *projected = acceptedChain; incomplete = true;
- }
- } else validation = engine::validateChain(chain);
- if(!validation.accepted && !incomplete)return false;
- const auto previous = prior ? *prior : facade.pendingSettings();
- auto s = facade.pendingSettings();
- if (chain.mode == engine::ChainMode::Node && !incomplete) {
- draftGlobals.apply(s);
- // A detached singleton owns editable values, not live resources.
- if (!projected->firstOf(engine::EffectType::SuperResolution)) {
- s.srTarget = previous.srTarget; s.videoSrQuality = previous.videoSrQuality;
- s.dlssSrModel = previous.dlssSrModel;
- }
- if (!projected->firstOf(engine::EffectType::FrameGeneration)){
- s.frameGenerationBackend = previous.frameGenerationBackend;
- s.vfgQuality = previous.vfgQuality;
- }
- }
- engine::fromChain(*projected, s);
- if(const auto error=s.validate();!error.empty()){
- veyra::log::error("qml-settings",error);
- validation={false,"效果参数无效,未提交;详见诊断日志"};return false;
- }
- const auto order = engine::runtimeOrder(*projected);
- const bool changed = s != previous || order != engine::runtimeOrder(acceptedChain);
- if (apply && changed) {
- if (const auto reason = unavailableEffects(s); !reason.isEmpty()) {
- validation = {false, "当前硬件或包不支持所选效果,请查看组件页"};
- veyra::log::warn("effect-availability", reason.toStdString());
- return false;
- }
- }
- if(apply && changed && !facade.applySettings(s,order)){
- facade.setPending(previous);
- validation={false,"引擎未接受设置,已保留原状态"};
- return false;
- }
- if(!apply || !changed)facade.setPending(s);
- acceptedChain = *projected;
- options = engine::PlayerOptions::from(s,order);
- return true;
- }
-#ifdef VEYRA_ENABLE_MOONLIGHT
- // --- PC streaming (Moonlight). Last, so they are destroyed first: the model joins its workers.
- QTimer* moonlightTimer = nullptr;
- bool moonlightWantCapture = false, moonlightStatsVisible = false, moonlightWasActive = false;
- int moonlightStatsTicks = 0;
- std::unique_ptr<ui::MoonlightInputCapture> moonlightCapture;
- std::unique_ptr<ui::MoonlightModel> moonlight;
-#endif
-#ifdef VEYRA_ENABLE_XBOX
- QTimer* xboxTimer = nullptr;
- bool xboxWasActive = false;
- int xboxStatsTicks = 0;
- std::unique_ptr<ui::XboxModel> xbox; // last: joins its worker first
-#endif
-};
-
namespace {
bool prepareStartupPreset(const engine::PresetEntry& entry, engine::ChainSession& session,
engine::EnhancementSettings& settings, QString& error) {
@@ -995,220 +54,6 @@ bool prepareStartupPreset(const engine::PresetEntry& entry, engine::ChainSession
return true;
}
} // namespace
-
-// The first hardware adapter, the one the engine opens (gfx adapter[0]): 0x10DE NVIDIA,
-// 0x1002 AMD, 0x8086 Intel, 0 unknown.
-static uint32_t primaryGpuVendor() {
- return effectGpu().vendor;
-}
-// FSR 4 ML frame generation needs an AMD RX 9000; on other GPUs the provider crashed the
-// whole program (field report 2026-10-01). Known non-AMD adapters are refused up front.
-static bool fsr4Possible() { return currentEffectCapabilities().value("fsr4").toMap().value("available").toBool(); }
-// The adapter the engine opens: the user's compute GPU when one is chosen
-// (gfx::preferredAdapterLuid) and usable, else the first D3D12 hardware
-// adapter in DXGI's high-performance order, as D3D12DeviceContext picks it.
-// UI thread only; cached per preference.
-static const DXGI_ADAPTER_DESC1* engineAdapterDesc(){
- static uint64_t cachedFor=~0ull;static DXGI_ADAPTER_DESC1 cached{};static bool found=false;
- const uint64_t preferred=gfx::preferredAdapterLuid();
- if(cachedFor==preferred)return found?&cached:nullptr;
- cachedFor=preferred;found=false;
- Microsoft::WRL::ComPtr<IDXGIFactory6> factory;
- if(FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory))))return nullptr;
- for(int pass=preferred?0:1;pass<2&&!found;++pass)
- for(UINT i=0;;++i){Microsoft::WRL::ComPtr<IDXGIAdapter1> adapter;
- if(FAILED(factory->EnumAdapterByGpuPreference(i,DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE,IID_PPV_ARGS(&adapter)))||!adapter)break;
- DXGI_ADAPTER_DESC1 d{};
- if(FAILED(adapter->GetDesc1(&d))||(d.Flags&DXGI_ADAPTER_FLAG_SOFTWARE))continue;
- const uint64_t luid=uint64_t(uint32_t(d.AdapterLuid.HighPart))<<32|d.AdapterLuid.LowPart;
- if(pass==0&&luid!=preferred)continue;
- if(FAILED(D3D12CreateDevice(adapter.Get(),D3D_FEATURE_LEVEL_12_0,__uuidof(ID3D12Device),nullptr)))continue;
- cached=d;found=true;break;
- }
- return found?&cached:nullptr;
-}
-// The menu checks the same adapter as the engine. The native backend then
-// verifies CUDA compute capability and the exact adapter LUID.
-static bool vfgHardwarePossible(){
- const auto* d=engineAdapterDesc();
- if(!d)return false;
- const auto name=QString::fromWCharArray(d->Description);
- return d->VendorId==0x10DE&&(name.contains(QStringLiteral("GeForce RTX 40"),Qt::CaseInsensitive)||
- name.contains(QStringLiteral("GeForce RTX 50"),Qt::CaseInsensitive)||name.contains(QStringLiteral("Ada"),Qt::CaseInsensitive)||name.contains(QStringLiteral("Blackwell"),Qt::CaseInsensitive));
-}
-static unsigned normalizeFgMultiplier(unsigned value,engine::FrameGenerationBackend backend,unsigned cap){
- value=std::clamp(value,2u,cap);
- return backend==engine::FrameGenerationBackend::Dlss&&value==5?4u:value;
-}
-bool QmlPlayerBridge::amdNrGpu() const { return primaryGpuVendor()==0x1002; }
-
-static ui::EffectGpu effectGpu() {
- ui::EffectGpu result;
- const auto* d = engineAdapterDesc();
- if (!d) return result;
- const auto name = QString::fromWCharArray(d->Description);
- result.vendor = d->VendorId;
- result.deviceId = d->DeviceId;
- result.rtx = name.contains("RTX", Qt::CaseInsensitive);
- result.blackwell = name.contains("RTX 50", Qt::CaseInsensitive) || name.contains("Blackwell", Qt::CaseInsensitive);
- result.ada = name.contains("RTX 40", Qt::CaseInsensitive) || name.contains("Ada", Qt::CaseInsensitive);
- result.rx9000 = name.contains("RX 90", Qt::CaseInsensitive);
- return result;
-}
-
-static QVariantMap scanEffectCapabilities() {
- using H = ui::HardwareEffect;
- const auto gpu = effectGpu();
- const auto nr = runtime::localRuntimeDirectory();
- const auto data = runtime::localDataDirectory();
- auto exists = [](const std::filesystem::path& path) { std::error_code ec; return std::filesystem::is_regular_file(path, ec); };
- const auto fsr = data / "amd/fidelityfx";
- const bool fsrLoader = exists(fsr / "amd_fidelityfx_loader_dx12.dll");
- QVariantMap out;
- auto add = [&](const QString& id, H hardware, bool files, const QString& requirement) {
- const bool supported = ui::hardwareSupports(hardware, gpu);
- out[id] = QVariantMap{{"available", supported && files}, {"reason", !supported ? requirement : !files ? QObject::tr("当前包缺少此功能的运行组件") : QString{}}};
- };
- add("nr2", H::NvidiaNrSf, exists(nr / "nr-ampere/nvngx_dlssnr.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
- out["nr0"]=out["nr2"]; // Retired preset ID; no retired runtime is loaded.
- out["nrAuto"]=QVariantMap{{"available",gpu.vendor==0x10DE&&gpu.deviceId==0x2f04&&out.value("nr0").toMap().value("available").toBool()},
- {"reason",gpu.deviceId!=0x2f04?QObject::tr("自动 NR 当前仅验证 RTX 5070"):!out.value("nr0").toMap().value("available").toBool()?QObject::tr("当前包缺少此功能的运行组件"):QString{}}};
- add("nr3", H::NvidiaNr50, exists(nr / "nr-original/nvngx_dlssnr.dll"), QObject::tr("需要 NVIDIA RTX 50 / Blackwell"));
- add("nr4", H::AmdNr, exists(nr / "../amd-nr/LmxxfNrRuntime.dll"), QObject::tr("需要 AMD RX 9000"));
- wchar_t systemDir[MAX_PATH]{};
- if (GetSystemDirectoryW(systemDir, MAX_PATH) && !exists(std::filesystem::path(systemDir) / "amdhip64_7.dll") && !GetModuleHandleW(L"amdhip64_7.dll")) {
- auto cap = out.value("nr4").toMap();
- if (cap.value("available").toBool()) { cap["available"] = false; cap["reason"] = QObject::tr("需要 AMD HIP 7 驱动运行组件"); out["nr4"] = cap; }
- }
- add("sr0", H::Nvidia, exists(nr / "nvngx_dlss.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
- for (int i = 1; i <= 4; ++i) add("sr" + QString::number(i), H::Nvidia, exists(nr / "nvngx_vsr.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
- add("sr5", H::CrossVendor, fsrLoader && exists(fsr / "amd_fidelityfx_upscaler_dx12.dll"), QObject::tr("需要支持 DirectX 12 的硬件显卡"));
- add("dlss", H::Nvidia, exists(nr / "nvngx_dlssg.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
- add("vfg", H::Vfg, pipeline::VfgBackend::runtimeAvailable(nr.wstring()), QObject::tr("需要 NVIDIA RTX 40 / 50(Ada / Blackwell)"));
- add("xess", H::CrossVendor, exists(data / "intel/experimental/libxess_fg.dll") && exists(data / "intel/experimental/libxell.dll"), QObject::tr("需要支持 DirectX 12 的硬件显卡"));
- add("fsr3", H::CrossVendor, fsrLoader && exists(fsr / "amd_fidelityfx_framegeneration_dx12.dll"), QObject::tr("需要支持 DirectX 12 的硬件显卡"));
- add("fsr4", H::Fsr4, fsrLoader && exists(fsr / "amd_fidelityfx_framegeneration_dx12.dll"), QObject::tr("需要 AMD RX 9000"));
- add("hdr", H::Nvidia, exists(nr / "nvngx_truehdr.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
- add("flow0", H::Nvidia, true, QObject::tr("需要 NVIDIA RTX 显卡及 NVOF 驱动"));
- add("flow1", H::CrossVendor, true, QObject::tr("需要支持 DirectX 12 的硬件显卡"));
- return out;
-}
-// All callers are on the bridge/UI thread. Snapshot reads must not perform
-// filesystem probes or rebuild capability maps. Refresh on actions, language
-// changes and a slow timer so user-replaced runtime files remain discoverable.
-static QVariantMap currentEffectCapabilities(bool refresh) {
- static QVariantMap cached;
- static QString language;
- const auto currentLanguage=i18n::current();
- if(refresh||cached.isEmpty()||language!=currentLanguage){
- cached=scanEffectCapabilities();language=currentLanguage;
- }
- return cached;
-}
-static QString fgEffectId(engine::FrameGenerationBackend backend) {
- switch (backend) {
- case engine::FrameGenerationBackend::Dlss: return "dlss";
- case engine::FrameGenerationBackend::XeSS: return "xess";
- case engine::FrameGenerationBackend::Fsr: return "fsr3";
- case engine::FrameGenerationBackend::Fsr4: return "fsr4";
- case engine::FrameGenerationBackend::Vfg: return "vfg";
- }
- return {};
-}
-static QString unavailableEffects(const engine::EnhancementSettings& settings) {
- const auto caps = currentEffectCapabilities(true);
- QStringList requested;
- if (settings.nr) requested << "nr" + QString::number(int(engine::currentNrRuntime(settings.nrRuntime)));
- if (settings.sr) requested << "sr" + QString::number(settings.videoSrQuality);
- if (settings.multiplier > 1) requested << fgEffectId(settings.frameGenerationBackend);
- if (settings.videoHdr.enabled) requested << "hdr";
- for (const auto& id : requested) {
- const auto cap = caps.value(id).toMap();
- if (!cap.value("available").toBool()) return id + ": " + cap.value("reason").toString();
- }
- return {};
-}
-static QString disableUnavailableEffects(engine::ChainConfiguration& configuration) {
- const auto caps = currentEffectCapabilities();
- const auto available = [&](const char* id) { return caps.value(id).toMap().value("available").toBool(); };
- const engine::FrameGenerationAvailability fgAvailable{
- available("dlss"),available("xess"),available("fsr3"),available("fsr4"),available("vfg")};
- QStringList reasons;
- const auto sanitize = [&](engine::EffectChain& chain, engine::ChainGlobalSettings& globals) {
- // Also migrate disabled stages: keeping an unavailable DLSS selection
- // left the AMD dropdown at DLSS even though a fresh profile chose FSR.
- const auto savedBackend = globals.fgBackend;
- globals.fgBackend = engine::restoredFrameGenerationBackend(savedBackend,fgAvailable);
- if (globals.fgBackend != savedBackend) {
- if (engine::fsrFrameGeneration(globals.fgBackend)) chain.fgMultiplier=2;
- else if (globals.fgBackend==engine::FrameGenerationBackend::XeSS)
- chain.fgMultiplier=normalizeFgMultiplier(chain.fgMultiplier,globals.fgBackend,2);
- else chain.fgMultiplier=normalizeFgMultiplier(chain.fgMultiplier,globals.fgBackend,6);
- veyra::log::warn("fg-default",std::format("unavailable saved backend={} selected={} rememberedMultiplier={} enabled flags preserved",
- engine::frameGenerationBackendName(savedBackend),engine::frameGenerationBackendName(globals.fgBackend),chain.fgMultiplier));
- }
- for (uint32_t i = 0; i < chain.nodeCount; ++i) {
- auto& node = chain.nodes[i];
- QString id;
- switch (node.type) {
- case engine::EffectType::NrEnhance: id = "nr" + QString::number(int(engine::currentNrRuntime(node.nr.runtime))); break;
- case engine::EffectType::SuperResolution: id = "sr" + QString::number(globals.videoSrQuality); break;
- case engine::EffectType::FrameGeneration: id = fgEffectId(globals.fgBackend); break;
- case engine::EffectType::VideoHdr: id = "hdr"; break;
- default: break;
- }
- if (id.isEmpty() || !node.enabled) continue;
- const auto cap = caps.value(id).toMap();
- if (!cap.value("available").toBool()) {
- node.enabled = false;
- reasons << id + ": " + cap.value("reason").toString();
- }
- }
- if (globals.opticalFlowBackend == engine::OpticalFlowBackend::Nvidia &&
- !caps.value("flow0").toMap().value("available").toBool())
- globals.opticalFlowBackend = engine::OpticalFlowBackend::AmdFidelityFx;
- };
- sanitize(configuration.chain, configuration);
- if (configuration.editor) {
- auto editor = std::make_shared<engine::NodeEditorDocument>(*configuration.editor);
- auto globals = editor->globals.value_or(static_cast<const engine::ChainGlobalSettings&>(configuration));
- sanitize(editor->nodes, globals);
- editor->globals = globals;
- configuration.editor = std::move(editor);
- }
- reasons.removeDuplicates();
- return reasons.join("; ");
-}
-QVariantMap QmlPlayerBridge::effectCapabilities() const { return currentEffectCapabilities(); }
-QVariantMap QmlPlayerBridge::effectAvailability(const QString& id) const {
- const auto& s = settings();
- const QString key = id == "nr" ? "nr" + QString::number(int(engine::currentNrRuntime(s.nrRuntime))) :
- id == "sr" ? "sr" + QString::number(s.videoSrQuality) : id == "video-hdr" ? QString("hdr") :
- id == "frame-generation" ? fgEffectId(s.frameGenerationBackend) :
- id == "dlss-fg" ? QString("dlss") : id == "xess-fg" ? QString("xess") :
- id == "fsr3-fg" ? QString("fsr3") : id == "fsr4-fg" ? QString("fsr4") : id == "vfg-fg" ? QString("vfg") : id;
- const auto caps = effectCapabilities();
- return caps.contains(key) ? caps.value(key).toMap() : QVariantMap{{"available", true}, {"reason", QString{}}};
-}
-QVariantList QmlPlayerBridge::nrRuntimeChoices() const {
- QVariantList choices;
- const auto caps = effectCapabilities();
- for (const auto& entry : std::initializer_list<std::pair<int, QString>>{{2, "RTX 20–50 · SF 310.9.16"}, {3, tr("RTX 50 · NVIDIA 原版")}, {4, tr("RX 9000 · lmxxf(实验)")}}) {
- const auto cap = caps.value("nr" + QString::number(entry.first)).toMap();
- choices << QVariantMap{{"id", QString::number(entry.first)}, {"label", entry.second}, {"disabled", !cap.value("available").toBool()}, {"note", cap.value("reason")}};
- }
- return choices;
-}
-QVariantList QmlPlayerBridge::srBackendChoices() const {
- QVariantList choices;
- const auto caps = effectCapabilities();
- for (const auto& entry : std::initializer_list<std::pair<int, QString>>{{0, "DLSS SR"}, {4, tr("RTX 视频超分")}, {5, effectGpu().vendor == 0x1002 ? tr("FSR 3.1 / 4 · 自动兼容") : QString("FSR 3.1")}}) {
- const auto cap = caps.value("sr" + QString::number(entry.first)).toMap();
- choices << QVariantMap{{"id", QString::number(entry.first)}, {"label", entry.second}, {"disabled", !cap.value("available").toBool()}, {"note", cap.value("reason")}};
- }
- return choices;
-}
-
QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesystem::path dataDirectory,
QObject* parent)
: QObject(parent), impl_(std::make_unique<Impl>(engine, std::move(dataDirectory))) {
@@ -1791,7443 +636,5 @@ QmlPlayerBridge::~QmlPlayerBridge() {
}
-// --- professional-page readouts ---------------------------------------------
-// These read fields the engine genuinely publishes. Where it publishes nothing,
-// the getter says so and the UI shows an explicit "unmeasured" rather than a
-// zero or a stand-in.
-QString QmlPlayerBridge::outputSummary() const {
- const auto& s = impl_->snapshot;
- const auto& plan = s.metrics.resolution;
- if (!s.running || !plan.output.valid() || plan.settingsRevision != s.applied.revision) return {};
- return QStringLiteral("%1x%2").arg(plan.output.width).arg(plan.output.height);
-}
-
-// A display rate is only real when the system's display event can be read. No
-// counter is wired in this build, so it reports unknown and the UI shows "未测" -
-// which is exactly what the design requires instead of passing the submit rate off
-// as a measurement that was never taken.
-double QmlPlayerBridge::displayFps() const { return 0.0; }
-bool QmlPlayerBridge::displayFpsKnown() const { return false; }
-
-double QmlPlayerBridge::queuedFrames() const {
- // Valid output opportunities held by presenter jobs, not cumulative skips
- // and not the OS/display queue. Zero is meaningful only with a live window.
- return queuedFramesKnown() ? double(impl_->snapshot.metrics.flow.pendingOutputFrames) : 0.0;
-}
-bool QmlPlayerBridge::queuedFramesKnown() const {
- const auto& s = impl_->snapshot;
- const auto& flow = s.metrics.flow;
- return s.running && !s.image && s.sessionId != 0 &&
- flow.latest.sessionId == s.sessionId && flow.lastReady100ns > 0 &&
- flow.latest.frame.settingsRevision == s.applied.revision;
-}
-
-int QmlPlayerBridge::skippedFrames() const { return int(impl_->snapshot.previewSkipped); }
-
-QString QmlPlayerBridge::flowBackend() const {
- // The snapshot carries a performance figure and a content rate, not a backend
- // name; report the fact we do have and let it read as unmeasured otherwise.
- const auto& s = impl_->snapshot;
- if (s.flowPerf == 0) return {};
- return QStringLiteral("GPU 光流");
-}
-
-int QmlPlayerBridge::opticalFlowChoice() const { return int(settings().opticalFlowBackend); }
-bool QmlPlayerBridge::setOpticalFlowChoice(int backend) {
- if(backend<0||backend>2)return false;
- const auto cap = effectCapabilities().value("flow" + QString::number(backend)).toMap();
- if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return false; }
- const auto before=settings();auto next=before;
- next.opticalFlowBackend=engine::OpticalFlowBackend(backend);
- if(next.opticalFlowBackend==before.opticalFlowBackend)return true;
- if(!impl_->commit(next)){
- emit notice(tr("引擎未接受光流配置,原设置保留"),true);return false;
- }
- emit settingsChanged();return true;
-}
-
-QVariantList QmlPlayerBridge::stageTimings() const {
- // Consume the existing GPU timestamp aggregates. Repeated NR layers share
- // a timestamp slot: this is stage sampling, NOT per-node attribution.
- // XeSS-internal FG is not measured by the graph's DLSS FG batch query.
- const auto& s = impl_->snapshot;
- QVariantList out;
- using Stage = diagnostics::GpuStage;
- struct Row { const char* label; Stage stage; const char* color; };
- const Row rows[] = {
- {"输入", Stage::Color, "#A8A8B8"},
- {"抗锯齿", Stage::AaNode0, "#7FD4FF"},
- {"抗锯齿 2", Stage::AaNode1, "#A9E2FF"},
- {"人脸识别", Stage::BeautyDetect, "#FFB3D1"},
- {"美颜", Stage::BeautyNode0, "#FF8FBF"},
- {"美颜 2", Stage::BeautyNode1, "#FF9DC7"},
- {"美颜 3", Stage::BeautyNode2, "#FFABCF"},
- {"美颜 4", Stage::BeautyNode3, "#FFB9D7"},
- {"美颜 5", Stage::BeautyNode4, "#FFC7DF"},
- {"美颜 6", Stage::BeautyNode5, "#FFD5E7"},
- {"超分", Stage::Sr, "#6EA8FF"},
- {"光流", Stage::Flow, "#9A85FF"},
- {"NR采样", Stage::Nr, "#FF8A3D"},
- {"残差", Stage::Residual, "#E7B868"},
- {"FG", Stage::FgBatch, "#3DDC84"},
- {"HDR", Stage::VideoHdr, "#E58BD9"},
- {"呈现", Stage::Blit, "#58CAD4"},
- };
- const double budget = stageBudgetMs();
- // Several NR layers: every layer marks the shared NR slot, so it only ever held the last
- // layer's time (field report 2026-10-01). Each layer also has its own slot; with two or
- // more layers measured, show those instead of the shared row.
- std::vector<Row> shown;
- unsigned measuredLayers = 0;
- for (unsigned i = 0; i < diagnostics::kTimedNrLayers; ++i)
- if (s.metrics.flow.gpuTiming[size_t(diagnostics::nrLayerStage(i))].samples > 0) ++measuredLayers;
- static const char* const layerLabels[] = {"NR 第1层", "NR 第2层", "NR 第3层", "NR 第4层"};
- static const char* const layerColors[] = {"#FF8A3D", "#FFA866", "#FFC28F", "#FFD9B8"};
- for (const auto& r : rows) {
- // Anti-aliasing and beauty rows appear only while those nodes run.
- const bool optional = r.stage == Stage::AaNode0 || r.stage == Stage::AaNode1 ||
- (r.stage >= Stage::BeautyNode0 && r.stage <= Stage::BeautyDetect);
- if (optional && s.metrics.flow.gpuTiming[size_t(r.stage)].samples == 0) continue;
- if (r.stage == Stage::Nr && measuredLayers >= 2) {
- for (unsigned i = 0; i < diagnostics::kTimedNrLayers; ++i)
- if (s.metrics.flow.gpuTiming[size_t(diagnostics::nrLayerStage(i))].samples > 0)
- shown.push_back({layerLabels[i], diagnostics::nrLayerStage(i), layerColors[i]});
- } else shown.push_back(r);
- }
- for (const auto& r : shown) {
- const auto& sample = s.metrics.flow.gpuTiming[size_t(r.stage)];
- // The mean of the last second, as 1.4.4's dashboard showed; P95 rides along for the
- // tooltip. Showing P95 alone read as "slower than 1.4.4" for the same work.
- const bool measured = queuedFramesKnown() && sample.samples > 0 &&
- sample.mean && std::isfinite(*sample.mean) && *sample.mean >= 0.0;
- const double ms = measured ? *sample.mean : 0.0;
- QVariantMap item;
- item["label"] = uiText(std::string_view(r.label));
- item["ms"] = ms;
- item["p95"] = measured && sample.p95 ? *sample.p95 : 0.0;
- item["measured"] = measured;
- item["samples"] = measured ? QVariant::fromValue<qulonglong>(sample.samples) : QVariant::fromValue<qulonglong>(0);
- item["domain"] = QStringLiteral("GPU timestamp P95");
- item["color"] = QString::fromUtf8(r.color);
- item["fraction"] = (measured && budget > 0.01) ? ms / budget : 0.0;
- out << item;
- }
- return out;
-}
-
-QVariantMap QmlPlayerBridge::nodeTimings() const {
- // Per-node GPU timestamp P95, keyed by the card id chain() publishes. An
- // editor node borrows a number only when the wired path it sits on is the
- // chain actually running; drafts, detached and disabled nodes never do.
- using Stage = diagnostics::GpuStage;
- const auto& c = impl_->chain;
- const auto& flow = impl_->snapshot.metrics.flow;
- const bool node = c.mode == engine::ChainMode::Node;
- std::vector<int> path;
- bool draft = false;
- if (!node) {
- for (uint32_t i = 0; i < c.nodeCount; ++i) path.push_back(int(i));
- } else {
- uint32_t id = impl_->layout.inputNext;
- while (id > engine::NodeGraphLayout::Output && path.size() <= c.nodeCount) {
- const int index = impl_->layout.indexOf(c, id);
- if (index < 0) break;
- path.push_back(index);
- id = impl_->layout.next[size_t(index)];
- }
- engine::EffectChain projected;
- draft = id != engine::NodeGraphLayout::Output || !impl_->layout.project(c, projected).accepted ||
- engine::runtimeOrder(projected) != engine::runtimeOrder(impl_->acceptedChain);
- if (draft) path.clear();
- }
- const bool live = queuedFramesKnown();
- const auto& snapshot = impl_->snapshot;
- // A failed optical-flow/NR backend can leave the requested editor layer
- // enabled while the engine has deliberately resumed playback without NR.
- // Show that confirmed recovery, not an endless timing warmup or stale ms.
- const bool nrRejected = live && !snapshot.applying && snapshot.rejectedRevision != 0 &&
- snapshot.desired.revision == snapshot.applied.revision &&
- !snapshot.desired.nr && !snapshot.applied.nr && !snapshot.backendWarning.empty();
- const bool xess = fgBackendName() == QLatin1String("xess");
- QVariantMap out;
- auto publish = [&](uint32_t i, const QString& state, std::optional<Stage> stage) {
- QVariantMap item{{"state", state}, {"ms", 0.0}, {"samples", QVariant::fromValue<qulonglong>(0)}};
- if (state == QLatin1String("failed")) item["reason"] = uiText(snapshot.backendWarning);
- if (stage) {
- const auto& sample = flow.gpuTiming[size_t(*stage)];
- if (live && sample.samples > 0 && sample.mean && std::isfinite(*sample.mean) && *sample.mean >= 0.0) {
- item["state"] = QStringLiteral("measured");
- item["ms"] = *sample.mean;
- item["samples"] = QVariant::fromValue<qulonglong>(sample.samples);
- }
- }
- const QVariant key = node ? QVariant(impl_->layout.ids[i]) : QVariant(i + 2);
- out[key.toString()] = item;
- };
- std::vector<bool> onPath(c.nodeCount, false);
- for (const int i : path) onPath[size_t(i)] = true;
- for (uint32_t i = 0; i < c.nodeCount; ++i)
- if (!onPath[i]) publish(i, draft ? QStringLiteral("draft") : QStringLiteral("idle"), std::nullopt);
- unsigned enabledNr = 0, colour = 0, antiAlias = 0, beauty = 0;
- for (const int index : path) {
- const auto i = uint32_t(index);
- const auto& n = c.nodes[i];
- std::optional<Stage> stage;
- QString waiting = live ? QStringLiteral("pending") : QStringLiteral("stopped");
- switch (n.type) {
- case engine::EffectType::NrEnhance:
- if (nrRejected) waiting = QStringLiteral("failed");
- else if (n.enabled && enabledNr < diagnostics::kTimedNrLayers) stage = diagnostics::nrLayerStage(enabledNr);
- if (n.enabled) ++enabledNr;
- break;
- case engine::EffectType::Color:
- // Parameter 0 before any SR/NR is fused into the input conversion
- // shader: it has no separable GPU span of its own.
- if (colour < diagnostics::kTimedColorNodes) stage = diagnostics::colorNodeStage(colour);
- if (colour == 0) waiting = live ? QStringLiteral("fused") : waiting;
- ++colour;
- break;
- case engine::EffectType::AntiAliasing:
- // Indexed by parameter ordinal, like Color: every anti-aliasing node on the path counts.
- if (antiAlias < diagnostics::kTimedAaNodes) stage = diagnostics::aaNodeStage(antiAlias);
- ++antiAlias;
- break;
- case engine::EffectType::Beauty:
- if (beauty < diagnostics::kTimedBeautyNodes) stage = diagnostics::beautyNodeStage(beauty);
- ++beauty;
- break;
- case engine::EffectType::SuperResolution: stage = Stage::Sr; break;
- case engine::EffectType::VideoHdr:
- stage = Stage::VideoHdr;
- // SDR display path: the node is wired but TrueHDR is not built.
- if (live && !impl_->snapshot.videoHdrActive) waiting = QStringLiteral("hdr-sdr");
- break;
- case engine::EffectType::FrameGeneration:
- if (xess) waiting = QStringLiteral("sdk"); else stage = Stage::FgBatch;
- // Realtime admission declined the pairs inside this window.
- if (!xess && live && flow.counters.fgSkippedBeforeEval > 0 && flow.counters.fgEvaluated < flow.counters.fgCandidate)
- waiting = QStringLiteral("fg-skipped");
- break;
- default: waiting = QStringLiteral("untimed"); break;
- }
- if (!n.enabled) { publish(i, QStringLiteral("disabled"), std::nullopt); continue; }
- publish(i, waiting, stage);
- }
- return out;
-}
-
-double QmlPlayerBridge::stageBudgetMs() const {
- // Budget per content frame entering enhancement. Intentional dedup and
- // playback speed change that interval; a presentation cap alone does not.
- // Reuse the bounded status sample, without sampling or repainting faster.
- const auto& s=impl_->snapshot;const auto& h=impl_->history;
- const double fps=h.session==s.sessionId&&h.revision==s.applied.revision&&h.output.contentFps>0
- ?h.output.contentFps:s.nominalSourceFps*(s.captureHalfRate?.5:1.0);
- return fps > 0.01 ? 1000.0 / fps : 0.0;
-}
-
-double QmlPlayerBridge::scheduleP95Ms() const { return impl_->snapshot.schedulingWaitP95Ms; }
-
-double QmlPlayerBridge::chainTotalMs() const {
- // Engine merges same-frame measured intervals before aggregation. Never
- // sum unrelated percentiles. This excludes uninstrumented stages/nodes.
- // Mean of the last second, the same statistic as the stage rows (see stageTimings).
- return chainTotalMsKnown() ? *impl_->snapshot.metrics.flow.enhancementProcessing.mean : 0.0;
-}
-bool QmlPlayerBridge::chainTotalMsKnown() const {
- const auto& sample = impl_->snapshot.metrics.flow.enhancementProcessing;
- return queuedFramesKnown() && sample.samples > 0 && sample.mean &&
- std::isfinite(*sample.mean) && *sample.mean >= 0.0;
-}
-
-
-// --- frame generation --------------------------------------------------------
-QString QmlPlayerBridge::fgBackendName() const {
- switch(settings().frameGenerationBackend){
- case engine::FrameGenerationBackend::Dlss:return QStringLiteral("dlss");
- case engine::FrameGenerationBackend::XeSS:return QStringLiteral("xess");
- case engine::FrameGenerationBackend::Fsr:return QStringLiteral("fsr3");
- case engine::FrameGenerationBackend::Fsr4:return QStringLiteral("fsr4");
- case engine::FrameGenerationBackend::Vfg:return QStringLiteral("vfg");
- }
- return {};
-}
-QVariantList QmlPlayerBridge::fgBackendChoices() const {
- QVariantList choices = {
- QVariantMap{{"id","dlss"},{"label",tr("DLSS 帧生成")}},
- QVariantMap{{"id","xess"},{"label",tr("Intel XeSS · 实验")}},
- QVariantMap{{"id","fsr3"},{"label",tr("FSR 3.1 · 2X")}},
- QVariantMap{{"id","fsr4"},{"label",tr("FSR 4 ML · RX 9000 · 实验")}},
- QVariantMap{{"id","vfg"},{"label",tr("NVIDIA VFG · RTX 40 / 50")}}
- };
- const auto caps = effectCapabilities();
- for (auto& choice : choices) {
- auto row = choice.toMap();
- const auto cap = caps.value(row.value("id").toString()).toMap();
- row["disabled"] = !cap.value("available").toBool();
- row["note"] = cap.value("reason");
- choice = row;
- }
- return choices;
-}
-QString QmlPlayerBridge::fgProviderText() const {
- const auto& s=impl_->snapshot;
- if(fgBackendName()==QLatin1String("vfg")){
- if(!vfgHardwarePossible())return tr("VFG 需要 NVIDIA Ada / Blackwell 显卡(RTX 40 / 50)");
- if(!effectCapabilities().value("vfg").toMap().value("available").toBool())return tr("未找到 VFG 运行组件,请在组件页核对路径");
- return tr("VFG 支持 2X~8X 和低 / 中 / 高质量;6X~8X 为实验档,高倍高质量会增加处理时间");
- }
- if(engine::fsrFrameGeneration(s.applied.frameGenerationBackend)&&s.applied.multiplier>1&&!s.fsrProviderVersion.empty())
- return tr("实际运行:FSR %1 · 2X").arg(QString::fromStdString(s.fsrProviderVersion));
- if(fgBackendName()==QLatin1String("fsr4"))return tr("FSR 4 ML 需要支持的 RX 9000 和驱动;实卡待验");
- if(fgBackendName()==QLatin1String("fsr3"))return tr("FSR 3.1 跨厂商补帧 · 最高 2X");
- if(fgBackendName()==QLatin1String("xess"))
- return fgMaxMultiplier()<4?tr("当前 XeSS 模块未匹配 3X / 4X 解锁版本;2X 可用,请在组件页核对版本"):
- tr("2X 为原生路径,3X / 4X 为实验解锁;失败原因见诊断");
- return tr("NVIDIA RTX 补帧;倍率以运行库实际能力为准");
-}
-// XeSS ceiling (SettingsWindow): 4X with the audited unlock provider, else 2X,
-// or a running session's reported interpolation count above 2X.
-static int xessCeiling(const engine::PlayerSnapshot& s) {
- static const bool audited = gfx::XessMfgUnlock::providerIsAudited(
- (runtime::localDataDirectory() / L"intel" / L"experimental" / L"libxess_fg.dll").wstring());
- int cap = audited ? 4 : 2;
- // A running context reports the count it was CREATED with (3X -> 2), not
- // what the provider allows: it may raise the ceiling, never lower it.
- // Lowering it made 4X vanish after picking 3X until the backend was reset.
- // The highest ceiling any context has reported this run stays offered:
- // a later context created at 2X reports 1 and must not hide 3X/4X again.
- static int seen = 0;
- if (s.xessMaxInterpolatedFrames > 1) seen = std::max(seen, std::clamp(s.xessMaxInterpolatedFrames + 1, 2, 4));
- return std::max(cap, seen);
-}
-void QmlPlayerBridge::setFgBackendName(const QString& value) {
- if(value!=QLatin1String("dlss")&&value!=QLatin1String("xess")&&value!=QLatin1String("fsr3")&&value!=QLatin1String("fsr4")&&value!=QLatin1String("vfg")){emit notice(tr("未知补帧后端"),true);return;}
- const auto availability = effectCapabilities().value(value).toMap();
- if (!availability.value("available").toBool()) { emit notice(availability.value("reason").toString(), true); emit settingsChanged(); return; }
- auto s = settings();
- const auto want = value == QLatin1String("xess") ? engine::FrameGenerationBackend::XeSS
- : value == QLatin1String("fsr3") ? engine::FrameGenerationBackend::Fsr
- : value == QLatin1String("fsr4") ? engine::FrameGenerationBackend::Fsr4
- : value == QLatin1String("vfg") ? engine::FrameGenerationBackend::Vfg
- : engine::FrameGenerationBackend::Dlss;
- if (s.frameGenerationBackend == want) return;
- if(want==engine::FrameGenerationBackend::Vfg&&(!vfgHardwarePossible()||!pipeline::VfgBackend::runtimeAvailable(runtime::localRuntimeDirectory().wstring()))){
- emit notice(!vfgHardwarePossible()?tr("VFG 需要 NVIDIA Ada / Blackwell 显卡(RTX 40 / 50)"):tr("未找到 VFG 运行组件,请在组件页核对路径"),true);emit settingsChanged();return;
- }
- if (want == engine::FrameGenerationBackend::Fsr4 && !fsr4Possible()) {
- // Keep the previous choice; the menu snaps back to it.
- emit notice(tr("FSR 4 ML 补帧只支持 AMD RX 9000 显卡,当前显卡不能使用,已保持原来的补帧方式"), true);
- emit settingsChanged();
- return;
- }
- s.frameGenerationBackend = want;
- // A DLSS multiplier above XeSS's ceiling used to make the switch fail
- // silently in effect (the backend stayed DLSS). Clamp to the ceiling instead.
- auto& chain = impl_->chain;
- const auto beforeMultiplier = chain.fgMultiplier;
- const int cap = want == engine::FrameGenerationBackend::XeSS ? xessCeiling(impl_->snapshot)
- : engine::fsrFrameGeneration(want) ? 2 : want==engine::FrameGenerationBackend::Vfg?8:6;
- chain.fgMultiplier=normalizeFgMultiplier(chain.fgMultiplier,want,uint32_t(cap));
- const bool clamped = chain.fgMultiplier != beforeMultiplier;
- if(!impl_->commit(s)){
- chain.fgMultiplier = beforeMultiplier;
- emit notice(tr("补帧后端切换未被接受,原设置保留"),true);return;
- }
- if (clamped) emit notice(tr("所选补帧后端的倍率已调整为 %1X").arg(chain.fgMultiplier), false);
- emit settingsChanged();
- emitChainChanged();
-}
-
-int QmlPlayerBridge::fgMaxMultiplier() const {
- // AppShell/SettingsWindow rules. Capabilities report GENERATED frames, so the
- // multiplier ceiling is that count + 1 (DLSS MultiFrameCountMax 5 = 6X on
- // Blackwell, 1 = 2X on Ada). Unknown DLSS capability offers the full list; a
- // new context validates it. XeSS: 4X with the audited unlock provider, else
- // 2X, or what a running session already reported above 2X.
- const auto& s = impl_->snapshot;
- if(settings().frameGenerationBackend==engine::FrameGenerationBackend::Vfg)return 8;
- if(engine::fsrFrameGeneration(settings().frameGenerationBackend))return 2;
- if (settings().frameGenerationBackend == engine::FrameGenerationBackend::XeSS)
- return xessCeiling(s);
- if (s.fgCapabilityKnown && s.fgMultiFrameMax > 0) return std::clamp(s.fgMultiFrameMax + 1, 2, 6);
- return 6;
-}
-
-QVariantList QmlPlayerBridge::fgMultiplierChoices() const {
- // Only multipliers the chosen backend supports are offered: DLSS reaches 6X on
- // capable hardware, XeSS stops at 4X. Offering a value the provider would
- // refuse is the same lie as a dead control.
- const bool xess = settings().frameGenerationBackend
- == engine::FrameGenerationBackend::XeSS;
- const int ceiling = xess ? std::min(fgMaxMultiplier(), 4) : fgMaxMultiplier();
- QVariantList out;
- const auto choices=settings().frameGenerationBackend==engine::FrameGenerationBackend::Vfg?
- std::span<const uint32_t>(engine::kVfgMultiplierChoices):std::span<const uint32_t>(engine::kFgMultiplierChoices);
- for (const auto choice : choices) {
- const int m = int(choice);
- if (m < 2 || m > ceiling) continue;
- QVariantMap item;
- item["id"] = QString::number(m);
- item["label"] = QString::number(m) + QStringLiteral("X");
- out << item;
- }
- return out;
-}
-
-int QmlPlayerBridge::vfgQuality()const{return int(settings().vfgQuality);}
-void QmlPlayerBridge::setVfgQuality(int value){
- if(value<0||uint32_t(value)>=engine::kVfgQualityCount)return;auto s=settings();if(s.vfgQuality==uint32_t(value))return;
- s.vfgQuality=uint32_t(value);
- if(!impl_->commit(s)){emit notice(tr("VFG 质量设置未被接受,原设置保留"),true);return;}
- emit settingsChanged();emitChainChanged();
-}
-
-bool QmlPlayerBridge::fgStrict() const { return impl_->chain.fgStrictAdmission; }
-void QmlPlayerBridge::setFgStrict(bool value) {
- if (impl_->chain.fgStrictAdmission == value) return;
- impl_->chain.fgStrictAdmission = value;
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message;
- impl_->chain.fgStrictAdmission = !value; impl_->revalidate();
- emit notice(uiText(error), true);
- }
- emit settingsChanged();
- emitChainChanged();
-}
-
-// 低延迟队列 is the presentation queue (1.4.4 PresentationSettings.enabled),
-// not EnhancementSettings::lowLatency, which means "NR before SR".
-bool QmlPlayerBridge::fgLowQueue() const { return impl_->presentation.enabled; }
-void QmlPlayerBridge::setFgLowQueue(bool value) {
- if (impl_->presentation.enabled == value) return;
- impl_->presentation.enabled = value;
- applyPresentation();
-}
-
-// --- colour ------------------------------------------------------------------
-double QmlPlayerBridge::colorExposure() const { return selectedColourSettings().exposure; }
-void QmlPlayerBridge::setColorExposure(double v) {
- setColourParameter(QStringLiteral("exposure"),v);
-}
-double QmlPlayerBridge::colorContrast() const { return selectedColourSettings().contrast; }
-void QmlPlayerBridge::setColorContrast(double v) {
- setColourParameter(QStringLiteral("contrast"),v);
-}
-double QmlPlayerBridge::colorSaturation() const { return selectedColourSettings().saturation; }
-void QmlPlayerBridge::setColorSaturation(double v) {
- setColourParameter(QStringLiteral("saturation"),v);
-}
-double QmlPlayerBridge::colorTemperature() const { return selectedColourSettings().temperature; }
-void QmlPlayerBridge::setColorTemperature(double v) {
- setColourParameter(QStringLiteral("temperature"),v);
-}
-
-void QmlPlayerBridge::resetCurrentPage() {
- // Reset only the enhancement settings this page edits. Presets, recent files,
- // the capture session and the export selection are deliberately untouched.
- auto s = settings();
- s.nr = false; s.sr = false; s.multiplier = 1;
- s.lowLatency = false; s.nrTemporal = false;
- s.nrLayers = {}; s.nrLayerCount = 0;
- s.model = engine::NrSettings{};
- s.residual = engine::ResidualSettings{};
- s.protection = engine::ProtectionSettings{};
- s.color = engine::ColorSettings{};
- s.additionalColors = {}; s.additionalColorCount = 0;
- s.antiAlias = engine::AntiAliasSettings{}; s.additionalAntiAlias = {}; s.additionalAntiAliasCount = 0;
- s.beauty = engine::BeautySettings{}; s.additionalBeauty = {}; s.additionalBeautyCount = 0; s.beautyDetection = {};
- s.videoHdr = engine::VideoHdrSettings{};
- const auto before=impl_->chain; const auto selected=impl_->selectedNr;
- const auto oldLayout = impl_->layout;
- const auto selectedColour=impl_->selectedColour;
- impl_->chain=engine::toChain(s); impl_->selectedNr=-1; impl_->selectedColour=-1;
- impl_->chain.mode = before.mode;
- if (before.mode == engine::ChainMode::Node) {
- engine::removeLegacyNodeProtection(impl_->chain);
- const auto initialized = impl_->layout.initialize(impl_->chain);
- if (!initialized.accepted) {
- impl_->chain = before; impl_->layout = oldLayout;
- impl_->selectedNr = selected; impl_->selectedColour = selectedColour;
- emit notice(uiText(initialized.message), true); return;
- }
- impl_->initializeDefaultNodePositions();
- }
- if(!impl_->revalidate(true)){
- const auto error=impl_->validation.message;
- impl_->chain=before;impl_->layout=oldLayout;impl_->selectedNr=selected;impl_->selectedColour=selectedColour;impl_->revalidate();
- emit notice(uiText(error),true);
- }
- emit settingsChanged();
- emitChainChanged();
-}
-
-
-// --- shell preferences -------------------------------------------------------
-bool QmlPlayerBridge::reducedMotion() const { return impl_->facade.reducedMotion(); }
-int QmlPlayerBridge::uiDeviceGeneration() const { return impl_->uiDeviceGeneration; }
-void QmlPlayerBridge::noteUiDeviceRecreated(const QString& window) {
- ++impl_->uiDeviceGeneration;
- veyra::log::warn("ui-device", std::format("{} scene graph recreated after a lost graphics device; icons rebuilt generation={}",
- window.toStdString(), impl_->uiDeviceGeneration));
- emit uiDeviceGenerationChanged();
-}
-void QmlPlayerBridge::setReducedMotion(bool value) {
- if (impl_->facade.reducedMotion() == value) return;
- impl_->facade.setReducedMotion(value);
- emit settingsChanged();
-}
-QString QmlPlayerBridge::defaultPage() const { return utf8Of(impl_->facade.defaultPage()); }
-void QmlPlayerBridge::setDefaultPage(const QString& value) {
- if (utf8Of(impl_->facade.defaultPage()) == value) return;
- impl_->facade.setDefaultPage(wideOf(value));
- emit settingsChanged();
-}
-QString QmlPlayerBridge::defaultPageLabel() const {
- const QString page = defaultPage();
- if (page == QLatin1String("min")) return tr("极简模式");
- if (page == QLatin1String("pro")) return tr("专业模式");
- if (page == QLatin1String("last")) return tr("上次");
- return tr("首页");
-}
-
-QString QmlPlayerBridge::initialPage() const {
- // The saved preference unless a test override was set; "last" reopens the
- // page the previous session ended on.
- if (!impl_->initialPageOverride.isEmpty()) return impl_->initialPageOverride;
- if (defaultPage() == QLatin1String("last")) {
- const QString last = impl_->prefString("lastPage");
- return last.isEmpty() ? QStringLiteral("home") : last;
- }
- return defaultPage();
-}
-void QmlPlayerBridge::setInitialPage(const QString& value) {
- impl_->initialPageOverride = value;
- emit settingsChanged();
-}
-
-QString QmlPlayerBridge::currentPage() const { return impl_->currentPage; }
-void QmlPlayerBridge::setCurrentPage(const QString& value) {
- impl_->currentPage = value;
- static const QStringList remembered{"home", "min", "pro", "node", "set", "exp"};
- if (remembered.contains(value) && impl_->prefString("lastPage") != value) {
- impl_->prefs["lastPage"] = value == QLatin1String("node") ? QStringLiteral("pro") : value;
- impl_->savePrefs();
- }
-}
-
-QString QmlPlayerBridge::remotePlayState() const {
- // The engine's own remote-play state word, or empty when there is none. No
- // invented "connected" wording.
- return uiText(impl_->snapshot.remoteRecoveryMessage);
-}
-
-QVariantList QmlPlayerBridge::componentList() const {
- if (!impl_->componentListRead) { impl_->componentList = readComponentList(); impl_->componentListRead = true; }
- return impl_->componentList;
-}
-void QmlPlayerBridge::refreshComponentList() {
- auto list = readComponentList();
- impl_->componentListRead = true;
- if (list == impl_->componentList) return;
- impl_->componentList = std::move(list);
- emit componentListChanged();
-}
-QVariantList QmlPlayerBridge::readComponentList() const {
- // Read from the runtime manifest the build produces rather than a list written
- // by hand here, so the page cannot claim a component the package lacks.
- QVariantList out;
- const auto vfgDirectory=pipeline::VfgBackend::runtimeDirectory(runtime::localRuntimeDirectory().wstring());
- const bool vfgAvailable=pipeline::VfgBackend::runtimeAvailable(runtime::localRuntimeDirectory().wstring());
- out<<QVariantMap{{"name",QStringLiteral("NVIDIA VFG")},{"detail",QString::fromStdWString(vfgDirectory)},
- {"loaded",vfgAvailable},{"experimental",true}};
- const auto manifest = runtime::localRuntimeDirectory() / L"release-runtime-manifest.json";
- QFile file(QString::fromWCharArray(manifest.c_str()));
- if (!file.open(QIODevice::ReadOnly)) {
- // No manifest is a reportable fact, not a reason to invent entries.
- return out;
- }
- const auto document = QJsonDocument::fromJson(file.readAll());
- const auto entries = document.isArray() ? document.array()
- : document.object().value(QStringLiteral("files")).toArray();
- for (const auto& value : entries) {
- const auto object = value.toObject();
- QVariantMap item;
- item["name"] = object.value(QStringLiteral("name")).toString();
- // Release manifests write fileVersion/authenticode; keep the short keys too.
- auto field = [&](const char* primary, const char* fallback) {
- const QString text = object.value(QLatin1String(primary)).toString();
- return text.isEmpty() ? object.value(QLatin1String(fallback)).toString() : text;
- };
- const QString version = field("version", "fileVersion");
- const QString signature = field("signature", "authenticode");
- const bool experimental = object.value(QStringLiteral("experimental")).toBool();
- // Several runtimes share a file name (the NR slots); the folder tells them apart.
- const QString path = object.value(QStringLiteral("path")).toString();
- const QString folder = path.section(QLatin1Char('/'), 0, -2);
- QStringList detail;
- for (const QString& part : {version, signature, folder})
- if (!part.isEmpty()) detail << part;
- item["detail"] = detail.join(QStringLiteral(" · "));
- item["loaded"] = object.value(QStringLiteral("loaded")).toBool(true);
- item["experimental"] = experimental;
- if (!item["name"].toString().isEmpty()) out << item;
- }
- return out;
-}
-
-void QmlPlayerBridge::openProjectPage() {
- // 关于 → 交流群: the group QR codes are kept current in the project README.
- if (!QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/Likely7/Veyra-NRVideo#readme"))))
- emit notice(tr("无法打开浏览器"), true);
-}
-
-void QmlPlayerBridge::copyDiagnostics() {
- if (auto* clipboard = QGuiApplication::clipboard()) {
- clipboard->setText(diagnosticsReport());
- emit notice(tr("诊断信息已复制"), false);
- }
-}
-
-
-// --- capture dialog ----------------------------------------------------------
-static QString captureDeviceUiLabel(const source::CaptureDevice& device) {
- return source::decklink::isPath(device.path)
- ? uiText(device.name).replace(QStringLiteral("跟随驱动输入"), uiText(L"跟随驱动输入")) : utf8Of(device.name);
-}
-QVariantList QmlPlayerBridge::captureDevices() const {
- // The source's own enumeration (asynchronous, see refreshCaptureDevices). An
- // empty list means the machine reports no capture devices.
- QVariantList out;
- for (const auto& d : impl_->captureVideo) {
- const bool native=source::decklink::isPath(d.path);
- const bool enabled=impl_->prefBool("blackmagicNativeCapture",false);
- if(native&&!enabled)continue;
- if(!native&&enabled&&source::isBlackmagicCaptureDevice(d.name,d.path))continue;
- out << QVariantMap{{"id", utf8Of(d.path)}, {"label", captureDeviceUiLabel(d)}, {"embeddedAudio", d.hasEmbeddedAudio}};
- }
- return out;
-}
-QString QmlPlayerBridge::captureDeviceId() const { return utf8Of(impl_->captureDevice); }
-void QmlPlayerBridge::setCaptureDeviceId(const QString& value) {
- if (impl_->captureDriverSettingsOpen) return;
- if (impl_->captureDevice == wideOf(value)) return;
- impl_->captureDevice = wideOf(value);
- impl_->captureFormatList.clear();++impl_->captureFormatGeneration;
- impl_->captureResolutionChoice.clear();impl_->captureRateChoice.clear();
- impl_->captureRequestedResolution.clear();
- impl_->captureFormatKey=impl_->captureDevice==impl_->capturePrefs.videoPath?impl_->capturePrefs.formatKey:std::wstring{};
- impl_->captureDriverFormatKey.clear();
- // Colour follows the device, as in 1.4.4; audio returns to "none" unless it
- // is the remembered device.
- impl_->captureColor = impl_->capturePrefs.colorForDevice(impl_->captureDevice);
- if(impl_->captureDevice==impl_->capturePrefs.videoPath)impl_->restoreCaptureForm();
- else {impl_->captureAudioChoice=source::kCaptureAudioDisabled;impl_->captureAudioMissing=false;}
- if(!impl_->persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- if (!impl_->captureDevice.empty()) queryCapture(1, impl_->captureDevice);
- emit captureChanged();
-}
-QString QmlPlayerBridge::captureDeviceLabel() const {
- for (const auto& d : impl_->captureVideo) if (d.path == impl_->captureDevice) return captureDeviceUiLabel(d);
- return impl_->captureDevice.empty() ? tr("未选择设备") : tr("设备未连接");
-}
-static QString captureFormatUiLabel(const source::CaptureFormat& f, const std::wstring& device) {
- auto label=uiText(f.label);
- if(source::decklink::isPath(device))label=label.replace(QStringLiteral("逐行"),QmlPlayerBridge::tr("逐行")).replace(QStringLiteral("隔行"),QmlPlayerBridge::tr("隔行"));
- if(source::captureMjpegFormat(f))label+=uiText(L"(不建议使用)");
- return label;
-}
-QVariantList QmlPlayerBridge::captureFormats() const {
- return impl_->captureList(impl_->captureFormatsCache, impl_->captureDevice, {}, [this] {
- QVariantList out;
- out.reserve(qsizetype(impl_->captureFormatList.size()));
- for (const auto& f : impl_->captureFormatList) {
- out << QVariantMap{{"id", utf8Of(f.key)}, {"label", captureFormatUiLabel(f, impl_->captureDevice)}, {"tier", f.tier},
- {"costHint", source::captureFormatNeedsCostHint(static_cast<source::CaptureFormatTier>(f.tier))}, {"driverCurrent", f.driverCurrent},
- {"width", int(f.width)}, {"height", int(f.height)}, {"fps", f.fps}, {"pixel", uiText(f.pixel)},
- {"scan", uiText(f.scan)}, {"interlaced", f.interlaced}, {"disabled", !f.supported}, {"rangeCandidate", f.rangeCandidate}, {"danger",source::captureMjpegFormat(f)}};
- }
- return out;
- });
-}
-QString QmlPlayerBridge::captureFormatKey() const { return utf8Of(impl_->captureFormatKey); }
-QString QmlPlayerBridge::captureFormatLabel() const {
- if (impl_->captureFormatKey.empty()) return {};
- for (const auto& f : impl_->captureFormatList)
- if (f.key == impl_->captureFormatKey) return captureFormatUiLabel(f, impl_->captureDevice);
- return {};
-}
-bool QmlPlayerBridge::captureFormatCostHint() const {
- if (impl_->captureFormatKey.empty()) return false;
- for (const auto& f : impl_->captureFormatList)
- if (f.key == impl_->captureFormatKey) return source::captureFormatNeedsCostHint(static_cast<source::CaptureFormatTier>(f.tier));
- return false;
-}
-void QmlPlayerBridge::setCaptureFormatKey(const QString& key) {
- const auto* format=source::selectCaptureFormat(impl_->captureFormatList,-1,wideOf(key));
- if(!format){
- // Retain the attempted identity as invalid, so a subsequent Connect
- // cannot silently open the previous selection instead.
- impl_->captureFormatKey=wideOf(key);
- impl_->captureStatus=tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。");
- emit notice(impl_->captureStatus,true);emit captureChanged();return;
- }
- if (impl_->captureFormatKey == format->key && impl_->captureResolutionChoice == source::captureResolutionId(*format) && impl_->captureRateChoice == source::captureFrameRateGroupId(*format)) return;
- impl_->captureResolutionChoice=source::captureResolutionId(*format);
- impl_->captureRateChoice=source::captureFrameRateGroupId(*format);
- impl_->captureFormatKey = format->key;
- impl_->captureStatus.clear();
- if(!impl_->persistCaptureSelection(true))emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- emit captureChanged();
-}
-namespace {
-QVariantList captureChoiceList(const std::vector<source::CaptureFormatOption>& options) {
- QVariantList out;
- for (const auto& option : options)
- out << QVariantMap{{"id", utf8Of(option.id)}, {"label", uiText(option.label)+(option.discouraged?uiText(L"(不建议使用)"):QString{})}, {"disabled",option.disabled},{"danger",option.discouraged}};
- return out;
-}
-const source::CaptureFormat* selectedCaptureFormat(const std::vector<source::CaptureFormat>& formats, const std::wstring& key) {
- return source::selectCaptureFormat(formats, -1, key);
-}
-}
-QVariantList QmlPlayerBridge::captureResolutionOptions() const {
- return impl_->captureList(impl_->captureResolutionCache, {}, {}, [this] { return captureChoiceList(source::captureResolutionOptions(impl_->captureFormatList)); });
-}
-QString QmlPlayerBridge::captureResolutionId() const {
- return utf8Of(impl_->captureResolutionChoice);
-}
-void QmlPlayerBridge::setCaptureResolutionId(const QString& id) {
- QString normalized=id.trimmed().toLower();normalized.remove(QLatin1Char(' '));
- normalized.replace(QChar(0x00D7),QLatin1Char('x'));
- const auto wide = wideOf(normalized);
- if(impl_->captureResolutionChoice==wide)return;
- const auto* sample=source::captureResolutionSample(impl_->captureFormatList,wide);
- if(!sample){
- const auto hint=source::captureResolutionHint(wide);
- if(hint.width&&hint.height&&!impl_->captureDevice.empty()&&!source::decklink::isPath(impl_->captureDevice)){
- impl_->captureRequestedResolution=wide;queryCapture(4,impl_->captureDevice);return;
- }
- emit notice(tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。"),true);return;
- }
- impl_->captureResolutionChoice=wide;
- if(!source::captureRateSample(impl_->captureFormatList,wide,impl_->captureRateChoice))
- if(const auto* rate=source::captureDefaultFrameRate(impl_->captureFormatList,wide))impl_->captureRateChoice=source::captureFrameRateGroupId(*rate);
- impl_->captureFormatKey.clear();
- if(!impl_->persistCaptureSelection(true))emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- emit captureChanged();
-}
-QVariantList QmlPlayerBridge::captureFrameRateOptions() const {
- // Common rates only unless 显示全部可用帧率 is on (captureVisibleFrameRates).
- const bool all = impl_->prefBool("captureShowAllFrameRates", false);
- return impl_->captureList(impl_->captureRateCache, impl_->captureResolutionChoice, impl_->captureRateChoice + (all ? L"|all" : L""), [this, all] {
- size_t hidden = 0;
- const auto rates = source::captureVisibleFrameRates(source::captureFrameRateOptions(impl_->captureFormatList,
- source::captureResolutionSample(impl_->captureFormatList, impl_->captureResolutionChoice)), impl_->captureRateChoice, all, &hidden);
- impl_->captureHiddenRates = int(hidden);
- return captureChoiceList(rates);
- });
-}
-int QmlPlayerBridge::captureHiddenFrameRates() const {
- (void)captureFrameRateOptions(); // the count is built with the list
- return impl_->captureHiddenRates;
-}
-QString QmlPlayerBridge::captureFrameRateId() const {
- return utf8Of(impl_->captureRateChoice);
-}
-void QmlPlayerBridge::setCaptureFrameRateId(const QString& id) {
- const auto wide = wideOf(id);
- if(impl_->captureResolutionChoice.empty()){emit notice(tr("请先选择分辨率"),true);return;}
- if(impl_->captureRateChoice==wide)return;
- if(!source::captureRateSample(impl_->captureFormatList,impl_->captureResolutionChoice,wide)){
- emit notice(tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。"),true);return;
- }
- const auto* sample=source::captureRateSample(impl_->captureFormatList,impl_->captureResolutionChoice,wide);
- impl_->captureRateChoice=source::captureFrameRateGroupId(*sample);impl_->captureFormatKey.clear();
- if(!impl_->persistCaptureSelection(true))emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- emit captureChanged();
-}
-QVariantList QmlPlayerBridge::capturePixelOptions() const {
- return impl_->captureList(impl_->capturePixelCache, impl_->captureResolutionChoice, impl_->captureRateChoice, [this] {
- return captureChoiceList(source::capturePixelOptions(impl_->captureFormatList, source::captureRateSample(impl_->captureFormatList,impl_->captureResolutionChoice,impl_->captureRateChoice)));
- });
-}
-QString QmlPlayerBridge::capturePixelId() const {
- const auto* format = source::selectCapturePixelFormat(impl_->captureFormatList,impl_->captureResolutionChoice,impl_->captureRateChoice,impl_->captureFormatKey);
- return format ? utf8Of(format->key) : QString();
-}
-void QmlPlayerBridge::setCapturePixelId(const QString& id) {
- const auto key = wideOf(id);
- if(impl_->captureResolutionChoice.empty()){emit notice(tr("请先选择分辨率"),true);return;}
- if(!source::selectCapturePixelFormat(impl_->captureFormatList,impl_->captureResolutionChoice,impl_->captureRateChoice,key)){
- impl_->captureFormatKey=key;
- impl_->captureStatus=tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。");
- emit notice(impl_->captureStatus,true);emit captureChanged();return;
- }
- setCaptureFormatKey(id);
-}
-QVariantList QmlPlayerBridge::captureAudioInputs() const {
- // Only what the user picks explicitly is ever opened (1.4.4 rule).
- QVariantList out{QVariantMap{{"id", source::kCaptureAudioDisabled}, {"label", tr("不监听音频")}}};
- if(impl_->captureAudioMissing)out<<QVariantMap{{"id",-4},{"label",tr("上次的音频输入未连接")},{"disabled",true}};
- for (const auto& d : impl_->captureVideo)
- if (d.path == impl_->captureDevice)
- out << QVariantMap{{"id", source::kCaptureAudioFromVideoDevice},
- {"label", d.hasEmbeddedAudio ? tr("视频设备内置音频(已检测)") : tr("尝试视频设备内置音频")}};
- for (size_t i = 0; i < impl_->captureAudio.size(); ++i)
- out << QVariantMap{{"id", int(i)}, {"label", QStringLiteral("[%1] %2").arg(impl_->captureAudio[i].wasapi ? QStringLiteral("WASAPI") : QStringLiteral("DirectShow"), utf8Of(impl_->captureAudio[i].name))}};
- return out;
-}
-int QmlPlayerBridge::captureAudioChoice() const { return impl_->captureAudioMissing?-4:impl_->captureAudioChoice; }
-void QmlPlayerBridge::setCaptureAudioChoice(int choice) {
- if (choice < source::kCaptureAudioFromVideoDevice || choice >= int(impl_->captureAudio.size())) return;
- impl_->captureAudioChoice = choice;
- impl_->captureAudioMissing=false;
- // Remember the audio choice for this device as soon as it is picked, not only on
- // 连接并开始 (field report 2026-10-01: picked, closed, and it was gone next time).
- if(!impl_->persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- emit captureChanged();
-}
-int QmlPlayerBridge::captureColorSpace() const { return int(source::captureColorSpace(impl_->captureColor)); }
-void QmlPlayerBridge::setCaptureColorSpace(int value) {
- if (value < 0 || value > 3) return;
- impl_->captureColor = source::captureColorOverride(unsigned(value), source::captureColorRange(impl_->captureColor));
- if(!impl_->persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- emit captureChanged();
-}
-int QmlPlayerBridge::captureColorRange() const { return int(source::captureColorRange(impl_->captureColor)); }
-void QmlPlayerBridge::setCaptureColorRange(int value) {
- if (value < 0 || value > 2) return;
- impl_->captureColor = source::captureColorOverride(source::captureColorSpace(impl_->captureColor), unsigned(value));
- if(!impl_->persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- emit captureChanged();
-}
-double QmlPlayerBridge::captureRequestedFps() const { return impl_->captureFps; }
-void QmlPlayerBridge::setCaptureRequestedFps(double value) {
- if (!source::validCaptureFrameRate(value)) { emit notice(tr("采集帧率请输入 1–1000 的数字(可带小数),或 0 沿用设备默认"), true); return; }
- if (impl_->captureFps == value) return;
- impl_->captureFps = value;
- // Saved as soon as it is typed, as the audio choice is (field report 2026-10-01: the
- // new rate was lost unless another option was changed before closing).
- if(!impl_->persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- veyra::log::info("capture-ui", std::format("requested fps={}", value));
- emit captureChanged();
-}
-int QmlPlayerBridge::captureAudioIngress() const { return int(settings().captureAudio); }
-void QmlPlayerBridge::setCaptureAudioIngress(int value) {
- if (value < 0 || value > 2) return;
- auto s = settings(); s.captureAudio = static_cast<engine::CaptureAudioIngress>(value);
- if(impl_->commit(std::move(s))){impl_->prefs["captureAudioIngress"]=value;if(!impl_->savePrefs())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);}
- emit settingsChanged();
-}
-int QmlPlayerBridge::captureBufferMode() const { return int(settings().captureBuffer); }
-void QmlPlayerBridge::setCaptureBufferMode(int value) {
- if (value < 0 || value > 2) return;
- auto s = settings(); s.captureBuffer = static_cast<source::CaptureBufferMode>(value);
- if(impl_->commit(std::move(s))){impl_->prefs["captureBufferMode"]=value;if(!impl_->savePrefs())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);}
- emit settingsChanged();
-}
-bool QmlPlayerBridge::captureQueryBusy() const { return impl_->captureBusy || impl_->captureDriverSettingsOpen; }
-QString QmlPlayerBridge::captureStatus() const { return impl_->captureStatus; }
-bool QmlPlayerBridge::captureBlackmagicDevice() const {
- for (const auto& d : impl_->captureVideo) if (d.path == impl_->captureDevice) return source::decklink::isPath(d.path)||source::isBlackmagicCaptureDevice(d.name, d.path);
- return false;
-}
-bool QmlPlayerBridge::openCaptureDriverSettings(bool inputSelector) {
- auto& i = *impl_;
- if (captureQueryBusy() || i.captureDevice.empty()) { emit notice(tr("请先选择设备并等待查询完成"), true); return false; }
- if (i.openingSource || (i.snapshot.capture && !i.engine.idle())) { emit notice(tr("请等待连接结束并断开采集,再打开驱动设置"), true); return false; }
- HWND owner = i.videoWindow ? GetAncestor(i.videoWindow, GA_ROOT) : nullptr;
- if (!owner) if (auto* window = QGuiApplication::focusWindow()) owner = reinterpret_cast<HWND>(window->winId());
- i.captureDriverSettingsOpen = true; emit captureChanged();
- std::wstring error;
- const bool ok = source::CaptureCardSource::showDeviceProperties(i.captureDevice, reinterpret_cast<uintptr_t>(owner), inputSelector, error, &i.captureDriverFormatKey);
- i.captureDriverSettingsOpen = false;
- if (!ok) { i.captureStatus = uiText(error); emit notice(i.captureStatus, true); emit captureChanged(); return false; }
- // Some property pages change only this filter instance's IAMStreamConfig.
- // Carry its exact identity to the new graph instead of discarding it.
- queryCapture(3, i.captureDevice);
- return true;
-}
-bool QmlPlayerBridge::captureMagewellDevice() const { return source::magewell::isProCaptureDevicePath(impl_->captureDevice); }
-QString QmlPlayerBridge::captureMagewellStatus() const {
- std::wstring runtime;
- if (!source::magewell::runtimeAvailable(&runtime))
- return tr("找不到美乐威运行库 LibMWCapture.dll(应在软件的 runtime\\magewell 文件夹里,或装美乐威驱动/SDK)");
- return veyra::ui::i18n::text(source::magewell::statusText());
-}
-void QmlPlayerBridge::refreshCaptureDevices() {
- if (impl_->captureDriverSettingsOpen) return;
- impl_->capturePrefs = ui::CapturePreferenceStore(impl_->dataDir).load();
- queryCapture(0, {});
-}
-void QmlPlayerBridge::queryCapture(int kind, std::wstring device) {
- auto& i = *impl_;
- if (captureQueryBusy()) { i.captureNextQuery=std::pair{kind,std::move(device)};return; }
- i.captureBusy = true; i.captureQueryKind = kind;
- i.captureStatus = kind == 0 ? tr("正在查询采集设备…当前播放继续") : tr("正在读取设备支持的格式…");
- const auto preferred=kind==2?i.capturePrefs.formatKey:
- kind==3&&!i.captureDriverFormatKey.empty()?i.captureDriverFormatKey:i.captureFormatKey;
- const auto requested=kind==4?i.captureRequestedResolution:
- preferred.empty()&&wideOf(i.prefs.value("captureDraftDevice").toString())==device?
- wideOf(i.prefs.value("captureDraftResolution").toString()):std::wstring{};
- i.captureQuery = std::async(std::launch::async, [kind, device, preferred, requested] {
- Impl::CaptureQuery q; q.kind = kind; q.device = device;q.requestedResolution=requested;
- const auto initialized=CoInitializeEx(nullptr, COINIT_MULTITHREADED);
- if(FAILED(initialized)){q.info.code=initialized;q.info.stage=L"COM initialization";return q;}
- try {
- if (kind == 0) { q.video = source::CaptureCardSource::deviceDetails(); q.audio = source::CaptureCardSource::deviceDetails(true); }
- else {
- if (kind == 2) { q.video = source::CaptureCardSource::deviceDetails(); q.audio = source::CaptureCardSource::deviceDetails(true); }
- q.formats = source::CaptureCardSource::formatsByPath(device,&q.info,preferred,requested);
- }
- } catch (...) {q.info.code=E_FAIL;q.info.stage=L"Capture capability exception";}
- CoUninitialize();
- return q;
- });
- emit captureChanged();
-}
-void QmlPlayerBridge::tickCapture() {
- auto& i = *impl_;
- if (!i.captureBusy || i.captureQuery.wait_for(std::chrono::seconds(0)) != std::future_status::ready) return;
- auto q = i.captureQuery.get();
- i.captureBusy = false;
- if(i.captureNextQuery){auto next=std::move(*i.captureNextQuery);i.captureNextQuery.reset();queryCapture(next.first,std::move(next.second));return;}
- if(FAILED(q.info.code)&&q.formats.empty()){
- if(q.kind!=0&&q.device!=i.captureDevice){emit captureChanged();return;}
- if(q.kind!=0&&q.kind!=4){i.captureFormatList.clear();++i.captureFormatGeneration;i.captureResolutionChoice.clear();i.captureRateChoice.clear();}
- i.captureStatus=tr("读取采集格式失败:%1(0x%2)。请检查设备占用与驱动后重试。")
- .arg(utf8Of(q.info.stage),QString::number(quint32(q.info.code),16).rightJustified(8,QLatin1Char('0')));
- emit notice(i.captureStatus,true);emit captureChanged();return;
- }
- if (q.kind == 0 || q.kind == 2) { i.captureVideo = std::move(q.video); i.captureAudio = std::move(q.audio); i.captureListed = true; }
- // The remembered rate and audio input, matched against the inputs listed now. Both the
- // panel (kind 0) and 继续上次 (kind 2) need it: the resume path skipped it and connected
- // without sound until the panel was opened once (field report 2026-10-02).
- const auto restoreRememberedAudio = [&i] {
- i.restoreCaptureForm();
- };
- if (q.kind == 2 && q.device == i.capturePrefs.videoPath) restoreRememberedAudio();
- if (q.kind == 0) {
- veyra::log::info("capture-ui", std::format("devices video={} audio={}", i.captureVideo.size(), i.captureAudio.size()));
- // Restore the remembered device; otherwise the first one. Never guess audio.
- std::wstring pick;
- const auto choices=captureDevices();
- auto allowed=[&](std::wstring_view path){for(const auto& value:choices)if(wideOf(value.toMap().value("id").toString())==path)return true;return false;};
- if(allowed(i.capturePrefs.videoPath))pick=i.capturePrefs.videoPath;
- // The two APIs are separate identities. Restore an explicitly used
- // endpoint, or select a unique native endpoint; never map by ordinal.
- const bool native=i.prefBool("blackmagicNativeCapture",false);
- const auto remembered=wideOf(i.prefs.value(native?"blackmagicNativeLastDevice":"blackmagicDirectShowLastDevice").toString());
- if(pick.empty()&&allowed(remembered))pick=remembered;
- if(pick.empty()&&native){std::vector<std::wstring> candidates;for(const auto& d:i.captureVideo)if(source::decklink::isPath(d.path))candidates.push_back(d.path);if(candidates.size()==1)pick=candidates.front();}
- if (pick.empty() && !choices.empty() && i.capturePrefs.videoPath.empty()&&!native) pick=wideOf(choices.front().toMap().value("id").toString());
- i.captureStatus = i.captureVideo.empty() ? tr("未找到采集设备。连接后点击刷新。")
- : pick.empty() ? tr("上次采集设备未连接。插回后刷新,或手动选择其他设备。") : QString();
- if (!pick.empty()) {
- i.captureDevice.clear();
- setCaptureDeviceId(utf8Of(pick));
- if (pick == i.capturePrefs.videoPath) restoreRememberedAudio();
- }else{setCaptureDeviceId({});if(native)i.captureStatus=tr("请选择 BMD 原生设备;若列表中没有,请安装 Desktop Video 驱动。多个设备不会自动猜选。");}
- emit captureChanged();
- return;
- }
- if (q.device != i.captureDevice) { emit captureChanged(); return; } // stale answer
- if(q.kind==4&&!source::captureResolutionSample(q.formats,q.requestedResolution)){
- i.captureStatus=tr("驱动未提供该分辨率,或尺寸不符合步进要求;原选择已保留。");
- emit notice(i.captureStatus,true);emit captureChanged();return;
- }
- i.captureFormatList = std::move(q.formats);
- ++i.captureFormatGeneration;
- const bool remembered = i.captureDevice == i.capturePrefs.videoPath;
- const std::wstring driverSelection = i.captureDriverFormatKey.empty() ? i.captureFormatKey : i.captureDriverFormatKey;
- if (q.kind == 3) i.captureDriverFormatKey.clear();
- i.captureFormatKey.clear();
- if (q.kind == 3 && !driverSelection.empty()) {
- if (const auto* f = source::selectCaptureFormat(i.captureFormatList, -1, driverSelection)) i.captureFormatKey = f->key;
- } else if (remembered && !i.capturePrefs.formatKey.empty()) {
- if (const auto* f = source::selectCaptureFormat(i.captureFormatList, -1, i.capturePrefs.formatKey)) i.captureFormatKey = f->key;
- }
- i.captureResolutionChoice.clear();i.captureRateChoice.clear();
- if(const auto* f=selectedCaptureFormat(i.captureFormatList,i.captureFormatKey)){
- i.captureResolutionChoice=source::captureResolutionId(*f);i.captureRateChoice=source::captureFrameRateGroupId(*f);
- }else if(remembered&&i.capturePrefs.formatKey.empty()&&wideOf(i.prefs.value("captureDraftDevice").toString())==i.captureDevice){
- const auto resolution=wideOf(i.prefs.value("captureDraftResolution").toString());
- const auto rate=wideOf(i.prefs.value("captureDraftRate").toString());
- if(source::captureResolutionSample(i.captureFormatList,resolution)){
- i.captureResolutionChoice=resolution;
- if(const auto* sample=source::captureRateSample(i.captureFormatList,resolution,rate))i.captureRateChoice=source::captureFrameRateGroupId(*sample);
- }
- }
- if(q.kind==4){
- i.captureResolutionChoice=q.requestedResolution;i.captureFormatKey.clear();
- if(const auto* rate=source::captureDefaultFrameRate(i.captureFormatList,i.captureResolutionChoice))i.captureRateChoice=source::captureFrameRateGroupId(*rate);
- if(!i.persistCaptureSelection(true))emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- }
- if(!i.captureFormatKey.empty()&&!i.persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- i.captureStatus = i.captureFormatList.empty() ? tr("驱动未提供可解析的视频格式,请检查设备与驱动后刷新。")
- : i.captureFormatKey.empty() ? (!i.capturePrefs.formatKey.empty()?tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。"):tr("先选择分辨率,再选择该分辨率支持的帧率和像素格式"))
- : q.kind == 3 ? tr("驱动设置已关闭。请核对所选格式与设备帧率,再连接。")
- : source::decklink::isPath(i.captureDevice) ? tr("原生采集先确认有效信号;请在设备列表选择对应的 HDMI/SDI 输入,支持自动检测的卡建议选择自动。Driver 保留驱动当前输入。")
- : captureBlackmagicDevice() ? tr("请选择与输入信号一致的格式。驱动默认格式不代表检测到的信号。")
- : tr("连接后使用当前增强设置。格式与音频变更需要重新连接。");
- if(q.info.partial)i.captureStatus=tr("部分采集能力读取失败(%1,0x%2);当前列表可能不完整,请刷新重试。")
- .arg(utf8Of(q.info.stage),QString::number(quint32(q.info.code),16).rightJustified(8,QLatin1Char('0')));
- veyra::log::info("capture-ui", std::format("formats={} selected={} raw={} rejected={} partial={} fallback={}", i.captureFormatList.size(), !i.captureFormatKey.empty(),q.info.advertised,q.info.rejected,q.info.partial,q.info.fallback));
- emit captureChanged();
- if (q.kind == 2) {
- if (i.captureFormatKey.empty()) emit notice(tr("上次的采集格式不可用,请在采集卡面板重新选择"), true);
- else startCaptureSession();
- }
-}
-bool QmlPlayerBridge::startCaptureSession() {
- auto& i = *impl_;
- if (captureQueryBusy()) { emit notice(tr("设备查询或驱动设置尚未完成"), true); return false; }
- int device = -1;
- for (size_t k = 0; k < i.captureVideo.size(); ++k) if (i.captureVideo[k].path == i.captureDevice) device = int(k);
- const auto* format = source::selectCapturePixelFormat(i.captureFormatList,i.captureResolutionChoice,i.captureRateChoice,i.captureFormatKey);
- if(source::decklink::isPath(i.captureDevice)!=i.prefBool("blackmagicNativeCapture",false)&&captureBlackmagicDevice()){
- emit notice(tr("采集接口已切换,请刷新并重新选择设备和格式"),true);return false;
- }
- if(device<0){emit notice(tr("请先选择采集设备和格式"),true);return false;}
- if(!format){emit notice(i.captureFormatKey.empty()&&i.capturePrefs.formatKey.empty()?tr("请先选择分辨率和像素格式"):tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。"),true);return false;}
- if(!format->supported){emit notice(tr("设备提供此格式,但当前播放器不支持其尺寸或像素布局,请选择其他格式"),true);return false;}
- if(i.captureAudioMissing){emit notice(tr("上次的音频输入未连接,请插回设备或重新选择音频监听"),true);return false;}
- const int audio = i.captureAudioChoice;
- const source::CaptureDevice* audioDevice = audio >= 0 && size_t(audio) < i.captureAudio.size() ? &i.captureAudio[size_t(audio)] : nullptr;
- const auto path = source::CaptureCardSource::makeCapturePath(unsigned(device), i.captureVideo[size_t(device)], format->index, audio,
- audioDevice, i.captureColor, i.captureFps, format->key);
- if (path.empty()) { emit notice(tr("无法生成采集连接参数"), true); return false; }
- if(!i.persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
- i.facade.noteCaptureSession({i.captureDevice, format->key, i.facade.presets().entries().empty() ? std::wstring{} : wideOf(currentPresetName()),
- i.captureFps > 0 ? i.captureFps : format->fps, true});
- veyra::log::info("capture-ui", std::format("connect format={} audio={} color={} fps={}", QString::fromStdWString(format->label).toStdString(), audio, i.captureColor, i.captureFps));
- i.prefs["captureDeviceName"] = utf8Of(i.captureVideo[size_t(device)].name);
- if(captureBlackmagicDevice())i.prefs[source::decklink::isPath(i.captureDevice)?"blackmagicNativeLastDevice":"blackmagicDirectShowLastDevice"]=utf8Of(i.captureDevice);
- rememberSource(QStringLiteral("capture"), utf8Of(i.captureVideo[size_t(device)].name));
- i.prefs["captureFormatLabel"] = utf8Of(format->label);
- i.savePrefs();
- // Started beside the capture open, not after it. A running PS5 stream still
- // holds the console's slot until the capture replaces it; the tick starts
- // PS5 手柄控制 once the capture card is live instead.
- if (i.prefBool("ps5CaptureControl", false) && !i.snapshot.remotePlay) startPs5Control(false);
- openSourceUri(path, i.captureVideo[size_t(device)].name);
- emit snapshotChanged();
- return true;
-}
-void QmlPlayerBridge::openSourceUri(const std::wstring& uri, const std::wstring& label, bool screenFill) {
- rememberPosition(true);
- impl_->openingSource = true;
- impl_->openingSessionId = 0;
- impl_->sourceLabel = label;
- impl_->resumeSession = 0;
- impl_->screenFillActive = screenFill;
- // Honor the dialog's initial viewport before input can be taken over.
- // Later explicit aspect choices still replace this session preset.
- if (!impl_->gameModeUri.empty() && uri == impl_->gameModeUri) impl_->aspectMode = 0;
- const bool screen = uri.find(L"screen") != std::wstring::npos;
- veyra::log::info("capture-ui", "open uri " + QString::fromStdWString(uri).toStdString());
- openAfterCinema(screen ? tr("正在开始屏幕捕获…") : tr("正在打开采集设备 · %1").arg(utf8Of(label)), [this, uri] {
- if (impl_->preOpen) impl_->preOpen();
- impl_->engine.previewView({});
- impl_->engine.open(impl_->videoWindow, uri, impl_->options);
- impl_->openingSessionId = impl_->engine.snapshot().sessionId;
- // Only the exact capture startScreenCapture opened in 游戏模式 is one.
- impl_->gameModeSessionId = !impl_->gameModeUri.empty() && uri == impl_->gameModeUri ? impl_->openingSessionId : 0;
- impl_->gameModeLive = false;
- impl_->gameModeUri.clear();
- updateGameMode();
- refreshSubtitles({});
- });
-}
-
-void QmlPlayerBridge::openAfterCinema(const QString& pending, std::function<void()> open) {
- const int gen = ++impl_->liveOpenGen;
- const bool fromHome = impl_->currentPage.isEmpty() || impl_->currentPage == QLatin1String("home");
- if (!fromHome || !impl_->gameModeUri.empty()) {
- // Game mode does not wait for the cinema animation or feature startup.
- if (fromHome) emit navigate(QStringLiteral("min"));
- impl_->pendingLiveText.clear(); open(); return;
- }
- // User report 2026-09-29: the window blacked out and jumped into 极简 when
- // the engine opened in the same instant as the page switch and the window's
- // height spring. Switch first, say that it is connecting, then open once
- // the page (.22s out + 150 ms + rise) and the .7s height spring have settled.
- emit navigate(QStringLiteral("min"));
- impl_->pendingLiveText = pending;
- emit snapshotChanged();
- const int delay = reducedMotion() ? 0 : 820;
- veyra::log::info("ui-live-open", std::format("deferred ms={} gen={}", delay, gen));
- QTimer::singleShot(delay, this, [this, gen, open = std::move(open)] {
- if (gen != impl_->liveOpenGen) { veyra::log::info("ui-live-open", std::format("superseded gen={}", gen)); return; }
- impl_->pendingLiveText.clear();
- veyra::log::info("ui-live-open", std::format("open gen={}", gen));
- open();
- emit snapshotChanged();
- });
-}
-
-// Force-SDR and vertical flip are real settings the engine already carries, so
-// these are genuine controls rather than placeholders.
-bool QmlPlayerBridge::captureForceSdr() const { return settings().forceSdrPreview; }
-void QmlPlayerBridge::setCaptureForceSdr(bool value) {
- auto s = settings();
- if (s.forceSdrPreview == value) return;
- s.forceSdrPreview = value;
- if(impl_->commit(std::move(s))){impl_->prefs["captureForceSdr"]=value;if(!impl_->savePrefs())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);}
- emit settingsChanged();
-}
-bool QmlPlayerBridge::captureFlipVertical() const { return settings().captureFlipVertical; }
-void QmlPlayerBridge::setCaptureFlipVertical(bool value) {
- auto s = settings();
- if (s.captureFlipVertical == value) return;
- s.captureFlipVertical = value;
- if(impl_->commit(std::move(s))){impl_->prefs["captureFlipVertical"]=value;if(!impl_->savePrefs())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);}
- emit settingsChanged();
-}
-
-// --- screen capture ----------------------------------------------------------
-QVariantList QmlPlayerBridge::screenTargets() const {
- // Enumerated from the source for the chosen kind; cached until refreshed so a
- // binding re-evaluation does not walk every window again.
- QVariantList out;
- for (const auto& target : impl_->screenList) {
- QVariantMap item;
- item["id"] = QString::number(target.handle);
- QString label = QString::fromWCharArray(target.name.c_str());
- if (target.width > 0)
- label += QStringLiteral(" · %1x%2").arg(target.width).arg(target.height);
- if (target.refresh > 0) label += QStringLiteral(" · %1Hz").arg(target.refresh);
- item["label"] = label;
- item["width"] = int(target.width);
- item["height"] = int(target.height);
- out << item;
- }
- return out;
-}
-QVariantMap QmlPlayerBridge::screenOptions() const {
- QVariantMap d{{"kind", 0}, {"method", 0}, {"fps", 0}, {"cursor", true}, {"fill", false},
- {"left", 0}, {"top", 0}, {"right", 0}, {"bottom", 0}, {"passthrough", false}};
- const auto saved = impl_->prefs.value("screen").toMap();
- for (auto it = saved.begin(); it != saved.end(); ++it) if (d.contains(it.key())) d[it.key()] = it.value();
- if (d.value("kind").toInt() == 0) d["method"] = 0; // DXGI is monitors only
- if (d.value("method").toInt() == 1) d["cursor"] = false; // and has no pointer
- return d;
-}
-bool QmlPlayerBridge::setScreenOption(const QString& key, const QVariant& value) {
- static const QHash<QString, std::pair<int, int>> ranges{{"kind", {0, 1}}, {"method", {0, 1}}, {"fps", {0, 5}},
- {"left", {0, 16384}}, {"top", {0, 16384}}, {"right", {0, 16384}}, {"bottom", {0, 16384}}};
- auto saved = impl_->prefs.value("screen").toMap();
- if (ranges.contains(key)) {
- bool ok = false; const int n = value.toInt(&ok);
- const auto [low, high] = ranges.value(key);
- if (!ok || n < low || n > high) { emit notice(tr("数值超出范围"), true); return false; }
- saved[key] = n;
- } else if (key == QLatin1String("cursor") || key == QLatin1String("fill") || key == QLatin1String("passthrough")) {
- saved[key] = value.toBool();
- } else return false;
- impl_->prefs["screen"] = saved;
- impl_->savePrefs();
- if (key == QLatin1String("kind")) { impl_->screenTarget.clear(); refreshCaptureTargets(); }
- emit captureChanged();
- return true;
-}
-bool QmlPlayerBridge::startScreenCapture() {
- const auto o = screenOptions();
- source::ScreenCaptureOptions value;
- bool found = false;
- for (const auto& t : impl_->screenList)
- if (QString::number(t.handle) == impl_->screenTarget) { value.kind = t.kind; value.target = t.handle; found = true; }
- if (!found) { emit notice(tr("先选择一个捕获目标"), true); return false; }
- constexpr unsigned rates[] = {0, 30, 60, 120, 144, 240};
- value.method = source::ScreenCaptureMethod(o.value("method").toInt());
- value.fps = rates[std::clamp(o.value("fps").toInt(), 0, 5)];
- value.cursor = o.value("cursor").toBool();
- value.left = o.value("left").toUInt(); value.top = o.value("top").toUInt();
- value.right = o.value("right").toUInt(); value.bottom = o.value("bottom").toUInt();
- // 游戏模式: the real pointer is drawn on top, so the picture carries none (a
- // second, late pointer otherwise), the picture must match the screen 1:1 for
- // clicks to land where they are seen (no crop), and the yellow border goes.
- const bool game = o.value("passthrough").toBool();
- if (game) {
- value.cursor = false; value.borderless = true;
- value.left = value.top = value.right = value.bottom = 0;
- const HWND window = value.kind == source::ScreenTargetKind::Window ? reinterpret_cast<HWND>(value.target) : nullptr;
- impl_->gameMonitor = window ? MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST) : reinterpret_cast<HMONITOR>(value.target);
- impl_->game.setTarget(window, impl_->gameMonitor, !window);
- impl_->gameModeUri = value.uri();
- // Exclusive fullscreen still cannot be covered by another process.
- QUERY_USER_NOTIFICATION_STATE state{};
- if (SUCCEEDED(SHQueryUserNotificationState(&state)) && state == QUNS_RUNNING_D3D_FULL_SCREEN)
- emit notice(tr("检测到独占全屏的游戏:Windows 不允许其它窗口盖在它上面,请把游戏改成无边框窗口或窗口化"), true);
- } else impl_->gameModeUri.clear();
- veyra::log::info("screen-ui", std::format("start kind={} method={} fps={} cursor={} crop={},{},{},{} fill={} gameMode={}", int(value.kind), int(value.method),
- value.fps, value.cursor, value.left, value.top, value.right, value.bottom, o.value("fill").toBool(), game));
- openSourceUri(value.uri(), wideOf(screenTargetLabel()), o.value("fill").toBool());
- impl_->screenFitClient = impl_->screenFitImage = QSize();
- if (gameMode()) { updateGameGeometry(); updateGameMode(); emit gameModeChanged(); }
- emit compareChanged();
- rememberSource(QStringLiteral("screen"), screenTargetLabel());
- return true;
-}
-bool QmlPlayerBridge::gameMode() const { return impl_->gameModeSessionId != 0; }
-bool QmlPlayerBridge::passthroughActive() const { return impl_->passthroughShown; }
-bool QmlPlayerBridge::gameInputActive() const { return impl_->gameInputShown; }
-bool QmlPlayerBridge::gameScaledPreview() const {
- return gameMode() && (ui::gameViewportScaled(impl_->screenFillActive, impl_->aspectMode) || previewRotation()!=0);
-}
-QRectF QmlPlayerBridge::gameVideoRect() const { return impl_->gameVideoRect; }
-void QmlPlayerBridge::attachMainWindow(qulonglong nativeHandle) {
- impl_->game.attach(reinterpret_cast<HWND>(nativeHandle));
- for (auto* window:QGuiApplication::allWindows())
- if (qulonglong(window->winId())==nativeHandle) { impl_->gameWindow=window; break; }
-}
-void QmlPlayerBridge::updateGameGeometry() {
- if (!gameMode() || !impl_->presentation.fullscreen || !impl_->gameWindow) return;
- RECT r=impl_->game.pictureBounds();
- if (gameScaledPreview()) {
- const HWND main = reinterpret_cast<HWND>(impl_->gameWindow->winId());
- POINT origin{};
- MONITORINFO info{sizeof(info)};
- if (!GetMonitorInfoW(impl_->gameMonitor, &info) || !ClientToScreen(main, &origin)) return;
- r=info.rcMonitor; OffsetRect(&r,-origin.x,-origin.y);
- }
- const qreal scale=impl_->gameWindow->devicePixelRatio();
- if (scale<=0) return;
- const QRectF rect(r.left/scale,r.top/scale,(r.right-r.left)/scale,(r.bottom-r.top)/scale);
- if (!rect.isEmpty() && rect!=impl_->gameVideoRect) {
- impl_->gameVideoRect=rect; emit gameModeChanged();
- }
-}
-void QmlPlayerBridge::setGamePanelOpen(bool open) {
- if (impl_->gamePanelOpen == open) return;
- impl_->gamePanelOpen = open;
- updateGameMode();
-}
-int QmlPlayerBridge::gameModeScreenIndex() const {
- if (!impl_->gameMonitor) return -1;
- const auto screens = QGuiApplication::screens();
- for (int i = 0; i < screens.size(); ++i) {
- const auto* native = screens[i]->nativeInterface<QNativeInterface::QWindowsScreen>();
- if (native && native->handle() == impl_->gameMonitor) return i;
- }
- return -1;
-}
-void QmlPlayerBridge::testBlockUi(int ms) {
- if (GetEnvironmentVariableW(L"VEYRA_TEST_UI_BLOCK", nullptr, 0) == 0) return;
- veyra::log::warn("game-mode", std::format("test: GUI thread blocked for {} ms", ms));
- Sleep(DWORD(std::clamp(ms, 0, 20000)));
-}
-// 游戏模式 state: click-through while the game-mode capture is live and the picture
-// is fullscreen, the panel while the Home panel is open, otherwise a normal window.
-void QmlPlayerBridge::updateGameMode() {
- using Mode = ui::GamePassthrough::Mode;
- auto& i = *impl_;
- const auto& s = i.snapshot;
- if (i.gameModeSessionId) {
- const bool same = s.sessionId == i.gameModeSessionId;
- if (same && s.running && !s.failed) i.gameModeLive = true;
- const bool ended = (same && (s.failed || s.transport == engine::TransportState::Stopping ||
- s.transport == engine::TransportState::Empty || (i.gameModeLive && !s.running))) || s.sessionId > i.gameModeSessionId;
- if (ended) {
- const bool shown = i.game.mode() != Mode::Off;
- veyra::log::info("game-mode", std::format("capture session {} ended failed={} pictureInFront={}", i.gameModeSessionId, s.failed, shown));
- i.gameModeSessionId = 0; i.gameModeLive = false;
- if (shown) {
- i.gameInputShown = i.passthroughShown = false;
- emit gameModeChanged();
- i.game.apply(Mode::Off);
- const QString why = s.failed ? uiText(s.status) : QString();
- emit gameModeStopped(why.isEmpty() ? tr("捕获已结束,已退出游戏模式") : why);
- }
- }
- }
- if (!i.presentation.fullscreen) i.gameRefused = false;
- Mode want = ui::gameInputMode(i.gameModeSessionId != 0, i.presentation.fullscreen,
- i.gameRefused, i.gamePanelOpen, gameScaledPreview());
- if (want!=Mode::Off && i.gameVideoRect.isEmpty()) updateGameGeometry();
- // A listener failure holds until fullscreen is left.
- if (want != Mode::Off && i.game.mode() == Mode::Off && !i.game.arm()) { i.gameRefused = true; want = Mode::Off; }
- if (want != i.game.mode()) {
- // QML binds the window's click-through flags to passthroughActive: publish
- // first, so Qt has changed the window before the foreground moves.
- const bool through = want == Mode::Through;
- const bool input = through || want == Mode::Scaled;
- if (through != i.passthroughShown || input != i.gameInputShown) {
- i.passthroughShown = through; i.gameInputShown = input; emit gameModeChanged();
- }
- if (want == Mode::Scaled && i.game.mode() != Mode::Panel)
- emit notice(tr("全屏缩放已启用:键盘和手柄控制源窗口,鼠标点击已拦截以免错位;需要鼠标穿透时切回贴合原窗口"), false);
- i.game.apply(want);
- }
- const bool mode = i.gameModeSessionId != 0;
- if ((!mode || !i.presentation.fullscreen) && !i.gameVideoRect.isEmpty()) {
- i.gameVideoRect={}; emit gameModeChanged();
- }
- if (mode != i.gameModeShown) { i.gameModeShown = mode; emit gameModeChanged(); }
-}
-QString QmlPlayerBridge::screenTargetId() const { return impl_->screenTarget; }
-void QmlPlayerBridge::setScreenTargetId(const QString& value) {
- impl_->screenTarget = value;
- emit captureChanged();
-}
-QString QmlPlayerBridge::screenTargetLabel() const {
- const QString id = screenTargetId();
- if (id.isEmpty()) return tr("未选择目标");
- for (const auto& item : screenTargets()) {
- if (item.toMap().value(QStringLiteral("id")).toString() == id)
- return item.toMap().value(QStringLiteral("label")).toString();
- }
- return tr("目标已失效");
-}
-void QmlPlayerBridge::refreshCaptureTargets() {
- const int kind = screenOptions().value("kind").toInt();
- impl_->screenList = source::ScreenCaptureSource::targets(kind == 1 ? source::ScreenTargetKind::Monitor : source::ScreenTargetKind::Window);
- bool stillThere = false;
- for (const auto& t : impl_->screenList) stillThere = stillThere || QString::number(t.handle) == impl_->screenTarget;
- if (!stillThere) impl_->screenTarget = impl_->screenList.empty() ? QString() : QString::number(impl_->screenList.front().handle);
- emit captureChanged();
-}
-
-// --- PS5 Remote Play (P4-e) ---------------------------------------------------
-namespace {
-constexpr uint32_t kPs5Bitrates[] = {5000, 10000, 15000, 20000, 30000, 50000, 80000, 100000};
-#ifdef VEYRA_ENABLE_REMOTEPLAY
-std::filesystem::path ps5Settings() { return remoteplay::profileDirectory() / L"settings.ini"; }
-#endif
-}
-QVariantMap QmlPlayerBridge::ps5() const {
- QVariantMap out = impl_->ps5Form;
- out["status"] = impl_->ps5Status;
- out["busy"] = impl_->ps5Busy;
- out["profile"] = QString::fromStdWString(impl_->ps5Profile);
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- out["available"] = true;
- out["psnReady"] = remoteplay::loadPsnAuthorization().has_value();
- const auto& s = impl_->snapshot;
- out["active"] = s.remotePlay && (s.running || s.transport == engine::TransportState::Opening || s.transport == engine::TransportState::Stopping);
- const auto c = impl_->controller.capabilities();
- out["controller"] = c.connected;
- out["gyro"] = c.gyro && c.accel;
- out["calibrating"] = c.calibrating;
-#else
- out["available"] = false;
-#endif
- return out;
-}
-QVariantList QmlPlayerBridge::ps5Profiles() const { return impl_->ps5ProfileList; }
-
-// --- PC streaming (Moonlight / Sunshine) -----------------------------------------------------------
-QObject* QmlPlayerBridge::moonlightModel() const {
-#ifdef VEYRA_ENABLE_MOONLIGHT
- return impl_->moonlight.get();
-#else
- return nullptr;
-#endif
-}
-bool QmlPlayerBridge::moonlightCaptured() const {
-#ifdef VEYRA_ENABLE_MOONLIGHT
- return impl_->moonlightCapture && impl_->moonlightCapture->captured();
-#else
- return false;
-#endif
-}
-bool QmlPlayerBridge::moonlightStatsVisible() const {
-#ifdef VEYRA_ENABLE_MOONLIGHT
- return impl_->moonlightStatsVisible;
-#else
- return false;
-#endif
-}
-void QmlPlayerBridge::setMoonlightStatsVisible(bool visible) {
-#ifdef VEYRA_ENABLE_MOONLIGHT
- if (impl_->moonlightStatsVisible == visible) return;
- impl_->moonlightStatsVisible = visible;
- emit moonlightUiChanged();
-#else
- (void)visible;
-#endif
-}
-void QmlPlayerBridge::openMoonlightDialog() { emit navigate(QStringLiteral("moonlight")); }
-
-// --- Xbox home streaming (unofficial) ------------------------------------------------------------------
-QObject* QmlPlayerBridge::xboxModel() const {
-#ifdef VEYRA_ENABLE_XBOX
- return impl_->xbox.get();
-#else
- return nullptr;
-#endif
-}
-void QmlPlayerBridge::openXboxDialog() { emit navigate(QStringLiteral("xbox")); }
-void QmlPlayerBridge::xboxDisconnect() {
-#ifdef VEYRA_ENABLE_XBOX
- if (impl_->snapshot.xboxActive) stopPlayback();
-#endif
-}
-
-#ifdef VEYRA_ENABLE_XBOX
-void QmlPlayerBridge::setupXbox() {
- auto& i = *impl_;
- i.xbox = std::make_unique<ui::XboxModel>();
- connect(i.xbox.get(), &ui::XboxModel::notice, this, &QmlPlayerBridge::notice);
- i.xbox->setLaunchHandler([this](ui::XboxModel::Launch launch) -> bool {
- auto& j = *impl_;
- if (!j.videoWindow) return false;
- rememberPosition(true);
- j.openingSource = true;
- j.openingSessionId = 0;
- j.sourceLabel = L"Xbox · " + launch.label.toStdWString();
- j.resumeSession = 0;
- j.screenFillActive = false;
- const bool pad = launch.desc.gamepad;
- const QString label = launch.label;
- auto request = std::make_shared<source::XboxConnectDesc>(std::move(launch.desc));
- openAfterCinema(tr("正在连接 Xbox · %1").arg(label), [this, request, pad] {
- auto& k = *impl_;
- if (k.preOpen) k.preOpen();
- k.engine.previewView({});
- k.engine.openXbox(k.videoWindow, std::move(*request), k.options);
- k.openingSessionId = k.engine.snapshot().sessionId;
- refreshSubtitles({});
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- // The pad is polled on the UI thread at 250 Hz; the session sends changes and a 33 ms heartbeat.
- if (pad) {
- if (!k.acquirePad(Impl::PadXbox)) veyra::log::warn("xbox-input", "SDL gamepad initialization failed");
- if (!k.xboxTimer) {
- k.xboxTimer = new QTimer(this);
- k.xboxTimer->setTimerType(Qt::PreciseTimer);
- connect(k.xboxTimer, &QTimer::timeout, this, [this] {
- auto& m = *impl_;
- if (!m.snapshot.xboxActive) { m.releasePad(Impl::PadXbox); m.xboxTimer->stop(); return; }
- const bool focused = QGuiApplication::focusWindow() != nullptr;
- m.engine.xboxController(m.controller.poll(focused));
- m.controller.feedback(m.engine.xboxFeedback(), focused);
- });
- }
- k.xboxTimer->start(4);
- } else {
- if (k.xboxTimer) k.xboxTimer->stop();
- k.releasePad(Impl::PadXbox);
- }
-#else
- (void)pad;
-#endif
- });
- rememberSource(QStringLiteral("xbox"), label);
- return true;
- });
-}
-
-void QmlPlayerBridge::tickXbox() {
- auto& i = *impl_;
- if (!i.xbox) return;
- const auto& s = i.snapshot;
- const bool active = s.xboxActive;
- if (active != i.xboxWasActive) {
- i.xboxWasActive = active;
- i.xbox->updateStream(active, s.xbox);
- } else if (active && ++i.xboxStatsTicks >= 15) {
- i.xboxStatsTicks = 0;
- i.xbox->updateStream(true, s.xbox);
- }
-}
-#else
-void QmlPlayerBridge::tickXbox() {}
-#endif
-
-void QmlPlayerBridge::moonlightCapture(bool on) {
-#ifdef VEYRA_ENABLE_MOONLIGHT
- auto& i = *impl_;
- if (!i.moonlightCapture) return;
- if (!on) {
- i.moonlightWantCapture = false;
- i.moonlightCapture->capture(false);
- return;
- }
- if (!i.snapshot.moonlightActive || !i.videoWindow) return;
- i.moonlightCapture->setWindow(GetAncestor(i.videoWindow, GA_ROOT));
- // The tick keeps trying until the window is in the foreground (right after connecting it may not be yet).
- i.moonlightWantCapture = !i.moonlightCapture->capture(true);
-#else
- (void)on;
-#endif
-}
-
-void QmlPlayerBridge::moonlightDisconnect() {
-#ifdef VEYRA_ENABLE_MOONLIGHT
- moonlightCapture(false);
- if (impl_->snapshot.moonlightActive) stopPlayback();
-#endif
-}
-
-#ifdef VEYRA_ENABLE_MOONLIGHT
-void QmlPlayerBridge::setupMoonlight() {
- auto& i = *impl_;
- i.moonlight = std::make_unique<ui::MoonlightModel>();
- i.moonlightCapture = std::make_unique<ui::MoonlightInputCapture>(i.engine);
- connect(i.moonlightCapture.get(), &ui::MoonlightInputCapture::capturedChanged, this, [this](bool) { emit moonlightUiChanged(); });
- connect(i.moonlightCapture.get(), &ui::MoonlightInputCapture::releaseRequested, this, [this] {
- impl_->moonlightWantCapture = false;
- emit notice(tr("已释放键盘和鼠标(点击画面重新捕获)"), false);
- });
- connect(i.moonlightCapture.get(), &ui::MoonlightInputCapture::quitRequested, this, [this] { moonlightDisconnect(); });
- connect(i.moonlightCapture.get(), &ui::MoonlightInputCapture::statsRequested, this, [this] { setMoonlightStatsVisible(!moonlightStatsVisible()); });
- connect(i.moonlight.get(), &ui::MoonlightModel::notice, this, &QmlPlayerBridge::notice);
- i.moonlight->setLaunchHandler([this](ui::MoonlightModel::Launch launch) -> bool {
- auto& j = *impl_;
- if (!j.videoWindow) return false;
- rememberPosition(true);
- j.openingSource = true;
- j.openingSessionId = 0;
- j.sourceLabel = L"PC · " + launch.label.toStdWString();
- j.resumeSession = 0;
- j.screenFillActive = false;
- const bool pad = (launch.desc.options.gamepadMask & 1) != 0;
- j.moonlightWantCapture = launch.captureInput;
- const QString label = launch.label;
- auto request = std::make_shared<source::MoonlightConnectDesc>(std::move(launch.desc));
- openAfterCinema(tr("正在连接 %1").arg(label), [this, request, pad] {
- auto& k = *impl_;
- if (k.preOpen) k.preOpen();
- k.engine.previewView({});
- k.engine.openMoonlight(k.videoWindow, std::move(*request), k.options);
- k.openingSessionId = k.engine.snapshot().sessionId;
- refreshSubtitles({});
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- // The pad is polled on the UI thread at 250 Hz and sent only when it changes.
- if (pad) {
- if (!k.acquirePad(Impl::PadMoonlight)) veyra::log::warn("moonlight-input", "SDL gamepad initialization failed");
- if (!k.moonlightTimer) {
- k.moonlightTimer = new QTimer(this);
- k.moonlightTimer->setTimerType(Qt::PreciseTimer);
- connect(k.moonlightTimer, &QTimer::timeout, this, [this] {
- auto& m = *impl_;
- if (!m.snapshot.moonlightActive) { m.releasePad(Impl::PadMoonlight); m.moonlightTimer->stop(); return; }
- const bool focused = QGuiApplication::focusWindow() != nullptr;
- m.engine.moonlightController(m.controller.poll(focused));
- m.controller.feedback(m.engine.moonlightFeedback(), focused);
- });
- }
- k.moonlightTimer->start(4);
- } else {
- if (k.moonlightTimer) k.moonlightTimer->stop();
- k.releasePad(Impl::PadMoonlight);
- }
-#else
- (void)pad;
-#endif
- });
- rememberSource(QStringLiteral("moonlight"), label);
- return true;
- });
-}
-
-void QmlPlayerBridge::tickMoonlight() {
- auto& i = *impl_;
- if (!i.moonlight) return;
- const auto& s = i.snapshot;
- const bool active = s.moonlightActive;
- if (active != i.moonlightWasActive) {
- i.moonlightWasActive = active;
- if (!active) {
- i.moonlightWantCapture = false;
- if (i.moonlightCapture) i.moonlightCapture->capture(false);
- }
- i.moonlight->updateStream(active, s.moonlight);
- } else if (active && ++i.moonlightStatsTicks >= 15) {
- i.moonlightStatsTicks = 0;
- i.moonlight->updateStream(true, s.moonlight);
- }
- // Take the keyboard and mouse as soon as the picture is up (and again when the window comes to the front).
- if (active && i.moonlightWantCapture && s.moonlight.state == source::MoonlightStats::State::Streaming) moonlightCapture(true);
-}
-#else
-void QmlPlayerBridge::tickMoonlight() {}
-#endif
-void QmlPlayerBridge::ps5Load() {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- auto& i = *impl_;
- try {
- const auto directory = remoteplay::profileDirectory();
- if (i.ps5Profile.empty()) {
- wchar_t last[80]{};
- GetPrivateProfileStringW(L"RemotePlay", L"LastProfile", L"", last, 80, ps5Settings().c_str());
- const std::wstring name = last;
- if (!name.empty() && name.find_first_of(L"/\\:") == std::wstring::npos) i.ps5Profile = name;
- }
- i.ps5ProfileList.clear();
- unsigned failures = 0;
- auto add = [&](const std::filesystem::path& path) {
- remoteplay::ProfileLoadError error{};
- auto saved = remoteplay::loadProfile(path, &error);
- if (saved) i.ps5ProfileList << QVariantMap{{"id", QString::fromStdWString(path.filename().wstring())},
- {"label", QString::fromStdString(saved->host)}};
- else if (error != remoteplay::ProfileLoadError::Missing) ++failures;
- };
- add(directory / "remoteplay-profile.dat");
- std::error_code ec; size_t scanned = 0;
- for (std::filesystem::directory_iterator it(directory, ec), end; !ec && it != end && i.ps5ProfileList.size() < 64 && scanned < 256; it.increment(ec), ++scanned) {
- const auto id = it->path().stem().wstring();
- if (it->path().extension() == ".dat" && id.size() == 32 &&
- std::all_of(id.begin(), id.end(), [](wchar_t c) { return (c >= L'0' && c <= L'9') || (c >= L'a' && c <= L'f'); }))
- add(it->path());
- }
- // A pairing made or found in the PS5 dialog lets a waiting PS5 手柄控制 start.
- if (!i.ps5ProfileList.isEmpty()) i.ps5ControlNoPair = false;
- bool known = false;
- for (const auto& p : i.ps5ProfileList) known = known || p.toMap().value("id").toString() == QString::fromStdWString(i.ps5Profile);
- if (!known) i.ps5Profile = i.ps5ProfileList.isEmpty() ? std::wstring{} : i.ps5ProfileList.front().toMap().value("id").toString().toStdWString();
- // Form defaults, then the selected pairing's own values.
- i.ps5Form = QVariantMap{{"host", QString()}, {"account", QString()}, {"quality", 3}, {"codec", 0}, {"bitrate", 2}, {"viewOnly", false},
- {"decode", int(std::min(2u, GetPrivateProfileIntW(L"RemotePlay", L"DecodeMode", 0, ps5Settings().c_str())))},
- {"sampling", int(std::min(1u, GetPrivateProfileIntW(L"RemotePlay", L"FineSampling", 1, ps5Settings().c_str())))}};
- if (!i.ps5Profile.empty())
- if (auto saved = remoteplay::loadProfile(directory / i.ps5Profile)) {
- i.ps5Form["host"] = QString::fromStdString(saved->host);
- i.ps5Form["account"] = QString::fromStdString(remoteplay::accountIdToBase64(saved->credentials.accountId));
- i.ps5Form["quality"] = (saved->video.height == 1080 ? 2 : 0) + (saved->video.fps == 60 ? 1 : 0);
- i.ps5Form["codec"] = int(saved->video.codec);
- const auto found = std::find(std::begin(kPs5Bitrates), std::end(kPs5Bitrates), saved->video.bitrateKbps);
- i.ps5Form["bitrate"] = found == std::end(kPs5Bitrates) ? 2 : int(found - std::begin(kPs5Bitrates));
- i.ps5Form["viewOnly"] = saved->viewOnly;
- }
- if (i.ps5Status.isEmpty())
- i.ps5Status = failures ? tr("有配对存档无法读取或解密,详情见日志。请使用原 Windows 账户;不要删除原件。")
- : !i.ps5Profile.empty() ? tr("已加载保存的主机,直接点“连接”,无需重新填写 8 位配对码。")
- : tr("首次使用:PS5 设置 → 系统 → 远程游玩 → 关联设备,填写账号 ID 与 8 位配对码后配对。");
- veyra::log::info("remoteplay-ui", std::format("profiles={} readFailures={}", i.ps5ProfileList.size(), failures));
- } catch (...) {
- impl_->ps5Status = tr("无法读取远程游玩目录;原有配对文件不会被改动。");
- }
-#else
- impl_->ps5Status = tr("此版本未包含 PS5 远程游玩组件。");
-#endif
- emit ps5Changed();
-}
-bool QmlPlayerBridge::ps5Set(const QString& key, const QVariant& value) {
- static const QHash<QString, std::pair<int, int>> ranges{{"quality", {0, 3}}, {"codec", {0, 2}}, {"bitrate", {0, 7}}, {"decode", {0, 2}}, {"sampling", {0, 1}}};
- if (ranges.contains(key)) {
- bool ok = false; const int n = value.toInt(&ok); const auto [low, high] = ranges.value(key);
- if (!ok || n < low || n > high) return false;
- impl_->ps5Form[key] = n;
- } else if (key == QLatin1String("viewOnly")) impl_->ps5Form[key] = value.toBool();
- else if (key == QLatin1String("host") || key == QLatin1String("account")) impl_->ps5Form[key] = value.toString().trimmed();
- else return false;
- emit ps5Changed();
- return true;
-}
-void QmlPlayerBridge::ps5SelectProfile(const QString& id) {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- if (impl_->ps5Busy) return;
- impl_->ps5Profile = id.toStdWString();
- WritePrivateProfileStringW(L"RemotePlay", L"LastProfile", impl_->ps5Profile.c_str(), ps5Settings().c_str());
- impl_->ps5Status.clear();
- ps5Load();
- if (impl_->engine.remoteControlRequested()) startPs5Control(true);
-#else
- Q_UNUSED(id);
-#endif
-}
-#ifdef VEYRA_ENABLE_REMOTEPLAY
-namespace {
-remoteplay::VideoProfile ps5Video(const QVariantMap& f) {
- remoteplay::VideoProfile p; const int q = f.value("quality").toInt();
- p.width = q < 2 ? 1280 : 1920; p.height = q < 2 ? 720 : 1080; p.fps = (q == 0 || q == 2) ? 30 : 60;
- p.codec = static_cast<remoteplay::Codec>(std::clamp(f.value("codec").toInt(), 0, 2));
- p.bitrateKbps = kPs5Bitrates[std::clamp(f.value("bitrate").toInt(), 0, 7)];
- return p;
-}
-std::string asciiOnly(const QString& s) {
- std::string out;
- for (const QChar c : s) { if (c.unicode() > 127) return {}; out.push_back(char(c.unicode())); }
- return out;
-}
-}
-#endif
-// One worker at a time, as the 1.4.4 panel; results are picked up in tickPs5().
-#define VEYRA_PS5_LAUNCH(body) \
- do { if (impl_->ps5Busy) return; if (impl_->ps5Worker.joinable()) impl_->ps5Worker.join(); \
- impl_->ps5Busy = true; impl_->ps5Done = false; impl_->ps5Status = tr("正在处理…可随时取消"); emit ps5Changed(); \
- impl_->ps5Worker = std::jthread([this, fn = std::move(body)](std::stop_token stop) mutable { \
- Impl::Ps5Outcome result; \
- try { result = fn(stop); } catch (...) { result.message = L"操作失败;请检查网络、输入和可用磁盘空间。"; } \
- { std::lock_guard lock(impl_->ps5Mutex); impl_->ps5Outcome = std::move(result); } impl_->ps5Done = true; }); } while (0)
-void QmlPlayerBridge::ps5Scan() {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- auto work = [](std::stop_token stop) {
- Impl::Ps5Outcome out; auto report = remoteplay::discoverLocalPs5(stop);
- for (const auto& line : report.diagnostics) veyra::log::info("remoteplay-discovery", line);
- for (auto& h : report.hosts) {
- std::string id = h.consoleId;
- std::transform(id.begin(), id.end(), id.begin(), [](unsigned char c) { return char(std::tolower(c)); });
- out.hosts.push_back({h.host, id});
- }
- out.message = stop.stop_requested() ? L"已取消查找" : out.hosts.empty()
- ? (report.error ? std::format(L"主机搜索发生错误({}),详情见日志;可手填 IP。", report.error) : L"搜索完成,未发现 PS5;确认同一局域网,或手动填写 IP。")
- : std::format(L"发现 {} 台 PS5。", out.hosts.size());
- return out;
- };
- VEYRA_PS5_LAUNCH(work);
-#endif
-}
-void QmlPlayerBridge::ps5Pair(const QString& pinText) {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- auto host = asciiOnly(impl_->ps5Form.value("host").toString()), id = asciiOnly(impl_->ps5Form.value("account").toString()), pin = asciiOnly(pinText);
- auto account = remoteplay::accountIdFromBase64(id); if (!account) account = remoteplay::accountIdFromDecimal(id);
- if (!remoteplay::validHost(host) || !account || !remoteplay::parsePairingPin(pin)) {
- impl_->ps5Status = tr("请填写有效主机地址、Account ID 和 8 位配对码。"); emit ps5Changed(); return;
- }
- // Same host + account reuses its file; otherwise a fresh random name.
- std::filesystem::path target;
- for (const auto& p : impl_->ps5ProfileList) {
- const auto path = remoteplay::profileDirectory() / p.toMap().value("id").toString().toStdWString();
- if (auto saved = remoteplay::loadProfile(path); saved && saved->host == host && saved->credentials.accountId == *account) target = path;
- }
- if (target.empty()) {
- GUID guid{}; if (FAILED(CoCreateGuid(&guid))) { impl_->ps5Status = tr("无法分配配对存档,请重试。"); emit ps5Changed(); return; }
- std::string name; const auto* bytes = reinterpret_cast<const unsigned char*>(&guid);
- for (size_t k = 0; k < sizeof(guid); ++k) name += std::format("{:02x}", bytes[k]);
- target = remoteplay::profileDirectory() / (name + ".dat");
- }
- const auto format = ps5Video(impl_->ps5Form);
- auto work = [host = std::move(host), account = *account, pin = std::move(pin), format, target](std::stop_token stop) mutable {
- auto result = remoteplay::pairLocalPs5(host, account, pin, stop); SecureZeroMemory(pin.data(), pin.size());
- Impl::Ps5Outcome out;
- if (result.result.ok && !stop.stop_requested()) {
- remoteplay::NativeConnectRequest request; request.host = host; request.video = format; request.credentials = std::move(result.credentials);
- for (auto byte : result.mac) request.consoleId += std::format("{:02x}", byte);
- if (request.consoleId == "000000000000") request.consoleId.clear();
- if (remoteplay::saveProfile(target, request)) { out.savedPath = target.filename().wstring(); out.message = L"配对成功并已加密保存;现在可以连接。"; }
- else out.message = L"配对成功,但保存失败;请检查用户目录权限。";
- } else out.message = result.canceled || stop.stop_requested() ? L"已取消配对" : std::format(L"配对失败({}),检查 PS5 配对码、Account ID 与网络。", result.result.code);
- return out;
- };
- VEYRA_PS5_LAUNCH(work);
-#else
- Q_UNUSED(pinText);
-#endif
-}
-bool QmlPlayerBridge::ps5Connect() {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- auto& i = *impl_;
- if (i.ps5Busy) return false;
- const auto path = i.ps5Profile.empty() ? std::filesystem::path{} : remoteplay::profileDirectory() / i.ps5Profile;
- auto saved = path.empty() ? std::nullopt : remoteplay::loadProfile(path);
- const auto host = asciiOnly(i.ps5Form.value("host").toString());
- if (!saved || !remoteplay::validHost(host)) { i.ps5Status = tr("请先完成配对,并填写有效主机地址。"); emit ps5Changed(); return false; }
- saved->host = host; saved->video = ps5Video(i.ps5Form); saved->viewOnly = i.ps5Form.value("viewOnly").toBool();
- if (!remoteplay::saveProfile(path, *saved)) { i.ps5Status = tr("保存连接设置失败,请检查目录权限。"); emit ps5Changed(); return false; }
- source::RemotePlayConnectDesc desc; desc.request = std::move(*saved);
- const int decode = std::clamp(i.ps5Form.value("decode").toInt(), 0, 2);
- desc.decodeMode = static_cast<source::RemotePlayConnectDesc::DecodeMode>(decode);
- desc.highQualitySampling = i.ps5Form.value("sampling").toInt() == 1;
- WritePrivateProfileStringW(L"RemotePlay", L"DecodeMode", std::to_wstring(decode).c_str(), ps5Settings().c_str());
- WritePrivateProfileStringW(L"RemotePlay", L"FineSampling", desc.highQualitySampling ? L"1" : L"0", ps5Settings().c_str());
- const bool viewOnly = desc.request.viewOnly;
- // The console has one Remote Play slot; the engine ends PS5 手柄控制 first.
- if (i.engine.remoteControlRequested()) emit notice(tr("已结束 PS5 手柄控制:PS5 同一时间只允许一个远程游玩连接"), false);
- rememberPosition(true);
- // The session id is cleared with the flag: the previous session's id left over here
- // ended "opening" on the next snapshot while the old source still ran.
- i.openingSource = true; i.openingSessionId = 0; i.sourceLabel = L"PS5 · " + std::wstring(host.begin(), host.end()); i.resumeSession = 0; i.screenFillActive = false;
- auto request = std::make_shared<source::RemotePlayConnectDesc>(std::move(desc));
- openAfterCinema(tr("正在连接 PS5 · %1").arg(QString::fromStdString(host)), [this, request, viewOnly] {
- auto& i = *impl_;
- if (i.preOpen) i.preOpen();
- i.engine.previewView({});
- i.engine.openRemotePlay(i.videoWindow, std::move(*request), i.options);
- i.openingSessionId = i.engine.snapshot().sessionId;
- refreshSubtitles({});
- // Controller forwarding at 8 ms, as 1.4.4; view-only leaves the pad to the PS5.
- // Started with the session: the poll stops the pad when no session runs.
- if (!viewOnly) {
- if (!i.acquirePad(Impl::PadPs5)) veyra::log::warn("remoteplay-input", "SDL gamepad initialization failed");
- if (!i.controllerTimer) {
- i.controllerTimer = new QTimer(this);
- connect(i.controllerTimer, &QTimer::timeout, this, [this] {
- auto& j = *impl_;
- const auto s = j.engine.snapshot();
- if (s.remotePlay && (s.running || s.transport == engine::TransportState::Opening)) {
- const bool focused = QGuiApplication::focusWindow() != nullptr;
- j.engine.remotePlayController(j.controller.poll(focused));
- j.controller.feedback(j.engine.remotePlayFeedback(), focused);
- } else {
- j.engine.remotePlayController({}); j.releasePad(Impl::PadPs5); j.controllerTimer->stop();
- }
- });
- }
- i.controllerTimer->start(8);
- } else {
- if (i.controllerTimer) i.controllerTimer->stop();
- i.releasePad(Impl::PadPs5);
- }
- });
- i.ps5Watching = true;
- rememberSource(QStringLiteral("ps5"), QString::fromStdString(host));
- i.ps5Status = tr("连接已开始。需要登录 PIN 时在下方提交。关闭面板不停止串流。");
- veyra::log::info("remoteplay-ui", std::format("connect quality={} codec={} bitrate={} decode={} viewOnly={}",
- i.ps5Form.value("quality").toInt(), i.ps5Form.value("codec").toInt(), i.ps5Form.value("bitrate").toInt(), decode, viewOnly));
- emit ps5Changed();
- return true;
-#else
- return false;
-#endif
-}
-void QmlPlayerBridge::ps5Wake() {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- auto saved = impl_->ps5Profile.empty() ? std::nullopt : remoteplay::loadProfile(remoteplay::profileDirectory() / impl_->ps5Profile);
- if (!saved) { impl_->ps5Status = tr("需要先配对才能唤醒。"); emit ps5Changed(); return; }
- saved->host = asciiOnly(impl_->ps5Form.value("host").toString());
- auto work = [request = std::move(*saved)](std::stop_token stop) {
- Impl::Ps5Outcome out; if (stop.stop_requested()) { out.message = L"已取消唤醒"; return out; }
- auto r = remoteplay::wakeLocalPs5(request);
- out.message = r.ok ? L"已发送唤醒请求,等待 PS5 开机后再连接。" : std::format(L"唤醒失败({});确认 PS5 处于待机而不是关机。", r.code);
- return out;
- };
- VEYRA_PS5_LAUNCH(work);
-#endif
-}
-void QmlPlayerBridge::ps5Forget() {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- if (impl_->ps5Busy || impl_->ps5Profile.empty()) return;
- std::error_code ec;
- const bool removed = std::filesystem::remove(remoteplay::profileDirectory() / impl_->ps5Profile, ec);
- impl_->ps5Status = removed ? tr("配对已删除。现有串流会保留;下次连接需选择其他主机或重新配对。") : tr("删除失败,请检查目录权限。");
- if (removed) impl_->ps5Profile.clear();
- ps5Load();
-#endif
-}
-void QmlPlayerBridge::ps5PsnLogin() {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- if (QDesktopServices::openUrl(QUrl(QString::fromStdWString(remoteplay::psnLoginUrl())))) {
- impl_->psnLoginStarted = GetTickCount64();
- impl_->ps5Status = tr("在 Sony 网页完成登录,复制最终回调地址,再点“提交登录结果”。");
- } else impl_->ps5Status = tr("无法打开浏览器,请检查默认浏览器设置。");
- emit ps5Changed();
-#endif
-}
-void QmlPlayerBridge::ps5PsnComplete() {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- if (impl_->ps5Busy) return;
- if (!impl_->psnLoginStarted || GetTickCount64() - impl_->psnLoginStarted > 600000) {
- impl_->ps5Status = tr("请先点登录 PSN,完成网页授权后再提交。"); emit ps5Changed(); return;
- }
- std::wstring callback = QGuiApplication::clipboard() ? QGuiApplication::clipboard()->text().left(8192).toStdWString() : std::wstring{};
- if (!remoteplay::validPsnCallback(callback)) {
- SecureZeroMemory(callback.data(), callback.size() * sizeof(wchar_t));
- impl_->ps5Status = tr("剪贴板不是有效的 Sony 授权回调地址。请复制登录完成后的完整 URL。"); emit ps5Changed(); return;
- }
- impl_->psnLoginStarted = 0;
- auto work = [callback = std::move(callback)](std::stop_token stop) mutable {
- auto result = remoteplay::authorizePsn(std::move(callback), stop); Impl::Ps5Outcome out;
- if (result.account) out.account = remoteplay::accountIdToBase64(*result.account);
- out.message = result.ok ? L"PSN 登录已保存,Account ID 已填入。首次仍需配对;已配对主机直接连接。"
- : std::format(L"PSN 授权失败({});原有配对不受影响,可重新登录。", result.error);
- return out;
- };
- VEYRA_PS5_LAUNCH(work);
-#endif
-}
-void QmlPlayerBridge::ps5PsnForget() {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- if (impl_->ps5Busy) return;
- impl_->ps5Status = remoteplay::forgetPsnAuthorization() ? tr("PSN 授权已删除,局域网配对保留。") : tr("删除授权失败,请检查目录权限。");
- emit ps5Changed();
-#endif
-}
-void QmlPlayerBridge::ps5SendLoginPin(const QString& pin) {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- const auto text = pin.trimmed();
- if (text.isEmpty() || !std::all_of(text.begin(), text.end(), [](QChar c) { return c.isDigit(); })) {
- impl_->ps5Status = tr("登录 PIN 必须为数字。"); emit ps5Changed(); return;
- }
- impl_->engine.remotePlayLoginPin(text.toStdString());
-#else
- (void)pin; // RemotePlay disabled: keep the QML-callable symbol but no backend.
-#endif
-}
-void QmlPlayerBridge::ps5Cancel() {
- if (impl_->ps5Busy && impl_->ps5Worker.joinable()) { impl_->ps5Worker.request_stop(); return; }
- if (impl_->snapshot.remotePlay) stopPlayback();
-}
-void QmlPlayerBridge::ps5Calibrate() {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- impl_->ps5Status = impl_->controller.calibrate() ? tr("将手柄平放并保持静止:采集 120 个稳定样本完成校准;10 秒内不稳定则保留原校准。")
- : tr("请先连接串流及带陀螺仪的电脑手柄。仅观看模式不使用电脑手柄。");
- emit ps5Changed();
-#endif
-}
-void QmlPlayerBridge::tickPs5() {
- auto& i = *impl_;
- bool changed = false;
- if (i.ps5Busy && i.ps5Done.load()) {
- if (i.ps5Worker.joinable()) i.ps5Worker.join();
- i.ps5Busy = false;
- Impl::Ps5Outcome r; { std::lock_guard lock(i.ps5Mutex); r = std::move(i.ps5Outcome); }
- i.ps5Status = veyra::ui::i18n::text(r.message);
- if (!r.account.empty()) i.ps5Form["account"] = QString::fromStdString(r.account);
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- if (!r.savedPath.empty()) {
- i.ps5Profile = r.savedPath;
- WritePrivateProfileStringW(L"RemotePlay", L"LastProfile", i.ps5Profile.c_str(), ps5Settings().c_str());
- const auto status = i.ps5Status; ps5Load(); i.ps5Status = status;
- }
- if (!r.hosts.empty()) {
- // A found console updates the selected pairing's address only when its
- // id matches (or the legacy profile had no id and the same host).
- const auto path = i.ps5Profile.empty() ? std::filesystem::path{} : remoteplay::profileDirectory() / i.ps5Profile;
- auto selected = path.empty() ? std::nullopt : remoteplay::loadProfile(path);
- bool matched = false;
- if (selected) for (const auto& [host, id] : r.hosts) {
- if ((!selected->consoleId.empty() && selected->consoleId == id) || (selected->consoleId.empty() && selected->host == host)) {
- selected->host = host; if (id.size() == 12) selected->consoleId = id;
- if (remoteplay::saveProfile(path, *selected)) { i.ps5Form["host"] = QString::fromStdString(host); matched = true; }
- break;
- }
- }
- if (!selected && r.hosts.size() == 1) i.ps5Form["host"] = QString::fromStdString(r.hosts.front().first);
- else if (selected && !matched) i.ps5Status = tr("发现主机,但无法确认是已配对的这一台。保留原地址,可核对后手动修改。");
- else if (!selected && r.hosts.size() > 1) i.ps5Status = tr("发现多台 PS5,请填写要配对的主机 IP,避免选错主机。");
- }
-#endif
- changed = true;
- }
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- if (i.ps5Watching && !i.ps5Busy) {
- const auto& s = i.snapshot;
- const bool active = s.remotePlay && (s.running || s.transport == engine::TransportState::Opening || s.transport == engine::TransportState::Stopping);
- QString message = veyra::ui::i18n::text(s.failed ? s.status : s.remoteRecovering ? s.remoteRecoveryMessage
- : s.remotePlay && s.running ? std::wstring(L"PS5 画面已进入播放;关闭此面板不停止串流。") : active ? s.status : std::wstring(L"PS5 串流已停止,可以重新连接。"));
- if (s.remotePlay && s.running && !s.failed && !s.remoteRecovering) {
- const auto& r = s.remoteStream; const auto& p = r.requestedProfile;
- message = veyra::ui::i18n::text(std::format(L"生效:{}p / {} fps / {} / 请求 {} Mbps · 实收视频 {:.1f} Mbps", p.height, p.fps,
- p.codec == remoteplay::Codec::H264 ? L"H.264" : p.codec == remoteplay::Codec::H265Hdr ? L"H.265 HDR" : L"H.265", p.bitrateKbps / 1000, r.videoMbps));
- const auto c = i.controller.capabilities();
- if (i.ps5Form.value("viewOnly").toBool()) message += tr("\n仅观看:电脑输入已关闭,手柄由 PS5 处理。");
- else if (!c.connected) message += tr("\n未检测到电脑手柄。");
- else message += veyra::ui::i18n::text(std::format(L"\n陀螺仪 {} · 触摸板 {} · 扳机 {} · 触觉 {}{}", c.gyro && c.accel ? L"已启用" : L"不可用",
- c.touch ? L"可用" : L"不可用", c.triggers ? L"已接入" : L"不可用", c.haptics ? L"端点已打开" : L"未打开", c.calibrating ? L" · 校准中" : L""));
- }
- if (message != i.ps5Status) { i.ps5Status = message; changed = true; }
- if (!active && !s.remotePlay) i.ps5Watching = false;
- }
-#endif
- if (changed) emit ps5Changed();
- tickPs5Control();
-}
-
-// --- PS5 手柄控制 (capture card dialog) ----------------------------------------
-QVariantMap QmlPlayerBridge::ps5Control() const {
- QVariantMap out = impl_->ps5ControlState;
- if (!out.contains(QStringLiteral("state"))) out[QStringLiteral("state")] = QStringLiteral("off");
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- out[QStringLiteral("available")] = true;
-#else
- out[QStringLiteral("available")] = false;
-#endif
- out[QStringLiteral("enabled")] = impl_->prefBool("ps5CaptureControl", false);
- out[QStringLiteral("background")] = impl_->prefBool("ps5ControlBackground", false);
- return out;
-}
-// liveKind is "ps5", "screen", "moonlight" or "xbox" for those sources; a file
-// leaves it alone but does not set snapshot.capture.
-bool QmlPlayerBridge::captureCardLive() const {
- const auto& s = impl_->snapshot;
- // Not while Stopping: after 断开 the run keeps `running` until it has torn
- // down, and the tick would start PS5 手柄控制 again in that window.
- const bool playing = s.running && !s.image && !s.remotePlay &&
- (s.transport == engine::TransportState::Playing || s.transport == engine::TransportState::Paused);
- // Tests only: any playing source stands in for the capture card (no card needed).
- if (playing && qEnvironmentVariableIsSet("VEYRA_TEST_PS5_CONTROL_ANY_SOURCE")) return true;
- return playing && s.capture && impl_->liveKind == QLatin1String("capture");
-}
-void QmlPlayerBridge::ps5ControlSet(const QString& key, const QVariant& value) {
- static const QHash<QString, QString> keys{{QStringLiteral("enabled"), QStringLiteral("ps5CaptureControl")},
- {QStringLiteral("background"), QStringLiteral("ps5ControlBackground")}};
- if (!keys.contains(key)) return;
- const bool on = value.toBool();
- const auto previous = impl_->prefs;
- impl_->prefs[keys.value(key)] = on;
- if (!impl_->savePrefs()) { impl_->prefs = previous; emit notice(tr("PS5 手柄控制设置保存失败"), true); emit ps5ControlChanged(); return; }
- veyra::log::info("remoteplay-control", std::format("ui {}={}", key.toStdString(), on));
- if (key == QLatin1String("enabled")) {
- impl_->ps5ControlNoPair = false;
- if (!on) stopPs5Control();
- else if (captureCardLive()) startPs5Control(false);
- tickPs5Control(true);
- }
- emit ps5ControlChanged();
-}
-void QmlPlayerBridge::ps5ControlRestart() {
- if (impl_->prefBool("ps5CaptureControl", false) && captureCardLive()) startPs5Control(true);
-}
-void QmlPlayerBridge::startPs5Control(bool restart) {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- auto& i = *impl_;
- source::RemotePlayConnectDesc desc;
- std::wstring profile;
- // Tests only: a dummy pairing to this host (an unroutable test address); the
- // saved pairings are not read, so no real console is ever contacted.
- const QString testHost = qEnvironmentVariable("VEYRA_TEST_PS5_CONTROL_HOST");
- if (!testHost.isEmpty()) {
- desc.request.host = testHost.toStdString();
- profile = L"test:" + testHost.toStdWString();
- } else {
- if (i.ps5Profile.empty()) ps5Load();
- auto saved = i.ps5Profile.empty() ? std::nullopt : remoteplay::loadProfile(remoteplay::profileDirectory() / i.ps5Profile);
- if (!saved) {
- i.engine.stopRemoteControl();
- if (!i.ps5ControlNoPair) emit notice(tr("PS5 手柄控制:还没有配对的 PS5,先在「PS5 串流」里配对一次"), true);
- i.ps5ControlNoPair = true;
- tickPs5Control(true);
- return;
- }
- desc.request = std::move(*saved);
- profile = i.ps5Profile;
- }
- const auto running = i.engine.remoteControlStatus();
- if (!restart && running.requested && (running.alive || running.starting) && profile == i.ps5ControlProfile) {
- if (!(i.padUsers & Impl::PadPs5Control)) i.acquirePad(Impl::PadPs5Control);
- if (i.ps5ControlTimer && !i.ps5ControlTimer->isActive()) i.ps5ControlTimer->start(8);
- return;
- }
- // Keepalive profile, the lightest the console accepts. Never written back to the pairing.
- remoteplay::VideoProfile keepalive;
- keepalive.width = 1280; keepalive.height = 720; keepalive.fps = 30; keepalive.bitrateKbps = 5000; keepalive.codec = remoteplay::Codec::H264;
- desc.request.video = keepalive;
- veyra::log::info("remoteplay-control", std::format("start host={} restart={} background={}", desc.request.host, restart, i.prefBool("ps5ControlBackground", false)));
- i.ps5ControlProfile = profile;
- i.ps5ControlNoticed.clear();
- i.ps5ControlNoPair = false;
- i.engine.startRemoteControl(std::move(desc));
- // The pad is read on the UI thread every 8 ms, as for the PS5 stream (the
- // session sends one state per 4 ms and queues the rest).
- if (!i.acquirePad(Impl::PadPs5Control)) veyra::log::warn("remoteplay-input", "SDL gamepad initialization failed");
- if (!i.ps5ControlTimer) {
- i.ps5ControlTimer = new QTimer(this);
- connect(i.ps5ControlTimer, &QTimer::timeout, this, [this] {
- auto& j = *impl_;
- // A PS5 stream polls the pad with its own timer and takes the slot.
- if (j.snapshot.remotePlay || !j.engine.remoteControlRequested()) {
- j.ps5ControlTimer->stop(); j.releasePad(Impl::PadPs5Control); return;
- }
- const bool focused = QGuiApplication::focusWindow() != nullptr || j.prefBool("ps5ControlBackground", false);
- j.engine.remotePlayController(j.controller.poll(focused));
- j.controller.feedback(j.engine.remotePlayFeedback(), focused);
- });
- }
- i.ps5ControlTimer->start(8);
- tickPs5Control(true);
-#else
- (void)restart;
-#endif
-}
-void QmlPlayerBridge::stopPs5Control() {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- auto& i = *impl_;
- if (!i.engine.remoteControlRequested()) return;
- veyra::log::info("remoteplay-control", "stop");
- i.engine.stopRemoteControl();
- i.ps5ControlProfile.clear();
- tickPs5Control(true);
-#endif
-}
-void QmlPlayerBridge::tickPs5Control(bool force) {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- auto& i = *impl_;
- if (!force && ++i.ps5ControlTicks % 15) return; // ~4 Hz from the 60 Hz poll
- // Switched on while the capture card was still opening, or the capture came
- // back by itself: start once it is live. A failed session stays requested
- // until the user restarts it, so this never loops.
- if (!force && !i.ps5ControlNoPair && i.prefBool("ps5CaptureControl", false) && captureCardLive() && !i.engine.remoteControlRequested())
- startPs5Control(false);
- const auto st = i.engine.remoteControlStatus();
- QString state = QStringLiteral("off");
- if (i.ps5ControlNoPair && !st.requested) state = QStringLiteral("nopair");
- else if (st.requested) {
- state = st.pinRequired ? QStringLiteral("pin")
- : st.recovering ? QStringLiteral("recovering")
- : st.alive && st.connected ? QStringLiteral("connected")
- : !st.alive && !st.starting ? QStringLiteral("failed")
- : QStringLiteral("starting");
- }
- // Tests only: show a state no console is available to produce here.
- if (const QString forced = qEnvironmentVariable("VEYRA_TEST_PS5_CONTROL_STATE"); !forced.isEmpty() && st.requested) state = forced;
- QVariantMap next;
- next[QStringLiteral("state")] = state;
- next[QStringLiteral("message")] = state == QLatin1String("nopair") ? tr("还没有配对的 PS5,先在「PS5 串流」里配对一次") : uiText(st.message);
- next[QStringLiteral("keepaliveFps")] = st.keepaliveReady ? std::round(st.keepaliveFps) : -1.0;
- const auto c = i.controller.capabilities();
- next[QStringLiteral("pad")] = (i.padUsers & Impl::PadPs5Control) && c.connected ? QString::fromStdString(c.name) : QString();
- next[QStringLiteral("gyro")] = c.gyro && c.accel;
- next[QStringLiteral("touch")] = c.touch;
- if (next == i.ps5ControlState) return;
- i.ps5ControlState = next;
- if (state != i.ps5ControlNoticed) {
- if (state == QLatin1String("connected")) emit notice(tr("PS5 手柄控制已连接"), false);
- else if (state == QLatin1String("pin")) emit notice(tr("PS5 要求输入登录 PIN:在采集卡面板「PS5 手柄控制」里填写"), false);
- else if (state == QLatin1String("failed")) {
- const QString reason = next.value(QStringLiteral("message")).toString();
- emit notice(reason.isEmpty() ? tr("PS5 手柄控制已停止") : reason, true);
- }
- if (state == QLatin1String("connected") || state == QLatin1String("pin") || state == QLatin1String("failed")) i.ps5ControlNoticed = state;
- }
- emit ps5ControlChanged();
-#else
- (void)force;
-#endif
-}
-
-// --- ps5 dialog --------------------------------------------------------------
-QString QmlPlayerBridge::remotePlayHost() const { return impl_->remotePlayHost; }
-void QmlPlayerBridge::setRemotePlayHost(const QString& value) {
- impl_->remotePlayHost = value;
- emit settingsChanged();
-}
-QString QmlPlayerBridge::remotePlayPin() const { return impl_->remotePlayPin; }
-void QmlPlayerBridge::setRemotePlayPin(const QString& value) {
- // Held only until the connect command runs; it is never written to the session
- // file, and the engine keeps PSN credentials encrypted in the user data
- // directory rather than here.
- impl_->remotePlayPin = value;
- emit settingsChanged();
-}
-
-
-// --- colour page -------------------------------------------------------------
-// One table of the parameters the engine actually carries, so a control can only
-// exist for a real field, and the UI can build itself from this catalogue.
-namespace {
-struct ColourParam {
- const char* name;
- const char* label;
- const char* group;
- float minimum, maximum, step;
-};
-// Names match ColorSettings' own members; the mixer bands are indexed.
-const ColourParam kColourParams[] = {
- {"exposure", "曝光(EV)", "亮", -5, 5, 0.05f},
- {"contrast", "对比度", "亮", -100, 100, 1},
- {"highlights", "高光", "亮", -100, 100, 1},
- {"shadows", "阴影", "亮", -100, 100, 1},
- {"whites", "白色", "亮", -100, 100, 1},
- {"blacks", "黑色", "亮", -100, 100, 1},
- {"texture", "纹理", "效果", -100, 100, 1},
- {"clarity", "清晰度", "效果", -100, 100, 1},
- {"dehaze", "去朦胧", "效果", -100, 100, 1},
- {"temperature", "色温(相对)", "颜色", -100, 100, 1},
- {"tint", "色调", "颜色", -100, 100, 1},
- {"vibrance", "自然饱和度", "颜色", -100, 100, 1},
- {"saturation", "饱和度", "颜色", -100, 100, 1},
- {"paramHighlights","参数化高光", "曲线", -100, 100, 1},
- {"paramLights", "参数化亮调", "曲线", -100, 100, 1},
- {"paramDarks", "参数化暗调", "曲线", -100, 100, 1},
- {"paramShadows", "参数化阴影", "曲线", -100, 100, 1},
- {"splitHighlights","分离高光", "曲线", -100, 100, 1},
- {"splitMidtones", "分离中间调", "曲线", -100, 100, 1},
- {"splitShadows", "分离阴影", "曲线", -100, 100, 1},
- {"gradingBlending","混合", "颜色分级", 0, 100, 1},
- {"gradingBalance","平衡", "颜色分级", -100, 100, 1},
- {"calibrationShadowTint","阴影色调","校准", -100, 100, 1},
- {"lutStrength", "LUT 强度", "LUT", 0, 100, 1},
-};
-
-float* colourScalar(engine::ColorSettings& c, const char* name) {
- const std::string_view n{name};
- if (n == "exposure") return &c.exposure;
- if (n == "contrast") return &c.contrast;
- if (n == "highlights") return &c.highlights;
- if (n == "shadows") return &c.shadows;
- if (n == "whites") return &c.whites;
- if (n == "blacks") return &c.blacks;
- if (n == "texture") return &c.texture;
- if (n == "clarity") return &c.clarity;
- if (n == "dehaze") return &c.dehaze;
- if (n == "temperature") return &c.temperature;
- if (n == "tint") return &c.tint;
- if (n == "vibrance") return &c.vibrance;
- if (n == "saturation") return &c.saturation;
- if (n == "paramHighlights") return &c.paramHighlights;
- if (n == "paramLights") return &c.paramLights;
- if (n == "paramDarks") return &c.paramDarks;
- if (n == "paramShadows") return &c.paramShadows;
- if (n == "splitHighlights") return &c.splitHighlights;
- if (n == "splitMidtones") return &c.splitMidtones;
- if (n == "splitShadows") return &c.splitShadows;
- if (n == "gradingBlending") return &c.gradingBlending;
- if (n == "gradingBalance") return &c.gradingBalance;
- if (n == "calibrationShadowTint") return &c.calibrationShadowTint;
- if (n == "lutStrength") return &c.lutStrength;
- // Array parameters retain the existing engine units; no UI-only mirrors.
- const auto parts=QString::fromUtf8(name).split('.');
- bool ok=false;
- const int index=parts.size()>=2?parts[1].toInt(&ok):-1;
- if(!ok||index<0)return nullptr;
- if(parts.size()==2){
- if(index<engine::kColorMixerBands){
- if(parts[0]=="mixerHue")return &c.mixerHue[index];
- if(parts[0]=="mixerSaturation")return &c.mixerSaturation[index];
- if(parts[0]=="mixerLuminance")return &c.mixerLuminance[index];
- if(parts[0]=="blackWhiteMix")return &c.blackWhiteMix[index];
- }
- if(index<3){
- if(parts[0]=="calibrationHue")return &c.calibrationHue[index];
- if(parts[0]=="calibrationSaturation")return &c.calibrationSaturation[index];
- }
- }
- if(parts.size()==3&&parts[0]=="grading"&&index<engine::kColorGradingZones){
- if(parts[2]=="hue")return &c.grading[index].hue;
- if(parts[2]=="saturation")return &c.grading[index].saturation;
- if(parts[2]=="luminance")return &c.grading[index].luminance;
- }
- return nullptr;
-}
-} // namespace
-
-QVariantList QmlPlayerBridge::colourParameters() const {
- QVariantList out;
- engine::ColorSettings defaults;
- for (const auto& p : kColourParams) {
- QVariantMap item;
- item["name"] = QString::fromUtf8(p.name);
- item["label"] = uiText(std::string_view(p.label));
- item["group"] = uiText(std::string_view(p.group));
- item["min"] = double(p.minimum);
- item["max"] = double(p.maximum);
- item["step"] = double(p.step);
- if (const auto* value = colourScalar(defaults, p.name)) item["defaultValue"] = double(*value);
- // Centred controls read their fill from the middle, as the design's sliders
- // do for anything that can go either way.
- item["center"] = p.minimum < 0 && p.maximum > 0;
- out << item;
- }
- return out;
-}
-
-QVariantList QmlPlayerBridge::colourGroups() const {
- // Grouped in catalogue order, so the sections appear in the design's order
- // rather than in whatever order a hash would produce.
- QVariantList groups;
- QStringList order;
- QHash<QString, QVariantList> buckets;
- for (const auto& p : kColourParams) {
- const QString group = uiText(std::string_view(p.group));
- if (!buckets.contains(group)) order << group;
- QVariantMap item;
- item["name"] = QString::fromUtf8(p.name);
- item["label"] = uiText(std::string_view(p.label));
- item["min"] = double(p.minimum);
- item["max"] = double(p.maximum);
- item["center"] = p.minimum < 0 && p.maximum > 0;
- buckets[group] << item;
- }
- for (const auto& group : order) {
- QVariantMap entry;
- entry["group"] = group;
- entry["items"] = buckets.value(group);
- groups << entry;
- }
- return groups;
-}
-
-double QmlPlayerBridge::colourParameter(const QString& name) const {
- auto c = selectedColourSettings();
- const auto utf8 = name.toUtf8();
- if (float* field = colourScalar(c, utf8.constData())) return double(*field);
- return 0.0;
-}
-
-bool QmlPlayerBridge::setColourParameter(const QString& name, double value) {
- if(!std::isfinite(value)){emit notice(tr("调色值必须是有限数值"),true);return false;}
- auto c = selectedColourSettings();
- const auto utf8 = name.toUtf8();
- float* field = colourScalar(c, utf8.constData());
- if (field == nullptr) return false;
- const float next = float(value);
- if (*field == next) return true;
- *field = next;
- return commitColour(c);
-}
-
-bool QmlPlayerBridge::resetColourParameter(const QString& name) {
- engine::ColorSettings defaults;
- const auto utf8 = name.toUtf8();
- float* field = colourScalar(defaults, utf8.constData());
- if (field == nullptr) return false;
- return setColourParameter(name,*field);
-}
-
-int QmlPlayerBridge::selectedColourLayer() const {return impl_->colourIndex();}
-void QmlPlayerBridge::setSelectedColourLayer(int index){
- if(index<0||uint32_t(index)>=impl_->chain.nodeCount||
- impl_->chain.nodes[index].type!=engine::EffectType::Color||impl_->selectedColour==index)return;
- impl_->selectedColour=index;emit settingsChanged();
-}
-engine::ColorSettings QmlPlayerBridge::selectedColourSettings() const {
- const int index=impl_->colourIndex();
- if(index<0)return {};
- auto colour=impl_->chain.nodes[index].color;
- colour.enabled=impl_->chain.nodes[index].enabled;
- return colour;
-}
-bool QmlPlayerBridge::commitColour(const engine::ColorSettings& colour){
- const int index=impl_->colourIndex();
- if(index<0){emit notice(tr("处理链中没有调色节点,未更改设置"),true);return false;}
- if(const auto error=colour.validate();!error.empty()){
- emit notice(tr("调色参数被拒绝:%1").arg(uiText(error)),true);return false;
- }
- auto& node=impl_->chain.nodes[index];
- if(node.color==colour&&node.enabled==colour.enabled)return true;
- const auto previous=node;const bool wasValid=chainValid();
- node.color=colour;node.enabled=colour.enabled;
- if(!impl_->revalidate(true)){
- const auto error=impl_->validation.message;node=previous;impl_->revalidate();
- emit notice(uiText(error),true);emit settingsChanged();return false;
- }
- if(!impl_->colourReplaying){
- const qint64 now=QDateTime::currentMSecsSinceEpoch();
- const bool sameDrag=index==impl_->colourLastIndex&&now-impl_->colourLastPushMs<600&&!impl_->colourUndo.empty();
- if(!sameDrag){
- auto before=previous.color;before.enabled=previous.enabled;
- impl_->colourUndo.push_back({index,before});
- if(impl_->colourUndo.size()>64)impl_->colourUndo.erase(impl_->colourUndo.begin());
- }
- impl_->colourLastPushMs=now;impl_->colourLastIndex=index;impl_->colourRedo.clear();
- }
- emit settingsChanged();
- if(previous.enabled!=node.enabled)emitChainChanged();else emitParameterChanged(&QmlPlayerBridge::colourParamsChanged,wasValid);
- return true;
-}
-QVariantMap QmlPlayerBridge::colourState() const { return colourStateAt(impl_->colourIndex()); }
-// Any colour node's full state, so several node cards can show their own
-// values at once; edits still go through the selected-layer setters.
-QVariantMap QmlPlayerBridge::colourStateAt(int index) const {
- engine::ColorSettings c{};
- if(index>=0&&uint32_t(index)<impl_->chain.nodeCount&&impl_->chain.nodes[index].type==engine::EffectType::Color){
- c=impl_->chain.nodes[index].color;c.enabled=impl_->chain.nodes[index].enabled;
- }else index=-1;
- QVariantMap out;
- out["index"]=index;out["enabled"]=c.enabled;
- out["blackWhite"]=c.blackWhite;out["groupBypassMask"]=int(c.groupBypassMask);
- for(const auto& p:kColourParams)out[QString::fromUtf8(p.name)]=double(*colourScalar(c,p.name));
- const auto list=[](const auto& values){QVariantList out;for(const auto v:values)out<<double(v);return out;};
- out["mixerHue"]=list(c.mixerHue);out["mixerSaturation"]=list(c.mixerSaturation);
- out["mixerLuminance"]=list(c.mixerLuminance);out["blackWhiteMix"]=list(c.blackWhiteMix);
- out["calibrationHue"]=list(c.calibrationHue);out["calibrationSaturation"]=list(c.calibrationSaturation);
- QVariantList curves,wheels,samples;
- for(const auto& curve:c.curves){
- QVariantList points;
- for(int i=0;i<curve.count;++i)points<<QVariantMap{{"x",double(curve.points[i].x)},{"y",double(curve.points[i].y)}};
- curves<<QVariant(points);
- QVariantList values;
- for(int i=0;i<=128;++i)values<<double(pipeline::ColorGradeTables::curveValue(curve,float(i)/128.0f));
- samples<<QVariant(values);
- }
- for(const auto& wheel:c.grading)wheels<<QVariantMap{{"hue",double(wheel.hue)},
- {"saturation",double(wheel.saturation)},{"luminance",double(wheel.luminance)}};
- out["curves"]=curves;out["curveSamples"]=samples;out["grading"]=wheels;
- out["lutName"]=QString::fromStdWString(c.lutNameString());out["lutInputSpace"]=c.lutInputSpace;
- return out;
-}
-bool QmlPlayerBridge::setColourCurve(int channel,const QVariantList& points){
- if(channel<0||channel>=4||points.size()<2||points.size()>engine::kColorCurvePoints)return false;
- auto c=selectedColourSettings();auto& curve=c.curves[channel];curve.reset();curve.count=int(points.size());
- for(int i=0;i<curve.count;++i){
- const auto point=points[i].toMap();bool xok=false,yok=false;
- const double x=point.value("x").toDouble(&xok),y=point.value("y").toDouble(&yok);
- if(!xok||!yok||!std::isfinite(x)||!std::isfinite(y))return false;
- curve.points[i]={float(x),float(y)};
- }
- return commitColour(c);
-}
-bool QmlPlayerBridge::setColourOption(const QString& name,int value){
- auto c=selectedColourSettings();
- if(name=="blackWhite"&&(value==0||value==1))c.blackWhite=value!=0;
- else if(name=="groupBypassMask"&&value>=0&&value<128)c.groupBypassMask=uint32_t(value);
- else if(name=="lutInputSpace"&&value>=0&&value<=2)c.lutInputSpace=value;
- else return false;
- return commitColour(c);
-}
-bool QmlPlayerBridge::setColourWheel(int zone,double hue,double saturation,double luminance){
- if(zone<0||zone>=engine::kColorGradingZones||!std::isfinite(hue)||
- !std::isfinite(saturation)||!std::isfinite(luminance))return false;
- auto c=selectedColourSettings();c.grading[zone]={float(hue),float(saturation),float(luminance)};
- return commitColour(c);
-}
-bool QmlPlayerBridge::resetColourGroup(int group){
- auto c=selectedColourSettings();const engine::ColorSettings d;
- switch(group){
- case -1:{const bool enabled=c.enabled;c=d;c.enabled=enabled;break;}
- case 0:c.exposure=c.contrast=c.highlights=c.shadows=c.whites=c.blacks=0;break;
- case 1:c.temperature=c.tint=c.vibrance=c.saturation=0;break;
- case 2:c.paramHighlights=c.paramLights=c.paramDarks=c.paramShadows=0;c.curves=d.curves;
- c.splitHighlights=c.splitMidtones=c.splitShadows=0;break;
- case 3:c.mixerHue=d.mixerHue;c.mixerSaturation=d.mixerSaturation;c.mixerLuminance=d.mixerLuminance;
- c.blackWhite=d.blackWhite;c.blackWhiteMix=d.blackWhiteMix;break;
- case 4:c.grading=d.grading;c.gradingBlending=d.gradingBlending;c.gradingBalance=0;break;
- case 5:c.calibrationShadowTint=0;c.calibrationHue=d.calibrationHue;c.calibrationSaturation=d.calibrationSaturation;break;
- case 6:c.clearLut();c.lutStrength=d.lutStrength;c.lutInputSpace=d.lutInputSpace;break;
- case 7:c.texture=c.clarity=c.dehaze=0;break;
- default:return false;
- }
- if(group>=0&&group<7)c.groupBypassMask&=~(1u<<group);
- return commitColour(c);
-}
-
-// --- LUT library and colour looks (P4-g) ------------------------------------
-// LUTs go to the folder the engine and the export worker resolve by name
-// (runtime_local/luts); looks are user data beside the presets.
-QVariantList QmlPlayerBridge::lutLibrary() const {
- QVariantList out;
- const engine::ColorLutStore store(runtime::localDataDirectory());
- for (const auto& name : store.list()) out << QString::fromStdWString(name);
- return out;
-}
-QVariantList QmlPlayerBridge::colourLooks() const {
- engine::ColorLookStore store(impl_->dataDir);
- QVariantList out;
- if (!store.load()) return out;
- for (size_t i = 0; i < store.entries().size(); ++i) {
- const auto& look = store.entries()[i];
- out << QVariantMap{{"index", int(i)}, {"name", QString::fromStdWString(look.name)},
- {"lut", QString::fromStdWString(look.color.lutNameString())}};
- }
- return out;
-}
-void QmlPlayerBridge::importLutDialog() {
- const QString path = QFileDialog::getOpenFileName(nullptr, tr("导入 .cube LUT"), QString(),
- tr("Cube LUT (*.cube);;所有文件 (*.*)"));
- if (!path.isEmpty()) importLut(path);
-}
-bool QmlPlayerBridge::importLut(const QString& path) {
- if (impl_->colourIndex() < 0) { emit notice(tr("处理链中没有调色节点,无法使用 LUT"), true); return false; }
- const engine::ColorLutStore store(runtime::localDataDirectory());
- std::wstring name; std::string error;
- if (!store.importFile(std::filesystem::path(path.toStdWString()), name, error) || name.empty()) {
- veyra::log::warn("ui-colour", std::format("lut import rejected path={} error={}", path.toStdString(), error));
- emit notice(tr("LUT 导入失败:%1").arg(QString::fromStdString(error)), true);
- return false;
- }
- veyra::log::info("ui-colour", std::format("lut imported name={}", QString::fromStdWString(name).toStdString()));
- emit colourLibraryChanged();
- const bool applied = setColourLut(QString::fromStdWString(name));
- if (applied) emit notice(tr("已导入并使用 LUT:%1").arg(QString::fromStdWString(name)), false);
- return applied;
-}
-bool QmlPlayerBridge::setColourLut(const QString& name) {
- auto c = selectedColourSettings();
- if (name.isEmpty()) { c.clearLut(); return commitColour(c); }
- const engine::ColorLutStore store(runtime::localDataDirectory());
- engine::ColorLutData data;
- if (!store.validName(name.toStdWString()) || !store.resolve(name.toStdWString(), data) || !data.valid()) {
- emit notice(tr("LUT 不可用:%1").arg(name), true);
- return false;
- }
- if (!c.setLutName(name.toStdWString())) { emit notice(tr("LUT 名称过长"), true); return false; }
- if (c.lutStrength <= 0.0f) c.lutStrength = 100.0f;
- c.enabled = true;
- return commitColour(c);
-}
-bool QmlPlayerBridge::saveColourLook(const QString& name, bool replace) {
- const QString trimmed = name.trimmed();
- if (trimmed.isEmpty() || trimmed.size() > 48) { emit notice(tr("颜色预设名称需为 1–48 个字符"), true); return false; }
- if (impl_->colourIndex() < 0) { emit notice(tr("处理链中没有调色节点"), true); return false; }
- engine::ColorLookStore store(impl_->dataDir);
- if (!store.load()) { emit notice(tr("颜色预设库无法读取:%1").arg(veyra::ui::i18n::text(store.error())), true); return false; }
- const bool exists = std::any_of(store.entries().begin(), store.entries().end(),
- [&](const auto& e) { return e.name == trimmed.toStdWString(); });
- if (exists && !replace) { emit notice(tr("已存在同名颜色预设"), true); return false; }
- auto colour = selectedColourSettings(); colour.enabled = true;
- if (!store.put(trimmed.toStdWString(), colour, replace) || !store.save()) {
- emit notice(tr("颜色预设保存失败:%1").arg(veyra::ui::i18n::text(store.error())), true); return false;
- }
- veyra::log::info("ui-colour", std::format("look saved name={} layer={}", trimmed.toStdString(), impl_->colourIndex()));
- emit colourLibraryChanged();
- emit notice(tr("已保存颜色预设:%1").arg(trimmed), false);
- return true;
-}
-bool QmlPlayerBridge::applyColourLook(int index) {
- engine::ColorLookStore store(impl_->dataDir);
- if (!store.load() || index < 0 || size_t(index) >= store.entries().size()) {
- emit notice(tr("颜色预设不存在"), true); return false;
- }
- auto colour = store.entries()[size_t(index)].color; colour.enabled = true;
- if (colour.hasLut()) {
- const engine::ColorLutStore luts(runtime::localDataDirectory());
- engine::ColorLutData data;
- if (!luts.resolve(colour.lutNameString(), data)) {
- emit notice(tr("预设引用的 LUT 不存在:%1,未应用").arg(QString::fromStdWString(colour.lutNameString())), true);
- return false;
- }
- }
- const bool ok = commitColour(colour);
- veyra::log::info("ui-colour", std::format("look applied index={} layer={} ok={}", index, impl_->colourIndex(), ok));
- return ok;
-}
-bool QmlPlayerBridge::deleteColourLook(int index) {
- engine::ColorLookStore store(impl_->dataDir);
- if (!store.load() || index < 0 || !store.erase(size_t(index)) || !store.save()) {
- emit notice(tr("删除颜色预设失败"), true); return false;
- }
- emit colourLibraryChanged();
- return true;
-}
-void QmlPlayerBridge::importColourLookDialog() {
- const QString path = QFileDialog::getOpenFileName(nullptr, tr("导入颜色预设"), QString(),
- tr("Veyra 颜色预设 (*.vpcolor);;所有文件 (*.*)"));
- if (!path.isEmpty()) importColourLook(path);
-}
-bool QmlPlayerBridge::importColourLook(const QString& path) {
- engine::ColorLookStore store(impl_->dataDir);
- std::wstring name;
- if (!store.load() || !store.importFile(std::filesystem::path(path.toStdWString()), name)) {
- emit notice(tr("导入颜色预设失败:%1").arg(veyra::ui::i18n::text(store.error())), true); return false;
- }
- emit colourLibraryChanged();
- emit notice(tr("已导入颜色预设:%1").arg(QString::fromStdWString(name)), false);
- return true;
-}
-void QmlPlayerBridge::exportColourLookDialog(int index) {
- const QString path = QFileDialog::getSaveFileName(nullptr, tr("导出颜色预设"), QString(),
- tr("Veyra 颜色预设 (*.vpcolor)"));
- if (!path.isEmpty()) exportColourLook(index, path);
-}
-bool QmlPlayerBridge::exportColourLook(int index, const QString& path) {
- engine::ColorLookStore store(impl_->dataDir);
- if (!store.load() || index < 0 || !store.exportFile(size_t(index), std::filesystem::path(path.toStdWString()))) {
- emit notice(tr("导出颜色预设失败:%1").arg(veyra::ui::i18n::text(store.error())), true); return false;
- }
- emit notice(tr("已导出颜色预设"), false);
- return true;
-}
-
-// --- image export (P4-b) -----------------------------------------------------
-bool QmlPlayerBridge::imageBatchActive() const { return impl_->imagePhase != Impl::ImagePhase::Idle; }
-int QmlPlayerBridge::imageBatchDone() const { return impl_->imageDone; }
-int QmlPlayerBridge::imageBatchTotal() const { return int(impl_->imageFiles.size()); }
-int QmlPlayerBridge::imageBatchFailures() const { return impl_->imageFailures; }
-QString QmlPlayerBridge::imageBatchStatus() const { return impl_->imageStatus; }
-void QmlPlayerBridge::saveFrameDialog() {
- if(!impl_->pendingFrameExport.isEmpty()||!impl_->pendingScreenshot.isEmpty()||imageBatchActive()){emit notice(tr("请等待当前图片导出完成"),true);return;}
- if (!hasSource()) { emit notice(tr("没有可保存的画面"), true); return; }
- if (impl_->chain.mode == engine::ChainMode::Node) {
- emit notice(tr("图片导出只接受列表模式;请切回列表模式再导出"), true); return;
- }
- const QString suggested = QDir(screenshotDirectory()).filePath(
- QFileInfo(QString::fromStdWString(impl_->sourceLabel)).completeBaseName() + QStringLiteral("-veyra.png"));
- const QString path = QFileDialog::getSaveFileName(nullptr, tr("导出当前画面"), suggested,
- tr("PNG 图片 (*.png);;JPEG 图片 (*.jpg)"));
- if (path.isEmpty()) return;
- if (QFileInfo::exists(path)) { emit notice(tr("目标文件已存在,请换一个文件名"), true); return; }
- impl_->engine.saveFrame(wideOf(QDir::toNativeSeparators(path)));
- impl_->pendingFrameExport=path;impl_->pendingFrameDeadline=QDateTime::currentMSecsSinceEpoch()+30000;
- emit notice(tr("正在保存:%1").arg(QDir::toNativeSeparators(path)), false);
-}
-void QmlPlayerBridge::exportImagesDialog() {
- const auto files = QFileDialog::getOpenFileNames(nullptr, tr("选择要处理的图片"), QString(),
- tr("图片 (*.png *.jpg *.jpeg)"));
- if (files.isEmpty()) return;
- const QString folder = QFileDialog::getExistingDirectory(nullptr, tr("保存到"), QFileInfo(files.front()).absolutePath());
- if (!folder.isEmpty()) startImageBatch(files, folder);
-}
-bool QmlPlayerBridge::startImageBatch(const QStringList& files, const QString& folder) {
- auto& i = *impl_;
- if (i.imagePhase != Impl::ImagePhase::Idle) { emit notice(tr("已有一批图片在处理"), true); return false; }
- if (i.chain.mode == engine::ChainMode::Node) {
- emit notice(tr("图片导出只接受列表模式;请切回列表模式再导出"), true); return false;
- }
- if (files.isEmpty() || !QFileInfo(folder).isDir()) { emit notice(tr("请选择图片和已存在的输出目录"), true); return false; }
- i.imageFiles = files; i.imageFolder = folder;
- i.imageIndex = -1; i.imageDone = 0; i.imageFailures = 0;
- i.imagePhase = Impl::ImagePhase::Opening; i.imageWaits = 0;
- veyra::log::info("image-batch", std::format("start files={} folder={}", files.size(), folder.toStdString()));
- emit imageBatchChanged();
- return true;
-}
-void QmlPlayerBridge::cancelImageBatch() {
- if (impl_->imagePhase == Impl::ImagePhase::Idle) return;
- impl_->imagePhase = Impl::ImagePhase::Idle;
- impl_->imageStatus = tr("已取消:完成 %1 / %2").arg(impl_->imageDone).arg(impl_->imageFiles.size());
- veyra::log::info("image-batch", "cancelled");
- emit imageBatchChanged();
-}
-void QmlPlayerBridge::tickImageBatch() {
- auto& i = *impl_;
- if(!i.pendingScreenshot.isEmpty()){
- const QString written=QDir::fromNativeSeparators(QString::fromStdWString(i.snapshot.savedFramePath));
- const QString hdr=QFileInfo(i.pendingScreenshot).path()+QLatin1Char('/')+QFileInfo(i.pendingScreenshot).completeBaseName()+QStringLiteral(".jxr");
- if(written==i.pendingScreenshot||written==hdr){
- i.lastScreenshot=written;i.pendingScreenshot.clear();
- veyra::log::info("ui-screenshot","saved path="+written.toStdString());
- emit preferencesChanged();
- emit notice(tr("截图保存到:%1").arg(QDir::toNativeSeparators(written)),false);
- }
- if(!i.pendingScreenshot.isEmpty()&&QDateTime::currentMSecsSinceEpoch()>i.pendingScreenshotDeadline){
- i.pendingScreenshot.clear();emit notice(tr("图片保存未确认完成,请查看诊断"),true);
- }
- }
- if(!i.pendingFrameExport.isEmpty()){
- QString path=i.pendingFrameExport;
- if(!QFileInfo(path).isFile())path=QFileInfo(path).path()+QLatin1Char('/')+QFileInfo(path).completeBaseName()+QStringLiteral(".jxr");
- const bool reported=i.snapshot.status.find(L"已保存")!=std::wstring::npos;
- if(reported&&QFileInfo(path).size()>0&&exportFileClosed(path)){
- const bool valid=path.endsWith(QStringLiteral(".jxr"),Qt::CaseInsensitive)||!QImageReader(path).read().isNull();
- if(valid){i.pendingFrameExport.clear();exportCompletionNotice(exportCompletionSound(),++i.imageCompletionEvent,"image");emit notice(tr("图片导出完成:%1").arg(path),false);}
- }
- if(!i.pendingFrameExport.isEmpty()&&QDateTime::currentMSecsSinceEpoch()>i.pendingFrameDeadline){i.pendingFrameExport.clear();emit notice(tr("图片保存未确认完成,请查看诊断"),true);}
- }
- if (i.imagePhase == Impl::ImagePhase::Idle) return;
- auto fail = [&](const QString& why) {
- ++i.imageFailures;
- veyra::log::warn("image-batch", std::format("item failed index={} reason={}", i.imageIndex, why.toStdString()));
- emit notice(tr("图片未导出:%1(%2)").arg(QFileInfo(i.imageFiles[i.imageIndex]).fileName(), why), true);
- i.imagePhase = Impl::ImagePhase::Opening; i.imageSession = 0;
- };
- const auto& s = i.snapshot;
- if (i.imagePhase == Impl::ImagePhase::Opening && i.imageSession == 0) {
- // Next item.
- if (++i.imageIndex >= i.imageFiles.size()) {
- i.imagePhase = Impl::ImagePhase::Idle;
- i.imageStatus = tr("完成 %1 张,失败 %2 张").arg(i.imageDone).arg(i.imageFailures);
- veyra::log::info("image-batch", std::format("finished done={} failed={}", i.imageDone, i.imageFailures));
- emit imageBatchChanged();
- emit notice(i.imageStatus, i.imageFailures > 0);
- if(i.imageDone>0&&i.imageFailures==0)exportCompletionNotice(exportCompletionSound(),++i.imageCompletionEvent,"image-batch");
- return;
- }
- const QString input = i.imageFiles[i.imageIndex];
- i.imageTarget = QDir(i.imageFolder).filePath(QFileInfo(input).completeBaseName() + QStringLiteral("-veyra.png"));
- i.imageStatus = tr("正在处理 %1 / %2:%3").arg(i.imageIndex + 1).arg(i.imageFiles.size()).arg(QFileInfo(input).fileName());
- emit imageBatchChanged();
- if (!QFileInfo(input).isFile()) { fail(tr("文件不存在")); return; }
- if (QFileInfo::exists(i.imageTarget)) { fail(tr("输出已存在,不覆盖")); return; }
- openPath(input);
- i.imageSession = i.openingSessionId ? i.openingSessionId : UINT64_MAX;
- i.imageWaits = 0;
- return;
- }
- ++i.imageWaits;
- if (i.imagePhase == Impl::ImagePhase::Opening) {
- if (s.sessionId == i.imageSession && s.failed) { fail(tr("无法打开")); return; }
- if (s.sessionId == i.imageSession && s.image && s.frames > 0 && !applying()) {
- impl_->engine.saveFrame(wideOf(QDir::toNativeSeparators(i.imageTarget)));
- i.imagePhase = Impl::ImagePhase::Saving; i.imageWaits = 0;
- } else if (i.imageWaits > 60 * 20) { fail(tr("打开超时")); }
- return;
- }
- // Saving: the engine writes on its own thread; HDR output becomes .jxr.
- QString written = i.imageTarget;
- if (!QFileInfo(written).isFile()) written = QFileInfo(i.imageTarget).path() + QLatin1Char('/') + QFileInfo(i.imageTarget).completeBaseName() + QStringLiteral(".jxr");
- if (QFileInfo(written).isFile() && QFileInfo(written).size() > 0 && s.status.find(L"已保存")!=std::wstring::npos && exportFileClosed(written)) {
- ++i.imageDone;
- veyra::log::info("image-batch", std::format("saved index={} path={}", i.imageIndex, written.toStdString()));
- i.imagePhase = Impl::ImagePhase::Opening; i.imageSession = 0;
- emit imageBatchChanged();
- } else if (i.imageWaits > 60 * 15) {
- fail(tr("保存超时"));
- }
-}
-
-// --- subtitles (P4-c) --------------------------------------------------------
-namespace {
-const wchar_t* const kSubtitleFonts[] = {L"Microsoft YaHei UI", L"SimHei", L"SimSun", L"DengXian", L"Arial", L"Segoe UI"};
-bool subtitleIsChinese(const engine::SubtitleTrack& t) {
- const auto has = [](const std::wstring& s, const wchar_t* k) { return s.find(k) != std::wstring::npos; };
- return has(t.language, L"chi") || has(t.language, L"zho") || has(t.language, L"zh") || has(t.name, L"中") ||
- has(t.name, L"简") || has(t.name, L"繁");
-}
-void ensureGdiplus() {
- static ULONG_PTR token = 0;
- if (token) return;
- Gdiplus::GdiplusStartupInput input;
- if (Gdiplus::GdiplusStartup(&token, &input, nullptr) != Gdiplus::Ok) token = 0;
-}
-}
-void QmlPlayerBridge::refreshSubtitles(const std::wstring& media) {
- auto& i = *impl_;
- i.subTracks.clear(); i.subExternal = i.subLoaded = 0;
- i.subPrimary = i.subSecondary = -1; i.subPrimaryChosen = i.subSecondaryChosen = false;
- i.subStatus=QFileInfo(QString::fromStdWString(media)).isFile()?tr("正在读取字幕"):QString{}; i.subMedia = media;
- if(i.subFileLoader)i.subFileGeneration=i.subFileLoader->requestFile(L"");
- i.subFilePath.clear();
- if (i.subAlignWorker.joinable()) { i.subAlignWorker.request_stop(); i.subAlignWorker = {}; }
- i.subAligning = false; i.subAlignReady = false;
- if (!i.subLoader) i.subLoader = std::make_unique<engine::SubtitleLoader>();
- // A file on a server is scanned only while playback has its buffer (#48): a second reader
- // that takes the same share's bandwidth would starve the picture it is meant to subtitle.
- const bool server = !media.empty() && engine::subtitleServerFile(media);
- i.subScanGate = server ? std::make_shared<std::atomic<bool>>(false) : nullptr;
- i.subScanOpen = false;
- i.subLoader->setReadGate(i.subScanGate);
- if (server) i.subStatus = tr("字幕将在视频缓冲好后读取");
- i.subGeneration = i.subLoader->request(media);
- emit subtitlesChanged();
-}
-void QmlPlayerBridge::tickSubtitles() {
- auto& i = *impl_;
- bool changed = false;
- if (i.subScanGate) {
- // Opens once playback holds a few seconds ahead (or has read the whole file), closes when
- // it runs short, and never opens for a server too slow for the stream itself.
- const auto& n = i.snapshot.network;
- const bool ended = n.active && n.state == media::NetworkStats::State::Ended;
- const bool healthy = n.active && !n.bandwidthLow && n.state == media::NetworkStats::State::Playing;
- const bool open = i.subScanOpen ? (ended || (healthy && n.bufferedSeconds >= 1.0))
- : (ended || (healthy && n.bufferedSeconds >= 3.0));
- if (open != i.subScanOpen) {
- i.subScanOpen = open;
- i.subScanGate->store(open);
- veyra::log::info("subtitle", std::format("server scan gate {} (buffer {:.1f}s)", open ? "open" : "closed", n.bufferedSeconds));
- if (open && i.subStatus == tr("字幕将在视频缓冲好后读取")) { i.subStatus = tr("正在读取字幕"); changed = true; }
- }
- }
- if (i.subLoader) {
- if (auto result = i.subLoader->poll(); result && result->generation == i.subGeneration) {
- // Replace the loader's tracks, keep user-loaded files and per-track offsets.
- const size_t count = result->tracks.size();
- for (size_t k = 0; k < std::min(i.subLoaded, count); ++k)
- result->tracks[k].offsetMs = i.subTracks[i.subExternal + k].offsetMs;
- i.subTracks.erase(i.subTracks.begin() + std::ptrdiff_t(i.subExternal),
- i.subTracks.begin() + std::ptrdiff_t(i.subExternal + i.subLoaded));
- i.subTracks.insert(i.subTracks.begin() + std::ptrdiff_t(i.subExternal),
- std::make_move_iterator(result->tracks.begin()), std::make_move_iterator(result->tracks.end()));
- i.subLoaded = count;
- if(result->complete&&(i.subStatus==tr("正在读取字幕")||i.subStatus==tr("字幕将在视频缓冲好后读取")))i.subStatus.clear();
- int firstUsable = -1, firstChinese = -1;
- for (size_t k = 0; k < i.subTracks.size(); ++k) {
- if (!i.subTracks[k].usable()) continue;
- if (firstUsable < 0) firstUsable = int(k);
- if (firstChinese < 0 && subtitleIsChinese(i.subTracks[k])) firstChinese = int(k);
- }
- if (!i.subPrimaryChosen) i.subPrimary = firstChinese >= 0 ? firstChinese : firstUsable;
- if (!i.subSecondaryChosen && i.prefBool("subtitleSecondLanguage", false)) {
- int candidate = -1;
- for (size_t k = 0; k < i.subTracks.size(); ++k)
- if (i.subTracks[k].usable() && int(k) != i.subPrimary) { candidate = int(k); break; }
- i.subSecondary = candidate;
- }
- if (result->complete)
- for (const auto& t : i.subTracks)
- veyra::log::info("subtitle", std::format("track name={} codec={} embedded={} cues={} usable={}",
- QString::fromStdWString(t.name).toStdString(), QString::fromStdWString(t.codec).toStdString(),
- t.embedded ? 1 : 0, t.cues.size(), t.usable() ? 1 : 0));
- veyra::log::info("subtitle", std::format("tracks={} primary={} secondary={}", i.subTracks.size(), i.subPrimary, i.subSecondary));
- changed = true;
- }
- }
- if(i.subFileLoader){
- if(auto result=i.subFileLoader->poll();result&&result->generation==i.subFileGeneration&&result->complete&&!i.subFilePath.empty()){
- const auto file=QFileInfo(QString::fromStdWString(i.subFilePath)).fileName();
- i.subFilePath.clear();
- const bool usable=std::any_of(result->tracks.begin(),result->tracks.end(),[](const auto& t){return t.usable();});
- if(!usable){
- const auto detail=result->tracks.empty()?tr("文件格式不支持、数据损坏或没有字幕内容"):uiText(result->tracks.front().note);
- i.subStatus=tr("外部字幕加载失败:%1 · %2").arg(file,detail);
- emit notice(i.subStatus,true);
- }else{
- const int added=int(result->tracks.size());
- int first=0;
- while(!result->tracks[size_t(first)].usable())++first;
- i.subTracks.insert(i.subTracks.begin(),std::make_move_iterator(result->tracks.begin()),std::make_move_iterator(result->tracks.end()));
- i.subExternal+=size_t(added);
- if(i.subSecondary>=0)i.subSecondary+=added;
- if(i.subAlignTrack>=0)i.subAlignTrack+=added;
- i.subPrimary=first;i.subPrimaryChosen=true;
- i.subStatus=tr("已加载外部字幕:%1").arg(file);
- veyra::log::info("subtitle",std::format("external loaded tracks={} file={}",added,file.toStdString()));
- }
- changed=true;
- }
- }
- if (i.subAlignReady.exchange(false) && i.subAlignGeneration == i.subGeneration &&
- i.subAlignTrack >= 0 && size_t(i.subAlignTrack) < i.subTracks.size()) {
- i.subTracks[size_t(i.subAlignTrack)].offsetMs = i.subAlignOffset.load();
- std::lock_guard lock(i.subAlignMutex);
- i.subStatus = tr("自动对齐:%1(Z/X 可微调)").arg(QString::fromStdWString(i.subAlignDetail));
- veyra::log::info("subtitle", std::format("auto align applied offsetMs={}", i.subAlignOffset.load()));
- changed = true;
- }
- if (i.subAligning.load() != (i.subStatus.startsWith(tr("正在自动对齐")))) changed = true;
- if (changed) emit subtitlesChanged();
-
- // Draw. The overlay is a layered child of the video window: it moves with the
- // picture and is clipped by the same window region as the video itself.
- if (!i.videoWindow || !IsWindow(i.videoWindow)) return;
- if (!i.subOverlay) {
- // A refused layered child (missing compatibility manifest, old OS) is
- // reported once; retrying every tick would only flood the log.
- if (i.subOverlayFailed) return;
- ensureGdiplus();
- i.subOverlay = createSubtitleOverlay(i.videoWindow);
- const DWORD error = i.subOverlay ? 0 : GetLastError();
- veyra::log::info("subtitle", std::format("overlay created ok={} err={}", i.subOverlay != nullptr, error));
- if (!i.subOverlay) { i.subOverlayFailed = true; return; }
- }
- RECT client{}; GetClientRect(i.videoWindow, &client);
- RECT current{}; GetClientRect(i.subOverlay, &current);
- if (current.right != client.right || current.bottom != client.bottom)
- SetWindowPos(i.subOverlay, HWND_TOP, 0, 0, client.right, client.bottom, SWP_NOACTIVATE);
- const auto& s = i.snapshot;
- std::vector<SubtitleLine> draw;
- const bool show = i.prefBool("subtitleEnabled", true) && (s.running && !s.image && !s.capture) && !i.subTracks.empty();
- if (show) {
- auto append = [&](int index, bool secondary) {
- if (index < 0 || size_t(index) >= i.subTracks.size()) return;
- const auto& track = i.subTracks[size_t(index)];
- if (!track.usable()) return;
- const double at = s.position + double(track.offsetMs) / 1000.0;
-#ifdef VEYRA_HAS_LIBASS
- if (track.ass) {
- // ASS/SSA: libass draws the whole script (effects, karaoke,
- // container fonts). The parsed text only feeds diagnostics.
- SubtitleLine line;
- line.ass = track.ass; line.assTimeMs = at * 1000.0; line.secondary = secondary;
- line.text = engine::textAt(track, at);
- draw.push_back(std::move(line));
- return;
- }
-#endif
- for (const auto* cue : engine::cuesAt(track, at, 3)) {
- SubtitleLine line;
- line.text = cue->text; line.bitmap = cue->bitmap;
- line.style = track.styles.empty() ? engine::SubtitleStyle{}
- : track.styles[size_t(std::clamp(cue->style, 0, int(track.styles.size()) - 1))];
- if (cue->alignOverride) line.style.alignment = cue->alignOverride;
- line.alignOverride = cue->alignOverride;
- line.posX = cue->posX >= 0 ? cue->posX / std::max(1.0, track.scriptWidth) : -1.0;
- line.posY = cue->posY >= 0 ? cue->posY / std::max(1.0, track.scriptHeight) : -1.0;
- line.secondary = secondary;
- // Outline level 0..3: none / thin / normal / thick, over the track's own width.
- const int outline = i.prefInt("subtitleOutline", 2);
- if (outline == 0) line.style.outlineWidth = 0;
- else if (line.style.outlineWidth <= 0) line.style.outlineWidth = outline == 1 ? 1.0 : outline == 2 ? 2.0 : 3.5;
- else line.style.outlineWidth *= outline == 1 ? 0.6 : outline == 3 ? 1.6 : 1.0;
- draw.push_back(std::move(line));
- }
- };
- append(i.subSecondary, true); // the painter stacks bottom-up
- append(i.subPrimary, false);
- }
- SubtitleView view;
- view.scale = double(i.prefInt("subtitleSize", 22)) / 22.0;
- const int font = i.prefInt("subtitleFont", 0);
- view.fontOverride = font > 0 ? std::wstring(kSubtitleFonts[std::clamp(font, 0, 5)]) : std::wstring{};
- view.outline = i.prefInt("subtitleOutline", 2) > 0;
- view.background = i.prefBool("subtitleBackground", false);
- view.bottomMargin = i.prefInt("subtitleMargin", 0) + i.subBottomInset;
- view.targetLines = i.prefInt("subtitleLines", 2);
- view.fitToLines = i.prefBool("subtitleFit", false);
- view.preview = i.engine.previewView();
- view.videoWidth = s.metrics.resolution.output.width;
- view.videoHeight = s.metrics.resolution.output.height;
- updateSubtitleOverlay(i.subOverlay, draw, view);
- QString joined;
- for (const auto& line : draw) { if (line.text.empty()) continue; if (!joined.isEmpty()) joined += QStringLiteral(" | "); joined += QString::fromStdWString(line.text); }
- if (joined != i.subText) {
- i.subText = joined;
- if (!joined.isEmpty()) veyra::log::info("subtitle-overlay", "text=" + joined.toStdString());
- emit subtitleTextChanged();
- }
-}
-QVariantList QmlPlayerBridge::subtitleTracks() const {
- QVariantList out;
- for (size_t k = 0; k < impl_->subTracks.size(); ++k) {
- const auto& t = impl_->subTracks[k];
- QString label = QString::fromStdWString(t.name);
- if (label.isEmpty()) label = QString::fromStdWString(t.language);
- if (label.isEmpty()) label = tr("字幕 %1").arg(k + 1);
- QString note = t.embedded ? tr("内嵌") : tr("外挂");
- if (!t.codec.empty()) note += QStringLiteral(" · ") + QString::fromStdWString(t.codec).toUpper();
- if (!t.note.empty()) note += QStringLiteral(" · ") + uiText(t.note);
- else if(!t.usable()) note += QStringLiteral(" · ") + tr("未解码出可显示的字幕");
- out << QVariantMap{{"index", int(k)}, {"label", label}, {"note", note}, {"usable", t.usable()},
- {"embedded", t.embedded}, {"cues", int(t.cues.size())}, {"offsetMs", t.offsetMs}};
- }
- return out;
-}
-int QmlPlayerBridge::subtitlePrimary() const { return impl_->subPrimary; }
-void QmlPlayerBridge::setSubtitlePrimary(int index) {
- if (index < -1 || index >= int(impl_->subTracks.size())) return;
- if (index >= 0 && !impl_->subTracks[size_t(index)].usable()) { emit notice(tr("该字幕轨没有可显示的内容"), true); return; }
- impl_->subPrimaryChosen = true;
- if (impl_->subPrimary == index) return;
- impl_->subPrimary = index;
- if (impl_->subSecondary == index) impl_->subSecondary = -1;
- veyra::log::info("subtitle", std::format("primary={} secondary={}", impl_->subPrimary, impl_->subSecondary));
- emit subtitlesChanged();
-}
-int QmlPlayerBridge::subtitleSecondary() const { return impl_->subSecondary; }
-void QmlPlayerBridge::setSubtitleSecondary(int index) {
- if (index < -1 || index >= int(impl_->subTracks.size())) return;
- if (index >= 0 && (!impl_->subTracks[size_t(index)].usable() || index == impl_->subPrimary)) return;
- impl_->subSecondaryChosen = true;
- if (impl_->subSecondary == index) return;
- impl_->subSecondary = index;
- veyra::log::info("subtitle", std::format("primary={} secondary={}", impl_->subPrimary, impl_->subSecondary));
- emit subtitlesChanged();
-}
-int QmlPlayerBridge::subtitleOffsetMs() const {
- const int p = impl_->subPrimary;
- return p >= 0 && size_t(p) < impl_->subTracks.size() ? impl_->subTracks[size_t(p)].offsetMs : 0;
-}
-void QmlPlayerBridge::setSubtitleOffsetMs(int ms) {
- const int p = impl_->subPrimary;
- if (p < 0 || size_t(p) >= impl_->subTracks.size()) return;
- auto& track = impl_->subTracks[size_t(p)];
- ms = std::clamp(ms, -30000, 30000);
- if (track.offsetMs == ms) return;
- track.offsetMs = ms;
- impl_->subStatus = tr("字幕延时 %1 ms").arg(ms);
- veyra::log::info("subtitle", std::format("offset track={} offsetMs={}", p, ms));
- emit subtitlesChanged();
-}
-QString QmlPlayerBridge::subtitleStatus() const { return impl_->subStatus; }
-bool QmlPlayerBridge::subtitleAligning() const { return impl_->subAligning.load(); }
-QString QmlPlayerBridge::subtitleText() const { return impl_->subText; }
-int QmlPlayerBridge::subtitleBottomInset() const { return impl_->subBottomInset; }
-void QmlPlayerBridge::setSubtitleBottomInset(int value) {
- value = std::clamp(value, 0, 400);
- if (impl_->subBottomInset == value) return;
- impl_->subBottomInset = value;
- emit subtitlesChanged();
-}
-void QmlPlayerBridge::loadSubtitleDialog() {
- const QString start = impl_->subMedia.empty() ? QString() : QFileInfo(QString::fromStdWString(impl_->subMedia)).absolutePath();
- const QString path = QFileDialog::getOpenFileName(nullptr, tr("加载外部字幕"), start,
- tr("字幕文件 (*.srt *.ass *.ssa *.vtt *.sup *.pgs *.idx *.sub *.smi *.sami *.sbv *.mpl *.stl *.txt);;所有文件 (*.*)"));
- if (!path.isEmpty()) loadSubtitleFile(path);
-}
-bool QmlPlayerBridge::loadSubtitleFile(const QString& path) {
- if(!QFileInfo(path).isFile()){
- emit notice(tr("字幕文件不存在或无法读取"),true);
- return false;
- }
- if(!impl_->subFileLoader)impl_->subFileLoader=std::make_unique<engine::SubtitleLoader>();
- impl_->subFilePath=wideOf(path);
- impl_->subFileGeneration=impl_->subFileLoader->requestFile(impl_->subFilePath);
- impl_->subStatus=tr("正在加载外部字幕:%1").arg(QFileInfo(path).fileName());
- emit subtitlesChanged();
- return true;
-}
-void QmlPlayerBridge::nudgeSubtitle(int deltaMs) {
- if (impl_->subPrimary < 0) { emit notice(tr("没有正在显示的字幕"), true); return; }
- setSubtitleOffsetMs(subtitleOffsetMs() + deltaMs);
- emit notice(impl_->subStatus, false);
-}
-void QmlPlayerBridge::cycleSubtitle(bool secondary) {
- auto& i = *impl_;
- if (i.subTracks.empty()) { emit notice(tr("当前片源没有字幕"), true); return; }
- int slot = secondary ? i.subSecondary : i.subPrimary;
- for (size_t n = 0; n <= i.subTracks.size(); ++n) { // -1 -> 0 -> ... -> -1, skipping unusable
- slot = slot + 1 >= int(i.subTracks.size()) ? -1 : slot + 1;
- if (slot < 0 || (i.subTracks[size_t(slot)].usable() && !(secondary && slot == i.subPrimary))) break;
- }
- if (secondary) setSubtitleSecondary(slot); else setSubtitlePrimary(slot);
- const int now = secondary ? i.subSecondary : i.subPrimary;
- emit notice(now < 0 ? (secondary ? tr("副字幕已关闭") : tr("主字幕已关闭"))
- : (secondary ? tr("副字幕:%1") : tr("主字幕:%1")).arg(subtitleTracks()[now].toMap().value("label").toString()), false);
-}
-void QmlPlayerBridge::toggleSubtitles() {
- const bool on = !impl_->prefBool("subtitleEnabled", true);
- setPreference(QStringLiteral("subtitleEnabled"), on);
- emit notice(on ? tr("字幕:开") : tr("字幕:关"), false);
-}
-void QmlPlayerBridge::autoAlignSubtitle() {
- auto& i = *impl_;
- if (i.subAligning.load()) { emit notice(tr("已有一个自动对齐在进行"), true); return; }
- if (i.subMedia.empty() || i.subPrimary < 0 || !i.subTracks[size_t(i.subPrimary)].usable()) {
- emit notice(tr("没有可用的主字幕,无法自动对齐"), true); return;
- }
- const std::wstring media = i.subMedia;
- const auto track = i.subTracks[size_t(i.subPrimary)];
- i.subAlignGeneration = i.subGeneration; i.subAlignTrack = i.subPrimary;
- i.subAligning = true; i.subAlignReady = false;
- i.subStatus = tr("正在自动对齐:分析音轨(最多前 30 分钟)…");
- emit subtitlesChanged();
- i.subAlignWorker = std::jthread([&i, media, track](std::stop_token stop) {
- const auto result = engine::alignSubtitleToAudio(media, track, 30, stop);
- if (stop.stop_requested()) { i.subAligning = false; return; }
- { std::lock_guard lock(i.subAlignMutex); i.subAlignDetail = result.detail; }
- i.subAlignOffset = result.ok ? result.offsetMs : 0;
- i.subAlignReady = result.ok;
- i.subAligning = false;
- });
-}
-
-void QmlPlayerBridge::attachVideoWindow(qulonglong nativeHandle) {
- impl_->videoWindow = reinterpret_cast<HWND>(nativeHandle);
-}
-
-void QmlPlayerBridge::setPreOpenHook(std::function<void()> hook) {
- impl_->preOpen = std::move(hook);
-}
-
-QString QmlPlayerBridge::appName() const { return QStringLiteral("Veyra"); }
-QString QmlPlayerBridge::version() const { return QStringLiteral(VEYRA_DISPLAY_VERSION); }
-
-// --- playback ---------------------------------------------------------------
-QString QmlPlayerBridge::statusText() const { return uiText(impl_->snapshot.status); }
-bool QmlPlayerBridge::running() const { return impl_->snapshot.running; }
-bool QmlPlayerBridge::paused() const { return impl_->snapshot.transport == engine::TransportState::Paused; }
-bool QmlPlayerBridge::failed() const { return impl_->snapshot.failed; }
-bool QmlPlayerBridge::isImage() const { return impl_->snapshot.image; }
-bool QmlPlayerBridge::isCapture() const { return impl_->snapshot.capture; }
-bool QmlPlayerBridge::hasSource() const { return impl_->snapshot.running || impl_->snapshot.image; }
-bool QmlPlayerBridge::openingSource() const { return impl_->openingSource; }
-double QmlPlayerBridge::position() const { return impl_->snapshot.position; }
-double QmlPlayerBridge::duration() const { return impl_->snapshot.duration; }
-double QmlPlayerBridge::progress() const {
- const double d = impl_->snapshot.duration;
- return d > 0.01 ? std::clamp(impl_->snapshot.position / d, 0.0, 1.0) : 0.0;
-}
-QString QmlPlayerBridge::positionText() const { return mmss(impl_->snapshot.position); }
-QString QmlPlayerBridge::durationText() const { return mmss(impl_->snapshot.duration); }
-
-// --- source -----------------------------------------------------------------
-QString QmlPlayerBridge::sourceName() const {
- if (impl_->sourceLabel.empty()) return QString();
- if(impl_->liveKind==QLatin1String("url"))return tr("网络视频 · %1").arg(impl_->liveLabel);
- return QFileInfo(utf8Of(impl_->sourceLabel)).fileName();
-}
-QString QmlPlayerBridge::sourceSummary() const {
- const auto& s = impl_->snapshot;
- if (!s.sourceWidth) return QString();
- // Reported values only: no upscaling claim, no invented bit depth.
- return QStringLiteral("%1x%2").arg(s.sourceWidth).arg(s.sourceHeight);
-}
-int QmlPlayerBridge::sourceWidth() const { return int(impl_->snapshot.sourceWidth); }
-int QmlPlayerBridge::sourceHeight() const { return int(impl_->snapshot.sourceHeight); }
-double QmlPlayerBridge::sourceFps() const { return impl_->snapshot.nominalSourceFps; }
-int QmlPlayerBridge::sourceRotation() const { return impl_->snapshot.sourceRotationDegrees; }
-int QmlPlayerBridge::previewRotation() const { return int(impl_->engine.previewView().userQuarterTurns)*90; }
-void QmlPlayerBridge::rotatePictureClockwise() {
- if(!hasSource()||!impl_->engine.rotatePreviewClockwise(impl_->snapshot.sessionId))return;
- // An in-progress protection selection uses the previous coordinate system.
- beginProtectionDraw(QString());
- tickSubtitles();
- if(gameMode()){updateGameGeometry();updateGameMode();emit gameModeChanged();}
- veyra::log::info("ui-rotation",std::format("session={} clockwise={}",impl_->snapshot.sessionId,previewRotation()));
- emit compareChanged();
-}
-double QmlPlayerBridge::sourceAspect() const {
- const auto& s = impl_->snapshot;
- // A known DAR already includes SAR/rotation. With no DAR, rotate the coded
- // extent as the presenter does; phone files can omit SAR yet carry a matrix.
- engine::PreviewView view;
- view.displayAspect=s.sourceDisplayAspect;
- view.rotationDegrees=s.sourceRotationDegrees;
- return view.aspect(float(s.sourceWidth),float(s.sourceHeight));
-}
-
-// --- live performance -------------------------------------------------------
-// XeSS generates inside the provider: the engine only submits source frames,
-// so its own rate would read 60 while the SDK presents 120. Show the provider's
-// reported submissions for XeSS (AppShell: "SDK提交(非屏幕实测)").
-static bool xessPresenting(const engine::PlayerSnapshot& s) {
- return s.fgActive && s.applied.frameGenerationBackend == engine::FrameGenerationBackend::XeSS &&
- s.metrics.flow.xessSdkSubmitFps > 0;
-}
-double QmlPlayerBridge::submitFps() const {
- const auto& s = impl_->snapshot;
- return xessPresenting(s) ? s.metrics.flow.xessSdkSubmitFps : s.submissionFps.value_or(0.0);
-}
-bool QmlPlayerBridge::submitFpsKnown() const { return xessPresenting(impl_->snapshot) || impl_->snapshot.submissionFps.has_value(); }
-QString QmlPlayerBridge::submitFpsLabel() const { return xessPresenting(impl_->snapshot) ? tr("SDK 提交") : tr("提交"); }
-double QmlPlayerBridge::lateMs() const { return impl_->snapshot.lateMs; }
-double QmlPlayerBridge::lateP95Ms() const { return impl_->snapshot.lateP95Ms; }
-QString QmlPlayerBridge::metricsSummary() const {
- const auto& s = impl_->snapshot;
- // Submit FPS, named as such: it is what we handed to the presenter, not what
- // the panel scanned out. There is no "display FPS" because we cannot measure
- // one, and a number we did not measure must not be shown as if we had.
- if (!s.submissionFps) return tr("未测量");
- return tr("提交 %1").arg(*s.submissionFps, 0, 'f', 1);
-}
-bool QmlPlayerBridge::nrActive() const { return impl_->snapshot.nrActive; }
-bool QmlPlayerBridge::nrAutoActive() const {return impl_->snapshot.nrAutoActive;}
-int QmlPlayerBridge::nrAutoPercent() const {return int(impl_->snapshot.nrAutoPercent);}
-QString QmlPlayerBridge::nrAutoStatus() const {
- const auto& s=impl_->snapshot;
- if(s.nrAutoActive)return tr("NR 自动 %1% · %2×%3").arg(s.nrAutoPercent).arg(s.nrAutoWidth).arg(s.nrAutoHeight);
- if(s.nrAutoStatus==L"自动NR实例池不可用,保留1080p NR")return tr("自动 NR 实例池不可用,保留固定 1080p 档");
- if(!s.nrAutoStatus.empty())return tr("当前配置未启用自动 NR,保留固定 1080p 档");
- return {};
-}
-bool QmlPlayerBridge::srActive() const { return impl_->snapshot.srActive; }
-bool QmlPlayerBridge::fgActive() const { return impl_->snapshot.fgActive; }
-bool QmlPlayerBridge::captureRecovering() const { return impl_->snapshot.captureRecovering; }
-double QmlPlayerBridge::captureFps() const { return impl_->snapshot.captureFps; }
-double QmlPlayerBridge::captureDropped() const { return double(impl_->snapshot.captureDropped); }
-QString QmlPlayerBridge::backendWarning() const { return uiText(impl_->snapshot.backendWarning); }
-
-// --- settings ---------------------------------------------------------------
-
-#define VEYRA_BOOL_PROP(getter, setter, member) \
- bool QmlPlayerBridge::getter() const { return settings().member; } \
- void QmlPlayerBridge::setter(bool value) { \
- auto s = settings(); \
- if (s.member == value) return; \
- s.member = value; \
- impl_->commit(std::move(s)); \
- emit settingsChanged(); \
- }
-#define VEYRA_NUM_PROP(getter, setter, member, type) \
- type QmlPlayerBridge::getter() const { return type(settings().member); } \
- void QmlPlayerBridge::setter(type value) { \
- auto s = settings(); \
- if (type(s.member) == value) return; \
- s.member = value; \
- impl_->commit(std::move(s)); \
- emit settingsChanged(); \
- }
-
-int QmlPlayerBridge::videoSrQuality() const { return int(settings().videoSrQuality); }
-int QmlPlayerBridge::dlssSrModel() const { return int(settings().dlssSrModel); }
-QVariantList QmlPlayerBridge::dlssSrModelChoices() const {
- return {QVariantMap{{"id", "0"}, {"label", "DLSS 4 · K"}},
- QVariantMap{{"id", "1"}, {"label", "DLSS 4.5 · M"}},
- QVariantMap{{"id", "2"}, {"label", "DLSS 4.5 · L"}}};
-}
-void QmlPlayerBridge::setDlssSrModel(int value) {
- if (value < 0 || unsigned(value) >= engine::kDlssSrModelCount) return;
- const auto cap = effectCapabilities().value("sr0").toMap();
- if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return; }
- auto s = settings();
- if (s.dlssSrModel == unsigned(value)) return;
- s.dlssSrModel = unsigned(value);
- if (impl_->commit(s)) emit settingsChanged();
-}
-void QmlPlayerBridge::setVideoSrQuality(int value) {
- if (value < 0 || value > 5) return;
- const auto cap = effectCapabilities().value("sr" + QString::number(value)).toMap();
- if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return; }
- auto s = settings();
- if (int(s.videoSrQuality) == value) return;
- s.videoSrQuality = unsigned(value);
- if (impl_->commit(s)) emit settingsChanged();
-}
-int QmlPlayerBridge::audioOffsetMs() const { return settings().audioOffsetMs; }
-void QmlPlayerBridge::setAudioOffsetMs(int value) {
- auto s = settings();
- if (s.audioOffsetMs == value) return;
- s.audioOffsetMs = value;
- if (!impl_->commit(std::move(s))) return;
- impl_->prefs[QStringLiteral("audioOffsetMs")] = value;
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "audio offset not saved");
- emit settingsChanged();
-}
-#undef VEYRA_BOOL_PROP
-#undef VEYRA_NUM_PROP
-
-// Stage-owned properties must change the authoritative chain first. commit()
-// projects that chain back to settings, so setting only a flat mirror is a no-op.
-bool QmlPlayerBridge::srEnabled() const {
- const auto* node = impl_->chain.firstOf(engine::EffectType::SuperResolution);
- return node && node->enabled;
-}
-void QmlPlayerBridge::setSrEnabled(bool enabled) {
- for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
- if (impl_->chain.nodes[i].type == engine::EffectType::SuperResolution) {
- setEffectEnabled(int(i), enabled); return;
- }
- if (enabled) emit notice(tr("请先添加超分节点"), true);
-}
-bool QmlPlayerBridge::videoHdr() const {
- const auto* node = impl_->chain.firstOf(engine::EffectType::VideoHdr);
- return node && node->enabled;
-}
-// Custom: static HDR output tuning. Globals, not chain nodes, and every field is
-// live (the curve is read by the present blit, the metadata sent to the display),
-// so a change never rebuilds the graph - but it does have to reach the session
-// file, which has no other trigger for a global change.
-int QmlPlayerBridge::hdrCurveStrength()const{return int(settings().hdrCurve.strengthPercent);}
-void QmlPlayerBridge::setHdrCurveStrength(int percent){
- auto s=settings();
- const unsigned clamped=unsigned(std::clamp(percent,0,200));
- if(s.hdrCurve.strengthPercent==clamped)return;
- s.hdrCurve.strengthPercent=clamped;
- commitHdrTuning(std::move(s));
-}
-int QmlPlayerBridge::hdrDisplayPeakNits()const{return int(settings().hdrCurve.displayPeakNits);}
-void QmlPlayerBridge::setHdrDisplayPeakNits(int nits){
- auto s=settings();
- // 0 = ask the system; anything else has to be a plausible panel peak.
- const int clamped=nits<=0?0:std::clamp(nits,100,10000);
- if(s.hdrCurve.displayPeakNits==unsigned(clamped))return;
- s.hdrCurve.displayPeakNits=unsigned(clamped);
- commitHdrTuning(std::move(s));
-}
-QVariantMap QmlPlayerBridge::hdrDisplayInfo()const{
- // Read from QML bindings (the peak row's hint text), so no driver work here:
- // the values come from the shared display state, queried in the background on
- // events and 刷新显示器状态 (this used to build a DXGI factory every 5 s on the
- // UI thread).
- HWND window=impl_->videoWindow;
- if(!IsWindow(window)){
- if(auto* focused=QGuiApplication::focusWindow())window=reinterpret_cast<HWND>(focused->winId());
- else window=nullptr;
- }
- auto& displays=impl_->engine.displayStates();
- std::optional<engine::DisplayState> known;
- if(window){displays.request(window,"ui");known=displays.state(displays.monitorOf(window));}
- const engine::DisplayColorState c=known?known->color:engine::DisplayColorState{};
- return {{"valid",c.peakValid},{"plausible",c.peakValid},{"peakNits",int(c.peakNits)},
- {"fullFrameNits",int(c.fullFrameNits)},{"minNits",c.minNits}};
-}
-bool QmlPlayerBridge::hdrCurve()const{return settings().hdrCurve.enabled;}
-void QmlPlayerBridge::setHdrCurve(bool enabled){
- auto s=settings();if(s.hdrCurve.enabled==enabled)return;s.hdrCurve.enabled=enabled;
- commitHdrTuning(std::move(s));
-}
-QVariantMap QmlPlayerBridge::hdrCurveParams()const{
- const auto& c=settings().hdrCurve;
- return {{"shadowLiftEv100",int(c.shadowLiftEv100)},{"shadowRangeNits",int(c.shadowRangeNits)},
- {"midGrayNits",int(c.midGrayNits)},{"highlightStartNits",int(c.highlightStartNits)},
- {"rollOffPercent",int(c.rollOffPercent)},{"peakCapNits",int(c.peakCapNits)}};
-}
-bool QmlPlayerBridge::setHdrCurveParameter(const QString& key,double value){
- if(!std::isfinite(value)||value<-10001||value>10001)return false;
- auto s=settings();const auto v=int(std::lround(value));
- if(key=="shadowLiftEv100"){if(v<-200||v>200)return false;s.hdrCurve.shadowLiftEv100=v;}
- else if(key=="shadowRangeNits"){if(v<1||v>100)return false;s.hdrCurve.shadowRangeNits=unsigned(v);}
- else if(key=="midGrayNits"){if(v<100||v>500)return false;s.hdrCurve.midGrayNits=unsigned(v);}
- else if(key=="highlightStartNits"){if(v<0||v>2000)return false;s.hdrCurve.highlightStartNits=unsigned(v);}
- else if(key=="rollOffPercent"){if(v<10||v>200)return false;s.hdrCurve.rollOffPercent=unsigned(v);}
- else if(key=="peakCapNits"){if(v<0||v>4000)return false;s.hdrCurve.peakCapNits=unsigned(v);}
- else return false;
- if(!s.hdrCurve.valid())return false;
- return commitHdrTuning(std::move(s));
-}
-bool QmlPlayerBridge::commitHdrTuning(engine::EnhancementSettings settings){
- const bool wasValid=chainValid();
- const auto curve=settings.hdrCurve;
- const auto metadata=settings.hdrMetadata;
- if(!impl_->commit(std::move(settings)))return false;
- // Re-project first, then re-assert both copies the session capture reads:
- // revalidate() rewrites the pending settings and the draft globals from the
- // runtime configuration, which does not carry this block yet.
- impl_->revalidate(true);
- auto after=impl_->facade.pendingSettings();
- after.hdrCurve=curve;after.hdrMetadata=metadata;
- impl_->facade.setPending(after);
- impl_->draftGlobals.hdrCurve=curve;impl_->draftGlobals.hdrMetadata=metadata;
- impl_->persistSession();
- if(!impl_->hdrRestoring&&impl_->hdrMemorySaveTimer){impl_->hdrMemoryDirty=true;impl_->hdrMemorySaveTimer->start();}
- emit settingsChanged();
- if(chainValid()!=wasValid)emitChainChanged();
- return true;
-}
-QString QmlPlayerBridge::hdrTuningPreset() const {
- const auto& s=settings();
- // hdrPresetMatches deliberately ignores the strength dial and the display peak:
- // they only scale the baseline, so turning them keeps you on the same preset.
- for(const auto& p:engine::kHdrTuningPresets)
- if(engine::hdrPresetMatches(s.hdrCurve,s.hdrMetadata,p))return QString::fromLatin1(p.id);
- return QStringLiteral("custom");
-}
-QString QmlPlayerBridge::hdrAppliedFrom() const {
- return impl_->prefString("hdrAppliedFrom")==QLatin1String("axes")?QStringLiteral("axes")
- :QStringLiteral("legacy");
-}
-
-void QmlPlayerBridge::setHdrAppliedFrom(const QString& from){
- const QString wanted=from==QLatin1String("axes")?QStringLiteral("axes"):QStringLiteral("legacy");
- if(impl_->prefString("hdrAppliedFrom")==wanted)return;
- impl_->prefs[QStringLiteral("hdrAppliedFrom")]=wanted;
- impl_->savePrefs();
- emit preferencesChanged();
-}
-
-QString QmlPlayerBridge::hdrPresetMode() const {
- return impl_->prefString("hdrPresetMode")==QLatin1String("axes")?QStringLiteral("axes")
- :QStringLiteral("legacy");
-}
-
-void QmlPlayerBridge::setHdrPresetMode(const QString& mode){
- const QString wanted=mode==QLatin1String("axes")?QStringLiteral("axes"):QStringLiteral("legacy");
- if(impl_->prefString("hdrPresetMode")==wanted)return;
- impl_->prefs[QStringLiteral("hdrPresetMode")]=wanted;
- if(!impl_->savePrefs())veyra::log::warn("ui-prefs","hdr preset mode not saved");
- emit preferencesChanged();
-}
-
-QVariantMap QmlPlayerBridge::hdrAxes() const {
- auto environment=impl_->prefString("hdrAxesEnvironment");
- if(environment==QLatin1String("bright"))environment=QStringLiteral("compensate");
- else if(environment==QLatin1String("dark"))environment=QStringLiteral("plain");
- return {{"content",impl_->prefString("hdrAxesContent")},
- {"environment",environment}};
-}
-
-QVariantMap QmlPlayerBridge::hdrAxesMatch() const {
- // Which combination the curve currently equals. Strength and the display peak are
- // ignored, exactly like hdrPresetMatches: they only scale the baseline.
- const auto& c=settings().hdrCurve;
- for(const auto& content:engine::kHdrContentPresets)
- for(const auto* environment:engine::kHdrEnvironmentIds){
- const auto candidate=engine::hdrAxesCurve(content.id,environment);
- if(c.enabled==candidate.enabled&&c.shadowLiftEv100==candidate.shadowLiftEv100&&
- c.shadowRangeNits==candidate.shadowRangeNits&&c.midGrayNits==candidate.midGrayNits&&
- c.highlightStartNits==candidate.highlightStartNits&&c.rollOffPercent==candidate.rollOffPercent&&
- c.peakCapNits==candidate.peakCapNits)
- return {{"content",QString::fromLatin1(content.id)},{"environment",QString::fromLatin1(environment)}};
- }
- return {{"content",QString()},{"environment",QString()}};
-}
-
-QVariantMap QmlPlayerBridge::hdrCurveCoverage() const {
- const auto& snap=impl_->snapshot;
- return {{"valid",impl_->hdrCoverageObserved&&hdrCurve()&&snap.hdrCoverageValid},
- {"aboveCeiling",snap.hdrAboveCeilingPercent},
- {"rollOff",snap.hdrInRollOffPercent},
- {"lift",snap.hdrInLiftPercent}};
-}
-
-void QmlPlayerBridge::observeHdrCoverage(bool on){if(impl_->hdrCoverageObserved==on)return;impl_->hdrCoverageObserved=on;impl_->engine.observeHdrCoverage(on);emit snapshotChanged();}
-QVariantMap QmlPlayerBridge::hdrCurveGraph() const {
- auto base=settings().hdrCurve;if(!base.displayPeakNits)base.displayPeakNits=effectiveHdrDisplayPeakNits();
- engine::HdrCurveSettings c;engine::HdrMetadataSettings metadata;
- engine::resolveHdrTuning(base,settings().hdrMetadata,c,metadata);
- QVariantList inputs,outputs;
- for(unsigned i=0;i<engine::kHdrCurveGraphPoints;++i){
- const double x=engine::hdrCurveGraphInputNits(i);
- inputs.append(x);
- outputs.append(c.enabled?engine::hdrCurveLuminance(c,x):x);
- }
- return {{"inputs",inputs},{"outputs",outputs},
- {"minNits",engine::kHdrCurveGraphMinNits},{"maxNits",engine::kHdrCurveGraphMaxNits},
- {"enabled",c.enabled}};
-}
-
-QVariantMap QmlPlayerBridge::hdrDials() const {
- const auto& c=settings().hdrCurve;
- return {{"shadowLift",int(engine::hdrShadowLiftLevel(c))},
- {"brightness",int(engine::hdrBrightnessLevel(c))},
- {"highlight",int(engine::hdrHighlightLevel(c))}};
-}
-
-bool QmlPlayerBridge::setHdrDial(const QString& key,int level){
- if(level<0)return false;
- auto s=settings();
- const unsigned value=unsigned(level);
- if(key==QLatin1String("shadowLift"))engine::setHdrShadowLiftLevel(s.hdrCurve,value);
- else if(key==QLatin1String("brightness"))engine::setHdrBrightnessLevel(s.hdrCurve,value);
- else if(key==QLatin1String("highlight"))engine::setHdrHighlightLevel(s.hdrCurve,value);
- else return false;
- return commitHdrTuning(std::move(s));
-}
-
-bool QmlPlayerBridge::applyHdrAxesPreset(const QString& content,const QString& environment){
- const QByteArray contentId=content.toUtf8();
- const QString normalizedEnvironment=environment==QLatin1String("bright")?QStringLiteral("compensate")
- :environment==QLatin1String("dark")?QStringLiteral("plain"):environment;
- const QByteArray environmentId=normalizedEnvironment.toUtf8();
- if(!engine::findHdrContentPreset(contentId.constData())||
- (normalizedEnvironment!=QLatin1String("compensate")&&normalizedEnvironment!=QLatin1String("plain")))return false;
- const auto curve=engine::hdrAxesCurve(contentId.constData(),environmentId.constData());
- auto s=settings();
- // The strength dial and the display peak belong to the user, not to the preset.
- const auto strength=s.hdrCurve.strengthPercent;
- const auto displayPeak=s.hdrCurve.displayPeakNits;
- s.hdrCurve=curve;
- s.hdrCurve.strengthPercent=strength;
- s.hdrCurve.displayPeakNits=displayPeak;
- if(!commitHdrTuning(std::move(s)))return false;
- setHdrAppliedFrom(QStringLiteral("axes"));
- impl_->prefs[QStringLiteral("hdrAxesContent")]=content;
- impl_->prefs[QStringLiteral("hdrAxesEnvironment")]=normalizedEnvironment;
- if(!impl_->savePrefs())veyra::log::warn("ui-prefs","hdr axes choice not saved");
- emit preferencesChanged();
- return true;
-}
-
-bool QmlPlayerBridge::hdrTitleMemory() const { return impl_->prefBool("hdrTitleMemory",true); }
-bool QmlPlayerBridge::hdrAutoRecommend() const { return impl_->prefBool("hdrAutoRecommend",false); }
-int QmlPlayerBridge::hdrTitleCount() const {
- return impl_->prefs.value(QStringLiteral("hdrTitles")).toList().size();
-}
-
-void QmlPlayerBridge::setHdrTitleMemory(bool on){
- if(impl_->prefBool("hdrTitleMemory",true)==on)return;
- impl_->prefs[QStringLiteral("hdrTitleMemory")]=on;
- if(!impl_->savePrefs())veyra::log::warn("ui-prefs","hdr title memory flag not saved");
- emit preferencesChanged();
-}
-
-void QmlPlayerBridge::setHdrAutoRecommend(bool on){
- if(impl_->prefBool("hdrAutoRecommend",false)==on)return;
- impl_->prefs[QStringLiteral("hdrAutoRecommend")]=on;
- if(!impl_->savePrefs())veyra::log::warn("ui-prefs","hdr auto recommend flag not saved");
- emit preferencesChanged();
-}
-
-void QmlPlayerBridge::forgetHdrTitles(){
- flushHdrMemory();
- impl_->prefs[QStringLiteral("hdrTitles")]=QVariantList{};
- if(!impl_->savePrefs())veyra::log::warn("ui-prefs","hdr title profiles not cleared");
- emit preferencesChanged();
- emit notice(tr("已清除影片记忆"),false);
-}
-
-void QmlPlayerBridge::flushHdrMemory(){
- if(impl_->hdrMemorySaveTimer)impl_->hdrMemorySaveTimer->stop();
- if(impl_->hdrRestoring||!impl_->hdrMemoryDirty)return;
- impl_->hdrMemoryDirty=false;
- if(!impl_->hdrProfileDisplay.isEmpty())storeHdrProfile(impl_->hdrProfileDisplay);
- if(hdrTitleMemory()&&!impl_->hdrTitleApplied.isEmpty())storeHdrTitleProfile(impl_->hdrTitleApplied);
-}
-void QmlPlayerBridge::syncHdrTitleProfile(){
- auto& i=*impl_;
- if(!i.snapshot.running||i.openingSource)return;
- const QFileInfo file(QString::fromStdWString(i.sourceLabel));
- if(!file.isFile())return; // Capture/stream labels are not film identities.
- const QString title=file.canonicalFilePath();
- if(title.isEmpty()||title==i.hdrTitleApplied)return;
- flushHdrMemory();i.hdrTitleApplied=title;
- if(hdrTitleMemory()&&loadHdrTitleProfile(title)){
- emit notice(tr("已套用这部影片上次的曲线设置"),false);return;
- }
- if(hdrAutoRecommend()&&settings().hdrCurve.enabled){QScopedValueRollback<bool> restoring(i.hdrRestoring,true);applyRecommendedHdrTuning();}
-}
-
-bool QmlPlayerBridge::loadHdrTitleProfile(const QString& title){
- const auto list=impl_->prefs.value(QStringLiteral("hdrTitles")).toList();
- for(const auto& item:list){
- const auto stored=item.toMap();
- if(stored.value(QStringLiteral("key")).toString()!=title)continue;
- auto s=settings();
- const auto number=[&](const char* key,int fallback){
- return stored.contains(QLatin1String(key))?stored.value(QLatin1String(key)).toInt():fallback;};
- s.hdrCurve.enabled=stored.value(QStringLiteral("enabled"),s.hdrCurve.enabled).toBool();
- s.hdrCurve.shadowLiftEv100=number("shadowLiftEv100",int(s.hdrCurve.shadowLiftEv100));
- s.hdrCurve.shadowRangeNits=unsigned(std::clamp(number("shadowRangeNits",int(s.hdrCurve.shadowRangeNits)),1,100));
- s.hdrCurve.midGrayNits=unsigned(std::clamp(number("midGrayNits",int(s.hdrCurve.midGrayNits)),100,500));
- s.hdrCurve.highlightStartNits=unsigned(std::clamp(number("highlightStartNits",int(s.hdrCurve.highlightStartNits)),0,2000));
- s.hdrCurve.rollOffPercent=unsigned(std::clamp(number("rollOffPercent",int(s.hdrCurve.rollOffPercent)),10,200));
- s.hdrCurve.peakCapNits=unsigned(std::clamp(number("peakCapNits",int(s.hdrCurve.peakCapNits)),0,4000));
- s.hdrCurve.strengthPercent=unsigned(std::clamp(number("strengthPercent",int(s.hdrCurve.strengthPercent)),0,200));
- QScopedValueRollback<bool> restoring(impl_->hdrRestoring,true);
- return commitHdrTuning(std::move(s));
- }
- return false;
-}
-
-bool QmlPlayerBridge::storeHdrTitleProfile(const QString& title){
- if(title.isEmpty()||!hdrTitleMemory())return false;
- auto& i=*impl_;
- const auto& c=settings().hdrCurve;
- QVariantMap entry;
- entry[QStringLiteral("key")]=title;
- entry[QStringLiteral("enabled")]=c.enabled;
- entry[QStringLiteral("shadowLiftEv100")]=int(c.shadowLiftEv100);
- entry[QStringLiteral("shadowRangeNits")]=int(c.shadowRangeNits);
- entry[QStringLiteral("midGrayNits")]=int(c.midGrayNits);
- entry[QStringLiteral("highlightStartNits")]=int(c.highlightStartNits);
- entry[QStringLiteral("rollOffPercent")]=int(c.rollOffPercent);
- entry[QStringLiteral("peakCapNits")]=int(c.peakCapNits);
- entry[QStringLiteral("strengthPercent")]=int(c.strengthPercent);
- auto list=i.prefs.value(QStringLiteral("hdrTitles")).toList();
- for(const auto& item:list)if(item.toMap().value(QStringLiteral("key")).toString()==title&&item.toMap()==entry)return false;
- for(int n=list.size()-1;n>=0;--n)
- if(list[n].toMap().value(QStringLiteral("key")).toString()==title)list.removeAt(n);
- list.append(entry);
- // Bounded list: the oldest titles fall off the front.
- while(list.size()>i.kHdrTitleProfileLimit)list.removeFirst();
- i.prefs[QStringLiteral("hdrTitles")]=list;
- if(!i.savePrefs())veyra::log::warn("ui-prefs","hdr title profile not saved");
- emit preferencesChanged();return true;
-}
-
-int QmlPlayerBridge::hdrDisplayProfileCount() const {
- return impl_->prefs.value(QStringLiteral("hdrProfiles")).toMap().size();
-}
-
-QString QmlPlayerBridge::hdrDisplayProfileId() const {
- // The EDID-based device id survives cable and port changes; the GDI device name
- // is the fallback for monitors that report none. Both are cheap Win32 calls -
- // no DXGI enumeration, so this stays safe on the snapshot cadence.
- HWND window=impl_->videoWindow;
- if(!IsWindow(window)){
- if(auto* focused=QGuiApplication::focusWindow())window=reinterpret_cast<HWND>(focused->winId());
- else window=nullptr;
- }
- const HMONITOR monitor=window?MonitorFromWindow(window,MONITOR_DEFAULTTONEAREST)
- :MonitorFromPoint(POINT{0,0},MONITOR_DEFAULTTOPRIMARY);
- if(!monitor)return QString();
- if(monitor==impl_->hdrIdentityMonitor&&!impl_->hdrIdentityKey.isEmpty())return impl_->hdrIdentityKey;
- impl_->hdrIdentityMonitor=monitor;
- MONITORINFOEXW info{};info.cbSize=sizeof(info);
- if(!GetMonitorInfoW(monitor,reinterpret_cast<MONITORINFO*>(&info)))return QString();
- DISPLAY_DEVICEW device{};device.cb=sizeof(device);
- if(EnumDisplayDevicesW(info.szDevice,0,&device,0)&&device.DeviceID[0])
- impl_->hdrIdentityKey=QString::fromWCharArray(device.DeviceID);
- else impl_->hdrIdentityKey=QString::fromWCharArray(info.szDevice);
- return impl_->hdrIdentityKey;
-}
-
-void QmlPlayerBridge::forgetHdrDisplayProfiles(){
- flushHdrMemory();
- auto& i=*impl_;
- i.prefs[QStringLiteral("hdrProfiles")]=QVariantMap{};
- if(!i.savePrefs())veyra::log::warn("ui-prefs","hdr display profiles not cleared");
- emit preferencesChanged();
- emit notice(tr("已清除显示设备记忆"),false);
-}
-
-void QmlPlayerBridge::syncHdrDisplayProfile(){
- auto& i=*impl_;
- const QString id=hdrDisplayProfileId();
- if(id.isEmpty()||id==i.hdrProfileDisplay)return; // the common path: nothing changed
- // Leaving a display: remember what the curve looks like on it.
- flushHdrMemory();
- i.hdrProfileDisplay=id;
- emit settingsChanged();
- if(loadHdrProfile(id)){
- emit preferencesChanged();
- emit notice(tr("已套用该显示设备的 HDR 曲线配置"),false);
- }
-}
-
-bool QmlPlayerBridge::loadHdrProfile(const QString& id){
- auto& i=*impl_;
- const auto profiles=i.prefs.value(QStringLiteral("hdrProfiles")).toMap();
- const auto stored=profiles.value(id).toMap();
- if(stored.isEmpty())return false;
- auto s=settings();
- const auto number=[&](const char* key,int fallback){
- return stored.contains(QLatin1String(key))?stored.value(QLatin1String(key)).toInt():fallback;};
- s.hdrCurve.enabled=stored.value(QStringLiteral("enabled"),s.hdrCurve.enabled).toBool();
- s.hdrCurve.shadowLiftEv100=number("shadowLiftEv100",int(s.hdrCurve.shadowLiftEv100));
- s.hdrCurve.shadowRangeNits=unsigned(std::clamp(number("shadowRangeNits",int(s.hdrCurve.shadowRangeNits)),1,100));
- s.hdrCurve.midGrayNits=unsigned(std::clamp(number("midGrayNits",int(s.hdrCurve.midGrayNits)),100,500));
- s.hdrCurve.highlightStartNits=unsigned(std::clamp(number("highlightStartNits",int(s.hdrCurve.highlightStartNits)),0,2000));
- s.hdrCurve.rollOffPercent=unsigned(std::clamp(number("rollOffPercent",int(s.hdrCurve.rollOffPercent)),10,200));
- s.hdrCurve.peakCapNits=unsigned(std::clamp(number("peakCapNits",int(s.hdrCurve.peakCapNits)),0,4000));
- s.hdrCurve.strengthPercent=unsigned(std::clamp(number("strengthPercent",int(s.hdrCurve.strengthPercent)),0,200));
- s.hdrCurve.displayPeakNits=unsigned(std::clamp(number("displayPeakNits",int(s.hdrCurve.displayPeakNits)),0,10000));
- QScopedValueRollback<bool> restoring(i.hdrRestoring,true);
- return commitHdrTuning(std::move(s));
-}
-
-bool QmlPlayerBridge::storeHdrProfile(const QString& id){
- auto& i=*impl_;
- const auto& c=settings().hdrCurve;
- QVariantMap entry;
- entry[QStringLiteral("enabled")]=c.enabled;
- entry[QStringLiteral("shadowLiftEv100")]=int(c.shadowLiftEv100);
- entry[QStringLiteral("shadowRangeNits")]=int(c.shadowRangeNits);
- entry[QStringLiteral("midGrayNits")]=int(c.midGrayNits);
- entry[QStringLiteral("highlightStartNits")]=int(c.highlightStartNits);
- entry[QStringLiteral("rollOffPercent")]=int(c.rollOffPercent);
- entry[QStringLiteral("peakCapNits")]=int(c.peakCapNits);
- entry[QStringLiteral("strengthPercent")]=int(c.strengthPercent);
- entry[QStringLiteral("displayPeakNits")]=int(c.displayPeakNits);
- auto profiles=i.prefs.value(QStringLiteral("hdrProfiles")).toMap();
- if(profiles.value(id).toMap()==entry)return false; // nothing new to remember
- profiles[id]=entry;
- while(profiles.size()>32)profiles.erase(profiles.begin());
- i.prefs[QStringLiteral("hdrProfiles")]=profiles;
- if(!i.savePrefs())veyra::log::warn("ui-prefs","hdr display profile not saved");
- emit preferencesChanged();return true;
-}
-
-QVariantMap QmlPlayerBridge::hdrSourceInfo() const {
- const auto& snap=impl_->snapshot;
- const unsigned mastering=snap.sourceMasteringPeakNits;
- const unsigned cll=snap.sourceMaxCllNits,fall=snap.sourceMaxFallNits;
- const bool valid=snap.sourceHdr&&(mastering||cll||fall);
- return {{"valid",valid},{"masteringPeakNits",int(mastering)},
- {"maxCllNits",int(cll)},{"maxFallNits",int(fall)}};
-}
-
-bool QmlPlayerBridge::sourceIsSdr() const {
- const auto& snap=impl_->snapshot;
- return snap.running&&!snap.sourceHdr;
-}
-
-unsigned QmlPlayerBridge::effectiveHdrDisplayPeakNits() const {
- // The ceiling the panel is actually held to: the user's own value when set, else the
- // system report - but only when that report is plausible (a projector answering
- // 10000 nit with a 0.000 black is its EDID ceiling, not a measurement; the presenter
- // applies the same rule). 0 means unknown and the recommendation skips that branch.
- const unsigned setting=unsigned(std::max(0,hdrDisplayPeakNits()));
- if(setting)return setting;
- const auto info=hdrDisplayInfo();
- if(!info.value("valid").toBool()||!info.value("plausible").toBool())return 0;
- return unsigned(std::max(0,info.value("peakNits").toInt()));
-}
-
-QVariantMap QmlPlayerBridge::hdrRecommendation() const {
- const auto& snap=impl_->snapshot;
- const auto rec=engine::recommendHdrTuning(snap.sourceMasteringPeakNits,snap.sourceMaxCllNits,
- snap.sourceMaxFallNits,effectiveHdrDisplayPeakNits());
- return {{"available",rec.available},{"presetId",QString::fromLatin1(rec.presetId)},
- {"axesContent",QString::fromLatin1(engine::hdrAxesContentForPreset(rec.presetId))},
- {"reason",QString::fromLatin1(rec.reasonKey)},{"strengthPercent",int(rec.strengthPercent)},
- {"cllNits",int(rec.cllNits)},{"fallNits",int(rec.fallNits)}};
-}
-
-QVariantMap QmlPlayerBridge::hdrPeakWarning() const {
- const auto& snap=impl_->snapshot;
- const auto& s=settings();
- // The arithmetic (including the divide-by-zero guard) lives in the header so the
- // unit tests cover it; this only marshals it to QML.
- const unsigned sourcePeak=snap.sourceMaxCllNits?snap.sourceMaxCllNits:snap.sourceMasteringPeakNits;
- auto baseline=s.hdrCurve;if(!baseline.displayPeakNits)baseline.displayPeakNits=effectiveHdrDisplayPeakNits();
- const auto w=engine::hdrPeakWarning(sourcePeak,snap.sourceHdr,baseline.enabled,baseline,s.hdrMetadata);
- return {{"valid",w.valid},{"sourcePeakNits",int(w.sourcePeakNits)},{"capNits",int(w.capNits)},
- {"keptPercent",int(w.keptPercent)},{"clipped",w.clipped}};
-}
-
-bool QmlPlayerBridge::applyRecommendedHdrTuning(){
- const auto& snap=impl_->snapshot;
- const auto rec=engine::recommendHdrTuning(snap.sourceMasteringPeakNits,snap.sourceMaxCllNits,
- snap.sourceMaxFallNits,effectiveHdrDisplayPeakNits());
- if(!rec.available)return false;
- // The finding is the same in both modes; only the thing it names differs. In the
- // axes mode the content comes from the source and the environment stays the user's
- // choice, exactly like a manual pick there.
- if(hdrPresetMode()==QLatin1String("axes")){
- QString environment=impl_->prefString("hdrAxesEnvironment");
- if(environment.isEmpty())environment=QStringLiteral("compensate");
- const QString content=QString::fromLatin1(engine::hdrAxesContentForPreset(rec.presetId));
- if(!applyHdrAxesPreset(content,environment))return false;
- emit notice(tr("已按片源自动选档:%1").arg(content),false);
- return true;
- }
- const auto* preset=engine::findHdrTuningPreset(rec.presetId);
- if(!preset)return false;
- auto s=settings();
- // The strength dial and the display peak belong to the user: the axes pick
- // preserves them, so a recommendation must not reset them either.
- const auto strength=s.hdrCurve.strengthPercent;
- const auto displayPeak=s.hdrCurve.displayPeakNits;
- s.hdrCurve=preset->curve;s.hdrMetadata=preset->metadata;
- s.hdrCurve.strengthPercent=strength;
- s.hdrCurve.displayPeakNits=displayPeak;
- if(!commitHdrTuning(std::move(s)))return false;
- setHdrAppliedFrom(QStringLiteral("legacy"));
- // One line per application, for diagnostics: it records what the recommendation decided
-
- // and on which numbers, so an odd suggestion can be explained afterwards. Per-user
-
- // calibration was considered and dropped - thresholds tuned on one person film library
-
- // would be shipped to everyone else.
- veyra::log::info("hdr-recommend",std::format("applied preset={} reason={} cll={} fall={} mastering={} displayPeak={} mode={}",
- rec.presetId,rec.reasonKey,rec.cllNits,rec.fallNits,snap.sourceMasteringPeakNits,
- effectiveHdrDisplayPeakNits(),hdrPresetMode().toStdString()));
- emit notice(tr("已按片源自动选档:%1").arg(QString::fromLatin1(rec.presetId)),false);
- return true;
-}
-
-bool QmlPlayerBridge::applyHdrTuningPreset(const QString& id){
- for(const auto& p:engine::kHdrTuningPresets){
- if(id!=QLatin1String(p.id))continue;
- auto s=settings();
- // Picking a preset replaces the baseline, not the two dials: how hard the
- // user turned it (and which panel they told us about) must survive.
- const auto strength=s.hdrCurve.strengthPercent;
- const auto displayPeak=s.hdrCurve.displayPeakNits;
- s.hdrCurve=p.curve;s.hdrMetadata=p.metadata;
- s.hdrCurve.strengthPercent=strength;s.hdrCurve.displayPeakNits=displayPeak;
- if(!s.hdrCurve.valid()||!s.hdrMetadata.valid())return false;
- if(!commitHdrTuning(std::move(s)))return false;
- setHdrAppliedFrom(QStringLiteral("legacy"));
- return true;
- }
- return false;
-}
-bool QmlPlayerBridge::hdrMetadataEnabled()const{return settings().hdrMetadata.enabled;}
-void QmlPlayerBridge::setHdrMetadataEnabled(bool enabled){
- auto s=settings();if(s.hdrMetadata.enabled==enabled)return;s.hdrMetadata.enabled=enabled;
- commitHdrTuning(std::move(s));
-}
-QVariantMap QmlPlayerBridge::hdrMetadataParams()const{
- const auto& m=settings().hdrMetadata;
- return {{"masteringPeakNits",int(m.masteringPeakNits)},{"maxCllNits",int(m.maxCllNits)},
- {"maxFallNits",int(m.maxFallNits)}};
-}
-bool QmlPlayerBridge::setHdrMetadataParameter(const QString& key,double value){
- if(!std::isfinite(value)||value<0||value>10000)return false;
- auto s=settings();const auto v=int(std::lround(value));
- if(v<0||v>10000)return false;
- if(key=="masteringPeakNits")s.hdrMetadata.masteringPeakNits=unsigned(v);
- else if(key=="maxCllNits")s.hdrMetadata.maxCllNits=unsigned(v);
- else if(key=="maxFallNits")s.hdrMetadata.maxFallNits=unsigned(v);
- else return false;
- if(!s.hdrMetadata.valid())return false;
- return commitHdrTuning(std::move(s));
-}
-void QmlPlayerBridge::setVideoHdr(bool enabled) {
- for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
- if (impl_->chain.nodes[i].type == engine::EffectType::VideoHdr) {
- setEffectEnabled(int(i), enabled); return;
- }
- if (enabled) emit notice(tr("请先添加 RTX Video HDR 节点"), true);
-}
-// RTX Video HDR tuning lives on the chain's HDR node, like NR parameters on
-// NR nodes: the same values AppShell's settings sliders edited.
-namespace {
-// Spatial anti-aliasing (#53): one node's values for the editors, and the edits they send.
-QString antiAliasSummary(const engine::AntiAliasSettings& a) {
- using engine::AntiAliasMethod;
- if (a.method == AntiAliasMethod::Mlaa)
- return QStringLiteral("MLAA · ") + QmlPlayerBridge::tr("阈值 %1").arg(double(a.mlaaThreshold), 0, 'f', 2);
- const QStringList fxaa{QmlPlayerBridge::tr("中"), QmlPlayerBridge::tr("高"), QmlPlayerBridge::tr("极高")};
- const QStringList smaa{QmlPlayerBridge::tr("低"), QmlPlayerBridge::tr("中"), QmlPlayerBridge::tr("高"), QmlPlayerBridge::tr("极高")};
- QString text = a.method == AntiAliasMethod::Fxaa ? QStringLiteral("FXAA · ") + fxaa.value(int(a.quality))
- : QStringLiteral("SMAA · ") + smaa.value(int(a.quality));
- if (a.usesTemporal())
- text += a.temporal == engine::AntiAliasTemporal::T2x ? QmlPlayerBridge::tr(" · 时域 T2x(实验)") : QmlPlayerBridge::tr(" · 时域 4x(实验)");
- return text;
-}
-QVariantMap antiAliasMap(const engine::ChainNode* node, int index) {
- const engine::AntiAliasSettings a = node ? node->aa : engine::AntiAliasSettings{};
- return {{"index", index}, {"present", node != nullptr}, {"enabled", node && node->enabled},
- {"method", int(a.method)}, {"quality", int(a.quality)},
- {"mlaaThreshold", double(a.mlaaThreshold)}, {"mlaaStrength", double(a.mlaaStrength)},
- {"temporal", int(a.temporal)}, {"historyWeight", double(a.historyWeight)},
- {"historyRejection", double(a.historyRejection)}, {"summary", antiAliasSummary(a)}};
-}
-// A method change starts from its high tier; the experimental modes keep Magpie's
-// history defaults (T2x 0.5, 4x 0.75) unless the weight was tuned.
-uint8_t defaultAntiAliasQuality(engine::AntiAliasMethod method) {
- return method == engine::AntiAliasMethod::Fxaa ? 1 : method == engine::AntiAliasMethod::Smaa ? 2 : 0;
-}
-float defaultHistoryWeight(engine::AntiAliasTemporal temporal) {
- return temporal == engine::AntiAliasTemporal::X4 ? 0.75f : 0.5f;
-}
-bool applyAntiAliasKey(engine::AntiAliasSettings& a, bool& enabled, const QString& key, double value) {
- using engine::AntiAliasMethod; using engine::AntiAliasTemporal;
- if (!std::isfinite(value)) return false;
- const int whole = int(std::lround(value));
- if (key == "enabled") { enabled = value != 0; return true; }
- if (key == "method") {
- if (whole < 0 || whole > 2) return false;
- const auto method = AntiAliasMethod(whole);
- if (method != a.method) { a.method = method; a.quality = defaultAntiAliasQuality(method); }
- if (method != AntiAliasMethod::Smaa) a.temporal = AntiAliasTemporal::Off;
- return true;
- }
- if (key == "quality") {
- if (whole < 0 || whole >= int(engine::antiAliasQualityCount(a.method))) return false;
- a.quality = uint8_t(whole); return true;
- }
- if (key == "temporal") {
- if (whole < 0 || whole > 2 || (whole && a.method != AntiAliasMethod::Smaa)) return false;
- const auto next = AntiAliasTemporal(whole);
- if (next != a.temporal && a.historyWeight == defaultHistoryWeight(a.temporal)) a.historyWeight = defaultHistoryWeight(next);
- a.temporal = next; return true;
- }
- if (key == "mlaaThreshold") { a.mlaaThreshold = float(value); return true; }
- if (key == "mlaaStrength") { a.mlaaStrength = float(value); return true; }
- if (key == "historyWeight") { a.historyWeight = float(value); return true; }
- if (key == "historyRejection") { a.historyRejection = float(value); return true; }
- return false;
-}
-}
-bool QmlPlayerBridge::antiAliasEnabled() const {
- const auto* node = impl_->chain.firstOf(engine::EffectType::AntiAliasing);
- return node && node->enabled;
-}
-void QmlPlayerBridge::setAntiAliasEnabled(bool enabled) {
- if (enabled != antiAliasEnabled()) (void)setAntiAliasParameter(QStringLiteral("enabled"), enabled ? 1 : 0);
-}
-QVariantMap QmlPlayerBridge::antiAliasParams() const {
- for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
- if (impl_->chain.nodes[i].type == engine::EffectType::AntiAliasing) return antiAliasMap(&impl_->chain.nodes[i], int(i));
- return antiAliasMap(nullptr, -1);
-}
-QVariantMap QmlPlayerBridge::antiAliasParamsAt(int index) const {
- if (index < 0 || uint32_t(index) >= impl_->chain.nodeCount ||
- impl_->chain.nodes[index].type != engine::EffectType::AntiAliasing) return antiAliasMap(nullptr, -1);
- return antiAliasMap(&impl_->chain.nodes[index], index);
-}
-bool QmlPlayerBridge::setAntiAliasParameter(const QString& key, double value) {
- auto& c = impl_->chain;
- for (uint32_t i = 0; i < c.nodeCount; ++i)
- if (c.nodes[i].type == engine::EffectType::AntiAliasing) return setAntiAliasParameterAt(int(i), key, value);
- if (c.mode != engine::ChainMode::List) { emit notice(tr("请先添加抗锯齿节点"), true); return false; }
- // The list card's instance exists once it is used, stored after the grades
- // where toChain() puts it; the list order (compileChainExecutionPlan) runs it
- // behind the NR group when NR is on and in front of SR otherwise.
- engine::ChainNode node; node.type = engine::EffectType::AntiAliasing;
- bool enabled = false;
- if (!applyAntiAliasKey(node.aa, enabled, key, value)) return false;
- node.enabled = node.aa.enabled = enabled;
- if (!node.aa.validate().empty()) return false;
- if (c.nodeCount >= engine::kMaxChainNodes) { emit notice(tr("效果链已满"), true); return false; }
- uint32_t insertAt = 0;
- while (insertAt < c.nodeCount && c.nodes[insertAt].type == engine::EffectType::Color) ++insertAt;
- const auto before = std::make_unique<engine::EffectChain>(c);
- const int selected = impl_->selectedNr, colourSelected = impl_->selectedColour;
- for (uint32_t i = c.nodeCount; i > insertAt; --i) c.nodes[i] = c.nodes[i - 1];
- c.nodes[insertAt] = node; ++c.nodeCount;
- if (impl_->selectedNr >= int(insertAt)) ++impl_->selectedNr;
- if (impl_->selectedColour >= int(insertAt)) ++impl_->selectedColour;
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message;
- c = *before; impl_->selectedNr = selected; impl_->selectedColour = colourSelected; impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- emit settingsChanged(); emitChainChanged();
- return true;
-}
-bool QmlPlayerBridge::setAntiAliasParameterAt(int index, const QString& key, double value) {
- auto& c = impl_->chain;
- if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::AntiAliasing) return false;
- auto& node = c.nodes[index];
- const auto before = node; const bool wasValid = chainValid();
- bool enabled = node.enabled;
- if (!applyAntiAliasKey(node.aa, enabled, key, value)) return false;
- node.enabled = node.aa.enabled = enabled;
- if (!node.aa.validate().empty()) { node = before; return false; }
- if (node == before) return true;
- const bool accepted = impl_->revalidate(true);
- if (!accepted) { const auto error = impl_->validation.message; node = before; impl_->revalidate(); emit notice(uiText(error), true); }
- emit settingsChanged();
- // The switch also strikes the chip through; parameters notify only their group.
- if (before.enabled != node.enabled) emitChainChanged();
- else emitParameterChanged(&QmlPlayerBridge::antiAliasChanged, wasValid);
- return accepted;
-}
-namespace {
-// Beauty nodes: one node's values for the editors, the edits they send and the presets.
-QString beautySummary(const engine::BeautySettings& b, bool enabled) {
- if (!enabled) return QmlPlayerBridge::tr("已关闭");
- QStringList parts;
- if (b.restore) parts << QmlPlayerBridge::tr("原画保护 %1%").arg(std::lround(b.restoreStrength * 100.0f));
- if (b.smooth) parts << QmlPlayerBridge::tr("磨皮 %1%").arg(std::lround(b.smoothAmount * 100.0f));
- return parts.isEmpty() ? QmlPlayerBridge::tr("未启用子功能") : parts.join(QStringLiteral(" · "));
-}
-QVariantMap beautyMap(const engine::ChainNode* node, int index, int layer) {
- const engine::BeautySettings b = node ? node->beauty : engine::BeautySettings{};
- return {{"index", index}, {"layer", layer}, {"present", node != nullptr}, {"enabled", node && node->enabled},
- {"restore", b.restore}, {"restoreStrength", double(b.restoreStrength)}, {"restoreScope", int(b.restoreScope)},
- {"regionExpand", double(b.regionExpand)}, {"feather", double(b.feather)},
- {"smooth", b.smooth}, {"strength", double(b.strength)}, {"smoothAmount", double(b.smoothAmount)},
- {"radius", double(b.radius)}, {"detail", double(b.detail)}, {"texture", double(b.texture)},
- {"brighten", double(b.brighten)}, {"scope", int(b.scope)},
- {"hueCenter", double(b.hueCenter)}, {"hueRange", double(b.hueRange)}, {"satMin", double(b.satMin)},
- {"satMax", double(b.satMax)}, {"lumaMin", double(b.lumaMin)}, {"lumaMax", double(b.lumaMax)},
- {"softness", double(b.softness)}, {"minConfidence", double(b.minConfidence)}, {"showMask", b.showMask},
- {"summary", beautySummary(b, node && node->enabled)}};
-}
-bool applyBeautyKey(engine::BeautySettings& b, bool& enabled, const QString& key, double value) {
- if (!std::isfinite(value)) return false;
- const int whole = int(std::lround(value));
- if (key == "enabled") { enabled = value != 0; return true; }
- if (key == "restore") { b.restore = value != 0; return true; }
- if (key == "smooth") { b.smooth = value != 0; return true; }
- if (key == "showMask") { b.showMask = value != 0; return true; }
- if (key == "restoreScope") { if (whole < 0 || whole > 1) return false; b.restoreScope = engine::BeautyRestoreScope(whole); return true; }
- if (key == "scope") { if (whole < 0 || whole > 1) return false; b.scope = engine::BeautyScope(whole); return true; }
- const std::pair<const char*, float engine::BeautySettings::*> floats[] = {
- {"restoreStrength", &engine::BeautySettings::restoreStrength}, {"regionExpand", &engine::BeautySettings::regionExpand},
- {"feather", &engine::BeautySettings::feather}, {"strength", &engine::BeautySettings::strength},
- {"smoothAmount", &engine::BeautySettings::smoothAmount}, {"radius", &engine::BeautySettings::radius},
- {"detail", &engine::BeautySettings::detail}, {"texture", &engine::BeautySettings::texture},
- {"brighten", &engine::BeautySettings::brighten}, {"hueCenter", &engine::BeautySettings::hueCenter},
- {"hueRange", &engine::BeautySettings::hueRange}, {"satMin", &engine::BeautySettings::satMin},
- {"satMax", &engine::BeautySettings::satMax}, {"lumaMin", &engine::BeautySettings::lumaMin},
- {"lumaMax", &engine::BeautySettings::lumaMax}, {"softness", &engine::BeautySettings::softness},
- {"minConfidence", &engine::BeautySettings::minConfidence}};
- for (const auto& [name, field] : floats)
- if (key == QLatin1String(name)) { b.*field = float(value); return true; }
- return false;
-}
-// Starting points, tuned on lit photos and dark game footage; each names the
-// sub-switches it changes and leaves the skin range and the detection alone.
-bool applyBeautyPresetValues(engine::BeautySettings& b, const QString& preset) {
- const auto natural = [&] { b.smooth = true; b.strength = 1.0f; b.smoothAmount = 0.6f; b.radius = 5.0f; b.detail = 0.6f; b.texture = 0.3f; };
- if (preset == "natural") { natural(); b.restore = false; return true; }
- if (preset == "light") {
- b.smooth = true; b.restore = false; b.strength = 1.0f; b.smoothAmount = 0.35f; b.radius = 3.0f; b.detail = 0.75f; b.texture = 0.4f;
- return true;
- }
- if (preset == "restore") { b.restore = true; b.restoreStrength = 1.0f; b.smooth = false; return true; }
- if (preset == "restoreNatural") { b.restore = true; b.restoreStrength = 1.0f; natural(); return true; }
- return false;
-}
-}
-QVariantList QmlPlayerBridge::beautyLayers() const {
- QVariantList out;
- int layer = 0;
- for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
- if (impl_->chain.nodes[i].type == engine::EffectType::Beauty) out << beautyMap(&impl_->chain.nodes[i], int(i), layer++);
- return out;
-}
-QVariantMap QmlPlayerBridge::beautyDetection() const {
- const auto& d = impl_->chain.beautyDetection;
- return {{"quality", int(d.quality)}, {"maxFaces", int(d.maxFaces)}, {"stability", double(d.stability)}};
-}
-QString QmlPlayerBridge::beautyStatus() const {
- const auto& s = impl_->snapshot;
- if (!s.beautyActive) return {};
- if (!s.beautyNotice.empty()) return uiText(s.beautyNotice);
- return s.beautyFaces ? tr("检测到 %1 张人脸").arg(s.beautyFaces) : tr("未检测到人脸");
-}
-QVariantMap QmlPlayerBridge::beautyParamsAt(int index) const {
- const auto& c = impl_->chain;
- if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty) return beautyMap(nullptr, -1, -1);
- int layer = 0;
- for (int i = 0; i < index; ++i) layer += c.nodes[i].type == engine::EffectType::Beauty;
- return beautyMap(&c.nodes[index], index, layer);
-}
-bool QmlPlayerBridge::setBeautyParameterAt(int index, const QString& key, double value) {
- auto& c = impl_->chain;
- if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty) return false;
- auto& node = c.nodes[index];
- const auto before = node; const bool wasValid = chainValid();
- bool enabled = node.enabled;
- if (!applyBeautyKey(node.beauty, enabled, key, value)) return false;
- node.enabled = node.beauty.enabled = enabled;
- if (!node.beauty.validate().empty()) { node = before; return false; }
- if (node == before) return true;
- const bool accepted = impl_->revalidate(true);
- if (!accepted) { const auto error = impl_->validation.message; node = before; impl_->revalidate(); emit notice(uiText(error), true); }
- emit settingsChanged();
- // The switch also strikes the chip through; parameters notify only their group.
- if (before.enabled != node.enabled) emitChainChanged();
- else emitParameterChanged(&QmlPlayerBridge::beautyChanged, wasValid);
- return accepted;
-}
-int QmlPlayerBridge::duplicateBeautyLayer(int index) {
- auto& c = impl_->chain;
- if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty) return -1;
- if (c.mode != engine::ChainMode::List) { emit notice(tr("节点模式请用节点的复制"), true); return -1; }
- if (c.countOf(engine::EffectType::Beauty) >= engine::kMaxBeautyInstances) {
- emit notice(tr("%1 最多 %2 个").arg(tr("美颜")).arg(engine::kMaxBeautyInstances), true); return -1;
- }
- if (c.nodeCount >= engine::kMaxChainNodes) { emit notice(tr("效果链已满"), true); return -1; }
- const auto before = std::make_unique<engine::EffectChain>(c);
- const int selected = impl_->selectedNr, colourSelected = impl_->selectedColour;
- const uint32_t at = uint32_t(index) + 1;
- for (uint32_t i = c.nodeCount; i > at; --i) c.nodes[i] = c.nodes[i - 1];
- c.nodes[at] = c.nodes[index]; ++c.nodeCount;
- if (impl_->selectedNr >= int(at)) ++impl_->selectedNr;
- if (impl_->selectedColour >= int(at)) ++impl_->selectedColour;
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message;
- c = *before; impl_->selectedNr = selected; impl_->selectedColour = colourSelected; impl_->revalidate();
- emit notice(uiText(error), true); return -1;
- }
- emit settingsChanged(); emitChainChanged();
- return int(at);
-}
-bool QmlPlayerBridge::moveBeautyLayer(int index, int delta) {
- auto& c = impl_->chain;
- if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty || !delta) return false;
- int other = index;
- do other += delta < 0 ? -1 : 1;
- while (other >= 0 && uint32_t(other) < c.nodeCount && c.nodes[other].type != engine::EffectType::Beauty);
- if (other < 0 || uint32_t(other) >= c.nodeCount) return false;
- const auto before = std::make_unique<engine::EffectChain>(c);
- const auto viewA = std::pair{c.nodes[index].viewX, c.nodes[index].viewY};
- const auto viewB = std::pair{c.nodes[other].viewX, c.nodes[other].viewY};
- std::swap(c.nodes[index], c.nodes[other]);
- // Node mode keeps the canvas positions with the slot; only the parameters trade places.
- c.nodes[index].viewX = viewA.first; c.nodes[index].viewY = viewA.second;
- c.nodes[other].viewX = viewB.first; c.nodes[other].viewY = viewB.second;
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message; c = *before; impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- emit settingsChanged(); emitChainChanged();
- return true;
-}
-bool QmlPlayerBridge::applyBeautyPreset(int index, const QString& preset) {
- auto& c = impl_->chain;
- if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty) return false;
- auto& node = c.nodes[index];
- const auto before = node;
- if (!applyBeautyPresetValues(node.beauty, preset)) return false;
- node.enabled = node.beauty.enabled = true;
- if (!node.beauty.validate().empty()) { node = before; return false; }
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message; node = before; impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- emit settingsChanged(); emitChainChanged();
- return true;
-}
-bool QmlPlayerBridge::setBeautyDetection(const QString& key, double value) {
- auto& c = impl_->chain;
- if (!std::isfinite(value)) return false;
- auto next = c.beautyDetection;
- const int whole = int(std::lround(value));
- if (key == "quality") next.quality = uint8_t(std::clamp(whole, 0, 2));
- else if (key == "maxFaces") next.maxFaces = uint8_t(std::clamp(whole, 1, 8));
- else if (key == "stability") next.stability = float(value);
- else return false;
- if (!next.validate().empty()) return false;
- if (next == c.beautyDetection) return true;
- const auto before = c.beautyDetection; const bool wasValid = chainValid();
- c.beautyDetection = next;
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message; c.beautyDetection = before; impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- emit settingsChanged();
- emitParameterChanged(&QmlPlayerBridge::beautyChanged, wasValid);
- return true;
-}
-bool QmlPlayerBridge::beautyAnyEnabled() const {
- const auto& c = impl_->chain;
- for (uint32_t i = 0; i < c.nodeCount; ++i) if (c.nodes[i].type == engine::EffectType::Beauty && c.nodes[i].enabled) return true;
- return false;
-}
-bool QmlPlayerBridge::setAllBeautyEnabled(bool enabled) {
- auto& c = impl_->chain;
- const auto before = std::make_unique<engine::EffectChain>(c);
- std::vector<uint32_t> layers;
- for (uint32_t i = 0; i < c.nodeCount; ++i) if (c.nodes[i].type == engine::EffectType::Beauty) layers.push_back(i);
- if (layers.empty()) return false;
- auto& restore = impl_->beautyMasterRestore;
- if (!enabled) {
- restore.clear();
- for (const auto i : layers) { restore.push_back(c.nodes[i].enabled); c.nodes[i].enabled = c.nodes[i].beauty.enabled = false; }
- } else {
- // As the NR switch: layers added or removed meanwhile bring every layer back.
- const bool faithful = restore.size() == layers.size() && std::find(restore.begin(), restore.end(), true) != restore.end();
- for (size_t k = 0; k < layers.size(); ++k) c.nodes[layers[k]].enabled = c.nodes[layers[k]].beauty.enabled = faithful ? bool(restore[k]) : true;
- }
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message; c = *before; impl_->revalidate();
- emit notice(uiText(error), true); emitChainChanged(); return false;
- }
- veyra::log::info("ui-beauty", std::format("group switch {} layers={}", enabled ? "on" : "off", layers.size()));
- emitChainChanged(); emit settingsChanged();
- return true;
-}
-bool QmlPlayerBridge::resetBeautyLayer(int index) {
- auto& c = impl_->chain;
- if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty) return false;
- auto& node = c.nodes[index];
- const auto before = node;
- node.beauty = engine::BeautySettings{};
- node.beauty.enabled = node.enabled;
- if (node == before) return true;
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message; node = before; impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- emit settingsChanged(); emitChainChanged();
- return true;
-}
-QVariantMap QmlPlayerBridge::videoHdrParams() const {
- for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
- if (impl_->chain.nodes[i].type == engine::EffectType::VideoHdr) {
- const auto& v = impl_->chain.nodes[i].videoHdr;
- return {{"contrast", int(v.contrast)}, {"saturation", int(v.saturation)},
- {"middleGray", int(v.middleGray)}, {"peakNits", int(v.peakNits)}};
- }
- return {};
-}
-bool QmlPlayerBridge::setVideoHdrParameter(const QString& key, double value) {
- if (!std::isfinite(value)) return false;
- for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i) {
- auto& node = impl_->chain.nodes[i];
- if (node.type != engine::EffectType::VideoHdr) continue;
- const auto before = node; const bool wasValid = chainValid();
- if (value < 0) return false;
- const auto v = unsigned(std::lround(value));
- if (key == "contrast") node.videoHdr.contrast = v;
- else if (key == "saturation") node.videoHdr.saturation = v;
- else if (key == "middleGray") node.videoHdr.middleGray = v;
- else if (key == "peakNits") node.videoHdr.peakNits = v;
- else return false;
- if (!node.videoHdr.valid()) { node = before; return false; }
- if (node == before) return true;
- const bool accepted = impl_->revalidate(true);
- if (!accepted) { const auto error = impl_->validation.message; node = before; impl_->revalidate(); emit notice(uiText(error), true); }
- emit settingsChanged(); emitParameterChanged(&QmlPlayerBridge::videoHdrParamsChanged, wasValid); return accepted;
- }
- emit notice(tr("请先添加 RTX Video HDR 节点"), true);
- return false;
-}
-bool QmlPlayerBridge::fgEnabled() const {
- const auto* node = impl_->chain.firstOf(engine::EffectType::FrameGeneration);
- return node && node->enabled;
-}
-void QmlPlayerBridge::setFgEnabled(bool enabled) {
- for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
- if (impl_->chain.nodes[i].type == engine::EffectType::FrameGeneration) {
- if (impl_->chain.nodes[i].enabled == enabled) return;
- // Turning on keeps the last chosen multiplier (at least 2X).
- if (enabled && impl_->chain.fgMultiplier < 2) impl_->chain.fgMultiplier = 2;
- setEffectEnabled(int(i), enabled); emit settingsChanged(); return;
- }
- if (enabled) emit notice(tr("请先添加补帧节点"), true);
-}
-int QmlPlayerBridge::fgMultiplier() const {
- const auto* node = impl_->chain.firstOf(engine::EffectType::FrameGeneration);
- return node && node->enabled ? int(impl_->chain.fgMultiplier) : 1;
-}
-void QmlPlayerBridge::setFgMultiplier(int multiplier) {
- const auto choices=settings().frameGenerationBackend==engine::FrameGenerationBackend::Vfg?
- std::span<const uint32_t>(engine::kVfgMultiplierChoices):std::span<const uint32_t>(engine::kFgMultiplierChoices);
- const bool legal = std::find(choices.begin(),choices.end(),uint32_t(std::max(multiplier,0)))!=choices.end();
- if (!legal || multiplier > fgMaxMultiplier()) {
- emit notice(tr("补帧倍率超出当前后端范围"), true); return;
- }
- auto& chain = impl_->chain;
- auto* node = chain.firstOf(engine::EffectType::FrameGeneration);
- if (!node) { if (multiplier > 1) emit notice(tr("请先添加补帧节点"), true); return; }
- const bool enabled = multiplier > 1;
- if (node->enabled == enabled && (!enabled || chain.fgMultiplier == uint32_t(multiplier))) return;
- const auto beforeMultiplier = chain.fgMultiplier; const auto beforeEnabled = node->enabled;
- node->enabled = enabled; if (enabled) chain.fgMultiplier = uint32_t(multiplier);
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message;
- node->enabled = beforeEnabled; chain.fgMultiplier = beforeMultiplier; impl_->revalidate();
- emit notice(uiText(error), true);
- }
- emit settingsChanged(); emitChainChanged();
-}
-
-bool QmlPlayerBridge::colorEnabled() const {return selectedColourSettings().enabled;}
-void QmlPlayerBridge::setColorEnabled(bool enabled){
- auto c=selectedColourSettings();c.enabled=enabled;commitColour(c);
-}
-
-bool QmlPlayerBridge::protectionEnabled() const { return settings().protection.enabled; }
-void QmlPlayerBridge::setProtectionEnabled(bool enabled) {
- if (impl_->chain.mode != engine::ChainMode::List) {
- emit notice(tr("NR 保护区域仅在列表模式可用"), true); return;
- }
- for (uint32_t i=0; i<impl_->chain.nodeCount; ++i) {
- if (impl_->chain.nodes[i].type==engine::EffectType::Protection) {
- setEffectEnabled(int(i), enabled);
- return;
- }
- }
- emit notice(tr("处理链中没有 NR 保护节点,未更改设置"), true);
-}
-
-QVariantMap QmlPlayerBridge::protectionState() const {
- const auto p = settings().protection;
- const auto r = p.regions[0];
- return {{"left",double(r.left)},{"top",double(r.top)},
- {"right",double(r.right)},{"bottom",double(r.bottom)},
- {"feather",double(p.featherPixels)}};
-}
-
-bool QmlPlayerBridge::setProtectionRegion(double left,double top,double right,double bottom,double feather) {
- if (impl_->chain.mode != engine::ChainMode::List) return false;
- for (double v : {left,top,right,bottom,feather}) if (!std::isfinite(v)) return false;
- if (left<0 || top<0 || right>1 || bottom>1 || left>right || top>bottom || feather<0 || feather>64) return false;
- for (uint32_t i=0;i<impl_->chain.nodeCount;++i) {
- auto& node=impl_->chain.nodes[i];
- if (node.type!=engine::EffectType::Protection) continue;
- const auto before=node;const bool wasValid=chainValid();
- // Explicit edits replace legacy multi-rectangle settings with the one global region.
- node.protection.regions={};
- node.protection.regions[0]={float(left),float(top),float(right),float(bottom)};
- node.protection.featherPixels=float(feather);
- if(node==before)return true;
- const bool accepted=impl_->revalidate(true);
- if(!accepted){const auto error=impl_->validation.message;node=before;impl_->revalidate();emit notice(uiText(error),true);}
- emit settingsChanged();emitParameterChanged(&QmlPlayerBridge::protectionChanged,wasValid);return accepted;
- }
- return false;
-}
-
-// The inspector edits the selected list node, not the first flat NR mirror.
-#define VEYRA_NR_PROP(getter,setter,member,type) \
- type QmlPlayerBridge::getter() const { \
- const auto* n=impl_->nrNode(); const engine::ChainNode fallback{}; \
- return type((n?*n:fallback).member); \
- } \
- void QmlPlayerBridge::setter(type value){ \
- auto* n=impl_->nrNode(); if(!n||type(n->member)==value)return; \
- const auto before=*n; const bool wasValid=chainValid(); \
- n->member=decltype(n->member)(value); \
- if(!impl_->revalidate(true)){ \
- const auto error=impl_->validation.message; *n=before; \
- impl_->revalidate();emit notice(uiText(error),true); \
- } \
- emit settingsChanged(); \
- if(before.enabled!=n->enabled)emitChainChanged(); \
- else emitParameterChanged(&QmlPlayerBridge::nrLayersChanged,wasValid); \
- }
-VEYRA_NR_PROP(nrEnabled,setNrEnabled,enabled,bool)
-VEYRA_NR_PROP(nrTemporal,setNrTemporal,nr.temporal,bool)
-VEYRA_NR_PROP(nrIntensity,setNrIntensity,nr.model.intensity,double)
-VEYRA_NR_PROP(nrTone,setNrTone,nr.model.tone,double)
-VEYRA_NR_PROP(nrStructure,setNrStructure,nr.model.structure,double)
-VEYRA_NR_PROP(nrSkin,setNrSkin,nr.model.skin,double)
-VEYRA_NR_PROP(nrAutoMask,setNrAutoMask,nr.model.autoMask,bool)
-VEYRA_NR_PROP(nrUiCorrection,setNrUiCorrection,nr.model.uiCorrection,bool)
-VEYRA_NR_PROP(nrStyle,setNrStyle,nr.model.style,int)
-#undef VEYRA_NR_PROP
-int QmlPlayerBridge::selectedNrLayer() const{return impl_->nrIndex();}
-void QmlPlayerBridge::setSelectedNrLayer(int index){
- if(index<0||uint32_t(index)>=impl_->chain.nodeCount||
- impl_->chain.nodes[index].type!=engine::EffectType::NrEnhance||index==impl_->selectedNr)return;
- impl_->selectedNr=index;emit settingsChanged();
-}
-bool QmlPlayerBridge::lowLatency() const{return settings().lowLatency;}
-void QmlPlayerBridge::setLowLatency(bool value){
- const auto before=impl_->chain;
- for(uint32_t i=0;i<impl_->chain.nodeCount;++i)if(impl_->chain.nodes[i].type==engine::EffectType::NrEnhance)
- impl_->chain.nodes[i].nr.lowLatencyPairing=value;
- if(!impl_->revalidate(true)){
- const auto error=impl_->validation.message;impl_->chain=before;
- impl_->revalidate();emit notice(uiText(error),true);
- }
- emit settingsChanged();emitChainChanged();
-}
-
-// Stage-5 output stabiliser (anti-flicker). Global, not per-node: it runs once,
-// after the whole NR stack and the residual composite. Strength 0 is the
-// default and the graph then skips the dispatch entirely, so committing it
-// never costs anything until the user turns it on.
-double QmlPlayerBridge::nrHoldStrength() const { return double(settings().nrHoldStrength); }
-void QmlPlayerBridge::setNrHoldStrength(double value) {
- auto s = settings();
- const float next = float(value);
- if (s.nrHoldStrength == next) return;
- s.nrHoldStrength = next;
- if (!impl_->commit(std::move(s))) return;
- impl_->prefs[QStringLiteral("nrHoldStrength")] = double(next);
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "output stabiliser strength not saved");
- emit settingsChanged();
-}
-double QmlPlayerBridge::nrHoldTolerance() const { return double(settings().nrHoldTolerance); }
-void QmlPlayerBridge::setNrHoldTolerance(double value) {
- auto s = settings();
- const float next = float(value);
- if (s.nrHoldTolerance == next) return;
- s.nrHoldTolerance = next;
- if (!impl_->commit(std::move(s))) return;
- impl_->prefs[QStringLiteral("nrHoldTolerance")] = double(next);
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "output stabiliser tolerance not saved");
- emit settingsChanged();
-}
-
-bool QmlPlayerBridge::applying() const { return impl_->facade.applying(); }
-
-// Volume and mute are engine state (the audio clock owns them), so they go
-// straight to the engine and come back through the snapshot: the UI shows what
-// the engine did, not what it asked for.
-double QmlPlayerBridge::volume() const { return double(impl_->snapshot.volume); }
-void QmlPlayerBridge::setVolume(double value) {
- impl_->engine.setVolume(float(std::clamp(value, 0.0, 1.0)), impl_->snapshot.muted);
-}
-bool QmlPlayerBridge::muted() const { return impl_->snapshot.muted; }
-void QmlPlayerBridge::setMuted(bool value) {
- impl_->engine.setVolume(impl_->snapshot.volume, value);
-}
-double QmlPlayerBridge::playbackSpeed() const { return impl_->snapshot.playbackSpeed; }
-double QmlPlayerBridge::playbackRate() const { return impl_->snapshot.playbackRate; }
-double QmlPlayerBridge::minimumPlaybackRate() const { return engine::kMinPlaybackRate; }
-double QmlPlayerBridge::maximumPlaybackRate() const { return engine::kMaxPlaybackRate; }
-void QmlPlayerBridge::setPlaybackRate(double rate) {
- if(!impl_->engine.setPlaybackRate(rate))return;
- impl_->snapshot.playbackRate=rate;emit snapshotChanged();
-}
-
-// --- chain ------------------------------------------------------------------
-// The settings the UI is showing: the facade's pending copy, which the engine
-// has been asked to apply. One accessor so every property reads the same value.
-engine::EnhancementSettings QmlPlayerBridge::settings() const {
- auto result = impl_->facade.pendingSettings();
- if (impl_->chain.mode == engine::ChainMode::Node) impl_->draftGlobals.apply(result);
- return result;
-}
-
-QVariantList QmlPlayerBridge::chain() const {
- QVariantList out;
- int nrOrdinal=0;
- const auto& c = impl_->chain;
- for (uint32_t i = 0; i < c.nodeCount; ++i) {
- const auto& node = c.nodes[i];
- const auto& info = engine::effectInfo(node.type);
- QVariantMap item;
- item["index"] = int(i);
- item["id"] = c.mode == engine::ChainMode::Node ? impl_->layout.ids[i] : i + 2;
- item["type"] = utf8Of(info.id);
- item["label"] = uiText(info.label);
- if(node.type==engine::EffectType::FrameGeneration)
- for(const auto& choice:fgBackendChoices()){
- const auto option=choice.toMap();
- if(option.value("id").toString()==fgBackendName())item["label"]=option.value("label");
- }
- if(node.type==engine::EffectType::NrEnhance)item["label"]=tr("NR 画面增强 · 第 %1 层").arg(++nrOrdinal);
- item["enabled"] = node.enabled;
- item["x"] = double(node.viewX);
- item["y"] = double(node.viewY);
- item["mustBeLast"] = info.mustBeLast;
- item["justBeforeLast"] = info.justBeforeLast;
- item["experimental"] = info.experimental;
- item["changesResolution"] = info.changesResolution;
- out << item;
- }
- return out;
-}
-
-QVariantList QmlPlayerBridge::nrLayers() const {
- QVariantList out;
- for(uint32_t i=0;i<impl_->chain.nodeCount;++i){const auto& node=impl_->chain.nodes[i];
- if(node.type!=engine::EffectType::NrEnhance)continue;
- const auto& n=node.nr;
- out<<QVariantMap{{"index",int(i)},{"enabled",node.enabled},{"sizePolicy",int(n.sizePolicy)},{"runtime",int(engine::currentNrRuntime(n.runtime))},
- {"manualSize",pipeline::manualNrSizePolicy(n.sizePolicy)},{"sizePercent",int(pipeline::nrSizePercent(n.sizePolicy))},
- {"intensity",n.model.intensity},{"tone",n.model.tone},{"structure",n.model.structure},
- {"skin",n.model.skin},{"style",n.model.style},{"autoMask",bool(n.model.autoMask)},
- {"uiCorrection",bool(n.model.uiCorrection)},{"performance",n.model.performance},{"total",n.residual.total},
- {"darken",n.residual.darken},{"brighten",n.residual.brighten},
- {"color",n.residual.color},{"luminance",n.residual.luminance},{"temporal",n.temporal},
- {"antiFlicker",int(n.antiFlicker)},
- {"correctionEnabled",n.residual.correction.enabled},{"correctionAuto",n.residual.correction.automatic},
- {"hueProtection",n.residual.correction.hue},{"chromaProtection",n.residual.correction.chroma},
- {"highlightProtection",n.residual.correction.highlight},{"localCompression",n.residual.correction.compression},
- {"temporalStability",n.residual.correction.stability},
- {"neutralProtection",n.residual.correction.neutral},{"colorRetention",n.residual.correction.colorKeep},
- {"luminanceRetention",n.residual.correction.lumaKeep},{"shadowProtection",n.residual.correction.shadow},
- {"correctionAmount",n.residual.correction.autoAmount}};
- }
- return out;
-}
-
-QString QmlPlayerBridge::nrAutoSelectionReason(int index) const {
- const auto cap=effectCapabilities().value("nrAuto").toMap();
- if(!cap.value("available").toBool())return cap.value("reason").toString();
- const auto& s=settings();const auto& snapshot=impl_->snapshot;
- int first=-1;unsigned count=0;bool temporal=false,otherAuto=false;
- for(uint32_t i=0;i<impl_->chain.nodeCount;++i){const auto& node=impl_->chain.nodes[i];
- if(node.type!=engine::EffectType::NrEnhance)continue;
- if(first<0)first=int(i);
- ++count;temporal|=node.enabled&&(node.nr.residual.correction.enabled?
- node.nr.residual.correction.usesHistory():node.nr.temporal);
- otherAuto|=int(i)!=index&&node.enabled&&node.nr.sizePolicy==pipeline::NrSizePolicy::Auto;
- }
- if(first!=index||count>2||otherAuto)return tr("自动 NR 仅支持一至两层列表的第一层");
- if(impl_->chain.mode!=engine::ChainMode::List||engine::currentNrRuntime(s.nrRuntime)!=engine::NrRuntime::Ampere||s.sr||s.multiplier>1||temporal||
- s.nrHoldStrength>0||s.color.enabled||s.additionalColorCount||s.antiAlias.enabled||s.additionalAntiAliasCount||s.beautyEnabled()||s.videoHdr.enabled||
- s.opticalFlowBackend!=engine::OpticalFlowBackend::Nvidia||s.nrMotion!=engine::MotionSource::OpticalFlow||snapshot.capture||snapshot.image||snapshot.sourceHdr||
- (snapshot.sourceWidth&& (snapshot.sourceWidth!=1920||snapshot.sourceHeight!=1080)))
- return tr("需 1080p SDR 文件、SF 和 NVIDIA 光流;关闭超分、补帧、抗闪烁、调色、美颜及 HDR");
- return {};
-}
-
-bool QmlPlayerBridge::setNrLayerParameter(int index,const QString& key,double value){
- if(index<0||uint32_t(index)>=impl_->chain.nodeCount||
- impl_->chain.nodes[index].type!=engine::EffectType::NrEnhance||!std::isfinite(value))return false;
- if(key=="runtime") {
- if(value!=0&&value!=1&&value!=2&&value!=3&&value!=4)return false;
- value=int(engine::currentNrRuntime(static_cast<engine::NrRuntime>(int(value))));
- const auto cap = effectCapabilities().value("nr" + QString::number(int(value))).toMap();
- if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return false; }
- const auto before=impl_->chain;
- for(uint32_t i=0;i<impl_->chain.nodeCount;++i)
- if(impl_->chain.nodes[i].type==engine::EffectType::NrEnhance)
- impl_->chain.nodes[i].nr.runtime=static_cast<engine::NrRuntime>(int(value));
- const bool accepted=impl_->revalidate(true);
- if(!accepted){const auto error=impl_->validation.message;impl_->chain=before;impl_->revalidate();emit notice(uiText(error),true);}
- emit settingsChanged();emitChainChanged();return accepted;
- }
- auto& node=impl_->chain.nodes[index];const auto before=node;auto& n=node.nr;const bool wasValid=chainValid();
- if(key=="intensity")n.model.intensity=float(value);
- else if(key=="tone")n.model.tone=float(value);
- else if(key=="structure")n.model.structure=float(value);
- else if(key=="skin")n.model.skin=float(value);
- else if(key=="total")n.residual.total=float(value);
- else if(key=="darken")n.residual.darken=float(value);
- else if(key=="brighten")n.residual.brighten=float(value);
- else if(key=="color")n.residual.color=float(value);
- else if(key=="luminance")n.residual.luminance=float(value);
- else if(key=="hueProtection")n.residual.correction.hue=float(value);
- else if(key=="chromaProtection")n.residual.correction.chroma=float(value);
- else if(key=="highlightProtection")n.residual.correction.highlight=float(value);
- else if(key=="localCompression")n.residual.correction.compression=float(value);
- else if(key=="temporalStability")n.residual.correction.stability=float(value);
- else if(key=="neutralProtection")n.residual.correction.neutral=float(value);
- else if(key=="colorRetention")n.residual.correction.colorKeep=float(value);
- else if(key=="luminanceRetention")n.residual.correction.lumaKeep=float(value);
- else if(key=="shadowProtection")n.residual.correction.shadow=float(value);
- else if(key=="correctionAmount")n.residual.correction.autoAmount=float(value);
- else if(key=="sizePercent"){
- if(value!=std::floor(value)||value<pipeline::kNrMinimumPercent||value>pipeline::kNrMaximumPercent)return false;
- n.sizePolicy=pipeline::nrSizePolicyForPercent(unsigned(value));
- }
- else if(key=="sizePolicy"){
- if(value!=std::floor(value)||value<0||value>int(pipeline::NrSizePolicy::Manual))return false;
- const auto policy=static_cast<pipeline::NrSizePolicy>(int(value));
- if(!pipeline::validNrSizePolicy(policy))return false;
- if(policy==pipeline::NrSizePolicy::Auto){const auto reason=nrAutoSelectionReason(index);if(!reason.isEmpty()){emit notice(reason,true);return false;}}
- n.sizePolicy=policy;
- }
- else {
- if(value!=std::floor(value)||value<0||value>6)return false;
- if(key=="style"&&value<=2)n.model.style=int(value);
- else if(key=="autoMask"&&value<=1)n.model.autoMask=int(value);
- else if(key=="uiCorrection"&&value<=1)n.model.uiCorrection=int(value);
- else if(key=="performance"&&value<=1&&engine::nrUsesPerformanceModel(n.runtime))n.model.performance=value!=0;
- else if(key=="temporal"&&value<=1)n.temporal=value!=0;
- else if(key=="correctionEnabled"&&value<=1)n.residual.correction.enabled=value!=0;
- else if(key=="correctionAuto"&&value<=1)n.residual.correction.automatic=value!=0;
- else if(key=="correctionUseAuto"&&value==1)n.residual.correction.useAutomaticValues(n.model.style);
- else if(key=="antiFlicker"&&validNrAntiFlicker(engine::NrAntiFlicker(int(value))))n.antiFlicker=static_cast<engine::NrAntiFlicker>(int(value));
- else return false;
- }
- if(node==before)return true;
- const bool accepted=impl_->revalidate(true);
- if(!accepted){const auto error=impl_->validation.message;node=before;impl_->revalidate();emit notice(uiText(error),true);}
- emit settingsChanged();emitParameterChanged(&QmlPlayerBridge::nrLayersChanged,wasValid);return accepted;
-}
-
-QVariantList QmlPlayerBridge::effectCatalog() const {
- QVariantList out;
- for (const auto& info : engine::effectCatalog()) {
- if (info.hidden) continue;
- if (impl_->chain.mode == engine::ChainMode::Node && info.type == engine::EffectType::Protection) continue;
- if (impl_->chain.mode == engine::ChainMode::Node && info.type == engine::EffectType::FrameGeneration) {
- for(const auto& choice : fgBackendChoices()) {
- const auto option=choice.toMap();const auto backend=option.value("id").toString();
- QVariantMap fg;
- fg["id"]=backend+QStringLiteral("-fg");
- fg["label"]=option.value("label");
- fg["maxInstances"]=1;fg["repeatable"]=false;fg["mustBeLast"]=true;
- fg["justBeforeLast"]=false;fg["experimental"]=backend!=QLatin1String("dlss");
- fg["disabled"]=option.value("disabled");fg["note"]=option.value("note");
- out<<fg;
- }
- continue;
- }
- QVariantMap item;
- item["id"] = utf8Of(info.id);
- item["label"] = uiText(info.label);
- item["maxInstances"] = int(info.maxInstances);
- item["repeatable"] = info.repeatable;
- item["mustBeLast"] = info.mustBeLast;
- item["justBeforeLast"] = info.justBeforeLast;
- item["experimental"] = info.experimental;
- auto cap = effectAvailability(utf8Of(info.id));
- if(info.type==engine::EffectType::FrameGeneration)
- for(const auto& choice:fgBackendChoices())if(!choice.toMap().value("disabled").toBool()){
- cap=QVariantMap{{"available",true},{"reason",QString{}}};break;
- }
- item["disabled"] = !cap.value("available").toBool();
- item["note"] = cap.value("reason");
- out << item;
- }
- return out;
-}
-
-QString QmlPlayerBridge::chainError() const { return uiText(impl_->validation.message); }
-void QmlPlayerBridge::emitChainChanged() {
- emit chainChanged(); emit nrLayersChanged(); emit videoHdrParamsChanged();
- emit antiAliasChanged(); emit beautyChanged(); emit colourParamsChanged(); emit protectionChanged();
-}
-// Every chainChanged re-evaluated all chain-bound bindings on every page (the pro
-// and node pages stay loaded) and repainted the node wires: 65-80 ms of interface
-// thread per 40 ms slider step with six effects (audit 2026-10-15).
-void QmlPlayerBridge::emitParameterChanged(void (QmlPlayerBridge::*group)(), bool wasValid) {
- if (chainValid() != wasValid) { emitChainChanged(); return; }
- (this->*group)();
-}
-bool QmlPlayerBridge::chainValid() const { return impl_->validation.accepted; }
-int QmlPlayerBridge::nodeMode() const { return impl_->chain.mode == engine::ChainMode::Node ? 1 : 0; }
-void QmlPlayerBridge::setNodeMode(int mode) {
- if (mode < 0 || mode > 1) { emit notice(tr("无效编辑模式"), true); return; }
- const auto want = mode ? engine::ChainMode::Node : engine::ChainMode::List;
- if (impl_->chain.mode == want) return;
- const auto previousSession = impl_->currentSession();
- auto candidate = previousSession;
- const bool freshNode = want == engine::ChainMode::Node && !candidate.initialized[size_t(want)];
- if (!candidate.select(want)) { emit notice(tr("模式配置无效,未切换"), true); return; }
- if (freshNode) {
- // The first visit to the node editor starts from an empty graph (input
- // straight to output), not a copy of the list's effects.
- auto& fresh = candidate.configurations[size_t(want)];
- auto empty = std::make_unique<engine::EffectChain>();
- empty->mode = engine::ChainMode::Node;
- empty->fgMultiplier = fresh.chain.fgMultiplier;
- fresh.chain = *empty;
- fresh.editor.reset();
- fresh.selectedNr = fresh.selectedColour = -1;
- }
- const auto previousSettings = impl_->facade.pendingSettings();
- auto next = previousSettings;
- auto& configuration = candidate.configurations[size_t(want)];
- disableUnavailableEffects(configuration);
- configuration.apply(next);
- if (!next.validate().empty()) { emit notice(tr("模式参数无效,未切换"), true); return; }
- // Save before changing the live mode; an unwritable/corrupt file cannot
- // silently discard the configuration the user is about to leave.
- if (!impl_->facade.saveChainSession(candidate)) { emit notice(uiText(impl_->facade.error()), true); return; }
- if (!impl_->facade.applySettings(next,engine::runtimeOrder(configuration.chain))) {
- impl_->facade.setPending(previousSettings);
- if (!impl_->facade.saveChainSession(previousSession))
- emit notice(tr("引擎拒绝切换,存档回退失败:") + uiText(impl_->facade.error()), true);
- emit notice(tr("引擎未接受模式设置,当前配置不变"), true); return;
- }
- impl_->session = impl_->savedSession = candidate;
- impl_->restoreConfiguration(configuration);
- impl_->revalidate();
- impl_->options = engine::PlayerOptions::from(next,engine::runtimeOrder(impl_->activeRuntime()));
- emitChainChanged();
- emit settingsChanged();
-}
-
-QVariantList QmlPlayerBridge::recentFiles() const {
- QVariantList out;
- for (const auto& entry : impl_->facade.recentFiles()) {
- QVariantMap item;
- item["path"] = utf8Of(entry.path);
- item["label"] = utf8Of(entry.label);
- item["exists"] = entry.exists;
- out << item;
- }
- return out;
-}
-
-QVariantList QmlPlayerBridge::presets() const {
- QVariantList out;
- const auto& entries = impl_->facade.presets().entries();
- for (size_t i = 0; i < entries.size(); ++i) {
- const auto& e = entries[i];
- QVariantMap item;
- item["index"] = int(i);
- item["name"] = utf8Of(e.name);
- item["note"] = uiText(e.note);
- item["builtin"] = e.builtin;
- item["nodeMode"] = e.kind == engine::ChainMode::Node;
- item["contents"] = int(e.contents);
- out << item;
- }
- return out;
-}
-
-QString QmlPlayerBridge::currentPresetName() const {
- // Matching is by name of the stored entry whose chain equals what the UI is
- // showing; anything else is honestly "自定义" rather than the nearest guess.
- const auto& entries = impl_->facade.presets().entries();
- for (const auto& e : entries) {
- if (e.chain == impl_->chain) return utf8Of(e.name);
- }
- return tr("自定义");
-}
-
-QVariantList QmlPlayerBridge::audioTracks() const {
- QVariantList out;
- for (const auto& track : impl_->snapshot.audioTracks) {
- // The track struct carries raw fields; the UI shows the ones that are
- // actually present rather than a synthesized name.
- QStringList parts;
- if (!track.language.empty()) parts << utf8Of(track.language);
- if (!track.title.empty()) parts << utf8Of(track.title);
- if (!track.codec.empty()) parts << utf8Of(track.codec);
- QVariantMap item;
- item["index"] = track.streamIndex;
- item["label"] = parts.isEmpty() ? tr("音轨 %1").arg(track.streamIndex) : parts.join(QStringLiteral(" · "));
- item["channels"] = int(track.channels);
- out << item;
- }
- return out;
-}
-int QmlPlayerBridge::selectedAudioTrack() const { return impl_->snapshot.selectedAudioTrack; }
-void QmlPlayerBridge::setSelectedAudioTrack(int index) {
- impl_->engine.selectAudioTrack(impl_->snapshot.sessionId, index);
-}
-bool QmlPlayerBridge::hasCaptureSession() const { return impl_->facade.hasCaptureSession(); }
-
-QString QmlPlayerBridge::captureSessionSummary() const {
- // Built from the recorded session only: the device, the format and the preset
- // that were actually used. A summary assembled from defaults would read as a
- // history that never happened.
- const auto& session = impl_->facade.lastCaptureSession();
- QStringList parts;
- // The device's friendly name (stored when the session started); the moniker
- // path itself is not something a person can read.
- const QString name = impl_->prefString("captureDeviceName");
- if (!name.isEmpty()) parts << name;
- else if (!session.devicePath.empty()) parts << QFileInfo(utf8Of(session.devicePath)).fileName();
- const QString formatLabel = impl_->prefString("captureFormatLabel");
- if (!formatLabel.isEmpty()) parts << formatLabel.section(QStringLiteral(" · "), 0, 1);
- else if (!session.formatKey.empty()) parts << utf8Of(session.formatKey);
- if (formatLabel.isEmpty() && session.fps > 0.01) parts << QStringLiteral("%1 fps").arg(session.fps, 0, 'f', 2);
- if (!session.presetName.empty()) parts << tr("预设「%1」").arg(utf8Of(session.presetName));
- return parts.join(QStringLiteral(" · "));
-}
-
-void QmlPlayerBridge::resumeCaptureSession() {
- // "Continue": the remembered device, format, audio and colour, re-checked
- // against what the machine reports now; nothing else is picked for the user.
- impl_->capturePrefs = ui::CapturePreferenceStore(impl_->dataDir).load();
- if (impl_->capturePrefs.videoPath.empty()) { emit notice(tr("还没有采集记录"), true); return; }
- impl_->captureDevice = impl_->capturePrefs.videoPath;
- impl_->captureColor = impl_->capturePrefs.colorForDevice(impl_->captureDevice);
- impl_->captureResumePending = true;
- queryCapture(2, impl_->captureDevice);
-}
-
-QString QmlPlayerBridge::colorStatus() const { return uiText(impl_->snapshot.colorStatus); }
-QString QmlPlayerBridge::videoHdrStatus() const { return uiText(impl_->snapshot.videoHdrStatus); }
-
-// --- export -----------------------------------------------------------------
-// Poll the export job once per UI tick. Its snapshot is the source of the
-// numbers below; nothing here keeps a parallel counter that could drift.
-void QmlPlayerBridge::pollExport() {
- const auto& queue=impl_->exportQueue.queue();
- const bool changed=impl_->exportQueue.tick();
- impl_->exportSnapshot=queue.snapshot();
- const auto event=queue.successEvent();
- if(event&&event!=impl_->exportNotifiedBatch){
- impl_->exportNotifiedBatch=event;
- exportCompletionNotice(exportCompletionSound(),event,"video-batch");
- emit notice(uiText(queue.status()),false);
- }
- if(changed)emit exportChanged();
-}
-
-bool QmlPlayerBridge::exportRunning() const { return impl_->exportQueue.queue().busy(); }
-bool QmlPlayerBridge::exportPaused() const {
- return impl_->exportSnapshot.state == engine::ExportState::Paused;
-}
-double QmlPlayerBridge::exportProgress() const { return impl_->exportSnapshot.progress; }
-QString QmlPlayerBridge::exportStatus() const {
- if(impl_->exportSnapshot.active())return uiText(impl_->exportSnapshot.message);
- return uiText(impl_->exportQueue.queue().status());
-}
-QString QmlPlayerBridge::exportTarget() const { return utf8Of(impl_->exportOutput); }
-int QmlPlayerBridge::exportEncoded() const { return int(impl_->exportSnapshot.encoded); }
-int QmlPlayerBridge::exportGenerated() const { return int(impl_->exportSnapshot.generated); }
-double QmlPlayerBridge::exportEtaSeconds() const { return impl_->exportSnapshot.etaSeconds; }
-int QmlPlayerBridge::exportQueueCount() const { return int(std::count_if(impl_->exportQueue.queue().items().begin(),impl_->exportQueue.queue().items().end(),[](const auto& i){return i.state==engine::ExportItemState::Queued;})); }
-int QmlPlayerBridge::exportQueueFailures() const { return int(impl_->exportQueue.queue().failures()); }
-QString QmlPlayerBridge::exportQueueFailure() const { return uiText(impl_->exportSnapshot.lastQueueFailure); }
-
-// HEVC or H.264: the engine's export entry takes this as a flag, so it is a real
-// choice with a real effect rather than a label.
-bool QmlPlayerBridge::exportHevc() const { return impl_->exportHevc; }
-void QmlPlayerBridge::setExportHevc(bool value) {
- if (impl_->exportHevc == value) return;
- impl_->exportHevc = value;
- emit exportChanged();
-}
-
-// Export bitrate: 0 means the encoder's constant-quality default, which is what
-// the engine's exportBitrateMbps field documents.
-int QmlPlayerBridge::exportBitrateMbps() const { return int(impl_->exportBitrateMbps); }
-void QmlPlayerBridge::setExportBitrateMbps(int value) {
- const uint32_t want = uint32_t(std::clamp(value, 0, 300));
- if (impl_->exportBitrateMbps == want) return;
- impl_->exportBitrateMbps = want;
- emit exportChanged();
-}
-
-int QmlPlayerBridge::exportRateControl() const { return int(impl_->exportRateControl); }
-void QmlPlayerBridge::setExportRateControl(int value) {
- if (value < 0 || value > 2) return;
- const auto want = static_cast<sink::ExportRateControl>(value);
- if (impl_->exportRateControl == want) return;
- impl_->exportRateControl = want;
- emit exportChanged();
-}
-
-QString QmlPlayerBridge::exportPresetName() const {
- return impl_->exportPresetName.empty() ? tr("当前播放设置") : utf8Of(impl_->exportPresetName);
-}
-
-int QmlPlayerBridge::exportSrTargetIndex() const {
- return impl_->exportResolutionIndex;
-}
-void QmlPlayerBridge::setExportSrTargetIndex(int index) {
- if (index < -1 || index > 6 || impl_->exportResolutionIndex == index) return;
- impl_->exportResolutionIndex = index;
- emit exportChanged();
-}
-
-double QmlPlayerBridge::exportTrimStart() const { return impl_->exportTrimStartSeconds; }
-void QmlPlayerBridge::setExportTrimStart(double seconds) {
- if (!std::isfinite(seconds)) return;
- const double duration = impl_->snapshot.duration;
- const double end = impl_->exportTrimEndSeconds > 0.0 ? impl_->exportTrimEndSeconds : duration;
- const double maxStart = end > 0.05 ? end - 0.05 : 0.0;
- const double value = std::clamp(seconds, 0.0, std::max(0.0, maxStart));
- if (std::abs(impl_->exportTrimStartSeconds - value) < 0.0005) return;
- const auto selected=impl_->exportQueue.selectedId();
- if(selected&&!impl_->exportQueue.queue().setTrim(selected,value,impl_->exportTrimEndSeconds))return;
- impl_->exportTrimStartSeconds = value;
- emit exportChanged();
-}
-
-double QmlPlayerBridge::exportTrimEnd() const { return impl_->exportTrimEndSeconds; }
-void QmlPlayerBridge::setExportTrimEnd(double seconds) {
- if (!std::isfinite(seconds)) return;
- const double duration = impl_->snapshot.duration;
- const double sourceEnd = duration > 0.0 ? duration : seconds;
- const double value = std::clamp(seconds, 0.0, std::max(0.0, sourceEnd));
- const double start = impl_->exportTrimStartSeconds;
- if (value > 0.0 && value <= start + 0.05) return;
- if (std::abs(impl_->exportTrimEndSeconds - value) < 0.0005) return;
- const auto selected=impl_->exportQueue.selectedId();
- if(selected&&!impl_->exportQueue.queue().setTrim(selected,impl_->exportTrimStartSeconds,value))return;
- impl_->exportTrimEndSeconds = value;
- emit exportChanged();
-}
-
-QString QmlPlayerBridge::srTargetLabel() const {
- // The label follows the SR target, because that is what sets the output size.
- switch (srTargetIndex()) {
- case 1: return QStringLiteral("2K");
- case 2: return QStringLiteral("4K");
- case 3: return QStringLiteral("8K");
- case 4: return QStringLiteral("5K");
- case 5: return QStringLiteral("6K");
- case 6: return QStringLiteral("7K");
- default: return tr("源尺寸");
- }
-}
-
-int QmlPlayerBridge::srTargetIndex() const {
- // UI IDs 1/2/3 remain 2K/4K/8K; append 4/5/6 for 5K/6K/7K.
- switch (settings().srTarget) {
- case pipeline::SrTarget::Qhd: return 1;
- case pipeline::SrTarget::Uhd4K: return 2;
- case pipeline::SrTarget::Uhd8K: return 3;
- case pipeline::SrTarget::Uhd5K: return 4;
- case pipeline::SrTarget::Uhd6K: return 5;
- case pipeline::SrTarget::Uhd7K: return 6;
- }
- return 0;
-}
-void QmlPlayerBridge::setSrTargetIndex(int index) {
- if(index<1||index>6)return;
- auto s = settings();
- pipeline::SrTarget want = pipeline::SrTarget::Uhd4K;
- switch (index) {
- case 1: want = pipeline::SrTarget::Qhd; break;
- case 2: want = pipeline::SrTarget::Uhd4K; break;
- case 3: want = pipeline::SrTarget::Uhd8K; break;
- case 4: want = pipeline::SrTarget::Uhd5K; break;
- case 5: want = pipeline::SrTarget::Uhd6K; break;
- case 6: want = pipeline::SrTarget::Uhd7K; break;
- default: break;
- }
- if (s.srTarget == want) return;
- s.srTarget = want;
- impl_->commit(std::move(s));
- emit settingsChanged();
-}
-
-QVariantList QmlPlayerBridge::presetChoices() const {
- // One list for both kinds; the label carries the distinction so the export page
- // can offer "any preset" without a second control.
- QVariantList out;
- out << QVariantMap{{"id", QStringLiteral("-1")}, {"label", tr("当前播放设置")}};
- const auto& entries = impl_->facade.presets().entries();
- for (size_t i = 0; i < entries.size(); ++i) {
- QVariantMap item;
- item["id"] = QString::number(i);
- item["label"] = utf8Of(entries[i].name)
- + (entries[i].kind == engine::ChainMode::Node ? tr(" · 节点") : QString());
- item["disabled"] = entries[i].kind == engine::ChainMode::Node;
- out << item;
- }
- return out;
-}
-
-void QmlPlayerBridge::pauseExport(bool paused) {
- impl_->exportJob.pause(paused);
- pollExport();
-}
-
-QString QmlPlayerBridge::formatTime(double seconds) const { return mmss(seconds); }
-
-QString QmlPlayerBridge::diagnosticsReport() const {
- // Engine-reported values only. A diagnostic that guesses is worse than none.
- const auto& s = impl_->snapshot;
- QStringList lines;
- lines << tr("状态: %1").arg(uiText(s.status));
- lines << tr("源: %1x%2 旋转 %3° 标称 %4 fps")
- .arg(s.sourceWidth).arg(s.sourceHeight).arg(s.sourceRotationDegrees)
- .arg(s.nominalSourceFps, 0, 'f', 2);
- lines << tr("提交 FPS: %1").arg(s.submissionFps ? QString::number(*s.submissionFps, 'f', 2) : tr("未测量"));
- lines << tr("晚点: 当前 %1 ms / P95 %2 ms").arg(s.lateMs, 0, 'f', 2).arg(s.lateP95Ms, 0, 'f', 2);
- lines << tr("调度等待 P95: %1 ms").arg(s.schedulingWaitP95Ms, 0, 'f', 2);
- lines << tr("处理 CPU P95: %1 ms").arg(s.processCpuP95Ms, 0, 'f', 2);
- lines << tr("呈现 CPU P95: %1 ms").arg(s.presentCpuP95Ms, 0, 'f', 2);
- lines << tr("帧: 已处理 %1 生成 %2").arg(s.frames).arg(s.generated);
- lines << tr("NR 求值 %1 / NVOF %2").arg(s.nrEvaluated).arg(s.nvofExecuted);
- if (s.capture) {
- lines << tr("采集: 接收 %1 丢弃 %2 速率 %3 fps")
- .arg(s.captureReceived).arg(s.captureDropped).arg(s.captureFps, 0, 'f', 2);
- }
- if (!s.backendWarning.empty()) lines << tr("后端告警: %1").arg(uiText(s.backendWarning));
- if (!s.colorStatus.empty()) lines << tr("色彩: %1").arg(uiText(s.colorStatus));
- if (!s.videoHdrStatus.empty()) lines << tr("Video HDR: %1").arg(uiText(s.videoHdrStatus));
- return lines.join(QLatin1Char('\n'));
-}
-
-// --- commands ---------------------------------------------------------------
-void QmlPlayerBridge::openFileDialog() {
- veyra::log::info("qml-file", "openFileDialog entered");
- const QString path = QFileDialog::getOpenFileName(
- nullptr, tr("打开视频或图片"), QString(),
- tr("媒体文件 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.jpg *.jpeg *.png *.bmp *.webp);;所有文件 (*)"));
- veyra::log::info("qml-file", path.isEmpty() ? "openFileDialog cancelled" : "openFileDialog selected file");
- if (!path.isEmpty()) openPath(path);
-}
-int QmlPlayerBridge::thumbnailGeneration() const { return impl_->thumbnailGeneration; }
-
-QObject* QmlPlayerBridge::playlist() const { return impl_->playlist; }
-void QmlPlayerBridge::showPlaylist() { emit playlistRequested(); }
-void QmlPlayerBridge::addPlaylistFilesDialog() {
- const auto paths = QFileDialog::getOpenFileNames(nullptr, tr("添加文件到播放列表"), {},
- tr("媒体文件 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.mts *.m4v *.wmv *.mpg *.mpeg *.vob *.flv *.ogv *.asf *.3gp *.jpg *.jpeg *.png *.bmp *.webp);;所有文件 (*)"));
- if (!paths.isEmpty()) { impl_->playlist->addPaths(paths); emit playlistRequested(); }
-}
-void QmlPlayerBridge::addPlaylistFolderDialog() {
- const auto path = QFileDialog::getExistingDirectory(nullptr, tr("导入文件夹到播放列表"));
- if (!path.isEmpty()) { impl_->playlist->addPaths({path}); emit playlistRequested(); }
-}
-void QmlPlayerBridge::openDroppedUrls(const QList<QUrl>& urls) {
- // A single file on the video retains drag-to-open. Folder/multi-file drops
- // append to the playlist; dropping inside PlaylistWindow always appends.
- if (urls.size() == 1) {
- const QUrl url = urls.front();
- if(!url.isLocalFile()){openUrl(url);return;}
- if (url.isLocalFile() && !QFileInfo(url.toLocalFile()).isDir()) { openUrl(url); return; }
- }
- impl_->playlist->addUrls(urls);
- emit playlistRequested();
-}
-void QmlPlayerBridge::tickPlaylist() {
- const auto& s = impl_->snapshot;
- using T = engine::TransportState;
- if (!impl_->playlistSession) return;
- if (!impl_->liveKind.isEmpty() || utf8Of(impl_->sourceLabel) != impl_->playlistPath) {
- impl_->playlistSession = 0; impl_->playlist->setPlayback({}, {}); return;
- }
- if (s.sessionId != impl_->playlistSession) return; // Ignore old session snapshots after open.
- if (s.capture || s.remotePlay) { impl_->playlistSession = 0; impl_->playlist->setPlayback({}, {}); return; }
- QString state = QStringLiteral("stopped");
- switch (s.transport) {
- case T::Opening: state = QStringLiteral("opening"); break;
- case T::Playing: state = s.image ? QStringLiteral("image") : QStringLiteral("playing"); break;
- case T::Paused: state = QStringLiteral("paused"); break;
- case T::Ended: state = QStringLiteral("ended"); break;
- case T::Failed: state = QStringLiteral("failed"); break;
- default: break;
- }
- impl_->playlist->setPlayback(impl_->playlistPath, state);
- if (s.transport != T::Ended || s.failed || s.image || impl_->openingSource ||
- impl_->playlistCompletedSession == s.sessionId) return;
- impl_->playlistCompletedSession = s.sessionId;
- // Wait for this GUI tick to finish, then recheck the engine session. A stop,
- // new file, or live source selected in between must cancel auto-advance.
- QTimer::singleShot(0, this, [this, session = s.sessionId] {
- const auto latest = impl_->engine.snapshot();
- if (impl_->playlistSession == session && latest.sessionId == session &&
- latest.transport == T::Ended && !latest.failed && !latest.image && impl_->liveKind.isEmpty())
- impl_->playlist->advanceAfterEnd();
- });
-}
-
-void QmlPlayerBridge::openPath(const QString& path) {
- if (path.isEmpty()) return;
- flushHdrMemory();impl_->hdrTitleApplied.clear();
- const bool network=media::networkMediaInput(wideOf(path));
- if (QFileInfo(path).isDir()) {
- impl_->playlist->addPaths({path}); emit playlistRequested(); return;
- }
- if (!network&&PlaylistModel::supported(path) && !impl_->playlist->containsPath(path)) impl_->playlist->addPaths({path});
- impl_->playlistPath = path;
- impl_->playlist->setPlayback(path, QStringLiteral("opening"));
- rememberPosition(true);
- impl_->exportQueue.setSelectedId(0);
- ++impl_->liveOpenGen; impl_->pendingLiveText.clear(); // a waiting live open is dropped
- impl_->exportTrimStartSeconds = 0.0;
- impl_->exportTrimEndSeconds = 0.0;
- emit exportChanged();
- impl_->openingSource = true;
- impl_->openingSessionId = 0;
- const std::wstring wide = wideOf(path);
- impl_->sourceLabel = wide;
- impl_->liveKind.clear();
- impl_->liveLabel.clear();
- if(network){impl_->liveKind=QStringLiteral("url");impl_->liveLabel=QUrl(path).host();}
- ++impl_->thumbnailGeneration;
- emit thumbnailSourceChanged(network?QString():path);
- emit thumbnailGenerationChanged();
- if(!network)impl_->facade.noteRecentFile(wide);
- emit recentFilesChanged();
- // Switch to a page with a video area, then settle the native window's
- // geometry, and only then open. The presenter samples the window's client
- // size once at initialisation; opening before that point is what produced a
- // 1x1 swapchain.
- // Only leave the current page when the user is choosing a source from home.
- // Opening a file from the professional page keeps them there, which is what the
- // design's source menu implies.
- if (impl_->currentPage.isEmpty() || impl_->currentPage == QLatin1String("home"))
- emit navigate(QStringLiteral("min"));
- if(!network)rememberSource(QStringLiteral("file"), path);
- if (impl_->preOpen) impl_->preOpen();
- auto options = impl_->options;
- options.softwareDecode = impl_->prefString("decode") == QLatin1String("software");
- options.hardwareDecodeOnly = impl_->prefString("decode") == QLatin1String("hardware");
- options.deinterlace=deinterlaceAvailable()&&impl_->prefBool("deinterlace",true);
- // Network / server playback (#48): read at open, like the decode choice above.
- options.network.level=media::networkBufferLevelFromId(impl_->prefString("networkBuffer").toStdString());
- options.network.startupPrebufferSeconds=impl_->prefs.value(QStringLiteral("networkPrebuffer"),-1).toInt();
- options.network.autoReconnect=impl_->prefBool("networkAutoReconnect",true);
- options.network.corrupt=media::corruptPolicyFromId(impl_->prefString("networkCorrupt").toStdString());
- impl_->engine.open(impl_->videoWindow, wide, options);
- impl_->openingSessionId = impl_->engine.snapshot().sessionId;
- impl_->playlistSession = network?0:impl_->openingSessionId;
- impl_->resumeSession = 0;
- if ((impl_->prefBool("rememberPosition", true)||impl_->prefBool("autoResume",false))) {
- const auto saved = impl_->prefs.value("positions").toMap().value(path).toMap();
- if (!saved.isEmpty()) { impl_->resumeSession = impl_->openingSessionId; impl_->resumeAt = saved.value("at").toDouble(); }
- }
- refreshSubtitles(network?std::wstring():wide);
-}
-
-bool QmlPlayerBridge::deinterlaceAvailable() const { return media::FFmpegDeinterlacer::available(); }
-void QmlPlayerBridge::openNetworkDialog(){emit navigate(QStringLiteral("network"));}
-bool QmlPlayerBridge::openNetworkAddress(const QString& address){
- const QUrl url(address.trimmed(),QUrl::StrictMode);
- if(!url.isValid()||url.host().isEmpty()||!media::networkMediaInput(wideOf(url.scheme()+QStringLiteral(":")))){
- emit notice(tr("请输入有效的 HTTP、HTTPS 或 RTSP 视频地址"),true);return false;
- }
- openPath(url.adjusted(QUrl::RemoveFragment).toString(QUrl::FullyEncoded));return true;
-}
-
-void QmlPlayerBridge::togglePlayPause() {
- // AppShell's Play button: a paused session is still "running" (the worker
- // stays alive), so the decision must come from the transport state.
- const auto& s = impl_->snapshot;
- using T = engine::TransportState;
- if (s.image || s.transport == T::Opening || s.transport == T::Stopping) return;
- if(impl_->liveKind==QLatin1String("url")&&(s.transport==T::Ended||(s.transport==T::Paused&&s.duration<=0))){
- openNetworkAddress(QString::fromStdWString(impl_->sourceLabel));return;
- }
- // Capture cards and streams pause too (field request 2026-10-02): the engine stops
- // reading and enhancing, keeps the last picture and resets the source's queue, so
- // play resumes with the newest frame rather than a backlog. The connection stays up.
- if (s.capture && s.running) {
- const bool pause = s.transport == T::Playing;
- impl_->engine.pause(pause);
- veyra::log::info("ui-transport", pause ? "live pause" : "live resume");
- emit notice(pause ? tr("已暂停:画面停在当前帧,不再处理新画面;点播放继续") : tr("已继续"), false);
- return;
- }
- if (!s.running || s.transport == T::Ended) {
- // Only a real file is reopened; device/stream labels are not paths.
- const QString file = QString::fromStdWString(impl_->sourceLabel);
- if (!file.isEmpty() && QFileInfo(file).isFile()) openPath(file);
- return;
- }
- const bool pause = s.transport == T::Playing;
- impl_->engine.pause(pause);
- veyra::log::info("ui-transport", pause ? "pause" : "resume");
-}
-void QmlPlayerBridge::stopPlayback() {
- flushHdrMemory();
- impl_->playlistSession = 0;
- impl_->playlist->setPlayback(impl_->playlistPath, QStringLiteral("stopped"));
- rememberPosition(true);
- ++impl_->liveOpenGen; impl_->pendingLiveText.clear();
- impl_->openingSource = false;
- impl_->openingSessionId = 0;
- impl_->engine.stop();
- stopPs5Control();
-}
-void QmlPlayerBridge::seekTo(double seconds) { impl_->engine.seek(seconds); }
-void QmlPlayerBridge::seekBy(double seconds) {
- impl_->engine.seek(std::max(0.0, impl_->snapshot.position + seconds));
-}
-void QmlPlayerBridge::openUrl(const QUrl& url) {
- if(!url.isLocalFile()){openNetworkAddress(url.toString(QUrl::FullyEncoded));return;}
- if (!url.isLocalFile()) {
- emit notice(tr("只能打开本地文件"), true);
- return;
- }
- // Opened inside the drop, as AppShell's WM_DROPFILES does.
- veyra::log::info("ui-drop", url.toLocalFile().toStdString());
- openPath(QDir::toNativeSeparators(url.toLocalFile()));
-}
-void QmlPlayerBridge::logUi(const QString& channel, const QString& text) {
- const std::string c = channel.toStdString();
- veyra::log::info(c.c_str(), text.toStdString());
-}
-void QmlPlayerBridge::setWindowMask(QObject* window, const QRectF& rect) {
- auto* w = qobject_cast<QWindow*>(window);
- if (!w) return;
- w->setMask(QRegion(rect.toAlignedRect()));
-}
-void QmlPlayerBridge::holdOriginal(bool held) {
- // Releasing the key returns to whatever the 显示 page chose (off or split).
- if (held) impl_->engine.comparison(1, false);
- else impl_->engine.comparison(impl_->compareMode, impl_->compareBase, float(impl_->compareSplit));
- veyra::log::info("ui-compare", held ? "hold original on" : "hold original off");
-}
-void QmlPlayerBridge::stepFrame(int direction) {
- // A frame step is a small seek. The engine owns the real frame duration, so
- // this is honest about being approximate rather than pretending to be exact.
- if (!direction) return;
- impl_->engine.seek(std::max(0.0, impl_->snapshot.position + (direction > 0 ? 1.0 / 60.0 : -1.0 / 60.0)));
-}
-
-void QmlPlayerBridge::takeScreenshot() {
- if (!hasSource()) { emit notice(tr("没有正在播放的画面,无法截图"), true); return; }
- if(!impl_->pendingScreenshot.isEmpty()||!impl_->pendingFrameExport.isEmpty()||imageBatchActive()){emit notice(tr("请等待当前图片导出完成"),true);return;}
- const QString folder = screenshotDirectory();
- if (!QDir().mkpath(folder)) { emit notice(tr("截图目录不可用:%1").arg(folder), true); return; }
- const QString name = QStringLiteral("veyra-%1.png")
- .arg(QDateTime::currentDateTime().toString(QStringLiteral("yyyyMMdd-HHmmss-zzz")));
- const QString path = QDir(folder).filePath(name);
- impl_->engine.saveFrame(wideOf(QDir::toNativeSeparators(path)));
- impl_->pendingScreenshot=path;
- impl_->pendingScreenshotDeadline=QDateTime::currentMSecsSinceEpoch()+30000;
- impl_->lastScreenshot.clear();
- veyra::log::info("ui-screenshot", "requested path=" + path.toStdString());
- emit preferencesChanged();
-}
-
-// --- shell preferences (P4-f / P4-c / P4-d) --------------------------------
-QVariantMap QmlPlayerBridge::preferences() const { return impl_->prefs; }
-QString QmlPlayerBridge::gpuPriorityStatus() const {
- const auto status=gfx::gpuPriorityStatus();
- const auto name=[](int priority){return priority==5?tr("实时"):priority==4?tr("高"):tr("普通");};
- if(status.state==gfx::GpuPriorityState::Pending)return tr("创建显卡会话后生效");
- if(status.state==gfx::GpuPriorityState::Unavailable)return tr("系统不支持调整 GPU 优先级");
- if(status.state==gfx::GpuPriorityState::Rejected)return tr("系统未接受设置,当前:%1").arg(status.actual<0?tr("未知"):name(status.actual));
- if(status.capped)return tr("已生效:%1(抖音直播伴侣运行中,暂不使用实时)").arg(name(status.actual));
- return tr("已生效:%1").arg(name(status.actual));
-}
-bool QmlPlayerBridge::enhancementPrewarmAvailable() const {
- // PreviewGpuSession::prepare refuses RTX 30/40 (patched FG sessions keep the
- // full NGX lifetime), so the switch must not look usable there either.
- const auto gpu=effectGpu();
- return gpu.vendor==0x10DE&&!ngx::FgCompatibilitySession::requested(gpu.vendor,gpu.deviceId);
-}
-void QmlPlayerBridge::scheduleEnhancementPrewarm(){
- QTimer::singleShot(2000,this,[this]{
- if(!impl_->prefBool("prewarmEnhancement",false)||!enhancementPrewarmAvailable()||impl_->openingSource||impl_->snapshot.running||!impl_->engine.idle())return;
- if(engine::runtimeOrder(impl_->activeRuntime()))return;
- const auto saved=impl_->prefs.value(QStringLiteral("lastSourceExtent")).toMap();
- const auto width=saved.value("width",1920).toUInt(),height=saved.value("height",1080).toUInt();
- const bool valid=width>=64&&height>=64&&width<=3840&&height<=2160;
- impl_->engine.prewarmEnhancement(impl_->facade.pendingSettings(),valid?width:1920,valid?height:1080);
- });
-}
-void QmlPlayerBridge::rememberWindowSize(int width, int height) {
- // Only kept when the user chose "记住上次"; the key is internal.
- if (width < 400 || height < 200 || width > 16384 || height > 16384) return;
- const QString v = QStringLiteral("%1x%2").arg(width).arg(height);
- if (impl_->prefs.value(QStringLiteral("lastWindow")).toString() == v) return;
- impl_->prefs[QStringLiteral("lastWindow")] = v;
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "last window size not saved");
-}
-QRect QmlPlayerBridge::screenAvailableAt(int x, int y) const {
- QScreen* screen = QGuiApplication::screenAt(QPoint(x, y));
- if (!screen) screen = QGuiApplication::primaryScreen();
- return screen ? screen->availableGeometry() : QRect(0, 0, 1920, 1040);
-}
-QRect QmlPlayerBridge::launchScreenAvailable() const {
- const QPoint at = QCursor::pos();
- return screenAvailableAt(at.x(), at.y());
-}
-
-bool QmlPlayerBridge::setPreference(const QString& key, const QVariant& value) {
- if(key==QLatin1String("blackmagicNativeCapture")){
- if(captureQueryBusy()){emit notice(tr("请等待采集设备查询完成后再切换接口"),true);return false;}
- if(captureBlackmagicDevice())impl_->prefs[source::decklink::isPath(impl_->captureDevice)?"blackmagicNativeLastDevice":"blackmagicDirectShowLastDevice"]=utf8Of(impl_->captureDevice);
- }
- static const QHash<QString, std::pair<int, int>> ranges{
- {"subtitleSize", {16, 56}}, {"subtitleFont", {0, 5}}, {"subtitleOutline", {0, 3}},
- {"subtitleMargin", {0, 240}}, {"subtitleLines", {0, 8}},
- // 列表模式 parameter panel width (ProPage splitter); QML clamps it to the window.
- {"listInspectorWidth", {376, 4000}},
- // Network sources (#48): seconds to collect before the first picture; -1 follows the buffer level.
- {"networkPrebuffer", {-1, 60}},
- // Live recording: the target bitrate for the file, and the frame rate
- // cap (0 keeps the presented rate).
- {"recordBitrateMbps", {0, 400}},
- {"recordFps", {0, 240}}};
- static const QStringList flags{"recordHevc", "recordAudio", "subtitleEnabled", "subtitleBackground", "subtitleFit",
- "subtitleSecondLanguage", "audioForceStereo", "holdCompare",
- "magewellLowLatency", "blackmagicNativeCapture", "captureShowAllFrameRates", "cinePillHidden", "exportStopsPlayback", "obsGameCapture", "autoResume", "fullscreenMemoryProtection", "prewarmEnhancement", "hdrFgCompatibility", "computeOnMonitorGpu", "deinterlace", "networkAutoReconnect"};
- QVariant stored;
- if (ranges.contains(key)) {
- bool ok = false; const int n = value.toInt(&ok);
- const auto [low, high] = ranges.value(key);
- if (!ok || n < low || n > high) return false;
- stored = n;
- } else if (flags.contains(key)) {
- stored = value.toBool();
- } else if (key == QLatin1String("screenshotDir")) {
- const QString dir = value.toString();
- if (!dir.isEmpty() && !QFileInfo(dir).isDir()) { emit notice(tr("截图目录不存在:%1").arg(dir), true); return false; }
- stored = dir;
- } else if (key == QLatin1String("recordDir")) {
- const QString dir = value.toString();
- if (!dir.isEmpty() && !QFileInfo(dir).isDir()) { emit notice(tr("录制目录不存在:%1").arg(dir), true); return false; }
- stored = dir;
- } else if (key == QLatin1String("audioDevice")) {
- stored = value.toString();
- } else if (key == QLatin1String("sliderKeyStep")) {
- // Arrow-key step of a focused slider (设置 → 通用): 1, 0.1 or 0.01.
- bool ok = false; const double v = value.toDouble(&ok);
- if (!ok || !(qFuzzyCompare(v, 1.0) || qFuzzyCompare(v, 0.1) || qFuzzyCompare(v, 0.01))) return false;
- stored = v;
- } else if (key == QLatin1String("accent")) {
- const QString v = value.toString();
- if (v != QLatin1String("orange") && v != QLatin1String("white")) return false;
- stored = v;
- } else if (key == QLatin1String("backdrop")) {
- bool ok = false; const int n = value.toInt(&ok);
- if (!ok || n < 0 || n > 2) return false;
- stored = n;
- } else if (key == QLatin1String("uiScale")) {
- bool ok = false; const int n = value.toInt(&ok);
- if (!ok || (n != 0 && n != 100 && n != 125 && n != 150)) return false;
- stored = n;
- } else if (key == QLatin1String("overlayCompat")) {
- // 设置 → 监控软件兼容; read by main.cpp before Qt starts.
- const QString v = value.toString();
- if (v != QLatin1String("auto") && v != QLatin1String("off")) return false;
- stored = v;
- } else if (key == QLatin1String("uiRenderer")) {
- // 设置 → 界面绘制 (veyra/ui/InterfaceRenderer.h); read by main.cpp before Qt starts.
- const QString v = value.toString();
- if (v != QLatin1String("software") && v != QLatin1String("gpu")) return false;
- stored = v;
- } else if (key == QLatin1String("gpuPriority")) {
- const QString v=value.toString();
- if(v!=QLatin1String("normal")&&v!=QLatin1String("high")&&v!=QLatin1String("realtime"))return false;
- stored=v;
- } else if (key == QLatin1String("decode")) {
- const QString v = value.toString();
- if (v != QLatin1String("auto") && v != QLatin1String("software") && v != QLatin1String("hardware")) return false;
- stored = v;
- } else if (key == QLatin1String("networkBuffer")) {
- // Network buffer level (#48): the ids of media::NetworkBufferLevel.
- const QString v = value.toString();
- static const QStringList levels{"auto", "off", "small", "medium", "large"};
- if (!levels.contains(v)) return false;
- stored = v;
- } else if (key == QLatin1String("networkCorrupt")) {
- // What to do with pictures damaged by packet loss (network sources only).
- const QString v = value.toString();
- if (v != QLatin1String("conceal") && v != QLatin1String("keyframe")) return false;
- stored = v;
- } else if (key == QLatin1String("rememberPosition") || key == QLatin1String("dockPinned")) {
- stored = value.toBool();
- } else if (key == QLatin1String("language")) {
- const QString v = value.toString();
- static const QStringList languages{"auto", "zh-CN", "zh-TW", "en", "ja"};
- if (!languages.contains(v)) return false;
- stored = v;
- } else if (key == QLatin1String("monitorGpu")) {
- const QString v = value.toString();
- if (!v.isEmpty() && std::none_of(impl_->gpuAdapters.begin(), impl_->gpuAdapters.end(), [&](const auto& a) { return a.id == v; })) return false;
- stored = v;
- } else if (key == QLatin1String("windowSize")) {
- const QString v = value.toString();
- static const QStringList sizes{"1280x800", "1600x1000", "1920x1200", "last"};
- if (!sizes.contains(v)) return false;
- stored = v;
- } else {
- return false;
- }
- if (impl_->prefs.value(key) == stored) return true;
- const auto previous = impl_->prefs;
- impl_->prefs[key] = stored;
- if (!impl_->savePrefs()) {
- impl_->prefs = previous;
- emit notice(tr("偏好保存失败,已保留原设置"), true);
- return false;
- }
- veyra::log::info("ui-prefs", std::format("{}={}", key.toStdString(), stored.toString().toStdString()));
- applyPreference(key);
- emit preferencesChanged();
- return true;
-}
-void QmlPlayerBridge::applyPreference(const QString& key) {
- if(key==QLatin1String("hdrFgCompatibility")){
- impl_->presentation.hdrFgCompatibility=impl_->prefBool("hdrFgCompatibility",false);
- impl_->engine.requestPresentation(impl_->presentation);
- emit presentationChanged();
- }
- if(key==QLatin1String("prewarmEnhancement")){
- impl_->engine.setEnhancementPrewarmEnabled(impl_->prefBool("prewarmEnhancement",false));
- if(impl_->prefBool("prewarmEnhancement",false))scheduleEnhancementPrewarm();
- }
- if(key==QLatin1String("gpuPriority")){
- const auto value=impl_->prefString("gpuPriority");
- // Unset means the default, 实时 (field request 2026-10-05).
- gfx::requestGpuPriority(value==QLatin1String("normal")?gfx::GpuPriority::Normal:
- value==QLatin1String("high")?gfx::GpuPriority::High:gfx::GpuPriority::Realtime);
- }
- if(key==QLatin1String("overlayCompat"))updateLiveCompanionCompat();
- if(key==QLatin1String("fullscreenMemoryProtection")){impl_->engine.setFullscreenMemoryProtection(impl_->prefBool("fullscreenMemoryProtection",false));emit snapshotChanged();}
- if(key==QLatin1String("captureShowAllFrameRates"))emit captureChanged();
- if (key == QLatin1String("audioDevice")) sink::setPreferredRenderEndpoint(impl_->prefString("audioDevice").toStdWString());
- else if (key == QLatin1String("audioForceStereo")) sink::setForceStereoDownmix(impl_->prefBool("audioForceStereo", false));
- else if (key == QLatin1String("magewellLowLatency")) source::magewell::setLowLatencyPreference(impl_->prefBool("magewellLowLatency", false));
- else if (key == QLatin1String("blackmagicNativeCapture")) { if(impl_->captureListed)refreshCaptureDevices();emit captureChanged(); }
- else if (key == QLatin1String("language")) {
- const QString code = i18n::resolve(impl_->prefString("language"));
- if (!i18n::apply(code)) emit notice(tr("这个语言的翻译没有找到,界面保持简体中文"), true);
- if (impl_->qmlEngine) {
- impl_->qmlEngine->setUiLanguage(i18n::current());
- impl_->qmlEngine->retranslate();
- // Strings the bridge builds itself (tr() in getters) follow once their
- // properties notify: every argument-free notify signal fires once.
- const QMetaObject* meta = metaObject();
- QSet<int> fired;
- for (int i = meta->propertyOffset(); i < meta->propertyCount(); ++i) {
- const QMetaMethod notify = meta->property(i).notifySignal();
- if (notify.isValid() && notify.parameterCount() == 0 && !fired.contains(notify.methodIndex())) {
- fired.insert(notify.methodIndex());
- notify.invoke(this, Qt::DirectConnection);
- }
- }
- impl_->exportQueue.refresh();
- }
- }
- else if (key == QLatin1String("monitorGpu") || key == QLatin1String("computeOnMonitorGpu")) {
- if (key == QLatin1String("monitorGpu")) { impl_->resolveGpuMonitor(); impl_->gpuUtil = -1.0; emit perfChanged(); }
- const auto before = impl_->computeLuid;
- impl_->applyComputeGpu();
- if (impl_->computeLuid != before) {
- // Effect availability follows the compute GPU (NVIDIA-only effects on another card).
- (void)currentEffectCapabilities(true);
- // The chain is checked against the new card the way a restart checks it:
- // DLSS moves to an available backend, NVOF to FidelityFX flow, and stages
- // the card cannot run are switched off with their parameters kept.
- auto candidate = impl_->currentSession();
- const auto previous = candidate;
- // Switching back gives the list mode its frame generation again (DLSS 4X
- // moved to FSR 2X by the last switch returns as DLSS 4X) once the card runs it.
- const auto caps = currentEffectCapabilities();
- const auto runs = [&](const QString& id) { return caps.value(id).toMap().value("available").toBool(); };
- auto& active = candidate.configurations[size_t(candidate.active)];
- const bool listMode = !active.editor;
- const auto memory = impl_->prefs.value(QStringLiteral("computeFgMemory")).toMap();
- bool restored = false;
- if (listMode && !memory.isEmpty()) {
- const auto backend = engine::FrameGenerationBackend(memory.value(QStringLiteral("backend")).toInt());
- const auto flow = engine::OpticalFlowBackend(memory.value(QStringLiteral("flow")).toInt());
- if (runs(fgEffectId(backend))) {
- active.fgBackend = backend;
- active.chain.fgMultiplier = memory.value(QStringLiteral("multiplier")).toUInt();
- if (flow != engine::OpticalFlowBackend::Nvidia || runs(QStringLiteral("flow0"))) active.opticalFlowBackend = flow;
- impl_->prefs.remove(QStringLiteral("computeFgMemory"));
- restored = true;
- veyra::log::info("effect-availability", std::format("compute gpu switch restored backend={} multiplier={}",
- engine::frameGenerationBackendName(backend), active.chain.fgMultiplier));
- }
- }
- QStringList disabled;
- for (auto& configuration : candidate.configurations) {
- const auto reason = disableUnavailableEffects(configuration);
- if (!reason.isEmpty()) disabled << reason;
- }
- const auto& before = previous.configurations[size_t(previous.active)];
- if (listMode && !restored && (before.fgBackend != active.fgBackend || before.opticalFlowBackend != active.opticalFlowBackend))
- impl_->prefs[QStringLiteral("computeFgMemory")] = QVariantMap{{QStringLiteral("backend"), int(before.fgBackend)},
- {QStringLiteral("multiplier"), int(before.chain.fgMultiplier)}, {QStringLiteral("flow"), int(before.opticalFlowBackend)}};
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "compute gpu frame generation memory not saved");
- if (candidate != previous) {
- auto next = impl_->facade.pendingSettings();
- const auto& configuration = candidate.configurations[size_t(candidate.active)];
- configuration.apply(next);
- if (next.validate().empty() && impl_->facade.applySettings(next, engine::runtimeOrder(configuration.chain))) {
- impl_->session = candidate;
- impl_->restoreConfiguration(configuration);
- impl_->revalidate();
- impl_->options = engine::PlayerOptions::from(next, engine::runtimeOrder(impl_->activeRuntime()));
- if (!impl_->persistSession()) veyra::log::warn("effect-availability", "compute gpu refit not saved");
- emitChainChanged(); emit settingsChanged();
- } else veyra::log::warn("effect-availability", "compute gpu refit not accepted; chain unchanged");
- if (!disabled.isEmpty()) {
- const auto message = tr("已关闭当前硬件或包不支持的效果,参数仍保留:") + disabled.join("; ");
- veyra::log::warn("effect-availability", message.toStdString());
- emit notice(message, false);
- }
- }
- emit effectCapabilitiesChanged(); emit fgChoicesChanged();
- if (impl_->snapshot.running)
- emit notice(impl_->computeLuid ? tr("运算显卡已切换为「%1」,重新打开视频后生效").arg(impl_->computeGpuName)
- : tr("运算显卡已恢复默认(性能最强的显卡),重新打开视频后生效"), false);
- }
- }
-}
-QVariantList QmlPlayerBridge::gpuMonitorChoices() const {
- QVariantList out;
- out << QVariantMap{{"id", QString()}, {"label", tr("自动(独立显卡)")}};
- for (const auto& a : impl_->gpuAdapters) out << QVariantMap{{"id", a.id}, {"label", a.name}};
- return out;
-}
-QString QmlPlayerBridge::gpuMonitorName() const { return impl_->gpuMonitorName; }
-QString QmlPlayerBridge::computeGpuHint() const {
- if (!impl_->prefBool("computeOnMonitorGpu", false)) return tr("关闭时增强、补帧和导出用性能最强的显卡");
- if (impl_->computeLuid) return tr("增强、补帧和导出都在「%1」上运行;切换后重新打开视频生效").arg(impl_->computeGpuName);
- return tr("上面选“自动”时仍用性能最强的显卡;选一块显卡后它也负责运算");
-}
-QString QmlPlayerBridge::uiLanguage() const { return i18n::current(); }
-void QmlPlayerBridge::setQmlEngine(QQmlEngine* engine) {
- impl_->qmlEngine = engine;
- if (engine) engine->setUiLanguage(i18n::current());
-}
-QVariantList QmlPlayerBridge::audioDevices() const {
- QVariantList out;
- out << QVariantMap{{"id", QString()}, {"label", tr("跟随系统默认")}, {"isDefault", false}};
- const QString chosen = impl_->prefString("audioDevice");
- bool listed = chosen.isEmpty();
- for (const auto& e : impl_->audioEndpoints) {
- const QString id = QString::fromStdWString(e.id);
- listed = listed || id == chosen;
- out << QVariantMap{{"id", id}, {"label", QString::fromStdWString(e.name) + (e.isDefault ? tr(" · 当前默认") : QString())},
- {"isDefault", e.isDefault}};
- }
- // A saved device that is unplugged stays visible, marked, instead of vanishing.
- if (!listed) out << QVariantMap{{"id", chosen}, {"label", tr("已保存的设备(未连接)")}, {"isDefault", false}, {"missing", true}};
- return out;
-}
-QString QmlPlayerBridge::audioOutputStatus() const {
- const auto& a = impl_->audioActive;
- if (!a.valid) return tr("尚未打开音频输出");
- QString text = QString::fromStdWString(a.name.empty() ? L"(未命名设备)" : a.name) + tr(" · %1 声道").arg(a.channels);
- if (a.downmix) text += tr(" · 下混");
- if (a.fallback) text = tr("所选设备不可用,已回落到系统默认:") + text;
- return text;
-}
-bool QmlPlayerBridge::audioOutputFallback() const { return impl_->audioActive.valid && impl_->audioActive.fallback; }
-void QmlPlayerBridge::refreshAudioDevices() {
- impl_->audioEndpoints = sink::enumerateRenderEndpoints();
- impl_->audioActive = sink::activeRenderEndpoint();
- veyra::log::info("ui-audio", std::format("render endpoints={}", impl_->audioEndpoints.size()));
- emit audioDevicesChanged();
-}
-// --- shortcuts (P4-f) --------------------------------------------------------
-namespace {
-const QVariantMap& shortcutDefaults() {
- static const QVariantMap d{{"playPause", "Space"}, {"fullscreen", "F"}, {"lock", "Ctrl+L"},
- {"hold", "V"}, {"screenshot", "Ctrl+S"}, {"toggleMode", "Tab"},
- {"gamePanel", "Home"}, {"gameExit", "Ctrl+Alt+Home"}};
- return d;
-}
-}
-QVariantMap QmlPlayerBridge::shortcuts() const {
- QVariantMap out = shortcutDefaults();
- const auto custom = impl_->prefs.value("shortcuts").toMap();
- for (auto it = custom.begin(); it != custom.end(); ++it)
- if (out.contains(it.key())) {
- if ((it.key()=="gamePanel"||it.key()=="gameExit") && !ui::gameKey(QKeySequence(it.value().toString(),QKeySequence::PortableText)).vk) continue;
- out[it.key()] = it.value();
- }
- return out;
-}
-bool QmlPlayerBridge::setShortcut(const QString& action, const QString& sequence) {
- if (!shortcutDefaults().contains(action)) return false;
- const QKeySequence seq(sequence, QKeySequence::PortableText);
- if (seq.isEmpty() || seq.count() != 1) { emit notice(tr("无效的按键"), true); return false; }
- const QString text = seq.toString(QKeySequence::PortableText);
- if ((action=="gamePanel"||action=="gameExit") && !ui::gameKey(seq).vk) {
- emit notice(tr("无效的按键"),true); return false;
- }
- if ((action=="gamePanel"||action=="gameExit") &&
- (text=="Ctrl+Alt+Del"||text=="Alt+Tab"||text=="Alt+F4"||text=="Ctrl+Shift+Esc"||text=="Alt+Enter")) {
- emit notice(tr("%1 已被固定功能占用").arg(text),true); return false;
- }
- // Keys the shell already owns cannot be taken over.
- static const QStringList reserved{"Esc", "F11", "Left", "Right", "Up", "Down", "Ctrl+O", "Ctrl+E",
- "B", "Z", "X", "T", "Y", "Shift+Z", "Shift+X", "Alt+Return"};
- if (reserved.contains(text)) { emit notice(tr("%1 已被固定功能占用").arg(text), true); return false; }
- const auto current = shortcuts();
- for (auto it = current.begin(); it != current.end(); ++it)
- if (it.key() != action && it.value().toString() == text) {
- emit notice(tr("%1 已用于其他操作").arg(text), true); return false;
- }
- auto custom = impl_->prefs.value("shortcuts").toMap();
- custom[action] = text;
- const auto previous = impl_->prefs;
- impl_->prefs["shortcuts"] = custom;
- if (!impl_->savePrefs()) { impl_->prefs = previous; emit notice(tr("快捷键保存失败"), true); return false; }
- veyra::log::info("ui-prefs", std::format("shortcut {}={}", action.toStdString(), text.toStdString()));
- const auto keys=shortcuts();
- impl_->game.setHotkeys(ui::gameKey(QKeySequence(keys.value("gamePanel").toString(),QKeySequence::PortableText)),
- ui::gameKey(QKeySequence(keys.value("gameExit").toString(),QKeySequence::PortableText)));
- emit preferencesChanged();
- return true;
-}
-void QmlPlayerBridge::resetShortcuts() {
- const auto previous = impl_->prefs;
- impl_->prefs.remove("shortcuts");
- if (!impl_->savePrefs()) { impl_->prefs = previous; return; }
- impl_->game.setHotkeys(ui::gameKey(QKeySequence("Home")),ui::gameKey(QKeySequence("Ctrl+Alt+Home")));
- emit preferencesChanged();
-}
-bool QmlPlayerBridge::obsGameCaptureActive() const { return qApp && qApp->property("veyraObsGameCapture").toBool(); }
-bool QmlPlayerBridge::overlayCompatActive() const { return qApp && qApp->property("veyraOverlayCompat").toBool(); }
-bool QmlPlayerBridge::softwareUiActive() const { return qApp && qApp->property("veyraSoftwareUi").toBool(); }
-bool QmlPlayerBridge::rivaTunerRunning() const { return gfx::rivaTunerRunning(); }
-bool QmlPlayerBridge::presentationOverlayRunning() const {
- return gfx::rivaTunerRunning() || gfx::nvidiaOverlayRunning() || gfx::gamePPRunning() || gfx::douyinLiveCompanionRunning();
-}
-// The field hangs with 抖音直播伴侣 (2026-10-15) came with this process at Realtime GPU
-// priority. OBS itself never asks for Realtime when hardware-accelerated GPU scheduling
-// is on (High instead, libobs-d3d11 set_priority); the same class is used here while
-// the companion runs, so neither program can hold the GPU off from the other.
-void QmlPlayerBridge::updateLiveCompanionCompat() {
- const bool automatic = impl_->prefString("overlayCompat") != QLatin1String("off");
- const bool running = automatic && !GetEnvironmentVariableW(L"VEYRA_TEST_IGNORE_DOUYIN", nullptr, 0)
- && gfx::douyinLiveCompanionRunning();
- if (running == impl_->liveCompanionCap) return;
- impl_->liveCompanionCap = running;
- gfx::setGpuPriorityCap(running ? gfx::GpuPriority::High : gfx::GpuPriority::Realtime);
- const auto status = gfx::gpuPriorityStatus();
- veyra::log::warn("overlay-hooks", std::format("Douyin live companion {}: GPU priority cap={} requested={} actual={}",
- running ? "running" : "gone", running ? "high" : "none", int(status.requested), status.actual));
- if (running && status.capped)
- emit notice(tr("检测到抖音直播伴侣:GPU 优先级暂时从“实时”降为“高”,避免两个程序争用显卡时卡死;直播伴侣退出后自动恢复"), false);
- emit preferencesChanged();
-}
-
-int QmlPlayerBridge::uiScaleActive() const { return qApp ? qApp->property("veyraUiScale").toInt() : 0; }
-void QmlPlayerBridge::openFeedbackPage() {
- copyDiagnostics();
- QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/Likely7/Veyra-NRVideo/issues")));
- emit notice(tr("诊断信息已复制,可直接粘贴到反馈里"), false);
-}
-void QmlPlayerBridge::openReleasesPage() {
- QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/Likely7/Veyra-NRVideo/releases")));
-}
-bool QmlPlayerBridge::openSponsorLink(const QString& id) {
- // The author's pages as the author gave them (2026-10-19); the page shows buttons,
- // never these addresses.
- static constexpr std::pair<const char*, const char*> links[] = {
- {"bilibili", "https://space.bilibili.com/19500532?spm_id_from=333.1007.0.0"},
- {"douyin", "https://v.douyin.com/9s06Bf2Inqc/"},
- {"x", "https://x.com/likely2002"},
- {"github", "https://github.com/Likely7"},
- {"youtube", "https://www.youtube.com/@Likely7Ai"},
- {"kofi", "https://ko-fi.com/likely7"},
- };
- for (const auto& [name, url] : links) {
- if (id != QLatin1StringView(name)) continue;
- veyra::log::info("ui-sponsor", std::format("open {}", name));
- // Acceptance runs click every card: they read the address from the log
- // instead of opening a browser on the test machine.
- if (qEnvironmentVariableIsSet("VEYRA_TEST_SPONSOR_NO_BROWSER")) {
- veyra::log::info("ui-sponsor", std::format("test url {}", url));
- return true;
- }
- if (QDesktopServices::openUrl(QUrl(QString::fromLatin1(url)))) return true;
- emit notice(tr("无法打开浏览器"), true);
- return false;
- }
- return false;
-}
-QObject* QmlPlayerBridge::updates() const { return updates_; }
-bool QmlPlayerBridge::eventFilter(QObject* watched, QEvent* event) {
- const auto type = event->type();
- if (watched == impl_->gameWindow && (type == QEvent::WinIdChange ||
- (type == QEvent::PlatformSurface && static_cast<QPlatformSurfaceEvent*>(event)->surfaceEventType() ==
- QPlatformSurfaceEvent::SurfaceCreated))) {
- // Rebind after Qt's platform-window transition, never during teardown.
- QMetaObject::invokeMethod(this, [this] {
- if (!impl_->gameWindow || !impl_->gameWindow->handle()) return;
- impl_->game.attach(reinterpret_cast<HWND>(impl_->gameWindow->winId()));
- updateGameGeometry(); updateGameMode();
- }, Qt::QueuedConnection);
- }
- if (type == QEvent::KeyPress || type == QEvent::KeyRelease) {
- auto* key = static_cast<QKeyEvent*>(event);
- if (!key->isAutoRepeat() && qobject_cast<QWindow*>(watched)) {
- const QKeySequence hold(shortcuts().value("hold").toString(), QKeySequence::PortableText);
- const int pressed = key->key() | int(key->modifiers() & ~Qt::KeypadModifier);
- // Typing into a text field never compares.
- const QObject* focus = QGuiApplication::focusObject();
- const bool typing = focus && (focus->inherits("QQuickTextInput") || focus->inherits("QQuickTextEdit"));
- if (!hold.isEmpty() && hold[0].toCombined() == pressed && !typing && impl_->prefBool("holdCompare", true)) {
- const bool down = type == QEvent::KeyPress;
- if (down != impl_->holdKeyDown) { impl_->holdKeyDown = down; holdOriginal(down); }
- return true;
- }
- if (type == QEvent::KeyRelease && impl_->holdKeyDown && key->key() == QKeySequence(hold)[0].key()) {
- impl_->holdKeyDown = false; holdOriginal(false);
- }
- }
- } else if (type == QEvent::ApplicationDeactivate && impl_->holdKeyDown) {
- impl_->holdKeyDown = false; holdOriginal(false);
- }
- return QObject::eventFilter(watched, event);
-}
-// Remembered playback positions: files only, the last 40, saved on switch/stop/exit.
-void QmlPlayerBridge::rememberPosition(bool flush) {
- const auto& s = impl_->snapshot;
- const QString file = QString::fromStdWString(impl_->sourceLabel);
- if (s.running && !s.image && !s.capture && s.duration > 0 && !file.isEmpty() && QFileInfo(file).isFile()) {
- auto positions = impl_->prefs.value("positions").toMap();
- const double at = s.position;
- if (at >= 0.5 && at < s.duration - 0.5) positions[file] = QVariantMap{{"at", at}, {"t", QDateTime::currentSecsSinceEpoch()}};
- else positions.remove(file); // finished or barely started: next time from the top
- while (positions.size() > 40) {
- auto oldest = positions.begin();
- for (auto it = positions.begin(); it != positions.end(); ++it)
- if (it.value().toMap().value("t").toLongLong() < oldest.value().toMap().value("t").toLongLong()) oldest = it;
- positions.erase(oldest);
- }
- impl_->prefs["positions"] = positions;
- }
- if (flush) impl_->savePrefs();
-}
-
-QString QmlPlayerBridge::screenshotDirectory() const {
- const QString chosen = impl_->prefString("screenshotDir");
- if (!chosen.isEmpty()) return chosen;
- const QString pictures = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
- return QDir(pictures.isEmpty() ? QDir::homePath() : pictures).filePath(QStringLiteral("Veyra"));
-}
-QString QmlPlayerBridge::lastScreenshot() const { return impl_->lastScreenshot; }
-QString QmlPlayerBridge::dataDirectory() const { return QString::fromStdWString(impl_->dataDir.wstring()); }
-// main() records the file it actually opened (it falls back to a per-process name).
-QString QmlPlayerBridge::logFile() const { return qApp ? qApp->property("veyraLogFile").toString() : QString(); }
-void QmlPlayerBridge::chooseScreenshotDirectory() {
- const QString dir = QFileDialog::getExistingDirectory(nullptr, tr("选择截图目录"), screenshotDirectory());
- if (!dir.isEmpty()) setPreference(QStringLiteral("screenshotDir"), dir);
-}
-void QmlPlayerBridge::openScreenshotDirectory() {
- const QString dir = screenshotDirectory();
- QDir().mkpath(dir);
- if (!QDesktopServices::openUrl(QUrl::fromLocalFile(dir))) emit notice(tr("无法打开目录:%1").arg(dir), true);
-}
-void QmlPlayerBridge::openLogFolder() {
- const QString file = logFile();
- const QString dir = file.isEmpty() ? QString() : QFileInfo(file).absolutePath();
- if (dir.isEmpty() || !QDesktopServices::openUrl(QUrl::fromLocalFile(dir))) emit notice(tr("日志目录不可用"), true);
-}
-void QmlPlayerBridge::openDataFolder() {
- if (!QDesktopServices::openUrl(QUrl::fromLocalFile(dataDirectory()))) emit notice(tr("无法打开数据目录"), true);
-}
-
-// --- live recording of the processed picture --------------------------------
-// The engine owns the encoder and the file; this side only starts, stops and
-// shows the state. The 3 second countdown is an interface animation and runs
-// before the request is sent.
-QString QmlPlayerBridge::recordingDirectory() const {
- const QString chosen = impl_->prefString("recordDir");
- if (!chosen.isEmpty()) return chosen;
- const QString videos = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
- return QDir(videos.isEmpty() ? QDir::homePath() : videos).filePath(QStringLiteral("Veyra"));
-}
-// 0 = automatic from the picture size and frame rate (LiveRecorder).
-int QmlPlayerBridge::recordingBitrateMbps() const { return std::clamp(impl_->prefInt("recordBitrateMbps", 0), 0, 400); }
-int QmlPlayerBridge::recordingFpsLimit() const { return std::clamp(impl_->prefInt("recordFps", 0), 0, 240); }
-bool QmlPlayerBridge::recordingHevc() const { return impl_->prefBool("recordHevc", false); }
-bool QmlPlayerBridge::recordingAudio() const { return impl_->prefBool("recordAudio", true); }
-bool QmlPlayerBridge::recording() const { return impl_->recordingState.value("active").toBool(); }
-QVariantMap QmlPlayerBridge::recordingState() const { return impl_->recordingState; }
-
-void QmlPlayerBridge::startRecording() {
- if (recording()) { emit notice(tr("录制已在进行中"), true); return; }
- if (!hasSource()) { emit notice(tr("没有正在播放的画面,无法录制"), true); return; }
- engine::RecordingSettings options;
- options.directory = wideOf(recordingDirectory());
- options.bitrateMbps = uint32_t(recordingBitrateMbps());
- options.hevc = recordingHevc();
- options.fpsLimit = uint32_t(std::max(0, recordingFpsLimit()));
- options.audio = recordingAudio();
- std::wstring error;
- if (!impl_->engine.requestRecording(options, error)) { emit notice(uiText(error), true); return; }
- // Shown at once; the poll fills in the file and the counters.
- impl_->recordingState["active"] = true;
- impl_->recordingState["failed"] = false;
- emit recordingChanged();
-}
-void QmlPlayerBridge::stopRecording() {
- if (!recording()) return;
- impl_->engine.stopRecording();
- impl_->recordingState["active"] = false;
- emit recordingChanged();
-}
-void QmlPlayerBridge::toggleRecording() { if (recording()) stopRecording(); else startRecording(); }
-void QmlPlayerBridge::chooseRecordingDirectory() {
- const QString dir = QFileDialog::getExistingDirectory(nullptr, tr("选择录制保存位置"), recordingDirectory());
- if (!dir.isEmpty()) setPreference(QStringLiteral("recordDir"), dir);
-}
-void QmlPlayerBridge::openRecordingDirectory() {
- const QString dir = recordingDirectory();
- QDir().mkpath(dir);
- if (!QDesktopServices::openUrl(QUrl::fromLocalFile(dir))) emit notice(tr("无法打开目录:%1").arg(dir), true);
-}
-
-void QmlPlayerBridge::chooseExportPath() {
- if (impl_->chain.mode == engine::ChainMode::Node) {
- emit notice(tr("节点链尚未接入导出执行器,请切换列表模式后导出"), true);
- return;
- }
- const QString path = QFileDialog::getExistingDirectory(nullptr,tr("选择导出目录"),exportTarget());
- setExportPath(path);
-}
-
-void QmlPlayerBridge::setExportPath(const QString& path) {
- if (path.isEmpty()) return;
- impl_->exportOutput = wideOf(path);
- impl_->exportStatus = QFileInfo(path).fileName();
- emit exportChanged();
-}
-
-void QmlPlayerBridge::startExport() {
- QString error;auto settings=impl_->exportSettings(error);
- if(!settings){emit notice(error,true);return;}
- if(impl_->exportQueue.count()==0){
- if(!QFileInfo(utf8Of(impl_->sourceLabel)).isFile()){emit notice(tr("请先添加要导出的文件"),true);return;}
- const QString target=exportTarget();
- const bool fileTarget=!target.isEmpty()&&!QFileInfo(target).isDir();
- const auto id=impl_->exportQueue.addFile(utf8Of(impl_->sourceLabel),fileTarget?target:QString());
- impl_->exportQueue.queue().setTrim(id,impl_->exportTrimStartSeconds,impl_->exportTrimEndSeconds);
- impl_->exportQueue.setSelectedId(id);
- }
- if(impl_->exportOutput.empty())chooseExportPath();
- if(impl_->exportOutput.empty())return;
- const QFileInfo target(exportTarget());
- const QString folder=target.isDir()?target.absoluteFilePath():target.absolutePath();
- std::wstring reason;
- if(!impl_->exportQueue.queue().start(wideOf(folder),*settings,impl_->exportHevc,impl_->exportRateControl,reason)){
- emit notice(uiText(reason),true);emit exportChanged();return;
- }
- veyra::log::info("qml-export",std::format("export frozen bitrateMbps={} rateControl={} hevc={} srTarget={}",
- settings->exportBitrateMbps,int(impl_->exportRateControl),impl_->exportHevc,int(settings->srTarget)));
- impl_->exportQueue.refresh();pollExport();emit navigate(QStringLiteral("exp"));
- // Leave the GPU to the export (field request 2026-10-02): whatever plays is closed,
- // unless 导出页 → 导出时关闭正在播放的内容 is off.
- if(impl_->prefBool("exportStopsPlayback",true)&&(hasSource()||impl_->openingSource)){
- veyra::log::info("qml-export","export started: closing the playing source");
- stopPlayback();emit notice(tr("已关闭正在播放的内容,显卡全部留给导出"),false);
- }
-}
-void QmlPlayerBridge::cancelExport() {
- impl_->exportQueue.queue().cancel();impl_->exportQueue.refresh();pollExport();emit exportChanged();
-}
-
-void QmlPlayerBridge::restartApplication() {
- requestApplicationRestart(false);
-}
-void QmlPlayerBridge::restartForOverlayCompatibility() {
- requestApplicationRestart(true);
-}
-void QmlPlayerBridge::requestApplicationRestart(bool overlayCompatibility) {
- if (exportRunning()) {
- emit notice(tr("设置已保存,请等待导出结束后重启软件"), true);
- return;
- }
- rememberPosition(true);
- qApp->setProperty("veyraOverlayCompatRestart", overlayCompatibility);
- // main launches the replacement only after UI/engine owners unwind.
- QCoreApplication::exit(42);
-}
-
-void QmlPlayerBridge::quit() {
- rememberPosition(true);
- if (auto* app = qobject_cast<QGuiApplication*>(QCoreApplication::instance())) app->quit();
-}
-
-void QmlPlayerBridge::openCaptureDialog() { emit navigate(QStringLiteral("capture")); }
-void QmlPlayerBridge::openPs5Dialog() { emit navigate(QStringLiteral("ps5")); }
-void QmlPlayerBridge::openScreenCaptureDialog() { emit navigate(QStringLiteral("screen")); }
-void QmlPlayerBridge::openAudioDialog() { emit navigate(QStringLiteral("audio")); }
-void QmlPlayerBridge::openSubtitleDialog() { emit navigate(QStringLiteral("subtitle")); }
-
-// --- chain editing ----------------------------------------------------------
-// The validator is the authority: an edit that would put frame generation or
-// RTX Video HDR where the pipeline cannot honour them is refused with a reason,
-// not silently dropped.
-int QmlPlayerBridge::addEffect(const QString& type) {
- // The generic list entry means "add an available FG stage". A saved,
- // disabled NVIDIA choice must not make FSR/XeSS impossible to add on AMD.
- if(type==QLatin1String("frame-generation")&&
- !effectAvailability(type).value("available").toBool()){
- for(const auto& choice:fgBackendChoices()){
- const auto row=choice.toMap();if(row.value("disabled").toBool())continue;
- return addEffect(row.value("id").toString()+QStringLiteral("-fg"));
- }
- }
- const auto cap = effectAvailability(type);
- if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return -1; }
- const bool fgType=type==QLatin1String("dlss-fg")||type==QLatin1String("xess-fg")||
- type==QLatin1String("fsr3-fg")||type==QLatin1String("fsr4-fg")||type==QLatin1String("vfg-fg");
- const auto fgBackend=type==QLatin1String("vfg-fg")?engine::FrameGenerationBackend::Vfg:type==QLatin1String("fsr4-fg")?engine::FrameGenerationBackend::Fsr4:
- type==QLatin1String("fsr3-fg")?engine::FrameGenerationBackend::Fsr:
- type==QLatin1String("xess-fg")?engine::FrameGenerationBackend::XeSS:engine::FrameGenerationBackend::Dlss;
- const auto fgCeiling=engine::fsrFrameGeneration(fgBackend)?2u:
- fgBackend==engine::FrameGenerationBackend::XeSS?uint32_t(xessCeiling(impl_->snapshot)):fgBackend==engine::FrameGenerationBackend::Vfg?8u:6u;
- if(fgType&&fgBackend==engine::FrameGenerationBackend::Vfg&&(!vfgHardwarePossible()||!pipeline::VfgBackend::runtimeAvailable(runtime::localRuntimeDirectory().wstring()))){
- emit notice(!vfgHardwarePossible()?tr("VFG 需要 NVIDIA Ada / Blackwell 显卡(RTX 40 / 50)"):tr("未找到 VFG 运行组件,请在组件页核对路径"),true);return -1;
- }
- if (impl_->chain.mode == engine::ChainMode::Node) {
- const bool fg = fgType;
- const engine::EffectInfo* info = nullptr;
- for (const auto& item : engine::effectCatalog())
- if ((fg && item.type == engine::EffectType::FrameGeneration) || utf8Of(item.id) == type) info = &item;
- if (!info || info->hidden || info->type == engine::EffectType::Protection) {
- emit notice(tr("节点模式不支持该效果类型"), true); return -1;
- }
- auto& c = impl_->chain;
- auto before = std::make_unique<engine::EffectChain>(c);
- const auto oldLayout = impl_->layout; const auto previous = impl_->facade.pendingSettings();
- const auto oldGlobals = impl_->draftGlobals;
- auto pending = settings();
- if (fg){pending.frameGenerationBackend=fgBackend;c.fgMultiplier=normalizeFgMultiplier(c.fgMultiplier,fgBackend,fgCeiling);}
- int index = -1;
- if (fg) for (uint32_t i = 0; i < c.nodeCount; ++i)
- if (c.nodes[i].type == engine::EffectType::FrameGeneration) index = int(i);
- if (index < 0) {
- if (c.nodeCount >= engine::kMaxChainNodes || c.countOf(info->type) >= info->maxInstances ||
- impl_->layout.nextId == std::numeric_limits<uint32_t>::max()) {
- emit notice(tr("该类型节点已达上限(含禁用和未连接节点)"), true); return -1;
- }
- index = int(c.nodeCount++);
- auto& node = c.nodes[index]; node = engine::ChainNode{}; node.type = info->type;
- node.enabled = info->type != engine::EffectType::Beauty; // beauty starts switched off
- node.viewX = float(index % 4) * 260; node.viewY = float(index / 4) * 300;
- if (info->type == engine::EffectType::NrEnhance) {
- node.nr.runtime = previous.nrRuntime; node.nr.lowLatencyPairing = previous.lowLatency;
- }
- const uint32_t id = impl_->layout.nextId++; impl_->layout.ids[index] = id; impl_->layout.next[index] = 0;
- auto projected = std::make_unique<engine::EffectChain>();
- if (oldLayout.project(*before, *projected).accepted) {
- uint32_t predecessor = 0, next = impl_->layout.inputNext;
- while (next > 1) {
- const int at = impl_->layout.indexOf(c, next);
- const auto t = c.nodes[at].type;
- if (t == engine::EffectType::FrameGeneration ||
- (info->type != engine::EffectType::FrameGeneration && t == engine::EffectType::VideoHdr)) break;
- predecessor = next; next = impl_->layout.next[at];
- }
- if (predecessor == 0) impl_->layout.inputNext = id;
- else impl_->layout.next[size_t(impl_->layout.indexOf(c, predecessor))] = id;
- impl_->layout.next[index] = next;
- }
- } else c.nodes[index].enabled = true;
- impl_->draftGlobals = engine::ChainGlobalSettings::capture(pending);
- if (!impl_->revalidate(true, &previous)) {
- const auto error = impl_->validation.message; c = *before; impl_->layout = oldLayout;
- impl_->draftGlobals = oldGlobals;
- impl_->facade.setPending(previous); impl_->revalidate(); emit notice(uiText(error), true); return -1;
- }
- if (info->type == engine::EffectType::NrEnhance) impl_->selectedNr = index;
- if (info->type == engine::EffectType::Color) impl_->selectedColour = index;
- emitChainChanged(); emit settingsChanged(); return index;
- }
- if(fgType) {
- const auto before=impl_->chain;const auto previous=settings();
- auto& c=impl_->chain;
- int slot=-1;
- for(uint32_t i=0;i<c.nodeCount;++i)if(c.nodes[i].type==engine::EffectType::FrameGeneration)slot=int(i);
- if(slot<0) {
- if(c.nodeCount>=engine::kMaxChainNodes){emit notice(tr("效果链已满"),true);return -1;}
- slot=int(c.nodeCount++);c.nodes[slot]={};c.nodes[slot].type=engine::EffectType::FrameGeneration;
- c.nodes[slot].viewX=float(slot%4)*260;c.nodes[slot].viewY=float(slot/4)*300;
- }
- c.nodes[slot].enabled=true;
- c.fgMultiplier=normalizeFgMultiplier(c.fgMultiplier,fgBackend,fgCeiling);
- auto next=previous;engine::fromChain(c,next);
- next.frameGenerationBackend=fgBackend;
- impl_->validation=engine::validateChain(c);
- if(!impl_->validation.accepted||!next.validate().empty()||
- !unavailableEffects(next).isEmpty()||
- !impl_->facade.applySettings(next,engine::runtimeOrder(c))) {
- c=before;impl_->facade.setPending(previous);impl_->validation=engine::validateChain(c);
- emit notice(tr("补帧选择未被接受,保留原设置;请检查倍率和后端能力"),true);return -1;
- }
- impl_->options=engine::PlayerOptions::from(next,engine::runtimeOrder(c));
- emit settingsChanged();emitChainChanged();return slot;
- }
- engine::EffectType wanted = engine::EffectType::NrEnhance;
- bool found = false;
- for (const auto& info : engine::effectCatalog()) {
- if (!info.hidden && utf8Of(info.id) == type) {
- wanted = info.type;
- found = true;
- break;
- }
- }
- if (!found) { emit notice(tr("未知的效果: %1").arg(type), true); return -1; }
- if (impl_->chain.mode == engine::ChainMode::Node && wanted == engine::EffectType::Protection) {
- emit notice(tr("节点模式已取消 NR 保护区域;请在列表模式使用全局保护"), true); return -1;
- }
-
- auto& c = impl_->chain;
- if (c.nodeCount >= engine::kMaxChainNodes) { emit notice(tr("效果链已满"), true); return -1; }
- const auto& info = engine::effectInfo(wanted);
- if (c.countOf(wanted) >= info.maxInstances) {
- emit notice(tr("%1 最多 %2 个").arg(uiText(info.label)).arg(info.maxInstances), true);
- return -1;
- }
-
- const auto before=c; const int selected=impl_->selectedNr,colourSelected=impl_->selectedColour;
- // Insert before a pinned tail so the validator never has to undo the edit:
- // frame generation stays last and RTX Video HDR stays in front of it.
- uint32_t insertAt = c.nodeCount;
- if (wanted != engine::EffectType::FrameGeneration) {
- for (uint32_t i = 0; i < c.nodeCount; ++i) {
- const auto& nodeInfo = engine::effectInfo(c.nodes[i].type);
- if (nodeInfo.mustBeLast||((wanted==engine::EffectType::Color||wanted==engine::EffectType::Beauty)&&c.nodes[i].type==engine::EffectType::VideoHdr)||
- (wanted==engine::EffectType::NrEnhance&&
- (c.nodes[i].type==engine::EffectType::Protection||c.nodes[i].type==engine::EffectType::VideoHdr))) { insertAt = i; break; }
- }
- }
- for (uint32_t i = c.nodeCount; i > insertAt; --i) c.nodes[i] = c.nodes[i - 1];
- if(impl_->selectedNr>=int(insertAt))++impl_->selectedNr;
- if(impl_->selectedColour>=int(insertAt))++impl_->selectedColour;
- c.nodes[insertAt] = engine::ChainNode{};
- c.nodes[insertAt].type = wanted;
- // A new list-mode NR layer arrives switched off: adding a layer must not
- // change the picture until the user turns it on.
- c.nodes[insertAt].enabled = !(wanted == engine::EffectType::NrEnhance && c.mode == engine::ChainMode::List);
- // A beauty layer arrives with its switch and both sub-functions off: adding one
- // never changes the picture (its presets turn it on).
- if (wanted == engine::EffectType::Beauty) c.nodes[insertAt].enabled = false;
- if(wanted==engine::EffectType::Color)impl_->selectedColour=int(insertAt);
- if(wanted==engine::EffectType::NrEnhance){
- c.nodes[insertAt].nr.runtime=settings().nrRuntime;
- c.nodes[insertAt].nr.lowLatencyPairing=settings().lowLatency;
- impl_->selectedNr=int(insertAt);
- }
- // A new node lands below the others in node mode, in a stable column.
- c.nodes[insertAt].viewX = 40.0f + float(insertAt % 4) * 260.0f;
- c.nodes[insertAt].viewY = 40.0f + float(insertAt / 4) * 200.0f;
- ++c.nodeCount;
-
- const bool live=c.mode==engine::ChainMode::Node||wanted==engine::EffectType::NrEnhance||wanted==engine::EffectType::Color;
- if(!impl_->revalidate(live)){
- const auto error=impl_->validation.message;c=before;impl_->selectedNr=selected;
- impl_->selectedColour=colourSelected;
- impl_->revalidate();emit notice(uiText(error),true);return -1;
- }
- emitChainChanged();
- if (!impl_->validation.accepted) {
- emit notice(uiText(impl_->validation.message), true);
- } else {
- emit settingsChanged();
- }
- return int(insertAt);
-}
-
-QVariantList QmlPlayerBridge::nodeConnections() const {
- QVariantList out;
- if (impl_->chain.mode != engine::ChainMode::Node) return out;
- const auto add = [&](uint32_t from, uint32_t to) {
- if (to != engine::NodeGraphLayout::Input)
- out << QVariantMap{{"from", from}, {"to", to}};
- };
- add(0, impl_->layout.inputNext);
- for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
- add(impl_->layout.ids[i], impl_->layout.next[i]);
- return out;
-}
-
-int QmlPlayerBridge::nodeIndexForId(uint id) const {
- return impl_->chain.mode == engine::ChainMode::Node ? impl_->layout.indexOf(impl_->chain, id) : -1;
-}
-
-int QmlPlayerBridge::duplicateNode(uint id) {
- if (impl_->chain.mode != engine::ChainMode::Node) return -1;
- auto before = std::make_unique<engine::EffectChain>(impl_->chain);
- const auto layout = impl_->layout;
- uint32_t created = 0;
- const auto result = impl_->layout.duplicate(impl_->chain, id, created);
- if (!result.accepted) { emit notice(uiText(result.message), true); return -1; }
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message;
- impl_->chain = *before; impl_->layout = layout; impl_->revalidate();
- emit notice(uiText(error), true); return -1;
- }
- const int index = nodeIndexForId(created);
- if (impl_->chain.nodes[index].type == engine::EffectType::NrEnhance) impl_->selectedNr = index;
- if (impl_->chain.nodes[index].type == engine::EffectType::Color) impl_->selectedColour = index;
- emitChainChanged(); emit settingsChanged(); return index;
-}
-
-bool QmlPlayerBridge::resetNode(uint id) {
- const int index = nodeIndexForId(id);
- if (index < 0) return false;
- auto& node = impl_->chain.nodes[index];
- const auto before = node; const auto multiplier = impl_->chain.fgMultiplier;
- const auto strict = impl_->chain.fgStrictAdmission;
- const auto previous = impl_->facade.pendingSettings();
- const auto oldGlobals = impl_->draftGlobals;
- node = engine::ChainNode{};
- node.type = before.type; node.enabled = before.enabled;
- node.viewX = before.viewX; node.viewY = before.viewY;
- if (node.type == engine::EffectType::FrameGeneration) {
- impl_->chain.fgMultiplier = 2; impl_->chain.fgStrictAdmission = false;
- }
- if (node.type == engine::EffectType::SuperResolution) {
- const engine::EnhancementSettings defaults;
- impl_->draftGlobals.srTarget = defaults.srTarget;
- impl_->draftGlobals.videoSrQuality = defaults.videoSrQuality;
- impl_->draftGlobals.dlssSrModel = defaults.dlssSrModel;
- }
- if (!impl_->revalidate(true, &previous)) {
- const auto error = impl_->validation.message; node = before;
- impl_->draftGlobals = oldGlobals;
- impl_->facade.setPending(previous);
- impl_->chain.fgMultiplier = multiplier; impl_->chain.fgStrictAdmission = strict; impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- emitChainChanged(); emit settingsChanged(); return true;
-}
-
-bool QmlPlayerBridge::connectNodes(uint from, uint to) {
- if (impl_->chain.mode != engine::ChainMode::Node) return false;
- const auto before = impl_->layout;
- const auto result = impl_->layout.connect(impl_->chain, from, to);
- if (!result.accepted) { emit notice(uiText(result.message), true); return false; }
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message; impl_->layout = before; impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- emitChainChanged(); emit settingsChanged(); return true;
-}
-
-bool QmlPlayerBridge::disconnectNode(uint from) {
- if (impl_->chain.mode != engine::ChainMode::Node) return false;
- const auto before = impl_->layout;
- const auto result = impl_->layout.disconnect(impl_->chain, from);
- if (!result.accepted) { emit notice(uiText(result.message), true); return false; }
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message; impl_->layout = before; impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- emitChainChanged(); emit settingsChanged(); return true;
-}
-
-bool QmlPlayerBridge::insertNodeAfter(uint id, uint after) {
- if (impl_->chain.mode != engine::ChainMode::Node) return false;
- const auto before = impl_->layout;
- const auto result = impl_->layout.insertAfter(impl_->chain, id, after);
- if (!result.accepted) { emit notice(uiText(result.message), true); return false; }
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message; impl_->layout = before; impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- emitChainChanged(); emit settingsChanged(); return true;
-}
-
-int QmlPlayerBridge::duplicateNrLayer(int index){
- if (impl_->chain.mode == engine::ChainMode::Node)
- return index >= 0 && uint32_t(index) < impl_->chain.nodeCount ? duplicateNode(impl_->layout.ids[index]) : -1;
- auto& c=impl_->chain;
- if(index<0||uint32_t(index)>=c.nodeCount||c.nodes[index].type!=engine::EffectType::NrEnhance||
- c.countOf(engine::EffectType::NrEnhance)>=engine::kMaxNrInstances||c.nodeCount>=engine::kMaxChainNodes)return -1;
- const auto before=c; const int selected=impl_->selectedNr,colourSelected=impl_->selectedColour;
- const auto original=c.nodes[index];
- for(uint32_t i=c.nodeCount;i>uint32_t(index+1);--i)c.nodes[i]=c.nodes[i-1];
- c.nodes[index+1]=original;++c.nodeCount;impl_->selectedNr=index+1;
- if(impl_->selectedColour>index)++impl_->selectedColour;
- if(!impl_->revalidate(true)){
- const auto error=impl_->validation.message;c=before;impl_->selectedNr=selected;
- impl_->selectedColour=colourSelected;
- impl_->revalidate();emit notice(uiText(error),true);return -1;
- }
- emitChainChanged();emit settingsChanged();return index+1;
-}
-
-bool QmlPlayerBridge::removeEffect(int index) {
- auto& c = impl_->chain;
- if (index < 0 || uint32_t(index) >= c.nodeCount) return false;
- const auto& info = engine::effectInfo(c.nodes[index].type);
- if (info.mustBeLast) { emit notice(tr("补帧固定为最后一步,不能删除"), true); return false; }
- const bool live=c.mode==engine::ChainMode::Node||c.nodes[index].type==engine::EffectType::NrEnhance||c.nodes[index].type==engine::EffectType::Color;
- const auto before=c; const int selected=impl_->selectedNr,colourSelected=impl_->selectedColour;
- const auto previousLayout = impl_->layout;
- if (c.mode == engine::ChainMode::Node) {
- const auto result = impl_->layout.remove(c, impl_->layout.ids[index]);
- if (!result.accepted) { emit notice(uiText(result.message), true); return false; }
- } else {
- for (uint32_t i = uint32_t(index); i + 1 < c.nodeCount; ++i) c.nodes[i] = c.nodes[i + 1];
- --c.nodeCount;
- }
- if(impl_->selectedNr==index)impl_->selectedNr=-1;
- else if(impl_->selectedNr>index)--impl_->selectedNr;
- if(impl_->selectedColour==index)impl_->selectedColour=-1;
- else if(impl_->selectedColour>index)--impl_->selectedColour;
- if(!impl_->revalidate(live)){
- const auto error=impl_->validation.message;c=before;impl_->layout=previousLayout;impl_->selectedNr=selected;
- impl_->selectedColour=colourSelected;
- impl_->revalidate();emit notice(uiText(error),true);return false;
- }
- emitChainChanged();
- emit settingsChanged();
- return true;
-}
-
-bool QmlPlayerBridge::moveEffect(int from, int to) {
- auto& c = impl_->chain;
- if (from < 0 || to < 0 || uint32_t(from) >= c.nodeCount || uint32_t(to) >= c.nodeCount) return false;
- if (c.mode == engine::ChainMode::Node) {
- if (from == to) return true;
- return insertNodeAfter(impl_->layout.ids[from], impl_->layout.ids[to]);
- }
- // The two pinned stages cannot be dragged; the UI greys them, and the
- // engine refuses them too so a script cannot route around the UI.
- if (engine::effectInfo(c.nodes[from].type).mustBeLast ||
- engine::effectInfo(c.nodes[to].type).mustBeLast) {
- emit notice(tr("补帧固定为最后一步,不能拖动"), true);
- return false;
- }
- const auto before = c;
- const auto moving = c.nodes[from];
- if (from < to) for (int i = from; i < to; ++i) c.nodes[i] = c.nodes[i + 1];
- else for (int i = from; i > to; --i) c.nodes[i] = c.nodes[i - 1];
- c.nodes[to] = moving;
-
- impl_->revalidate(true);
- if (!impl_->validation.accepted) {
- const auto error=impl_->validation.message;
- impl_->chain = before;
- impl_->revalidate();
- emit notice(uiText(error), true);
- return false;
- }
- const auto remap=[&](int i){
- if(i==from)return to;
- if(from<to&&i>from&&i<=to)return i-1;
- if(from>to&&i>=to&&i<from)return i+1;
- return i;
- };
- impl_->selectedNr=remap(impl_->selectedNr);
- impl_->selectedColour=remap(impl_->selectedColour);
- emitChainChanged();
- emit settingsChanged();
- return true;
-}
-
-bool QmlPlayerBridge::setEffectEnabled(int index, bool enabled) {
- auto& c = impl_->chain;
- if (index < 0 || uint32_t(index) >= c.nodeCount) return false;
- if (c.nodes[index].enabled == enabled) return true;
- c.nodes[index].enabled = enabled;
- if(!impl_->revalidate(true)){
- const auto error=impl_->validation.message;c.nodes[index].enabled=!enabled;
- impl_->revalidate();emit notice(uiText(error),true);return false;
- }
- emitChainChanged();
- emit settingsChanged();
- return true;
-}
-
-bool QmlPlayerBridge::nrAnyEnabled() const {
- const auto& c=impl_->chain;
- for(uint32_t i=0;i<c.nodeCount;++i)if(c.nodes[i].type==engine::EffectType::NrEnhance&&c.nodes[i].enabled)return true;
- return false;
-}
-bool QmlPlayerBridge::setAllNrEnabled(bool enabled) {
- auto& c=impl_->chain;const auto before=c;
- std::vector<uint32_t> layers;
- for(uint32_t i=0;i<c.nodeCount;++i)if(c.nodes[i].type==engine::EffectType::NrEnhance)layers.push_back(i);
- if(layers.empty())return false;
- auto& restore=impl_->nrMasterRestore;
- if(!enabled){
- restore.clear();
- for(const auto i:layers){restore.push_back(c.nodes[i].enabled);c.nodes[i].enabled=false;}
- }else{
- // Layers added or removed since the switch went off: no faithful restore,
- // so every layer comes back on. Same when nothing was on to begin with.
- const bool faithful=restore.size()==layers.size()&&std::find(restore.begin(),restore.end(),true)!=restore.end();
- for(size_t k=0;k<layers.size();++k)c.nodes[layers[k]].enabled=faithful?bool(restore[k]):true;
- }
- if(!impl_->revalidate(true)){
- const auto error=impl_->validation.message;c=before;impl_->revalidate();
- emit notice(uiText(error),true);emitChainChanged();return false;
- }
- veyra::log::info("ui-nr",std::format("master switch {} layers={}",enabled?"on":"off",layers.size()));
- emitChainChanged();emit settingsChanged();
- return true;
-}
-
-QVariantMap QmlPlayerBridge::nodeAnchors() const { return impl_->anchors; }
-bool QmlPlayerBridge::setNodeAnchor(const QString& key, double x, double y) {
- if ((key != QLatin1String("input") && key != QLatin1String("flow") && key != QLatin1String("output")) ||
- !std::isfinite(x) || !std::isfinite(y) || std::abs(x) > 1000000 || std::abs(y) > 1000000) return false;
- impl_->anchors[key] = QVariantMap{{"x", x}, {"y", y}};
- if (!impl_->anchorsFile.empty()) {
- QFile file(QString::fromStdWString(impl_->anchorsFile.wstring()));
- if (file.open(QIODevice::WriteOnly | QIODevice::Truncate))
- file.write(QJsonDocument(QJsonObject::fromVariantMap(impl_->anchors)).toJson(QJsonDocument::Compact));
- else veyra::log::warn("ui-node", "node anchor positions not saved");
- }
- emit nodeAnchorsChanged();
- return true;
-}
-bool QmlPlayerBridge::setEffectPosition(int index, double x, double y) {
- auto& c = impl_->chain;
- if (index < 0 || uint32_t(index) >= c.nodeCount || !std::isfinite(x) || !std::isfinite(y) ||
- std::abs(x) > 1000000 || std::abs(y) > 1000000) return false;
- c.nodes[index].viewX = float(x);
- c.nodes[index].viewY = float(y);
- // Positions never affect the picture, so this deliberately does not
- // revalidate or touch the engine: dragging a node must not cost a rebuild.
- emitChainChanged();
- return true;
-}
-
-QVariantMap QmlPlayerBridge::effectDescriptor(const QString& type) const {
- for (const auto& info : engine::effectCatalog()) {
- if (utf8Of(info.id) != type) continue;
- QVariantMap out;
- out["id"] = utf8Of(info.id);
- out["label"] = uiText(info.label);
- out["maxInstances"] = int(info.maxInstances);
- out["repeatable"] = info.repeatable;
- out["mustBeLast"] = info.mustBeLast;
- out["justBeforeLast"] = info.justBeforeLast;
- out["changesResolution"] = info.changesResolution;
- out["experimental"] = info.experimental;
- return out;
- }
- return {};
-}
-
-// --- presets ----------------------------------------------------------------
-bool QmlPlayerBridge::applyPresetIndex(int index) {
- if (index < 0 || size_t(index) >= impl_->facade.presets().entries().size()) return false;
- const auto mode = impl_->chain.mode;
- const auto& entry = impl_->facade.presets().entries()[size_t(index)];
- if (entry.kind != mode) { emit notice(tr("请先切换到预设对应的编辑模式"), true); return false; }
- const auto previous = impl_->facade.pendingSettings();
- const auto oldGlobals = impl_->draftGlobals;
- auto nextGlobals = oldGlobals;
- auto settings = previous;
- auto candidate = impl_->chain;
- const auto oldLayout = impl_->layout;
- auto nextLayout = oldLayout;
- engine::ChainValidation validation;
- if (mode == engine::ChainMode::Node) {
- auto document = std::make_unique<engine::NodeEditorDocument>();
- document->nodes = candidate; document->layout = nextLayout; document->globals = oldGlobals;
- validation = engine::PresetLibrary::applyToEditor(entry, *document, settings);
- candidate = document->nodes; nextLayout = document->layout;
- nextGlobals = document->globals.value_or(engine::ChainGlobalSettings::capture(settings));
- // Keep the facade on accepted values until revalidate projects the new
- // document. Audio/non-chain preset fields are retained in this copy.
- engine::fromChain(impl_->activeRuntime(), settings);
- // Custom: the static HDR output tuning rides in the globals block this call
- // re-derives, so preserve the values this commit is carrying.
- const auto keepCurve = settings.hdrCurve;
- const auto keepMetadata = settings.hdrMetadata;
- engine::ChainGlobalSettings::capture(previous).apply(settings);
- settings.hdrCurve = keepCurve; settings.hdrMetadata = keepMetadata;
- } else validation = engine::PresetLibrary::applyToChain(entry, candidate, settings);
- if (!validation.accepted) { emit notice(uiText(validation.message), true); return false; }
- if (const auto error = settings.validate(); !error.empty()) {
- veyra::log::error("qml-preset", error);
- emit notice(tr("预设参数无效,已保留原状态"), true); return false;
- }
- // Partial presets do not change the current editing target. Colour-only
- // insertion/removal can shift NR indices, so retain the instance ordinal.
- const auto remapSelection = [&](int selected, engine::EffectType type) {
- if (entry.contents & engine::presetContentMask(engine::PresetContent::Chain)) return -1;
- if (selected < 0) return -1;
- uint32_t ordinal = 0;
- for (int i = 0; i < selected; ++i) if (impl_->chain.nodes[i].type == type) ++ordinal;
- for (uint32_t i = 0; i < candidate.nodeCount; ++i) {
- if (candidate.nodes[i].type != type) continue;
- if (ordinal == 0) return int(i);
- --ordinal;
- }
- return -1;
- };
- const int selectedNr = remapSelection(impl_->nrIndex(), engine::EffectType::NrEnhance);
- const int selectedColour = remapSelection(impl_->colourIndex(), engine::EffectType::Color);
- auto oldChain = std::make_unique<engine::EffectChain>(impl_->chain);
- impl_->chain = candidate;
- impl_->layout = nextLayout;
- if (mode == engine::ChainMode::Node) {
- impl_->draftGlobals = nextGlobals;
- engine::ChainGlobalSettings::capture(previous).apply(settings);
- }
- impl_->facade.setPending(settings);
- if (!impl_->revalidate(true, &previous)) {
- const auto error = impl_->validation.message; impl_->chain = *oldChain; impl_->layout = oldLayout;
- impl_->draftGlobals = oldGlobals;
- impl_->facade.setPending(previous); impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- impl_->selectedNr = selectedNr;
- impl_->selectedColour = selectedColour;
- if (entry.flow && (entry.contents & engine::presetContentMask(engine::PresetContent::Flow))) {
- impl_->prefs[QStringLiteral("contentRate")] = int(this->settings().content);
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "preset content cadence not saved");
- }
- emit settingsChanged();
- emitChainChanged();
- return true;
-}
-
-void QmlPlayerBridge::enqueueExportFile(const QString& input,const QString& output) {
- if(!QFileInfo(input).isFile()){emit notice(tr("队列输入文件不存在"),true);return;}
- impl_->exportQueue.addFile(input,output);emit exportChanged();
-}
-void QmlPlayerBridge::addExportFiles(const QStringList& paths) {
- for(const auto& path:paths){const auto url=QUrl(path);const QString file=url.isLocalFile()?url.toLocalFile():path;
- if(QFileInfo(file).isFile())impl_->exportQueue.addFile(file);
- else emit notice(tr("无法添加文件:%1").arg(file),true);
- }
- emit exportChanged();
-}
-void QmlPlayerBridge::addExportFilesDialog() {
- addExportFiles(QFileDialog::getOpenFileNames(nullptr,tr("加入导出队列"),QString(),
- tr("视频文件 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts);;所有文件 (*)")));
-}
-bool QmlPlayerBridge::selectExportPreset(int index) {
- if (index == -1) {
- impl_->exportPresetName.clear();
- } else {
- const auto& entries = impl_->facade.presets().entries();
- if (index < 0 || size_t(index) >= entries.size() || entries[size_t(index)].kind == engine::ChainMode::Node)
- return false;
- impl_->exportPresetName = entries[size_t(index)].name;
- }
- emit exportChanged();
- return true;
-}
-
-bool QmlPlayerBridge::savePresetAs(const QString& name, int contentsMask, bool nodeMode) {
- if (name.isEmpty()) { emit notice(tr("预设需要一个名字"), true); return false; }
- if (nodeMode != (impl_->chain.mode == engine::ChainMode::Node)) {
- emit notice(tr("请先切换到要保存的编辑模式"), true); return false;
- }
- engine::PresetEntry entry;
- entry.name = wideOf(name);
- entry.kind = nodeMode ? engine::ChainMode::Node : engine::ChainMode::List;
- entry.contents = uint32_t(contentsMask);
- entry.chain = impl_->chain;
- entry.globals=engine::ChainGlobalSettings::capture(impl_->facade.pendingSettings());
- entry.color = impl_->facade.pendingSettings().color;
- entry.fg.multiplier = impl_->facade.pendingSettings().multiplier;
- entry.fg.backend = impl_->facade.pendingSettings().frameGenerationBackend;
- entry.fg.vfgQuality = impl_->facade.pendingSettings().vfgQuality;
- entry.audioSync = impl_->facade.pendingSettings().audioSync;
- entry.audioOffsetMs = impl_->facade.pendingSettings().audioOffsetMs;
- if (nodeMode) {
- entry.nodeConfiguration = impl_->currentSession().configurations[1];
- entry.chain = entry.nodeConfiguration->chain;
- if (const auto* color = impl_->chain.firstOf(engine::EffectType::Color)) {
- entry.color = color->color; entry.color.enabled = color->enabled;
- }
- entry.fg.multiplier = uint32_t(fgMultiplier());
- entry.fg.backend = impl_->draftGlobals.fgBackend;
- entry.fg.vfgQuality = impl_->draftGlobals.vfgQuality;
- entry.globals=impl_->draftGlobals;
- }
- entry.flow = engine::PresetFlowSettings::capture(settings());
- const bool ok = impl_->facade.savePreset(entry, false);
- if (ok) emit presetsChanged();
- else emit notice(tr("保存预设失败: %1").arg(uiText(impl_->facade.error())), true);
- return ok;
-}
-
-bool QmlPlayerBridge::deletePreset(int index) {
- if (index < 0 || size_t(index) >= impl_->facade.presets().entries().size()) return false;
- const auto& entry = impl_->facade.presets().entries()[size_t(index)];
- if (entry.builtin) { emit notice(tr("内置预设不能删除,可以另存一份"), true); return false; }
- const bool selected = impl_->exportPresetName == entry.name;
- const bool ok = impl_->facade.presets().erase(size_t(index));
- if (ok) {
- if (selected) { impl_->exportPresetName.clear(); emit exportChanged(); }
- emit presetsChanged();
- }
- return ok;
-}
-
-bool QmlPlayerBridge::renamePreset(int index, const QString& name) {
- if (index < 0 || size_t(index) >= impl_->facade.presets().entries().size()) return false;
- const bool selected = impl_->exportPresetName == impl_->facade.presets().entries()[size_t(index)].name;
- const bool ok = impl_->facade.presets().rename(size_t(index), wideOf(name));
- if (ok) {
- if (selected) { impl_->exportPresetName = wideOf(name); emit exportChanged(); }
- emit presetsChanged();
- }
- return ok;
-}
-
-QVariantList QmlPlayerBridge::presetSaveParts() const {
- // What a preset would contain right now, part by part, so the save dialog can
- // list it before the user names anything. `meaningful` marks the parts that are
- // not at defaults, which is what makes "will be saved" honest.
- const auto s = settings();
- QVariantList out;
- auto add = [&](const char* id, const QString& label, const QString& summary, bool meaningful) {
- QVariantMap item;
- item["id"] = QString::fromUtf8(id);
- item["label"] = label;
- item["summary"] = summary;
- item["meaningful"] = meaningful;
- out << item;
- };
- QStringList chainParts;
- for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
- chainParts << uiText(engine::effectInfo(impl_->chain.nodes[i].type).label);
- add("chain", tr("效果链"),
- chainParts.isEmpty() ? tr("空") : chainParts.join(QStringLiteral(" → ")),
- impl_->chain.nodeCount > 0);
- add("color", tr("色彩"), s.color.enabled ? tr("已启用") : tr("未启用"), s.color.enabled);
- add("fg", tr("补帧"),
- s.multiplier > 1 ? QStringLiteral("%1X").arg(s.multiplier) : tr("关闭", "off"),
- s.multiplier > 1);
- add("audio", tr("声音"),
- s.audioOffsetMs != 0 ? tr("偏移 %1 ms").arg(s.audioOffsetMs) : tr("默认"),
- s.audioOffsetMs != 0);
- const QStringList flowNames{QStringLiteral("NVIDIA NVOF"), tr("AMD 光流"), QStringLiteral("GPU DIS")};
- const QStringList qualityNames{tr("性能"), tr("平衡"), tr("质量")};
- const QStringList cadenceNames{tr("采用源时间戳"), tr("自动识别内容节奏"), tr("识别 30fps 内容"),
- tr("识别 50fps 内容"), tr("识别 60fps 内容"), tr("采集 60→30(PS5 30 帧)")};
- QString flowSummary = flowNames.value(int(s.opticalFlowBackend)) + QStringLiteral(" · ") +
- qualityNames.value(int(s.flow)) + QStringLiteral(" · ") + cadenceNames.value(int(s.content));
- if (s.opticalFlowBackend == engine::OpticalFlowBackend::AmdFidelityFx && s.amdFlowHalfResolution)
- flowSummary += QStringLiteral(" · ") + tr("半分辨率");
- add("flow", tr("光流与内容节奏"), flowSummary,
- engine::PresetFlowSettings::capture(s) != engine::PresetFlowSettings{});
- return out;
-}
-
-int QmlPlayerBridge::defaultPresetIndex() const {
- const auto index = impl_->facade.presets().defaultIndex();
- return index.has_value() ? int(*index) : -1;
-}
-
-bool QmlPlayerBridge::setDefaultPreset(int index) {
- if (index < -1 || (index >= 0 && size_t(index) >= impl_->facade.presets().entries().size())) return false;
- const bool ok = index == -1 ? impl_->facade.presets().clearDefault()
- : impl_->facade.presets().setDefault(size_t(index));
- if (ok) emit presetsChanged();
- else emit notice(tr("默认预设保存失败:") + uiText(impl_->facade.presets().error()), true);
- return ok;
-}
-
-bool QmlPlayerBridge::duplicatePreset(int index) {
- if (index < 0 || size_t(index) >= impl_->facade.presets().entries().size()) return false;
- const bool ok = impl_->facade.presets().duplicate(size_t(index));
- if (ok) emit presetsChanged();
- return ok;
-}
-
-void QmlPlayerBridge::refreshRecentFiles() {
- impl_->facade.refreshRecentFiles();
- emit recentFilesChanged();
-}
-void QmlPlayerBridge::clearRecentFiles() {
- // The facade owns the list; clearing it means dropping the entries it holds
- // and re-persisting, which refreshRecentFiles already does after the fact.
- impl_->facade.clearRecentFiles();
- emit recentFilesChanged();
-}
-
-
-// --- audio sync (1.4.4 声音补偿, #12) ------------------------------------------
-int QmlPlayerBridge::audioSyncMode() const { return int(settings().audioSync); }
-void QmlPlayerBridge::setAudioSyncMode(int value) {
- if (value < 0 || value > 2) return;
- auto s = settings();
- if (int(s.audioSync) == value) return;
- s.audioSync = static_cast<engine::AudioSyncMode>(value);
- if (!impl_->commit(std::move(s))) return;
- impl_->prefs[QStringLiteral("audioSync")] = value;
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "sound sync mode not saved");
- emit settingsChanged();
-}
-bool QmlPlayerBridge::audioSyncLive() const {
- const auto& s = impl_->snapshot;
- return s.running && (s.capture || s.remotePlay);
-}
-double QmlPlayerBridge::audioCompensationMs() const {
- return audioSyncLive() ? impl_->snapshot.captureAudio.compensationMs : 0.0;
-}
-
-// --- performance orbs and status light (#13) --------------------------------
-double QmlPlayerBridge::gpuUtilization() const { return std::max(0.0, impl_->gpuUtil.load()); }
-bool QmlPlayerBridge::gpuUtilizationKnown() const { return impl_->gpuUtil.load() >= 0.0; }
-QString QmlPlayerBridge::runStatus() const { return impl_->runStatus; }
-QString QmlPlayerBridge::runStatusLevel() const { return impl_->runLevel; }
-QString QmlPlayerBridge::runStatusDetail() const { return impl_->runDetail; }
-QStringList QmlPlayerBridge::runOptions() const { return impl_->runOptions; }
-double QmlPlayerBridge::effectiveOutputFps() const { return impl_->effectiveOutputFps; }
-double QmlPlayerBridge::outputRateRatio() const { return impl_->rateRatio; }
-
-void QmlPlayerBridge::startGpuSampler() {
- // Task Manager's source: the "GPU Engine" utilization counters, summed per
- // engine type across processes, busiest type wins. Sampled once a second on
- // its own thread; -1 means the counters are unavailable.
- auto* impl = impl_.get();
- impl->gpuSampler = std::jthread([impl](std::stop_token stop) {
- PDH_HQUERY query = nullptr; PDH_HCOUNTER counter = nullptr;
- if (PdhOpenQueryW(nullptr, 0, &query) != ERROR_SUCCESS) return;
- if (PdhAddEnglishCounterW(query, L"\\GPU Engine(*)\\Utilization Percentage", 0, &counter) != ERROR_SUCCESS) {
- PdhCloseQuery(query); veyra::log::warn("perf", "GPU engine counters unavailable"); return;
- }
- PdhCollectQueryData(query);
- std::vector<unsigned char> buffer;
- while (!stop.stop_requested()) {
- for (int i = 0; i < 10 && !stop.stop_requested(); ++i) std::this_thread::sleep_for(std::chrono::milliseconds(100));
- if (stop.stop_requested()) break;
- if (PdhCollectQueryData(query) != ERROR_SUCCESS) continue;
- DWORD bytes = 0, count = 0;
- if (PdhGetFormattedCounterArrayW(counter, PDH_FMT_DOUBLE, &bytes, &count, nullptr) != PDH_MORE_DATA) continue;
- buffer.resize(bytes);
- auto* items = reinterpret_cast<PDH_FMT_COUNTERVALUE_ITEM_W*>(buffer.data());
- if (PdhGetFormattedCounterArrayW(counter, PDH_FMT_DOUBLE, &bytes, &count, items) != ERROR_SUCCESS) continue;
- std::map<std::wstring, double> byType;
- // Instance names carry the adapter: pid_<n>_luid_0x<high>_0x<low>_phys_..._engtype_<type>.
- const uint64_t luid = impl->gpuMonitorLuid.load();
- const std::wstring luidKey = luid ? std::format(L"luid_0x{:08x}_0x{:08x}_", uint32_t(luid >> 32), uint32_t(luid)) : std::wstring{};
- for (DWORD i = 0; i < count; ++i) {
- if (items[i].FmtValue.CStatus != PDH_CSTATUS_VALID_DATA && items[i].FmtValue.CStatus != PDH_CSTATUS_NEW_DATA) continue;
- std::wstring name = items[i].szName ? items[i].szName : L"";
- std::transform(name.begin(), name.end(), name.begin(), [](wchar_t ch) { return wchar_t(towlower(ch)); });
- if (!luidKey.empty() && name.find(luidKey) == std::wstring::npos) continue;
- const auto at = name.find(L"engtype_");
- byType[at == std::wstring::npos ? std::wstring{} : name.substr(at + 8)] += items[i].FmtValue.doubleValue;
- }
- double busiest = 0;
- for (const auto& [type, value] : byType) busiest = std::max(busiest, value);
- impl->gpuUtil = std::clamp(busiest, 0.0, 100.0);
- }
- PdhCloseQuery(query);
- });
-}
-
-void QmlPlayerBridge::updateRunStatus() {
- auto& i = *impl_;
- const auto& s = i.snapshot;
- // QScreen's cached rate for the actual video host, not an arbitrary popup
- // or another monitor. This uses the existing bounded status cadence.
- double refresh=0;
- const HWND owner=i.videoWindow?GetAncestor(i.videoWindow,GA_ROOT):nullptr;
- for(auto* window:QGuiApplication::topLevelWindows())
- if(window->isVisible()&&window->screen()&&reinterpret_cast<HWND>(window->winId())==owner){refresh=window->screen()->refreshRate();break;}
- i.history.sample(s,{refresh,i.compareMode!=0});
- const auto& rate=i.history.output;
- const auto& f = s.metrics.flow;
- const bool active = s.running && !s.image && s.transport == engine::TransportState::Playing;
- QString status = tr("待机"), level = QStringLiteral("idle");
- if (s.failed) { status = tr("错误"); level = QStringLiteral("err"); }
- else if (s.remoteRecovering) { status = tr("恢复中"); level = QStringLiteral("warn"); }
- // Paused to buffer a network source (#48): no pictures are due, so the output rate is not judged.
- else if (s.running && s.network.active && (s.network.holding() || s.network.state == media::NetworkStats::State::Reconnecting)) {
- status = tr("缓冲中"); level = QStringLiteral("warn");
- }
- else if (active && !s.applying && f.rateWindowReady) {
- // Judged on the engine's own words, shown in the interface language.
- const std::wstring rate = i.history.rateStatus(s);
- status = uiText(rate);
- level = rate == L"正常" ? QStringLiteral("ok") : QStringLiteral("warn");
- }
- else if (s.applying && s.running) { status = tr("调整中"); level = QStringLiteral("warn"); }
- else if (active) status = tr("采样中");
- else if (s.transport == engine::TransportState::Paused) status = tr("已暂停");
- QStringList options;
- const auto chosen=settings();
- if(chosen.content!=engine::ContentRate::Transport){
- QString cadence;
- switch(chosen.content){
- case engine::ContentRate::Auto:cadence=tr("自动识别内容节奏");break;
- case engine::ContentRate::Fps30:cadence=tr("识别 %1 fps 内容").arg(30);break;
- case engine::ContentRate::Fps50:cadence=tr("识别 %1 fps 内容").arg(50);break;
- case engine::ContentRate::Fps60:cadence=tr("识别 %1 fps 内容").arg(60);break;
- case engine::ContentRate::Capture60To30:cadence=tr("采集 60→30");break;
- default:break;
- }
- if(s.running&&rate.halfRate)options<<tr("%1 · 当前约 %2 fps").arg(cadence).arg(rate.contentFps,0,'f',0);
- else if(s.running&&rate.deduplicating)options<<tr("%1 · 去重后约 %2 fps").arg(cadence).arg(rate.contentFps,0,'f',0);
- else if(s.running&&!s.capture)options<<tr("%1 · 当前来源未去重").arg(cadence);
- else if(s.running)options<<tr("%1 · 尚未观察到去重").arg(cadence);
- else options<<cadence;
- }
- if(i.presentation.display!=engine::DisplaySync::Tearing){
- const auto sync=i.presentation.display==engine::DisplaySync::Vsync?tr("垂直同步"):tr("自动显示同步");
- options<<((refresh>0)?tr("%1 · 屏幕 %2 Hz").arg(sync).arg(refresh,0,'f',1):sync);
- }
- // Variable refresh (NVIDIA G-SYNC / G-SYNC Compatible), Windows HDR and the
- // refresh rate: the presenting monitor while playing, otherwise the main
- // window's monitor. They come from the engine's DisplayStateService,
- // queried in the background on events only (startup, another monitor,
- // WM_DISPLAYCHANGE, the switch turned on, 刷新显示器状态), never on a timer.
- // The driver and Windows settings are the user's; the 可变刷新 switch decides
- // how Veyra presents when it is possible.
- auto& displays=i.engine.displayStates();
- if(i.displayChanged){i.displayChanged=false;displays.invalidate("display-change");}
- HWND host=s.running&&i.videoWindow?i.videoWindow:owner;
- if(!host)if(auto* window=QGuiApplication::focusWindow())host=reinterpret_cast<HWND>(window->winId());
- // request() starts a query only when this monitor's state is stale or
- // missing (the presenter asks for the same monitor while playing).
- if(host)displays.request(host,i.displayRecheckPending?"manual":"ui");
- const auto display=host?displays.state(displays.monitorOf(host)):std::nullopt;
- const int vrrLevel=s.running?int(s.displayVrr):display?int(gfx::vrrLevel(display->vrr)):0;
- const int hdr=display&&display->color.hdr?int(*display->color.hdr):-1;
- const double refreshHz=display?display->refreshHz:0;
- QString recheckNotice;bool recheckFailed=false;
- if(i.displayRecheckPending){
- // Answered once the shown monitor has a state of the re-check's generation.
- if(display&&display->generation>=i.displayRecheckGeneration){
- i.displayRecheckPending=false;
- recheckNotice=tr("已刷新显示器状态:系统 HDR %1 · 可变刷新 %2")
- .arg(hdr>0?tr("开"):hdr==0?tr("关"):tr("未知"),vrrSummaryText(int(gfx::vrrLevel(display->vrr))));
- }else if(std::chrono::steady_clock::now()-i.displayRecheckSince>std::chrono::seconds(5)){
- i.displayRecheckPending=false;recheckNotice=tr("刷新显示器状态没有完成,请稍后再试");recheckFailed=true;
- }
- }
- const bool displayChecking=i.displayRecheckPending||displays.busy();
- if(i.presentation.variableRefresh){
- if(vrrLevel>=4)options<<tr("可变刷新 · 生效中");
- else if(vrrLevel==3)options<<tr("可变刷新 · 等待驱动确认");
- else options<<tr("可变刷新 · 当前屏幕不可用");
- }else if(s.running&&vrrLevel>=4)options<<tr("屏幕可变刷新生效中");
- if(i.presentation.outputRate!=engine::OutputRateMode::Off){
- if(s.running&&s.presentationEffective.outputRate==engine::OutputRateMode::Off)
- options<<tr("输出限帧 · 当前未生效");
- else if(i.presentation.outputRate==engine::OutputRateMode::FollowDisplay)
- options<<tr("输出限帧 · 跟随屏幕");
- else options<<tr("输出限帧 · %1 fps").arg(i.presentation.customFps,0,'f',1);
- }
- if(i.presentation.enabled)options<<(s.running&&!s.presentationEffective.enabled?tr("低延迟队列 · 当前未生效"):tr("低延迟队列"));
- if(!s.capture&&std::abs(s.playbackRate-1.0)>.001)options<<tr("播放速度 %1×").arg(s.playbackRate,0,'f',2);
- if(i.compareMode!=0)options<<tr("画面对比 · 补帧暂停");
- QStringList detail;
- // Live output hint: also shown under the 倍率 control (fgDisplayHint).
- QString fgHint;
- if (s.running && !s.image && s.applied.multiplier > 1 && i.compareMode == 0 && s.displayFgSuggestion > 0 &&
- s.displayFgContentFps > 0 && s.displayFgRefreshHz > 0) {
- const double output = s.displayFgContentFps * s.applied.multiplier;
- fgHint = s.displayFgSuggestion == 1
- ? tr("当前帧率 %1 fps 超出屏幕刷新率 %2 Hz,建议关闭补帧来获得更好的延迟体验")
- .arg(output, 0, 'f', 0).arg(s.displayFgRefreshHz, 0, 'f', 0)
- : tr("当前帧率 %1 fps 超出屏幕刷新率 %2 Hz,建议降至 %3X 来获得更好的延迟体验")
- .arg(output, 0, 'f', 0).arg(s.displayFgRefreshHz, 0, 'f', 0).arg(s.displayFgSuggestion);
- }
- if (s.running && !s.image) {
- if (s.applied.multiplier > 1) {
- QString backend;
- switch (s.applied.frameGenerationBackend) {
- case engine::FrameGenerationBackend::Dlss: backend = tr("DLSS"); break;
- case engine::FrameGenerationBackend::XeSS: backend = tr("XeSS"); break;
- case engine::FrameGenerationBackend::Fsr: backend = tr("FSR 3.1"); break;
- case engine::FrameGenerationBackend::Fsr4: backend = tr("FSR 4 ML"); break;
- case engine::FrameGenerationBackend::Vfg: backend = QStringLiteral("NVIDIA VFG"); break;
- }
- detail << tr("补帧 %1X · %2").arg(s.applied.multiplier)
- .arg(backend);
- }
- else detail << tr("未补帧");
- if (s.applied.multiplier > 1 && impl_->compareMode != 0) detail << tr("补帧暂停");
- // Live output hint (DisplayFgBudget.h): a suggestion only, the
- // multiplier stays the user's choice.
- else if (!fgHint.isEmpty()) detail << fgHint;
- else if (s.applied.multiplier > 1 && (s.fgBudgetLimited || s.xessGenerationSuppressed) &&
- (!rate.policyLimited()||i.history.overloaded)) detail << tr("调度降档");
- // Why VFG cannot hold the requested multiplier. One VFG interpolation
- // costs about the same at any resolution, so what fits follows from its
- // measured cost, the rest of the chain and the source interval; the
- // display refresh caps what can be shown. A hint only: no setting changes.
- if (s.applied.multiplier > 1 && s.applied.frameGenerationBackend == engine::FrameGenerationBackend::Vfg && i.compareMode == 0) {
- const double source = rate.contentFps;
- const auto perRun = f.gpuTiming[size_t(diagnostics::GpuStage::Fg1)].p95;
- const auto batch = f.gpuTiming[size_t(diagnostics::GpuStage::FgBatch)].p95;
- const auto whole = f.enhancementProcessing.p95;
- // A mixed tier runs its first model once per pair (the middle
- // subframe) and the second model for the others; Fg1 is then a
- // second-model subframe whenever the group has more than one.
- const bool mixed = engine::vfgMixedQuality(s.applied.vfgQuality) && s.applied.multiplier > 2;
- const auto middleStage = diagnostics::GpuStage(unsigned(diagnostics::GpuStage::Fg1) + engine::vfgPrimarySubframe(s.applied.multiplier) - 1);
- const auto middle = mixed ? f.gpuTiming[size_t(middleStage)].p95 : perRun;
- if (s.fgBudgetLimited && (!rate.policyLimited()||i.history.overloaded) && source > 1 && perRun && *perRun > 0 && middle && *middle > 0 && batch && whole) {
- const double base = std::max(0.0, *whole - *batch), budget = 1000.0 / source - base;
- // generated = 1 middle + k others; fits = generated + the real frame.
- const int generated = budget < *middle ? 0 : 1 + int(std::floor((budget - *middle) / *perRun));
- const int fits = std::clamp(1 + generated, 1, int(s.applied.multiplier));
- if (fits < int(s.applied.multiplier)) {
- if (mixed) detail << tr("VFG 中间帧约 %1 ms、其余每张约 %2 ms,当前负载约可稳定 %3X").arg(*middle, 0, 'f', 1).arg(*perRun, 0, 'f', 1).arg(fits);
- else detail << tr("VFG 每张约 %1 ms,当前负载约可稳定 %2X").arg(*perRun, 0, 'f', 1).arg(fits);
- }
- }
- if (fgHint.isEmpty() && refresh > 1 && source > 1 && source * s.applied.multiplier > refresh * 1.02)
- detail << tr("屏幕 %1 Hz 最多显示约 %2X").arg(refresh, 0, 'f', 0).arg(std::max(1, int(refresh / source)));
- }
- if (s.nominalSourceFps > 0.01) detail << tr("源 %1 fps").arg(s.nominalSourceFps, 0, 'f', 2);
- if(active&&f.rateWindowReady&&rate.targetFps>0)detail<<tr("有效目标 %1 fps").arg(rate.targetFps,0,'f',1);
- const auto autoState=nrAutoStatus();if(!autoState.isEmpty())detail<<autoState;
- }
- double ratio = -1.0;
- if (active && f.rateWindowReady && rate.targetFps>0)ratio=rate.actualFps/rate.targetFps;
- const bool ratioChanged = std::abs(ratio - i.rateRatio) > 0.005;
- i.rateRatio = ratio;
- // Frame-time line: the submit interval while playing (a real display rate is
- // not available here), 48 samples = 12 s at the 250 ms cadence.
- if (active && submitFpsKnown() && submitFps() > 0.5) {
- i.frameTimes.push_back(1000.0 / submitFps());
- while (i.frameTimes.size() > 48) i.frameTimes.pop_front();
- } else if (!s.running && !i.frameTimes.empty()) i.frameTimes.clear();
- const QString text = detail.join(QStringLiteral(" · "));
- const double gpu = i.gpuUtil.load();
- const double target=active&&f.rateWindowReady&&rate.targetFps>0?rate.targetFps:-1;
- const bool changed = ratioChanged || active || status != i.runStatus || level != i.runLevel || text != i.runDetail || options!=i.runOptions || std::abs(target-i.effectiveOutputFps)>.05 || std::abs(gpu - i.gpuPublished) > 0.05 ||
- fgHint != i.fgDisplayHint || vrrLevel != i.vrrState || displayChecking != i.displayChecking ||
- hdr != i.displayHdr || std::abs(refreshHz - i.displayRefreshHz) > .01;
- i.runStatus = status; i.runLevel = level; i.runDetail = text; i.gpuPublished = gpu;
- i.runOptions=options;i.effectiveOutputFps=target;i.fgDisplayHint=fgHint;i.vrrState=vrrLevel;i.displayChecking=displayChecking;
- i.displayHdr=hdr;i.displayRefreshHz=refreshHz;
- if (changed) emit perfChanged();
- if (!recheckNotice.isEmpty()) emit notice(recheckNotice, recheckFailed);
-}
-
-// --- NR protection regions drawn on the picture (#8) ------------------------
-namespace {
-// Outline of the region being drawn, on a layered child of the video window
-// (the swapchain is never read or touched), as 1.4.4's ProtectionOverlay.
-void drawProtectionOutline(HWND overlay, HWND video, RECT box, bool ellipse) {
- RECT r{}; GetClientRect(video, &r);
- if (r.right < 1 || r.bottom < 1) return;
- SetWindowPos(overlay, HWND_TOP, 0, 0, r.right, r.bottom, SWP_NOACTIVATE);
- BITMAPINFO info{}; info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); info.bmiHeader.biWidth = r.right;
- info.bmiHeader.biHeight = -r.bottom; info.bmiHeader.biPlanes = 1; info.bmiHeader.biBitCount = 32;
- HDC screen = GetDC(nullptr), memory = CreateCompatibleDC(screen); void* bits = nullptr;
- HBITMAP bitmap = CreateDIBSection(screen, &info, DIB_RGB_COLORS, &bits, nullptr, 0);
- if (!bitmap || !bits) { if (bitmap) DeleteObject(bitmap); DeleteDC(memory); ReleaseDC(nullptr, screen); return; }
- auto previous = SelectObject(memory, bitmap);
- memset(bits, 0, size_t(r.right) * size_t(r.bottom) * 4);
- {
- Gdiplus::Bitmap canvas(r.right, r.bottom, r.right * 4, PixelFormat32bppPARGB, static_cast<BYTE*>(bits));
- Gdiplus::Graphics g(&canvas); g.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
- Gdiplus::Pen pen(Gdiplus::Color(255, 255, 138, 61), 2.0f);
- Gdiplus::SolidBrush fill(Gdiplus::Color(40, 255, 138, 61));
- const Gdiplus::Rect rect(box.left, box.top, std::max(1L, box.right - box.left), std::max(1L, box.bottom - box.top));
- if (ellipse) { g.FillEllipse(&fill, rect); g.DrawEllipse(&pen, rect); }
- else { g.FillRectangle(&fill, rect); g.DrawRectangle(&pen, rect); }
- }
- SIZE size{r.right, r.bottom}; POINT origin{}; BLENDFUNCTION blend{AC_SRC_OVER, 0, 255, AC_SRC_ALPHA};
- if (UpdateLayeredWindow(overlay, screen, nullptr, &size, memory, &origin, 0, &blend, ULW_ALPHA))
- ShowWindow(overlay, SW_SHOWNOACTIVATE);
- SelectObject(memory, previous); DeleteObject(bitmap); DeleteDC(memory); ReleaseDC(nullptr, screen);
-}
-}
-
-QVariantList QmlPlayerBridge::protectionRegions() const {
- QVariantList out;
- const auto& p = settings().protection;
- for (int i = 0; i < int(p.regions.size()); ++i) {
- const auto& q = p.regions[size_t(i)];
- if (q.empty()) continue;
- out << QVariantMap{{"index", i}, {"left", double(q.left)}, {"top", double(q.top)}, {"right", double(q.right)},
- {"bottom", double(q.bottom)}, {"ellipse", q.ellipse}};
- }
- return out;
-}
-QString QmlPlayerBridge::protectionDrawShape() const { return impl_->protDraw; }
-
-bool QmlPlayerBridge::editProtection(const std::function<bool(engine::ChainNode&)>& edit) {
- if (impl_->chain.mode != engine::ChainMode::List) { emit notice(tr("NR 保护区域仅在列表模式可用"), true); return false; }
- for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i) {
- auto& node = impl_->chain.nodes[i];
- if (node.type != engine::EffectType::Protection) continue;
- const auto before = node; const bool wasValid = chainValid();
- if (!edit(node)) return false;
- if (node == before) return true;
- const bool accepted = impl_->revalidate(true);
- if (!accepted) { const auto error = impl_->validation.message; node = before; impl_->revalidate(); emit notice(uiText(error), true); }
- emit settingsChanged();
- if (before.enabled != node.enabled) emitChainChanged(); else emitParameterChanged(&QmlPlayerBridge::protectionChanged, wasValid);
- return accepted;
- }
- emit notice(tr("处理链中没有 NR 保护节点,未更改设置"), true);
- return false;
-}
-
-bool QmlPlayerBridge::beginProtectionDraw(const QString& shape) {
- auto& i = *impl_;
- if (shape.isEmpty()) {
- if (i.protOverlay) ShowWindow(i.protOverlay, SW_HIDE);
- if (!i.protDraw.isEmpty()) { i.protDraw.clear(); emit protectionDrawChanged(); }
- return true;
- }
- if (shape != QLatin1String("rect") && shape != QLatin1String("ellipse")) return false;
- if (i.chain.mode != engine::ChainMode::List) { emit notice(tr("NR 保护区域仅在列表模式可用"), true); return false; }
- if (!i.snapshot.running || !i.videoWindow) { emit notice(tr("请先打开视频,再在画面上绘制保护区域"), true); return false; }
- bool space = false;
- for (const auto& q : settings().protection.regions) space |= q.empty();
- if (!space) { emit notice(tr("最多 4 个保护区域,请先删除一个"), true); return false; }
- i.protDraw = shape;
- emit protectionDrawChanged();
- return true;
-}
-
-void QmlPlayerBridge::updateProtectionDraw(double x0, double y0, double x1, double y1) {
- auto& i = *impl_;
- if (i.protDraw.isEmpty() || !i.videoWindow) return;
- if (!i.protOverlay) { ensureGdiplus(); i.protOverlay = createSubtitleOverlay(i.videoWindow); }
- if (!i.protOverlay) return;
- RECT client{}; GetClientRect(i.videoWindow, &client);
- const auto px = [&](double f, LONG extent) { return LONG(std::lround(std::clamp(f, 0.0, 1.0) * extent)); };
- const RECT box{px(std::min(x0, x1), client.right), px(std::min(y0, y1), client.bottom),
- px(std::max(x0, x1), client.right), px(std::max(y0, y1), client.bottom)};
- drawProtectionOutline(i.protOverlay, i.videoWindow, box, i.protDraw == QLatin1String("ellipse"));
-}
-
-bool QmlPlayerBridge::commitProtectionDraw(double x0, double y0, double x1, double y1) {
- auto& i = *impl_;
- const bool ellipse = i.protDraw == QLatin1String("ellipse");
- const bool armed = !i.protDraw.isEmpty();
- beginProtectionDraw(QString());
- if (!armed || !i.videoWindow) return false;
- RECT client{}; GetClientRect(i.videoWindow, &client);
- if (client.right < 1 || client.bottom < 1) return false;
- const double w = client.right, h = client.bottom;
- // Too small to be intended (1.4.4: at least 3 px each way).
- if (std::abs(x1 - x0) * w < 3 || std::abs(y1 - y0) * h < 3) return false;
- // Host pixels -> source-normalized, through the current zoom/pan (1.4.4).
- const auto e = i.snapshot.metrics.resolution.output;
- const auto view = i.engine.previewView();
- const auto a = view.sourcePoint(float(x0 * w), float(y0 * h), float(w), float(h), float(e.width), float(e.height));
- const auto b = view.sourcePoint(float(x1 * w), float(y1 * h), float(w), float(h), float(e.width), float(e.height));
- engine::ProtectionRect q{std::clamp(std::min(a.first, b.first), 0.0f, 1.0f), std::clamp(std::min(a.second, b.second), 0.0f, 1.0f),
- std::clamp(std::max(a.first, b.first), 0.0f, 1.0f), std::clamp(std::max(a.second, b.second), 0.0f, 1.0f), ellipse};
- if (q.empty()) return false;
- const bool ok = editProtection([&](engine::ChainNode& node) {
- for (auto& slot : node.protection.regions)
- if (slot.empty()) { slot = q; node.enabled = true; node.protection.enabled = true; return true; }
- emit notice(tr("最多 4 个保护区域,请先删除一个"), true);
- return false;
- });
- veyra::log::info("ui-protection", std::format("{} accepted={} bounds={:.3f},{:.3f},{:.3f},{:.3f} source-normalized NR-only",
- ellipse ? "ellipse" : "rectangle", ok, q.left, q.top, q.right, q.bottom));
- return ok;
-}
-
-bool QmlPlayerBridge::removeProtectionRegion(int index) {
- if (index < 0 || index >= int(engine::ProtectionSettings{}.regions.size())) return false;
- return editProtection([&](engine::ChainNode& node) {
- // Keep the remaining regions packed in order.
- auto& regions = node.protection.regions;
- for (int k = index; k + 1 < int(regions.size()); ++k) regions[size_t(k)] = regions[size_t(k + 1)];
- regions.back() = {};
- return true;
- });
-}
-bool QmlPlayerBridge::clearProtectionRegions() {
- return editProtection([](engine::ChainNode& node) { node.protection.regions = {}; return true; });
-}
-bool QmlPlayerBridge::setProtectionFeather(double pixels) {
- if (!std::isfinite(pixels) || pixels < 0 || pixels > 64) return false;
- return editProtection([&](engine::ChainNode& node) { node.protection.featherPixels = float(pixels); return true; });
-}
-
-
-// --- design gap A1-A5: flow, cadence, presentation ----------------------------
-int QmlPlayerBridge::hdrOutputMode()const{return int(settings().hdrOutputMode);}
-void QmlPlayerBridge::setHdrOutputMode(int value){if(value<0||value>1)return;auto s=settings();if(int(s.hdrOutputMode)==value)return;s.hdrOutputMode=engine::HdrOutputMode(value);if(impl_->commit(std::move(s)))emit settingsChanged();}
-int QmlPlayerBridge::fgMotionSource()const{return engine::motionUsesFlow(settings().fgMotion,settings().frameGenerationBackend)?1:0;}
-void QmlPlayerBridge::setFgMotionSource(int value){if(value<0||value>1)return;auto s=settings();s.fgMotion=engine::MotionSource(value);if(impl_->commit(std::move(s)))emit settingsChanged();}
-int QmlPlayerBridge::srMotionSource()const{return engine::motionUsesFlow(settings().srMotion)?1:0;}
-void QmlPlayerBridge::setSrMotionSource(int value){if(value<0||value>1)return;auto s=settings();s.srMotion=engine::MotionSource(value);if(impl_->commit(std::move(s)))emit settingsChanged();}
-int QmlPlayerBridge::nrMotionSource()const{return engine::motionUsesFlow(settings().nrMotion)?1:0;}
-void QmlPlayerBridge::setNrMotionSource(int value){if(value<0||value>1)return;auto s=settings();s.nrMotion=engine::MotionSource(value);if(impl_->commit(std::move(s)))emit settingsChanged();}
-int QmlPlayerBridge::flowQuality() const { return int(settings().flow); }
-void QmlPlayerBridge::setFlowQuality(int value) {
- if (value < 0 || value > 2) return;
- auto s = settings();
- if (int(s.flow) == value) return;
- s.flow = static_cast<engine::FlowQuality>(value);
- if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受运动估算质量,原设置保留"), true); return; }
- emit settingsChanged();
-}
-bool QmlPlayerBridge::amdFlowHalf() const { return settings().amdFlowHalfResolution; }
-void QmlPlayerBridge::setAmdFlowHalf(bool value) {
- auto s = settings();
- if (s.amdFlowHalfResolution == value) return;
- s.amdFlowHalfResolution = value;
- if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受 AMD 性能档,原设置保留"), true); return; }
- emit settingsChanged();
-}
-bool QmlPlayerBridge::edgeAegis() const { return settings().fgMotionRefine; }
-void QmlPlayerBridge::setEdgeAegis(bool value) {
- auto s = settings();
- if (s.fgMotionRefine == value) return;
- s.fgMotionRefine = value;
- if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受边缘神盾,原设置保留"), true); return; }
- impl_->prefs[QStringLiteral("edgeAegis")] = value;
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "edge aegis not saved");
- emit settingsChanged();
-}
-bool QmlPlayerBridge::dlssgLite() const { return settings().dlssgLite; }
-void QmlPlayerBridge::setDlssgLite(bool value) {
- auto s = settings();
- if (s.dlssgLite == value) return;
- s.dlssgLite = value;
- if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受 DLSS 性能模式,原设置保留"), true); return; }
- impl_->prefs[QStringLiteral("dlssgPerformance")] = value;
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "DLSS performance mode not saved");
- emit settingsChanged();
-}
-bool QmlPlayerBridge::dlssgLiteAvailable() const {
- static const bool present = ngx::dlssgLiteRuntimePresent(runtime::localRuntimeDirectory());
- return present;
-}
-QString QmlPlayerBridge::dlssgLiteHint() const {
- if (!dlssgLiteAvailable()) return tr("此软件包没有附带性能模式所需的 DLSS 帧生成 310.9.16 运行库");
- const auto& s = impl_->snapshot;
- if (s.running && s.dlssgLiteState == 3) return tr("目前只支持 RTX 50 系列:40/30 系的多帧解锁只适用于原版运行库");
- if (s.running && s.dlssgLiteState == 1) return tr("生效中:NVIDIA DLSS 帧生成性能模式(测试版)");
- return tr("NVIDIA 新增的性能模式(测试版):补帧更省 GPU,高倍率更稳,画质可能略降;导出仍用标准模式");
-}
-int QmlPlayerBridge::contentRate() const { return int(settings().content); }
-void QmlPlayerBridge::setContentRate(int value) {
- if (value < 0 || value > int(engine::ContentRate::Capture60To30)) return;
- auto s = settings();
- if (int(s.content) == value) return;
- s.content = static_cast<engine::ContentRate>(value);
- if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受内容节奏,原设置保留"), true); return; }
- // Shared cadence stays in shell preferences and can be included in presets.
- impl_->prefs[QStringLiteral("contentRate")] = value;
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "content cadence not saved");
- emit settingsChanged();
-}
-
-int QmlPlayerBridge::displaySync() const { return int(impl_->presentation.display); }
-bool QmlPlayerBridge::fullscreenMemorySafe() const { return !impl_->prefBool("fullscreenMemoryProtection",false)||!impl_->snapshot.vramFullscreenUnsafe; }
-void QmlPlayerBridge::setPresentationFullscreen(bool value) {
- if(impl_->presentation.fullscreen==value)return;
- impl_->presentation.fullscreen=value;
- impl_->engine.requestPresentation(impl_->presentation);
- emit presentationChanged();
- // QML's visibility notification runs inside Qt's fullscreen transition.
- // Let Qt finish its activation request before applying no-focus/through
- // flags and handing the foreground to the game. One queued transition,
- // without changing polling or presentation cadence.
- if(value&&gameMode()) QMetaObject::invokeMethod(this,[this]{
- if(impl_->presentation.fullscreen)updateGameMode();
- },Qt::QueuedConnection);
- else updateGameMode();
-}
-double QmlPlayerBridge::previewAspect() const {
- const int mode=impl_->screenFillActive?2:impl_->aspectMode;
- auto view=impl_->engine.previewView();
- view.mode=mode;
- view.rotationDegrees=impl_->snapshot.sourceRotationDegrees;
- view.displayAspect=impl_->snapshot.sourceDisplayAspect;
- const auto e=impl_->snapshot.metrics.resolution.output;
- if(mode==1&&e.height)return view.aspect(float(e.width),float(e.height));
- return view.aspect(float(impl_->snapshot.sourceWidth),float(impl_->snapshot.sourceHeight));
-}
-void QmlPlayerBridge::setDisplaySync(int value) {
- if (value < 0 || value > 2 || int(impl_->presentation.display) == value) return;
- impl_->presentation.display = static_cast<engine::DisplaySync>(value);
- applyPresentation();
-}
-bool QmlPlayerBridge::variableRefresh() const { return impl_->presentation.variableRefresh; }
-void QmlPlayerBridge::setVariableRefresh(bool value) {
- if (impl_->presentation.variableRefresh == value) return;
- impl_->presentation.variableRefresh = value;
- // Turning it on reads the monitor again: the driver setting may have changed.
- if (value) impl_->engine.displayStates().invalidate("vrr-switch-on");
- applyPresentation();
-}
-int QmlPlayerBridge::vrrState() const { return impl_->vrrState; }
-int QmlPlayerBridge::displayHdr() const { return impl_->displayHdr; }
-double QmlPlayerBridge::displayRefreshHz() const { return impl_->displayRefreshHz; }
-bool QmlPlayerBridge::displayChecking() const { return impl_->displayChecking; }
-void QmlPlayerBridge::recheckDisplay() {
- // Every stored display state becomes stale; the next status update (or the
- // presenter's next loop) queries the shown monitor in the background.
- auto& i = *impl_;
- i.displayRecheckGeneration = i.engine.displayStates().invalidate("manual");
- i.displayRecheckPending = true;
- i.displayRecheckSince = std::chrono::steady_clock::now();
- if (!i.displayChecking) { i.displayChecking = true; emit perfChanged(); }
-}
-QString QmlPlayerBridge::vrrHint() const { return vrrHintText(impl_->vrrState); }
-QString QmlPlayerBridge::vrrSummary() const { return vrrSummaryText(impl_->vrrState); }
-// The 信号 card's short form of vrrHintText.
-QString QmlPlayerBridge::vrrSummaryText(int level) const {
- switch (level) {
- case 0: return tr("无法检测");
- case 1: return tr("不支持");
- case 2: return tr("当前不可用");
- case 3: return impl_->presentation.variableRefresh && impl_->snapshot.running ? tr("已请求") : tr("可用");
- default: return tr("生效中");
- }
-}
-QString QmlPlayerBridge::vrrHintText(int level) const {
- // The 可变刷新 switch is available (not grey) from level 2: the monitor
- // can do VRR even if the driver setting is still off.
- const bool on = impl_->presentation.variableRefresh, running = impl_->snapshot.running;
- switch (level) {
- case 0: return tr("无法检测屏幕是否支持(目前只支持 NVIDIA 显卡)");
- case 1: return tr("当前屏幕不支持可变刷新");
- case 2: return tr("屏幕支持可变刷新,但当前显示模式不可用;请检查连接、刷新率及驱动设置");
- case 3:
- if (!on) return tr("屏幕跟着画面刷新:不撕裂,也几乎不用等刷新");
- return running ? tr("已请求可变刷新,驱动尚未确认生效;可检查窗口/全屏 G-SYNC 设置,当前状态不代表驱动已关闭")
- : tr("已开启,将在播放时请求可变刷新;是否生效以驱动报告为准");
- default: return on ? tr("生效中:屏幕跟着画面刷新") : tr("屏幕正处于可变刷新(驱动已开启)");
- }
-}
-QString QmlPlayerBridge::fgDisplayHint() const { return impl_->fgDisplayHint; }
-int QmlPlayerBridge::outputRateMode() const { return int(impl_->presentation.outputRate); }
-void QmlPlayerBridge::setOutputRateMode(int value) {
- if (value < 0 || value > 2 || int(impl_->presentation.outputRate) == value) return;
- impl_->presentation.outputRate = static_cast<engine::OutputRateMode>(value);
- applyPresentation();
-}
-double QmlPlayerBridge::outputCustomFps() const { return impl_->presentation.customFps; }
-void QmlPlayerBridge::setOutputCustomFps(double value) {
- if (!std::isfinite(value) || value < 1.0 || value > 1000.0) { emit notice(tr("输出上限需在 1–1000 fps 之间"), true); return; }
- if (std::abs(impl_->presentation.customFps - value) < 1e-6) return;
- impl_->presentation.customFps = value;
- applyPresentation();
-}
-bool QmlPlayerBridge::presentationOwned() const { return impl_->snapshot.presentationProviderOwned; }
-QString QmlPlayerBridge::presentationStatus() const { return uiText(impl_->snapshot.presentationStatus); }
-void QmlPlayerBridge::applyPresentation() {
- auto& p = impl_->presentation;
- if (!p.valid()) return;
- impl_->engine.requestPresentation(p);
- impl_->prefs[QStringLiteral("presentation")] = QVariantMap{
- {"lowQueue", p.enabled}, {"display", int(p.display)}, {"outputRate", int(p.outputRate)}, {"customFps", p.customFps}, {"vrr", p.variableRefresh}};
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "presentation settings not saved");
- veyra::log::info("ui-presentation", std::format("lowQueue={} display={} outputRate={} customFps={:.3f} variableRefresh={}",
- p.enabled, int(p.display), int(p.outputRate), p.customFps, p.variableRefresh));
- emit presentationChanged();
- emit settingsChanged();
- emit perfChanged();
-}
-
-// --- design gap B8-B11: compare and aspect ------------------------------------
-int QmlPlayerBridge::compareMode() const { return impl_->compareMode; }
-void QmlPlayerBridge::setCompareMode(int value) {
- if (value < 0 || value > 2 || impl_->compareMode == value) return;
- impl_->compareMode = value;
- if (!impl_->holdKeyDown) impl_->engine.comparison(value, impl_->compareBase, float(impl_->compareSplit));
- veyra::log::info("ui-compare", std::format("mode={} base={} split={:.3f}", value, impl_->compareBase, impl_->compareSplit));
- // Comparison shows real frames only (a generated frame has no original to set beside
- // it), so frame generation pauses while it is on. A field user left split compare on
- // for 24 minutes and reported "补帧无效" (logs9, 2026-10-01): say so.
- if (value != 0 && impl_->snapshot.running && impl_->snapshot.applied.multiplier > 1)
- emit notice(tr("对比模式下补帧暂停(对比只能用真实帧),关闭对比后自动恢复"), false);
- emit compareChanged();
-}
-bool QmlPlayerBridge::compareBase() const { return impl_->compareBase; }
-void QmlPlayerBridge::setCompareBase(bool value) {
- if (impl_->compareBase == value) return;
- impl_->compareBase = value;
- if (!impl_->holdKeyDown) impl_->engine.comparison(impl_->compareMode, value, float(impl_->compareSplit));
- emit compareChanged();
-}
-double QmlPlayerBridge::compareSplit() const { return impl_->compareSplit; }
-void QmlPlayerBridge::setCompareSplitAt(double fx) {
- // 1.4.4 AppShell: the split is a fraction of the displayed picture, which is
- // letterboxed and may be zoomed/panned inside the host.
- auto& i = *impl_;
- if (!i.videoWindow || !std::isfinite(fx)) return;
- RECT r{}; GetClientRect(i.videoWindow, &r);
- if (r.right < 1 || r.bottom < 1) return;
- const auto e = i.snapshot.metrics.resolution.output;
- const auto view = i.engine.previewView();
- float contentWidth = float(r.right);
- if (e.width && e.height) contentWidth = view.renderedSize(float(r.right),float(r.bottom),float(e.width),float(e.height)).first;
- const float left = r.right * .5f - contentWidth * view.centerX;
- i.compareSplit = std::clamp((float(fx) * r.right - left) / std::max(1.0f, contentWidth), 0.0f, 1.0f);
- if (!i.holdKeyDown) i.engine.comparison(i.compareMode, i.compareBase, float(i.compareSplit));
- emit compareChanged();
-}
-int QmlPlayerBridge::aspectMode() const { return impl_->screenFillActive ? 2 : impl_->aspectMode; }
-void QmlPlayerBridge::setAspectMode(int value) {
- if (value < 0 || value > 6 || (impl_->aspectMode == value && !impl_->screenFillActive)) return;
- impl_->aspectMode = value;
- impl_->screenFillActive = false;
- impl_->prefs[QStringLiteral("aspect")] = value;
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "aspect mode not saved");
- applyAspect(true);
- if (gameMode()) { updateGameGeometry(); updateGameMode(); emit gameModeChanged(); }
- emit compareChanged();
-}
-void QmlPlayerBridge::applyAspect(bool force) {
- auto& i = *impl_;
- const bool aligned=gameMode()&&i.presentation.fullscreen&&!gameScaledPreview();
- const int mode = i.screenFillActive ? 2 : i.aspectMode;
- if (!i.videoWindow) return;
- RECT r{}; GetClientRect(i.videoWindow, &r);
- const auto e = i.snapshot.metrics.resolution.output;
- const QSize client(r.right, r.bottom), image(int(e.width), int(e.height));
- const double dar=sourceAspect();
- if (!force && mode == i.aspectApplied && client == i.screenFitClient && image == i.screenFitImage && dar == i.screenFitAspect) return;
- i.screenFitClient = client; i.screenFitImage = image; i.aspectApplied = mode; i.screenFitAspect = dar;
- auto view=force||aligned?engine::PreviewView{}:i.engine.previewView();
- view.mode=mode;
- view.displayAspect=dar>0&&image.height()>0&&std::abs(dar-double(image.width())/image.height())>.001?dar:0;
- i.engine.previewView(view);
- veyra::log::info("ui-aspect", std::format("mode={} zoom={:.3f} dar={:.4f} client={}x{} image={}x{}",mode,view.zoom,dar,
- client.width(),client.height(),image.width(),image.height()));
-}
-
-// --- design gap D18 / C15 / E20 / F21 / F24 ------------------------------------
-double QmlPlayerBridge::audioSkewMs() const {
- const auto& skew = impl_->snapshot.captureAudio.skewMs;
- return audioSkewKnown() ? *skew : 0.0;
-}
-bool QmlPlayerBridge::audioSkewKnown() const {
- const auto& skew = impl_->snapshot.captureAudio.skewMs;
- return audioSyncLive() && skew.has_value() && std::isfinite(*skew) && std::abs(*skew) < 5000.0;
-}
-
-QString QmlPlayerBridge::exportSizeEstimate() const {
- const auto gb = [](double bytes) {
- return bytes >= 1024.0 * 1024 * 1024 ? QStringLiteral("%1 GB").arg(bytes / (1024.0 * 1024 * 1024), 0, 'f', 2)
- : QStringLiteral("%1 MB").arg(bytes / (1024.0 * 1024), 0, 'f', 0);
- };
- if (exportRunning()) {
- const double progress = exportProgress();
- const QFileInfo partial(exportTarget() + QStringLiteral(".partial"));
- if (progress > 0.02 && partial.exists() && partial.size() > 0)
- return tr("预计约 %1(按已写入 %2 推算)").arg(gb(partial.size() / progress)).arg(gb(double(partial.size())));
- return tr("开始写入后按已写入量推算");
- }
- const double end = impl_->exportTrimEndSeconds > 0 ? impl_->exportTrimEndSeconds : impl_->snapshot.duration;
- const double seconds = std::max(0.0, end - impl_->exportTrimStartSeconds);
- if (seconds <= 0) return QString();
- if (impl_->exportBitrateMbps > 0)
- return tr("约 %1(视频 %2 Mbps × %3,音轨另计)").arg(gb(impl_->exportBitrateMbps * 1e6 / 8.0 * seconds))
- .arg(impl_->exportBitrateMbps).arg(formatTime(seconds));
- return tr("恒定质量:大小取决于画面,开始后按已写入量推算");
-}
-
-QVariantMap QmlPlayerBridge::lastSource() const {
- auto saved = impl_->prefs.value(QStringLiteral("lastSource")).toMap();
- const QString kind = saved.value(QStringLiteral("kind")).toString();
- if (kind == QLatin1String("file")) {
- saved[QStringLiteral("summary")]=QFileInfo(saved.value(QStringLiteral("label")).toString()).fileName();
- } else if (kind == QLatin1String("capture")) {
- if (!hasCaptureSession()) return {};
- saved[QStringLiteral("summary")] = captureSessionSummary();
- } else if (kind == QLatin1String("ps5")) {
- saved[QStringLiteral("summary")] = tr("PS5 串流 · %1").arg(saved.value(QStringLiteral("label")).toString());
- } else if (kind == QLatin1String("moonlight")) {
- saved[QStringLiteral("summary")] = tr("PC 串流 · %1").arg(saved.value(QStringLiteral("label")).toString());
- } else if (kind == QLatin1String("xbox")) {
- saved[QStringLiteral("summary")] = tr("Xbox 串流 · %1").arg(saved.value(QStringLiteral("label")).toString());
- } else if (kind == QLatin1String("screen")) {
- saved[QStringLiteral("summary")] = tr("屏幕捕获 · %1").arg(saved.value(QStringLiteral("label")).toString());
- } else if (hasCaptureSession()) {
- // Before this was recorded, only capture sessions were remembered.
- return QVariantMap{{"kind", "capture"}, {"summary", captureSessionSummary()}};
- } else return {};
- return saved;
-}
-void QmlPlayerBridge::rememberSource(const QString& kind, const QString& label) {
- if(kind!=QLatin1String("file")){impl_->liveKind = kind;impl_->liveLabel = label;}
- QVariantMap value{{"kind", kind}, {"label", label}};
- if (kind == QLatin1String("screen")) value[QStringLiteral("screenKind")] = screenOptions().value(QStringLiteral("kind")).toInt();
- if (impl_->prefs.value(QStringLiteral("lastSource")).toMap() == value) return;
- impl_->prefs[QStringLiteral("lastSource")] = value;
- if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "last source not saved");
- emit preferencesChanged();
-}
-void QmlPlayerBridge::autoResumeLastSource() {
- if(!impl_->prefBool("autoResume",false)||impl_->openingSource||impl_->snapshot.running)return;
- if(lastSource().isEmpty())return;
- veyra::log::info("ui-startup","automatically resuming the last source");
- resumeLastSource();
-}
-void QmlPlayerBridge::resumeLastSource() {
- const auto last = lastSource();
- const QString kind = last.value(QStringLiteral("kind")).toString();
- veyra::log::info("ui-resume-source", "kind=" + kind.toStdString());
- if(kind==QLatin1String("file")){
- const QString path=last.value(QStringLiteral("label")).toString();
- if(!QFileInfo(path).isFile()){emit notice(tr("上次的视频文件不存在:%1").arg(path),true);return;}
- openPath(path);return;
- }
- if (kind == QLatin1String("capture")) { resumeCaptureSession(); return; }
- if (kind == QLatin1String("ps5")) {
-#ifdef VEYRA_ENABLE_REMOTEPLAY
- ps5Load();
- if (!ps5Connect()) emit notice(tr("没能继续上次的 PS5 串流:%1").arg(impl_->ps5Status), true);
-#else
- emit notice(tr("此版本不含 PS5 串流"), true);
-#endif
- return;
- }
- if (kind == QLatin1String("xbox")) {
-#ifdef VEYRA_ENABLE_XBOX
- if (!impl_->xbox || !impl_->xbox->resumeLast()) {
- emit notice(tr("没能继续上次的 Xbox 串流,请在 Xbox 串流窗口里重新选择"), true);
- emit navigate(QStringLiteral("xbox"));
- }
-#else
- emit notice(tr("此版本不含 Xbox 串流"), true);
-#endif
- return;
- }
- if (kind == QLatin1String("moonlight")) {
-#ifdef VEYRA_ENABLE_MOONLIGHT
- if (!impl_->moonlight || !impl_->moonlight->resumeLast()) {
- emit notice(tr("没能继续上次的 PC 串流,请在 PC 串流窗口里重新选择"), true);
- emit navigate(QStringLiteral("moonlight"));
- }
-#else
- emit notice(tr("此版本不含 PC 串流"), true);
-#endif
- return;
- }
- if (kind == QLatin1String("screen")) {
- const int screenKind = last.value(QStringLiteral("screenKind")).toInt();
- if (screenOptions().value(QStringLiteral("kind")).toInt() != screenKind) setScreenOption(QStringLiteral("kind"), screenKind);
- refreshCaptureTargets();
- const QString label = last.value(QStringLiteral("label")).toString();
- for (const auto& item : screenTargets()) {
- const auto map = item.toMap();
- if (map.value(QStringLiteral("label")).toString() == label) {
- setScreenTargetId(map.value(QStringLiteral("id")).toString());
- startScreenCapture();
- return;
- }
- }
- emit notice(tr("上次的捕获目标「%1」已不在,请重新选择").arg(label), true);
- emit navigate(QStringLiteral("screen"));
- return;
- }
- emit notice(tr("还没有可以继续的片源"), true);
-}
-
-bool QmlPlayerBridge::resetNrLayer(int index) {
- auto& c = impl_->chain;
- if (c.mode != engine::ChainMode::List || index < 0 || index >= int(c.nodeCount) ||
- c.nodes[size_t(index)].type != engine::EffectType::NrEnhance) return false;
- auto& node = c.nodes[size_t(index)];
- const auto before = node;
- const engine::NrLayerSettings defaults;
- // The model and residual parameters, the size and the temporal option go
- // back to their defaults; the shared runtime and the on/off state stay.
- node.nr.model = defaults.model; node.nr.residual = defaults.residual;
- node.nr.temporal = defaults.temporal; node.nr.sizePolicy = defaults.sizePolicy;
- if (node == before) return true;
- if (!impl_->revalidate(true)) {
- const auto error = impl_->validation.message; node = before; impl_->revalidate();
- emit notice(uiText(error), true); return false;
- }
- emit settingsChanged(); emitChainChanged();
- return true;
-}
-
-QVariantList QmlPlayerBridge::frameTimes() const {
- QVariantList out;
- for (const double v : impl_->frameTimes) out << v;
- return out;
-}
-
-// --- P5 (2026-09-29): headers, colour history, export rows, presets -------
-QString QmlPlayerBridge::sourceKind() const {
- const auto& s = impl_->snapshot;
- if (!hasSource()) return {};
- if (s.image) return QStringLiteral("image");
- if (s.remotePlay) return QStringLiteral("ps5");
- if (!impl_->liveKind.isEmpty()) return impl_->liveKind;
- if (s.capture) return QStringLiteral("capture");
- return QStringLiteral("file");
-}
-QString QmlPlayerBridge::sourceTitle() const {
- const QString kind = sourceKind();
- if (kind.isEmpty()) return {};
- if(kind==QLatin1String("url"))return tr("网络视频 · %1").arg(impl_->liveLabel);
- if (kind == QLatin1String("file") || kind == QLatin1String("image")) return sourceName();
- if (kind == QLatin1String("capture")) {
- const QString name = impl_->prefString("captureDeviceName");
- return tr("采集卡 · %1").arg(name.isEmpty() ? impl_->liveLabel : name);
- }
- if (kind == QLatin1String("ps5")) return tr("PS5 串流 · %1").arg(impl_->liveLabel);
- if (kind == QLatin1String("moonlight")) return tr("PC 串流 · %1").arg(impl_->liveLabel);
- if (kind == QLatin1String("xbox")) return tr("Xbox 串流 · %1").arg(impl_->liveLabel);
- return tr("屏幕捕获 · %1").arg(impl_->liveLabel);
-}
-// "1080p60" / "1080p59.94": the reported height and nominal rate only.
-QString QmlPlayerBridge::sourceRateText() const {
- const auto& s = impl_->snapshot;
- if (!s.sourceHeight) return {};
- if (s.image) return QStringLiteral("%1×%2").arg(s.sourceWidth).arg(s.sourceHeight);
- const double fps = s.nominalSourceFps;
- if (fps <= 0.0) return QStringLiteral("%1p").arg(s.sourceHeight);
- const bool whole = std::abs(fps - std::round(fps)) < 0.01;
- return QStringLiteral("%1p%2").arg(s.sourceHeight)
- .arg(whole ? QString::number(int(std::round(fps))) : QString::number(fps, 'f', 2));
-}
-QString QmlPlayerBridge::sourceFormatText() const {
- QStringList parts;
- const QString rate = sourceRateText();
- if (rate.isEmpty()) return {};
- parts << rate;
- if (sourceKind() == QLatin1String("capture")) {
- for (const auto& f : impl_->captureFormatList)
- if (f.key == impl_->captureFormatKey) {
- const QString label = uiText(f.label);
- const int dot = label.lastIndexOf(QString::fromUtf8("·"));
- if (dot >= 0) parts << label.mid(dot + 1).trimmed();
- break;
- }
- }
- const QString colour = uiText(impl_->snapshot.colorStatus);
- if (!colour.isEmpty()) parts << colour.section(QString::fromUtf8(" → "), 0, 0).trimmed();
- return parts.join(QString::fromUtf8(" · "));
-}
-
-bool QmlPlayerBridge::colourCanUndo() const { return !impl_->colourUndo.empty(); }
-bool QmlPlayerBridge::colourCanRedo() const { return !impl_->colourRedo.empty(); }
-bool QmlPlayerBridge::colourCanPaste() const { return impl_->colourClip.has_value(); }
-namespace {
-bool isColourNode(const engine::EffectChain& chain, int index) {
- return index >= 0 && uint32_t(index) < chain.nodeCount && chain.nodes[index].type == engine::EffectType::Color;
-}
-}
-// Undo and redo re-commit a stored state through the normal path (validation,
-// chain rebuild), marked as a replay so it does not push history of its own.
-bool QmlPlayerBridge::colourUndo() {
- while (!impl_->colourUndo.empty()) {
- const auto step = impl_->colourUndo.back();
- impl_->colourUndo.pop_back();
- if (!isColourNode(impl_->chain, step.index)) continue;
- impl_->selectedColour = step.index;
- const auto current = selectedColourSettings();
- impl_->colourReplaying = true;
- const bool ok = commitColour(step.colour);
- impl_->colourReplaying = false;
- if (ok) impl_->colourRedo.push_back({step.index, current});
- impl_->colourLastIndex = -1;
- veyra::log::info("ui-colour", std::format("undo layer={} ok={} left={}", step.index, ok, impl_->colourUndo.size()));
- emit settingsChanged();
- return ok;
- }
- emit settingsChanged();
- return false;
-}
-bool QmlPlayerBridge::colourRedo() {
- while (!impl_->colourRedo.empty()) {
- const auto step = impl_->colourRedo.back();
- impl_->colourRedo.pop_back();
- if (!isColourNode(impl_->chain, step.index)) continue;
- impl_->selectedColour = step.index;
- const auto current = selectedColourSettings();
- impl_->colourReplaying = true;
- const bool ok = commitColour(step.colour);
- impl_->colourReplaying = false;
- if (ok) impl_->colourUndo.push_back({step.index, current});
- impl_->colourLastIndex = -1;
- veyra::log::info("ui-colour", std::format("redo layer={} ok={}", step.index, ok));
- emit settingsChanged();
- return ok;
- }
- emit settingsChanged();
- return false;
-}
-void QmlPlayerBridge::colourCopy() {
- if (impl_->colourIndex() < 0) { emit notice(tr("处理链中没有调色节点"), true); return; }
- impl_->colourClip = selectedColourSettings();
- veyra::log::info("ui-colour", "copy");
- emit settingsChanged();
- emit notice(tr("已复制调色参数"), false);
-}
-bool QmlPlayerBridge::colourPaste() {
- if (!impl_->colourClip) return false;
- auto next = *impl_->colourClip;
- next.enabled = selectedColourSettings().enabled; // paste the grade, not the switch
- impl_->colourLastIndex = -1; // a paste is its own step
- const bool ok = commitColour(next);
- veyra::log::info("ui-colour", std::format("paste ok={}", ok));
- return ok;
-}
-
-QVariantList QmlPlayerBridge::exportItems() const {
- QVariantList result;for(int i=0;i<impl_->exportQueue.count();++i)result<<impl_->exportQueue.get(i);return result;
-}
-void QmlPlayerBridge::addCurrentExportFile(){
- if(!QFileInfo(utf8Of(impl_->sourceLabel)).isFile())return;
- const auto id=impl_->exportQueue.addFile(utf8Of(impl_->sourceLabel));
- impl_->exportQueue.queue().setTrim(id,impl_->exportTrimStartSeconds,impl_->exportTrimEndSeconds);
- impl_->exportQueue.setSelectedId(id);emit exportChanged();
-}
-QObject* QmlPlayerBridge::exportQueueModel() const{return &impl_->exportQueue;}
-int QmlPlayerBridge::exportContainer()const{return impl_->exportContainer;}
-void QmlPlayerBridge::setExportContainer(int value){
- if(value<0||value>1||value==impl_->exportContainer)return;
- impl_->exportContainer=value;impl_->exportQueue.queue().setContainer(static_cast<engine::ExportContainer>(value));
- impl_->exportQueue.refresh();
-}
-int QmlPlayerBridge::exportReadyCount()const{return int(impl_->exportQueue.queue().readyCount());}
-bool QmlPlayerBridge::exportSelectionEditable()const{
- const auto* item=impl_->exportQueue.queue().find(impl_->exportQueue.selectedId());
- return item&&item->state!=engine::ExportItemState::Running&&item->state!=engine::ExportItemState::Queued;
-}
-int QmlPlayerBridge::exportAudioPolicy()const{
- const auto* item=impl_->exportQueue.queue().find(impl_->exportQueue.selectedId());return item?int(item->media.audio.policy):1;
-}
-int QmlPlayerBridge::exportSubtitlePolicy()const{
- const auto* item=impl_->exportQueue.queue().find(impl_->exportQueue.selectedId());return item?int(item->media.subtitles.policy):1;
-}
-QVariantList QmlPlayerBridge::exportTracks()const{
- QVariantList result;const auto* item=impl_->exportQueue.queue().find(impl_->exportQueue.selectedId());if(!item)return result;
- for(const auto& track:item->info.tracks){const auto& selection=track.audio?item->media.audio:item->media.subtitles;
- const bool selected=selection.policy==engine::ExportTrackPolicy::All||selection.contains(track.index);
- result<<QVariantMap{{"index",track.index},{"audio",track.audio},{"selected",selected},{"compatible",track.compatible},
- {"label",QStringLiteral("%1 · %2 · %3%4").arg(track.index).arg(utf8Of(track.codec)).arg(utf8Of(track.language)).arg(track.channels?QStringLiteral(" · %1 声道").arg(track.channels):QString())},
- {"title",utf8Of(track.title)},{"action",utf8Of(track.action)}};
- }
- return result;
-}
-void QmlPlayerBridge::setExportTrackPolicy(bool audio,int policy){
- if(policy<1||policy>3)return;
- auto& queue=impl_->exportQueue.queue();const auto id=impl_->exportQueue.selectedId();const auto* item=queue.find(id);if(!item)return;
- engine::ExportTrackSelection selection;selection.policy=static_cast<engine::ExportTrackPolicy>(policy);
- if(selection.policy==engine::ExportTrackPolicy::Selected){
- for(const auto& track:item->info.tracks)if(track.audio==audio){selection.indices[0]=track.index;selection.count=1;break;}
- if(!selection.count){emit notice(tr("该文件没有可选轨道"),true);return;}
- }
- if(queue.setTracks(id,audio,selection))impl_->exportQueue.refresh();
-}
-void QmlPlayerBridge::toggleExportTrack(bool audio,int index,bool keep){
- auto& queue=impl_->exportQueue.queue();const auto id=impl_->exportQueue.selectedId();const auto* item=queue.find(id);if(!item)return;
- const auto& previous=audio?item->media.audio:item->media.subtitles;
- engine::ExportTrackSelection selection;selection.policy=engine::ExportTrackPolicy::Selected;
- for(const auto& track:item->info.tracks)if(track.audio==audio){
- // Leaving "all" keeps what "all" actually carried: tracks it skipped for
- // this container stay out instead of turning into a hard failure.
- const bool selected=track.index==index?keep:previous.policy==engine::ExportTrackPolicy::All?track.compatible:previous.contains(track.index);
- if(selected){if(selection.count>=selection.indices.size()){emit notice(tr("手动选择最多 64 条;保留全部不限制轨道数量"),true);return;}selection.indices[selection.count++]=track.index;}
- }
- if(!selection.count)selection.policy=engine::ExportTrackPolicy::None;
- if(queue.setTracks(id,audio,selection))impl_->exportQueue.refresh();
-}
-void QmlPlayerBridge::previewExportItem(qulonglong id){
- const auto* item=impl_->exportQueue.queue().find(id);if(!item)return;
- const QString input=utf8Of(item->input);const double start=item->start,end=item->end;
- if(input!=utf8Of(impl_->sourceLabel))openPath(input);
- impl_->exportQueue.setSelectedId(id);impl_->exportTrimStartSeconds=start;impl_->exportTrimEndSeconds=end;
- emit exportChanged();
-}
-bool QmlPlayerBridge::exportCompletionSound()const{return impl_->prefs.value(QStringLiteral("exportCompletionSound"),true).toBool();}
-void QmlPlayerBridge::setExportCompletionSound(bool enabled){
- const auto previous=impl_->prefs;impl_->prefs[QStringLiteral("exportCompletionSound")]=enabled;
- if(!impl_->savePrefs()){impl_->prefs=previous;emit notice(tr("提示音设置保存失败"),true);}
- emit exportChanged();
-}
-void QmlPlayerBridge::clearFinishedExportItems() {
- for(int row=impl_->exportQueue.count()-1;row>=0;--row){const auto& item=impl_->exportQueue.queue().items()[row];
- if(item.state==engine::ExportItemState::Done||item.state==engine::ExportItemState::Failed||item.state==engine::ExportItemState::Cancelled)impl_->exportQueue.removeItem(item.id);
- }
- emit exportChanged();
-}
-// A thumbnail of any file (export queue rows), through the same provider.
-QString QmlPlayerBridge::fileThumbnailId(const QString& path, double seconds) const {
- if (path.isEmpty()) return {};
- return QStringLiteral("image://veyra-thumb/file/%1/%2/%3")
- .arg(impl_->thumbnailGeneration)
- .arg(QString::fromLatin1(path.toUtf8().toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals)))
- .arg(qint64(std::max(0.0, seconds) * 1000.0));
-}
-
-QString QmlPlayerBridge::capturePreviewUrl() const {
- const auto& s = impl_->snapshot;
- if (!s.running || s.posterRgba.empty() || !s.posterWidth || !s.posterHeight) return {};
- if (impl_->posterSession != s.sessionId || impl_->posterUrl.isEmpty()) {
- const QImage image(s.posterRgba.data(), int(s.posterWidth), int(s.posterHeight), int(s.posterWidth * 4),
- QImage::Format_RGBA8888);
- QByteArray png;
- QBuffer buffer(&png);
- buffer.open(QIODevice::WriteOnly);
- image.save(&buffer, "PNG");
- impl_->posterSession = s.sessionId;
- impl_->posterUrl = png.isEmpty() ? QString()
- : QStringLiteral("data:image/png;base64,") + QString::fromLatin1(png.toBase64());
- }
- return impl_->posterUrl;
-}
-QString QmlPlayerBridge::captureSignalLevel() const {
- const auto& s = impl_->snapshot;
- if (!s.running || !s.capture) return QStringLiteral("idle");
- if (s.captureRecovering) return QStringLiteral("warn");
- if (s.captureSampledBlack) return QStringLiteral("warn");
- return s.captureFps > 0.5 ? QStringLiteral("ok") : QStringLiteral("warn");
-}
-QString QmlPlayerBridge::captureSignalText() const {
- const auto& s = impl_->snapshot;
- if (captureSignalLevel() == QLatin1String("idle")) return tr("未连接");
- if (s.captureRecovering) return tr("正在恢复");
- if (s.captureFps > 0.5 && s.captureSampledBlack) return tr("收到黑帧 · 检查输入制式");
- return s.captureFps > 0.5 ? tr("正在收帧") : tr("等待信号");
-}
-
-void QmlPlayerBridge::importPresetDialog() {
- const QString path = QFileDialog::getOpenFileName(nullptr, tr("导入预设"), QString(),
- tr("Veyra 预设 (*.vpreset);;所有文件 (*)"));
- if (!path.isEmpty()) importPreset(path);
-}
-bool QmlPlayerBridge::importPreset(const QString& path) {
- std::wstring name;
- auto& library = impl_->facade.presets();
- const bool ok = library.importFile(std::filesystem::path(wideOf(path)), name);
- veyra::log::info("ui-preset", std::format("import ok={} name={}", ok, utf8Of(name).toStdString()));
- if (!ok) { emit notice(tr("导入失败:%1").arg(uiText(library.error())), true); return false; }
- emit presetsChanged();
- emit notice(tr("已导入预设:%1").arg(utf8Of(name)), false);
- return true;
-}
-void QmlPlayerBridge::exportPresetDialog(int index) {
- const auto& entries = impl_->facade.presets().entries();
- if (index < 0 || size_t(index) >= entries.size()) return;
- const QString path = QFileDialog::getSaveFileName(nullptr, tr("导出预设"),
- utf8Of(entries[size_t(index)].name) + QStringLiteral(".vpreset"),
- tr("Veyra 预设 (*.vpreset)"));
- if (!path.isEmpty()) exportPreset(index, path);
-}
-bool QmlPlayerBridge::exportPreset(int index, const QString& path) {
- auto& library = impl_->facade.presets();
- if (index < 0 || size_t(index) >= library.entries().size()) return false;
- const bool ok = library.exportEntry(size_t(index), std::filesystem::path(wideOf(path)));
- veyra::log::info("ui-preset", std::format("export index={} ok={}", index, ok));
- if (!ok) { emit notice(tr("导出失败:%1").arg(uiText(library.error())), true); return false; }
- emit notice(tr("预设已导出到:%1").arg(QDir::toNativeSeparators(path)), false);
- return true;
-}
-
-QString QmlPlayerBridge::liveOpeningText() const {
- if (!impl_->pendingLiveText.isEmpty()) return impl_->pendingLiveText;
- const auto& s = impl_->snapshot;
- if (s.running || s.failed || s.transport != engine::TransportState::Opening) return {};
- const QString status = veyra::ui::i18n::text(s.status);
- if (s.remotePlay)
- return status.contains(QStringLiteral("PIN")) ? status : tr("正在连接 PS5 · %1").arg(impl_->liveLabel);
- if (impl_->liveKind == QLatin1String("screen")) return tr("正在开始屏幕捕获…");
- if (s.capture) return tr("正在打开采集设备…");
- return {};
-}
-
-// ---- network / server playback (#48) ------------------------------------------------
-bool QmlPlayerBridge::networkActive() const { return impl_->snapshot.network.active; }
-bool QmlPlayerBridge::networkHolding() const {
- const auto& n = impl_->snapshot.network;
- return n.active && (n.holding() || n.state == media::NetworkStats::State::Reconnecting);
-}
-QString QmlPlayerBridge::networkSummary() const {
- const auto& n = impl_->snapshot.network;
- if (!n.active) return {};
- QStringList parts;
- parts << tr("缓冲 %1 s").arg(n.bufferedSeconds, 0, 'f', 1);
- parts << (n.downloadBytesPerSecond > 0 ? tr("下载 %1 MB/s").arg(n.downloadBytesPerSecond / 1048576.0, 0, 'f', 1)
- : tr("下载 —"));
- parts << tr("重连 %1").arg(n.reconnects);
- if (const uint64_t lost = std::max(n.corruptPackets, n.corruptFrames); lost > 0) parts << tr("丢包 %1").arg(qulonglong(lost));
- return parts.join(QStringLiteral(" · "));
-}
-QString QmlPlayerBridge::networkNotice() const {
- const auto& n = impl_->snapshot.network;
- return n.active ? uiText(n.message) : QString();
-}
} // namespace veyra::ui
diff --git a/src/ui/QmlPlayerBridge_p.h b/src/ui/QmlPlayerBridge_p.h
new file mode 100644
index 00000000..a1c008da
--- /dev/null
+++ b/src/ui/QmlPlayerBridge_p.h
@@ -0,0 +1,960 @@
+#pragma once
+// Private bridge state shared by cohesive implementation modules.
+// Public QML API, ownership, polling and settings contracts remain in QmlPlayerBridge.h.
+#include "veyra/media/FFmpegDeinterlacer.h"
+#include "veyra/ui/QmlPlayerBridge.h"
+#include "veyra/gfx/PresentSink.h"
+#include "veyra/gfx/NvidiaVrr.h"
+#include "veyra/media/NetworkInput.h"
+#include "veyra/ngx/DlssgLite.h"
+#include "veyra/RuntimePaths.h"
+#include "veyra/ui/GamePassthrough.h"
+#include <QAbstractNativeEventFilter>
+#include <QGuiApplication>
+#include <QScreen>
+#include <QtGui/qscreen_platform.h>
+#include <shellapi.h>
+#include <QElapsedTimer>
+#include <QScopedValueRollback>
+#include "veyra/ui/EffectAvailability.h"
+#include "veyra/engine/FrameGenerationSelection.h"
+#include "veyra/ui/QmlExportQueueModel.h"
+#include "veyra/ui/PlaylistModel.h"
+#include "veyra/ui/UpdateChecker.h"
+#include "veyra/ui/UiLanguage.h"
+#include <QQmlEngine>
+#include <QMetaMethod>
+#include <QMetaProperty>
+#include <QSet>
+
+#include <QRegion>
+#include <QCursor>
+#include <QScreen>
+#include <QWindow>
+#include <QPlatformSurfaceEvent>
+#include <QPointer>
+
+#include <QDateTime>
+#include <QDir>
+#include <QFileDialog>
+#include <QFileInfo>
+#include <QDesktopServices>
+#include <QStandardPaths>
+#include <QKeyEvent>
+#include <QKeySequence>
+#include <QCoreApplication>
+#include <QClipboard>
+#include <QGuiApplication>
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QJsonArray>
+#include <QHash>
+#include <QFile>
+#include <QSaveFile>
+#include <QTimer>
+#include <QBuffer>
+#include <QImage>
+#include <QImageReader>
+
+#include <algorithm>
+#include <cmath>
+#include <chrono>
+#include <limits>
+#include <optional>
+#include <span>
+#include <vector>
+
+#include "veyra/Log.h"
+#include "veyra/RuntimePaths.h"
+#include "veyra/pipeline/VfgBackend.h"
+#include "veyra/gfx/GpuSchedulingPriority.h"
+#include "veyra/engine/ColorLookStore.h"
+#include "veyra/engine/ColorLut.h"
+#include "veyra/engine/Subtitles.h"
+#include "veyra/engine/PlaybackRate.h"
+#include "veyra/sink/WasapiAudioSink.h"
+#include "veyra/source/CaptureFormatSelection.h"
+#include "veyra/source/CaptureCapabilityRange.h"
+#include "veyra/source/CaptureFormatRank.h"
+#include "veyra/source/CaptureColorOverride.h"
+#include "veyra/source/CaptureFrameRate.h"
+#include "veyra/source/MagewellCapture.h"
+#include "CapturePreferenceStore.h"
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+// SDL3-static's system libraries (see CMakeLists: kept off the link line).
+#pragma comment(lib, "winmm.lib")
+#pragma comment(lib, "imm32.lib")
+#pragma comment(lib, "version.lib")
+#pragma comment(lib, "setupapi.lib")
+#pragma comment(lib, "dinput8.lib")
+#include "veyra/remoteplay/ControllerInput.h"
+#include "veyra/remoteplay/Discovery.h"
+#include "veyra/remoteplay/ProfileStore.h"
+#include "veyra/remoteplay/PsnAuth.h"
+#include "veyra/source/RemotePlaySource.h"
+#endif
+#ifdef VEYRA_ENABLE_XBOX
+#include "veyra/ui/XboxModel.h"
+#endif
+#ifdef VEYRA_ENABLE_MOONLIGHT
+#include "veyra/ui/MoonlightInputCapture.h"
+#include "veyra/ui/MoonlightModel.h"
+#endif
+#include <future>
+#include <functional>
+#include <map>
+#include <deque>
+#include "SubtitleOverlay.h"
+// GDI+ is only started here (the overlay draws with it); its headers expect
+// min/max, which NOMINMAX builds do not define as macros.
+#include <objidl.h>
+namespace Gdiplus { using std::min; using std::max; }
+#include <gdiplus.h>
+#pragma comment(lib, "gdiplus.lib")
+// 1.4.4's live status rules (正常 / 补帧调度降档 / 输出未达标 / 输入帧率不足).
+#include "LiveStatusHistory.h"
+// GPU utilization for the performance orb: the Windows "GPU Engine" counters,
+// the same source Task Manager reads.
+#include <pdh.h>
+#include <pdhmsg.h>
+#pragma comment(lib, "pdh.lib")
+#include <atomic>
+#include <set>
+#include <mutex>
+#include <thread>
+#include "veyra/pipeline/ColorGradeTables.h"
+#include "veyra/ui/PlaybackPowerGuard.h"
+#include "veyra/gfx/XessMfgUnlock.h"
+#include "veyra/gfx/D3D12DeviceContext.h"
+#include "veyra/gfx/PresentationHooks.h"
+#include <dxgi1_6.h>
+#include <wrl/client.h>
+#include "veyra/ngx/NrArchitecturePolicy.h"
+#include "veyra/ngx/FgCompatibilitySession.h"
+#include "veyra/source/CaptureCardSource.h"
+#include "veyra/source/DeckLinkCapture.h"
+#include "veyra/source/CaptureSignalProbe.h"
+#include "veyra/source/ScreenCaptureSource.h"
+
+namespace veyra::ui {
+namespace bridge_detail {
+inline QString utf8Of(std::string_view s) { return QString::fromUtf8(s.data(), int(s.size())); }
+inline QString utf8Of(const std::wstring& w) { return QString::fromWCharArray(w.c_str(), int(w.size())); }
+
+// Where crash and device-loss hints go: next to the log, where the crash handler in
+// apps/veyra-qml/main.cpp writes them too.
+inline QString lastFailurePath() {
+ return QFileInfo(qApp->property("veyraLogFile").toString()).absolutePath() + QStringLiteral("/veyra-last-failure.txt");
+}
+
+// What the user can switch off, for the injected components named in `modules`
+// (RTSSHooks64.dll, see gfx::riskyInjections). Empty when none is known.
+inline QString injectionAdvice(const QString& modules) {
+ QStringList parts;
+ if (modules.contains(QStringLiteral("RTSSHooks64.dll"), Qt::CaseInsensitive) && !qApp->property("veyraSoftwareUi").toBool())
+ parts << QCoreApplication::translate("QmlPlayerBridge", "检测到 RivaTuner(小飞机 OSD)注入了 Veyra。请把 设置 → 监控软件兼容 设为“自动”并在小飞机运行时重启 Veyra:界面改用兼容绘制,OSD 只显示在视频上");
+ return parts.join(QStringLiteral(";"));
+}
+// Messages and fixed table labels shown to the user, in the interface language
+// (UiLanguage.h). Data that only passes through the UI - paths, device, preset and
+// LUT names - keeps utf8Of(), and so do log lines.
+inline QString uiText(const std::wstring& w) { return veyra::ui::i18n::text(w); }
+inline QString uiText(std::string_view s) { return veyra::ui::i18n::text(QString::fromUtf8(s.data(), int(s.size()))); }
+inline std::wstring wideOf(const QString& s) {
+ return std::wstring(reinterpret_cast<const wchar_t*>(s.utf16()), size_t(s.size()));
+}
+inline QString mmss(double seconds) {
+ if (!std::isfinite(seconds) || seconds < 0) seconds = 0;
+ const int total = int(seconds);
+ const int h = total / 3600, m = (total % 3600) / 60, s = total % 60;
+ return h > 0 ? QStringLiteral("%1:%2:%3").arg(h).arg(m, 2, 10, QLatin1Char('0')).arg(s, 2, 10, QLatin1Char('0'))
+ : QStringLiteral("%1:%2").arg(m).arg(s, 2, 10, QLatin1Char('0'));
+}
+inline void exportCompletionNotice(bool enabled,uint64_t event,const char* kind){
+ const BOOL queued=enabled?MessageBeep(MB_OK):FALSE;
+ veyra::log::info("export-notify",std::format("kind={} event={} soundEnabled={} systemSoundQueued={}",kind,event,enabled,queued!=FALSE));
+}
+inline bool exportFileClosed(const QString& path){
+ HANDLE file=CreateFileW(wideOf(path).c_str(),GENERIC_READ,0,nullptr,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,nullptr);
+ if(file==INVALID_HANDLE_VALUE)return false;
+ CloseHandle(file);return true;
+}
+} // namespace bridge_detail
+using namespace bridge_detail;
+
+QVariantMap currentEffectCapabilities(bool refresh=false);
+QString unavailableEffects(const engine::EnhancementSettings& settings);
+QString disableUnavailableEffects(engine::ChainConfiguration& configuration);
+ui::EffectGpu effectGpu();
+
+namespace bridge_detail {
+// WM_DISPLAYCHANGE reaches every top-level window when a display mode, refresh
+// rate or HDR state, or the set of screens, changes: the 可变刷新 state is then
+// read once more (DisplayStateService) instead of on a timer.
+struct DisplayChangeFilter final : QAbstractNativeEventFilter {
+ bool* changed = nullptr;
+ bool nativeEventFilter(const QByteArray& type, void* message, qintptr*) override {
+ if (changed && type == "windows_generic_MSG" && static_cast<const MSG*>(message)->message == WM_DISPLAYCHANGE) *changed = true;
+ return false;
+ }
+};
+} // namespace bridge_detail
+
+struct QmlPlayerBridge::Impl {
+ // Per-layer on/off before the NR master switch turned them all off.
+ std::vector<bool> nrMasterRestore;
+ std::vector<bool> beautyMasterRestore; // the same for the beauty group switch
+ QQmlEngine* qmlEngine = nullptr;
+ engine::EngineController& engine;
+ PlayerUiFacade facade;
+
+ // Last published snapshot and the revision it came from. Polling compares
+ // revisions, so an unchanged snapshot costs one comparison per tick.
+ engine::PlayerSnapshot snapshot;
+ uint64_t publishedRevision = 0;
+ bool haveSnapshot = false;
+ bool openingSource = false;
+ uint64_t openingSessionId = 0;
+ uint64_t vramNoticeSession = 0; // the session the video-memory warning was shown for
+
+ // The chain the UI edits, kept in step with the facade's pending settings.
+ engine::EffectChain chain;
+ engine::EffectChain acceptedChain;
+ engine::NodeGraphLayout layout;
+ engine::ChainGlobalSettings draftGlobals;
+ const engine::EffectChain& activeRuntime() const {
+ return chain.mode == engine::ChainMode::Node ? acceptedChain : chain;
+ }
+ void initializeDefaultNodePositions() {
+ if (chain.mode != engine::ChainMode::Node) return;
+ for (uint32_t i = 0; i < chain.nodeCount; ++i)
+ if (chain.nodes[i].viewX == 0 && chain.nodes[i].viewY == 0) {
+ chain.nodes[i].viewX = float(i % 4) * 260;
+ chain.nodes[i].viewY = float(i / 4) * 300;
+ }
+ }
+ void restoreConfiguration(const engine::ChainConfiguration& c) {
+ draftGlobals = c.editor && c.editor->globals ? *c.editor->globals :
+ static_cast<const engine::ChainGlobalSettings&>(c);
+ acceptedChain = c.chain;
+ chain = c.editor ? c.editor->nodes : c.chain;
+ if (c.editor) layout = c.editor->layout;
+ else if (chain.mode == engine::ChainMode::Node) layout.initialize(chain);
+ selectedNr = c.selectedNr; selectedColour = c.selectedColour;
+ // Resolve the old QML-only layout fallback once so duplication, wires
+ // and saved coordinates use the same physical rectangles.
+ if (!c.editor) initializeDefaultNodePositions();
+ }
+ engine::ChainValidation validation;
+ engine::ChainSession session;
+ engine::ChainSession savedSession;
+ QTimer* sessionSaveTimer = nullptr;
+ int selectedNr=-1;
+ int nrIndex() const {
+ if(selectedNr>=0&&uint32_t(selectedNr)<chain.nodeCount&&
+ chain.nodes[selectedNr].type==engine::EffectType::NrEnhance)return selectedNr;
+ for(uint32_t i=0;i<chain.nodeCount;++i)if(chain.nodes[i].type==engine::EffectType::NrEnhance)return int(i);
+ return -1;
+ }
+ engine::ChainNode* nrNode(){const int i=nrIndex();return i>=0?&chain.nodes[i]:nullptr;}
+ int selectedColour=-1;
+ int colourIndex() const {
+ if(selectedColour>=0&&uint32_t(selectedColour)<chain.nodeCount&&
+ chain.nodes[selectedColour].type==engine::EffectType::Color)return selectedColour;
+ for(uint32_t i=0;i<chain.nodeCount;++i)if(chain.nodes[i].type==engine::EffectType::Color)return int(i);
+ return -1;
+ }
+
+ // The window the engine presents into, and the last file the UI opened.
+ HWND videoWindow = nullptr;
+ std::wstring sourceLabel;
+ int thumbnailGeneration = 0;
+ // The live source kind and label ("" for a file), for the page headers.
+ QString liveKind, liveLabel;
+ // A live open waiting for the 极简 switch to settle (openAfterCinema); the
+ // generation lets a newer open or a stop cancel it.
+ int liveOpenGen = 0;
+ QString pendingLiveText;
+ // 调色 history: each commit pushes the layer's previous state; a slider
+ // drag (edits under 600 ms apart on one layer) is one step.
+ struct ColourStep { int index = -1; engine::ColorSettings colour{}; };
+ std::vector<ColourStep> colourUndo, colourRedo;
+ std::optional<engine::ColorSettings> colourClip;
+ qint64 colourLastPushMs = 0;
+ int colourLastIndex = -1;
+ bool colourReplaying = false;
+ // Poster data URL cache, per session.
+ uint64_t posterSession = 0;
+ QString posterUrl;
+
+ // Keeps the display and system awake while a video plays (AppShell rule: running,
+ // not failed, not a still image, transport Playing). Acquired and released on
+ // this GUI thread, as SetThreadExecutionState requires.
+ PlaybackPowerGuard power;
+ std::function<void()> preOpen;
+
+ // Export progress is mirror state: the engine reports an export through a
+ // progress callback, and there is no export status in PlayerSnapshot yet.
+ bool exportRunning = false;
+ std::wstring exportOutput;
+ QString exportStatus;
+ engine::PlayerOptions options;
+
+ // The export job manager is the real thing: state, progress and encoded
+ // counts come from its snapshot.
+ engine::ExportJobManager exportJob;
+ QmlExportQueueModel exportQueue{exportJob};
+ int exportContainer=0;
+ uint64_t exportNotifiedBatch=0;
+ QString pendingFrameExport;
+ qint64 pendingFrameDeadline=0;
+ uint64_t imageCompletionEvent=0;
+ engine::ExportJobSnapshot exportSnapshot;
+ bool exportHevc = false;
+ // Default: VBR at 8 Mbps (field request 2026-10-02); CQ stays one tap away.
+ uint32_t exportBitrateMbps = 8;
+ sink::ExportRateControl exportRateControl = sink::ExportRateControl::Vbr;
+ int exportResolutionIndex = -1;
+ double exportTrimStartSeconds = 0.0;
+ double exportTrimEndSeconds = 0.0;
+ std::wstring exportPresetName;
+ QString initialPageOverride;
+ QString currentPage;
+ std::wstring captureDevice;
+ QString screenTarget;
+ QString remotePlayHost, remotePlayPin;
+
+ QTimer* timer = nullptr;
+
+ // Canvas positions of the fixed input / optical-flow / output boxes. They are
+ // editor furniture, not chain nodes, so they live beside the preferences.
+ std::filesystem::path anchorsFile;
+ QVariantMap anchors;
+ // Where the user's own files live (the facade resolves the same default).
+ std::filesystem::path dataDir;
+ PlaylistModel* playlist = nullptr;
+ QString playlistPath;
+ uint64_t playlistSession = 0, playlistCompletedSession = 0;
+ // --- subtitles (ported from the Win32 shell, same semantics) ---
+ std::unique_ptr<engine::SubtitleLoader> subLoader;
+ // Embedded-subtitle scan of a file on a server (#48): reads only while playback has its own
+ // buffer. The gate follows the engine's network statistics (tickSubtitles); null for local files.
+ std::shared_ptr<std::atomic<bool>> subScanGate;
+ bool subScanOpen = false;
+ std::unique_ptr<engine::SubtitleLoader> subFileLoader;
+ uint64_t subFileGeneration = 0;
+ std::wstring subFilePath;
+ uint64_t subGeneration = 0;
+ std::vector<engine::SubtitleTrack> subTracks; // external files first, then the loader's
+ size_t subExternal = 0; // user-loaded files at the front
+ size_t subLoaded = 0; // loader tracks currently held
+ int subPrimary = -1, subSecondary = -1;
+ bool subPrimaryChosen = false, subSecondaryChosen = false;
+ QString subStatus;
+ QString subText;
+ int subBottomInset = 0;
+ HWND subOverlay = nullptr;
+ bool subOverlayFailed = false;
+ std::wstring subMedia;
+ std::atomic<bool> subAligning{false}, subAlignReady{false};
+ std::atomic<int> subAlignOffset{0};
+ std::mutex subAlignMutex;
+ std::wstring subAlignDetail;
+ uint64_t subAlignGeneration = 0;
+ int subAlignTrack = -1;
+ // Declared after everything the worker touches, so it is joined first.
+ std::jthread subAlignWorker;
+ QVariantMap prefs;
+ // Live recording state published by the engine (see LiveRecorder.h).
+ QVariantMap recordingState;
+ uint64_t recordingSaved = 0; // LiveRecorder's finished-file counter already announced
+ // Custom: the display whose HDR curve is currently applied (see syncHdrDisplayProfile).
+ QString hdrProfileDisplay;
+ // Custom: the title whose curve is currently applied (see syncHdrTitleProfile).
+ QString hdrTitleApplied;
+ HMONITOR hdrIdentityMonitor=nullptr;
+ QString hdrIdentityKey;
+ bool hdrRestoring=false,hdrCoverageObserved=false,hdrMemoryDirty=false;
+ QTimer* hdrMemorySaveTimer=nullptr;
+ // Custom: how many remembered titles survive; the oldest fall off first.
+ int kHdrTitleProfileLimit = 60;
+ QString lastScreenshot;
+ QString pendingScreenshot;
+ qint64 pendingScreenshotDeadline=0;
+ bool holdKeyDown = false;
+ int positionTicks = 0;
+ // A reopened file resumes here once its session is running.
+ uint64_t resumeSession = 0;
+ double resumeAt = 0;
+ std::vector<sink::RenderEndpoint> audioEndpoints;
+ // --- capture connection (P4-e) ---
+ struct CaptureQuery { int kind = 0; std::wstring device,requestedResolution; std::vector<source::CaptureDevice> video, audio; std::vector<source::CaptureFormat> formats;source::CaptureFormatQueryInfo info; };
+ std::future<CaptureQuery> captureQuery;
+ std::optional<std::pair<int,std::wstring>> captureNextQuery;
+ bool captureBusy = false, captureListed = false, captureResumePending = false;
+ bool captureDriverSettingsOpen = false;
+ std::wstring captureDriverFormatKey;
+ int captureQueryKind = 0; // 0 device list, 1 formats, 2 formats then connect (continue)
+ std::vector<source::CaptureDevice> captureVideo, captureAudio;
+ std::vector<source::CaptureFormat> captureFormatList;
+ // The capture dialog's lists are built once per input. QML re-reads a list property on
+ // every element access (Qt 6 sequence references), so a getter that rebuilt the list
+ // made `.find()` and VSelect quadratic: 15474 formats hung the interface (logs(18)).
+ // Each cache is checked against what it was built from, not reset by captureChanged:
+ // QML bindings receive a notify signal before any ordinary connection does.
+ uint64_t captureFormatGeneration = 0; // bumped whenever captureFormatList is replaced
+ int uiDeviceGeneration = 0; // interface scene graphs recreated after a lost device
+ // One automatic capture-card reconnect after the GPU stopped completing work. Field
+ // logs 56: after the hang and driver reset the session just ended; reconnecting by hand
+ // ran smoothly again. A second GPU failure within ten minutes is left to the user.
+ uint64_t gpuReconnectSession = 0;
+ std::chrono::steady_clock::time_point gpuReconnectDue{}, gpuReconnectLast{};
+ // Network sources (#48): damaged data is concealed or skipped without a word per packet;
+ // the user hears about it once in a while, and about a successful reconnect.
+ uint64_t netNoticeSession = 0, netLossReported = 0;
+ uint32_t netReconnectsReported = 0;
+ std::chrono::steady_clock::time_point netLossNoticeAt{};
+ struct CaptureListCache { bool valid = false; uint64_t generation = 0; QString language; std::wstring a, b; QVariantList list; };
+ CaptureListCache captureFormatsCache, captureResolutionCache, captureRateCache, capturePixelCache;
+ // Settings → 组件与许可. Read once and on refreshComponentList(): the property used to
+ // notify with every engine snapshot, so each 60 Hz tick re-read the manifest and
+ // rebuilt the page's 49 rows (audit 2026-10-15 B5).
+ QVariantList componentList; bool componentListRead = false;
+ bool liveCompanionCap = false; // updateLiveCompanionCompat
+ int captureHiddenRates = 0; // set with captureRateCache
+ template <class Build> const QVariantList& captureList(CaptureListCache& cache, const std::wstring& a, const std::wstring& b, Build&& build) {
+ const QString language = i18n::current();
+ if (!cache.valid || cache.generation != captureFormatGeneration || cache.language != language || cache.a != a || cache.b != b) {
+ cache.list = build();
+ cache.valid = true; cache.generation = captureFormatGeneration; cache.language = language; cache.a = a; cache.b = b;
+ }
+ return cache.list;
+ }
+ std::wstring captureFormatKey;
+ std::wstring captureResolutionChoice, captureRateChoice;
+ std::wstring captureRequestedResolution;
+ int captureAudioChoice = source::kCaptureAudioDisabled;
+ bool captureAudioMissing = false;
+ unsigned captureColor = 0;
+ double captureFps = 0;
+ QString captureStatus;
+ ui::CapturePreferences capturePrefs;
+ // --- PS5 Remote Play ---
+ QVariantMap ps5Form;
+ QString ps5Status;
+ std::wstring ps5Profile; // file name inside profileDirectory()
+ QVariantList ps5ProfileList;
+ uint64_t psnLoginStarted = 0;
+ bool ps5Watching = false;
+ struct Ps5Outcome { std::wstring message; std::vector<std::pair<std::string, std::string>> hosts; std::wstring savedPath; std::string account; bool refreshProfiles = false; };
+ std::mutex ps5Mutex;
+ Ps5Outcome ps5Outcome;
+ std::atomic<bool> ps5Done{false};
+ bool ps5Busy = false;
+ QTimer* controllerTimer = nullptr;
+ // PS5 手柄控制 (capture card dialog).
+ QTimer* ps5ControlTimer = nullptr;
+ QVariantMap ps5ControlState;
+ std::wstring ps5ControlProfile; // pairing (or test host) the session was started with
+ QString ps5ControlNoticed; // state the last notice was shown for
+ int ps5ControlTicks = 0;
+ bool ps5ControlNoPair = false; // switched on without a pairing; cleared once pairings exist
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ remoteplay::ControllerInput controller;
+ // One SDL pad reader shared by PS5 stream, PS5 手柄控制, PC and Xbox streaming.
+ // Each user acquires it and only the last release stops it, so the timer of a
+ // source that just ended never cuts off the pad the next source started using.
+ enum PadUser : unsigned { PadPs5 = 1, PadPs5Control = 2, PadMoonlight = 4, PadXbox = 8 };
+ unsigned padUsers = 0;
+ bool acquirePad(unsigned user) {
+ const bool ok = controller.start(); // no-op once initialized
+ padUsers |= user;
+ controller.setFollowLastPressed((padUsers & PadPs5Control) != 0);
+ return ok;
+ }
+ void releasePad(unsigned user) {
+ padUsers &= ~user;
+ if (!padUsers) controller.stop();
+ else controller.setFollowLastPressed((padUsers & PadPs5Control) != 0);
+ }
+#endif
+ std::jthread ps5Worker; // last: joined before what it touches
+ // --- screen capture ---
+ std::vector<source::ScreenCaptureTarget> screenList;
+ bool screenFillActive = false;
+ QSize screenFitClient, screenFitImage;
+ double screenFitAspect = -1;
+ // --- image batch ---
+ QStringList imageFiles;
+ QString imageFolder, imageTarget, imageStatus;
+ int imageIndex = -1, imageDone = 0, imageFailures = 0, imageWaits = 0;
+ uint64_t imageSession = 0;
+ enum class ImagePhase { Idle, Opening, Saving } imagePhase = ImagePhase::Idle;
+ sink::ActiveRenderEndpoint audioActive;
+ int audioPollTicks = 0;
+ // --- protection drawing (#8) ---
+ QString protDraw; // "" | rect | ellipse
+ HWND protOverlay = nullptr;
+ // --- performance orbs / status light (#13) ---
+ ui::live_status::DashboardHistory history;
+ int historyTicks = 0;
+ QString runStatus, runLevel, runDetail;
+ QStringList runOptions;
+ double effectiveOutputFps=-1;
+ // FG output hint for the 倍率 row; 可变刷新 level (gfx::vrrLevel) of the
+ // presenting monitor, or of the main window's monitor while idle.
+ QString fgDisplayHint;
+ int vrrState=0;
+ // The shown monitor's Windows HDR (-1 unknown) and refresh rate.
+ int displayHdr=-1;double displayRefreshHz=0;
+ // 刷新显示器状态: the display generation it asked for, until the shown monitor
+ // answers (displayChecking also covers any query in flight).
+ bool displayChecking=false,displayRecheckPending=false,displayChanged=false;
+ uint64_t displayRecheckGeneration=0;
+ std::chrono::steady_clock::time_point displayRecheckSince{};
+ DisplayChangeFilter displayChangeFilter;
+ std::atomic<double> gpuUtil{-1.0};
+ // Hardware adapters in Windows' high-performance order (discrete first). The
+ // sampler only counts engines of the adapter whose LUID is in gpuMonitorLuid
+ // (0: every adapter, the old behaviour, used only when none was found).
+ struct GpuAdapter { QString id, name; uint32_t luidHigh = 0, luidLow = 0; };
+ std::vector<GpuAdapter> gpuAdapters;
+ std::atomic<uint64_t> gpuMonitorLuid{0};
+ QString gpuMonitorName;
+ // LUIDs that have "GPU Engine" counter instances. DXGI can list one physical GPU
+ // twice (a virtual display driver such as GameViewer's exposes a second adapter
+ // with the GPU's own name); only the real one has engines to measure.
+ static std::set<uint64_t> gpuEngineLuids() {
+ std::set<uint64_t> found;
+ DWORD counterBytes = 0, instanceBytes = 0;
+ if (PdhEnumObjectItemsW(nullptr, nullptr, L"GPU Engine", nullptr, &counterBytes, nullptr, &instanceBytes, PERF_DETAIL_WIZARD, 0) != PDH_MORE_DATA)
+ return found;
+ std::vector<wchar_t> counters(counterBytes + 1), instances(instanceBytes + 1);
+ if (PdhEnumObjectItemsW(nullptr, nullptr, L"GPU Engine", counters.data(), &counterBytes, instances.data(), &instanceBytes, PERF_DETAIL_WIZARD, 0) != ERROR_SUCCESS)
+ return found;
+ for (const wchar_t* name = instances.data(); *name; name += wcslen(name) + 1) {
+ unsigned high = 0, low = 0;
+ if (const wchar_t* at = wcsstr(name, L"luid_"); at && swscanf_s(at, L"luid_0x%x_0x%x", &high, &low) == 2)
+ found.insert(uint64_t(high) << 32 | low);
+ }
+ return found;
+ }
+ void enumerateGpuAdapters() {
+ const auto measured = gpuEngineLuids();
+ Microsoft::WRL::ComPtr<IDXGIFactory6> factory;
+ if (FAILED(CreateDXGIFactory2(0, IID_PPV_ARGS(&factory)))) return;
+ Microsoft::WRL::ComPtr<IDXGIAdapter1> adapter;
+ for (UINT i = 0; SUCCEEDED(factory->EnumAdapterByGpuPreference(i, DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE, IID_PPV_ARGS(adapter.ReleaseAndGetAddressOf()))); ++i) {
+ DXGI_ADAPTER_DESC1 d{};
+ if (FAILED(adapter->GetDesc1(&d)) || (d.Flags & DXGI_ADAPTER_FLAG_SOFTWARE) || d.VendorId == 0x1414) continue;
+ const uint64_t luid = uint64_t(uint32_t(d.AdapterLuid.HighPart)) << 32 | d.AdapterLuid.LowPart;
+ if (!measured.empty() && !measured.count(luid)) {
+ veyra::log::info("perf", std::format("gpu adapter skipped (no engine counters) luid={:08X}:{:08X} {}", uint32_t(luid >> 32), uint32_t(luid),
+ QString::fromWCharArray(d.Description).toStdString()));
+ continue;
+ }
+ // LUIDs change at every boot, so the saved choice is vendor:device:subsystem,
+ // with an ordinal for two identical cards.
+ QString id = QStringLiteral("%1:%2:%3").arg(d.VendorId, 4, 16, QLatin1Char('0')).arg(d.DeviceId, 4, 16, QLatin1Char('0')).arg(d.SubSysId, 8, 16, QLatin1Char('0'));
+ int same = 0;
+ for (const auto& a : gpuAdapters) if (a.id.section('#', 0, 0) == id) ++same;
+ if (same) id += QStringLiteral("#%1").arg(same);
+ gpuAdapters.push_back({id, QString::fromWCharArray(d.Description).trimmed(), uint32_t(d.AdapterLuid.HighPart), d.AdapterLuid.LowPart});
+ veyra::log::info("perf", std::format("gpu adapter {} id={} luid={:08X}:{:08X} dedicatedMiB={}", gpuAdapters.size() - 1,
+ id.toStdString(), uint32_t(d.AdapterLuid.HighPart), d.AdapterLuid.LowPart, d.DedicatedVideoMemory >> 20));
+ }
+ }
+ // 游戏模式: the native side, the capture it belongs to and what the UI reported.
+ ui::GamePassthrough game;
+ std::wstring gameModeUri; // the screen URI startScreenCapture opened in game mode
+ uint64_t gameModeSessionId = 0; // its engine session once the open ran
+ bool gameModeLive = false, gamePanelOpen = false, gameRefused = false;
+ bool gameModeShown = false, passthroughShown = false, gameInputShown = false;
+ QRectF gameVideoRect;
+ QPointer<QWindow> gameWindow;
+ HMONITOR gameMonitor = nullptr;
+ // The monitored GPU also computes when 设置 -> "同时用这块显卡运算" is on
+ // and a specific GPU (not 自动) is chosen; otherwise the default order.
+ QString computeGpuName;
+ uint64_t computeLuid = 0;
+ void applyComputeGpu() {
+ const QString wanted = prefString("monitorGpu");
+ const GpuAdapter* chosen = nullptr;
+ for (const auto& a : gpuAdapters) if (!wanted.isEmpty() && a.id == wanted) chosen = &a;
+ const bool follow = prefBool("computeOnMonitorGpu", false) && chosen;
+ computeLuid = follow ? (uint64_t(chosen->luidHigh) << 32 | chosen->luidLow) : 0;
+ computeGpuName = follow ? chosen->name : QString();
+ gfx::setPreferredAdapterLuid(computeLuid);
+ veyra::log::info("perf", std::format("compute gpu follow={} wanted={} using={}", follow, wanted.isEmpty() ? "auto" : wanted.toStdString(),
+ follow ? chosen->name.toStdString() : "default order (highest-performance adapter)"));
+ }
+ void resolveGpuMonitor() {
+ const QString wanted = prefString("monitorGpu");
+ const GpuAdapter* chosen = gpuAdapters.empty() ? nullptr : &gpuAdapters.front();
+ for (const auto& a : gpuAdapters) if (!wanted.isEmpty() && a.id == wanted) chosen = &a;
+ gpuMonitorLuid = chosen ? (uint64_t(chosen->luidHigh) << 32 | chosen->luidLow) : 0;
+ gpuMonitorName = chosen ? chosen->name : QString();
+ veyra::log::info("perf", std::format("gpu monitor wanted={} using={}", wanted.isEmpty() ? "auto" : wanted.toStdString(),
+ chosen ? chosen->name.toStdString() : "all adapters"));
+ }
+ double gpuPublished = -2.0;
+ double rateRatio = -1.0;
+ std::deque<double> frameTimes; // frame interval ms, newest last
+ // --- design gap: presentation, compare, aspect ---
+ engine::PresentationSettings presentation;
+ int compareMode = 0;
+ bool compareBase = false;
+ double compareSplit = 0.5;
+ int aspectMode = 0, aspectApplied = 0;
+ uint64_t aspectSession = 0;
+ std::jthread gpuSampler; // joined before gpuUtil goes away
+ std::filesystem::path prefsFile() const { return dataDir / L"qml-preferences.v1.json"; }
+ void loadPrefs() {
+ QFile file(QString::fromStdWString(prefsFile().wstring()));
+ if (!file.exists()) return;
+ if (!file.open(QIODevice::ReadOnly)) { veyra::log::warn("ui-prefs", "qml preferences unreadable; defaults used"); return; }
+ QJsonParseError error{};
+ const auto doc = QJsonDocument::fromJson(file.readAll(), &error);
+ if (error.error != QJsonParseError::NoError || !doc.isObject()) {
+ veyra::log::warn("ui-prefs", "qml preferences damaged; defaults used, file kept");
+ return;
+ }
+ prefs = doc.object().toVariantMap();
+ }
+ bool savePrefs() {
+ const QString path = QString::fromStdWString(prefsFile().wstring());
+ // A fresh data directory may not exist yet: the first preference saved
+ // on a new profile used to fail and was silently kept only in memory.
+ std::error_code ec;
+ std::filesystem::create_directories(prefsFile().parent_path(), ec);
+ if(ec)return false;
+ QSaveFile file(path);
+ if (!file.open(QIODevice::WriteOnly)) return false;
+ const auto bytes = QJsonDocument(QJsonObject::fromVariantMap(prefs)).toJson(QJsonDocument::Indented);
+ if (file.write(bytes) != bytes.size()) return false;
+ return file.commit();
+ }
+ int prefInt(const char* key, int fallback) const { return prefs.contains(key) ? prefs.value(key).toInt() : fallback; }
+ bool prefBool(const char* key, bool fallback) const { return prefs.contains(key) ? prefs.value(key).toBool() : fallback; }
+ QString prefString(const char* key) const { return prefs.value(key).toString(); }
+ void restoreCaptureForm() {
+ captureFps=capturePrefs.requestedFps;
+ captureColor=capturePrefs.colorForDevice(captureDevice);
+ captureAudioChoice=source::kCaptureAudioDisabled;
+ captureAudioMissing=false;
+ if(capturePrefs.audioMode==source::kCaptureAudioFromVideoDevice)captureAudioChoice=source::kCaptureAudioFromVideoDevice;
+ else if(!capturePrefs.audioPath.empty()){
+ captureAudioMissing=true;
+ for(size_t k=0;k<captureAudio.size();++k)
+ if(captureAudio[k].path==capturePrefs.audioPath&&captureAudio[k].wasapi==(capturePrefs.audioMode==source::kCaptureAudioWasapi)){
+ captureAudioChoice=int(k);captureAudioMissing=false;break;
+ }
+ }
+ }
+ bool persistCaptureSelection(bool explicitFormat = false) {
+ if(captureDevice.empty())return true; // Disconnecting a card must retain it.
+ const bool sameDevice=capturePrefs.videoPath==captureDevice;
+ capturePrefs.videoPath=captureDevice;
+ // An unavailable saved type has no active selection. Editing another
+ // control must retain its key until the user explicitly picks a new type.
+ if(explicitFormat||!captureFormatKey.empty()||!sameDevice)capturePrefs.formatKey=captureFormatKey;
+ if(explicitFormat){
+ // A partial form is a deliberate choice too. Keep it without
+ // upgrading capture-preferences.v1 or inventing a concrete format.
+ prefs["captureDraftDevice"]=utf8Of(captureDevice);
+ prefs["captureDraftResolution"]=utf8Of(captureResolutionChoice);
+ prefs["captureDraftRate"]=utf8Of(captureRateChoice);
+ if(!savePrefs())return false;
+ }
+ capturePrefs.colorOverride=captureColor;capturePrefs.requestedFps=captureFps;
+ if(capturePrefs.deviceColors.size()<128||capturePrefs.deviceColors.contains(captureDevice))capturePrefs.deviceColors[captureDevice]=captureColor;
+ if(!captureAudioMissing){
+ const auto* audio=captureAudioChoice>=0&&size_t(captureAudioChoice)<captureAudio.size()?&captureAudio[size_t(captureAudioChoice)]:nullptr;
+ capturePrefs.audioPath=audio?audio->path:std::wstring{};
+ capturePrefs.audioMode=audio?(audio->wasapi?source::kCaptureAudioWasapi:0):captureAudioChoice;
+ }
+ if(ui::CapturePreferenceStore(dataDir).save(capturePrefs))return true;
+ veyra::log::error("capture-ui","capture settings could not be saved");return false;
+ }
+ Impl(engine::EngineController& e, std::filesystem::path dataDirectory)
+ : engine(e), facade(e, dataDirectory),
+ dataDir(dataDirectory.empty() ? runtime::localDataDirectory() : dataDirectory) {
+ if (!dataDirectory.empty()) anchorsFile = dataDirectory / L"node-anchors.json";
+ if (!anchorsFile.empty()) {
+ QFile file(QString::fromStdWString(anchorsFile.wstring()));
+ if (file.open(QIODevice::ReadOnly)) anchors = QJsonDocument::fromJson(file.readAll()).object().toVariantMap();
+ }
+ // Same high-performance DXGI ordering as the engine. This only seeds a
+ // fresh session; loading saved settings below preserves manual choices.
+ gfx::ComPtr<IDXGIFactory6> factory;
+ if(SUCCEEDED(CreateDXGIFactory2(0,IID_PPV_ARGS(&factory)))) {
+ gfx::ComPtr<IDXGIAdapter1> adapter;
+ for(UINT i=0;SUCCEEDED(factory->EnumAdapterByGpuPreference(i,DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE,IID_PPV_ARGS(&adapter)));++i) {
+ DXGI_ADAPTER_DESC1 desc{};
+ if(FAILED(adapter->GetDesc1(&desc))||(desc.Flags&DXGI_ADAPTER_FLAG_SOFTWARE))continue;
+ auto initial=facade.pendingSettings();
+ initial.nrRuntime=desc.VendorId==0x1002?engine::NrRuntime::LmxxfAmd:engine::NrRuntime::Ampere;
+ if(desc.VendorId==0x1002||desc.VendorId==0x8086){
+ initial.opticalFlowBackend=engine::OpticalFlowBackend::AmdFidelityFx;
+ initial.videoSrQuality=engine::kVideoSrFsr;
+ }
+ initial.frameGenerationBackend=engine::defaultFrameGenerationBackend(desc.VendorId);
+ facade.setPending(initial);
+ veyra::log::info("nr-default",std::format("adapter={} selected={}",utf8Of(std::wstring(desc.Description)).toStdString(),engine::nrRuntimeName(initial.nrRuntime)));
+ break;
+ }
+ }
+ chain = engine::toChain(facade.pendingSettings());
+ acceptedChain = chain;
+ draftGlobals = engine::ChainGlobalSettings::capture(facade.pendingSettings());
+ session = engine::ChainSession::initial(facade.pendingSettings());
+ savedSession = session;
+ validation = engine::validateChain(chain);
+ options = engine::PlayerOptions::from(facade.pendingSettings());
+ }
+
+ std::optional<engine::EnhancementSettings> exportSettings(QString& error) const {
+ if (chain.mode == engine::ChainMode::Node) {
+ error = QObject::tr("节点链尚未接入导出执行器,请切换列表模式后导出");
+ return std::nullopt;
+ }
+ auto settings = facade.pendingSettings();
+ engine::fromChain(chain, settings);
+ if (!exportPresetName.empty()) {
+ const auto& entries = facade.presets().entries();
+ const auto preset = std::find_if(entries.begin(), entries.end(), [this](const auto& entry) {
+ return entry.name == exportPresetName;
+ });
+ if (preset == entries.end()) {
+ error = QObject::tr("导出预设已不存在,请重新选择");
+ return std::nullopt;
+ }
+ if (preset->kind != engine::ChainMode::List) {
+ error = QObject::tr("节点预设尚未接入导出执行器");
+ return std::nullopt;
+ }
+ engine::PresetLibrary::apply(*preset, settings);
+ }
+ settings.exportBitrateMbps = exportBitrateMbps;
+ if (exportResolutionIndex >= 0) {
+ settings.sr = exportResolutionIndex != 0;
+ if (settings.sr) {
+ switch (exportResolutionIndex) {
+ case 1: settings.srTarget = pipeline::SrTarget::Qhd; break;
+ case 2: settings.srTarget = pipeline::SrTarget::Uhd4K; break;
+ case 3: settings.srTarget = pipeline::SrTarget::Uhd8K; break;
+ case 4: settings.srTarget = pipeline::SrTarget::Uhd5K; break;
+ case 5: settings.srTarget = pipeline::SrTarget::Uhd6K; break;
+ case 6: settings.srTarget = pipeline::SrTarget::Uhd7K; break;
+ default: break;
+ }
+ }
+ }
+ if (exportRateControl != sink::ExportRateControl::Cq && !exportBitrateMbps) {
+ error = QObject::tr("CBR/VBR 需要指定码率");
+ return std::nullopt;
+ }
+ if (const auto why = settings.validate(); !why.empty()) {
+ veyra::log::warn("export-settings", std::format("invalid: {} bitrateMbps={}", why, settings.exportBitrateMbps));
+ error = QObject::tr("导出设置无效:%1").arg(utf8Of(why));
+ return std::nullopt;
+ }
+ if (const auto why = unavailableEffects(settings); !why.isEmpty()) {
+ error = QObject::tr("导出设置无效:%1").arg(why);
+ return std::nullopt;
+ }
+ if(settings.multiplier>1&&engine::presentSinkFrameGeneration(settings.frameGenerationBackend)){
+ error=QObject::tr("XeSS 尚未提供可编码的补帧纹理,请为导出选择 FSR、DLSS 或 VFG 补帧");
+ return std::nullopt;
+ }
+ return settings;
+ }
+
+ engine::ChainSession currentSession() const {
+ auto current = session;
+ current.active = chain.mode;
+ current.initialized[size_t(chain.mode)] = true;
+ current.configurations[size_t(chain.mode)] = engine::ChainConfiguration::capture(
+ activeRuntime(), facade.pendingSettings(), nrIndex(), colourIndex());
+ // Custom: the static HDR output tuning does not travel through the runtime
+ // configuration yet, so take it straight from the draft globals at the point
+ // the session is built. Without this the values took effect and then came
+ // back as defaults on the next start.
+ current.configurations[size_t(chain.mode)].hdrCurve = draftGlobals.hdrCurve;
+ current.configurations[size_t(chain.mode)].hdrMetadata = draftGlobals.hdrMetadata;
+ if (chain.mode == engine::ChainMode::Node) {
+ auto document = std::make_shared<engine::NodeEditorDocument>();
+ document->nodes = chain; document->layout = layout; document->globals = draftGlobals;
+ current.configurations[size_t(chain.mode)].editor = std::move(document);
+ }
+ return current;
+ }
+
+ bool persistSession() {
+ const auto current = currentSession();
+ if (current == savedSession) return true;
+ if (!facade.saveChainSession(current)) return false;
+ session = savedSession = current;
+ return true;
+ }
+
+ bool poll() {
+ const auto before=facade.pendingSettings();
+ auto frame = facade.poll();
+ const auto restored=facade.pendingSettings();
+ const bool fgRollback=before.frameGenerationBackend!=restored.frameGenerationBackend||before.multiplier!=restored.multiplier||before.vfgQuality!=restored.vfgQuality;
+ const bool nrRollback=before.nrRuntime!=restored.nrRuntime;
+ if(nrRollback) {
+ for(auto* c:{&chain,&acceptedChain})for(uint32_t i=0;i<c->nodeCount;++i)
+ if(c->nodes[i].type==engine::EffectType::NrEnhance)c->nodes[i].nr.runtime=restored.nrRuntime;
+ }
+ if(fgRollback){
+ const auto restoreFg=[&](engine::EffectChain& value){
+ if(restored.multiplier>1)value.fgMultiplier=restored.multiplier;
+ for(uint32_t i=0;i<value.nodeCount;++i)
+ if(value.nodes[i].type==engine::EffectType::FrameGeneration)value.nodes[i].enabled=restored.multiplier>1;
+ };
+ restoreFg(chain);restoreFg(acceptedChain);
+ if(draftGlobals.fgBackend==before.frameGenerationBackend)draftGlobals.fgBackend=restored.frameGenerationBackend;
+ if(draftGlobals.vfgQuality==before.vfgQuality)draftGlobals.vfgQuality=restored.vfgQuality;
+ options=engine::PlayerOptions::from(restored,engine::runtimeOrder(acceptedChain));
+ }
+ if (!frame.changed && haveSnapshot) return fgRollback||nrRollback;
+ snapshot = frame.snapshot;
+ publishedRevision = frame.revision;
+ haveSnapshot = true;
+ if (openingSource && openingSessionId != 0 && snapshot.sessionId == openingSessionId &&
+ (snapshot.running || snapshot.image || snapshot.failed ||
+ snapshot.transport == engine::TransportState::Empty ||
+ snapshot.transport == engine::TransportState::Stopping))
+ openingSource = false;
+ return fgRollback||nrRollback;
+ }
+
+ // The chain is the source of truth for the stage settings; every commit
+ // writes it back over the struct so the two can never disagree.
+ bool commit(engine::EnhancementSettings settings) {
+ // Custom: the static HDR output tuning belongs to neither transaction, so
+ // keep the draft globals in sync in BOTH modes. Only the node branch below
+ // refreshed them, which is why a change made in list mode took effect and
+ // then came back as a default after a restart (the session capture reads the
+ // tuning from the draft globals).
+ draftGlobals.hdrCurve = settings.hdrCurve;
+ draftGlobals.hdrMetadata = settings.hdrMetadata;
+ if (chain.mode == engine::ChainMode::Node) {
+ const auto previous = facade.pendingSettings();
+ const auto oldGlobals = draftGlobals;
+ draftGlobals = engine::ChainGlobalSettings::capture(settings);
+ // Non-node controls (e.g. audio) may still change while a wire is
+ // incomplete. Keep runtime globals separate from that transaction.
+ // Custom: HDR brightness is one of those controls - it is not part of a
+ // node edit, so the restore below must not put the previous value back
+ // (field report: a new target peak took effect and then reverted on the
+ // next start, because this line overwrote it before the session was
+ // captured).
+ facade.setPending(settings);
+ if (revalidate(true, &previous)) return true;
+ draftGlobals = oldGlobals; facade.setPending(previous);
+ revalidate();
+ return false;
+ }
+ const auto& runtime = activeRuntime();
+ engine::fromChain(runtime, settings);
+ if (const auto reason = unavailableEffects(settings); !reason.isEmpty()) {
+ veyra::log::warn("effect-availability", reason.toStdString());
+ return false;
+ }
+ if(!facade.applySettings(settings,engine::runtimeOrder(runtime)))return false;
+ options = engine::PlayerOptions::from(settings,engine::runtimeOrder(runtime));
+ return true;
+ }
+
+ bool revalidate(bool apply=false, const engine::EnhancementSettings* prior=nullptr) {
+ auto projected = std::make_unique<engine::EffectChain>(chain);
+ bool incomplete = false;
+ if (chain.mode == engine::ChainMode::Node) {
+ validation = layout.validate(chain);
+ if (!validation.accepted) return false;
+ // Even detached controls must obey the persistent parameter contract.
+ auto check = std::make_unique<engine::ChainConfiguration>(
+ engine::ChainConfiguration::capture(acceptedChain, facade.pendingSettings()));
+ auto document = std::make_shared<engine::NodeEditorDocument>();
+ document->nodes = chain; document->layout = layout; document->globals = draftGlobals; check->editor = document;
+ if (!check->valid()) { validation = {false, "节点参数无效,未提交"}; return false; }
+ validation = layout.project(chain, *projected);
+ if (!validation.accepted) {
+ uint32_t end = layout.inputNext;
+ while (end > engine::NodeGraphLayout::Output)
+ end = layout.next[size_t(layout.indexOf(chain, end))];
+ // Incomplete wires are editable/savable. A complete but illegal
+ // path is rejected atomically by the caller, never auto-sorted.
+ if (end != engine::NodeGraphLayout::Input) return false;
+ *projected = acceptedChain; incomplete = true;
+ }
+ } else validation = engine::validateChain(chain);
+ if(!validation.accepted && !incomplete)return false;
+ const auto previous = prior ? *prior : facade.pendingSettings();
+ auto s = facade.pendingSettings();
+ if (chain.mode == engine::ChainMode::Node && !incomplete) {
+ draftGlobals.apply(s);
+ // A detached singleton owns editable values, not live resources.
+ if (!projected->firstOf(engine::EffectType::SuperResolution)) {
+ s.srTarget = previous.srTarget; s.videoSrQuality = previous.videoSrQuality;
+ s.dlssSrModel = previous.dlssSrModel;
+ }
+ if (!projected->firstOf(engine::EffectType::FrameGeneration)){
+ s.frameGenerationBackend = previous.frameGenerationBackend;
+ s.vfgQuality = previous.vfgQuality;
+ }
+ }
+ engine::fromChain(*projected, s);
+ if(const auto error=s.validate();!error.empty()){
+ veyra::log::error("qml-settings",error);
+ validation={false,"效果参数无效,未提交;详见诊断日志"};return false;
+ }
+ const auto order = engine::runtimeOrder(*projected);
+ const bool changed = s != previous || order != engine::runtimeOrder(acceptedChain);
+ if (apply && changed) {
+ if (const auto reason = unavailableEffects(s); !reason.isEmpty()) {
+ validation = {false, "当前硬件或包不支持所选效果,请查看组件页"};
+ veyra::log::warn("effect-availability", reason.toStdString());
+ return false;
+ }
+ }
+ if(apply && changed && !facade.applySettings(s,order)){
+ facade.setPending(previous);
+ validation={false,"引擎未接受设置,已保留原状态"};
+ return false;
+ }
+ if(!apply || !changed)facade.setPending(s);
+ acceptedChain = *projected;
+ options = engine::PlayerOptions::from(s,order);
+ return true;
+ }
+#ifdef VEYRA_ENABLE_MOONLIGHT
+ // --- PC streaming (Moonlight). Last, so they are destroyed first: the model joins its workers.
+ QTimer* moonlightTimer = nullptr;
+ bool moonlightWantCapture = false, moonlightStatsVisible = false, moonlightWasActive = false;
+ int moonlightStatsTicks = 0;
+ std::unique_ptr<ui::MoonlightInputCapture> moonlightCapture;
+ std::unique_ptr<ui::MoonlightModel> moonlight;
+#endif
+#ifdef VEYRA_ENABLE_XBOX
+ QTimer* xboxTimer = nullptr;
+ bool xboxWasActive = false;
+ int xboxStatsTicks = 0;
+ std::unique_ptr<ui::XboxModel> xbox; // last: joins its worker first
+#endif
+};
+
+
+uint32_t primaryGpuVendor();
+bool fsr4Possible();
+const DXGI_ADAPTER_DESC1* engineAdapterDesc();
+bool vfgHardwarePossible();
+unsigned normalizeFgMultiplier(unsigned value, engine::FrameGenerationBackend backend, unsigned cap);
+QString fgEffectId(engine::FrameGenerationBackend backend);
+int xessCeiling(const engine::PlayerSnapshot& snapshot);
+void ensureGdiplus();
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Capture.cpp b/src/ui/bridge/Capture.cpp
new file mode 100644
index 00000000..19175a74
--- /dev/null
+++ b/src/ui/bridge/Capture.cpp
@@ -0,0 +1,705 @@
+// QML bridge: Capture responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- capture dialog ----------------------------------------------------------
+static QString captureDeviceUiLabel(const source::CaptureDevice& device) {
+ return source::decklink::isPath(device.path)
+ ? uiText(device.name).replace(QStringLiteral("跟随驱动输入"), uiText(L"跟随驱动输入")) : utf8Of(device.name);
+}
+QVariantList QmlPlayerBridge::captureDevices() const {
+ // The source's own enumeration (asynchronous, see refreshCaptureDevices). An
+ // empty list means the machine reports no capture devices.
+ QVariantList out;
+ for (const auto& d : impl_->captureVideo) {
+ const bool native=source::decklink::isPath(d.path);
+ const bool enabled=impl_->prefBool("blackmagicNativeCapture",false);
+ if(native&&!enabled)continue;
+ if(!native&&enabled&&source::isBlackmagicCaptureDevice(d.name,d.path))continue;
+ out << QVariantMap{{"id", utf8Of(d.path)}, {"label", captureDeviceUiLabel(d)}, {"embeddedAudio", d.hasEmbeddedAudio}};
+ }
+ return out;
+}
+QString QmlPlayerBridge::captureDeviceId() const { return utf8Of(impl_->captureDevice); }
+void QmlPlayerBridge::setCaptureDeviceId(const QString& value) {
+ if (impl_->captureDriverSettingsOpen) return;
+ if (impl_->captureDevice == wideOf(value)) return;
+ impl_->captureDevice = wideOf(value);
+ impl_->captureFormatList.clear();++impl_->captureFormatGeneration;
+ impl_->captureResolutionChoice.clear();impl_->captureRateChoice.clear();
+ impl_->captureRequestedResolution.clear();
+ impl_->captureFormatKey=impl_->captureDevice==impl_->capturePrefs.videoPath?impl_->capturePrefs.formatKey:std::wstring{};
+ impl_->captureDriverFormatKey.clear();
+ // Colour follows the device, as in 1.4.4; audio returns to "none" unless it
+ // is the remembered device.
+ impl_->captureColor = impl_->capturePrefs.colorForDevice(impl_->captureDevice);
+ if(impl_->captureDevice==impl_->capturePrefs.videoPath)impl_->restoreCaptureForm();
+ else {impl_->captureAudioChoice=source::kCaptureAudioDisabled;impl_->captureAudioMissing=false;}
+ if(!impl_->persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ if (!impl_->captureDevice.empty()) queryCapture(1, impl_->captureDevice);
+ emit captureChanged();
+}
+QString QmlPlayerBridge::captureDeviceLabel() const {
+ for (const auto& d : impl_->captureVideo) if (d.path == impl_->captureDevice) return captureDeviceUiLabel(d);
+ return impl_->captureDevice.empty() ? tr("未选择设备") : tr("设备未连接");
+}
+static QString captureFormatUiLabel(const source::CaptureFormat& f, const std::wstring& device) {
+ auto label=uiText(f.label);
+ if(source::decklink::isPath(device))label=label.replace(QStringLiteral("逐行"),QmlPlayerBridge::tr("逐行")).replace(QStringLiteral("隔行"),QmlPlayerBridge::tr("隔行"));
+ if(source::captureMjpegFormat(f))label+=uiText(L"(不建议使用)");
+ return label;
+}
+QVariantList QmlPlayerBridge::captureFormats() const {
+ return impl_->captureList(impl_->captureFormatsCache, impl_->captureDevice, {}, [this] {
+ QVariantList out;
+ out.reserve(qsizetype(impl_->captureFormatList.size()));
+ for (const auto& f : impl_->captureFormatList) {
+ out << QVariantMap{{"id", utf8Of(f.key)}, {"label", captureFormatUiLabel(f, impl_->captureDevice)}, {"tier", f.tier},
+ {"costHint", source::captureFormatNeedsCostHint(static_cast<source::CaptureFormatTier>(f.tier))}, {"driverCurrent", f.driverCurrent},
+ {"width", int(f.width)}, {"height", int(f.height)}, {"fps", f.fps}, {"pixel", uiText(f.pixel)},
+ {"scan", uiText(f.scan)}, {"interlaced", f.interlaced}, {"disabled", !f.supported}, {"rangeCandidate", f.rangeCandidate}, {"danger",source::captureMjpegFormat(f)}};
+ }
+ return out;
+ });
+}
+QString QmlPlayerBridge::captureFormatKey() const { return utf8Of(impl_->captureFormatKey); }
+QString QmlPlayerBridge::captureFormatLabel() const {
+ if (impl_->captureFormatKey.empty()) return {};
+ for (const auto& f : impl_->captureFormatList)
+ if (f.key == impl_->captureFormatKey) return captureFormatUiLabel(f, impl_->captureDevice);
+ return {};
+}
+bool QmlPlayerBridge::captureFormatCostHint() const {
+ if (impl_->captureFormatKey.empty()) return false;
+ for (const auto& f : impl_->captureFormatList)
+ if (f.key == impl_->captureFormatKey) return source::captureFormatNeedsCostHint(static_cast<source::CaptureFormatTier>(f.tier));
+ return false;
+}
+void QmlPlayerBridge::setCaptureFormatKey(const QString& key) {
+ const auto* format=source::selectCaptureFormat(impl_->captureFormatList,-1,wideOf(key));
+ if(!format){
+ // Retain the attempted identity as invalid, so a subsequent Connect
+ // cannot silently open the previous selection instead.
+ impl_->captureFormatKey=wideOf(key);
+ impl_->captureStatus=tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。");
+ emit notice(impl_->captureStatus,true);emit captureChanged();return;
+ }
+ if (impl_->captureFormatKey == format->key && impl_->captureResolutionChoice == source::captureResolutionId(*format) && impl_->captureRateChoice == source::captureFrameRateGroupId(*format)) return;
+ impl_->captureResolutionChoice=source::captureResolutionId(*format);
+ impl_->captureRateChoice=source::captureFrameRateGroupId(*format);
+ impl_->captureFormatKey = format->key;
+ impl_->captureStatus.clear();
+ if(!impl_->persistCaptureSelection(true))emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ emit captureChanged();
+}
+namespace {
+QVariantList captureChoiceList(const std::vector<source::CaptureFormatOption>& options) {
+ QVariantList out;
+ for (const auto& option : options)
+ out << QVariantMap{{"id", utf8Of(option.id)}, {"label", uiText(option.label)+(option.discouraged?uiText(L"(不建议使用)"):QString{})}, {"disabled",option.disabled},{"danger",option.discouraged}};
+ return out;
+}
+const source::CaptureFormat* selectedCaptureFormat(const std::vector<source::CaptureFormat>& formats, const std::wstring& key) {
+ return source::selectCaptureFormat(formats, -1, key);
+}
+}
+QVariantList QmlPlayerBridge::captureResolutionOptions() const {
+ return impl_->captureList(impl_->captureResolutionCache, {}, {}, [this] { return captureChoiceList(source::captureResolutionOptions(impl_->captureFormatList)); });
+}
+QString QmlPlayerBridge::captureResolutionId() const {
+ return utf8Of(impl_->captureResolutionChoice);
+}
+void QmlPlayerBridge::setCaptureResolutionId(const QString& id) {
+ QString normalized=id.trimmed().toLower();normalized.remove(QLatin1Char(' '));
+ normalized.replace(QChar(0x00D7),QLatin1Char('x'));
+ const auto wide = wideOf(normalized);
+ if(impl_->captureResolutionChoice==wide)return;
+ const auto* sample=source::captureResolutionSample(impl_->captureFormatList,wide);
+ if(!sample){
+ const auto hint=source::captureResolutionHint(wide);
+ if(hint.width&&hint.height&&!impl_->captureDevice.empty()&&!source::decklink::isPath(impl_->captureDevice)){
+ impl_->captureRequestedResolution=wide;queryCapture(4,impl_->captureDevice);return;
+ }
+ emit notice(tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。"),true);return;
+ }
+ impl_->captureResolutionChoice=wide;
+ if(!source::captureRateSample(impl_->captureFormatList,wide,impl_->captureRateChoice))
+ if(const auto* rate=source::captureDefaultFrameRate(impl_->captureFormatList,wide))impl_->captureRateChoice=source::captureFrameRateGroupId(*rate);
+ impl_->captureFormatKey.clear();
+ if(!impl_->persistCaptureSelection(true))emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ emit captureChanged();
+}
+QVariantList QmlPlayerBridge::captureFrameRateOptions() const {
+ // Common rates only unless 显示全部可用帧率 is on (captureVisibleFrameRates).
+ const bool all = impl_->prefBool("captureShowAllFrameRates", false);
+ return impl_->captureList(impl_->captureRateCache, impl_->captureResolutionChoice, impl_->captureRateChoice + (all ? L"|all" : L""), [this, all] {
+ size_t hidden = 0;
+ const auto rates = source::captureVisibleFrameRates(source::captureFrameRateOptions(impl_->captureFormatList,
+ source::captureResolutionSample(impl_->captureFormatList, impl_->captureResolutionChoice)), impl_->captureRateChoice, all, &hidden);
+ impl_->captureHiddenRates = int(hidden);
+ return captureChoiceList(rates);
+ });
+}
+int QmlPlayerBridge::captureHiddenFrameRates() const {
+ (void)captureFrameRateOptions(); // the count is built with the list
+ return impl_->captureHiddenRates;
+}
+QString QmlPlayerBridge::captureFrameRateId() const {
+ return utf8Of(impl_->captureRateChoice);
+}
+void QmlPlayerBridge::setCaptureFrameRateId(const QString& id) {
+ const auto wide = wideOf(id);
+ if(impl_->captureResolutionChoice.empty()){emit notice(tr("请先选择分辨率"),true);return;}
+ if(impl_->captureRateChoice==wide)return;
+ if(!source::captureRateSample(impl_->captureFormatList,impl_->captureResolutionChoice,wide)){
+ emit notice(tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。"),true);return;
+ }
+ const auto* sample=source::captureRateSample(impl_->captureFormatList,impl_->captureResolutionChoice,wide);
+ impl_->captureRateChoice=source::captureFrameRateGroupId(*sample);impl_->captureFormatKey.clear();
+ if(!impl_->persistCaptureSelection(true))emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ emit captureChanged();
+}
+QVariantList QmlPlayerBridge::capturePixelOptions() const {
+ return impl_->captureList(impl_->capturePixelCache, impl_->captureResolutionChoice, impl_->captureRateChoice, [this] {
+ return captureChoiceList(source::capturePixelOptions(impl_->captureFormatList, source::captureRateSample(impl_->captureFormatList,impl_->captureResolutionChoice,impl_->captureRateChoice)));
+ });
+}
+QString QmlPlayerBridge::capturePixelId() const {
+ const auto* format = source::selectCapturePixelFormat(impl_->captureFormatList,impl_->captureResolutionChoice,impl_->captureRateChoice,impl_->captureFormatKey);
+ return format ? utf8Of(format->key) : QString();
+}
+void QmlPlayerBridge::setCapturePixelId(const QString& id) {
+ const auto key = wideOf(id);
+ if(impl_->captureResolutionChoice.empty()){emit notice(tr("请先选择分辨率"),true);return;}
+ if(!source::selectCapturePixelFormat(impl_->captureFormatList,impl_->captureResolutionChoice,impl_->captureRateChoice,key)){
+ impl_->captureFormatKey=key;
+ impl_->captureStatus=tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。");
+ emit notice(impl_->captureStatus,true);emit captureChanged();return;
+ }
+ setCaptureFormatKey(id);
+}
+QVariantList QmlPlayerBridge::captureAudioInputs() const {
+ // Only what the user picks explicitly is ever opened (1.4.4 rule).
+ QVariantList out{QVariantMap{{"id", source::kCaptureAudioDisabled}, {"label", tr("不监听音频")}}};
+ if(impl_->captureAudioMissing)out<<QVariantMap{{"id",-4},{"label",tr("上次的音频输入未连接")},{"disabled",true}};
+ for (const auto& d : impl_->captureVideo)
+ if (d.path == impl_->captureDevice)
+ out << QVariantMap{{"id", source::kCaptureAudioFromVideoDevice},
+ {"label", d.hasEmbeddedAudio ? tr("视频设备内置音频(已检测)") : tr("尝试视频设备内置音频")}};
+ for (size_t i = 0; i < impl_->captureAudio.size(); ++i)
+ out << QVariantMap{{"id", int(i)}, {"label", QStringLiteral("[%1] %2").arg(impl_->captureAudio[i].wasapi ? QStringLiteral("WASAPI") : QStringLiteral("DirectShow"), utf8Of(impl_->captureAudio[i].name))}};
+ return out;
+}
+int QmlPlayerBridge::captureAudioChoice() const { return impl_->captureAudioMissing?-4:impl_->captureAudioChoice; }
+void QmlPlayerBridge::setCaptureAudioChoice(int choice) {
+ if (choice < source::kCaptureAudioFromVideoDevice || choice >= int(impl_->captureAudio.size())) return;
+ impl_->captureAudioChoice = choice;
+ impl_->captureAudioMissing=false;
+ // Remember the audio choice for this device as soon as it is picked, not only on
+ // 连接并开始 (field report 2026-10-01: picked, closed, and it was gone next time).
+ if(!impl_->persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ emit captureChanged();
+}
+int QmlPlayerBridge::captureColorSpace() const { return int(source::captureColorSpace(impl_->captureColor)); }
+void QmlPlayerBridge::setCaptureColorSpace(int value) {
+ if (value < 0 || value > 3) return;
+ impl_->captureColor = source::captureColorOverride(unsigned(value), source::captureColorRange(impl_->captureColor));
+ if(!impl_->persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ emit captureChanged();
+}
+int QmlPlayerBridge::captureColorRange() const { return int(source::captureColorRange(impl_->captureColor)); }
+void QmlPlayerBridge::setCaptureColorRange(int value) {
+ if (value < 0 || value > 2) return;
+ impl_->captureColor = source::captureColorOverride(source::captureColorSpace(impl_->captureColor), unsigned(value));
+ if(!impl_->persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ emit captureChanged();
+}
+double QmlPlayerBridge::captureRequestedFps() const { return impl_->captureFps; }
+void QmlPlayerBridge::setCaptureRequestedFps(double value) {
+ if (!source::validCaptureFrameRate(value)) { emit notice(tr("采集帧率请输入 1–1000 的数字(可带小数),或 0 沿用设备默认"), true); return; }
+ if (impl_->captureFps == value) return;
+ impl_->captureFps = value;
+ // Saved as soon as it is typed, as the audio choice is (field report 2026-10-01: the
+ // new rate was lost unless another option was changed before closing).
+ if(!impl_->persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ veyra::log::info("capture-ui", std::format("requested fps={}", value));
+ emit captureChanged();
+}
+int QmlPlayerBridge::captureAudioIngress() const { return int(settings().captureAudio); }
+void QmlPlayerBridge::setCaptureAudioIngress(int value) {
+ if (value < 0 || value > 2) return;
+ auto s = settings(); s.captureAudio = static_cast<engine::CaptureAudioIngress>(value);
+ if(impl_->commit(std::move(s))){impl_->prefs["captureAudioIngress"]=value;if(!impl_->savePrefs())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);}
+ emit settingsChanged();
+}
+int QmlPlayerBridge::captureBufferMode() const { return int(settings().captureBuffer); }
+void QmlPlayerBridge::setCaptureBufferMode(int value) {
+ if (value < 0 || value > 2) return;
+ auto s = settings(); s.captureBuffer = static_cast<source::CaptureBufferMode>(value);
+ if(impl_->commit(std::move(s))){impl_->prefs["captureBufferMode"]=value;if(!impl_->savePrefs())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);}
+ emit settingsChanged();
+}
+bool QmlPlayerBridge::captureQueryBusy() const { return impl_->captureBusy || impl_->captureDriverSettingsOpen; }
+QString QmlPlayerBridge::captureStatus() const { return impl_->captureStatus; }
+bool QmlPlayerBridge::captureBlackmagicDevice() const {
+ for (const auto& d : impl_->captureVideo) if (d.path == impl_->captureDevice) return source::decklink::isPath(d.path)||source::isBlackmagicCaptureDevice(d.name, d.path);
+ return false;
+}
+bool QmlPlayerBridge::openCaptureDriverSettings(bool inputSelector) {
+ auto& i = *impl_;
+ if (captureQueryBusy() || i.captureDevice.empty()) { emit notice(tr("请先选择设备并等待查询完成"), true); return false; }
+ if (i.openingSource || (i.snapshot.capture && !i.engine.idle())) { emit notice(tr("请等待连接结束并断开采集,再打开驱动设置"), true); return false; }
+ HWND owner = i.videoWindow ? GetAncestor(i.videoWindow, GA_ROOT) : nullptr;
+ if (!owner) if (auto* window = QGuiApplication::focusWindow()) owner = reinterpret_cast<HWND>(window->winId());
+ i.captureDriverSettingsOpen = true; emit captureChanged();
+ std::wstring error;
+ const bool ok = source::CaptureCardSource::showDeviceProperties(i.captureDevice, reinterpret_cast<uintptr_t>(owner), inputSelector, error, &i.captureDriverFormatKey);
+ i.captureDriverSettingsOpen = false;
+ if (!ok) { i.captureStatus = uiText(error); emit notice(i.captureStatus, true); emit captureChanged(); return false; }
+ // Some property pages change only this filter instance's IAMStreamConfig.
+ // Carry its exact identity to the new graph instead of discarding it.
+ queryCapture(3, i.captureDevice);
+ return true;
+}
+bool QmlPlayerBridge::captureMagewellDevice() const { return source::magewell::isProCaptureDevicePath(impl_->captureDevice); }
+QString QmlPlayerBridge::captureMagewellStatus() const {
+ std::wstring runtime;
+ if (!source::magewell::runtimeAvailable(&runtime))
+ return tr("找不到美乐威运行库 LibMWCapture.dll(应在软件的 runtime\\magewell 文件夹里,或装美乐威驱动/SDK)");
+ return veyra::ui::i18n::text(source::magewell::statusText());
+}
+void QmlPlayerBridge::refreshCaptureDevices() {
+ if (impl_->captureDriverSettingsOpen) return;
+ impl_->capturePrefs = ui::CapturePreferenceStore(impl_->dataDir).load();
+ queryCapture(0, {});
+}
+void QmlPlayerBridge::queryCapture(int kind, std::wstring device) {
+ auto& i = *impl_;
+ if (captureQueryBusy()) { i.captureNextQuery=std::pair{kind,std::move(device)};return; }
+ i.captureBusy = true; i.captureQueryKind = kind;
+ i.captureStatus = kind == 0 ? tr("正在查询采集设备…当前播放继续") : tr("正在读取设备支持的格式…");
+ const auto preferred=kind==2?i.capturePrefs.formatKey:
+ kind==3&&!i.captureDriverFormatKey.empty()?i.captureDriverFormatKey:i.captureFormatKey;
+ const auto requested=kind==4?i.captureRequestedResolution:
+ preferred.empty()&&wideOf(i.prefs.value("captureDraftDevice").toString())==device?
+ wideOf(i.prefs.value("captureDraftResolution").toString()):std::wstring{};
+ i.captureQuery = std::async(std::launch::async, [kind, device, preferred, requested] {
+ Impl::CaptureQuery q; q.kind = kind; q.device = device;q.requestedResolution=requested;
+ const auto initialized=CoInitializeEx(nullptr, COINIT_MULTITHREADED);
+ if(FAILED(initialized)){q.info.code=initialized;q.info.stage=L"COM initialization";return q;}
+ try {
+ if (kind == 0) { q.video = source::CaptureCardSource::deviceDetails(); q.audio = source::CaptureCardSource::deviceDetails(true); }
+ else {
+ if (kind == 2) { q.video = source::CaptureCardSource::deviceDetails(); q.audio = source::CaptureCardSource::deviceDetails(true); }
+ q.formats = source::CaptureCardSource::formatsByPath(device,&q.info,preferred,requested);
+ }
+ } catch (...) {q.info.code=E_FAIL;q.info.stage=L"Capture capability exception";}
+ CoUninitialize();
+ return q;
+ });
+ emit captureChanged();
+}
+void QmlPlayerBridge::tickCapture() {
+ auto& i = *impl_;
+ if (!i.captureBusy || i.captureQuery.wait_for(std::chrono::seconds(0)) != std::future_status::ready) return;
+ auto q = i.captureQuery.get();
+ i.captureBusy = false;
+ if(i.captureNextQuery){auto next=std::move(*i.captureNextQuery);i.captureNextQuery.reset();queryCapture(next.first,std::move(next.second));return;}
+ if(FAILED(q.info.code)&&q.formats.empty()){
+ if(q.kind!=0&&q.device!=i.captureDevice){emit captureChanged();return;}
+ if(q.kind!=0&&q.kind!=4){i.captureFormatList.clear();++i.captureFormatGeneration;i.captureResolutionChoice.clear();i.captureRateChoice.clear();}
+ i.captureStatus=tr("读取采集格式失败:%1(0x%2)。请检查设备占用与驱动后重试。")
+ .arg(utf8Of(q.info.stage),QString::number(quint32(q.info.code),16).rightJustified(8,QLatin1Char('0')));
+ emit notice(i.captureStatus,true);emit captureChanged();return;
+ }
+ if (q.kind == 0 || q.kind == 2) { i.captureVideo = std::move(q.video); i.captureAudio = std::move(q.audio); i.captureListed = true; }
+ // The remembered rate and audio input, matched against the inputs listed now. Both the
+ // panel (kind 0) and 继续上次 (kind 2) need it: the resume path skipped it and connected
+ // without sound until the panel was opened once (field report 2026-10-02).
+ const auto restoreRememberedAudio = [&i] {
+ i.restoreCaptureForm();
+ };
+ if (q.kind == 2 && q.device == i.capturePrefs.videoPath) restoreRememberedAudio();
+ if (q.kind == 0) {
+ veyra::log::info("capture-ui", std::format("devices video={} audio={}", i.captureVideo.size(), i.captureAudio.size()));
+ // Restore the remembered device; otherwise the first one. Never guess audio.
+ std::wstring pick;
+ const auto choices=captureDevices();
+ auto allowed=[&](std::wstring_view path){for(const auto& value:choices)if(wideOf(value.toMap().value("id").toString())==path)return true;return false;};
+ if(allowed(i.capturePrefs.videoPath))pick=i.capturePrefs.videoPath;
+ // The two APIs are separate identities. Restore an explicitly used
+ // endpoint, or select a unique native endpoint; never map by ordinal.
+ const bool native=i.prefBool("blackmagicNativeCapture",false);
+ const auto remembered=wideOf(i.prefs.value(native?"blackmagicNativeLastDevice":"blackmagicDirectShowLastDevice").toString());
+ if(pick.empty()&&allowed(remembered))pick=remembered;
+ if(pick.empty()&&native){std::vector<std::wstring> candidates;for(const auto& d:i.captureVideo)if(source::decklink::isPath(d.path))candidates.push_back(d.path);if(candidates.size()==1)pick=candidates.front();}
+ if (pick.empty() && !choices.empty() && i.capturePrefs.videoPath.empty()&&!native) pick=wideOf(choices.front().toMap().value("id").toString());
+ i.captureStatus = i.captureVideo.empty() ? tr("未找到采集设备。连接后点击刷新。")
+ : pick.empty() ? tr("上次采集设备未连接。插回后刷新,或手动选择其他设备。") : QString();
+ if (!pick.empty()) {
+ i.captureDevice.clear();
+ setCaptureDeviceId(utf8Of(pick));
+ if (pick == i.capturePrefs.videoPath) restoreRememberedAudio();
+ }else{setCaptureDeviceId({});if(native)i.captureStatus=tr("请选择 BMD 原生设备;若列表中没有,请安装 Desktop Video 驱动。多个设备不会自动猜选。");}
+ emit captureChanged();
+ return;
+ }
+ if (q.device != i.captureDevice) { emit captureChanged(); return; } // stale answer
+ if(q.kind==4&&!source::captureResolutionSample(q.formats,q.requestedResolution)){
+ i.captureStatus=tr("驱动未提供该分辨率,或尺寸不符合步进要求;原选择已保留。");
+ emit notice(i.captureStatus,true);emit captureChanged();return;
+ }
+ i.captureFormatList = std::move(q.formats);
+ ++i.captureFormatGeneration;
+ const bool remembered = i.captureDevice == i.capturePrefs.videoPath;
+ const std::wstring driverSelection = i.captureDriverFormatKey.empty() ? i.captureFormatKey : i.captureDriverFormatKey;
+ if (q.kind == 3) i.captureDriverFormatKey.clear();
+ i.captureFormatKey.clear();
+ if (q.kind == 3 && !driverSelection.empty()) {
+ if (const auto* f = source::selectCaptureFormat(i.captureFormatList, -1, driverSelection)) i.captureFormatKey = f->key;
+ } else if (remembered && !i.capturePrefs.formatKey.empty()) {
+ if (const auto* f = source::selectCaptureFormat(i.captureFormatList, -1, i.capturePrefs.formatKey)) i.captureFormatKey = f->key;
+ }
+ i.captureResolutionChoice.clear();i.captureRateChoice.clear();
+ if(const auto* f=selectedCaptureFormat(i.captureFormatList,i.captureFormatKey)){
+ i.captureResolutionChoice=source::captureResolutionId(*f);i.captureRateChoice=source::captureFrameRateGroupId(*f);
+ }else if(remembered&&i.capturePrefs.formatKey.empty()&&wideOf(i.prefs.value("captureDraftDevice").toString())==i.captureDevice){
+ const auto resolution=wideOf(i.prefs.value("captureDraftResolution").toString());
+ const auto rate=wideOf(i.prefs.value("captureDraftRate").toString());
+ if(source::captureResolutionSample(i.captureFormatList,resolution)){
+ i.captureResolutionChoice=resolution;
+ if(const auto* sample=source::captureRateSample(i.captureFormatList,resolution,rate))i.captureRateChoice=source::captureFrameRateGroupId(*sample);
+ }
+ }
+ if(q.kind==4){
+ i.captureResolutionChoice=q.requestedResolution;i.captureFormatKey.clear();
+ if(const auto* rate=source::captureDefaultFrameRate(i.captureFormatList,i.captureResolutionChoice))i.captureRateChoice=source::captureFrameRateGroupId(*rate);
+ if(!i.persistCaptureSelection(true))emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ }
+ if(!i.captureFormatKey.empty()&&!i.persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ i.captureStatus = i.captureFormatList.empty() ? tr("驱动未提供可解析的视频格式,请检查设备与驱动后刷新。")
+ : i.captureFormatKey.empty() ? (!i.capturePrefs.formatKey.empty()?tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。"):tr("先选择分辨率,再选择该分辨率支持的帧率和像素格式"))
+ : q.kind == 3 ? tr("驱动设置已关闭。请核对所选格式与设备帧率,再连接。")
+ : source::decklink::isPath(i.captureDevice) ? tr("原生采集先确认有效信号;请在设备列表选择对应的 HDMI/SDI 输入,支持自动检测的卡建议选择自动。Driver 保留驱动当前输入。")
+ : captureBlackmagicDevice() ? tr("请选择与输入信号一致的格式。驱动默认格式不代表检测到的信号。")
+ : tr("连接后使用当前增强设置。格式与音频变更需要重新连接。");
+ if(q.info.partial)i.captureStatus=tr("部分采集能力读取失败(%1,0x%2);当前列表可能不完整,请刷新重试。")
+ .arg(utf8Of(q.info.stage),QString::number(quint32(q.info.code),16).rightJustified(8,QLatin1Char('0')));
+ veyra::log::info("capture-ui", std::format("formats={} selected={} raw={} rejected={} partial={} fallback={}", i.captureFormatList.size(), !i.captureFormatKey.empty(),q.info.advertised,q.info.rejected,q.info.partial,q.info.fallback));
+ emit captureChanged();
+ if (q.kind == 2) {
+ if (i.captureFormatKey.empty()) emit notice(tr("上次的采集格式不可用,请在采集卡面板重新选择"), true);
+ else startCaptureSession();
+ }
+}
+bool QmlPlayerBridge::startCaptureSession() {
+ auto& i = *impl_;
+ if (captureQueryBusy()) { emit notice(tr("设备查询或驱动设置尚未完成"), true); return false; }
+ int device = -1;
+ for (size_t k = 0; k < i.captureVideo.size(); ++k) if (i.captureVideo[k].path == i.captureDevice) device = int(k);
+ const auto* format = source::selectCapturePixelFormat(i.captureFormatList,i.captureResolutionChoice,i.captureRateChoice,i.captureFormatKey);
+ if(source::decklink::isPath(i.captureDevice)!=i.prefBool("blackmagicNativeCapture",false)&&captureBlackmagicDevice()){
+ emit notice(tr("采集接口已切换,请刷新并重新选择设备和格式"),true);return false;
+ }
+ if(device<0){emit notice(tr("请先选择采集设备和格式"),true);return false;}
+ if(!format){emit notice(i.captureFormatKey.empty()&&i.capturePrefs.formatKey.empty()?tr("请先选择分辨率和像素格式"):tr("此采集卡无此格式,请重新选择分辨率、帧率和像素格式。"),true);return false;}
+ if(!format->supported){emit notice(tr("设备提供此格式,但当前播放器不支持其尺寸或像素布局,请选择其他格式"),true);return false;}
+ if(i.captureAudioMissing){emit notice(tr("上次的音频输入未连接,请插回设备或重新选择音频监听"),true);return false;}
+ const int audio = i.captureAudioChoice;
+ const source::CaptureDevice* audioDevice = audio >= 0 && size_t(audio) < i.captureAudio.size() ? &i.captureAudio[size_t(audio)] : nullptr;
+ const auto path = source::CaptureCardSource::makeCapturePath(unsigned(device), i.captureVideo[size_t(device)], format->index, audio,
+ audioDevice, i.captureColor, i.captureFps, format->key);
+ if (path.empty()) { emit notice(tr("无法生成采集连接参数"), true); return false; }
+ if(!i.persistCaptureSelection())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);
+ i.facade.noteCaptureSession({i.captureDevice, format->key, i.facade.presets().entries().empty() ? std::wstring{} : wideOf(currentPresetName()),
+ i.captureFps > 0 ? i.captureFps : format->fps, true});
+ veyra::log::info("capture-ui", std::format("connect format={} audio={} color={} fps={}", QString::fromStdWString(format->label).toStdString(), audio, i.captureColor, i.captureFps));
+ i.prefs["captureDeviceName"] = utf8Of(i.captureVideo[size_t(device)].name);
+ if(captureBlackmagicDevice())i.prefs[source::decklink::isPath(i.captureDevice)?"blackmagicNativeLastDevice":"blackmagicDirectShowLastDevice"]=utf8Of(i.captureDevice);
+ rememberSource(QStringLiteral("capture"), utf8Of(i.captureVideo[size_t(device)].name));
+ i.prefs["captureFormatLabel"] = utf8Of(format->label);
+ i.savePrefs();
+ // Started beside the capture open, not after it. A running PS5 stream still
+ // holds the console's slot until the capture replaces it; the tick starts
+ // PS5 手柄控制 once the capture card is live instead.
+ if (i.prefBool("ps5CaptureControl", false) && !i.snapshot.remotePlay) startPs5Control(false);
+ openSourceUri(path, i.captureVideo[size_t(device)].name);
+ emit snapshotChanged();
+ return true;
+}
+void QmlPlayerBridge::openSourceUri(const std::wstring& uri, const std::wstring& label, bool screenFill) {
+ rememberPosition(true);
+ impl_->openingSource = true;
+ impl_->openingSessionId = 0;
+ impl_->sourceLabel = label;
+ impl_->resumeSession = 0;
+ impl_->screenFillActive = screenFill;
+ // Honor the dialog's initial viewport before input can be taken over.
+ // Later explicit aspect choices still replace this session preset.
+ if (!impl_->gameModeUri.empty() && uri == impl_->gameModeUri) impl_->aspectMode = 0;
+ const bool screen = uri.find(L"screen") != std::wstring::npos;
+ veyra::log::info("capture-ui", "open uri " + QString::fromStdWString(uri).toStdString());
+ openAfterCinema(screen ? tr("正在开始屏幕捕获…") : tr("正在打开采集设备 · %1").arg(utf8Of(label)), [this, uri] {
+ if (impl_->preOpen) impl_->preOpen();
+ impl_->engine.previewView({});
+ impl_->engine.open(impl_->videoWindow, uri, impl_->options);
+ impl_->openingSessionId = impl_->engine.snapshot().sessionId;
+ // Only the exact capture startScreenCapture opened in 游戏模式 is one.
+ impl_->gameModeSessionId = !impl_->gameModeUri.empty() && uri == impl_->gameModeUri ? impl_->openingSessionId : 0;
+ impl_->gameModeLive = false;
+ impl_->gameModeUri.clear();
+ updateGameMode();
+ refreshSubtitles({});
+ });
+}
+
+void QmlPlayerBridge::openAfterCinema(const QString& pending, std::function<void()> open) {
+ const int gen = ++impl_->liveOpenGen;
+ const bool fromHome = impl_->currentPage.isEmpty() || impl_->currentPage == QLatin1String("home");
+ if (!fromHome || !impl_->gameModeUri.empty()) {
+ // Game mode does not wait for the cinema animation or feature startup.
+ if (fromHome) emit navigate(QStringLiteral("min"));
+ impl_->pendingLiveText.clear(); open(); return;
+ }
+ // User report 2026-09-29: the window blacked out and jumped into 极简 when
+ // the engine opened in the same instant as the page switch and the window's
+ // height spring. Switch first, say that it is connecting, then open once
+ // the page (.22s out + 150 ms + rise) and the .7s height spring have settled.
+ emit navigate(QStringLiteral("min"));
+ impl_->pendingLiveText = pending;
+ emit snapshotChanged();
+ const int delay = reducedMotion() ? 0 : 820;
+ veyra::log::info("ui-live-open", std::format("deferred ms={} gen={}", delay, gen));
+ QTimer::singleShot(delay, this, [this, gen, open = std::move(open)] {
+ if (gen != impl_->liveOpenGen) { veyra::log::info("ui-live-open", std::format("superseded gen={}", gen)); return; }
+ impl_->pendingLiveText.clear();
+ veyra::log::info("ui-live-open", std::format("open gen={}", gen));
+ open();
+ emit snapshotChanged();
+ });
+}
+
+// Force-SDR and vertical flip are real settings the engine already carries, so
+// these are genuine controls rather than placeholders.
+bool QmlPlayerBridge::captureForceSdr() const { return settings().forceSdrPreview; }
+void QmlPlayerBridge::setCaptureForceSdr(bool value) {
+ auto s = settings();
+ if (s.forceSdrPreview == value) return;
+ s.forceSdrPreview = value;
+ if(impl_->commit(std::move(s))){impl_->prefs["captureForceSdr"]=value;if(!impl_->savePrefs())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);}
+ emit settingsChanged();
+}
+bool QmlPlayerBridge::captureFlipVertical() const { return settings().captureFlipVertical; }
+void QmlPlayerBridge::setCaptureFlipVertical(bool value) {
+ auto s = settings();
+ if (s.captureFlipVertical == value) return;
+ s.captureFlipVertical = value;
+ if(impl_->commit(std::move(s))){impl_->prefs["captureFlipVertical"]=value;if(!impl_->savePrefs())emit notice(tr("采集设置保存失败,请检查配置目录是否可写"),true);}
+ emit settingsChanged();
+}
+
+// --- screen capture ----------------------------------------------------------
+QVariantList QmlPlayerBridge::screenTargets() const {
+ // Enumerated from the source for the chosen kind; cached until refreshed so a
+ // binding re-evaluation does not walk every window again.
+ QVariantList out;
+ for (const auto& target : impl_->screenList) {
+ QVariantMap item;
+ item["id"] = QString::number(target.handle);
+ QString label = QString::fromWCharArray(target.name.c_str());
+ if (target.width > 0)
+ label += QStringLiteral(" · %1x%2").arg(target.width).arg(target.height);
+ if (target.refresh > 0) label += QStringLiteral(" · %1Hz").arg(target.refresh);
+ item["label"] = label;
+ item["width"] = int(target.width);
+ item["height"] = int(target.height);
+ out << item;
+ }
+ return out;
+}
+QVariantMap QmlPlayerBridge::screenOptions() const {
+ QVariantMap d{{"kind", 0}, {"method", 0}, {"fps", 0}, {"cursor", true}, {"fill", false},
+ {"left", 0}, {"top", 0}, {"right", 0}, {"bottom", 0}, {"passthrough", false}};
+ const auto saved = impl_->prefs.value("screen").toMap();
+ for (auto it = saved.begin(); it != saved.end(); ++it) if (d.contains(it.key())) d[it.key()] = it.value();
+ if (d.value("kind").toInt() == 0) d["method"] = 0; // DXGI is monitors only
+ if (d.value("method").toInt() == 1) d["cursor"] = false; // and has no pointer
+ return d;
+}
+bool QmlPlayerBridge::setScreenOption(const QString& key, const QVariant& value) {
+ static const QHash<QString, std::pair<int, int>> ranges{{"kind", {0, 1}}, {"method", {0, 1}}, {"fps", {0, 5}},
+ {"left", {0, 16384}}, {"top", {0, 16384}}, {"right", {0, 16384}}, {"bottom", {0, 16384}}};
+ auto saved = impl_->prefs.value("screen").toMap();
+ if (ranges.contains(key)) {
+ bool ok = false; const int n = value.toInt(&ok);
+ const auto [low, high] = ranges.value(key);
+ if (!ok || n < low || n > high) { emit notice(tr("数值超出范围"), true); return false; }
+ saved[key] = n;
+ } else if (key == QLatin1String("cursor") || key == QLatin1String("fill") || key == QLatin1String("passthrough")) {
+ saved[key] = value.toBool();
+ } else return false;
+ impl_->prefs["screen"] = saved;
+ impl_->savePrefs();
+ if (key == QLatin1String("kind")) { impl_->screenTarget.clear(); refreshCaptureTargets(); }
+ emit captureChanged();
+ return true;
+}
+bool QmlPlayerBridge::startScreenCapture() {
+ const auto o = screenOptions();
+ source::ScreenCaptureOptions value;
+ bool found = false;
+ for (const auto& t : impl_->screenList)
+ if (QString::number(t.handle) == impl_->screenTarget) { value.kind = t.kind; value.target = t.handle; found = true; }
+ if (!found) { emit notice(tr("先选择一个捕获目标"), true); return false; }
+ constexpr unsigned rates[] = {0, 30, 60, 120, 144, 240};
+ value.method = source::ScreenCaptureMethod(o.value("method").toInt());
+ value.fps = rates[std::clamp(o.value("fps").toInt(), 0, 5)];
+ value.cursor = o.value("cursor").toBool();
+ value.left = o.value("left").toUInt(); value.top = o.value("top").toUInt();
+ value.right = o.value("right").toUInt(); value.bottom = o.value("bottom").toUInt();
+ // 游戏模式: the real pointer is drawn on top, so the picture carries none (a
+ // second, late pointer otherwise), the picture must match the screen 1:1 for
+ // clicks to land where they are seen (no crop), and the yellow border goes.
+ const bool game = o.value("passthrough").toBool();
+ if (game) {
+ value.cursor = false; value.borderless = true;
+ value.left = value.top = value.right = value.bottom = 0;
+ const HWND window = value.kind == source::ScreenTargetKind::Window ? reinterpret_cast<HWND>(value.target) : nullptr;
+ impl_->gameMonitor = window ? MonitorFromWindow(window, MONITOR_DEFAULTTONEAREST) : reinterpret_cast<HMONITOR>(value.target);
+ impl_->game.setTarget(window, impl_->gameMonitor, !window);
+ impl_->gameModeUri = value.uri();
+ // Exclusive fullscreen still cannot be covered by another process.
+ QUERY_USER_NOTIFICATION_STATE state{};
+ if (SUCCEEDED(SHQueryUserNotificationState(&state)) && state == QUNS_RUNNING_D3D_FULL_SCREEN)
+ emit notice(tr("检测到独占全屏的游戏:Windows 不允许其它窗口盖在它上面,请把游戏改成无边框窗口或窗口化"), true);
+ } else impl_->gameModeUri.clear();
+ veyra::log::info("screen-ui", std::format("start kind={} method={} fps={} cursor={} crop={},{},{},{} fill={} gameMode={}", int(value.kind), int(value.method),
+ value.fps, value.cursor, value.left, value.top, value.right, value.bottom, o.value("fill").toBool(), game));
+ openSourceUri(value.uri(), wideOf(screenTargetLabel()), o.value("fill").toBool());
+ impl_->screenFitClient = impl_->screenFitImage = QSize();
+ if (gameMode()) { updateGameGeometry(); updateGameMode(); emit gameModeChanged(); }
+ emit compareChanged();
+ rememberSource(QStringLiteral("screen"), screenTargetLabel());
+ return true;
+}
+bool QmlPlayerBridge::gameMode() const { return impl_->gameModeSessionId != 0; }
+bool QmlPlayerBridge::passthroughActive() const { return impl_->passthroughShown; }
+bool QmlPlayerBridge::gameInputActive() const { return impl_->gameInputShown; }
+bool QmlPlayerBridge::gameScaledPreview() const {
+ return gameMode() && (ui::gameViewportScaled(impl_->screenFillActive, impl_->aspectMode) || previewRotation()!=0);
+}
+QRectF QmlPlayerBridge::gameVideoRect() const { return impl_->gameVideoRect; }
+void QmlPlayerBridge::attachMainWindow(qulonglong nativeHandle) {
+ impl_->game.attach(reinterpret_cast<HWND>(nativeHandle));
+ for (auto* window:QGuiApplication::allWindows())
+ if (qulonglong(window->winId())==nativeHandle) { impl_->gameWindow=window; break; }
+}
+void QmlPlayerBridge::updateGameGeometry() {
+ if (!gameMode() || !impl_->presentation.fullscreen || !impl_->gameWindow) return;
+ RECT r=impl_->game.pictureBounds();
+ if (gameScaledPreview()) {
+ const HWND main = reinterpret_cast<HWND>(impl_->gameWindow->winId());
+ POINT origin{};
+ MONITORINFO info{sizeof(info)};
+ if (!GetMonitorInfoW(impl_->gameMonitor, &info) || !ClientToScreen(main, &origin)) return;
+ r=info.rcMonitor; OffsetRect(&r,-origin.x,-origin.y);
+ }
+ const qreal scale=impl_->gameWindow->devicePixelRatio();
+ if (scale<=0) return;
+ const QRectF rect(r.left/scale,r.top/scale,(r.right-r.left)/scale,(r.bottom-r.top)/scale);
+ if (!rect.isEmpty() && rect!=impl_->gameVideoRect) {
+ impl_->gameVideoRect=rect; emit gameModeChanged();
+ }
+}
+void QmlPlayerBridge::setGamePanelOpen(bool open) {
+ if (impl_->gamePanelOpen == open) return;
+ impl_->gamePanelOpen = open;
+ updateGameMode();
+}
+int QmlPlayerBridge::gameModeScreenIndex() const {
+ if (!impl_->gameMonitor) return -1;
+ const auto screens = QGuiApplication::screens();
+ for (int i = 0; i < screens.size(); ++i) {
+ const auto* native = screens[i]->nativeInterface<QNativeInterface::QWindowsScreen>();
+ if (native && native->handle() == impl_->gameMonitor) return i;
+ }
+ return -1;
+}
+void QmlPlayerBridge::testBlockUi(int ms) {
+ if (GetEnvironmentVariableW(L"VEYRA_TEST_UI_BLOCK", nullptr, 0) == 0) return;
+ veyra::log::warn("game-mode", std::format("test: GUI thread blocked for {} ms", ms));
+ Sleep(DWORD(std::clamp(ms, 0, 20000)));
+}
+// 游戏模式 state: click-through while the game-mode capture is live and the picture
+// is fullscreen, the panel while the Home panel is open, otherwise a normal window.
+void QmlPlayerBridge::updateGameMode() {
+ using Mode = ui::GamePassthrough::Mode;
+ auto& i = *impl_;
+ const auto& s = i.snapshot;
+ if (i.gameModeSessionId) {
+ const bool same = s.sessionId == i.gameModeSessionId;
+ if (same && s.running && !s.failed) i.gameModeLive = true;
+ const bool ended = (same && (s.failed || s.transport == engine::TransportState::Stopping ||
+ s.transport == engine::TransportState::Empty || (i.gameModeLive && !s.running))) || s.sessionId > i.gameModeSessionId;
+ if (ended) {
+ const bool shown = i.game.mode() != Mode::Off;
+ veyra::log::info("game-mode", std::format("capture session {} ended failed={} pictureInFront={}", i.gameModeSessionId, s.failed, shown));
+ i.gameModeSessionId = 0; i.gameModeLive = false;
+ if (shown) {
+ i.gameInputShown = i.passthroughShown = false;
+ emit gameModeChanged();
+ i.game.apply(Mode::Off);
+ const QString why = s.failed ? uiText(s.status) : QString();
+ emit gameModeStopped(why.isEmpty() ? tr("捕获已结束,已退出游戏模式") : why);
+ }
+ }
+ }
+ if (!i.presentation.fullscreen) i.gameRefused = false;
+ Mode want = ui::gameInputMode(i.gameModeSessionId != 0, i.presentation.fullscreen,
+ i.gameRefused, i.gamePanelOpen, gameScaledPreview());
+ if (want!=Mode::Off && i.gameVideoRect.isEmpty()) updateGameGeometry();
+ // A listener failure holds until fullscreen is left.
+ if (want != Mode::Off && i.game.mode() == Mode::Off && !i.game.arm()) { i.gameRefused = true; want = Mode::Off; }
+ if (want != i.game.mode()) {
+ // QML binds the window's click-through flags to passthroughActive: publish
+ // first, so Qt has changed the window before the foreground moves.
+ const bool through = want == Mode::Through;
+ const bool input = through || want == Mode::Scaled;
+ if (through != i.passthroughShown || input != i.gameInputShown) {
+ i.passthroughShown = through; i.gameInputShown = input; emit gameModeChanged();
+ }
+ if (want == Mode::Scaled && i.game.mode() != Mode::Panel)
+ emit notice(tr("全屏缩放已启用:键盘和手柄控制源窗口,鼠标点击已拦截以免错位;需要鼠标穿透时切回贴合原窗口"), false);
+ i.game.apply(want);
+ }
+ const bool mode = i.gameModeSessionId != 0;
+ if ((!mode || !i.presentation.fullscreen) && !i.gameVideoRect.isEmpty()) {
+ i.gameVideoRect={}; emit gameModeChanged();
+ }
+ if (mode != i.gameModeShown) { i.gameModeShown = mode; emit gameModeChanged(); }
+}
+QString QmlPlayerBridge::screenTargetId() const { return impl_->screenTarget; }
+void QmlPlayerBridge::setScreenTargetId(const QString& value) {
+ impl_->screenTarget = value;
+ emit captureChanged();
+}
+QString QmlPlayerBridge::screenTargetLabel() const {
+ const QString id = screenTargetId();
+ if (id.isEmpty()) return tr("未选择目标");
+ for (const auto& item : screenTargets()) {
+ if (item.toMap().value(QStringLiteral("id")).toString() == id)
+ return item.toMap().value(QStringLiteral("label")).toString();
+ }
+ return tr("目标已失效");
+}
+void QmlPlayerBridge::refreshCaptureTargets() {
+ const int kind = screenOptions().value("kind").toInt();
+ impl_->screenList = source::ScreenCaptureSource::targets(kind == 1 ? source::ScreenTargetKind::Monitor : source::ScreenTargetKind::Window);
+ bool stillThere = false;
+ for (const auto& t : impl_->screenList) stillThere = stillThere || QString::number(t.handle) == impl_->screenTarget;
+ if (!stillThere) impl_->screenTarget = impl_->screenList.empty() ? QString() : QString::number(impl_->screenList.front().handle);
+ emit captureChanged();
+}
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Chain.cpp b/src/ui/bridge/Chain.cpp
new file mode 100644
index 00000000..4598a6fa
--- /dev/null
+++ b/src/ui/bridge/Chain.cpp
@@ -0,0 +1,1033 @@
+// QML bridge: Chain responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- chain ------------------------------------------------------------------
+// The settings the UI is showing: the facade's pending copy, which the engine
+// has been asked to apply. One accessor so every property reads the same value.
+engine::EnhancementSettings QmlPlayerBridge::settings() const {
+ auto result = impl_->facade.pendingSettings();
+ if (impl_->chain.mode == engine::ChainMode::Node) impl_->draftGlobals.apply(result);
+ return result;
+}
+
+QVariantList QmlPlayerBridge::chain() const {
+ QVariantList out;
+ int nrOrdinal=0;
+ const auto& c = impl_->chain;
+ for (uint32_t i = 0; i < c.nodeCount; ++i) {
+ const auto& node = c.nodes[i];
+ const auto& info = engine::effectInfo(node.type);
+ QVariantMap item;
+ item["index"] = int(i);
+ item["id"] = c.mode == engine::ChainMode::Node ? impl_->layout.ids[i] : i + 2;
+ item["type"] = utf8Of(info.id);
+ item["label"] = uiText(info.label);
+ if(node.type==engine::EffectType::FrameGeneration)
+ for(const auto& choice:fgBackendChoices()){
+ const auto option=choice.toMap();
+ if(option.value("id").toString()==fgBackendName())item["label"]=option.value("label");
+ }
+ if(node.type==engine::EffectType::NrEnhance)item["label"]=tr("NR 画面增强 · 第 %1 层").arg(++nrOrdinal);
+ item["enabled"] = node.enabled;
+ item["x"] = double(node.viewX);
+ item["y"] = double(node.viewY);
+ item["mustBeLast"] = info.mustBeLast;
+ item["justBeforeLast"] = info.justBeforeLast;
+ item["experimental"] = info.experimental;
+ item["changesResolution"] = info.changesResolution;
+ out << item;
+ }
+ return out;
+}
+
+QVariantList QmlPlayerBridge::nrLayers() const {
+ QVariantList out;
+ for(uint32_t i=0;i<impl_->chain.nodeCount;++i){const auto& node=impl_->chain.nodes[i];
+ if(node.type!=engine::EffectType::NrEnhance)continue;
+ const auto& n=node.nr;
+ out<<QVariantMap{{"index",int(i)},{"enabled",node.enabled},{"sizePolicy",int(n.sizePolicy)},{"runtime",int(engine::currentNrRuntime(n.runtime))},
+ {"manualSize",pipeline::manualNrSizePolicy(n.sizePolicy)},{"sizePercent",int(pipeline::nrSizePercent(n.sizePolicy))},
+ {"intensity",n.model.intensity},{"tone",n.model.tone},{"structure",n.model.structure},
+ {"skin",n.model.skin},{"style",n.model.style},{"autoMask",bool(n.model.autoMask)},
+ {"uiCorrection",bool(n.model.uiCorrection)},{"performance",n.model.performance},{"total",n.residual.total},
+ {"darken",n.residual.darken},{"brighten",n.residual.brighten},
+ {"color",n.residual.color},{"luminance",n.residual.luminance},{"temporal",n.temporal},
+ {"antiFlicker",int(n.antiFlicker)},
+ {"correctionEnabled",n.residual.correction.enabled},{"correctionAuto",n.residual.correction.automatic},
+ {"hueProtection",n.residual.correction.hue},{"chromaProtection",n.residual.correction.chroma},
+ {"highlightProtection",n.residual.correction.highlight},{"localCompression",n.residual.correction.compression},
+ {"temporalStability",n.residual.correction.stability},
+ {"neutralProtection",n.residual.correction.neutral},{"colorRetention",n.residual.correction.colorKeep},
+ {"luminanceRetention",n.residual.correction.lumaKeep},{"shadowProtection",n.residual.correction.shadow},
+ {"correctionAmount",n.residual.correction.autoAmount}};
+ }
+ return out;
+}
+
+QString QmlPlayerBridge::nrAutoSelectionReason(int index) const {
+ const auto cap=effectCapabilities().value("nrAuto").toMap();
+ if(!cap.value("available").toBool())return cap.value("reason").toString();
+ const auto& s=settings();const auto& snapshot=impl_->snapshot;
+ int first=-1;unsigned count=0;bool temporal=false,otherAuto=false;
+ for(uint32_t i=0;i<impl_->chain.nodeCount;++i){const auto& node=impl_->chain.nodes[i];
+ if(node.type!=engine::EffectType::NrEnhance)continue;
+ if(first<0)first=int(i);
+ ++count;temporal|=node.enabled&&(node.nr.residual.correction.enabled?
+ node.nr.residual.correction.usesHistory():node.nr.temporal);
+ otherAuto|=int(i)!=index&&node.enabled&&node.nr.sizePolicy==pipeline::NrSizePolicy::Auto;
+ }
+ if(first!=index||count>2||otherAuto)return tr("自动 NR 仅支持一至两层列表的第一层");
+ if(impl_->chain.mode!=engine::ChainMode::List||engine::currentNrRuntime(s.nrRuntime)!=engine::NrRuntime::Ampere||s.sr||s.multiplier>1||temporal||
+ s.nrHoldStrength>0||s.color.enabled||s.additionalColorCount||s.antiAlias.enabled||s.additionalAntiAliasCount||s.beautyEnabled()||s.videoHdr.enabled||
+ s.opticalFlowBackend!=engine::OpticalFlowBackend::Nvidia||s.nrMotion!=engine::MotionSource::OpticalFlow||snapshot.capture||snapshot.image||snapshot.sourceHdr||
+ (snapshot.sourceWidth&& (snapshot.sourceWidth!=1920||snapshot.sourceHeight!=1080)))
+ return tr("需 1080p SDR 文件、SF 和 NVIDIA 光流;关闭超分、补帧、抗闪烁、调色、美颜及 HDR");
+ return {};
+}
+
+bool QmlPlayerBridge::setNrLayerParameter(int index,const QString& key,double value){
+ if(index<0||uint32_t(index)>=impl_->chain.nodeCount||
+ impl_->chain.nodes[index].type!=engine::EffectType::NrEnhance||!std::isfinite(value))return false;
+ if(key=="runtime") {
+ if(value!=0&&value!=1&&value!=2&&value!=3&&value!=4)return false;
+ value=int(engine::currentNrRuntime(static_cast<engine::NrRuntime>(int(value))));
+ const auto cap = effectCapabilities().value("nr" + QString::number(int(value))).toMap();
+ if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return false; }
+ const auto before=impl_->chain;
+ for(uint32_t i=0;i<impl_->chain.nodeCount;++i)
+ if(impl_->chain.nodes[i].type==engine::EffectType::NrEnhance)
+ impl_->chain.nodes[i].nr.runtime=static_cast<engine::NrRuntime>(int(value));
+ const bool accepted=impl_->revalidate(true);
+ if(!accepted){const auto error=impl_->validation.message;impl_->chain=before;impl_->revalidate();emit notice(uiText(error),true);}
+ emit settingsChanged();emitChainChanged();return accepted;
+ }
+ auto& node=impl_->chain.nodes[index];const auto before=node;auto& n=node.nr;const bool wasValid=chainValid();
+ if(key=="intensity")n.model.intensity=float(value);
+ else if(key=="tone")n.model.tone=float(value);
+ else if(key=="structure")n.model.structure=float(value);
+ else if(key=="skin")n.model.skin=float(value);
+ else if(key=="total")n.residual.total=float(value);
+ else if(key=="darken")n.residual.darken=float(value);
+ else if(key=="brighten")n.residual.brighten=float(value);
+ else if(key=="color")n.residual.color=float(value);
+ else if(key=="luminance")n.residual.luminance=float(value);
+ else if(key=="hueProtection")n.residual.correction.hue=float(value);
+ else if(key=="chromaProtection")n.residual.correction.chroma=float(value);
+ else if(key=="highlightProtection")n.residual.correction.highlight=float(value);
+ else if(key=="localCompression")n.residual.correction.compression=float(value);
+ else if(key=="temporalStability")n.residual.correction.stability=float(value);
+ else if(key=="neutralProtection")n.residual.correction.neutral=float(value);
+ else if(key=="colorRetention")n.residual.correction.colorKeep=float(value);
+ else if(key=="luminanceRetention")n.residual.correction.lumaKeep=float(value);
+ else if(key=="shadowProtection")n.residual.correction.shadow=float(value);
+ else if(key=="correctionAmount")n.residual.correction.autoAmount=float(value);
+ else if(key=="sizePercent"){
+ if(value!=std::floor(value)||value<pipeline::kNrMinimumPercent||value>pipeline::kNrMaximumPercent)return false;
+ n.sizePolicy=pipeline::nrSizePolicyForPercent(unsigned(value));
+ }
+ else if(key=="sizePolicy"){
+ if(value!=std::floor(value)||value<0||value>int(pipeline::NrSizePolicy::Manual))return false;
+ const auto policy=static_cast<pipeline::NrSizePolicy>(int(value));
+ if(!pipeline::validNrSizePolicy(policy))return false;
+ if(policy==pipeline::NrSizePolicy::Auto){const auto reason=nrAutoSelectionReason(index);if(!reason.isEmpty()){emit notice(reason,true);return false;}}
+ n.sizePolicy=policy;
+ }
+ else {
+ if(value!=std::floor(value)||value<0||value>6)return false;
+ if(key=="style"&&value<=2)n.model.style=int(value);
+ else if(key=="autoMask"&&value<=1)n.model.autoMask=int(value);
+ else if(key=="uiCorrection"&&value<=1)n.model.uiCorrection=int(value);
+ else if(key=="performance"&&value<=1&&engine::nrUsesPerformanceModel(n.runtime))n.model.performance=value!=0;
+ else if(key=="temporal"&&value<=1)n.temporal=value!=0;
+ else if(key=="correctionEnabled"&&value<=1)n.residual.correction.enabled=value!=0;
+ else if(key=="correctionAuto"&&value<=1)n.residual.correction.automatic=value!=0;
+ else if(key=="correctionUseAuto"&&value==1)n.residual.correction.useAutomaticValues(n.model.style);
+ else if(key=="antiFlicker"&&validNrAntiFlicker(engine::NrAntiFlicker(int(value))))n.antiFlicker=static_cast<engine::NrAntiFlicker>(int(value));
+ else return false;
+ }
+ if(node==before)return true;
+ const bool accepted=impl_->revalidate(true);
+ if(!accepted){const auto error=impl_->validation.message;node=before;impl_->revalidate();emit notice(uiText(error),true);}
+ emit settingsChanged();emitParameterChanged(&QmlPlayerBridge::nrLayersChanged,wasValid);return accepted;
+}
+
+QVariantList QmlPlayerBridge::effectCatalog() const {
+ QVariantList out;
+ for (const auto& info : engine::effectCatalog()) {
+ if (info.hidden) continue;
+ if (impl_->chain.mode == engine::ChainMode::Node && info.type == engine::EffectType::Protection) continue;
+ if (impl_->chain.mode == engine::ChainMode::Node && info.type == engine::EffectType::FrameGeneration) {
+ for(const auto& choice : fgBackendChoices()) {
+ const auto option=choice.toMap();const auto backend=option.value("id").toString();
+ QVariantMap fg;
+ fg["id"]=backend+QStringLiteral("-fg");
+ fg["label"]=option.value("label");
+ fg["maxInstances"]=1;fg["repeatable"]=false;fg["mustBeLast"]=true;
+ fg["justBeforeLast"]=false;fg["experimental"]=backend!=QLatin1String("dlss");
+ fg["disabled"]=option.value("disabled");fg["note"]=option.value("note");
+ out<<fg;
+ }
+ continue;
+ }
+ QVariantMap item;
+ item["id"] = utf8Of(info.id);
+ item["label"] = uiText(info.label);
+ item["maxInstances"] = int(info.maxInstances);
+ item["repeatable"] = info.repeatable;
+ item["mustBeLast"] = info.mustBeLast;
+ item["justBeforeLast"] = info.justBeforeLast;
+ item["experimental"] = info.experimental;
+ auto cap = effectAvailability(utf8Of(info.id));
+ if(info.type==engine::EffectType::FrameGeneration)
+ for(const auto& choice:fgBackendChoices())if(!choice.toMap().value("disabled").toBool()){
+ cap=QVariantMap{{"available",true},{"reason",QString{}}};break;
+ }
+ item["disabled"] = !cap.value("available").toBool();
+ item["note"] = cap.value("reason");
+ out << item;
+ }
+ return out;
+}
+
+QString QmlPlayerBridge::chainError() const { return uiText(impl_->validation.message); }
+void QmlPlayerBridge::emitChainChanged() {
+ emit chainChanged(); emit nrLayersChanged(); emit videoHdrParamsChanged();
+ emit antiAliasChanged(); emit beautyChanged(); emit colourParamsChanged(); emit protectionChanged();
+}
+// Every chainChanged re-evaluated all chain-bound bindings on every page (the pro
+// and node pages stay loaded) and repainted the node wires: 65-80 ms of interface
+// thread per 40 ms slider step with six effects (audit 2026-10-15).
+void QmlPlayerBridge::emitParameterChanged(void (QmlPlayerBridge::*group)(), bool wasValid) {
+ if (chainValid() != wasValid) { emitChainChanged(); return; }
+ (this->*group)();
+}
+bool QmlPlayerBridge::chainValid() const { return impl_->validation.accepted; }
+int QmlPlayerBridge::nodeMode() const { return impl_->chain.mode == engine::ChainMode::Node ? 1 : 0; }
+void QmlPlayerBridge::setNodeMode(int mode) {
+ if (mode < 0 || mode > 1) { emit notice(tr("无效编辑模式"), true); return; }
+ const auto want = mode ? engine::ChainMode::Node : engine::ChainMode::List;
+ if (impl_->chain.mode == want) return;
+ const auto previousSession = impl_->currentSession();
+ auto candidate = previousSession;
+ const bool freshNode = want == engine::ChainMode::Node && !candidate.initialized[size_t(want)];
+ if (!candidate.select(want)) { emit notice(tr("模式配置无效,未切换"), true); return; }
+ if (freshNode) {
+ // The first visit to the node editor starts from an empty graph (input
+ // straight to output), not a copy of the list's effects.
+ auto& fresh = candidate.configurations[size_t(want)];
+ auto empty = std::make_unique<engine::EffectChain>();
+ empty->mode = engine::ChainMode::Node;
+ empty->fgMultiplier = fresh.chain.fgMultiplier;
+ fresh.chain = *empty;
+ fresh.editor.reset();
+ fresh.selectedNr = fresh.selectedColour = -1;
+ }
+ const auto previousSettings = impl_->facade.pendingSettings();
+ auto next = previousSettings;
+ auto& configuration = candidate.configurations[size_t(want)];
+ disableUnavailableEffects(configuration);
+ configuration.apply(next);
+ if (!next.validate().empty()) { emit notice(tr("模式参数无效,未切换"), true); return; }
+ // Save before changing the live mode; an unwritable/corrupt file cannot
+ // silently discard the configuration the user is about to leave.
+ if (!impl_->facade.saveChainSession(candidate)) { emit notice(uiText(impl_->facade.error()), true); return; }
+ if (!impl_->facade.applySettings(next,engine::runtimeOrder(configuration.chain))) {
+ impl_->facade.setPending(previousSettings);
+ if (!impl_->facade.saveChainSession(previousSession))
+ emit notice(tr("引擎拒绝切换,存档回退失败:") + uiText(impl_->facade.error()), true);
+ emit notice(tr("引擎未接受模式设置,当前配置不变"), true); return;
+ }
+ impl_->session = impl_->savedSession = candidate;
+ impl_->restoreConfiguration(configuration);
+ impl_->revalidate();
+ impl_->options = engine::PlayerOptions::from(next,engine::runtimeOrder(impl_->activeRuntime()));
+ emitChainChanged();
+ emit settingsChanged();
+}
+
+QVariantList QmlPlayerBridge::recentFiles() const {
+ QVariantList out;
+ for (const auto& entry : impl_->facade.recentFiles()) {
+ QVariantMap item;
+ item["path"] = utf8Of(entry.path);
+ item["label"] = utf8Of(entry.label);
+ item["exists"] = entry.exists;
+ out << item;
+ }
+ return out;
+}
+
+QVariantList QmlPlayerBridge::presets() const {
+ QVariantList out;
+ const auto& entries = impl_->facade.presets().entries();
+ for (size_t i = 0; i < entries.size(); ++i) {
+ const auto& e = entries[i];
+ QVariantMap item;
+ item["index"] = int(i);
+ item["name"] = utf8Of(e.name);
+ item["note"] = uiText(e.note);
+ item["builtin"] = e.builtin;
+ item["nodeMode"] = e.kind == engine::ChainMode::Node;
+ item["contents"] = int(e.contents);
+ out << item;
+ }
+ return out;
+}
+
+QString QmlPlayerBridge::currentPresetName() const {
+ // Matching is by name of the stored entry whose chain equals what the UI is
+ // showing; anything else is honestly "自定义" rather than the nearest guess.
+ const auto& entries = impl_->facade.presets().entries();
+ for (const auto& e : entries) {
+ if (e.chain == impl_->chain) return utf8Of(e.name);
+ }
+ return tr("自定义");
+}
+
+QVariantList QmlPlayerBridge::audioTracks() const {
+ QVariantList out;
+ for (const auto& track : impl_->snapshot.audioTracks) {
+ // The track struct carries raw fields; the UI shows the ones that are
+ // actually present rather than a synthesized name.
+ QStringList parts;
+ if (!track.language.empty()) parts << utf8Of(track.language);
+ if (!track.title.empty()) parts << utf8Of(track.title);
+ if (!track.codec.empty()) parts << utf8Of(track.codec);
+ QVariantMap item;
+ item["index"] = track.streamIndex;
+ item["label"] = parts.isEmpty() ? tr("音轨 %1").arg(track.streamIndex) : parts.join(QStringLiteral(" · "));
+ item["channels"] = int(track.channels);
+ out << item;
+ }
+ return out;
+}
+int QmlPlayerBridge::selectedAudioTrack() const { return impl_->snapshot.selectedAudioTrack; }
+void QmlPlayerBridge::setSelectedAudioTrack(int index) {
+ impl_->engine.selectAudioTrack(impl_->snapshot.sessionId, index);
+}
+bool QmlPlayerBridge::hasCaptureSession() const { return impl_->facade.hasCaptureSession(); }
+
+QString QmlPlayerBridge::captureSessionSummary() const {
+ // Built from the recorded session only: the device, the format and the preset
+ // that were actually used. A summary assembled from defaults would read as a
+ // history that never happened.
+ const auto& session = impl_->facade.lastCaptureSession();
+ QStringList parts;
+ // The device's friendly name (stored when the session started); the moniker
+ // path itself is not something a person can read.
+ const QString name = impl_->prefString("captureDeviceName");
+ if (!name.isEmpty()) parts << name;
+ else if (!session.devicePath.empty()) parts << QFileInfo(utf8Of(session.devicePath)).fileName();
+ const QString formatLabel = impl_->prefString("captureFormatLabel");
+ if (!formatLabel.isEmpty()) parts << formatLabel.section(QStringLiteral(" · "), 0, 1);
+ else if (!session.formatKey.empty()) parts << utf8Of(session.formatKey);
+ if (formatLabel.isEmpty() && session.fps > 0.01) parts << QStringLiteral("%1 fps").arg(session.fps, 0, 'f', 2);
+ if (!session.presetName.empty()) parts << tr("预设「%1」").arg(utf8Of(session.presetName));
+ return parts.join(QStringLiteral(" · "));
+}
+
+void QmlPlayerBridge::resumeCaptureSession() {
+ // "Continue": the remembered device, format, audio and colour, re-checked
+ // against what the machine reports now; nothing else is picked for the user.
+ impl_->capturePrefs = ui::CapturePreferenceStore(impl_->dataDir).load();
+ if (impl_->capturePrefs.videoPath.empty()) { emit notice(tr("还没有采集记录"), true); return; }
+ impl_->captureDevice = impl_->capturePrefs.videoPath;
+ impl_->captureColor = impl_->capturePrefs.colorForDevice(impl_->captureDevice);
+ impl_->captureResumePending = true;
+ queryCapture(2, impl_->captureDevice);
+}
+
+QString QmlPlayerBridge::colorStatus() const { return uiText(impl_->snapshot.colorStatus); }
+QString QmlPlayerBridge::videoHdrStatus() const { return uiText(impl_->snapshot.videoHdrStatus); }
+
+// --- chain editing ----------------------------------------------------------
+// The validator is the authority: an edit that would put frame generation or
+// RTX Video HDR where the pipeline cannot honour them is refused with a reason,
+// not silently dropped.
+int QmlPlayerBridge::addEffect(const QString& type) {
+ // The generic list entry means "add an available FG stage". A saved,
+ // disabled NVIDIA choice must not make FSR/XeSS impossible to add on AMD.
+ if(type==QLatin1String("frame-generation")&&
+ !effectAvailability(type).value("available").toBool()){
+ for(const auto& choice:fgBackendChoices()){
+ const auto row=choice.toMap();if(row.value("disabled").toBool())continue;
+ return addEffect(row.value("id").toString()+QStringLiteral("-fg"));
+ }
+ }
+ const auto cap = effectAvailability(type);
+ if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return -1; }
+ const bool fgType=type==QLatin1String("dlss-fg")||type==QLatin1String("xess-fg")||
+ type==QLatin1String("fsr3-fg")||type==QLatin1String("fsr4-fg")||type==QLatin1String("vfg-fg");
+ const auto fgBackend=type==QLatin1String("vfg-fg")?engine::FrameGenerationBackend::Vfg:type==QLatin1String("fsr4-fg")?engine::FrameGenerationBackend::Fsr4:
+ type==QLatin1String("fsr3-fg")?engine::FrameGenerationBackend::Fsr:
+ type==QLatin1String("xess-fg")?engine::FrameGenerationBackend::XeSS:engine::FrameGenerationBackend::Dlss;
+ const auto fgCeiling=engine::fsrFrameGeneration(fgBackend)?2u:
+ fgBackend==engine::FrameGenerationBackend::XeSS?uint32_t(xessCeiling(impl_->snapshot)):fgBackend==engine::FrameGenerationBackend::Vfg?8u:6u;
+ if(fgType&&fgBackend==engine::FrameGenerationBackend::Vfg&&(!vfgHardwarePossible()||!pipeline::VfgBackend::runtimeAvailable(runtime::localRuntimeDirectory().wstring()))){
+ emit notice(!vfgHardwarePossible()?tr("VFG 需要 NVIDIA Ada / Blackwell 显卡(RTX 40 / 50)"):tr("未找到 VFG 运行组件,请在组件页核对路径"),true);return -1;
+ }
+ if (impl_->chain.mode == engine::ChainMode::Node) {
+ const bool fg = fgType;
+ const engine::EffectInfo* info = nullptr;
+ for (const auto& item : engine::effectCatalog())
+ if ((fg && item.type == engine::EffectType::FrameGeneration) || utf8Of(item.id) == type) info = &item;
+ if (!info || info->hidden || info->type == engine::EffectType::Protection) {
+ emit notice(tr("节点模式不支持该效果类型"), true); return -1;
+ }
+ auto& c = impl_->chain;
+ auto before = std::make_unique<engine::EffectChain>(c);
+ const auto oldLayout = impl_->layout; const auto previous = impl_->facade.pendingSettings();
+ const auto oldGlobals = impl_->draftGlobals;
+ auto pending = settings();
+ if (fg){pending.frameGenerationBackend=fgBackend;c.fgMultiplier=normalizeFgMultiplier(c.fgMultiplier,fgBackend,fgCeiling);}
+ int index = -1;
+ if (fg) for (uint32_t i = 0; i < c.nodeCount; ++i)
+ if (c.nodes[i].type == engine::EffectType::FrameGeneration) index = int(i);
+ if (index < 0) {
+ if (c.nodeCount >= engine::kMaxChainNodes || c.countOf(info->type) >= info->maxInstances ||
+ impl_->layout.nextId == std::numeric_limits<uint32_t>::max()) {
+ emit notice(tr("该类型节点已达上限(含禁用和未连接节点)"), true); return -1;
+ }
+ index = int(c.nodeCount++);
+ auto& node = c.nodes[index]; node = engine::ChainNode{}; node.type = info->type;
+ node.enabled = info->type != engine::EffectType::Beauty; // beauty starts switched off
+ node.viewX = float(index % 4) * 260; node.viewY = float(index / 4) * 300;
+ if (info->type == engine::EffectType::NrEnhance) {
+ node.nr.runtime = previous.nrRuntime; node.nr.lowLatencyPairing = previous.lowLatency;
+ }
+ const uint32_t id = impl_->layout.nextId++; impl_->layout.ids[index] = id; impl_->layout.next[index] = 0;
+ auto projected = std::make_unique<engine::EffectChain>();
+ if (oldLayout.project(*before, *projected).accepted) {
+ uint32_t predecessor = 0, next = impl_->layout.inputNext;
+ while (next > 1) {
+ const int at = impl_->layout.indexOf(c, next);
+ const auto t = c.nodes[at].type;
+ if (t == engine::EffectType::FrameGeneration ||
+ (info->type != engine::EffectType::FrameGeneration && t == engine::EffectType::VideoHdr)) break;
+ predecessor = next; next = impl_->layout.next[at];
+ }
+ if (predecessor == 0) impl_->layout.inputNext = id;
+ else impl_->layout.next[size_t(impl_->layout.indexOf(c, predecessor))] = id;
+ impl_->layout.next[index] = next;
+ }
+ } else c.nodes[index].enabled = true;
+ impl_->draftGlobals = engine::ChainGlobalSettings::capture(pending);
+ if (!impl_->revalidate(true, &previous)) {
+ const auto error = impl_->validation.message; c = *before; impl_->layout = oldLayout;
+ impl_->draftGlobals = oldGlobals;
+ impl_->facade.setPending(previous); impl_->revalidate(); emit notice(uiText(error), true); return -1;
+ }
+ if (info->type == engine::EffectType::NrEnhance) impl_->selectedNr = index;
+ if (info->type == engine::EffectType::Color) impl_->selectedColour = index;
+ emitChainChanged(); emit settingsChanged(); return index;
+ }
+ if(fgType) {
+ const auto before=impl_->chain;const auto previous=settings();
+ auto& c=impl_->chain;
+ int slot=-1;
+ for(uint32_t i=0;i<c.nodeCount;++i)if(c.nodes[i].type==engine::EffectType::FrameGeneration)slot=int(i);
+ if(slot<0) {
+ if(c.nodeCount>=engine::kMaxChainNodes){emit notice(tr("效果链已满"),true);return -1;}
+ slot=int(c.nodeCount++);c.nodes[slot]={};c.nodes[slot].type=engine::EffectType::FrameGeneration;
+ c.nodes[slot].viewX=float(slot%4)*260;c.nodes[slot].viewY=float(slot/4)*300;
+ }
+ c.nodes[slot].enabled=true;
+ c.fgMultiplier=normalizeFgMultiplier(c.fgMultiplier,fgBackend,fgCeiling);
+ auto next=previous;engine::fromChain(c,next);
+ next.frameGenerationBackend=fgBackend;
+ impl_->validation=engine::validateChain(c);
+ if(!impl_->validation.accepted||!next.validate().empty()||
+ !unavailableEffects(next).isEmpty()||
+ !impl_->facade.applySettings(next,engine::runtimeOrder(c))) {
+ c=before;impl_->facade.setPending(previous);impl_->validation=engine::validateChain(c);
+ emit notice(tr("补帧选择未被接受,保留原设置;请检查倍率和后端能力"),true);return -1;
+ }
+ impl_->options=engine::PlayerOptions::from(next,engine::runtimeOrder(c));
+ emit settingsChanged();emitChainChanged();return slot;
+ }
+ engine::EffectType wanted = engine::EffectType::NrEnhance;
+ bool found = false;
+ for (const auto& info : engine::effectCatalog()) {
+ if (!info.hidden && utf8Of(info.id) == type) {
+ wanted = info.type;
+ found = true;
+ break;
+ }
+ }
+ if (!found) { emit notice(tr("未知的效果: %1").arg(type), true); return -1; }
+ if (impl_->chain.mode == engine::ChainMode::Node && wanted == engine::EffectType::Protection) {
+ emit notice(tr("节点模式已取消 NR 保护区域;请在列表模式使用全局保护"), true); return -1;
+ }
+
+ auto& c = impl_->chain;
+ if (c.nodeCount >= engine::kMaxChainNodes) { emit notice(tr("效果链已满"), true); return -1; }
+ const auto& info = engine::effectInfo(wanted);
+ if (c.countOf(wanted) >= info.maxInstances) {
+ emit notice(tr("%1 最多 %2 个").arg(uiText(info.label)).arg(info.maxInstances), true);
+ return -1;
+ }
+
+ const auto before=c; const int selected=impl_->selectedNr,colourSelected=impl_->selectedColour;
+ // Insert before a pinned tail so the validator never has to undo the edit:
+ // frame generation stays last and RTX Video HDR stays in front of it.
+ uint32_t insertAt = c.nodeCount;
+ if (wanted != engine::EffectType::FrameGeneration) {
+ for (uint32_t i = 0; i < c.nodeCount; ++i) {
+ const auto& nodeInfo = engine::effectInfo(c.nodes[i].type);
+ if (nodeInfo.mustBeLast||((wanted==engine::EffectType::Color||wanted==engine::EffectType::Beauty)&&c.nodes[i].type==engine::EffectType::VideoHdr)||
+ (wanted==engine::EffectType::NrEnhance&&
+ (c.nodes[i].type==engine::EffectType::Protection||c.nodes[i].type==engine::EffectType::VideoHdr))) { insertAt = i; break; }
+ }
+ }
+ for (uint32_t i = c.nodeCount; i > insertAt; --i) c.nodes[i] = c.nodes[i - 1];
+ if(impl_->selectedNr>=int(insertAt))++impl_->selectedNr;
+ if(impl_->selectedColour>=int(insertAt))++impl_->selectedColour;
+ c.nodes[insertAt] = engine::ChainNode{};
+ c.nodes[insertAt].type = wanted;
+ // A new list-mode NR layer arrives switched off: adding a layer must not
+ // change the picture until the user turns it on.
+ c.nodes[insertAt].enabled = !(wanted == engine::EffectType::NrEnhance && c.mode == engine::ChainMode::List);
+ // A beauty layer arrives with its switch and both sub-functions off: adding one
+ // never changes the picture (its presets turn it on).
+ if (wanted == engine::EffectType::Beauty) c.nodes[insertAt].enabled = false;
+ if(wanted==engine::EffectType::Color)impl_->selectedColour=int(insertAt);
+ if(wanted==engine::EffectType::NrEnhance){
+ c.nodes[insertAt].nr.runtime=settings().nrRuntime;
+ c.nodes[insertAt].nr.lowLatencyPairing=settings().lowLatency;
+ impl_->selectedNr=int(insertAt);
+ }
+ // A new node lands below the others in node mode, in a stable column.
+ c.nodes[insertAt].viewX = 40.0f + float(insertAt % 4) * 260.0f;
+ c.nodes[insertAt].viewY = 40.0f + float(insertAt / 4) * 200.0f;
+ ++c.nodeCount;
+
+ const bool live=c.mode==engine::ChainMode::Node||wanted==engine::EffectType::NrEnhance||wanted==engine::EffectType::Color;
+ if(!impl_->revalidate(live)){
+ const auto error=impl_->validation.message;c=before;impl_->selectedNr=selected;
+ impl_->selectedColour=colourSelected;
+ impl_->revalidate();emit notice(uiText(error),true);return -1;
+ }
+ emitChainChanged();
+ if (!impl_->validation.accepted) {
+ emit notice(uiText(impl_->validation.message), true);
+ } else {
+ emit settingsChanged();
+ }
+ return int(insertAt);
+}
+
+QVariantList QmlPlayerBridge::nodeConnections() const {
+ QVariantList out;
+ if (impl_->chain.mode != engine::ChainMode::Node) return out;
+ const auto add = [&](uint32_t from, uint32_t to) {
+ if (to != engine::NodeGraphLayout::Input)
+ out << QVariantMap{{"from", from}, {"to", to}};
+ };
+ add(0, impl_->layout.inputNext);
+ for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
+ add(impl_->layout.ids[i], impl_->layout.next[i]);
+ return out;
+}
+
+int QmlPlayerBridge::nodeIndexForId(uint id) const {
+ return impl_->chain.mode == engine::ChainMode::Node ? impl_->layout.indexOf(impl_->chain, id) : -1;
+}
+
+int QmlPlayerBridge::duplicateNode(uint id) {
+ if (impl_->chain.mode != engine::ChainMode::Node) return -1;
+ auto before = std::make_unique<engine::EffectChain>(impl_->chain);
+ const auto layout = impl_->layout;
+ uint32_t created = 0;
+ const auto result = impl_->layout.duplicate(impl_->chain, id, created);
+ if (!result.accepted) { emit notice(uiText(result.message), true); return -1; }
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message;
+ impl_->chain = *before; impl_->layout = layout; impl_->revalidate();
+ emit notice(uiText(error), true); return -1;
+ }
+ const int index = nodeIndexForId(created);
+ if (impl_->chain.nodes[index].type == engine::EffectType::NrEnhance) impl_->selectedNr = index;
+ if (impl_->chain.nodes[index].type == engine::EffectType::Color) impl_->selectedColour = index;
+ emitChainChanged(); emit settingsChanged(); return index;
+}
+
+bool QmlPlayerBridge::resetNode(uint id) {
+ const int index = nodeIndexForId(id);
+ if (index < 0) return false;
+ auto& node = impl_->chain.nodes[index];
+ const auto before = node; const auto multiplier = impl_->chain.fgMultiplier;
+ const auto strict = impl_->chain.fgStrictAdmission;
+ const auto previous = impl_->facade.pendingSettings();
+ const auto oldGlobals = impl_->draftGlobals;
+ node = engine::ChainNode{};
+ node.type = before.type; node.enabled = before.enabled;
+ node.viewX = before.viewX; node.viewY = before.viewY;
+ if (node.type == engine::EffectType::FrameGeneration) {
+ impl_->chain.fgMultiplier = 2; impl_->chain.fgStrictAdmission = false;
+ }
+ if (node.type == engine::EffectType::SuperResolution) {
+ const engine::EnhancementSettings defaults;
+ impl_->draftGlobals.srTarget = defaults.srTarget;
+ impl_->draftGlobals.videoSrQuality = defaults.videoSrQuality;
+ impl_->draftGlobals.dlssSrModel = defaults.dlssSrModel;
+ }
+ if (!impl_->revalidate(true, &previous)) {
+ const auto error = impl_->validation.message; node = before;
+ impl_->draftGlobals = oldGlobals;
+ impl_->facade.setPending(previous);
+ impl_->chain.fgMultiplier = multiplier; impl_->chain.fgStrictAdmission = strict; impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ emitChainChanged(); emit settingsChanged(); return true;
+}
+
+bool QmlPlayerBridge::connectNodes(uint from, uint to) {
+ if (impl_->chain.mode != engine::ChainMode::Node) return false;
+ const auto before = impl_->layout;
+ const auto result = impl_->layout.connect(impl_->chain, from, to);
+ if (!result.accepted) { emit notice(uiText(result.message), true); return false; }
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message; impl_->layout = before; impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ emitChainChanged(); emit settingsChanged(); return true;
+}
+
+bool QmlPlayerBridge::disconnectNode(uint from) {
+ if (impl_->chain.mode != engine::ChainMode::Node) return false;
+ const auto before = impl_->layout;
+ const auto result = impl_->layout.disconnect(impl_->chain, from);
+ if (!result.accepted) { emit notice(uiText(result.message), true); return false; }
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message; impl_->layout = before; impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ emitChainChanged(); emit settingsChanged(); return true;
+}
+
+bool QmlPlayerBridge::insertNodeAfter(uint id, uint after) {
+ if (impl_->chain.mode != engine::ChainMode::Node) return false;
+ const auto before = impl_->layout;
+ const auto result = impl_->layout.insertAfter(impl_->chain, id, after);
+ if (!result.accepted) { emit notice(uiText(result.message), true); return false; }
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message; impl_->layout = before; impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ emitChainChanged(); emit settingsChanged(); return true;
+}
+
+int QmlPlayerBridge::duplicateNrLayer(int index){
+ if (impl_->chain.mode == engine::ChainMode::Node)
+ return index >= 0 && uint32_t(index) < impl_->chain.nodeCount ? duplicateNode(impl_->layout.ids[index]) : -1;
+ auto& c=impl_->chain;
+ if(index<0||uint32_t(index)>=c.nodeCount||c.nodes[index].type!=engine::EffectType::NrEnhance||
+ c.countOf(engine::EffectType::NrEnhance)>=engine::kMaxNrInstances||c.nodeCount>=engine::kMaxChainNodes)return -1;
+ const auto before=c; const int selected=impl_->selectedNr,colourSelected=impl_->selectedColour;
+ const auto original=c.nodes[index];
+ for(uint32_t i=c.nodeCount;i>uint32_t(index+1);--i)c.nodes[i]=c.nodes[i-1];
+ c.nodes[index+1]=original;++c.nodeCount;impl_->selectedNr=index+1;
+ if(impl_->selectedColour>index)++impl_->selectedColour;
+ if(!impl_->revalidate(true)){
+ const auto error=impl_->validation.message;c=before;impl_->selectedNr=selected;
+ impl_->selectedColour=colourSelected;
+ impl_->revalidate();emit notice(uiText(error),true);return -1;
+ }
+ emitChainChanged();emit settingsChanged();return index+1;
+}
+
+bool QmlPlayerBridge::removeEffect(int index) {
+ auto& c = impl_->chain;
+ if (index < 0 || uint32_t(index) >= c.nodeCount) return false;
+ const auto& info = engine::effectInfo(c.nodes[index].type);
+ if (info.mustBeLast) { emit notice(tr("补帧固定为最后一步,不能删除"), true); return false; }
+ const bool live=c.mode==engine::ChainMode::Node||c.nodes[index].type==engine::EffectType::NrEnhance||c.nodes[index].type==engine::EffectType::Color;
+ const auto before=c; const int selected=impl_->selectedNr,colourSelected=impl_->selectedColour;
+ const auto previousLayout = impl_->layout;
+ if (c.mode == engine::ChainMode::Node) {
+ const auto result = impl_->layout.remove(c, impl_->layout.ids[index]);
+ if (!result.accepted) { emit notice(uiText(result.message), true); return false; }
+ } else {
+ for (uint32_t i = uint32_t(index); i + 1 < c.nodeCount; ++i) c.nodes[i] = c.nodes[i + 1];
+ --c.nodeCount;
+ }
+ if(impl_->selectedNr==index)impl_->selectedNr=-1;
+ else if(impl_->selectedNr>index)--impl_->selectedNr;
+ if(impl_->selectedColour==index)impl_->selectedColour=-1;
+ else if(impl_->selectedColour>index)--impl_->selectedColour;
+ if(!impl_->revalidate(live)){
+ const auto error=impl_->validation.message;c=before;impl_->layout=previousLayout;impl_->selectedNr=selected;
+ impl_->selectedColour=colourSelected;
+ impl_->revalidate();emit notice(uiText(error),true);return false;
+ }
+ emitChainChanged();
+ emit settingsChanged();
+ return true;
+}
+
+bool QmlPlayerBridge::moveEffect(int from, int to) {
+ auto& c = impl_->chain;
+ if (from < 0 || to < 0 || uint32_t(from) >= c.nodeCount || uint32_t(to) >= c.nodeCount) return false;
+ if (c.mode == engine::ChainMode::Node) {
+ if (from == to) return true;
+ return insertNodeAfter(impl_->layout.ids[from], impl_->layout.ids[to]);
+ }
+ // The two pinned stages cannot be dragged; the UI greys them, and the
+ // engine refuses them too so a script cannot route around the UI.
+ if (engine::effectInfo(c.nodes[from].type).mustBeLast ||
+ engine::effectInfo(c.nodes[to].type).mustBeLast) {
+ emit notice(tr("补帧固定为最后一步,不能拖动"), true);
+ return false;
+ }
+ const auto before = c;
+ const auto moving = c.nodes[from];
+ if (from < to) for (int i = from; i < to; ++i) c.nodes[i] = c.nodes[i + 1];
+ else for (int i = from; i > to; --i) c.nodes[i] = c.nodes[i - 1];
+ c.nodes[to] = moving;
+
+ impl_->revalidate(true);
+ if (!impl_->validation.accepted) {
+ const auto error=impl_->validation.message;
+ impl_->chain = before;
+ impl_->revalidate();
+ emit notice(uiText(error), true);
+ return false;
+ }
+ const auto remap=[&](int i){
+ if(i==from)return to;
+ if(from<to&&i>from&&i<=to)return i-1;
+ if(from>to&&i>=to&&i<from)return i+1;
+ return i;
+ };
+ impl_->selectedNr=remap(impl_->selectedNr);
+ impl_->selectedColour=remap(impl_->selectedColour);
+ emitChainChanged();
+ emit settingsChanged();
+ return true;
+}
+
+bool QmlPlayerBridge::setEffectEnabled(int index, bool enabled) {
+ auto& c = impl_->chain;
+ if (index < 0 || uint32_t(index) >= c.nodeCount) return false;
+ if (c.nodes[index].enabled == enabled) return true;
+ c.nodes[index].enabled = enabled;
+ if(!impl_->revalidate(true)){
+ const auto error=impl_->validation.message;c.nodes[index].enabled=!enabled;
+ impl_->revalidate();emit notice(uiText(error),true);return false;
+ }
+ emitChainChanged();
+ emit settingsChanged();
+ return true;
+}
+
+bool QmlPlayerBridge::nrAnyEnabled() const {
+ const auto& c=impl_->chain;
+ for(uint32_t i=0;i<c.nodeCount;++i)if(c.nodes[i].type==engine::EffectType::NrEnhance&&c.nodes[i].enabled)return true;
+ return false;
+}
+bool QmlPlayerBridge::setAllNrEnabled(bool enabled) {
+ auto& c=impl_->chain;const auto before=c;
+ std::vector<uint32_t> layers;
+ for(uint32_t i=0;i<c.nodeCount;++i)if(c.nodes[i].type==engine::EffectType::NrEnhance)layers.push_back(i);
+ if(layers.empty())return false;
+ auto& restore=impl_->nrMasterRestore;
+ if(!enabled){
+ restore.clear();
+ for(const auto i:layers){restore.push_back(c.nodes[i].enabled);c.nodes[i].enabled=false;}
+ }else{
+ // Layers added or removed since the switch went off: no faithful restore,
+ // so every layer comes back on. Same when nothing was on to begin with.
+ const bool faithful=restore.size()==layers.size()&&std::find(restore.begin(),restore.end(),true)!=restore.end();
+ for(size_t k=0;k<layers.size();++k)c.nodes[layers[k]].enabled=faithful?bool(restore[k]):true;
+ }
+ if(!impl_->revalidate(true)){
+ const auto error=impl_->validation.message;c=before;impl_->revalidate();
+ emit notice(uiText(error),true);emitChainChanged();return false;
+ }
+ veyra::log::info("ui-nr",std::format("master switch {} layers={}",enabled?"on":"off",layers.size()));
+ emitChainChanged();emit settingsChanged();
+ return true;
+}
+
+QVariantMap QmlPlayerBridge::nodeAnchors() const { return impl_->anchors; }
+bool QmlPlayerBridge::setNodeAnchor(const QString& key, double x, double y) {
+ if ((key != QLatin1String("input") && key != QLatin1String("flow") && key != QLatin1String("output")) ||
+ !std::isfinite(x) || !std::isfinite(y) || std::abs(x) > 1000000 || std::abs(y) > 1000000) return false;
+ impl_->anchors[key] = QVariantMap{{"x", x}, {"y", y}};
+ if (!impl_->anchorsFile.empty()) {
+ QFile file(QString::fromStdWString(impl_->anchorsFile.wstring()));
+ if (file.open(QIODevice::WriteOnly | QIODevice::Truncate))
+ file.write(QJsonDocument(QJsonObject::fromVariantMap(impl_->anchors)).toJson(QJsonDocument::Compact));
+ else veyra::log::warn("ui-node", "node anchor positions not saved");
+ }
+ emit nodeAnchorsChanged();
+ return true;
+}
+bool QmlPlayerBridge::setEffectPosition(int index, double x, double y) {
+ auto& c = impl_->chain;
+ if (index < 0 || uint32_t(index) >= c.nodeCount || !std::isfinite(x) || !std::isfinite(y) ||
+ std::abs(x) > 1000000 || std::abs(y) > 1000000) return false;
+ c.nodes[index].viewX = float(x);
+ c.nodes[index].viewY = float(y);
+ // Positions never affect the picture, so this deliberately does not
+ // revalidate or touch the engine: dragging a node must not cost a rebuild.
+ emitChainChanged();
+ return true;
+}
+
+QVariantMap QmlPlayerBridge::effectDescriptor(const QString& type) const {
+ for (const auto& info : engine::effectCatalog()) {
+ if (utf8Of(info.id) != type) continue;
+ QVariantMap out;
+ out["id"] = utf8Of(info.id);
+ out["label"] = uiText(info.label);
+ out["maxInstances"] = int(info.maxInstances);
+ out["repeatable"] = info.repeatable;
+ out["mustBeLast"] = info.mustBeLast;
+ out["justBeforeLast"] = info.justBeforeLast;
+ out["changesResolution"] = info.changesResolution;
+ out["experimental"] = info.experimental;
+ return out;
+ }
+ return {};
+}
+
+// --- presets ----------------------------------------------------------------
+bool QmlPlayerBridge::applyPresetIndex(int index) {
+ if (index < 0 || size_t(index) >= impl_->facade.presets().entries().size()) return false;
+ const auto mode = impl_->chain.mode;
+ const auto& entry = impl_->facade.presets().entries()[size_t(index)];
+ if (entry.kind != mode) { emit notice(tr("请先切换到预设对应的编辑模式"), true); return false; }
+ const auto previous = impl_->facade.pendingSettings();
+ const auto oldGlobals = impl_->draftGlobals;
+ auto nextGlobals = oldGlobals;
+ auto settings = previous;
+ auto candidate = impl_->chain;
+ const auto oldLayout = impl_->layout;
+ auto nextLayout = oldLayout;
+ engine::ChainValidation validation;
+ if (mode == engine::ChainMode::Node) {
+ auto document = std::make_unique<engine::NodeEditorDocument>();
+ document->nodes = candidate; document->layout = nextLayout; document->globals = oldGlobals;
+ validation = engine::PresetLibrary::applyToEditor(entry, *document, settings);
+ candidate = document->nodes; nextLayout = document->layout;
+ nextGlobals = document->globals.value_or(engine::ChainGlobalSettings::capture(settings));
+ // Keep the facade on accepted values until revalidate projects the new
+ // document. Audio/non-chain preset fields are retained in this copy.
+ engine::fromChain(impl_->activeRuntime(), settings);
+ // Custom: the static HDR output tuning rides in the globals block this call
+ // re-derives, so preserve the values this commit is carrying.
+ const auto keepCurve = settings.hdrCurve;
+ const auto keepMetadata = settings.hdrMetadata;
+ engine::ChainGlobalSettings::capture(previous).apply(settings);
+ settings.hdrCurve = keepCurve; settings.hdrMetadata = keepMetadata;
+ } else validation = engine::PresetLibrary::applyToChain(entry, candidate, settings);
+ if (!validation.accepted) { emit notice(uiText(validation.message), true); return false; }
+ if (const auto error = settings.validate(); !error.empty()) {
+ veyra::log::error("qml-preset", error);
+ emit notice(tr("预设参数无效,已保留原状态"), true); return false;
+ }
+ // Partial presets do not change the current editing target. Colour-only
+ // insertion/removal can shift NR indices, so retain the instance ordinal.
+ const auto remapSelection = [&](int selected, engine::EffectType type) {
+ if (entry.contents & engine::presetContentMask(engine::PresetContent::Chain)) return -1;
+ if (selected < 0) return -1;
+ uint32_t ordinal = 0;
+ for (int i = 0; i < selected; ++i) if (impl_->chain.nodes[i].type == type) ++ordinal;
+ for (uint32_t i = 0; i < candidate.nodeCount; ++i) {
+ if (candidate.nodes[i].type != type) continue;
+ if (ordinal == 0) return int(i);
+ --ordinal;
+ }
+ return -1;
+ };
+ const int selectedNr = remapSelection(impl_->nrIndex(), engine::EffectType::NrEnhance);
+ const int selectedColour = remapSelection(impl_->colourIndex(), engine::EffectType::Color);
+ auto oldChain = std::make_unique<engine::EffectChain>(impl_->chain);
+ impl_->chain = candidate;
+ impl_->layout = nextLayout;
+ if (mode == engine::ChainMode::Node) {
+ impl_->draftGlobals = nextGlobals;
+ engine::ChainGlobalSettings::capture(previous).apply(settings);
+ }
+ impl_->facade.setPending(settings);
+ if (!impl_->revalidate(true, &previous)) {
+ const auto error = impl_->validation.message; impl_->chain = *oldChain; impl_->layout = oldLayout;
+ impl_->draftGlobals = oldGlobals;
+ impl_->facade.setPending(previous); impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ impl_->selectedNr = selectedNr;
+ impl_->selectedColour = selectedColour;
+ if (entry.flow && (entry.contents & engine::presetContentMask(engine::PresetContent::Flow))) {
+ impl_->prefs[QStringLiteral("contentRate")] = int(this->settings().content);
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "preset content cadence not saved");
+ }
+ emit settingsChanged();
+ emitChainChanged();
+ return true;
+}
+
+void QmlPlayerBridge::enqueueExportFile(const QString& input,const QString& output) {
+ if(!QFileInfo(input).isFile()){emit notice(tr("队列输入文件不存在"),true);return;}
+ impl_->exportQueue.addFile(input,output);emit exportChanged();
+}
+void QmlPlayerBridge::addExportFiles(const QStringList& paths) {
+ for(const auto& path:paths){const auto url=QUrl(path);const QString file=url.isLocalFile()?url.toLocalFile():path;
+ if(QFileInfo(file).isFile())impl_->exportQueue.addFile(file);
+ else emit notice(tr("无法添加文件:%1").arg(file),true);
+ }
+ emit exportChanged();
+}
+void QmlPlayerBridge::addExportFilesDialog() {
+ addExportFiles(QFileDialog::getOpenFileNames(nullptr,tr("加入导出队列"),QString(),
+ tr("视频文件 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts);;所有文件 (*)")));
+}
+bool QmlPlayerBridge::selectExportPreset(int index) {
+ if (index == -1) {
+ impl_->exportPresetName.clear();
+ } else {
+ const auto& entries = impl_->facade.presets().entries();
+ if (index < 0 || size_t(index) >= entries.size() || entries[size_t(index)].kind == engine::ChainMode::Node)
+ return false;
+ impl_->exportPresetName = entries[size_t(index)].name;
+ }
+ emit exportChanged();
+ return true;
+}
+
+bool QmlPlayerBridge::savePresetAs(const QString& name, int contentsMask, bool nodeMode) {
+ if (name.isEmpty()) { emit notice(tr("预设需要一个名字"), true); return false; }
+ if (nodeMode != (impl_->chain.mode == engine::ChainMode::Node)) {
+ emit notice(tr("请先切换到要保存的编辑模式"), true); return false;
+ }
+ engine::PresetEntry entry;
+ entry.name = wideOf(name);
+ entry.kind = nodeMode ? engine::ChainMode::Node : engine::ChainMode::List;
+ entry.contents = uint32_t(contentsMask);
+ entry.chain = impl_->chain;
+ entry.globals=engine::ChainGlobalSettings::capture(impl_->facade.pendingSettings());
+ entry.color = impl_->facade.pendingSettings().color;
+ entry.fg.multiplier = impl_->facade.pendingSettings().multiplier;
+ entry.fg.backend = impl_->facade.pendingSettings().frameGenerationBackend;
+ entry.fg.vfgQuality = impl_->facade.pendingSettings().vfgQuality;
+ entry.audioSync = impl_->facade.pendingSettings().audioSync;
+ entry.audioOffsetMs = impl_->facade.pendingSettings().audioOffsetMs;
+ if (nodeMode) {
+ entry.nodeConfiguration = impl_->currentSession().configurations[1];
+ entry.chain = entry.nodeConfiguration->chain;
+ if (const auto* color = impl_->chain.firstOf(engine::EffectType::Color)) {
+ entry.color = color->color; entry.color.enabled = color->enabled;
+ }
+ entry.fg.multiplier = uint32_t(fgMultiplier());
+ entry.fg.backend = impl_->draftGlobals.fgBackend;
+ entry.fg.vfgQuality = impl_->draftGlobals.vfgQuality;
+ entry.globals=impl_->draftGlobals;
+ }
+ entry.flow = engine::PresetFlowSettings::capture(settings());
+ const bool ok = impl_->facade.savePreset(entry, false);
+ if (ok) emit presetsChanged();
+ else emit notice(tr("保存预设失败: %1").arg(uiText(impl_->facade.error())), true);
+ return ok;
+}
+
+bool QmlPlayerBridge::deletePreset(int index) {
+ if (index < 0 || size_t(index) >= impl_->facade.presets().entries().size()) return false;
+ const auto& entry = impl_->facade.presets().entries()[size_t(index)];
+ if (entry.builtin) { emit notice(tr("内置预设不能删除,可以另存一份"), true); return false; }
+ const bool selected = impl_->exportPresetName == entry.name;
+ const bool ok = impl_->facade.presets().erase(size_t(index));
+ if (ok) {
+ if (selected) { impl_->exportPresetName.clear(); emit exportChanged(); }
+ emit presetsChanged();
+ }
+ return ok;
+}
+
+bool QmlPlayerBridge::renamePreset(int index, const QString& name) {
+ if (index < 0 || size_t(index) >= impl_->facade.presets().entries().size()) return false;
+ const bool selected = impl_->exportPresetName == impl_->facade.presets().entries()[size_t(index)].name;
+ const bool ok = impl_->facade.presets().rename(size_t(index), wideOf(name));
+ if (ok) {
+ if (selected) { impl_->exportPresetName = wideOf(name); emit exportChanged(); }
+ emit presetsChanged();
+ }
+ return ok;
+}
+
+QVariantList QmlPlayerBridge::presetSaveParts() const {
+ // What a preset would contain right now, part by part, so the save dialog can
+ // list it before the user names anything. `meaningful` marks the parts that are
+ // not at defaults, which is what makes "will be saved" honest.
+ const auto s = settings();
+ QVariantList out;
+ auto add = [&](const char* id, const QString& label, const QString& summary, bool meaningful) {
+ QVariantMap item;
+ item["id"] = QString::fromUtf8(id);
+ item["label"] = label;
+ item["summary"] = summary;
+ item["meaningful"] = meaningful;
+ out << item;
+ };
+ QStringList chainParts;
+ for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
+ chainParts << uiText(engine::effectInfo(impl_->chain.nodes[i].type).label);
+ add("chain", tr("效果链"),
+ chainParts.isEmpty() ? tr("空") : chainParts.join(QStringLiteral(" → ")),
+ impl_->chain.nodeCount > 0);
+ add("color", tr("色彩"), s.color.enabled ? tr("已启用") : tr("未启用"), s.color.enabled);
+ add("fg", tr("补帧"),
+ s.multiplier > 1 ? QStringLiteral("%1X").arg(s.multiplier) : tr("关闭", "off"),
+ s.multiplier > 1);
+ add("audio", tr("声音"),
+ s.audioOffsetMs != 0 ? tr("偏移 %1 ms").arg(s.audioOffsetMs) : tr("默认"),
+ s.audioOffsetMs != 0);
+ const QStringList flowNames{QStringLiteral("NVIDIA NVOF"), tr("AMD 光流"), QStringLiteral("GPU DIS")};
+ const QStringList qualityNames{tr("性能"), tr("平衡"), tr("质量")};
+ const QStringList cadenceNames{tr("采用源时间戳"), tr("自动识别内容节奏"), tr("识别 30fps 内容"),
+ tr("识别 50fps 内容"), tr("识别 60fps 内容"), tr("采集 60→30(PS5 30 帧)")};
+ QString flowSummary = flowNames.value(int(s.opticalFlowBackend)) + QStringLiteral(" · ") +
+ qualityNames.value(int(s.flow)) + QStringLiteral(" · ") + cadenceNames.value(int(s.content));
+ if (s.opticalFlowBackend == engine::OpticalFlowBackend::AmdFidelityFx && s.amdFlowHalfResolution)
+ flowSummary += QStringLiteral(" · ") + tr("半分辨率");
+ add("flow", tr("光流与内容节奏"), flowSummary,
+ engine::PresetFlowSettings::capture(s) != engine::PresetFlowSettings{});
+ return out;
+}
+
+int QmlPlayerBridge::defaultPresetIndex() const {
+ const auto index = impl_->facade.presets().defaultIndex();
+ return index.has_value() ? int(*index) : -1;
+}
+
+bool QmlPlayerBridge::setDefaultPreset(int index) {
+ if (index < -1 || (index >= 0 && size_t(index) >= impl_->facade.presets().entries().size())) return false;
+ const bool ok = index == -1 ? impl_->facade.presets().clearDefault()
+ : impl_->facade.presets().setDefault(size_t(index));
+ if (ok) emit presetsChanged();
+ else emit notice(tr("默认预设保存失败:") + uiText(impl_->facade.presets().error()), true);
+ return ok;
+}
+
+bool QmlPlayerBridge::duplicatePreset(int index) {
+ if (index < 0 || size_t(index) >= impl_->facade.presets().entries().size()) return false;
+ const bool ok = impl_->facade.presets().duplicate(size_t(index));
+ if (ok) emit presetsChanged();
+ return ok;
+}
+
+void QmlPlayerBridge::refreshRecentFiles() {
+ impl_->facade.refreshRecentFiles();
+ emit recentFilesChanged();
+}
+void QmlPlayerBridge::clearRecentFiles() {
+ // The facade owns the list; clearing it means dropping the entries it holds
+ // and re-persisting, which refreshRecentFiles already does after the fact.
+ impl_->facade.clearRecentFiles();
+ emit recentFilesChanged();
+}
+
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Colour.cpp b/src/ui/bridge/Colour.cpp
new file mode 100644
index 00000000..04beeb24
--- /dev/null
+++ b/src/ui/bridge/Colour.cpp
@@ -0,0 +1,471 @@
+// QML bridge: Colour responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- colour ------------------------------------------------------------------
+double QmlPlayerBridge::colorExposure() const { return selectedColourSettings().exposure; }
+void QmlPlayerBridge::setColorExposure(double v) {
+ setColourParameter(QStringLiteral("exposure"),v);
+}
+double QmlPlayerBridge::colorContrast() const { return selectedColourSettings().contrast; }
+void QmlPlayerBridge::setColorContrast(double v) {
+ setColourParameter(QStringLiteral("contrast"),v);
+}
+double QmlPlayerBridge::colorSaturation() const { return selectedColourSettings().saturation; }
+void QmlPlayerBridge::setColorSaturation(double v) {
+ setColourParameter(QStringLiteral("saturation"),v);
+}
+double QmlPlayerBridge::colorTemperature() const { return selectedColourSettings().temperature; }
+void QmlPlayerBridge::setColorTemperature(double v) {
+ setColourParameter(QStringLiteral("temperature"),v);
+}
+
+void QmlPlayerBridge::resetCurrentPage() {
+ // Reset only the enhancement settings this page edits. Presets, recent files,
+ // the capture session and the export selection are deliberately untouched.
+ auto s = settings();
+ s.nr = false; s.sr = false; s.multiplier = 1;
+ s.lowLatency = false; s.nrTemporal = false;
+ s.nrLayers = {}; s.nrLayerCount = 0;
+ s.model = engine::NrSettings{};
+ s.residual = engine::ResidualSettings{};
+ s.protection = engine::ProtectionSettings{};
+ s.color = engine::ColorSettings{};
+ s.additionalColors = {}; s.additionalColorCount = 0;
+ s.antiAlias = engine::AntiAliasSettings{}; s.additionalAntiAlias = {}; s.additionalAntiAliasCount = 0;
+ s.beauty = engine::BeautySettings{}; s.additionalBeauty = {}; s.additionalBeautyCount = 0; s.beautyDetection = {};
+ s.videoHdr = engine::VideoHdrSettings{};
+ const auto before=impl_->chain; const auto selected=impl_->selectedNr;
+ const auto oldLayout = impl_->layout;
+ const auto selectedColour=impl_->selectedColour;
+ impl_->chain=engine::toChain(s); impl_->selectedNr=-1; impl_->selectedColour=-1;
+ impl_->chain.mode = before.mode;
+ if (before.mode == engine::ChainMode::Node) {
+ engine::removeLegacyNodeProtection(impl_->chain);
+ const auto initialized = impl_->layout.initialize(impl_->chain);
+ if (!initialized.accepted) {
+ impl_->chain = before; impl_->layout = oldLayout;
+ impl_->selectedNr = selected; impl_->selectedColour = selectedColour;
+ emit notice(uiText(initialized.message), true); return;
+ }
+ impl_->initializeDefaultNodePositions();
+ }
+ if(!impl_->revalidate(true)){
+ const auto error=impl_->validation.message;
+ impl_->chain=before;impl_->layout=oldLayout;impl_->selectedNr=selected;impl_->selectedColour=selectedColour;impl_->revalidate();
+ emit notice(uiText(error),true);
+ }
+ emit settingsChanged();
+ emitChainChanged();
+}
+
+
+// --- colour page -------------------------------------------------------------
+// One table of the parameters the engine actually carries, so a control can only
+// exist for a real field, and the UI can build itself from this catalogue.
+namespace {
+struct ColourParam {
+ const char* name;
+ const char* label;
+ const char* group;
+ float minimum, maximum, step;
+};
+// Names match ColorSettings' own members; the mixer bands are indexed.
+const ColourParam kColourParams[] = {
+ {"exposure", "曝光(EV)", "亮", -5, 5, 0.05f},
+ {"contrast", "对比度", "亮", -100, 100, 1},
+ {"highlights", "高光", "亮", -100, 100, 1},
+ {"shadows", "阴影", "亮", -100, 100, 1},
+ {"whites", "白色", "亮", -100, 100, 1},
+ {"blacks", "黑色", "亮", -100, 100, 1},
+ {"texture", "纹理", "效果", -100, 100, 1},
+ {"clarity", "清晰度", "效果", -100, 100, 1},
+ {"dehaze", "去朦胧", "效果", -100, 100, 1},
+ {"temperature", "色温(相对)", "颜色", -100, 100, 1},
+ {"tint", "色调", "颜色", -100, 100, 1},
+ {"vibrance", "自然饱和度", "颜色", -100, 100, 1},
+ {"saturation", "饱和度", "颜色", -100, 100, 1},
+ {"paramHighlights","参数化高光", "曲线", -100, 100, 1},
+ {"paramLights", "参数化亮调", "曲线", -100, 100, 1},
+ {"paramDarks", "参数化暗调", "曲线", -100, 100, 1},
+ {"paramShadows", "参数化阴影", "曲线", -100, 100, 1},
+ {"splitHighlights","分离高光", "曲线", -100, 100, 1},
+ {"splitMidtones", "分离中间调", "曲线", -100, 100, 1},
+ {"splitShadows", "分离阴影", "曲线", -100, 100, 1},
+ {"gradingBlending","混合", "颜色分级", 0, 100, 1},
+ {"gradingBalance","平衡", "颜色分级", -100, 100, 1},
+ {"calibrationShadowTint","阴影色调","校准", -100, 100, 1},
+ {"lutStrength", "LUT 强度", "LUT", 0, 100, 1},
+};
+
+float* colourScalar(engine::ColorSettings& c, const char* name) {
+ const std::string_view n{name};
+ if (n == "exposure") return &c.exposure;
+ if (n == "contrast") return &c.contrast;
+ if (n == "highlights") return &c.highlights;
+ if (n == "shadows") return &c.shadows;
+ if (n == "whites") return &c.whites;
+ if (n == "blacks") return &c.blacks;
+ if (n == "texture") return &c.texture;
+ if (n == "clarity") return &c.clarity;
+ if (n == "dehaze") return &c.dehaze;
+ if (n == "temperature") return &c.temperature;
+ if (n == "tint") return &c.tint;
+ if (n == "vibrance") return &c.vibrance;
+ if (n == "saturation") return &c.saturation;
+ if (n == "paramHighlights") return &c.paramHighlights;
+ if (n == "paramLights") return &c.paramLights;
+ if (n == "paramDarks") return &c.paramDarks;
+ if (n == "paramShadows") return &c.paramShadows;
+ if (n == "splitHighlights") return &c.splitHighlights;
+ if (n == "splitMidtones") return &c.splitMidtones;
+ if (n == "splitShadows") return &c.splitShadows;
+ if (n == "gradingBlending") return &c.gradingBlending;
+ if (n == "gradingBalance") return &c.gradingBalance;
+ if (n == "calibrationShadowTint") return &c.calibrationShadowTint;
+ if (n == "lutStrength") return &c.lutStrength;
+ // Array parameters retain the existing engine units; no UI-only mirrors.
+ const auto parts=QString::fromUtf8(name).split('.');
+ bool ok=false;
+ const int index=parts.size()>=2?parts[1].toInt(&ok):-1;
+ if(!ok||index<0)return nullptr;
+ if(parts.size()==2){
+ if(index<engine::kColorMixerBands){
+ if(parts[0]=="mixerHue")return &c.mixerHue[index];
+ if(parts[0]=="mixerSaturation")return &c.mixerSaturation[index];
+ if(parts[0]=="mixerLuminance")return &c.mixerLuminance[index];
+ if(parts[0]=="blackWhiteMix")return &c.blackWhiteMix[index];
+ }
+ if(index<3){
+ if(parts[0]=="calibrationHue")return &c.calibrationHue[index];
+ if(parts[0]=="calibrationSaturation")return &c.calibrationSaturation[index];
+ }
+ }
+ if(parts.size()==3&&parts[0]=="grading"&&index<engine::kColorGradingZones){
+ if(parts[2]=="hue")return &c.grading[index].hue;
+ if(parts[2]=="saturation")return &c.grading[index].saturation;
+ if(parts[2]=="luminance")return &c.grading[index].luminance;
+ }
+ return nullptr;
+}
+} // namespace
+
+QVariantList QmlPlayerBridge::colourParameters() const {
+ QVariantList out;
+ engine::ColorSettings defaults;
+ for (const auto& p : kColourParams) {
+ QVariantMap item;
+ item["name"] = QString::fromUtf8(p.name);
+ item["label"] = uiText(std::string_view(p.label));
+ item["group"] = uiText(std::string_view(p.group));
+ item["min"] = double(p.minimum);
+ item["max"] = double(p.maximum);
+ item["step"] = double(p.step);
+ if (const auto* value = colourScalar(defaults, p.name)) item["defaultValue"] = double(*value);
+ // Centred controls read their fill from the middle, as the design's sliders
+ // do for anything that can go either way.
+ item["center"] = p.minimum < 0 && p.maximum > 0;
+ out << item;
+ }
+ return out;
+}
+
+QVariantList QmlPlayerBridge::colourGroups() const {
+ // Grouped in catalogue order, so the sections appear in the design's order
+ // rather than in whatever order a hash would produce.
+ QVariantList groups;
+ QStringList order;
+ QHash<QString, QVariantList> buckets;
+ for (const auto& p : kColourParams) {
+ const QString group = uiText(std::string_view(p.group));
+ if (!buckets.contains(group)) order << group;
+ QVariantMap item;
+ item["name"] = QString::fromUtf8(p.name);
+ item["label"] = uiText(std::string_view(p.label));
+ item["min"] = double(p.minimum);
+ item["max"] = double(p.maximum);
+ item["center"] = p.minimum < 0 && p.maximum > 0;
+ buckets[group] << item;
+ }
+ for (const auto& group : order) {
+ QVariantMap entry;
+ entry["group"] = group;
+ entry["items"] = buckets.value(group);
+ groups << entry;
+ }
+ return groups;
+}
+
+double QmlPlayerBridge::colourParameter(const QString& name) const {
+ auto c = selectedColourSettings();
+ const auto utf8 = name.toUtf8();
+ if (float* field = colourScalar(c, utf8.constData())) return double(*field);
+ return 0.0;
+}
+
+bool QmlPlayerBridge::setColourParameter(const QString& name, double value) {
+ if(!std::isfinite(value)){emit notice(tr("调色值必须是有限数值"),true);return false;}
+ auto c = selectedColourSettings();
+ const auto utf8 = name.toUtf8();
+ float* field = colourScalar(c, utf8.constData());
+ if (field == nullptr) return false;
+ const float next = float(value);
+ if (*field == next) return true;
+ *field = next;
+ return commitColour(c);
+}
+
+bool QmlPlayerBridge::resetColourParameter(const QString& name) {
+ engine::ColorSettings defaults;
+ const auto utf8 = name.toUtf8();
+ float* field = colourScalar(defaults, utf8.constData());
+ if (field == nullptr) return false;
+ return setColourParameter(name,*field);
+}
+
+int QmlPlayerBridge::selectedColourLayer() const {return impl_->colourIndex();}
+void QmlPlayerBridge::setSelectedColourLayer(int index){
+ if(index<0||uint32_t(index)>=impl_->chain.nodeCount||
+ impl_->chain.nodes[index].type!=engine::EffectType::Color||impl_->selectedColour==index)return;
+ impl_->selectedColour=index;emit settingsChanged();
+}
+engine::ColorSettings QmlPlayerBridge::selectedColourSettings() const {
+ const int index=impl_->colourIndex();
+ if(index<0)return {};
+ auto colour=impl_->chain.nodes[index].color;
+ colour.enabled=impl_->chain.nodes[index].enabled;
+ return colour;
+}
+bool QmlPlayerBridge::commitColour(const engine::ColorSettings& colour){
+ const int index=impl_->colourIndex();
+ if(index<0){emit notice(tr("处理链中没有调色节点,未更改设置"),true);return false;}
+ if(const auto error=colour.validate();!error.empty()){
+ emit notice(tr("调色参数被拒绝:%1").arg(uiText(error)),true);return false;
+ }
+ auto& node=impl_->chain.nodes[index];
+ if(node.color==colour&&node.enabled==colour.enabled)return true;
+ const auto previous=node;const bool wasValid=chainValid();
+ node.color=colour;node.enabled=colour.enabled;
+ if(!impl_->revalidate(true)){
+ const auto error=impl_->validation.message;node=previous;impl_->revalidate();
+ emit notice(uiText(error),true);emit settingsChanged();return false;
+ }
+ if(!impl_->colourReplaying){
+ const qint64 now=QDateTime::currentMSecsSinceEpoch();
+ const bool sameDrag=index==impl_->colourLastIndex&&now-impl_->colourLastPushMs<600&&!impl_->colourUndo.empty();
+ if(!sameDrag){
+ auto before=previous.color;before.enabled=previous.enabled;
+ impl_->colourUndo.push_back({index,before});
+ if(impl_->colourUndo.size()>64)impl_->colourUndo.erase(impl_->colourUndo.begin());
+ }
+ impl_->colourLastPushMs=now;impl_->colourLastIndex=index;impl_->colourRedo.clear();
+ }
+ emit settingsChanged();
+ if(previous.enabled!=node.enabled)emitChainChanged();else emitParameterChanged(&QmlPlayerBridge::colourParamsChanged,wasValid);
+ return true;
+}
+QVariantMap QmlPlayerBridge::colourState() const { return colourStateAt(impl_->colourIndex()); }
+// Any colour node's full state, so several node cards can show their own
+// values at once; edits still go through the selected-layer setters.
+QVariantMap QmlPlayerBridge::colourStateAt(int index) const {
+ engine::ColorSettings c{};
+ if(index>=0&&uint32_t(index)<impl_->chain.nodeCount&&impl_->chain.nodes[index].type==engine::EffectType::Color){
+ c=impl_->chain.nodes[index].color;c.enabled=impl_->chain.nodes[index].enabled;
+ }else index=-1;
+ QVariantMap out;
+ out["index"]=index;out["enabled"]=c.enabled;
+ out["blackWhite"]=c.blackWhite;out["groupBypassMask"]=int(c.groupBypassMask);
+ for(const auto& p:kColourParams)out[QString::fromUtf8(p.name)]=double(*colourScalar(c,p.name));
+ const auto list=[](const auto& values){QVariantList out;for(const auto v:values)out<<double(v);return out;};
+ out["mixerHue"]=list(c.mixerHue);out["mixerSaturation"]=list(c.mixerSaturation);
+ out["mixerLuminance"]=list(c.mixerLuminance);out["blackWhiteMix"]=list(c.blackWhiteMix);
+ out["calibrationHue"]=list(c.calibrationHue);out["calibrationSaturation"]=list(c.calibrationSaturation);
+ QVariantList curves,wheels,samples;
+ for(const auto& curve:c.curves){
+ QVariantList points;
+ for(int i=0;i<curve.count;++i)points<<QVariantMap{{"x",double(curve.points[i].x)},{"y",double(curve.points[i].y)}};
+ curves<<QVariant(points);
+ QVariantList values;
+ for(int i=0;i<=128;++i)values<<double(pipeline::ColorGradeTables::curveValue(curve,float(i)/128.0f));
+ samples<<QVariant(values);
+ }
+ for(const auto& wheel:c.grading)wheels<<QVariantMap{{"hue",double(wheel.hue)},
+ {"saturation",double(wheel.saturation)},{"luminance",double(wheel.luminance)}};
+ out["curves"]=curves;out["curveSamples"]=samples;out["grading"]=wheels;
+ out["lutName"]=QString::fromStdWString(c.lutNameString());out["lutInputSpace"]=c.lutInputSpace;
+ return out;
+}
+bool QmlPlayerBridge::setColourCurve(int channel,const QVariantList& points){
+ if(channel<0||channel>=4||points.size()<2||points.size()>engine::kColorCurvePoints)return false;
+ auto c=selectedColourSettings();auto& curve=c.curves[channel];curve.reset();curve.count=int(points.size());
+ for(int i=0;i<curve.count;++i){
+ const auto point=points[i].toMap();bool xok=false,yok=false;
+ const double x=point.value("x").toDouble(&xok),y=point.value("y").toDouble(&yok);
+ if(!xok||!yok||!std::isfinite(x)||!std::isfinite(y))return false;
+ curve.points[i]={float(x),float(y)};
+ }
+ return commitColour(c);
+}
+bool QmlPlayerBridge::setColourOption(const QString& name,int value){
+ auto c=selectedColourSettings();
+ if(name=="blackWhite"&&(value==0||value==1))c.blackWhite=value!=0;
+ else if(name=="groupBypassMask"&&value>=0&&value<128)c.groupBypassMask=uint32_t(value);
+ else if(name=="lutInputSpace"&&value>=0&&value<=2)c.lutInputSpace=value;
+ else return false;
+ return commitColour(c);
+}
+bool QmlPlayerBridge::setColourWheel(int zone,double hue,double saturation,double luminance){
+ if(zone<0||zone>=engine::kColorGradingZones||!std::isfinite(hue)||
+ !std::isfinite(saturation)||!std::isfinite(luminance))return false;
+ auto c=selectedColourSettings();c.grading[zone]={float(hue),float(saturation),float(luminance)};
+ return commitColour(c);
+}
+bool QmlPlayerBridge::resetColourGroup(int group){
+ auto c=selectedColourSettings();const engine::ColorSettings d;
+ switch(group){
+ case -1:{const bool enabled=c.enabled;c=d;c.enabled=enabled;break;}
+ case 0:c.exposure=c.contrast=c.highlights=c.shadows=c.whites=c.blacks=0;break;
+ case 1:c.temperature=c.tint=c.vibrance=c.saturation=0;break;
+ case 2:c.paramHighlights=c.paramLights=c.paramDarks=c.paramShadows=0;c.curves=d.curves;
+ c.splitHighlights=c.splitMidtones=c.splitShadows=0;break;
+ case 3:c.mixerHue=d.mixerHue;c.mixerSaturation=d.mixerSaturation;c.mixerLuminance=d.mixerLuminance;
+ c.blackWhite=d.blackWhite;c.blackWhiteMix=d.blackWhiteMix;break;
+ case 4:c.grading=d.grading;c.gradingBlending=d.gradingBlending;c.gradingBalance=0;break;
+ case 5:c.calibrationShadowTint=0;c.calibrationHue=d.calibrationHue;c.calibrationSaturation=d.calibrationSaturation;break;
+ case 6:c.clearLut();c.lutStrength=d.lutStrength;c.lutInputSpace=d.lutInputSpace;break;
+ case 7:c.texture=c.clarity=c.dehaze=0;break;
+ default:return false;
+ }
+ if(group>=0&&group<7)c.groupBypassMask&=~(1u<<group);
+ return commitColour(c);
+}
+
+// --- LUT library and colour looks (P4-g) ------------------------------------
+// LUTs go to the folder the engine and the export worker resolve by name
+// (runtime_local/luts); looks are user data beside the presets.
+QVariantList QmlPlayerBridge::lutLibrary() const {
+ QVariantList out;
+ const engine::ColorLutStore store(runtime::localDataDirectory());
+ for (const auto& name : store.list()) out << QString::fromStdWString(name);
+ return out;
+}
+QVariantList QmlPlayerBridge::colourLooks() const {
+ engine::ColorLookStore store(impl_->dataDir);
+ QVariantList out;
+ if (!store.load()) return out;
+ for (size_t i = 0; i < store.entries().size(); ++i) {
+ const auto& look = store.entries()[i];
+ out << QVariantMap{{"index", int(i)}, {"name", QString::fromStdWString(look.name)},
+ {"lut", QString::fromStdWString(look.color.lutNameString())}};
+ }
+ return out;
+}
+void QmlPlayerBridge::importLutDialog() {
+ const QString path = QFileDialog::getOpenFileName(nullptr, tr("导入 .cube LUT"), QString(),
+ tr("Cube LUT (*.cube);;所有文件 (*.*)"));
+ if (!path.isEmpty()) importLut(path);
+}
+bool QmlPlayerBridge::importLut(const QString& path) {
+ if (impl_->colourIndex() < 0) { emit notice(tr("处理链中没有调色节点,无法使用 LUT"), true); return false; }
+ const engine::ColorLutStore store(runtime::localDataDirectory());
+ std::wstring name; std::string error;
+ if (!store.importFile(std::filesystem::path(path.toStdWString()), name, error) || name.empty()) {
+ veyra::log::warn("ui-colour", std::format("lut import rejected path={} error={}", path.toStdString(), error));
+ emit notice(tr("LUT 导入失败:%1").arg(QString::fromStdString(error)), true);
+ return false;
+ }
+ veyra::log::info("ui-colour", std::format("lut imported name={}", QString::fromStdWString(name).toStdString()));
+ emit colourLibraryChanged();
+ const bool applied = setColourLut(QString::fromStdWString(name));
+ if (applied) emit notice(tr("已导入并使用 LUT:%1").arg(QString::fromStdWString(name)), false);
+ return applied;
+}
+bool QmlPlayerBridge::setColourLut(const QString& name) {
+ auto c = selectedColourSettings();
+ if (name.isEmpty()) { c.clearLut(); return commitColour(c); }
+ const engine::ColorLutStore store(runtime::localDataDirectory());
+ engine::ColorLutData data;
+ if (!store.validName(name.toStdWString()) || !store.resolve(name.toStdWString(), data) || !data.valid()) {
+ emit notice(tr("LUT 不可用:%1").arg(name), true);
+ return false;
+ }
+ if (!c.setLutName(name.toStdWString())) { emit notice(tr("LUT 名称过长"), true); return false; }
+ if (c.lutStrength <= 0.0f) c.lutStrength = 100.0f;
+ c.enabled = true;
+ return commitColour(c);
+}
+bool QmlPlayerBridge::saveColourLook(const QString& name, bool replace) {
+ const QString trimmed = name.trimmed();
+ if (trimmed.isEmpty() || trimmed.size() > 48) { emit notice(tr("颜色预设名称需为 1–48 个字符"), true); return false; }
+ if (impl_->colourIndex() < 0) { emit notice(tr("处理链中没有调色节点"), true); return false; }
+ engine::ColorLookStore store(impl_->dataDir);
+ if (!store.load()) { emit notice(tr("颜色预设库无法读取:%1").arg(veyra::ui::i18n::text(store.error())), true); return false; }
+ const bool exists = std::any_of(store.entries().begin(), store.entries().end(),
+ [&](const auto& e) { return e.name == trimmed.toStdWString(); });
+ if (exists && !replace) { emit notice(tr("已存在同名颜色预设"), true); return false; }
+ auto colour = selectedColourSettings(); colour.enabled = true;
+ if (!store.put(trimmed.toStdWString(), colour, replace) || !store.save()) {
+ emit notice(tr("颜色预设保存失败:%1").arg(veyra::ui::i18n::text(store.error())), true); return false;
+ }
+ veyra::log::info("ui-colour", std::format("look saved name={} layer={}", trimmed.toStdString(), impl_->colourIndex()));
+ emit colourLibraryChanged();
+ emit notice(tr("已保存颜色预设:%1").arg(trimmed), false);
+ return true;
+}
+bool QmlPlayerBridge::applyColourLook(int index) {
+ engine::ColorLookStore store(impl_->dataDir);
+ if (!store.load() || index < 0 || size_t(index) >= store.entries().size()) {
+ emit notice(tr("颜色预设不存在"), true); return false;
+ }
+ auto colour = store.entries()[size_t(index)].color; colour.enabled = true;
+ if (colour.hasLut()) {
+ const engine::ColorLutStore luts(runtime::localDataDirectory());
+ engine::ColorLutData data;
+ if (!luts.resolve(colour.lutNameString(), data)) {
+ emit notice(tr("预设引用的 LUT 不存在:%1,未应用").arg(QString::fromStdWString(colour.lutNameString())), true);
+ return false;
+ }
+ }
+ const bool ok = commitColour(colour);
+ veyra::log::info("ui-colour", std::format("look applied index={} layer={} ok={}", index, impl_->colourIndex(), ok));
+ return ok;
+}
+bool QmlPlayerBridge::deleteColourLook(int index) {
+ engine::ColorLookStore store(impl_->dataDir);
+ if (!store.load() || index < 0 || !store.erase(size_t(index)) || !store.save()) {
+ emit notice(tr("删除颜色预设失败"), true); return false;
+ }
+ emit colourLibraryChanged();
+ return true;
+}
+void QmlPlayerBridge::importColourLookDialog() {
+ const QString path = QFileDialog::getOpenFileName(nullptr, tr("导入颜色预设"), QString(),
+ tr("Veyra 颜色预设 (*.vpcolor);;所有文件 (*.*)"));
+ if (!path.isEmpty()) importColourLook(path);
+}
+bool QmlPlayerBridge::importColourLook(const QString& path) {
+ engine::ColorLookStore store(impl_->dataDir);
+ std::wstring name;
+ if (!store.load() || !store.importFile(std::filesystem::path(path.toStdWString()), name)) {
+ emit notice(tr("导入颜色预设失败:%1").arg(veyra::ui::i18n::text(store.error())), true); return false;
+ }
+ emit colourLibraryChanged();
+ emit notice(tr("已导入颜色预设:%1").arg(QString::fromStdWString(name)), false);
+ return true;
+}
+void QmlPlayerBridge::exportColourLookDialog(int index) {
+ const QString path = QFileDialog::getSaveFileName(nullptr, tr("导出颜色预设"), QString(),
+ tr("Veyra 颜色预设 (*.vpcolor)"));
+ if (!path.isEmpty()) exportColourLook(index, path);
+}
+bool QmlPlayerBridge::exportColourLook(int index, const QString& path) {
+ engine::ColorLookStore store(impl_->dataDir);
+ if (!store.load() || index < 0 || !store.exportFile(size_t(index), std::filesystem::path(path.toStdWString()))) {
+ emit notice(tr("导出颜色预设失败:%1").arg(veyra::ui::i18n::text(store.error())), true); return false;
+ }
+ emit notice(tr("已导出颜色预设"), false);
+ return true;
+}
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Enhancement.cpp b/src/ui/bridge/Enhancement.cpp
new file mode 100644
index 00000000..f2ddd123
--- /dev/null
+++ b/src/ui/bridge/Enhancement.cpp
@@ -0,0 +1,1175 @@
+// QML bridge: Enhancement responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- settings ---------------------------------------------------------------
+
+#define VEYRA_BOOL_PROP(getter, setter, member) \
+ bool QmlPlayerBridge::getter() const { return settings().member; } \
+ void QmlPlayerBridge::setter(bool value) { \
+ auto s = settings(); \
+ if (s.member == value) return; \
+ s.member = value; \
+ impl_->commit(std::move(s)); \
+ emit settingsChanged(); \
+ }
+#define VEYRA_NUM_PROP(getter, setter, member, type) \
+ type QmlPlayerBridge::getter() const { return type(settings().member); } \
+ void QmlPlayerBridge::setter(type value) { \
+ auto s = settings(); \
+ if (type(s.member) == value) return; \
+ s.member = value; \
+ impl_->commit(std::move(s)); \
+ emit settingsChanged(); \
+ }
+
+int QmlPlayerBridge::videoSrQuality() const { return int(settings().videoSrQuality); }
+int QmlPlayerBridge::dlssSrModel() const { return int(settings().dlssSrModel); }
+QVariantList QmlPlayerBridge::dlssSrModelChoices() const {
+ return {QVariantMap{{"id", "0"}, {"label", "DLSS 4 · K"}},
+ QVariantMap{{"id", "1"}, {"label", "DLSS 4.5 · M"}},
+ QVariantMap{{"id", "2"}, {"label", "DLSS 4.5 · L"}}};
+}
+void QmlPlayerBridge::setDlssSrModel(int value) {
+ if (value < 0 || unsigned(value) >= engine::kDlssSrModelCount) return;
+ const auto cap = effectCapabilities().value("sr0").toMap();
+ if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return; }
+ auto s = settings();
+ if (s.dlssSrModel == unsigned(value)) return;
+ s.dlssSrModel = unsigned(value);
+ if (impl_->commit(s)) emit settingsChanged();
+}
+void QmlPlayerBridge::setVideoSrQuality(int value) {
+ if (value < 0 || value > 5) return;
+ const auto cap = effectCapabilities().value("sr" + QString::number(value)).toMap();
+ if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return; }
+ auto s = settings();
+ if (int(s.videoSrQuality) == value) return;
+ s.videoSrQuality = unsigned(value);
+ if (impl_->commit(s)) emit settingsChanged();
+}
+int QmlPlayerBridge::audioOffsetMs() const { return settings().audioOffsetMs; }
+void QmlPlayerBridge::setAudioOffsetMs(int value) {
+ auto s = settings();
+ if (s.audioOffsetMs == value) return;
+ s.audioOffsetMs = value;
+ if (!impl_->commit(std::move(s))) return;
+ impl_->prefs[QStringLiteral("audioOffsetMs")] = value;
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "audio offset not saved");
+ emit settingsChanged();
+}
+#undef VEYRA_BOOL_PROP
+#undef VEYRA_NUM_PROP
+
+// Stage-owned properties must change the authoritative chain first. commit()
+// projects that chain back to settings, so setting only a flat mirror is a no-op.
+bool QmlPlayerBridge::srEnabled() const {
+ const auto* node = impl_->chain.firstOf(engine::EffectType::SuperResolution);
+ return node && node->enabled;
+}
+void QmlPlayerBridge::setSrEnabled(bool enabled) {
+ for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
+ if (impl_->chain.nodes[i].type == engine::EffectType::SuperResolution) {
+ setEffectEnabled(int(i), enabled); return;
+ }
+ if (enabled) emit notice(tr("请先添加超分节点"), true);
+}
+bool QmlPlayerBridge::videoHdr() const {
+ const auto* node = impl_->chain.firstOf(engine::EffectType::VideoHdr);
+ return node && node->enabled;
+}
+// Custom: static HDR output tuning. Globals, not chain nodes, and every field is
+// live (the curve is read by the present blit, the metadata sent to the display),
+// so a change never rebuilds the graph - but it does have to reach the session
+// file, which has no other trigger for a global change.
+int QmlPlayerBridge::hdrCurveStrength()const{return int(settings().hdrCurve.strengthPercent);}
+void QmlPlayerBridge::setHdrCurveStrength(int percent){
+ auto s=settings();
+ const unsigned clamped=unsigned(std::clamp(percent,0,200));
+ if(s.hdrCurve.strengthPercent==clamped)return;
+ s.hdrCurve.strengthPercent=clamped;
+ commitHdrTuning(std::move(s));
+}
+int QmlPlayerBridge::hdrDisplayPeakNits()const{return int(settings().hdrCurve.displayPeakNits);}
+void QmlPlayerBridge::setHdrDisplayPeakNits(int nits){
+ auto s=settings();
+ // 0 = ask the system; anything else has to be a plausible panel peak.
+ const int clamped=nits<=0?0:std::clamp(nits,100,10000);
+ if(s.hdrCurve.displayPeakNits==unsigned(clamped))return;
+ s.hdrCurve.displayPeakNits=unsigned(clamped);
+ commitHdrTuning(std::move(s));
+}
+QVariantMap QmlPlayerBridge::hdrDisplayInfo()const{
+ // Read from QML bindings (the peak row's hint text), so no driver work here:
+ // the values come from the shared display state, queried in the background on
+ // events and 刷新显示器状态 (this used to build a DXGI factory every 5 s on the
+ // UI thread).
+ HWND window=impl_->videoWindow;
+ if(!IsWindow(window)){
+ if(auto* focused=QGuiApplication::focusWindow())window=reinterpret_cast<HWND>(focused->winId());
+ else window=nullptr;
+ }
+ auto& displays=impl_->engine.displayStates();
+ std::optional<engine::DisplayState> known;
+ if(window){displays.request(window,"ui");known=displays.state(displays.monitorOf(window));}
+ const engine::DisplayColorState c=known?known->color:engine::DisplayColorState{};
+ return {{"valid",c.peakValid},{"plausible",c.peakValid},{"peakNits",int(c.peakNits)},
+ {"fullFrameNits",int(c.fullFrameNits)},{"minNits",c.minNits}};
+}
+bool QmlPlayerBridge::hdrCurve()const{return settings().hdrCurve.enabled;}
+void QmlPlayerBridge::setHdrCurve(bool enabled){
+ auto s=settings();if(s.hdrCurve.enabled==enabled)return;s.hdrCurve.enabled=enabled;
+ commitHdrTuning(std::move(s));
+}
+QVariantMap QmlPlayerBridge::hdrCurveParams()const{
+ const auto& c=settings().hdrCurve;
+ return {{"shadowLiftEv100",int(c.shadowLiftEv100)},{"shadowRangeNits",int(c.shadowRangeNits)},
+ {"midGrayNits",int(c.midGrayNits)},{"highlightStartNits",int(c.highlightStartNits)},
+ {"rollOffPercent",int(c.rollOffPercent)},{"peakCapNits",int(c.peakCapNits)}};
+}
+bool QmlPlayerBridge::setHdrCurveParameter(const QString& key,double value){
+ if(!std::isfinite(value)||value<-10001||value>10001)return false;
+ auto s=settings();const auto v=int(std::lround(value));
+ if(key=="shadowLiftEv100"){if(v<-200||v>200)return false;s.hdrCurve.shadowLiftEv100=v;}
+ else if(key=="shadowRangeNits"){if(v<1||v>100)return false;s.hdrCurve.shadowRangeNits=unsigned(v);}
+ else if(key=="midGrayNits"){if(v<100||v>500)return false;s.hdrCurve.midGrayNits=unsigned(v);}
+ else if(key=="highlightStartNits"){if(v<0||v>2000)return false;s.hdrCurve.highlightStartNits=unsigned(v);}
+ else if(key=="rollOffPercent"){if(v<10||v>200)return false;s.hdrCurve.rollOffPercent=unsigned(v);}
+ else if(key=="peakCapNits"){if(v<0||v>4000)return false;s.hdrCurve.peakCapNits=unsigned(v);}
+ else return false;
+ if(!s.hdrCurve.valid())return false;
+ return commitHdrTuning(std::move(s));
+}
+bool QmlPlayerBridge::commitHdrTuning(engine::EnhancementSettings settings){
+ const bool wasValid=chainValid();
+ const auto curve=settings.hdrCurve;
+ const auto metadata=settings.hdrMetadata;
+ if(!impl_->commit(std::move(settings)))return false;
+ // Re-project first, then re-assert both copies the session capture reads:
+ // revalidate() rewrites the pending settings and the draft globals from the
+ // runtime configuration, which does not carry this block yet.
+ impl_->revalidate(true);
+ auto after=impl_->facade.pendingSettings();
+ after.hdrCurve=curve;after.hdrMetadata=metadata;
+ impl_->facade.setPending(after);
+ impl_->draftGlobals.hdrCurve=curve;impl_->draftGlobals.hdrMetadata=metadata;
+ impl_->persistSession();
+ if(!impl_->hdrRestoring&&impl_->hdrMemorySaveTimer){impl_->hdrMemoryDirty=true;impl_->hdrMemorySaveTimer->start();}
+ emit settingsChanged();
+ if(chainValid()!=wasValid)emitChainChanged();
+ return true;
+}
+QString QmlPlayerBridge::hdrTuningPreset() const {
+ const auto& s=settings();
+ // hdrPresetMatches deliberately ignores the strength dial and the display peak:
+ // they only scale the baseline, so turning them keeps you on the same preset.
+ for(const auto& p:engine::kHdrTuningPresets)
+ if(engine::hdrPresetMatches(s.hdrCurve,s.hdrMetadata,p))return QString::fromLatin1(p.id);
+ return QStringLiteral("custom");
+}
+QString QmlPlayerBridge::hdrAppliedFrom() const {
+ return impl_->prefString("hdrAppliedFrom")==QLatin1String("axes")?QStringLiteral("axes")
+ :QStringLiteral("legacy");
+}
+
+void QmlPlayerBridge::setHdrAppliedFrom(const QString& from){
+ const QString wanted=from==QLatin1String("axes")?QStringLiteral("axes"):QStringLiteral("legacy");
+ if(impl_->prefString("hdrAppliedFrom")==wanted)return;
+ impl_->prefs[QStringLiteral("hdrAppliedFrom")]=wanted;
+ impl_->savePrefs();
+ emit preferencesChanged();
+}
+
+QString QmlPlayerBridge::hdrPresetMode() const {
+ return impl_->prefString("hdrPresetMode")==QLatin1String("axes")?QStringLiteral("axes")
+ :QStringLiteral("legacy");
+}
+
+void QmlPlayerBridge::setHdrPresetMode(const QString& mode){
+ const QString wanted=mode==QLatin1String("axes")?QStringLiteral("axes"):QStringLiteral("legacy");
+ if(impl_->prefString("hdrPresetMode")==wanted)return;
+ impl_->prefs[QStringLiteral("hdrPresetMode")]=wanted;
+ if(!impl_->savePrefs())veyra::log::warn("ui-prefs","hdr preset mode not saved");
+ emit preferencesChanged();
+}
+
+QVariantMap QmlPlayerBridge::hdrAxes() const {
+ auto environment=impl_->prefString("hdrAxesEnvironment");
+ if(environment==QLatin1String("bright"))environment=QStringLiteral("compensate");
+ else if(environment==QLatin1String("dark"))environment=QStringLiteral("plain");
+ return {{"content",impl_->prefString("hdrAxesContent")},
+ {"environment",environment}};
+}
+
+QVariantMap QmlPlayerBridge::hdrAxesMatch() const {
+ // Which combination the curve currently equals. Strength and the display peak are
+ // ignored, exactly like hdrPresetMatches: they only scale the baseline.
+ const auto& c=settings().hdrCurve;
+ for(const auto& content:engine::kHdrContentPresets)
+ for(const auto* environment:engine::kHdrEnvironmentIds){
+ const auto candidate=engine::hdrAxesCurve(content.id,environment);
+ if(c.enabled==candidate.enabled&&c.shadowLiftEv100==candidate.shadowLiftEv100&&
+ c.shadowRangeNits==candidate.shadowRangeNits&&c.midGrayNits==candidate.midGrayNits&&
+ c.highlightStartNits==candidate.highlightStartNits&&c.rollOffPercent==candidate.rollOffPercent&&
+ c.peakCapNits==candidate.peakCapNits)
+ return {{"content",QString::fromLatin1(content.id)},{"environment",QString::fromLatin1(environment)}};
+ }
+ return {{"content",QString()},{"environment",QString()}};
+}
+
+QVariantMap QmlPlayerBridge::hdrCurveCoverage() const {
+ const auto& snap=impl_->snapshot;
+ return {{"valid",impl_->hdrCoverageObserved&&hdrCurve()&&snap.hdrCoverageValid},
+ {"aboveCeiling",snap.hdrAboveCeilingPercent},
+ {"rollOff",snap.hdrInRollOffPercent},
+ {"lift",snap.hdrInLiftPercent}};
+}
+
+void QmlPlayerBridge::observeHdrCoverage(bool on){if(impl_->hdrCoverageObserved==on)return;impl_->hdrCoverageObserved=on;impl_->engine.observeHdrCoverage(on);emit snapshotChanged();}
+QVariantMap QmlPlayerBridge::hdrCurveGraph() const {
+ auto base=settings().hdrCurve;if(!base.displayPeakNits)base.displayPeakNits=effectiveHdrDisplayPeakNits();
+ engine::HdrCurveSettings c;engine::HdrMetadataSettings metadata;
+ engine::resolveHdrTuning(base,settings().hdrMetadata,c,metadata);
+ QVariantList inputs,outputs;
+ for(unsigned i=0;i<engine::kHdrCurveGraphPoints;++i){
+ const double x=engine::hdrCurveGraphInputNits(i);
+ inputs.append(x);
+ outputs.append(c.enabled?engine::hdrCurveLuminance(c,x):x);
+ }
+ return {{"inputs",inputs},{"outputs",outputs},
+ {"minNits",engine::kHdrCurveGraphMinNits},{"maxNits",engine::kHdrCurveGraphMaxNits},
+ {"enabled",c.enabled}};
+}
+
+QVariantMap QmlPlayerBridge::hdrDials() const {
+ const auto& c=settings().hdrCurve;
+ return {{"shadowLift",int(engine::hdrShadowLiftLevel(c))},
+ {"brightness",int(engine::hdrBrightnessLevel(c))},
+ {"highlight",int(engine::hdrHighlightLevel(c))}};
+}
+
+bool QmlPlayerBridge::setHdrDial(const QString& key,int level){
+ if(level<0)return false;
+ auto s=settings();
+ const unsigned value=unsigned(level);
+ if(key==QLatin1String("shadowLift"))engine::setHdrShadowLiftLevel(s.hdrCurve,value);
+ else if(key==QLatin1String("brightness"))engine::setHdrBrightnessLevel(s.hdrCurve,value);
+ else if(key==QLatin1String("highlight"))engine::setHdrHighlightLevel(s.hdrCurve,value);
+ else return false;
+ return commitHdrTuning(std::move(s));
+}
+
+bool QmlPlayerBridge::applyHdrAxesPreset(const QString& content,const QString& environment){
+ const QByteArray contentId=content.toUtf8();
+ const QString normalizedEnvironment=environment==QLatin1String("bright")?QStringLiteral("compensate")
+ :environment==QLatin1String("dark")?QStringLiteral("plain"):environment;
+ const QByteArray environmentId=normalizedEnvironment.toUtf8();
+ if(!engine::findHdrContentPreset(contentId.constData())||
+ (normalizedEnvironment!=QLatin1String("compensate")&&normalizedEnvironment!=QLatin1String("plain")))return false;
+ const auto curve=engine::hdrAxesCurve(contentId.constData(),environmentId.constData());
+ auto s=settings();
+ // The strength dial and the display peak belong to the user, not to the preset.
+ const auto strength=s.hdrCurve.strengthPercent;
+ const auto displayPeak=s.hdrCurve.displayPeakNits;
+ s.hdrCurve=curve;
+ s.hdrCurve.strengthPercent=strength;
+ s.hdrCurve.displayPeakNits=displayPeak;
+ if(!commitHdrTuning(std::move(s)))return false;
+ setHdrAppliedFrom(QStringLiteral("axes"));
+ impl_->prefs[QStringLiteral("hdrAxesContent")]=content;
+ impl_->prefs[QStringLiteral("hdrAxesEnvironment")]=normalizedEnvironment;
+ if(!impl_->savePrefs())veyra::log::warn("ui-prefs","hdr axes choice not saved");
+ emit preferencesChanged();
+ return true;
+}
+
+bool QmlPlayerBridge::hdrTitleMemory() const { return impl_->prefBool("hdrTitleMemory",true); }
+bool QmlPlayerBridge::hdrAutoRecommend() const { return impl_->prefBool("hdrAutoRecommend",false); }
+int QmlPlayerBridge::hdrTitleCount() const {
+ return impl_->prefs.value(QStringLiteral("hdrTitles")).toList().size();
+}
+
+void QmlPlayerBridge::setHdrTitleMemory(bool on){
+ if(impl_->prefBool("hdrTitleMemory",true)==on)return;
+ impl_->prefs[QStringLiteral("hdrTitleMemory")]=on;
+ if(!impl_->savePrefs())veyra::log::warn("ui-prefs","hdr title memory flag not saved");
+ emit preferencesChanged();
+}
+
+void QmlPlayerBridge::setHdrAutoRecommend(bool on){
+ if(impl_->prefBool("hdrAutoRecommend",false)==on)return;
+ impl_->prefs[QStringLiteral("hdrAutoRecommend")]=on;
+ if(!impl_->savePrefs())veyra::log::warn("ui-prefs","hdr auto recommend flag not saved");
+ emit preferencesChanged();
+}
+
+void QmlPlayerBridge::forgetHdrTitles(){
+ flushHdrMemory();
+ impl_->prefs[QStringLiteral("hdrTitles")]=QVariantList{};
+ if(!impl_->savePrefs())veyra::log::warn("ui-prefs","hdr title profiles not cleared");
+ emit preferencesChanged();
+ emit notice(tr("已清除影片记忆"),false);
+}
+
+void QmlPlayerBridge::flushHdrMemory(){
+ if(impl_->hdrMemorySaveTimer)impl_->hdrMemorySaveTimer->stop();
+ if(impl_->hdrRestoring||!impl_->hdrMemoryDirty)return;
+ impl_->hdrMemoryDirty=false;
+ if(!impl_->hdrProfileDisplay.isEmpty())storeHdrProfile(impl_->hdrProfileDisplay);
+ if(hdrTitleMemory()&&!impl_->hdrTitleApplied.isEmpty())storeHdrTitleProfile(impl_->hdrTitleApplied);
+}
+void QmlPlayerBridge::syncHdrTitleProfile(){
+ auto& i=*impl_;
+ if(!i.snapshot.running||i.openingSource)return;
+ const QFileInfo file(QString::fromStdWString(i.sourceLabel));
+ if(!file.isFile())return; // Capture/stream labels are not film identities.
+ const QString title=file.canonicalFilePath();
+ if(title.isEmpty()||title==i.hdrTitleApplied)return;
+ flushHdrMemory();i.hdrTitleApplied=title;
+ if(hdrTitleMemory()&&loadHdrTitleProfile(title)){
+ emit notice(tr("已套用这部影片上次的曲线设置"),false);return;
+ }
+ if(hdrAutoRecommend()&&settings().hdrCurve.enabled){QScopedValueRollback<bool> restoring(i.hdrRestoring,true);applyRecommendedHdrTuning();}
+}
+
+bool QmlPlayerBridge::loadHdrTitleProfile(const QString& title){
+ const auto list=impl_->prefs.value(QStringLiteral("hdrTitles")).toList();
+ for(const auto& item:list){
+ const auto stored=item.toMap();
+ if(stored.value(QStringLiteral("key")).toString()!=title)continue;
+ auto s=settings();
+ const auto number=[&](const char* key,int fallback){
+ return stored.contains(QLatin1String(key))?stored.value(QLatin1String(key)).toInt():fallback;};
+ s.hdrCurve.enabled=stored.value(QStringLiteral("enabled"),s.hdrCurve.enabled).toBool();
+ s.hdrCurve.shadowLiftEv100=number("shadowLiftEv100",int(s.hdrCurve.shadowLiftEv100));
+ s.hdrCurve.shadowRangeNits=unsigned(std::clamp(number("shadowRangeNits",int(s.hdrCurve.shadowRangeNits)),1,100));
+ s.hdrCurve.midGrayNits=unsigned(std::clamp(number("midGrayNits",int(s.hdrCurve.midGrayNits)),100,500));
+ s.hdrCurve.highlightStartNits=unsigned(std::clamp(number("highlightStartNits",int(s.hdrCurve.highlightStartNits)),0,2000));
+ s.hdrCurve.rollOffPercent=unsigned(std::clamp(number("rollOffPercent",int(s.hdrCurve.rollOffPercent)),10,200));
+ s.hdrCurve.peakCapNits=unsigned(std::clamp(number("peakCapNits",int(s.hdrCurve.peakCapNits)),0,4000));
+ s.hdrCurve.strengthPercent=unsigned(std::clamp(number("strengthPercent",int(s.hdrCurve.strengthPercent)),0,200));
+ QScopedValueRollback<bool> restoring(impl_->hdrRestoring,true);
+ return commitHdrTuning(std::move(s));
+ }
+ return false;
+}
+
+bool QmlPlayerBridge::storeHdrTitleProfile(const QString& title){
+ if(title.isEmpty()||!hdrTitleMemory())return false;
+ auto& i=*impl_;
+ const auto& c=settings().hdrCurve;
+ QVariantMap entry;
+ entry[QStringLiteral("key")]=title;
+ entry[QStringLiteral("enabled")]=c.enabled;
+ entry[QStringLiteral("shadowLiftEv100")]=int(c.shadowLiftEv100);
+ entry[QStringLiteral("shadowRangeNits")]=int(c.shadowRangeNits);
+ entry[QStringLiteral("midGrayNits")]=int(c.midGrayNits);
+ entry[QStringLiteral("highlightStartNits")]=int(c.highlightStartNits);
+ entry[QStringLiteral("rollOffPercent")]=int(c.rollOffPercent);
+ entry[QStringLiteral("peakCapNits")]=int(c.peakCapNits);
+ entry[QStringLiteral("strengthPercent")]=int(c.strengthPercent);
+ auto list=i.prefs.value(QStringLiteral("hdrTitles")).toList();
+ for(const auto& item:list)if(item.toMap().value(QStringLiteral("key")).toString()==title&&item.toMap()==entry)return false;
+ for(int n=list.size()-1;n>=0;--n)
+ if(list[n].toMap().value(QStringLiteral("key")).toString()==title)list.removeAt(n);
+ list.append(entry);
+ // Bounded list: the oldest titles fall off the front.
+ while(list.size()>i.kHdrTitleProfileLimit)list.removeFirst();
+ i.prefs[QStringLiteral("hdrTitles")]=list;
+ if(!i.savePrefs())veyra::log::warn("ui-prefs","hdr title profile not saved");
+ emit preferencesChanged();return true;
+}
+
+int QmlPlayerBridge::hdrDisplayProfileCount() const {
+ return impl_->prefs.value(QStringLiteral("hdrProfiles")).toMap().size();
+}
+
+QString QmlPlayerBridge::hdrDisplayProfileId() const {
+ // The EDID-based device id survives cable and port changes; the GDI device name
+ // is the fallback for monitors that report none. Both are cheap Win32 calls -
+ // no DXGI enumeration, so this stays safe on the snapshot cadence.
+ HWND window=impl_->videoWindow;
+ if(!IsWindow(window)){
+ if(auto* focused=QGuiApplication::focusWindow())window=reinterpret_cast<HWND>(focused->winId());
+ else window=nullptr;
+ }
+ const HMONITOR monitor=window?MonitorFromWindow(window,MONITOR_DEFAULTTONEAREST)
+ :MonitorFromPoint(POINT{0,0},MONITOR_DEFAULTTOPRIMARY);
+ if(!monitor)return QString();
+ if(monitor==impl_->hdrIdentityMonitor&&!impl_->hdrIdentityKey.isEmpty())return impl_->hdrIdentityKey;
+ impl_->hdrIdentityMonitor=monitor;
+ MONITORINFOEXW info{};info.cbSize=sizeof(info);
+ if(!GetMonitorInfoW(monitor,reinterpret_cast<MONITORINFO*>(&info)))return QString();
+ DISPLAY_DEVICEW device{};device.cb=sizeof(device);
+ if(EnumDisplayDevicesW(info.szDevice,0,&device,0)&&device.DeviceID[0])
+ impl_->hdrIdentityKey=QString::fromWCharArray(device.DeviceID);
+ else impl_->hdrIdentityKey=QString::fromWCharArray(info.szDevice);
+ return impl_->hdrIdentityKey;
+}
+
+void QmlPlayerBridge::forgetHdrDisplayProfiles(){
+ flushHdrMemory();
+ auto& i=*impl_;
+ i.prefs[QStringLiteral("hdrProfiles")]=QVariantMap{};
+ if(!i.savePrefs())veyra::log::warn("ui-prefs","hdr display profiles not cleared");
+ emit preferencesChanged();
+ emit notice(tr("已清除显示设备记忆"),false);
+}
+
+void QmlPlayerBridge::syncHdrDisplayProfile(){
+ auto& i=*impl_;
+ const QString id=hdrDisplayProfileId();
+ if(id.isEmpty()||id==i.hdrProfileDisplay)return; // the common path: nothing changed
+ // Leaving a display: remember what the curve looks like on it.
+ flushHdrMemory();
+ i.hdrProfileDisplay=id;
+ emit settingsChanged();
+ if(loadHdrProfile(id)){
+ emit preferencesChanged();
+ emit notice(tr("已套用该显示设备的 HDR 曲线配置"),false);
+ }
+}
+
+bool QmlPlayerBridge::loadHdrProfile(const QString& id){
+ auto& i=*impl_;
+ const auto profiles=i.prefs.value(QStringLiteral("hdrProfiles")).toMap();
+ const auto stored=profiles.value(id).toMap();
+ if(stored.isEmpty())return false;
+ auto s=settings();
+ const auto number=[&](const char* key,int fallback){
+ return stored.contains(QLatin1String(key))?stored.value(QLatin1String(key)).toInt():fallback;};
+ s.hdrCurve.enabled=stored.value(QStringLiteral("enabled"),s.hdrCurve.enabled).toBool();
+ s.hdrCurve.shadowLiftEv100=number("shadowLiftEv100",int(s.hdrCurve.shadowLiftEv100));
+ s.hdrCurve.shadowRangeNits=unsigned(std::clamp(number("shadowRangeNits",int(s.hdrCurve.shadowRangeNits)),1,100));
+ s.hdrCurve.midGrayNits=unsigned(std::clamp(number("midGrayNits",int(s.hdrCurve.midGrayNits)),100,500));
+ s.hdrCurve.highlightStartNits=unsigned(std::clamp(number("highlightStartNits",int(s.hdrCurve.highlightStartNits)),0,2000));
+ s.hdrCurve.rollOffPercent=unsigned(std::clamp(number("rollOffPercent",int(s.hdrCurve.rollOffPercent)),10,200));
+ s.hdrCurve.peakCapNits=unsigned(std::clamp(number("peakCapNits",int(s.hdrCurve.peakCapNits)),0,4000));
+ s.hdrCurve.strengthPercent=unsigned(std::clamp(number("strengthPercent",int(s.hdrCurve.strengthPercent)),0,200));
+ s.hdrCurve.displayPeakNits=unsigned(std::clamp(number("displayPeakNits",int(s.hdrCurve.displayPeakNits)),0,10000));
+ QScopedValueRollback<bool> restoring(i.hdrRestoring,true);
+ return commitHdrTuning(std::move(s));
+}
+
+bool QmlPlayerBridge::storeHdrProfile(const QString& id){
+ auto& i=*impl_;
+ const auto& c=settings().hdrCurve;
+ QVariantMap entry;
+ entry[QStringLiteral("enabled")]=c.enabled;
+ entry[QStringLiteral("shadowLiftEv100")]=int(c.shadowLiftEv100);
+ entry[QStringLiteral("shadowRangeNits")]=int(c.shadowRangeNits);
+ entry[QStringLiteral("midGrayNits")]=int(c.midGrayNits);
+ entry[QStringLiteral("highlightStartNits")]=int(c.highlightStartNits);
+ entry[QStringLiteral("rollOffPercent")]=int(c.rollOffPercent);
+ entry[QStringLiteral("peakCapNits")]=int(c.peakCapNits);
+ entry[QStringLiteral("strengthPercent")]=int(c.strengthPercent);
+ entry[QStringLiteral("displayPeakNits")]=int(c.displayPeakNits);
+ auto profiles=i.prefs.value(QStringLiteral("hdrProfiles")).toMap();
+ if(profiles.value(id).toMap()==entry)return false; // nothing new to remember
+ profiles[id]=entry;
+ while(profiles.size()>32)profiles.erase(profiles.begin());
+ i.prefs[QStringLiteral("hdrProfiles")]=profiles;
+ if(!i.savePrefs())veyra::log::warn("ui-prefs","hdr display profile not saved");
+ emit preferencesChanged();return true;
+}
+
+QVariantMap QmlPlayerBridge::hdrSourceInfo() const {
+ const auto& snap=impl_->snapshot;
+ const unsigned mastering=snap.sourceMasteringPeakNits;
+ const unsigned cll=snap.sourceMaxCllNits,fall=snap.sourceMaxFallNits;
+ const bool valid=snap.sourceHdr&&(mastering||cll||fall);
+ return {{"valid",valid},{"masteringPeakNits",int(mastering)},
+ {"maxCllNits",int(cll)},{"maxFallNits",int(fall)}};
+}
+
+bool QmlPlayerBridge::sourceIsSdr() const {
+ const auto& snap=impl_->snapshot;
+ return snap.running&&!snap.sourceHdr;
+}
+
+unsigned QmlPlayerBridge::effectiveHdrDisplayPeakNits() const {
+ // The ceiling the panel is actually held to: the user's own value when set, else the
+ // system report - but only when that report is plausible (a projector answering
+ // 10000 nit with a 0.000 black is its EDID ceiling, not a measurement; the presenter
+ // applies the same rule). 0 means unknown and the recommendation skips that branch.
+ const unsigned setting=unsigned(std::max(0,hdrDisplayPeakNits()));
+ if(setting)return setting;
+ const auto info=hdrDisplayInfo();
+ if(!info.value("valid").toBool()||!info.value("plausible").toBool())return 0;
+ return unsigned(std::max(0,info.value("peakNits").toInt()));
+}
+
+QVariantMap QmlPlayerBridge::hdrRecommendation() const {
+ const auto& snap=impl_->snapshot;
+ const auto rec=engine::recommendHdrTuning(snap.sourceMasteringPeakNits,snap.sourceMaxCllNits,
+ snap.sourceMaxFallNits,effectiveHdrDisplayPeakNits());
+ return {{"available",rec.available},{"presetId",QString::fromLatin1(rec.presetId)},
+ {"axesContent",QString::fromLatin1(engine::hdrAxesContentForPreset(rec.presetId))},
+ {"reason",QString::fromLatin1(rec.reasonKey)},{"strengthPercent",int(rec.strengthPercent)},
+ {"cllNits",int(rec.cllNits)},{"fallNits",int(rec.fallNits)}};
+}
+
+QVariantMap QmlPlayerBridge::hdrPeakWarning() const {
+ const auto& snap=impl_->snapshot;
+ const auto& s=settings();
+ // The arithmetic (including the divide-by-zero guard) lives in the header so the
+ // unit tests cover it; this only marshals it to QML.
+ const unsigned sourcePeak=snap.sourceMaxCllNits?snap.sourceMaxCllNits:snap.sourceMasteringPeakNits;
+ auto baseline=s.hdrCurve;if(!baseline.displayPeakNits)baseline.displayPeakNits=effectiveHdrDisplayPeakNits();
+ const auto w=engine::hdrPeakWarning(sourcePeak,snap.sourceHdr,baseline.enabled,baseline,s.hdrMetadata);
+ return {{"valid",w.valid},{"sourcePeakNits",int(w.sourcePeakNits)},{"capNits",int(w.capNits)},
+ {"keptPercent",int(w.keptPercent)},{"clipped",w.clipped}};
+}
+
+bool QmlPlayerBridge::applyRecommendedHdrTuning(){
+ const auto& snap=impl_->snapshot;
+ const auto rec=engine::recommendHdrTuning(snap.sourceMasteringPeakNits,snap.sourceMaxCllNits,
+ snap.sourceMaxFallNits,effectiveHdrDisplayPeakNits());
+ if(!rec.available)return false;
+ // The finding is the same in both modes; only the thing it names differs. In the
+ // axes mode the content comes from the source and the environment stays the user's
+ // choice, exactly like a manual pick there.
+ if(hdrPresetMode()==QLatin1String("axes")){
+ QString environment=impl_->prefString("hdrAxesEnvironment");
+ if(environment.isEmpty())environment=QStringLiteral("compensate");
+ const QString content=QString::fromLatin1(engine::hdrAxesContentForPreset(rec.presetId));
+ if(!applyHdrAxesPreset(content,environment))return false;
+ emit notice(tr("已按片源自动选档:%1").arg(content),false);
+ return true;
+ }
+ const auto* preset=engine::findHdrTuningPreset(rec.presetId);
+ if(!preset)return false;
+ auto s=settings();
+ // The strength dial and the display peak belong to the user: the axes pick
+ // preserves them, so a recommendation must not reset them either.
+ const auto strength=s.hdrCurve.strengthPercent;
+ const auto displayPeak=s.hdrCurve.displayPeakNits;
+ s.hdrCurve=preset->curve;s.hdrMetadata=preset->metadata;
+ s.hdrCurve.strengthPercent=strength;
+ s.hdrCurve.displayPeakNits=displayPeak;
+ if(!commitHdrTuning(std::move(s)))return false;
+ setHdrAppliedFrom(QStringLiteral("legacy"));
+ // One line per application, for diagnostics: it records what the recommendation decided
+
+ // and on which numbers, so an odd suggestion can be explained afterwards. Per-user
+
+ // calibration was considered and dropped - thresholds tuned on one person film library
+
+ // would be shipped to everyone else.
+ veyra::log::info("hdr-recommend",std::format("applied preset={} reason={} cll={} fall={} mastering={} displayPeak={} mode={}",
+ rec.presetId,rec.reasonKey,rec.cllNits,rec.fallNits,snap.sourceMasteringPeakNits,
+ effectiveHdrDisplayPeakNits(),hdrPresetMode().toStdString()));
+ emit notice(tr("已按片源自动选档:%1").arg(QString::fromLatin1(rec.presetId)),false);
+ return true;
+}
+
+bool QmlPlayerBridge::applyHdrTuningPreset(const QString& id){
+ for(const auto& p:engine::kHdrTuningPresets){
+ if(id!=QLatin1String(p.id))continue;
+ auto s=settings();
+ // Picking a preset replaces the baseline, not the two dials: how hard the
+ // user turned it (and which panel they told us about) must survive.
+ const auto strength=s.hdrCurve.strengthPercent;
+ const auto displayPeak=s.hdrCurve.displayPeakNits;
+ s.hdrCurve=p.curve;s.hdrMetadata=p.metadata;
+ s.hdrCurve.strengthPercent=strength;s.hdrCurve.displayPeakNits=displayPeak;
+ if(!s.hdrCurve.valid()||!s.hdrMetadata.valid())return false;
+ if(!commitHdrTuning(std::move(s)))return false;
+ setHdrAppliedFrom(QStringLiteral("legacy"));
+ return true;
+ }
+ return false;
+}
+bool QmlPlayerBridge::hdrMetadataEnabled()const{return settings().hdrMetadata.enabled;}
+void QmlPlayerBridge::setHdrMetadataEnabled(bool enabled){
+ auto s=settings();if(s.hdrMetadata.enabled==enabled)return;s.hdrMetadata.enabled=enabled;
+ commitHdrTuning(std::move(s));
+}
+QVariantMap QmlPlayerBridge::hdrMetadataParams()const{
+ const auto& m=settings().hdrMetadata;
+ return {{"masteringPeakNits",int(m.masteringPeakNits)},{"maxCllNits",int(m.maxCllNits)},
+ {"maxFallNits",int(m.maxFallNits)}};
+}
+bool QmlPlayerBridge::setHdrMetadataParameter(const QString& key,double value){
+ if(!std::isfinite(value)||value<0||value>10000)return false;
+ auto s=settings();const auto v=int(std::lround(value));
+ if(v<0||v>10000)return false;
+ if(key=="masteringPeakNits")s.hdrMetadata.masteringPeakNits=unsigned(v);
+ else if(key=="maxCllNits")s.hdrMetadata.maxCllNits=unsigned(v);
+ else if(key=="maxFallNits")s.hdrMetadata.maxFallNits=unsigned(v);
+ else return false;
+ if(!s.hdrMetadata.valid())return false;
+ return commitHdrTuning(std::move(s));
+}
+void QmlPlayerBridge::setVideoHdr(bool enabled) {
+ for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
+ if (impl_->chain.nodes[i].type == engine::EffectType::VideoHdr) {
+ setEffectEnabled(int(i), enabled); return;
+ }
+ if (enabled) emit notice(tr("请先添加 RTX Video HDR 节点"), true);
+}
+// RTX Video HDR tuning lives on the chain's HDR node, like NR parameters on
+// NR nodes: the same values AppShell's settings sliders edited.
+namespace {
+// Spatial anti-aliasing (#53): one node's values for the editors, and the edits they send.
+QString antiAliasSummary(const engine::AntiAliasSettings& a) {
+ using engine::AntiAliasMethod;
+ if (a.method == AntiAliasMethod::Mlaa)
+ return QStringLiteral("MLAA · ") + QmlPlayerBridge::tr("阈值 %1").arg(double(a.mlaaThreshold), 0, 'f', 2);
+ const QStringList fxaa{QmlPlayerBridge::tr("中"), QmlPlayerBridge::tr("高"), QmlPlayerBridge::tr("极高")};
+ const QStringList smaa{QmlPlayerBridge::tr("低"), QmlPlayerBridge::tr("中"), QmlPlayerBridge::tr("高"), QmlPlayerBridge::tr("极高")};
+ QString text = a.method == AntiAliasMethod::Fxaa ? QStringLiteral("FXAA · ") + fxaa.value(int(a.quality))
+ : QStringLiteral("SMAA · ") + smaa.value(int(a.quality));
+ if (a.usesTemporal())
+ text += a.temporal == engine::AntiAliasTemporal::T2x ? QmlPlayerBridge::tr(" · 时域 T2x(实验)") : QmlPlayerBridge::tr(" · 时域 4x(实验)");
+ return text;
+}
+QVariantMap antiAliasMap(const engine::ChainNode* node, int index) {
+ const engine::AntiAliasSettings a = node ? node->aa : engine::AntiAliasSettings{};
+ return {{"index", index}, {"present", node != nullptr}, {"enabled", node && node->enabled},
+ {"method", int(a.method)}, {"quality", int(a.quality)},
+ {"mlaaThreshold", double(a.mlaaThreshold)}, {"mlaaStrength", double(a.mlaaStrength)},
+ {"temporal", int(a.temporal)}, {"historyWeight", double(a.historyWeight)},
+ {"historyRejection", double(a.historyRejection)}, {"summary", antiAliasSummary(a)}};
+}
+// A method change starts from its high tier; the experimental modes keep Magpie's
+// history defaults (T2x 0.5, 4x 0.75) unless the weight was tuned.
+uint8_t defaultAntiAliasQuality(engine::AntiAliasMethod method) {
+ return method == engine::AntiAliasMethod::Fxaa ? 1 : method == engine::AntiAliasMethod::Smaa ? 2 : 0;
+}
+float defaultHistoryWeight(engine::AntiAliasTemporal temporal) {
+ return temporal == engine::AntiAliasTemporal::X4 ? 0.75f : 0.5f;
+}
+bool applyAntiAliasKey(engine::AntiAliasSettings& a, bool& enabled, const QString& key, double value) {
+ using engine::AntiAliasMethod; using engine::AntiAliasTemporal;
+ if (!std::isfinite(value)) return false;
+ const int whole = int(std::lround(value));
+ if (key == "enabled") { enabled = value != 0; return true; }
+ if (key == "method") {
+ if (whole < 0 || whole > 2) return false;
+ const auto method = AntiAliasMethod(whole);
+ if (method != a.method) { a.method = method; a.quality = defaultAntiAliasQuality(method); }
+ if (method != AntiAliasMethod::Smaa) a.temporal = AntiAliasTemporal::Off;
+ return true;
+ }
+ if (key == "quality") {
+ if (whole < 0 || whole >= int(engine::antiAliasQualityCount(a.method))) return false;
+ a.quality = uint8_t(whole); return true;
+ }
+ if (key == "temporal") {
+ if (whole < 0 || whole > 2 || (whole && a.method != AntiAliasMethod::Smaa)) return false;
+ const auto next = AntiAliasTemporal(whole);
+ if (next != a.temporal && a.historyWeight == defaultHistoryWeight(a.temporal)) a.historyWeight = defaultHistoryWeight(next);
+ a.temporal = next; return true;
+ }
+ if (key == "mlaaThreshold") { a.mlaaThreshold = float(value); return true; }
+ if (key == "mlaaStrength") { a.mlaaStrength = float(value); return true; }
+ if (key == "historyWeight") { a.historyWeight = float(value); return true; }
+ if (key == "historyRejection") { a.historyRejection = float(value); return true; }
+ return false;
+}
+}
+bool QmlPlayerBridge::antiAliasEnabled() const {
+ const auto* node = impl_->chain.firstOf(engine::EffectType::AntiAliasing);
+ return node && node->enabled;
+}
+void QmlPlayerBridge::setAntiAliasEnabled(bool enabled) {
+ if (enabled != antiAliasEnabled()) (void)setAntiAliasParameter(QStringLiteral("enabled"), enabled ? 1 : 0);
+}
+QVariantMap QmlPlayerBridge::antiAliasParams() const {
+ for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
+ if (impl_->chain.nodes[i].type == engine::EffectType::AntiAliasing) return antiAliasMap(&impl_->chain.nodes[i], int(i));
+ return antiAliasMap(nullptr, -1);
+}
+QVariantMap QmlPlayerBridge::antiAliasParamsAt(int index) const {
+ if (index < 0 || uint32_t(index) >= impl_->chain.nodeCount ||
+ impl_->chain.nodes[index].type != engine::EffectType::AntiAliasing) return antiAliasMap(nullptr, -1);
+ return antiAliasMap(&impl_->chain.nodes[index], index);
+}
+bool QmlPlayerBridge::setAntiAliasParameter(const QString& key, double value) {
+ auto& c = impl_->chain;
+ for (uint32_t i = 0; i < c.nodeCount; ++i)
+ if (c.nodes[i].type == engine::EffectType::AntiAliasing) return setAntiAliasParameterAt(int(i), key, value);
+ if (c.mode != engine::ChainMode::List) { emit notice(tr("请先添加抗锯齿节点"), true); return false; }
+ // The list card's instance exists once it is used, stored after the grades
+ // where toChain() puts it; the list order (compileChainExecutionPlan) runs it
+ // behind the NR group when NR is on and in front of SR otherwise.
+ engine::ChainNode node; node.type = engine::EffectType::AntiAliasing;
+ bool enabled = false;
+ if (!applyAntiAliasKey(node.aa, enabled, key, value)) return false;
+ node.enabled = node.aa.enabled = enabled;
+ if (!node.aa.validate().empty()) return false;
+ if (c.nodeCount >= engine::kMaxChainNodes) { emit notice(tr("效果链已满"), true); return false; }
+ uint32_t insertAt = 0;
+ while (insertAt < c.nodeCount && c.nodes[insertAt].type == engine::EffectType::Color) ++insertAt;
+ const auto before = std::make_unique<engine::EffectChain>(c);
+ const int selected = impl_->selectedNr, colourSelected = impl_->selectedColour;
+ for (uint32_t i = c.nodeCount; i > insertAt; --i) c.nodes[i] = c.nodes[i - 1];
+ c.nodes[insertAt] = node; ++c.nodeCount;
+ if (impl_->selectedNr >= int(insertAt)) ++impl_->selectedNr;
+ if (impl_->selectedColour >= int(insertAt)) ++impl_->selectedColour;
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message;
+ c = *before; impl_->selectedNr = selected; impl_->selectedColour = colourSelected; impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ emit settingsChanged(); emitChainChanged();
+ return true;
+}
+bool QmlPlayerBridge::setAntiAliasParameterAt(int index, const QString& key, double value) {
+ auto& c = impl_->chain;
+ if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::AntiAliasing) return false;
+ auto& node = c.nodes[index];
+ const auto before = node; const bool wasValid = chainValid();
+ bool enabled = node.enabled;
+ if (!applyAntiAliasKey(node.aa, enabled, key, value)) return false;
+ node.enabled = node.aa.enabled = enabled;
+ if (!node.aa.validate().empty()) { node = before; return false; }
+ if (node == before) return true;
+ const bool accepted = impl_->revalidate(true);
+ if (!accepted) { const auto error = impl_->validation.message; node = before; impl_->revalidate(); emit notice(uiText(error), true); }
+ emit settingsChanged();
+ // The switch also strikes the chip through; parameters notify only their group.
+ if (before.enabled != node.enabled) emitChainChanged();
+ else emitParameterChanged(&QmlPlayerBridge::antiAliasChanged, wasValid);
+ return accepted;
+}
+namespace {
+// Beauty nodes: one node's values for the editors, the edits they send and the presets.
+QString beautySummary(const engine::BeautySettings& b, bool enabled) {
+ if (!enabled) return QmlPlayerBridge::tr("已关闭");
+ QStringList parts;
+ if (b.restore) parts << QmlPlayerBridge::tr("原画保护 %1%").arg(std::lround(b.restoreStrength * 100.0f));
+ if (b.smooth) parts << QmlPlayerBridge::tr("磨皮 %1%").arg(std::lround(b.smoothAmount * 100.0f));
+ return parts.isEmpty() ? QmlPlayerBridge::tr("未启用子功能") : parts.join(QStringLiteral(" · "));
+}
+QVariantMap beautyMap(const engine::ChainNode* node, int index, int layer) {
+ const engine::BeautySettings b = node ? node->beauty : engine::BeautySettings{};
+ return {{"index", index}, {"layer", layer}, {"present", node != nullptr}, {"enabled", node && node->enabled},
+ {"restore", b.restore}, {"restoreStrength", double(b.restoreStrength)}, {"restoreScope", int(b.restoreScope)},
+ {"regionExpand", double(b.regionExpand)}, {"feather", double(b.feather)},
+ {"smooth", b.smooth}, {"strength", double(b.strength)}, {"smoothAmount", double(b.smoothAmount)},
+ {"radius", double(b.radius)}, {"detail", double(b.detail)}, {"texture", double(b.texture)},
+ {"brighten", double(b.brighten)}, {"scope", int(b.scope)},
+ {"hueCenter", double(b.hueCenter)}, {"hueRange", double(b.hueRange)}, {"satMin", double(b.satMin)},
+ {"satMax", double(b.satMax)}, {"lumaMin", double(b.lumaMin)}, {"lumaMax", double(b.lumaMax)},
+ {"softness", double(b.softness)}, {"minConfidence", double(b.minConfidence)}, {"showMask", b.showMask},
+ {"summary", beautySummary(b, node && node->enabled)}};
+}
+bool applyBeautyKey(engine::BeautySettings& b, bool& enabled, const QString& key, double value) {
+ if (!std::isfinite(value)) return false;
+ const int whole = int(std::lround(value));
+ if (key == "enabled") { enabled = value != 0; return true; }
+ if (key == "restore") { b.restore = value != 0; return true; }
+ if (key == "smooth") { b.smooth = value != 0; return true; }
+ if (key == "showMask") { b.showMask = value != 0; return true; }
+ if (key == "restoreScope") { if (whole < 0 || whole > 1) return false; b.restoreScope = engine::BeautyRestoreScope(whole); return true; }
+ if (key == "scope") { if (whole < 0 || whole > 1) return false; b.scope = engine::BeautyScope(whole); return true; }
+ const std::pair<const char*, float engine::BeautySettings::*> floats[] = {
+ {"restoreStrength", &engine::BeautySettings::restoreStrength}, {"regionExpand", &engine::BeautySettings::regionExpand},
+ {"feather", &engine::BeautySettings::feather}, {"strength", &engine::BeautySettings::strength},
+ {"smoothAmount", &engine::BeautySettings::smoothAmount}, {"radius", &engine::BeautySettings::radius},
+ {"detail", &engine::BeautySettings::detail}, {"texture", &engine::BeautySettings::texture},
+ {"brighten", &engine::BeautySettings::brighten}, {"hueCenter", &engine::BeautySettings::hueCenter},
+ {"hueRange", &engine::BeautySettings::hueRange}, {"satMin", &engine::BeautySettings::satMin},
+ {"satMax", &engine::BeautySettings::satMax}, {"lumaMin", &engine::BeautySettings::lumaMin},
+ {"lumaMax", &engine::BeautySettings::lumaMax}, {"softness", &engine::BeautySettings::softness},
+ {"minConfidence", &engine::BeautySettings::minConfidence}};
+ for (const auto& [name, field] : floats)
+ if (key == QLatin1String(name)) { b.*field = float(value); return true; }
+ return false;
+}
+// Starting points, tuned on lit photos and dark game footage; each names the
+// sub-switches it changes and leaves the skin range and the detection alone.
+bool applyBeautyPresetValues(engine::BeautySettings& b, const QString& preset) {
+ const auto natural = [&] { b.smooth = true; b.strength = 1.0f; b.smoothAmount = 0.6f; b.radius = 5.0f; b.detail = 0.6f; b.texture = 0.3f; };
+ if (preset == "natural") { natural(); b.restore = false; return true; }
+ if (preset == "light") {
+ b.smooth = true; b.restore = false; b.strength = 1.0f; b.smoothAmount = 0.35f; b.radius = 3.0f; b.detail = 0.75f; b.texture = 0.4f;
+ return true;
+ }
+ if (preset == "restore") { b.restore = true; b.restoreStrength = 1.0f; b.smooth = false; return true; }
+ if (preset == "restoreNatural") { b.restore = true; b.restoreStrength = 1.0f; natural(); return true; }
+ return false;
+}
+}
+QVariantList QmlPlayerBridge::beautyLayers() const {
+ QVariantList out;
+ int layer = 0;
+ for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
+ if (impl_->chain.nodes[i].type == engine::EffectType::Beauty) out << beautyMap(&impl_->chain.nodes[i], int(i), layer++);
+ return out;
+}
+QVariantMap QmlPlayerBridge::beautyDetection() const {
+ const auto& d = impl_->chain.beautyDetection;
+ return {{"quality", int(d.quality)}, {"maxFaces", int(d.maxFaces)}, {"stability", double(d.stability)}};
+}
+QString QmlPlayerBridge::beautyStatus() const {
+ const auto& s = impl_->snapshot;
+ if (!s.beautyActive) return {};
+ if (!s.beautyNotice.empty()) return uiText(s.beautyNotice);
+ return s.beautyFaces ? tr("检测到 %1 张人脸").arg(s.beautyFaces) : tr("未检测到人脸");
+}
+QVariantMap QmlPlayerBridge::beautyParamsAt(int index) const {
+ const auto& c = impl_->chain;
+ if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty) return beautyMap(nullptr, -1, -1);
+ int layer = 0;
+ for (int i = 0; i < index; ++i) layer += c.nodes[i].type == engine::EffectType::Beauty;
+ return beautyMap(&c.nodes[index], index, layer);
+}
+bool QmlPlayerBridge::setBeautyParameterAt(int index, const QString& key, double value) {
+ auto& c = impl_->chain;
+ if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty) return false;
+ auto& node = c.nodes[index];
+ const auto before = node; const bool wasValid = chainValid();
+ bool enabled = node.enabled;
+ if (!applyBeautyKey(node.beauty, enabled, key, value)) return false;
+ node.enabled = node.beauty.enabled = enabled;
+ if (!node.beauty.validate().empty()) { node = before; return false; }
+ if (node == before) return true;
+ const bool accepted = impl_->revalidate(true);
+ if (!accepted) { const auto error = impl_->validation.message; node = before; impl_->revalidate(); emit notice(uiText(error), true); }
+ emit settingsChanged();
+ // The switch also strikes the chip through; parameters notify only their group.
+ if (before.enabled != node.enabled) emitChainChanged();
+ else emitParameterChanged(&QmlPlayerBridge::beautyChanged, wasValid);
+ return accepted;
+}
+int QmlPlayerBridge::duplicateBeautyLayer(int index) {
+ auto& c = impl_->chain;
+ if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty) return -1;
+ if (c.mode != engine::ChainMode::List) { emit notice(tr("节点模式请用节点的复制"), true); return -1; }
+ if (c.countOf(engine::EffectType::Beauty) >= engine::kMaxBeautyInstances) {
+ emit notice(tr("%1 最多 %2 个").arg(tr("美颜")).arg(engine::kMaxBeautyInstances), true); return -1;
+ }
+ if (c.nodeCount >= engine::kMaxChainNodes) { emit notice(tr("效果链已满"), true); return -1; }
+ const auto before = std::make_unique<engine::EffectChain>(c);
+ const int selected = impl_->selectedNr, colourSelected = impl_->selectedColour;
+ const uint32_t at = uint32_t(index) + 1;
+ for (uint32_t i = c.nodeCount; i > at; --i) c.nodes[i] = c.nodes[i - 1];
+ c.nodes[at] = c.nodes[index]; ++c.nodeCount;
+ if (impl_->selectedNr >= int(at)) ++impl_->selectedNr;
+ if (impl_->selectedColour >= int(at)) ++impl_->selectedColour;
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message;
+ c = *before; impl_->selectedNr = selected; impl_->selectedColour = colourSelected; impl_->revalidate();
+ emit notice(uiText(error), true); return -1;
+ }
+ emit settingsChanged(); emitChainChanged();
+ return int(at);
+}
+bool QmlPlayerBridge::moveBeautyLayer(int index, int delta) {
+ auto& c = impl_->chain;
+ if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty || !delta) return false;
+ int other = index;
+ do other += delta < 0 ? -1 : 1;
+ while (other >= 0 && uint32_t(other) < c.nodeCount && c.nodes[other].type != engine::EffectType::Beauty);
+ if (other < 0 || uint32_t(other) >= c.nodeCount) return false;
+ const auto before = std::make_unique<engine::EffectChain>(c);
+ const auto viewA = std::pair{c.nodes[index].viewX, c.nodes[index].viewY};
+ const auto viewB = std::pair{c.nodes[other].viewX, c.nodes[other].viewY};
+ std::swap(c.nodes[index], c.nodes[other]);
+ // Node mode keeps the canvas positions with the slot; only the parameters trade places.
+ c.nodes[index].viewX = viewA.first; c.nodes[index].viewY = viewA.second;
+ c.nodes[other].viewX = viewB.first; c.nodes[other].viewY = viewB.second;
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message; c = *before; impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ emit settingsChanged(); emitChainChanged();
+ return true;
+}
+bool QmlPlayerBridge::applyBeautyPreset(int index, const QString& preset) {
+ auto& c = impl_->chain;
+ if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty) return false;
+ auto& node = c.nodes[index];
+ const auto before = node;
+ if (!applyBeautyPresetValues(node.beauty, preset)) return false;
+ node.enabled = node.beauty.enabled = true;
+ if (!node.beauty.validate().empty()) { node = before; return false; }
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message; node = before; impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ emit settingsChanged(); emitChainChanged();
+ return true;
+}
+bool QmlPlayerBridge::setBeautyDetection(const QString& key, double value) {
+ auto& c = impl_->chain;
+ if (!std::isfinite(value)) return false;
+ auto next = c.beautyDetection;
+ const int whole = int(std::lround(value));
+ if (key == "quality") next.quality = uint8_t(std::clamp(whole, 0, 2));
+ else if (key == "maxFaces") next.maxFaces = uint8_t(std::clamp(whole, 1, 8));
+ else if (key == "stability") next.stability = float(value);
+ else return false;
+ if (!next.validate().empty()) return false;
+ if (next == c.beautyDetection) return true;
+ const auto before = c.beautyDetection; const bool wasValid = chainValid();
+ c.beautyDetection = next;
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message; c.beautyDetection = before; impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ emit settingsChanged();
+ emitParameterChanged(&QmlPlayerBridge::beautyChanged, wasValid);
+ return true;
+}
+bool QmlPlayerBridge::beautyAnyEnabled() const {
+ const auto& c = impl_->chain;
+ for (uint32_t i = 0; i < c.nodeCount; ++i) if (c.nodes[i].type == engine::EffectType::Beauty && c.nodes[i].enabled) return true;
+ return false;
+}
+bool QmlPlayerBridge::setAllBeautyEnabled(bool enabled) {
+ auto& c = impl_->chain;
+ const auto before = std::make_unique<engine::EffectChain>(c);
+ std::vector<uint32_t> layers;
+ for (uint32_t i = 0; i < c.nodeCount; ++i) if (c.nodes[i].type == engine::EffectType::Beauty) layers.push_back(i);
+ if (layers.empty()) return false;
+ auto& restore = impl_->beautyMasterRestore;
+ if (!enabled) {
+ restore.clear();
+ for (const auto i : layers) { restore.push_back(c.nodes[i].enabled); c.nodes[i].enabled = c.nodes[i].beauty.enabled = false; }
+ } else {
+ // As the NR switch: layers added or removed meanwhile bring every layer back.
+ const bool faithful = restore.size() == layers.size() && std::find(restore.begin(), restore.end(), true) != restore.end();
+ for (size_t k = 0; k < layers.size(); ++k) c.nodes[layers[k]].enabled = c.nodes[layers[k]].beauty.enabled = faithful ? bool(restore[k]) : true;
+ }
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message; c = *before; impl_->revalidate();
+ emit notice(uiText(error), true); emitChainChanged(); return false;
+ }
+ veyra::log::info("ui-beauty", std::format("group switch {} layers={}", enabled ? "on" : "off", layers.size()));
+ emitChainChanged(); emit settingsChanged();
+ return true;
+}
+bool QmlPlayerBridge::resetBeautyLayer(int index) {
+ auto& c = impl_->chain;
+ if (index < 0 || uint32_t(index) >= c.nodeCount || c.nodes[index].type != engine::EffectType::Beauty) return false;
+ auto& node = c.nodes[index];
+ const auto before = node;
+ node.beauty = engine::BeautySettings{};
+ node.beauty.enabled = node.enabled;
+ if (node == before) return true;
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message; node = before; impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ emit settingsChanged(); emitChainChanged();
+ return true;
+}
+QVariantMap QmlPlayerBridge::videoHdrParams() const {
+ for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
+ if (impl_->chain.nodes[i].type == engine::EffectType::VideoHdr) {
+ const auto& v = impl_->chain.nodes[i].videoHdr;
+ return {{"contrast", int(v.contrast)}, {"saturation", int(v.saturation)},
+ {"middleGray", int(v.middleGray)}, {"peakNits", int(v.peakNits)}};
+ }
+ return {};
+}
+bool QmlPlayerBridge::setVideoHdrParameter(const QString& key, double value) {
+ if (!std::isfinite(value)) return false;
+ for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i) {
+ auto& node = impl_->chain.nodes[i];
+ if (node.type != engine::EffectType::VideoHdr) continue;
+ const auto before = node; const bool wasValid = chainValid();
+ if (value < 0) return false;
+ const auto v = unsigned(std::lround(value));
+ if (key == "contrast") node.videoHdr.contrast = v;
+ else if (key == "saturation") node.videoHdr.saturation = v;
+ else if (key == "middleGray") node.videoHdr.middleGray = v;
+ else if (key == "peakNits") node.videoHdr.peakNits = v;
+ else return false;
+ if (!node.videoHdr.valid()) { node = before; return false; }
+ if (node == before) return true;
+ const bool accepted = impl_->revalidate(true);
+ if (!accepted) { const auto error = impl_->validation.message; node = before; impl_->revalidate(); emit notice(uiText(error), true); }
+ emit settingsChanged(); emitParameterChanged(&QmlPlayerBridge::videoHdrParamsChanged, wasValid); return accepted;
+ }
+ emit notice(tr("请先添加 RTX Video HDR 节点"), true);
+ return false;
+}
+bool QmlPlayerBridge::fgEnabled() const {
+ const auto* node = impl_->chain.firstOf(engine::EffectType::FrameGeneration);
+ return node && node->enabled;
+}
+void QmlPlayerBridge::setFgEnabled(bool enabled) {
+ for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i)
+ if (impl_->chain.nodes[i].type == engine::EffectType::FrameGeneration) {
+ if (impl_->chain.nodes[i].enabled == enabled) return;
+ // Turning on keeps the last chosen multiplier (at least 2X).
+ if (enabled && impl_->chain.fgMultiplier < 2) impl_->chain.fgMultiplier = 2;
+ setEffectEnabled(int(i), enabled); emit settingsChanged(); return;
+ }
+ if (enabled) emit notice(tr("请先添加补帧节点"), true);
+}
+int QmlPlayerBridge::fgMultiplier() const {
+ const auto* node = impl_->chain.firstOf(engine::EffectType::FrameGeneration);
+ return node && node->enabled ? int(impl_->chain.fgMultiplier) : 1;
+}
+void QmlPlayerBridge::setFgMultiplier(int multiplier) {
+ const auto choices=settings().frameGenerationBackend==engine::FrameGenerationBackend::Vfg?
+ std::span<const uint32_t>(engine::kVfgMultiplierChoices):std::span<const uint32_t>(engine::kFgMultiplierChoices);
+ const bool legal = std::find(choices.begin(),choices.end(),uint32_t(std::max(multiplier,0)))!=choices.end();
+ if (!legal || multiplier > fgMaxMultiplier()) {
+ emit notice(tr("补帧倍率超出当前后端范围"), true); return;
+ }
+ auto& chain = impl_->chain;
+ auto* node = chain.firstOf(engine::EffectType::FrameGeneration);
+ if (!node) { if (multiplier > 1) emit notice(tr("请先添加补帧节点"), true); return; }
+ const bool enabled = multiplier > 1;
+ if (node->enabled == enabled && (!enabled || chain.fgMultiplier == uint32_t(multiplier))) return;
+ const auto beforeMultiplier = chain.fgMultiplier; const auto beforeEnabled = node->enabled;
+ node->enabled = enabled; if (enabled) chain.fgMultiplier = uint32_t(multiplier);
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message;
+ node->enabled = beforeEnabled; chain.fgMultiplier = beforeMultiplier; impl_->revalidate();
+ emit notice(uiText(error), true);
+ }
+ emit settingsChanged(); emitChainChanged();
+}
+
+bool QmlPlayerBridge::colorEnabled() const {return selectedColourSettings().enabled;}
+void QmlPlayerBridge::setColorEnabled(bool enabled){
+ auto c=selectedColourSettings();c.enabled=enabled;commitColour(c);
+}
+
+bool QmlPlayerBridge::protectionEnabled() const { return settings().protection.enabled; }
+void QmlPlayerBridge::setProtectionEnabled(bool enabled) {
+ if (impl_->chain.mode != engine::ChainMode::List) {
+ emit notice(tr("NR 保护区域仅在列表模式可用"), true); return;
+ }
+ for (uint32_t i=0; i<impl_->chain.nodeCount; ++i) {
+ if (impl_->chain.nodes[i].type==engine::EffectType::Protection) {
+ setEffectEnabled(int(i), enabled);
+ return;
+ }
+ }
+ emit notice(tr("处理链中没有 NR 保护节点,未更改设置"), true);
+}
+
+QVariantMap QmlPlayerBridge::protectionState() const {
+ const auto p = settings().protection;
+ const auto r = p.regions[0];
+ return {{"left",double(r.left)},{"top",double(r.top)},
+ {"right",double(r.right)},{"bottom",double(r.bottom)},
+ {"feather",double(p.featherPixels)}};
+}
+
+bool QmlPlayerBridge::setProtectionRegion(double left,double top,double right,double bottom,double feather) {
+ if (impl_->chain.mode != engine::ChainMode::List) return false;
+ for (double v : {left,top,right,bottom,feather}) if (!std::isfinite(v)) return false;
+ if (left<0 || top<0 || right>1 || bottom>1 || left>right || top>bottom || feather<0 || feather>64) return false;
+ for (uint32_t i=0;i<impl_->chain.nodeCount;++i) {
+ auto& node=impl_->chain.nodes[i];
+ if (node.type!=engine::EffectType::Protection) continue;
+ const auto before=node;const bool wasValid=chainValid();
+ // Explicit edits replace legacy multi-rectangle settings with the one global region.
+ node.protection.regions={};
+ node.protection.regions[0]={float(left),float(top),float(right),float(bottom)};
+ node.protection.featherPixels=float(feather);
+ if(node==before)return true;
+ const bool accepted=impl_->revalidate(true);
+ if(!accepted){const auto error=impl_->validation.message;node=before;impl_->revalidate();emit notice(uiText(error),true);}
+ emit settingsChanged();emitParameterChanged(&QmlPlayerBridge::protectionChanged,wasValid);return accepted;
+ }
+ return false;
+}
+
+// The inspector edits the selected list node, not the first flat NR mirror.
+#define VEYRA_NR_PROP(getter,setter,member,type) \
+ type QmlPlayerBridge::getter() const { \
+ const auto* n=impl_->nrNode(); const engine::ChainNode fallback{}; \
+ return type((n?*n:fallback).member); \
+ } \
+ void QmlPlayerBridge::setter(type value){ \
+ auto* n=impl_->nrNode(); if(!n||type(n->member)==value)return; \
+ const auto before=*n; const bool wasValid=chainValid(); \
+ n->member=decltype(n->member)(value); \
+ if(!impl_->revalidate(true)){ \
+ const auto error=impl_->validation.message; *n=before; \
+ impl_->revalidate();emit notice(uiText(error),true); \
+ } \
+ emit settingsChanged(); \
+ if(before.enabled!=n->enabled)emitChainChanged(); \
+ else emitParameterChanged(&QmlPlayerBridge::nrLayersChanged,wasValid); \
+ }
+VEYRA_NR_PROP(nrEnabled,setNrEnabled,enabled,bool)
+VEYRA_NR_PROP(nrTemporal,setNrTemporal,nr.temporal,bool)
+VEYRA_NR_PROP(nrIntensity,setNrIntensity,nr.model.intensity,double)
+VEYRA_NR_PROP(nrTone,setNrTone,nr.model.tone,double)
+VEYRA_NR_PROP(nrStructure,setNrStructure,nr.model.structure,double)
+VEYRA_NR_PROP(nrSkin,setNrSkin,nr.model.skin,double)
+VEYRA_NR_PROP(nrAutoMask,setNrAutoMask,nr.model.autoMask,bool)
+VEYRA_NR_PROP(nrUiCorrection,setNrUiCorrection,nr.model.uiCorrection,bool)
+VEYRA_NR_PROP(nrStyle,setNrStyle,nr.model.style,int)
+#undef VEYRA_NR_PROP
+int QmlPlayerBridge::selectedNrLayer() const{return impl_->nrIndex();}
+void QmlPlayerBridge::setSelectedNrLayer(int index){
+ if(index<0||uint32_t(index)>=impl_->chain.nodeCount||
+ impl_->chain.nodes[index].type!=engine::EffectType::NrEnhance||index==impl_->selectedNr)return;
+ impl_->selectedNr=index;emit settingsChanged();
+}
+bool QmlPlayerBridge::lowLatency() const{return settings().lowLatency;}
+void QmlPlayerBridge::setLowLatency(bool value){
+ const auto before=impl_->chain;
+ for(uint32_t i=0;i<impl_->chain.nodeCount;++i)if(impl_->chain.nodes[i].type==engine::EffectType::NrEnhance)
+ impl_->chain.nodes[i].nr.lowLatencyPairing=value;
+ if(!impl_->revalidate(true)){
+ const auto error=impl_->validation.message;impl_->chain=before;
+ impl_->revalidate();emit notice(uiText(error),true);
+ }
+ emit settingsChanged();emitChainChanged();
+}
+
+// Stage-5 output stabiliser (anti-flicker). Global, not per-node: it runs once,
+// after the whole NR stack and the residual composite. Strength 0 is the
+// default and the graph then skips the dispatch entirely, so committing it
+// never costs anything until the user turns it on.
+double QmlPlayerBridge::nrHoldStrength() const { return double(settings().nrHoldStrength); }
+void QmlPlayerBridge::setNrHoldStrength(double value) {
+ auto s = settings();
+ const float next = float(value);
+ if (s.nrHoldStrength == next) return;
+ s.nrHoldStrength = next;
+ if (!impl_->commit(std::move(s))) return;
+ impl_->prefs[QStringLiteral("nrHoldStrength")] = double(next);
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "output stabiliser strength not saved");
+ emit settingsChanged();
+}
+double QmlPlayerBridge::nrHoldTolerance() const { return double(settings().nrHoldTolerance); }
+void QmlPlayerBridge::setNrHoldTolerance(double value) {
+ auto s = settings();
+ const float next = float(value);
+ if (s.nrHoldTolerance == next) return;
+ s.nrHoldTolerance = next;
+ if (!impl_->commit(std::move(s))) return;
+ impl_->prefs[QStringLiteral("nrHoldTolerance")] = double(next);
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "output stabiliser tolerance not saved");
+ emit settingsChanged();
+}
+
+bool QmlPlayerBridge::applying() const { return impl_->facade.applying(); }
+
+// Volume and mute are engine state (the audio clock owns them), so they go
+// straight to the engine and come back through the snapshot: the UI shows what
+// the engine did, not what it asked for.
+double QmlPlayerBridge::volume() const { return double(impl_->snapshot.volume); }
+void QmlPlayerBridge::setVolume(double value) {
+ impl_->engine.setVolume(float(std::clamp(value, 0.0, 1.0)), impl_->snapshot.muted);
+}
+bool QmlPlayerBridge::muted() const { return impl_->snapshot.muted; }
+void QmlPlayerBridge::setMuted(bool value) {
+ impl_->engine.setVolume(impl_->snapshot.volume, value);
+}
+double QmlPlayerBridge::playbackSpeed() const { return impl_->snapshot.playbackSpeed; }
+double QmlPlayerBridge::playbackRate() const { return impl_->snapshot.playbackRate; }
+double QmlPlayerBridge::minimumPlaybackRate() const { return engine::kMinPlaybackRate; }
+double QmlPlayerBridge::maximumPlaybackRate() const { return engine::kMaxPlaybackRate; }
+void QmlPlayerBridge::setPlaybackRate(double rate) {
+ if(!impl_->engine.setPlaybackRate(rate))return;
+ impl_->snapshot.playbackRate=rate;emit snapshotChanged();
+}
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Export.cpp b/src/ui/bridge/Export.cpp
new file mode 100644
index 00000000..b752a000
--- /dev/null
+++ b/src/ui/bridge/Export.cpp
@@ -0,0 +1,329 @@
+// QML bridge: Export responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- image export (P4-b) -----------------------------------------------------
+bool QmlPlayerBridge::imageBatchActive() const { return impl_->imagePhase != Impl::ImagePhase::Idle; }
+int QmlPlayerBridge::imageBatchDone() const { return impl_->imageDone; }
+int QmlPlayerBridge::imageBatchTotal() const { return int(impl_->imageFiles.size()); }
+int QmlPlayerBridge::imageBatchFailures() const { return impl_->imageFailures; }
+QString QmlPlayerBridge::imageBatchStatus() const { return impl_->imageStatus; }
+void QmlPlayerBridge::saveFrameDialog() {
+ if(!impl_->pendingFrameExport.isEmpty()||!impl_->pendingScreenshot.isEmpty()||imageBatchActive()){emit notice(tr("请等待当前图片导出完成"),true);return;}
+ if (!hasSource()) { emit notice(tr("没有可保存的画面"), true); return; }
+ if (impl_->chain.mode == engine::ChainMode::Node) {
+ emit notice(tr("图片导出只接受列表模式;请切回列表模式再导出"), true); return;
+ }
+ const QString suggested = QDir(screenshotDirectory()).filePath(
+ QFileInfo(QString::fromStdWString(impl_->sourceLabel)).completeBaseName() + QStringLiteral("-veyra.png"));
+ const QString path = QFileDialog::getSaveFileName(nullptr, tr("导出当前画面"), suggested,
+ tr("PNG 图片 (*.png);;JPEG 图片 (*.jpg)"));
+ if (path.isEmpty()) return;
+ if (QFileInfo::exists(path)) { emit notice(tr("目标文件已存在,请换一个文件名"), true); return; }
+ impl_->engine.saveFrame(wideOf(QDir::toNativeSeparators(path)));
+ impl_->pendingFrameExport=path;impl_->pendingFrameDeadline=QDateTime::currentMSecsSinceEpoch()+30000;
+ emit notice(tr("正在保存:%1").arg(QDir::toNativeSeparators(path)), false);
+}
+void QmlPlayerBridge::exportImagesDialog() {
+ const auto files = QFileDialog::getOpenFileNames(nullptr, tr("选择要处理的图片"), QString(),
+ tr("图片 (*.png *.jpg *.jpeg)"));
+ if (files.isEmpty()) return;
+ const QString folder = QFileDialog::getExistingDirectory(nullptr, tr("保存到"), QFileInfo(files.front()).absolutePath());
+ if (!folder.isEmpty()) startImageBatch(files, folder);
+}
+bool QmlPlayerBridge::startImageBatch(const QStringList& files, const QString& folder) {
+ auto& i = *impl_;
+ if (i.imagePhase != Impl::ImagePhase::Idle) { emit notice(tr("已有一批图片在处理"), true); return false; }
+ if (i.chain.mode == engine::ChainMode::Node) {
+ emit notice(tr("图片导出只接受列表模式;请切回列表模式再导出"), true); return false;
+ }
+ if (files.isEmpty() || !QFileInfo(folder).isDir()) { emit notice(tr("请选择图片和已存在的输出目录"), true); return false; }
+ i.imageFiles = files; i.imageFolder = folder;
+ i.imageIndex = -1; i.imageDone = 0; i.imageFailures = 0;
+ i.imagePhase = Impl::ImagePhase::Opening; i.imageWaits = 0;
+ veyra::log::info("image-batch", std::format("start files={} folder={}", files.size(), folder.toStdString()));
+ emit imageBatchChanged();
+ return true;
+}
+void QmlPlayerBridge::cancelImageBatch() {
+ if (impl_->imagePhase == Impl::ImagePhase::Idle) return;
+ impl_->imagePhase = Impl::ImagePhase::Idle;
+ impl_->imageStatus = tr("已取消:完成 %1 / %2").arg(impl_->imageDone).arg(impl_->imageFiles.size());
+ veyra::log::info("image-batch", "cancelled");
+ emit imageBatchChanged();
+}
+void QmlPlayerBridge::tickImageBatch() {
+ auto& i = *impl_;
+ if(!i.pendingScreenshot.isEmpty()){
+ const QString written=QDir::fromNativeSeparators(QString::fromStdWString(i.snapshot.savedFramePath));
+ const QString hdr=QFileInfo(i.pendingScreenshot).path()+QLatin1Char('/')+QFileInfo(i.pendingScreenshot).completeBaseName()+QStringLiteral(".jxr");
+ if(written==i.pendingScreenshot||written==hdr){
+ i.lastScreenshot=written;i.pendingScreenshot.clear();
+ veyra::log::info("ui-screenshot","saved path="+written.toStdString());
+ emit preferencesChanged();
+ emit notice(tr("截图保存到:%1").arg(QDir::toNativeSeparators(written)),false);
+ }
+ if(!i.pendingScreenshot.isEmpty()&&QDateTime::currentMSecsSinceEpoch()>i.pendingScreenshotDeadline){
+ i.pendingScreenshot.clear();emit notice(tr("图片保存未确认完成,请查看诊断"),true);
+ }
+ }
+ if(!i.pendingFrameExport.isEmpty()){
+ QString path=i.pendingFrameExport;
+ if(!QFileInfo(path).isFile())path=QFileInfo(path).path()+QLatin1Char('/')+QFileInfo(path).completeBaseName()+QStringLiteral(".jxr");
+ const bool reported=i.snapshot.status.find(L"已保存")!=std::wstring::npos;
+ if(reported&&QFileInfo(path).size()>0&&exportFileClosed(path)){
+ const bool valid=path.endsWith(QStringLiteral(".jxr"),Qt::CaseInsensitive)||!QImageReader(path).read().isNull();
+ if(valid){i.pendingFrameExport.clear();exportCompletionNotice(exportCompletionSound(),++i.imageCompletionEvent,"image");emit notice(tr("图片导出完成:%1").arg(path),false);}
+ }
+ if(!i.pendingFrameExport.isEmpty()&&QDateTime::currentMSecsSinceEpoch()>i.pendingFrameDeadline){i.pendingFrameExport.clear();emit notice(tr("图片保存未确认完成,请查看诊断"),true);}
+ }
+ if (i.imagePhase == Impl::ImagePhase::Idle) return;
+ auto fail = [&](const QString& why) {
+ ++i.imageFailures;
+ veyra::log::warn("image-batch", std::format("item failed index={} reason={}", i.imageIndex, why.toStdString()));
+ emit notice(tr("图片未导出:%1(%2)").arg(QFileInfo(i.imageFiles[i.imageIndex]).fileName(), why), true);
+ i.imagePhase = Impl::ImagePhase::Opening; i.imageSession = 0;
+ };
+ const auto& s = i.snapshot;
+ if (i.imagePhase == Impl::ImagePhase::Opening && i.imageSession == 0) {
+ // Next item.
+ if (++i.imageIndex >= i.imageFiles.size()) {
+ i.imagePhase = Impl::ImagePhase::Idle;
+ i.imageStatus = tr("完成 %1 张,失败 %2 张").arg(i.imageDone).arg(i.imageFailures);
+ veyra::log::info("image-batch", std::format("finished done={} failed={}", i.imageDone, i.imageFailures));
+ emit imageBatchChanged();
+ emit notice(i.imageStatus, i.imageFailures > 0);
+ if(i.imageDone>0&&i.imageFailures==0)exportCompletionNotice(exportCompletionSound(),++i.imageCompletionEvent,"image-batch");
+ return;
+ }
+ const QString input = i.imageFiles[i.imageIndex];
+ i.imageTarget = QDir(i.imageFolder).filePath(QFileInfo(input).completeBaseName() + QStringLiteral("-veyra.png"));
+ i.imageStatus = tr("正在处理 %1 / %2:%3").arg(i.imageIndex + 1).arg(i.imageFiles.size()).arg(QFileInfo(input).fileName());
+ emit imageBatchChanged();
+ if (!QFileInfo(input).isFile()) { fail(tr("文件不存在")); return; }
+ if (QFileInfo::exists(i.imageTarget)) { fail(tr("输出已存在,不覆盖")); return; }
+ openPath(input);
+ i.imageSession = i.openingSessionId ? i.openingSessionId : UINT64_MAX;
+ i.imageWaits = 0;
+ return;
+ }
+ ++i.imageWaits;
+ if (i.imagePhase == Impl::ImagePhase::Opening) {
+ if (s.sessionId == i.imageSession && s.failed) { fail(tr("无法打开")); return; }
+ if (s.sessionId == i.imageSession && s.image && s.frames > 0 && !applying()) {
+ impl_->engine.saveFrame(wideOf(QDir::toNativeSeparators(i.imageTarget)));
+ i.imagePhase = Impl::ImagePhase::Saving; i.imageWaits = 0;
+ } else if (i.imageWaits > 60 * 20) { fail(tr("打开超时")); }
+ return;
+ }
+ // Saving: the engine writes on its own thread; HDR output becomes .jxr.
+ QString written = i.imageTarget;
+ if (!QFileInfo(written).isFile()) written = QFileInfo(i.imageTarget).path() + QLatin1Char('/') + QFileInfo(i.imageTarget).completeBaseName() + QStringLiteral(".jxr");
+ if (QFileInfo(written).isFile() && QFileInfo(written).size() > 0 && s.status.find(L"已保存")!=std::wstring::npos && exportFileClosed(written)) {
+ ++i.imageDone;
+ veyra::log::info("image-batch", std::format("saved index={} path={}", i.imageIndex, written.toStdString()));
+ i.imagePhase = Impl::ImagePhase::Opening; i.imageSession = 0;
+ emit imageBatchChanged();
+ } else if (i.imageWaits > 60 * 15) {
+ fail(tr("保存超时"));
+ }
+}
+
+// --- export -----------------------------------------------------------------
+// Poll the export job once per UI tick. Its snapshot is the source of the
+// numbers below; nothing here keeps a parallel counter that could drift.
+void QmlPlayerBridge::pollExport() {
+ const auto& queue=impl_->exportQueue.queue();
+ const bool changed=impl_->exportQueue.tick();
+ impl_->exportSnapshot=queue.snapshot();
+ const auto event=queue.successEvent();
+ if(event&&event!=impl_->exportNotifiedBatch){
+ impl_->exportNotifiedBatch=event;
+ exportCompletionNotice(exportCompletionSound(),event,"video-batch");
+ emit notice(uiText(queue.status()),false);
+ }
+ if(changed)emit exportChanged();
+}
+
+bool QmlPlayerBridge::exportRunning() const { return impl_->exportQueue.queue().busy(); }
+bool QmlPlayerBridge::exportPaused() const {
+ return impl_->exportSnapshot.state == engine::ExportState::Paused;
+}
+double QmlPlayerBridge::exportProgress() const { return impl_->exportSnapshot.progress; }
+QString QmlPlayerBridge::exportStatus() const {
+ if(impl_->exportSnapshot.active())return uiText(impl_->exportSnapshot.message);
+ return uiText(impl_->exportQueue.queue().status());
+}
+QString QmlPlayerBridge::exportTarget() const { return utf8Of(impl_->exportOutput); }
+int QmlPlayerBridge::exportEncoded() const { return int(impl_->exportSnapshot.encoded); }
+int QmlPlayerBridge::exportGenerated() const { return int(impl_->exportSnapshot.generated); }
+double QmlPlayerBridge::exportEtaSeconds() const { return impl_->exportSnapshot.etaSeconds; }
+int QmlPlayerBridge::exportQueueCount() const { return int(std::count_if(impl_->exportQueue.queue().items().begin(),impl_->exportQueue.queue().items().end(),[](const auto& i){return i.state==engine::ExportItemState::Queued;})); }
+int QmlPlayerBridge::exportQueueFailures() const { return int(impl_->exportQueue.queue().failures()); }
+QString QmlPlayerBridge::exportQueueFailure() const { return uiText(impl_->exportSnapshot.lastQueueFailure); }
+
+// HEVC or H.264: the engine's export entry takes this as a flag, so it is a real
+// choice with a real effect rather than a label.
+bool QmlPlayerBridge::exportHevc() const { return impl_->exportHevc; }
+void QmlPlayerBridge::setExportHevc(bool value) {
+ if (impl_->exportHevc == value) return;
+ impl_->exportHevc = value;
+ emit exportChanged();
+}
+
+// Export bitrate: 0 means the encoder's constant-quality default, which is what
+// the engine's exportBitrateMbps field documents.
+int QmlPlayerBridge::exportBitrateMbps() const { return int(impl_->exportBitrateMbps); }
+void QmlPlayerBridge::setExportBitrateMbps(int value) {
+ const uint32_t want = uint32_t(std::clamp(value, 0, 300));
+ if (impl_->exportBitrateMbps == want) return;
+ impl_->exportBitrateMbps = want;
+ emit exportChanged();
+}
+
+int QmlPlayerBridge::exportRateControl() const { return int(impl_->exportRateControl); }
+void QmlPlayerBridge::setExportRateControl(int value) {
+ if (value < 0 || value > 2) return;
+ const auto want = static_cast<sink::ExportRateControl>(value);
+ if (impl_->exportRateControl == want) return;
+ impl_->exportRateControl = want;
+ emit exportChanged();
+}
+
+QString QmlPlayerBridge::exportPresetName() const {
+ return impl_->exportPresetName.empty() ? tr("当前播放设置") : utf8Of(impl_->exportPresetName);
+}
+
+int QmlPlayerBridge::exportSrTargetIndex() const {
+ return impl_->exportResolutionIndex;
+}
+void QmlPlayerBridge::setExportSrTargetIndex(int index) {
+ if (index < -1 || index > 6 || impl_->exportResolutionIndex == index) return;
+ impl_->exportResolutionIndex = index;
+ emit exportChanged();
+}
+
+double QmlPlayerBridge::exportTrimStart() const { return impl_->exportTrimStartSeconds; }
+void QmlPlayerBridge::setExportTrimStart(double seconds) {
+ if (!std::isfinite(seconds)) return;
+ const double duration = impl_->snapshot.duration;
+ const double end = impl_->exportTrimEndSeconds > 0.0 ? impl_->exportTrimEndSeconds : duration;
+ const double maxStart = end > 0.05 ? end - 0.05 : 0.0;
+ const double value = std::clamp(seconds, 0.0, std::max(0.0, maxStart));
+ if (std::abs(impl_->exportTrimStartSeconds - value) < 0.0005) return;
+ const auto selected=impl_->exportQueue.selectedId();
+ if(selected&&!impl_->exportQueue.queue().setTrim(selected,value,impl_->exportTrimEndSeconds))return;
+ impl_->exportTrimStartSeconds = value;
+ emit exportChanged();
+}
+
+double QmlPlayerBridge::exportTrimEnd() const { return impl_->exportTrimEndSeconds; }
+void QmlPlayerBridge::setExportTrimEnd(double seconds) {
+ if (!std::isfinite(seconds)) return;
+ const double duration = impl_->snapshot.duration;
+ const double sourceEnd = duration > 0.0 ? duration : seconds;
+ const double value = std::clamp(seconds, 0.0, std::max(0.0, sourceEnd));
+ const double start = impl_->exportTrimStartSeconds;
+ if (value > 0.0 && value <= start + 0.05) return;
+ if (std::abs(impl_->exportTrimEndSeconds - value) < 0.0005) return;
+ const auto selected=impl_->exportQueue.selectedId();
+ if(selected&&!impl_->exportQueue.queue().setTrim(selected,impl_->exportTrimStartSeconds,value))return;
+ impl_->exportTrimEndSeconds = value;
+ emit exportChanged();
+}
+
+QString QmlPlayerBridge::srTargetLabel() const {
+ // The label follows the SR target, because that is what sets the output size.
+ switch (srTargetIndex()) {
+ case 1: return QStringLiteral("2K");
+ case 2: return QStringLiteral("4K");
+ case 3: return QStringLiteral("8K");
+ case 4: return QStringLiteral("5K");
+ case 5: return QStringLiteral("6K");
+ case 6: return QStringLiteral("7K");
+ default: return tr("源尺寸");
+ }
+}
+
+int QmlPlayerBridge::srTargetIndex() const {
+ // UI IDs 1/2/3 remain 2K/4K/8K; append 4/5/6 for 5K/6K/7K.
+ switch (settings().srTarget) {
+ case pipeline::SrTarget::Qhd: return 1;
+ case pipeline::SrTarget::Uhd4K: return 2;
+ case pipeline::SrTarget::Uhd8K: return 3;
+ case pipeline::SrTarget::Uhd5K: return 4;
+ case pipeline::SrTarget::Uhd6K: return 5;
+ case pipeline::SrTarget::Uhd7K: return 6;
+ }
+ return 0;
+}
+void QmlPlayerBridge::setSrTargetIndex(int index) {
+ if(index<1||index>6)return;
+ auto s = settings();
+ pipeline::SrTarget want = pipeline::SrTarget::Uhd4K;
+ switch (index) {
+ case 1: want = pipeline::SrTarget::Qhd; break;
+ case 2: want = pipeline::SrTarget::Uhd4K; break;
+ case 3: want = pipeline::SrTarget::Uhd8K; break;
+ case 4: want = pipeline::SrTarget::Uhd5K; break;
+ case 5: want = pipeline::SrTarget::Uhd6K; break;
+ case 6: want = pipeline::SrTarget::Uhd7K; break;
+ default: break;
+ }
+ if (s.srTarget == want) return;
+ s.srTarget = want;
+ impl_->commit(std::move(s));
+ emit settingsChanged();
+}
+
+QVariantList QmlPlayerBridge::presetChoices() const {
+ // One list for both kinds; the label carries the distinction so the export page
+ // can offer "any preset" without a second control.
+ QVariantList out;
+ out << QVariantMap{{"id", QStringLiteral("-1")}, {"label", tr("当前播放设置")}};
+ const auto& entries = impl_->facade.presets().entries();
+ for (size_t i = 0; i < entries.size(); ++i) {
+ QVariantMap item;
+ item["id"] = QString::number(i);
+ item["label"] = utf8Of(entries[i].name)
+ + (entries[i].kind == engine::ChainMode::Node ? tr(" · 节点") : QString());
+ item["disabled"] = entries[i].kind == engine::ChainMode::Node;
+ out << item;
+ }
+ return out;
+}
+
+void QmlPlayerBridge::pauseExport(bool paused) {
+ impl_->exportJob.pause(paused);
+ pollExport();
+}
+
+QString QmlPlayerBridge::formatTime(double seconds) const { return mmss(seconds); }
+
+QString QmlPlayerBridge::diagnosticsReport() const {
+ // Engine-reported values only. A diagnostic that guesses is worse than none.
+ const auto& s = impl_->snapshot;
+ QStringList lines;
+ lines << tr("状态: %1").arg(uiText(s.status));
+ lines << tr("源: %1x%2 旋转 %3° 标称 %4 fps")
+ .arg(s.sourceWidth).arg(s.sourceHeight).arg(s.sourceRotationDegrees)
+ .arg(s.nominalSourceFps, 0, 'f', 2);
+ lines << tr("提交 FPS: %1").arg(s.submissionFps ? QString::number(*s.submissionFps, 'f', 2) : tr("未测量"));
+ lines << tr("晚点: 当前 %1 ms / P95 %2 ms").arg(s.lateMs, 0, 'f', 2).arg(s.lateP95Ms, 0, 'f', 2);
+ lines << tr("调度等待 P95: %1 ms").arg(s.schedulingWaitP95Ms, 0, 'f', 2);
+ lines << tr("处理 CPU P95: %1 ms").arg(s.processCpuP95Ms, 0, 'f', 2);
+ lines << tr("呈现 CPU P95: %1 ms").arg(s.presentCpuP95Ms, 0, 'f', 2);
+ lines << tr("帧: 已处理 %1 生成 %2").arg(s.frames).arg(s.generated);
+ lines << tr("NR 求值 %1 / NVOF %2").arg(s.nrEvaluated).arg(s.nvofExecuted);
+ if (s.capture) {
+ lines << tr("采集: 接收 %1 丢弃 %2 速率 %3 fps")
+ .arg(s.captureReceived).arg(s.captureDropped).arg(s.captureFps, 0, 'f', 2);
+ }
+ if (!s.backendWarning.empty()) lines << tr("后端告警: %1").arg(uiText(s.backendWarning));
+ if (!s.colorStatus.empty()) lines << tr("色彩: %1").arg(uiText(s.colorStatus));
+ if (!s.videoHdrStatus.empty()) lines << tr("Video HDR: %1").arg(uiText(s.videoHdrStatus));
+ return lines.join(QLatin1Char('\n'));
+}
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/FrameGeneration.cpp b/src/ui/bridge/FrameGeneration.cpp
new file mode 100644
index 00000000..f3e2fcd7
--- /dev/null
+++ b/src/ui/bridge/FrameGeneration.cpp
@@ -0,0 +1,349 @@
+// QML bridge: FrameGeneration responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- frame generation --------------------------------------------------------
+QString QmlPlayerBridge::fgBackendName() const {
+ switch(settings().frameGenerationBackend){
+ case engine::FrameGenerationBackend::Dlss:return QStringLiteral("dlss");
+ case engine::FrameGenerationBackend::XeSS:return QStringLiteral("xess");
+ case engine::FrameGenerationBackend::Fsr:return QStringLiteral("fsr3");
+ case engine::FrameGenerationBackend::Fsr4:return QStringLiteral("fsr4");
+ case engine::FrameGenerationBackend::Vfg:return QStringLiteral("vfg");
+ }
+ return {};
+}
+QVariantList QmlPlayerBridge::fgBackendChoices() const {
+ QVariantList choices = {
+ QVariantMap{{"id","dlss"},{"label",tr("DLSS 帧生成")}},
+ QVariantMap{{"id","xess"},{"label",tr("Intel XeSS · 实验")}},
+ QVariantMap{{"id","fsr3"},{"label",tr("FSR 3.1 · 2X")}},
+ QVariantMap{{"id","fsr4"},{"label",tr("FSR 4 ML · RX 9000 · 实验")}},
+ QVariantMap{{"id","vfg"},{"label",tr("NVIDIA VFG · RTX 40 / 50")}}
+ };
+ const auto caps = effectCapabilities();
+ for (auto& choice : choices) {
+ auto row = choice.toMap();
+ const auto cap = caps.value(row.value("id").toString()).toMap();
+ row["disabled"] = !cap.value("available").toBool();
+ row["note"] = cap.value("reason");
+ choice = row;
+ }
+ return choices;
+}
+QString QmlPlayerBridge::fgProviderText() const {
+ const auto& s=impl_->snapshot;
+ if(fgBackendName()==QLatin1String("vfg")){
+ if(!vfgHardwarePossible())return tr("VFG 需要 NVIDIA Ada / Blackwell 显卡(RTX 40 / 50)");
+ if(!effectCapabilities().value("vfg").toMap().value("available").toBool())return tr("未找到 VFG 运行组件,请在组件页核对路径");
+ return tr("VFG 支持 2X~8X 和低 / 中 / 高质量;6X~8X 为实验档,高倍高质量会增加处理时间");
+ }
+ if(engine::fsrFrameGeneration(s.applied.frameGenerationBackend)&&s.applied.multiplier>1&&!s.fsrProviderVersion.empty())
+ return tr("实际运行:FSR %1 · 2X").arg(QString::fromStdString(s.fsrProviderVersion));
+ if(fgBackendName()==QLatin1String("fsr4"))return tr("FSR 4 ML 需要支持的 RX 9000 和驱动;实卡待验");
+ if(fgBackendName()==QLatin1String("fsr3"))return tr("FSR 3.1 跨厂商补帧 · 最高 2X");
+ if(fgBackendName()==QLatin1String("xess"))
+ return fgMaxMultiplier()<4?tr("当前 XeSS 模块未匹配 3X / 4X 解锁版本;2X 可用,请在组件页核对版本"):
+ tr("2X 为原生路径,3X / 4X 为实验解锁;失败原因见诊断");
+ return tr("NVIDIA RTX 补帧;倍率以运行库实际能力为准");
+}
+// XeSS ceiling (SettingsWindow): 4X with the audited unlock provider, else 2X,
+// or a running session's reported interpolation count above 2X.
+int xessCeiling(const engine::PlayerSnapshot& s) {
+ static const bool audited = gfx::XessMfgUnlock::providerIsAudited(
+ (runtime::localDataDirectory() / L"intel" / L"experimental" / L"libxess_fg.dll").wstring());
+ int cap = audited ? 4 : 2;
+ // A running context reports the count it was CREATED with (3X -> 2), not
+ // what the provider allows: it may raise the ceiling, never lower it.
+ // Lowering it made 4X vanish after picking 3X until the backend was reset.
+ // The highest ceiling any context has reported this run stays offered:
+ // a later context created at 2X reports 1 and must not hide 3X/4X again.
+ static int seen = 0;
+ if (s.xessMaxInterpolatedFrames > 1) seen = std::max(seen, std::clamp(s.xessMaxInterpolatedFrames + 1, 2, 4));
+ return std::max(cap, seen);
+}
+void QmlPlayerBridge::setFgBackendName(const QString& value) {
+ if(value!=QLatin1String("dlss")&&value!=QLatin1String("xess")&&value!=QLatin1String("fsr3")&&value!=QLatin1String("fsr4")&&value!=QLatin1String("vfg")){emit notice(tr("未知补帧后端"),true);return;}
+ const auto availability = effectCapabilities().value(value).toMap();
+ if (!availability.value("available").toBool()) { emit notice(availability.value("reason").toString(), true); emit settingsChanged(); return; }
+ auto s = settings();
+ const auto want = value == QLatin1String("xess") ? engine::FrameGenerationBackend::XeSS
+ : value == QLatin1String("fsr3") ? engine::FrameGenerationBackend::Fsr
+ : value == QLatin1String("fsr4") ? engine::FrameGenerationBackend::Fsr4
+ : value == QLatin1String("vfg") ? engine::FrameGenerationBackend::Vfg
+ : engine::FrameGenerationBackend::Dlss;
+ if (s.frameGenerationBackend == want) return;
+ if(want==engine::FrameGenerationBackend::Vfg&&(!vfgHardwarePossible()||!pipeline::VfgBackend::runtimeAvailable(runtime::localRuntimeDirectory().wstring()))){
+ emit notice(!vfgHardwarePossible()?tr("VFG 需要 NVIDIA Ada / Blackwell 显卡(RTX 40 / 50)"):tr("未找到 VFG 运行组件,请在组件页核对路径"),true);emit settingsChanged();return;
+ }
+ if (want == engine::FrameGenerationBackend::Fsr4 && !fsr4Possible()) {
+ // Keep the previous choice; the menu snaps back to it.
+ emit notice(tr("FSR 4 ML 补帧只支持 AMD RX 9000 显卡,当前显卡不能使用,已保持原来的补帧方式"), true);
+ emit settingsChanged();
+ return;
+ }
+ s.frameGenerationBackend = want;
+ // A DLSS multiplier above XeSS's ceiling used to make the switch fail
+ // silently in effect (the backend stayed DLSS). Clamp to the ceiling instead.
+ auto& chain = impl_->chain;
+ const auto beforeMultiplier = chain.fgMultiplier;
+ const int cap = want == engine::FrameGenerationBackend::XeSS ? xessCeiling(impl_->snapshot)
+ : engine::fsrFrameGeneration(want) ? 2 : want==engine::FrameGenerationBackend::Vfg?8:6;
+ chain.fgMultiplier=normalizeFgMultiplier(chain.fgMultiplier,want,uint32_t(cap));
+ const bool clamped = chain.fgMultiplier != beforeMultiplier;
+ if(!impl_->commit(s)){
+ chain.fgMultiplier = beforeMultiplier;
+ emit notice(tr("补帧后端切换未被接受,原设置保留"),true);return;
+ }
+ if (clamped) emit notice(tr("所选补帧后端的倍率已调整为 %1X").arg(chain.fgMultiplier), false);
+ emit settingsChanged();
+ emitChainChanged();
+}
+
+int QmlPlayerBridge::fgMaxMultiplier() const {
+ // AppShell/SettingsWindow rules. Capabilities report GENERATED frames, so the
+ // multiplier ceiling is that count + 1 (DLSS MultiFrameCountMax 5 = 6X on
+ // Blackwell, 1 = 2X on Ada). Unknown DLSS capability offers the full list; a
+ // new context validates it. XeSS: 4X with the audited unlock provider, else
+ // 2X, or what a running session already reported above 2X.
+ const auto& s = impl_->snapshot;
+ if(settings().frameGenerationBackend==engine::FrameGenerationBackend::Vfg)return 8;
+ if(engine::fsrFrameGeneration(settings().frameGenerationBackend))return 2;
+ if (settings().frameGenerationBackend == engine::FrameGenerationBackend::XeSS)
+ return xessCeiling(s);
+ if (s.fgCapabilityKnown && s.fgMultiFrameMax > 0) return std::clamp(s.fgMultiFrameMax + 1, 2, 6);
+ return 6;
+}
+
+QVariantList QmlPlayerBridge::fgMultiplierChoices() const {
+ // Only multipliers the chosen backend supports are offered: DLSS reaches 6X on
+ // capable hardware, XeSS stops at 4X. Offering a value the provider would
+ // refuse is the same lie as a dead control.
+ const bool xess = settings().frameGenerationBackend
+ == engine::FrameGenerationBackend::XeSS;
+ const int ceiling = xess ? std::min(fgMaxMultiplier(), 4) : fgMaxMultiplier();
+ QVariantList out;
+ const auto choices=settings().frameGenerationBackend==engine::FrameGenerationBackend::Vfg?
+ std::span<const uint32_t>(engine::kVfgMultiplierChoices):std::span<const uint32_t>(engine::kFgMultiplierChoices);
+ for (const auto choice : choices) {
+ const int m = int(choice);
+ if (m < 2 || m > ceiling) continue;
+ QVariantMap item;
+ item["id"] = QString::number(m);
+ item["label"] = QString::number(m) + QStringLiteral("X");
+ out << item;
+ }
+ return out;
+}
+
+int QmlPlayerBridge::vfgQuality()const{return int(settings().vfgQuality);}
+void QmlPlayerBridge::setVfgQuality(int value){
+ if(value<0||uint32_t(value)>=engine::kVfgQualityCount)return;auto s=settings();if(s.vfgQuality==uint32_t(value))return;
+ s.vfgQuality=uint32_t(value);
+ if(!impl_->commit(s)){emit notice(tr("VFG 质量设置未被接受,原设置保留"),true);return;}
+ emit settingsChanged();emitChainChanged();
+}
+
+bool QmlPlayerBridge::fgStrict() const { return impl_->chain.fgStrictAdmission; }
+void QmlPlayerBridge::setFgStrict(bool value) {
+ if (impl_->chain.fgStrictAdmission == value) return;
+ impl_->chain.fgStrictAdmission = value;
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message;
+ impl_->chain.fgStrictAdmission = !value; impl_->revalidate();
+ emit notice(uiText(error), true);
+ }
+ emit settingsChanged();
+ emitChainChanged();
+}
+
+// 低延迟队列 is the presentation queue (1.4.4 PresentationSettings.enabled),
+// not EnhancementSettings::lowLatency, which means "NR before SR".
+bool QmlPlayerBridge::fgLowQueue() const { return impl_->presentation.enabled; }
+void QmlPlayerBridge::setFgLowQueue(bool value) {
+ if (impl_->presentation.enabled == value) return;
+ impl_->presentation.enabled = value;
+ applyPresentation();
+}
+
+// --- design gap A1-A5: flow, cadence, presentation ----------------------------
+int QmlPlayerBridge::hdrOutputMode()const{return int(settings().hdrOutputMode);}
+void QmlPlayerBridge::setHdrOutputMode(int value){if(value<0||value>1)return;auto s=settings();if(int(s.hdrOutputMode)==value)return;s.hdrOutputMode=engine::HdrOutputMode(value);if(impl_->commit(std::move(s)))emit settingsChanged();}
+int QmlPlayerBridge::fgMotionSource()const{return engine::motionUsesFlow(settings().fgMotion,settings().frameGenerationBackend)?1:0;}
+void QmlPlayerBridge::setFgMotionSource(int value){if(value<0||value>1)return;auto s=settings();s.fgMotion=engine::MotionSource(value);if(impl_->commit(std::move(s)))emit settingsChanged();}
+int QmlPlayerBridge::srMotionSource()const{return engine::motionUsesFlow(settings().srMotion)?1:0;}
+void QmlPlayerBridge::setSrMotionSource(int value){if(value<0||value>1)return;auto s=settings();s.srMotion=engine::MotionSource(value);if(impl_->commit(std::move(s)))emit settingsChanged();}
+int QmlPlayerBridge::nrMotionSource()const{return engine::motionUsesFlow(settings().nrMotion)?1:0;}
+void QmlPlayerBridge::setNrMotionSource(int value){if(value<0||value>1)return;auto s=settings();s.nrMotion=engine::MotionSource(value);if(impl_->commit(std::move(s)))emit settingsChanged();}
+int QmlPlayerBridge::flowQuality() const { return int(settings().flow); }
+void QmlPlayerBridge::setFlowQuality(int value) {
+ if (value < 0 || value > 2) return;
+ auto s = settings();
+ if (int(s.flow) == value) return;
+ s.flow = static_cast<engine::FlowQuality>(value);
+ if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受运动估算质量,原设置保留"), true); return; }
+ emit settingsChanged();
+}
+bool QmlPlayerBridge::amdFlowHalf() const { return settings().amdFlowHalfResolution; }
+void QmlPlayerBridge::setAmdFlowHalf(bool value) {
+ auto s = settings();
+ if (s.amdFlowHalfResolution == value) return;
+ s.amdFlowHalfResolution = value;
+ if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受 AMD 性能档,原设置保留"), true); return; }
+ emit settingsChanged();
+}
+bool QmlPlayerBridge::edgeAegis() const { return settings().fgMotionRefine; }
+void QmlPlayerBridge::setEdgeAegis(bool value) {
+ auto s = settings();
+ if (s.fgMotionRefine == value) return;
+ s.fgMotionRefine = value;
+ if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受边缘神盾,原设置保留"), true); return; }
+ impl_->prefs[QStringLiteral("edgeAegis")] = value;
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "edge aegis not saved");
+ emit settingsChanged();
+}
+bool QmlPlayerBridge::dlssgLite() const { return settings().dlssgLite; }
+void QmlPlayerBridge::setDlssgLite(bool value) {
+ auto s = settings();
+ if (s.dlssgLite == value) return;
+ s.dlssgLite = value;
+ if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受 DLSS 性能模式,原设置保留"), true); return; }
+ impl_->prefs[QStringLiteral("dlssgPerformance")] = value;
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "DLSS performance mode not saved");
+ emit settingsChanged();
+}
+bool QmlPlayerBridge::dlssgLiteAvailable() const {
+ static const bool present = ngx::dlssgLiteRuntimePresent(runtime::localRuntimeDirectory());
+ return present;
+}
+QString QmlPlayerBridge::dlssgLiteHint() const {
+ if (!dlssgLiteAvailable()) return tr("此软件包没有附带性能模式所需的 DLSS 帧生成 310.9.16 运行库");
+ const auto& s = impl_->snapshot;
+ if (s.running && s.dlssgLiteState == 3) return tr("目前只支持 RTX 50 系列:40/30 系的多帧解锁只适用于原版运行库");
+ if (s.running && s.dlssgLiteState == 1) return tr("生效中:NVIDIA DLSS 帧生成性能模式(测试版)");
+ return tr("NVIDIA 新增的性能模式(测试版):补帧更省 GPU,高倍率更稳,画质可能略降;导出仍用标准模式");
+}
+int QmlPlayerBridge::contentRate() const { return int(settings().content); }
+void QmlPlayerBridge::setContentRate(int value) {
+ if (value < 0 || value > int(engine::ContentRate::Capture60To30)) return;
+ auto s = settings();
+ if (int(s.content) == value) return;
+ s.content = static_cast<engine::ContentRate>(value);
+ if (!impl_->commit(std::move(s))) { emit notice(tr("引擎未接受内容节奏,原设置保留"), true); return; }
+ // Shared cadence stays in shell preferences and can be included in presets.
+ impl_->prefs[QStringLiteral("contentRate")] = value;
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "content cadence not saved");
+ emit settingsChanged();
+}
+
+int QmlPlayerBridge::displaySync() const { return int(impl_->presentation.display); }
+bool QmlPlayerBridge::fullscreenMemorySafe() const { return !impl_->prefBool("fullscreenMemoryProtection",false)||!impl_->snapshot.vramFullscreenUnsafe; }
+void QmlPlayerBridge::setPresentationFullscreen(bool value) {
+ if(impl_->presentation.fullscreen==value)return;
+ impl_->presentation.fullscreen=value;
+ impl_->engine.requestPresentation(impl_->presentation);
+ emit presentationChanged();
+ // QML's visibility notification runs inside Qt's fullscreen transition.
+ // Let Qt finish its activation request before applying no-focus/through
+ // flags and handing the foreground to the game. One queued transition,
+ // without changing polling or presentation cadence.
+ if(value&&gameMode()) QMetaObject::invokeMethod(this,[this]{
+ if(impl_->presentation.fullscreen)updateGameMode();
+ },Qt::QueuedConnection);
+ else updateGameMode();
+}
+double QmlPlayerBridge::previewAspect() const {
+ const int mode=impl_->screenFillActive?2:impl_->aspectMode;
+ auto view=impl_->engine.previewView();
+ view.mode=mode;
+ view.rotationDegrees=impl_->snapshot.sourceRotationDegrees;
+ view.displayAspect=impl_->snapshot.sourceDisplayAspect;
+ const auto e=impl_->snapshot.metrics.resolution.output;
+ if(mode==1&&e.height)return view.aspect(float(e.width),float(e.height));
+ return view.aspect(float(impl_->snapshot.sourceWidth),float(impl_->snapshot.sourceHeight));
+}
+void QmlPlayerBridge::setDisplaySync(int value) {
+ if (value < 0 || value > 2 || int(impl_->presentation.display) == value) return;
+ impl_->presentation.display = static_cast<engine::DisplaySync>(value);
+ applyPresentation();
+}
+bool QmlPlayerBridge::variableRefresh() const { return impl_->presentation.variableRefresh; }
+void QmlPlayerBridge::setVariableRefresh(bool value) {
+ if (impl_->presentation.variableRefresh == value) return;
+ impl_->presentation.variableRefresh = value;
+ // Turning it on reads the monitor again: the driver setting may have changed.
+ if (value) impl_->engine.displayStates().invalidate("vrr-switch-on");
+ applyPresentation();
+}
+int QmlPlayerBridge::vrrState() const { return impl_->vrrState; }
+int QmlPlayerBridge::displayHdr() const { return impl_->displayHdr; }
+double QmlPlayerBridge::displayRefreshHz() const { return impl_->displayRefreshHz; }
+bool QmlPlayerBridge::displayChecking() const { return impl_->displayChecking; }
+void QmlPlayerBridge::recheckDisplay() {
+ // Every stored display state becomes stale; the next status update (or the
+ // presenter's next loop) queries the shown monitor in the background.
+ auto& i = *impl_;
+ i.displayRecheckGeneration = i.engine.displayStates().invalidate("manual");
+ i.displayRecheckPending = true;
+ i.displayRecheckSince = std::chrono::steady_clock::now();
+ if (!i.displayChecking) { i.displayChecking = true; emit perfChanged(); }
+}
+QString QmlPlayerBridge::vrrHint() const { return vrrHintText(impl_->vrrState); }
+QString QmlPlayerBridge::vrrSummary() const { return vrrSummaryText(impl_->vrrState); }
+// The 信号 card's short form of vrrHintText.
+QString QmlPlayerBridge::vrrSummaryText(int level) const {
+ switch (level) {
+ case 0: return tr("无法检测");
+ case 1: return tr("不支持");
+ case 2: return tr("当前不可用");
+ case 3: return impl_->presentation.variableRefresh && impl_->snapshot.running ? tr("已请求") : tr("可用");
+ default: return tr("生效中");
+ }
+}
+QString QmlPlayerBridge::vrrHintText(int level) const {
+ // The 可变刷新 switch is available (not grey) from level 2: the monitor
+ // can do VRR even if the driver setting is still off.
+ const bool on = impl_->presentation.variableRefresh, running = impl_->snapshot.running;
+ switch (level) {
+ case 0: return tr("无法检测屏幕是否支持(目前只支持 NVIDIA 显卡)");
+ case 1: return tr("当前屏幕不支持可变刷新");
+ case 2: return tr("屏幕支持可变刷新,但当前显示模式不可用;请检查连接、刷新率及驱动设置");
+ case 3:
+ if (!on) return tr("屏幕跟着画面刷新:不撕裂,也几乎不用等刷新");
+ return running ? tr("已请求可变刷新,驱动尚未确认生效;可检查窗口/全屏 G-SYNC 设置,当前状态不代表驱动已关闭")
+ : tr("已开启,将在播放时请求可变刷新;是否生效以驱动报告为准");
+ default: return on ? tr("生效中:屏幕跟着画面刷新") : tr("屏幕正处于可变刷新(驱动已开启)");
+ }
+}
+QString QmlPlayerBridge::fgDisplayHint() const { return impl_->fgDisplayHint; }
+int QmlPlayerBridge::outputRateMode() const { return int(impl_->presentation.outputRate); }
+void QmlPlayerBridge::setOutputRateMode(int value) {
+ if (value < 0 || value > 2 || int(impl_->presentation.outputRate) == value) return;
+ impl_->presentation.outputRate = static_cast<engine::OutputRateMode>(value);
+ applyPresentation();
+}
+double QmlPlayerBridge::outputCustomFps() const { return impl_->presentation.customFps; }
+void QmlPlayerBridge::setOutputCustomFps(double value) {
+ if (!std::isfinite(value) || value < 1.0 || value > 1000.0) { emit notice(tr("输出上限需在 1–1000 fps 之间"), true); return; }
+ if (std::abs(impl_->presentation.customFps - value) < 1e-6) return;
+ impl_->presentation.customFps = value;
+ applyPresentation();
+}
+bool QmlPlayerBridge::presentationOwned() const { return impl_->snapshot.presentationProviderOwned; }
+QString QmlPlayerBridge::presentationStatus() const { return uiText(impl_->snapshot.presentationStatus); }
+void QmlPlayerBridge::applyPresentation() {
+ auto& p = impl_->presentation;
+ if (!p.valid()) return;
+ impl_->engine.requestPresentation(p);
+ impl_->prefs[QStringLiteral("presentation")] = QVariantMap{
+ {"lowQueue", p.enabled}, {"display", int(p.display)}, {"outputRate", int(p.outputRate)}, {"customFps", p.customFps}, {"vrr", p.variableRefresh}};
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "presentation settings not saved");
+ veyra::log::info("ui-presentation", std::format("lowQueue={} display={} outputRate={} customFps={:.3f} variableRefresh={}",
+ p.enabled, int(p.display), int(p.outputRate), p.customFps, p.variableRefresh));
+ emit presentationChanged();
+ emit settingsChanged();
+ emit perfChanged();
+}
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Hardware.cpp b/src/ui/bridge/Hardware.cpp
new file mode 100644
index 00000000..97ea3204
--- /dev/null
+++ b/src/ui/bridge/Hardware.cpp
@@ -0,0 +1,220 @@
+// QML bridge: Hardware responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+
+// The first hardware adapter, the one the engine opens (gfx adapter[0]): 0x10DE NVIDIA,
+// 0x1002 AMD, 0x8086 Intel, 0 unknown.
+uint32_t primaryGpuVendor() {
+ return effectGpu().vendor;
+}
+// FSR 4 ML frame generation needs an AMD RX 9000; on other GPUs the provider crashed the
+// whole program (field report 2026-10-01). Known non-AMD adapters are refused up front.
+bool fsr4Possible() { return currentEffectCapabilities().value("fsr4").toMap().value("available").toBool(); }
+// The adapter the engine opens: the user's compute GPU when one is chosen
+// (gfx::preferredAdapterLuid) and usable, else the first D3D12 hardware
+// adapter in DXGI's high-performance order, as D3D12DeviceContext picks it.
+// UI thread only; cached per preference.
+const DXGI_ADAPTER_DESC1* engineAdapterDesc(){
+ static uint64_t cachedFor=~0ull;static DXGI_ADAPTER_DESC1 cached{};static bool found=false;
+ const uint64_t preferred=gfx::preferredAdapterLuid();
+ if(cachedFor==preferred)return found?&cached:nullptr;
+ cachedFor=preferred;found=false;
+ Microsoft::WRL::ComPtr<IDXGIFactory6> factory;
+ if(FAILED(CreateDXGIFactory1(IID_PPV_ARGS(&factory))))return nullptr;
+ for(int pass=preferred?0:1;pass<2&&!found;++pass)
+ for(UINT i=0;;++i){Microsoft::WRL::ComPtr<IDXGIAdapter1> adapter;
+ if(FAILED(factory->EnumAdapterByGpuPreference(i,DXGI_GPU_PREFERENCE_HIGH_PERFORMANCE,IID_PPV_ARGS(&adapter)))||!adapter)break;
+ DXGI_ADAPTER_DESC1 d{};
+ if(FAILED(adapter->GetDesc1(&d))||(d.Flags&DXGI_ADAPTER_FLAG_SOFTWARE))continue;
+ const uint64_t luid=uint64_t(uint32_t(d.AdapterLuid.HighPart))<<32|d.AdapterLuid.LowPart;
+ if(pass==0&&luid!=preferred)continue;
+ if(FAILED(D3D12CreateDevice(adapter.Get(),D3D_FEATURE_LEVEL_12_0,__uuidof(ID3D12Device),nullptr)))continue;
+ cached=d;found=true;break;
+ }
+ return found?&cached:nullptr;
+}
+// The menu checks the same adapter as the engine. The native backend then
+// verifies CUDA compute capability and the exact adapter LUID.
+bool vfgHardwarePossible(){
+ const auto* d=engineAdapterDesc();
+ if(!d)return false;
+ const auto name=QString::fromWCharArray(d->Description);
+ return d->VendorId==0x10DE&&(name.contains(QStringLiteral("GeForce RTX 40"),Qt::CaseInsensitive)||
+ name.contains(QStringLiteral("GeForce RTX 50"),Qt::CaseInsensitive)||name.contains(QStringLiteral("Ada"),Qt::CaseInsensitive)||name.contains(QStringLiteral("Blackwell"),Qt::CaseInsensitive));
+}
+unsigned normalizeFgMultiplier(unsigned value,engine::FrameGenerationBackend backend,unsigned cap){
+ value=std::clamp(value,2u,cap);
+ return backend==engine::FrameGenerationBackend::Dlss&&value==5?4u:value;
+}
+bool QmlPlayerBridge::amdNrGpu() const { return primaryGpuVendor()==0x1002; }
+
+ui::EffectGpu effectGpu() {
+ ui::EffectGpu result;
+ const auto* d = engineAdapterDesc();
+ if (!d) return result;
+ const auto name = QString::fromWCharArray(d->Description);
+ result.vendor = d->VendorId;
+ result.deviceId = d->DeviceId;
+ result.rtx = name.contains("RTX", Qt::CaseInsensitive);
+ result.blackwell = name.contains("RTX 50", Qt::CaseInsensitive) || name.contains("Blackwell", Qt::CaseInsensitive);
+ result.ada = name.contains("RTX 40", Qt::CaseInsensitive) || name.contains("Ada", Qt::CaseInsensitive);
+ result.rx9000 = name.contains("RX 90", Qt::CaseInsensitive);
+ return result;
+}
+
+static QVariantMap scanEffectCapabilities() {
+ using H = ui::HardwareEffect;
+ const auto gpu = effectGpu();
+ const auto nr = runtime::localRuntimeDirectory();
+ const auto data = runtime::localDataDirectory();
+ auto exists = [](const std::filesystem::path& path) { std::error_code ec; return std::filesystem::is_regular_file(path, ec); };
+ const auto fsr = data / "amd/fidelityfx";
+ const bool fsrLoader = exists(fsr / "amd_fidelityfx_loader_dx12.dll");
+ QVariantMap out;
+ auto add = [&](const QString& id, H hardware, bool files, const QString& requirement) {
+ const bool supported = ui::hardwareSupports(hardware, gpu);
+ out[id] = QVariantMap{{"available", supported && files}, {"reason", !supported ? requirement : !files ? QObject::tr("当前包缺少此功能的运行组件") : QString{}}};
+ };
+ add("nr2", H::NvidiaNrSf, exists(nr / "nr-ampere/nvngx_dlssnr.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
+ out["nr0"]=out["nr2"]; // Retired preset ID; no retired runtime is loaded.
+ out["nrAuto"]=QVariantMap{{"available",gpu.vendor==0x10DE&&gpu.deviceId==0x2f04&&out.value("nr0").toMap().value("available").toBool()},
+ {"reason",gpu.deviceId!=0x2f04?QObject::tr("自动 NR 当前仅验证 RTX 5070"):!out.value("nr0").toMap().value("available").toBool()?QObject::tr("当前包缺少此功能的运行组件"):QString{}}};
+ add("nr3", H::NvidiaNr50, exists(nr / "nr-original/nvngx_dlssnr.dll"), QObject::tr("需要 NVIDIA RTX 50 / Blackwell"));
+ add("nr4", H::AmdNr, exists(nr / "../amd-nr/LmxxfNrRuntime.dll"), QObject::tr("需要 AMD RX 9000"));
+ wchar_t systemDir[MAX_PATH]{};
+ if (GetSystemDirectoryW(systemDir, MAX_PATH) && !exists(std::filesystem::path(systemDir) / "amdhip64_7.dll") && !GetModuleHandleW(L"amdhip64_7.dll")) {
+ auto cap = out.value("nr4").toMap();
+ if (cap.value("available").toBool()) { cap["available"] = false; cap["reason"] = QObject::tr("需要 AMD HIP 7 驱动运行组件"); out["nr4"] = cap; }
+ }
+ add("sr0", H::Nvidia, exists(nr / "nvngx_dlss.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
+ for (int i = 1; i <= 4; ++i) add("sr" + QString::number(i), H::Nvidia, exists(nr / "nvngx_vsr.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
+ add("sr5", H::CrossVendor, fsrLoader && exists(fsr / "amd_fidelityfx_upscaler_dx12.dll"), QObject::tr("需要支持 DirectX 12 的硬件显卡"));
+ add("dlss", H::Nvidia, exists(nr / "nvngx_dlssg.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
+ add("vfg", H::Vfg, pipeline::VfgBackend::runtimeAvailable(nr.wstring()), QObject::tr("需要 NVIDIA RTX 40 / 50(Ada / Blackwell)"));
+ add("xess", H::CrossVendor, exists(data / "intel/experimental/libxess_fg.dll") && exists(data / "intel/experimental/libxell.dll"), QObject::tr("需要支持 DirectX 12 的硬件显卡"));
+ add("fsr3", H::CrossVendor, fsrLoader && exists(fsr / "amd_fidelityfx_framegeneration_dx12.dll"), QObject::tr("需要支持 DirectX 12 的硬件显卡"));
+ add("fsr4", H::Fsr4, fsrLoader && exists(fsr / "amd_fidelityfx_framegeneration_dx12.dll"), QObject::tr("需要 AMD RX 9000"));
+ add("hdr", H::Nvidia, exists(nr / "nvngx_truehdr.dll"), QObject::tr("需要 NVIDIA RTX 显卡"));
+ add("flow0", H::Nvidia, true, QObject::tr("需要 NVIDIA RTX 显卡及 NVOF 驱动"));
+ add("flow1", H::CrossVendor, true, QObject::tr("需要支持 DirectX 12 的硬件显卡"));
+ return out;
+}
+// All callers are on the bridge/UI thread. Snapshot reads must not perform
+// filesystem probes or rebuild capability maps. Refresh on actions, language
+// changes and a slow timer so user-replaced runtime files remain discoverable.
+QVariantMap currentEffectCapabilities(bool refresh) {
+ static QVariantMap cached;
+ static QString language;
+ const auto currentLanguage=i18n::current();
+ if(refresh||cached.isEmpty()||language!=currentLanguage){
+ cached=scanEffectCapabilities();language=currentLanguage;
+ }
+ return cached;
+}
+QString fgEffectId(engine::FrameGenerationBackend backend) {
+ switch (backend) {
+ case engine::FrameGenerationBackend::Dlss: return "dlss";
+ case engine::FrameGenerationBackend::XeSS: return "xess";
+ case engine::FrameGenerationBackend::Fsr: return "fsr3";
+ case engine::FrameGenerationBackend::Fsr4: return "fsr4";
+ case engine::FrameGenerationBackend::Vfg: return "vfg";
+ }
+ return {};
+}
+QString unavailableEffects(const engine::EnhancementSettings& settings) {
+ const auto caps = currentEffectCapabilities(true);
+ QStringList requested;
+ if (settings.nr) requested << "nr" + QString::number(int(engine::currentNrRuntime(settings.nrRuntime)));
+ if (settings.sr) requested << "sr" + QString::number(settings.videoSrQuality);
+ if (settings.multiplier > 1) requested << fgEffectId(settings.frameGenerationBackend);
+ if (settings.videoHdr.enabled) requested << "hdr";
+ for (const auto& id : requested) {
+ const auto cap = caps.value(id).toMap();
+ if (!cap.value("available").toBool()) return id + ": " + cap.value("reason").toString();
+ }
+ return {};
+}
+QString disableUnavailableEffects(engine::ChainConfiguration& configuration) {
+ const auto caps = currentEffectCapabilities();
+ const auto available = [&](const char* id) { return caps.value(id).toMap().value("available").toBool(); };
+ const engine::FrameGenerationAvailability fgAvailable{
+ available("dlss"),available("xess"),available("fsr3"),available("fsr4"),available("vfg")};
+ QStringList reasons;
+ const auto sanitize = [&](engine::EffectChain& chain, engine::ChainGlobalSettings& globals) {
+ // Also migrate disabled stages: keeping an unavailable DLSS selection
+ // left the AMD dropdown at DLSS even though a fresh profile chose FSR.
+ const auto savedBackend = globals.fgBackend;
+ globals.fgBackend = engine::restoredFrameGenerationBackend(savedBackend,fgAvailable);
+ if (globals.fgBackend != savedBackend) {
+ if (engine::fsrFrameGeneration(globals.fgBackend)) chain.fgMultiplier=2;
+ else if (globals.fgBackend==engine::FrameGenerationBackend::XeSS)
+ chain.fgMultiplier=normalizeFgMultiplier(chain.fgMultiplier,globals.fgBackend,2);
+ else chain.fgMultiplier=normalizeFgMultiplier(chain.fgMultiplier,globals.fgBackend,6);
+ veyra::log::warn("fg-default",std::format("unavailable saved backend={} selected={} rememberedMultiplier={} enabled flags preserved",
+ engine::frameGenerationBackendName(savedBackend),engine::frameGenerationBackendName(globals.fgBackend),chain.fgMultiplier));
+ }
+ for (uint32_t i = 0; i < chain.nodeCount; ++i) {
+ auto& node = chain.nodes[i];
+ QString id;
+ switch (node.type) {
+ case engine::EffectType::NrEnhance: id = "nr" + QString::number(int(engine::currentNrRuntime(node.nr.runtime))); break;
+ case engine::EffectType::SuperResolution: id = "sr" + QString::number(globals.videoSrQuality); break;
+ case engine::EffectType::FrameGeneration: id = fgEffectId(globals.fgBackend); break;
+ case engine::EffectType::VideoHdr: id = "hdr"; break;
+ default: break;
+ }
+ if (id.isEmpty() || !node.enabled) continue;
+ const auto cap = caps.value(id).toMap();
+ if (!cap.value("available").toBool()) {
+ node.enabled = false;
+ reasons << id + ": " + cap.value("reason").toString();
+ }
+ }
+ if (globals.opticalFlowBackend == engine::OpticalFlowBackend::Nvidia &&
+ !caps.value("flow0").toMap().value("available").toBool())
+ globals.opticalFlowBackend = engine::OpticalFlowBackend::AmdFidelityFx;
+ };
+ sanitize(configuration.chain, configuration);
+ if (configuration.editor) {
+ auto editor = std::make_shared<engine::NodeEditorDocument>(*configuration.editor);
+ auto globals = editor->globals.value_or(static_cast<const engine::ChainGlobalSettings&>(configuration));
+ sanitize(editor->nodes, globals);
+ editor->globals = globals;
+ configuration.editor = std::move(editor);
+ }
+ reasons.removeDuplicates();
+ return reasons.join("; ");
+}
+QVariantMap QmlPlayerBridge::effectCapabilities() const { return currentEffectCapabilities(); }
+QVariantMap QmlPlayerBridge::effectAvailability(const QString& id) const {
+ const auto& s = settings();
+ const QString key = id == "nr" ? "nr" + QString::number(int(engine::currentNrRuntime(s.nrRuntime))) :
+ id == "sr" ? "sr" + QString::number(s.videoSrQuality) : id == "video-hdr" ? QString("hdr") :
+ id == "frame-generation" ? fgEffectId(s.frameGenerationBackend) :
+ id == "dlss-fg" ? QString("dlss") : id == "xess-fg" ? QString("xess") :
+ id == "fsr3-fg" ? QString("fsr3") : id == "fsr4-fg" ? QString("fsr4") : id == "vfg-fg" ? QString("vfg") : id;
+ const auto caps = effectCapabilities();
+ return caps.contains(key) ? caps.value(key).toMap() : QVariantMap{{"available", true}, {"reason", QString{}}};
+}
+QVariantList QmlPlayerBridge::nrRuntimeChoices() const {
+ QVariantList choices;
+ const auto caps = effectCapabilities();
+ for (const auto& entry : std::initializer_list<std::pair<int, QString>>{{2, "RTX 20–50 · SF 310.9.16"}, {3, tr("RTX 50 · NVIDIA 原版")}, {4, tr("RX 9000 · lmxxf(实验)")}}) {
+ const auto cap = caps.value("nr" + QString::number(entry.first)).toMap();
+ choices << QVariantMap{{"id", QString::number(entry.first)}, {"label", entry.second}, {"disabled", !cap.value("available").toBool()}, {"note", cap.value("reason")}};
+ }
+ return choices;
+}
+QVariantList QmlPlayerBridge::srBackendChoices() const {
+ QVariantList choices;
+ const auto caps = effectCapabilities();
+ for (const auto& entry : std::initializer_list<std::pair<int, QString>>{{0, "DLSS SR"}, {4, tr("RTX 视频超分")}, {5, effectGpu().vendor == 0x1002 ? tr("FSR 3.1 / 4 · 自动兼容") : QString("FSR 3.1")}}) {
+ const auto cap = caps.value("sr" + QString::number(entry.first)).toMap();
+ choices << QVariantMap{{"id", QString::number(entry.first)}, {"label", entry.second}, {"disabled", !cap.value("available").toBool()}, {"note", cap.value("reason")}};
+ }
+ return choices;
+}
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Playback.cpp b/src/ui/bridge/Playback.cpp
new file mode 100644
index 00000000..4c9bef72
--- /dev/null
+++ b/src/ui/bridge/Playback.cpp
@@ -0,0 +1,349 @@
+// QML bridge: Playback responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- playback ---------------------------------------------------------------
+QString QmlPlayerBridge::statusText() const { return uiText(impl_->snapshot.status); }
+bool QmlPlayerBridge::running() const { return impl_->snapshot.running; }
+bool QmlPlayerBridge::paused() const { return impl_->snapshot.transport == engine::TransportState::Paused; }
+bool QmlPlayerBridge::failed() const { return impl_->snapshot.failed; }
+bool QmlPlayerBridge::isImage() const { return impl_->snapshot.image; }
+bool QmlPlayerBridge::isCapture() const { return impl_->snapshot.capture; }
+bool QmlPlayerBridge::hasSource() const { return impl_->snapshot.running || impl_->snapshot.image; }
+bool QmlPlayerBridge::openingSource() const { return impl_->openingSource; }
+double QmlPlayerBridge::position() const { return impl_->snapshot.position; }
+double QmlPlayerBridge::duration() const { return impl_->snapshot.duration; }
+double QmlPlayerBridge::progress() const {
+ const double d = impl_->snapshot.duration;
+ return d > 0.01 ? std::clamp(impl_->snapshot.position / d, 0.0, 1.0) : 0.0;
+}
+QString QmlPlayerBridge::positionText() const { return mmss(impl_->snapshot.position); }
+QString QmlPlayerBridge::durationText() const { return mmss(impl_->snapshot.duration); }
+
+// --- source -----------------------------------------------------------------
+QString QmlPlayerBridge::sourceName() const {
+ if (impl_->sourceLabel.empty()) return QString();
+ if(impl_->liveKind==QLatin1String("url"))return tr("网络视频 · %1").arg(impl_->liveLabel);
+ return QFileInfo(utf8Of(impl_->sourceLabel)).fileName();
+}
+QString QmlPlayerBridge::sourceSummary() const {
+ const auto& s = impl_->snapshot;
+ if (!s.sourceWidth) return QString();
+ // Reported values only: no upscaling claim, no invented bit depth.
+ return QStringLiteral("%1x%2").arg(s.sourceWidth).arg(s.sourceHeight);
+}
+int QmlPlayerBridge::sourceWidth() const { return int(impl_->snapshot.sourceWidth); }
+int QmlPlayerBridge::sourceHeight() const { return int(impl_->snapshot.sourceHeight); }
+double QmlPlayerBridge::sourceFps() const { return impl_->snapshot.nominalSourceFps; }
+int QmlPlayerBridge::sourceRotation() const { return impl_->snapshot.sourceRotationDegrees; }
+int QmlPlayerBridge::previewRotation() const { return int(impl_->engine.previewView().userQuarterTurns)*90; }
+void QmlPlayerBridge::rotatePictureClockwise() {
+ if(!hasSource()||!impl_->engine.rotatePreviewClockwise(impl_->snapshot.sessionId))return;
+ // An in-progress protection selection uses the previous coordinate system.
+ beginProtectionDraw(QString());
+ tickSubtitles();
+ if(gameMode()){updateGameGeometry();updateGameMode();emit gameModeChanged();}
+ veyra::log::info("ui-rotation",std::format("session={} clockwise={}",impl_->snapshot.sessionId,previewRotation()));
+ emit compareChanged();
+}
+double QmlPlayerBridge::sourceAspect() const {
+ const auto& s = impl_->snapshot;
+ // A known DAR already includes SAR/rotation. With no DAR, rotate the coded
+ // extent as the presenter does; phone files can omit SAR yet carry a matrix.
+ engine::PreviewView view;
+ view.displayAspect=s.sourceDisplayAspect;
+ view.rotationDegrees=s.sourceRotationDegrees;
+ return view.aspect(float(s.sourceWidth),float(s.sourceHeight));
+}
+
+// --- live performance -------------------------------------------------------
+// XeSS generates inside the provider: the engine only submits source frames,
+// so its own rate would read 60 while the SDK presents 120. Show the provider's
+// reported submissions for XeSS (AppShell: "SDK提交(非屏幕实测)").
+static bool xessPresenting(const engine::PlayerSnapshot& s) {
+ return s.fgActive && s.applied.frameGenerationBackend == engine::FrameGenerationBackend::XeSS &&
+ s.metrics.flow.xessSdkSubmitFps > 0;
+}
+double QmlPlayerBridge::submitFps() const {
+ const auto& s = impl_->snapshot;
+ return xessPresenting(s) ? s.metrics.flow.xessSdkSubmitFps : s.submissionFps.value_or(0.0);
+}
+bool QmlPlayerBridge::submitFpsKnown() const { return xessPresenting(impl_->snapshot) || impl_->snapshot.submissionFps.has_value(); }
+QString QmlPlayerBridge::submitFpsLabel() const { return xessPresenting(impl_->snapshot) ? tr("SDK 提交") : tr("提交"); }
+double QmlPlayerBridge::lateMs() const { return impl_->snapshot.lateMs; }
+double QmlPlayerBridge::lateP95Ms() const { return impl_->snapshot.lateP95Ms; }
+QString QmlPlayerBridge::metricsSummary() const {
+ const auto& s = impl_->snapshot;
+ // Submit FPS, named as such: it is what we handed to the presenter, not what
+ // the panel scanned out. There is no "display FPS" because we cannot measure
+ // one, and a number we did not measure must not be shown as if we had.
+ if (!s.submissionFps) return tr("未测量");
+ return tr("提交 %1").arg(*s.submissionFps, 0, 'f', 1);
+}
+bool QmlPlayerBridge::nrActive() const { return impl_->snapshot.nrActive; }
+bool QmlPlayerBridge::nrAutoActive() const {return impl_->snapshot.nrAutoActive;}
+int QmlPlayerBridge::nrAutoPercent() const {return int(impl_->snapshot.nrAutoPercent);}
+QString QmlPlayerBridge::nrAutoStatus() const {
+ const auto& s=impl_->snapshot;
+ if(s.nrAutoActive)return tr("NR 自动 %1% · %2×%3").arg(s.nrAutoPercent).arg(s.nrAutoWidth).arg(s.nrAutoHeight);
+ if(s.nrAutoStatus==L"自动NR实例池不可用,保留1080p NR")return tr("自动 NR 实例池不可用,保留固定 1080p 档");
+ if(!s.nrAutoStatus.empty())return tr("当前配置未启用自动 NR,保留固定 1080p 档");
+ return {};
+}
+bool QmlPlayerBridge::srActive() const { return impl_->snapshot.srActive; }
+bool QmlPlayerBridge::fgActive() const { return impl_->snapshot.fgActive; }
+bool QmlPlayerBridge::captureRecovering() const { return impl_->snapshot.captureRecovering; }
+double QmlPlayerBridge::captureFps() const { return impl_->snapshot.captureFps; }
+double QmlPlayerBridge::captureDropped() const { return double(impl_->snapshot.captureDropped); }
+QString QmlPlayerBridge::backendWarning() const { return uiText(impl_->snapshot.backendWarning); }
+
+// --- commands ---------------------------------------------------------------
+void QmlPlayerBridge::openFileDialog() {
+ veyra::log::info("qml-file", "openFileDialog entered");
+ const QString path = QFileDialog::getOpenFileName(
+ nullptr, tr("打开视频或图片"), QString(),
+ tr("媒体文件 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.jpg *.jpeg *.png *.bmp *.webp);;所有文件 (*)"));
+ veyra::log::info("qml-file", path.isEmpty() ? "openFileDialog cancelled" : "openFileDialog selected file");
+ if (!path.isEmpty()) openPath(path);
+}
+int QmlPlayerBridge::thumbnailGeneration() const { return impl_->thumbnailGeneration; }
+
+QObject* QmlPlayerBridge::playlist() const { return impl_->playlist; }
+void QmlPlayerBridge::showPlaylist() { emit playlistRequested(); }
+void QmlPlayerBridge::addPlaylistFilesDialog() {
+ const auto paths = QFileDialog::getOpenFileNames(nullptr, tr("添加文件到播放列表"), {},
+ tr("媒体文件 (*.mp4 *.mkv *.mov *.avi *.webm *.ts *.m2ts *.mts *.m4v *.wmv *.mpg *.mpeg *.vob *.flv *.ogv *.asf *.3gp *.jpg *.jpeg *.png *.bmp *.webp);;所有文件 (*)"));
+ if (!paths.isEmpty()) { impl_->playlist->addPaths(paths); emit playlistRequested(); }
+}
+void QmlPlayerBridge::addPlaylistFolderDialog() {
+ const auto path = QFileDialog::getExistingDirectory(nullptr, tr("导入文件夹到播放列表"));
+ if (!path.isEmpty()) { impl_->playlist->addPaths({path}); emit playlistRequested(); }
+}
+void QmlPlayerBridge::openDroppedUrls(const QList<QUrl>& urls) {
+ // A single file on the video retains drag-to-open. Folder/multi-file drops
+ // append to the playlist; dropping inside PlaylistWindow always appends.
+ if (urls.size() == 1) {
+ const QUrl url = urls.front();
+ if(!url.isLocalFile()){openUrl(url);return;}
+ if (url.isLocalFile() && !QFileInfo(url.toLocalFile()).isDir()) { openUrl(url); return; }
+ }
+ impl_->playlist->addUrls(urls);
+ emit playlistRequested();
+}
+void QmlPlayerBridge::tickPlaylist() {
+ const auto& s = impl_->snapshot;
+ using T = engine::TransportState;
+ if (!impl_->playlistSession) return;
+ if (!impl_->liveKind.isEmpty() || utf8Of(impl_->sourceLabel) != impl_->playlistPath) {
+ impl_->playlistSession = 0; impl_->playlist->setPlayback({}, {}); return;
+ }
+ if (s.sessionId != impl_->playlistSession) return; // Ignore old session snapshots after open.
+ if (s.capture || s.remotePlay) { impl_->playlistSession = 0; impl_->playlist->setPlayback({}, {}); return; }
+ QString state = QStringLiteral("stopped");
+ switch (s.transport) {
+ case T::Opening: state = QStringLiteral("opening"); break;
+ case T::Playing: state = s.image ? QStringLiteral("image") : QStringLiteral("playing"); break;
+ case T::Paused: state = QStringLiteral("paused"); break;
+ case T::Ended: state = QStringLiteral("ended"); break;
+ case T::Failed: state = QStringLiteral("failed"); break;
+ default: break;
+ }
+ impl_->playlist->setPlayback(impl_->playlistPath, state);
+ if (s.transport != T::Ended || s.failed || s.image || impl_->openingSource ||
+ impl_->playlistCompletedSession == s.sessionId) return;
+ impl_->playlistCompletedSession = s.sessionId;
+ // Wait for this GUI tick to finish, then recheck the engine session. A stop,
+ // new file, or live source selected in between must cancel auto-advance.
+ QTimer::singleShot(0, this, [this, session = s.sessionId] {
+ const auto latest = impl_->engine.snapshot();
+ if (impl_->playlistSession == session && latest.sessionId == session &&
+ latest.transport == T::Ended && !latest.failed && !latest.image && impl_->liveKind.isEmpty())
+ impl_->playlist->advanceAfterEnd();
+ });
+}
+
+void QmlPlayerBridge::openPath(const QString& path) {
+ if (path.isEmpty()) return;
+ flushHdrMemory();impl_->hdrTitleApplied.clear();
+ const bool network=media::networkMediaInput(wideOf(path));
+ if (QFileInfo(path).isDir()) {
+ impl_->playlist->addPaths({path}); emit playlistRequested(); return;
+ }
+ if (!network&&PlaylistModel::supported(path) && !impl_->playlist->containsPath(path)) impl_->playlist->addPaths({path});
+ impl_->playlistPath = path;
+ impl_->playlist->setPlayback(path, QStringLiteral("opening"));
+ rememberPosition(true);
+ impl_->exportQueue.setSelectedId(0);
+ ++impl_->liveOpenGen; impl_->pendingLiveText.clear(); // a waiting live open is dropped
+ impl_->exportTrimStartSeconds = 0.0;
+ impl_->exportTrimEndSeconds = 0.0;
+ emit exportChanged();
+ impl_->openingSource = true;
+ impl_->openingSessionId = 0;
+ const std::wstring wide = wideOf(path);
+ impl_->sourceLabel = wide;
+ impl_->liveKind.clear();
+ impl_->liveLabel.clear();
+ if(network){impl_->liveKind=QStringLiteral("url");impl_->liveLabel=QUrl(path).host();}
+ ++impl_->thumbnailGeneration;
+ emit thumbnailSourceChanged(network?QString():path);
+ emit thumbnailGenerationChanged();
+ if(!network)impl_->facade.noteRecentFile(wide);
+ emit recentFilesChanged();
+ // Switch to a page with a video area, then settle the native window's
+ // geometry, and only then open. The presenter samples the window's client
+ // size once at initialisation; opening before that point is what produced a
+ // 1x1 swapchain.
+ // Only leave the current page when the user is choosing a source from home.
+ // Opening a file from the professional page keeps them there, which is what the
+ // design's source menu implies.
+ if (impl_->currentPage.isEmpty() || impl_->currentPage == QLatin1String("home"))
+ emit navigate(QStringLiteral("min"));
+ if(!network)rememberSource(QStringLiteral("file"), path);
+ if (impl_->preOpen) impl_->preOpen();
+ auto options = impl_->options;
+ options.softwareDecode = impl_->prefString("decode") == QLatin1String("software");
+ options.hardwareDecodeOnly = impl_->prefString("decode") == QLatin1String("hardware");
+ options.deinterlace=deinterlaceAvailable()&&impl_->prefBool("deinterlace",true);
+ // Network / server playback (#48): read at open, like the decode choice above.
+ options.network.level=media::networkBufferLevelFromId(impl_->prefString("networkBuffer").toStdString());
+ options.network.startupPrebufferSeconds=impl_->prefs.value(QStringLiteral("networkPrebuffer"),-1).toInt();
+ options.network.autoReconnect=impl_->prefBool("networkAutoReconnect",true);
+ options.network.corrupt=media::corruptPolicyFromId(impl_->prefString("networkCorrupt").toStdString());
+ impl_->engine.open(impl_->videoWindow, wide, options);
+ impl_->openingSessionId = impl_->engine.snapshot().sessionId;
+ impl_->playlistSession = network?0:impl_->openingSessionId;
+ impl_->resumeSession = 0;
+ if ((impl_->prefBool("rememberPosition", true)||impl_->prefBool("autoResume",false))) {
+ const auto saved = impl_->prefs.value("positions").toMap().value(path).toMap();
+ if (!saved.isEmpty()) { impl_->resumeSession = impl_->openingSessionId; impl_->resumeAt = saved.value("at").toDouble(); }
+ }
+ refreshSubtitles(network?std::wstring():wide);
+}
+
+bool QmlPlayerBridge::deinterlaceAvailable() const { return media::FFmpegDeinterlacer::available(); }
+void QmlPlayerBridge::openNetworkDialog(){emit navigate(QStringLiteral("network"));}
+bool QmlPlayerBridge::openNetworkAddress(const QString& address){
+ const QUrl url(address.trimmed(),QUrl::StrictMode);
+ if(!url.isValid()||url.host().isEmpty()||!media::networkMediaInput(wideOf(url.scheme()+QStringLiteral(":")))){
+ emit notice(tr("请输入有效的 HTTP、HTTPS 或 RTSP 视频地址"),true);return false;
+ }
+ openPath(url.adjusted(QUrl::RemoveFragment).toString(QUrl::FullyEncoded));return true;
+}
+
+void QmlPlayerBridge::togglePlayPause() {
+ // AppShell's Play button: a paused session is still "running" (the worker
+ // stays alive), so the decision must come from the transport state.
+ const auto& s = impl_->snapshot;
+ using T = engine::TransportState;
+ if (s.image || s.transport == T::Opening || s.transport == T::Stopping) return;
+ if(impl_->liveKind==QLatin1String("url")&&(s.transport==T::Ended||(s.transport==T::Paused&&s.duration<=0))){
+ openNetworkAddress(QString::fromStdWString(impl_->sourceLabel));return;
+ }
+ // Capture cards and streams pause too (field request 2026-10-02): the engine stops
+ // reading and enhancing, keeps the last picture and resets the source's queue, so
+ // play resumes with the newest frame rather than a backlog. The connection stays up.
+ if (s.capture && s.running) {
+ const bool pause = s.transport == T::Playing;
+ impl_->engine.pause(pause);
+ veyra::log::info("ui-transport", pause ? "live pause" : "live resume");
+ emit notice(pause ? tr("已暂停:画面停在当前帧,不再处理新画面;点播放继续") : tr("已继续"), false);
+ return;
+ }
+ if (!s.running || s.transport == T::Ended) {
+ // Only a real file is reopened; device/stream labels are not paths.
+ const QString file = QString::fromStdWString(impl_->sourceLabel);
+ if (!file.isEmpty() && QFileInfo(file).isFile()) openPath(file);
+ return;
+ }
+ const bool pause = s.transport == T::Playing;
+ impl_->engine.pause(pause);
+ veyra::log::info("ui-transport", pause ? "pause" : "resume");
+}
+void QmlPlayerBridge::stopPlayback() {
+ flushHdrMemory();
+ impl_->playlistSession = 0;
+ impl_->playlist->setPlayback(impl_->playlistPath, QStringLiteral("stopped"));
+ rememberPosition(true);
+ ++impl_->liveOpenGen; impl_->pendingLiveText.clear();
+ impl_->openingSource = false;
+ impl_->openingSessionId = 0;
+ impl_->engine.stop();
+ stopPs5Control();
+}
+void QmlPlayerBridge::seekTo(double seconds) { impl_->engine.seek(seconds); }
+void QmlPlayerBridge::seekBy(double seconds) {
+ impl_->engine.seek(std::max(0.0, impl_->snapshot.position + seconds));
+}
+void QmlPlayerBridge::openUrl(const QUrl& url) {
+ if(!url.isLocalFile()){openNetworkAddress(url.toString(QUrl::FullyEncoded));return;}
+ if (!url.isLocalFile()) {
+ emit notice(tr("只能打开本地文件"), true);
+ return;
+ }
+ // Opened inside the drop, as AppShell's WM_DROPFILES does.
+ veyra::log::info("ui-drop", url.toLocalFile().toStdString());
+ openPath(QDir::toNativeSeparators(url.toLocalFile()));
+}
+void QmlPlayerBridge::logUi(const QString& channel, const QString& text) {
+ const std::string c = channel.toStdString();
+ veyra::log::info(c.c_str(), text.toStdString());
+}
+void QmlPlayerBridge::setWindowMask(QObject* window, const QRectF& rect) {
+ auto* w = qobject_cast<QWindow*>(window);
+ if (!w) return;
+ w->setMask(QRegion(rect.toAlignedRect()));
+}
+void QmlPlayerBridge::holdOriginal(bool held) {
+ // Releasing the key returns to whatever the 显示 page chose (off or split).
+ if (held) impl_->engine.comparison(1, false);
+ else impl_->engine.comparison(impl_->compareMode, impl_->compareBase, float(impl_->compareSplit));
+ veyra::log::info("ui-compare", held ? "hold original on" : "hold original off");
+}
+void QmlPlayerBridge::stepFrame(int direction) {
+ // A frame step is a small seek. The engine owns the real frame duration, so
+ // this is honest about being approximate rather than pretending to be exact.
+ if (!direction) return;
+ impl_->engine.seek(std::max(0.0, impl_->snapshot.position + (direction > 0 ? 1.0 / 60.0 : -1.0 / 60.0)));
+}
+
+void QmlPlayerBridge::takeScreenshot() {
+ if (!hasSource()) { emit notice(tr("没有正在播放的画面,无法截图"), true); return; }
+ if(!impl_->pendingScreenshot.isEmpty()||!impl_->pendingFrameExport.isEmpty()||imageBatchActive()){emit notice(tr("请等待当前图片导出完成"),true);return;}
+ const QString folder = screenshotDirectory();
+ if (!QDir().mkpath(folder)) { emit notice(tr("截图目录不可用:%1").arg(folder), true); return; }
+ const QString name = QStringLiteral("veyra-%1.png")
+ .arg(QDateTime::currentDateTime().toString(QStringLiteral("yyyyMMdd-HHmmss-zzz")));
+ const QString path = QDir(folder).filePath(name);
+ impl_->engine.saveFrame(wideOf(QDir::toNativeSeparators(path)));
+ impl_->pendingScreenshot=path;
+ impl_->pendingScreenshotDeadline=QDateTime::currentMSecsSinceEpoch()+30000;
+ impl_->lastScreenshot.clear();
+ veyra::log::info("ui-screenshot", "requested path=" + path.toStdString());
+ emit preferencesChanged();
+}
+
+// ---- network / server playback (#48) ------------------------------------------------
+bool QmlPlayerBridge::networkActive() const { return impl_->snapshot.network.active; }
+bool QmlPlayerBridge::networkHolding() const {
+ const auto& n = impl_->snapshot.network;
+ return n.active && (n.holding() || n.state == media::NetworkStats::State::Reconnecting);
+}
+QString QmlPlayerBridge::networkSummary() const {
+ const auto& n = impl_->snapshot.network;
+ if (!n.active) return {};
+ QStringList parts;
+ parts << tr("缓冲 %1 s").arg(n.bufferedSeconds, 0, 'f', 1);
+ parts << (n.downloadBytesPerSecond > 0 ? tr("下载 %1 MB/s").arg(n.downloadBytesPerSecond / 1048576.0, 0, 'f', 1)
+ : tr("下载 —"));
+ parts << tr("重连 %1").arg(n.reconnects);
+ if (const uint64_t lost = std::max(n.corruptPackets, n.corruptFrames); lost > 0) parts << tr("丢包 %1").arg(qulonglong(lost));
+ return parts.join(QStringLiteral(" · "));
+}
+QString QmlPlayerBridge::networkNotice() const {
+ const auto& n = impl_->snapshot.network;
+ return n.active ? uiText(n.message) : QString();
+}
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Preferences.cpp b/src/ui/bridge/Preferences.cpp
new file mode 100644
index 00000000..d6b58814
--- /dev/null
+++ b/src/ui/bridge/Preferences.cpp
@@ -0,0 +1,937 @@
+// QML bridge: Preferences responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- shell preferences -------------------------------------------------------
+bool QmlPlayerBridge::reducedMotion() const { return impl_->facade.reducedMotion(); }
+int QmlPlayerBridge::uiDeviceGeneration() const { return impl_->uiDeviceGeneration; }
+void QmlPlayerBridge::noteUiDeviceRecreated(const QString& window) {
+ ++impl_->uiDeviceGeneration;
+ veyra::log::warn("ui-device", std::format("{} scene graph recreated after a lost graphics device; icons rebuilt generation={}",
+ window.toStdString(), impl_->uiDeviceGeneration));
+ emit uiDeviceGenerationChanged();
+}
+void QmlPlayerBridge::setReducedMotion(bool value) {
+ if (impl_->facade.reducedMotion() == value) return;
+ impl_->facade.setReducedMotion(value);
+ emit settingsChanged();
+}
+QString QmlPlayerBridge::defaultPage() const { return utf8Of(impl_->facade.defaultPage()); }
+void QmlPlayerBridge::setDefaultPage(const QString& value) {
+ if (utf8Of(impl_->facade.defaultPage()) == value) return;
+ impl_->facade.setDefaultPage(wideOf(value));
+ emit settingsChanged();
+}
+QString QmlPlayerBridge::defaultPageLabel() const {
+ const QString page = defaultPage();
+ if (page == QLatin1String("min")) return tr("极简模式");
+ if (page == QLatin1String("pro")) return tr("专业模式");
+ if (page == QLatin1String("last")) return tr("上次");
+ return tr("首页");
+}
+
+QString QmlPlayerBridge::initialPage() const {
+ // The saved preference unless a test override was set; "last" reopens the
+ // page the previous session ended on.
+ if (!impl_->initialPageOverride.isEmpty()) return impl_->initialPageOverride;
+ if (defaultPage() == QLatin1String("last")) {
+ const QString last = impl_->prefString("lastPage");
+ return last.isEmpty() ? QStringLiteral("home") : last;
+ }
+ return defaultPage();
+}
+void QmlPlayerBridge::setInitialPage(const QString& value) {
+ impl_->initialPageOverride = value;
+ emit settingsChanged();
+}
+
+QString QmlPlayerBridge::currentPage() const { return impl_->currentPage; }
+void QmlPlayerBridge::setCurrentPage(const QString& value) {
+ impl_->currentPage = value;
+ static const QStringList remembered{"home", "min", "pro", "node", "set", "exp"};
+ if (remembered.contains(value) && impl_->prefString("lastPage") != value) {
+ impl_->prefs["lastPage"] = value == QLatin1String("node") ? QStringLiteral("pro") : value;
+ impl_->savePrefs();
+ }
+}
+
+QString QmlPlayerBridge::remotePlayState() const {
+ // The engine's own remote-play state word, or empty when there is none. No
+ // invented "connected" wording.
+ return uiText(impl_->snapshot.remoteRecoveryMessage);
+}
+
+QVariantList QmlPlayerBridge::componentList() const {
+ if (!impl_->componentListRead) { impl_->componentList = readComponentList(); impl_->componentListRead = true; }
+ return impl_->componentList;
+}
+void QmlPlayerBridge::refreshComponentList() {
+ auto list = readComponentList();
+ impl_->componentListRead = true;
+ if (list == impl_->componentList) return;
+ impl_->componentList = std::move(list);
+ emit componentListChanged();
+}
+QVariantList QmlPlayerBridge::readComponentList() const {
+ // Read from the runtime manifest the build produces rather than a list written
+ // by hand here, so the page cannot claim a component the package lacks.
+ QVariantList out;
+ const auto vfgDirectory=pipeline::VfgBackend::runtimeDirectory(runtime::localRuntimeDirectory().wstring());
+ const bool vfgAvailable=pipeline::VfgBackend::runtimeAvailable(runtime::localRuntimeDirectory().wstring());
+ out<<QVariantMap{{"name",QStringLiteral("NVIDIA VFG")},{"detail",QString::fromStdWString(vfgDirectory)},
+ {"loaded",vfgAvailable},{"experimental",true}};
+ const auto manifest = runtime::localRuntimeDirectory() / L"release-runtime-manifest.json";
+ QFile file(QString::fromWCharArray(manifest.c_str()));
+ if (!file.open(QIODevice::ReadOnly)) {
+ // No manifest is a reportable fact, not a reason to invent entries.
+ return out;
+ }
+ const auto document = QJsonDocument::fromJson(file.readAll());
+ const auto entries = document.isArray() ? document.array()
+ : document.object().value(QStringLiteral("files")).toArray();
+ for (const auto& value : entries) {
+ const auto object = value.toObject();
+ QVariantMap item;
+ item["name"] = object.value(QStringLiteral("name")).toString();
+ // Release manifests write fileVersion/authenticode; keep the short keys too.
+ auto field = [&](const char* primary, const char* fallback) {
+ const QString text = object.value(QLatin1String(primary)).toString();
+ return text.isEmpty() ? object.value(QLatin1String(fallback)).toString() : text;
+ };
+ const QString version = field("version", "fileVersion");
+ const QString signature = field("signature", "authenticode");
+ const bool experimental = object.value(QStringLiteral("experimental")).toBool();
+ // Several runtimes share a file name (the NR slots); the folder tells them apart.
+ const QString path = object.value(QStringLiteral("path")).toString();
+ const QString folder = path.section(QLatin1Char('/'), 0, -2);
+ QStringList detail;
+ for (const QString& part : {version, signature, folder})
+ if (!part.isEmpty()) detail << part;
+ item["detail"] = detail.join(QStringLiteral(" · "));
+ item["loaded"] = object.value(QStringLiteral("loaded")).toBool(true);
+ item["experimental"] = experimental;
+ if (!item["name"].toString().isEmpty()) out << item;
+ }
+ return out;
+}
+
+void QmlPlayerBridge::openProjectPage() {
+ // 关于 → 交流群: the group QR codes are kept current in the project README.
+ if (!QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/Likely7/Veyra-NRVideo#readme"))))
+ emit notice(tr("无法打开浏览器"), true);
+}
+
+void QmlPlayerBridge::copyDiagnostics() {
+ if (auto* clipboard = QGuiApplication::clipboard()) {
+ clipboard->setText(diagnosticsReport());
+ emit notice(tr("诊断信息已复制"), false);
+ }
+}
+
+
+// --- shell preferences (P4-f / P4-c / P4-d) --------------------------------
+QVariantMap QmlPlayerBridge::preferences() const { return impl_->prefs; }
+QString QmlPlayerBridge::gpuPriorityStatus() const {
+ const auto status=gfx::gpuPriorityStatus();
+ const auto name=[](int priority){return priority==5?tr("实时"):priority==4?tr("高"):tr("普通");};
+ if(status.state==gfx::GpuPriorityState::Pending)return tr("创建显卡会话后生效");
+ if(status.state==gfx::GpuPriorityState::Unavailable)return tr("系统不支持调整 GPU 优先级");
+ if(status.state==gfx::GpuPriorityState::Rejected)return tr("系统未接受设置,当前:%1").arg(status.actual<0?tr("未知"):name(status.actual));
+ if(status.capped)return tr("已生效:%1(抖音直播伴侣运行中,暂不使用实时)").arg(name(status.actual));
+ return tr("已生效:%1").arg(name(status.actual));
+}
+bool QmlPlayerBridge::enhancementPrewarmAvailable() const {
+ // PreviewGpuSession::prepare refuses RTX 30/40 (patched FG sessions keep the
+ // full NGX lifetime), so the switch must not look usable there either.
+ const auto gpu=effectGpu();
+ return gpu.vendor==0x10DE&&!ngx::FgCompatibilitySession::requested(gpu.vendor,gpu.deviceId);
+}
+void QmlPlayerBridge::scheduleEnhancementPrewarm(){
+ QTimer::singleShot(2000,this,[this]{
+ if(!impl_->prefBool("prewarmEnhancement",false)||!enhancementPrewarmAvailable()||impl_->openingSource||impl_->snapshot.running||!impl_->engine.idle())return;
+ if(engine::runtimeOrder(impl_->activeRuntime()))return;
+ const auto saved=impl_->prefs.value(QStringLiteral("lastSourceExtent")).toMap();
+ const auto width=saved.value("width",1920).toUInt(),height=saved.value("height",1080).toUInt();
+ const bool valid=width>=64&&height>=64&&width<=3840&&height<=2160;
+ impl_->engine.prewarmEnhancement(impl_->facade.pendingSettings(),valid?width:1920,valid?height:1080);
+ });
+}
+void QmlPlayerBridge::rememberWindowSize(int width, int height) {
+ // Only kept when the user chose "记住上次"; the key is internal.
+ if (width < 400 || height < 200 || width > 16384 || height > 16384) return;
+ const QString v = QStringLiteral("%1x%2").arg(width).arg(height);
+ if (impl_->prefs.value(QStringLiteral("lastWindow")).toString() == v) return;
+ impl_->prefs[QStringLiteral("lastWindow")] = v;
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "last window size not saved");
+}
+QRect QmlPlayerBridge::screenAvailableAt(int x, int y) const {
+ QScreen* screen = QGuiApplication::screenAt(QPoint(x, y));
+ if (!screen) screen = QGuiApplication::primaryScreen();
+ return screen ? screen->availableGeometry() : QRect(0, 0, 1920, 1040);
+}
+QRect QmlPlayerBridge::launchScreenAvailable() const {
+ const QPoint at = QCursor::pos();
+ return screenAvailableAt(at.x(), at.y());
+}
+
+bool QmlPlayerBridge::setPreference(const QString& key, const QVariant& value) {
+ if(key==QLatin1String("blackmagicNativeCapture")){
+ if(captureQueryBusy()){emit notice(tr("请等待采集设备查询完成后再切换接口"),true);return false;}
+ if(captureBlackmagicDevice())impl_->prefs[source::decklink::isPath(impl_->captureDevice)?"blackmagicNativeLastDevice":"blackmagicDirectShowLastDevice"]=utf8Of(impl_->captureDevice);
+ }
+ static const QHash<QString, std::pair<int, int>> ranges{
+ {"subtitleSize", {16, 56}}, {"subtitleFont", {0, 5}}, {"subtitleOutline", {0, 3}},
+ {"subtitleMargin", {0, 240}}, {"subtitleLines", {0, 8}},
+ // 列表模式 parameter panel width (ProPage splitter); QML clamps it to the window.
+ {"listInspectorWidth", {376, 4000}},
+ // Network sources (#48): seconds to collect before the first picture; -1 follows the buffer level.
+ {"networkPrebuffer", {-1, 60}},
+ // Live recording: the target bitrate for the file, and the frame rate
+ // cap (0 keeps the presented rate).
+ {"recordBitrateMbps", {0, 400}},
+ {"recordFps", {0, 240}}};
+ static const QStringList flags{"recordHevc", "recordAudio", "subtitleEnabled", "subtitleBackground", "subtitleFit",
+ "subtitleSecondLanguage", "audioForceStereo", "holdCompare",
+ "magewellLowLatency", "blackmagicNativeCapture", "captureShowAllFrameRates", "cinePillHidden", "exportStopsPlayback", "obsGameCapture", "autoResume", "fullscreenMemoryProtection", "prewarmEnhancement", "hdrFgCompatibility", "computeOnMonitorGpu", "deinterlace", "networkAutoReconnect"};
+ QVariant stored;
+ if (ranges.contains(key)) {
+ bool ok = false; const int n = value.toInt(&ok);
+ const auto [low, high] = ranges.value(key);
+ if (!ok || n < low || n > high) return false;
+ stored = n;
+ } else if (flags.contains(key)) {
+ stored = value.toBool();
+ } else if (key == QLatin1String("screenshotDir")) {
+ const QString dir = value.toString();
+ if (!dir.isEmpty() && !QFileInfo(dir).isDir()) { emit notice(tr("截图目录不存在:%1").arg(dir), true); return false; }
+ stored = dir;
+ } else if (key == QLatin1String("recordDir")) {
+ const QString dir = value.toString();
+ if (!dir.isEmpty() && !QFileInfo(dir).isDir()) { emit notice(tr("录制目录不存在:%1").arg(dir), true); return false; }
+ stored = dir;
+ } else if (key == QLatin1String("audioDevice")) {
+ stored = value.toString();
+ } else if (key == QLatin1String("sliderKeyStep")) {
+ // Arrow-key step of a focused slider (设置 → 通用): 1, 0.1 or 0.01.
+ bool ok = false; const double v = value.toDouble(&ok);
+ if (!ok || !(qFuzzyCompare(v, 1.0) || qFuzzyCompare(v, 0.1) || qFuzzyCompare(v, 0.01))) return false;
+ stored = v;
+ } else if (key == QLatin1String("accent")) {
+ const QString v = value.toString();
+ if (v != QLatin1String("orange") && v != QLatin1String("white")) return false;
+ stored = v;
+ } else if (key == QLatin1String("backdrop")) {
+ bool ok = false; const int n = value.toInt(&ok);
+ if (!ok || n < 0 || n > 2) return false;
+ stored = n;
+ } else if (key == QLatin1String("uiScale")) {
+ bool ok = false; const int n = value.toInt(&ok);
+ if (!ok || (n != 0 && n != 100 && n != 125 && n != 150)) return false;
+ stored = n;
+ } else if (key == QLatin1String("overlayCompat")) {
+ // 设置 → 监控软件兼容; read by main.cpp before Qt starts.
+ const QString v = value.toString();
+ if (v != QLatin1String("auto") && v != QLatin1String("off")) return false;
+ stored = v;
+ } else if (key == QLatin1String("uiRenderer")) {
+ // 设置 → 界面绘制 (veyra/ui/InterfaceRenderer.h); read by main.cpp before Qt starts.
+ const QString v = value.toString();
+ if (v != QLatin1String("software") && v != QLatin1String("gpu")) return false;
+ stored = v;
+ } else if (key == QLatin1String("gpuPriority")) {
+ const QString v=value.toString();
+ if(v!=QLatin1String("normal")&&v!=QLatin1String("high")&&v!=QLatin1String("realtime"))return false;
+ stored=v;
+ } else if (key == QLatin1String("decode")) {
+ const QString v = value.toString();
+ if (v != QLatin1String("auto") && v != QLatin1String("software") && v != QLatin1String("hardware")) return false;
+ stored = v;
+ } else if (key == QLatin1String("networkBuffer")) {
+ // Network buffer level (#48): the ids of media::NetworkBufferLevel.
+ const QString v = value.toString();
+ static const QStringList levels{"auto", "off", "small", "medium", "large"};
+ if (!levels.contains(v)) return false;
+ stored = v;
+ } else if (key == QLatin1String("networkCorrupt")) {
+ // What to do with pictures damaged by packet loss (network sources only).
+ const QString v = value.toString();
+ if (v != QLatin1String("conceal") && v != QLatin1String("keyframe")) return false;
+ stored = v;
+ } else if (key == QLatin1String("rememberPosition") || key == QLatin1String("dockPinned")) {
+ stored = value.toBool();
+ } else if (key == QLatin1String("language")) {
+ const QString v = value.toString();
+ static const QStringList languages{"auto", "zh-CN", "zh-TW", "en", "ja"};
+ if (!languages.contains(v)) return false;
+ stored = v;
+ } else if (key == QLatin1String("monitorGpu")) {
+ const QString v = value.toString();
+ if (!v.isEmpty() && std::none_of(impl_->gpuAdapters.begin(), impl_->gpuAdapters.end(), [&](const auto& a) { return a.id == v; })) return false;
+ stored = v;
+ } else if (key == QLatin1String("windowSize")) {
+ const QString v = value.toString();
+ static const QStringList sizes{"1280x800", "1600x1000", "1920x1200", "last"};
+ if (!sizes.contains(v)) return false;
+ stored = v;
+ } else {
+ return false;
+ }
+ if (impl_->prefs.value(key) == stored) return true;
+ const auto previous = impl_->prefs;
+ impl_->prefs[key] = stored;
+ if (!impl_->savePrefs()) {
+ impl_->prefs = previous;
+ emit notice(tr("偏好保存失败,已保留原设置"), true);
+ return false;
+ }
+ veyra::log::info("ui-prefs", std::format("{}={}", key.toStdString(), stored.toString().toStdString()));
+ applyPreference(key);
+ emit preferencesChanged();
+ return true;
+}
+void QmlPlayerBridge::applyPreference(const QString& key) {
+ if(key==QLatin1String("hdrFgCompatibility")){
+ impl_->presentation.hdrFgCompatibility=impl_->prefBool("hdrFgCompatibility",false);
+ impl_->engine.requestPresentation(impl_->presentation);
+ emit presentationChanged();
+ }
+ if(key==QLatin1String("prewarmEnhancement")){
+ impl_->engine.setEnhancementPrewarmEnabled(impl_->prefBool("prewarmEnhancement",false));
+ if(impl_->prefBool("prewarmEnhancement",false))scheduleEnhancementPrewarm();
+ }
+ if(key==QLatin1String("gpuPriority")){
+ const auto value=impl_->prefString("gpuPriority");
+ // Unset means the default, 实时 (field request 2026-10-05).
+ gfx::requestGpuPriority(value==QLatin1String("normal")?gfx::GpuPriority::Normal:
+ value==QLatin1String("high")?gfx::GpuPriority::High:gfx::GpuPriority::Realtime);
+ }
+ if(key==QLatin1String("overlayCompat"))updateLiveCompanionCompat();
+ if(key==QLatin1String("fullscreenMemoryProtection")){impl_->engine.setFullscreenMemoryProtection(impl_->prefBool("fullscreenMemoryProtection",false));emit snapshotChanged();}
+ if(key==QLatin1String("captureShowAllFrameRates"))emit captureChanged();
+ if (key == QLatin1String("audioDevice")) sink::setPreferredRenderEndpoint(impl_->prefString("audioDevice").toStdWString());
+ else if (key == QLatin1String("audioForceStereo")) sink::setForceStereoDownmix(impl_->prefBool("audioForceStereo", false));
+ else if (key == QLatin1String("magewellLowLatency")) source::magewell::setLowLatencyPreference(impl_->prefBool("magewellLowLatency", false));
+ else if (key == QLatin1String("blackmagicNativeCapture")) { if(impl_->captureListed)refreshCaptureDevices();emit captureChanged(); }
+ else if (key == QLatin1String("language")) {
+ const QString code = i18n::resolve(impl_->prefString("language"));
+ if (!i18n::apply(code)) emit notice(tr("这个语言的翻译没有找到,界面保持简体中文"), true);
+ if (impl_->qmlEngine) {
+ impl_->qmlEngine->setUiLanguage(i18n::current());
+ impl_->qmlEngine->retranslate();
+ // Strings the bridge builds itself (tr() in getters) follow once their
+ // properties notify: every argument-free notify signal fires once.
+ const QMetaObject* meta = metaObject();
+ QSet<int> fired;
+ for (int i = meta->propertyOffset(); i < meta->propertyCount(); ++i) {
+ const QMetaMethod notify = meta->property(i).notifySignal();
+ if (notify.isValid() && notify.parameterCount() == 0 && !fired.contains(notify.methodIndex())) {
+ fired.insert(notify.methodIndex());
+ notify.invoke(this, Qt::DirectConnection);
+ }
+ }
+ impl_->exportQueue.refresh();
+ }
+ }
+ else if (key == QLatin1String("monitorGpu") || key == QLatin1String("computeOnMonitorGpu")) {
+ if (key == QLatin1String("monitorGpu")) { impl_->resolveGpuMonitor(); impl_->gpuUtil = -1.0; emit perfChanged(); }
+ const auto before = impl_->computeLuid;
+ impl_->applyComputeGpu();
+ if (impl_->computeLuid != before) {
+ // Effect availability follows the compute GPU (NVIDIA-only effects on another card).
+ (void)currentEffectCapabilities(true);
+ // The chain is checked against the new card the way a restart checks it:
+ // DLSS moves to an available backend, NVOF to FidelityFX flow, and stages
+ // the card cannot run are switched off with their parameters kept.
+ auto candidate = impl_->currentSession();
+ const auto previous = candidate;
+ // Switching back gives the list mode its frame generation again (DLSS 4X
+ // moved to FSR 2X by the last switch returns as DLSS 4X) once the card runs it.
+ const auto caps = currentEffectCapabilities();
+ const auto runs = [&](const QString& id) { return caps.value(id).toMap().value("available").toBool(); };
+ auto& active = candidate.configurations[size_t(candidate.active)];
+ const bool listMode = !active.editor;
+ const auto memory = impl_->prefs.value(QStringLiteral("computeFgMemory")).toMap();
+ bool restored = false;
+ if (listMode && !memory.isEmpty()) {
+ const auto backend = engine::FrameGenerationBackend(memory.value(QStringLiteral("backend")).toInt());
+ const auto flow = engine::OpticalFlowBackend(memory.value(QStringLiteral("flow")).toInt());
+ if (runs(fgEffectId(backend))) {
+ active.fgBackend = backend;
+ active.chain.fgMultiplier = memory.value(QStringLiteral("multiplier")).toUInt();
+ if (flow != engine::OpticalFlowBackend::Nvidia || runs(QStringLiteral("flow0"))) active.opticalFlowBackend = flow;
+ impl_->prefs.remove(QStringLiteral("computeFgMemory"));
+ restored = true;
+ veyra::log::info("effect-availability", std::format("compute gpu switch restored backend={} multiplier={}",
+ engine::frameGenerationBackendName(backend), active.chain.fgMultiplier));
+ }
+ }
+ QStringList disabled;
+ for (auto& configuration : candidate.configurations) {
+ const auto reason = disableUnavailableEffects(configuration);
+ if (!reason.isEmpty()) disabled << reason;
+ }
+ const auto& before = previous.configurations[size_t(previous.active)];
+ if (listMode && !restored && (before.fgBackend != active.fgBackend || before.opticalFlowBackend != active.opticalFlowBackend))
+ impl_->prefs[QStringLiteral("computeFgMemory")] = QVariantMap{{QStringLiteral("backend"), int(before.fgBackend)},
+ {QStringLiteral("multiplier"), int(before.chain.fgMultiplier)}, {QStringLiteral("flow"), int(before.opticalFlowBackend)}};
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "compute gpu frame generation memory not saved");
+ if (candidate != previous) {
+ auto next = impl_->facade.pendingSettings();
+ const auto& configuration = candidate.configurations[size_t(candidate.active)];
+ configuration.apply(next);
+ if (next.validate().empty() && impl_->facade.applySettings(next, engine::runtimeOrder(configuration.chain))) {
+ impl_->session = candidate;
+ impl_->restoreConfiguration(configuration);
+ impl_->revalidate();
+ impl_->options = engine::PlayerOptions::from(next, engine::runtimeOrder(impl_->activeRuntime()));
+ if (!impl_->persistSession()) veyra::log::warn("effect-availability", "compute gpu refit not saved");
+ emitChainChanged(); emit settingsChanged();
+ } else veyra::log::warn("effect-availability", "compute gpu refit not accepted; chain unchanged");
+ if (!disabled.isEmpty()) {
+ const auto message = tr("已关闭当前硬件或包不支持的效果,参数仍保留:") + disabled.join("; ");
+ veyra::log::warn("effect-availability", message.toStdString());
+ emit notice(message, false);
+ }
+ }
+ emit effectCapabilitiesChanged(); emit fgChoicesChanged();
+ if (impl_->snapshot.running)
+ emit notice(impl_->computeLuid ? tr("运算显卡已切换为「%1」,重新打开视频后生效").arg(impl_->computeGpuName)
+ : tr("运算显卡已恢复默认(性能最强的显卡),重新打开视频后生效"), false);
+ }
+ }
+}
+QVariantList QmlPlayerBridge::gpuMonitorChoices() const {
+ QVariantList out;
+ out << QVariantMap{{"id", QString()}, {"label", tr("自动(独立显卡)")}};
+ for (const auto& a : impl_->gpuAdapters) out << QVariantMap{{"id", a.id}, {"label", a.name}};
+ return out;
+}
+QString QmlPlayerBridge::gpuMonitorName() const { return impl_->gpuMonitorName; }
+QString QmlPlayerBridge::computeGpuHint() const {
+ if (!impl_->prefBool("computeOnMonitorGpu", false)) return tr("关闭时增强、补帧和导出用性能最强的显卡");
+ if (impl_->computeLuid) return tr("增强、补帧和导出都在「%1」上运行;切换后重新打开视频生效").arg(impl_->computeGpuName);
+ return tr("上面选“自动”时仍用性能最强的显卡;选一块显卡后它也负责运算");
+}
+QString QmlPlayerBridge::uiLanguage() const { return i18n::current(); }
+void QmlPlayerBridge::setQmlEngine(QQmlEngine* engine) {
+ impl_->qmlEngine = engine;
+ if (engine) engine->setUiLanguage(i18n::current());
+}
+QVariantList QmlPlayerBridge::audioDevices() const {
+ QVariantList out;
+ out << QVariantMap{{"id", QString()}, {"label", tr("跟随系统默认")}, {"isDefault", false}};
+ const QString chosen = impl_->prefString("audioDevice");
+ bool listed = chosen.isEmpty();
+ for (const auto& e : impl_->audioEndpoints) {
+ const QString id = QString::fromStdWString(e.id);
+ listed = listed || id == chosen;
+ out << QVariantMap{{"id", id}, {"label", QString::fromStdWString(e.name) + (e.isDefault ? tr(" · 当前默认") : QString())},
+ {"isDefault", e.isDefault}};
+ }
+ // A saved device that is unplugged stays visible, marked, instead of vanishing.
+ if (!listed) out << QVariantMap{{"id", chosen}, {"label", tr("已保存的设备(未连接)")}, {"isDefault", false}, {"missing", true}};
+ return out;
+}
+QString QmlPlayerBridge::audioOutputStatus() const {
+ const auto& a = impl_->audioActive;
+ if (!a.valid) return tr("尚未打开音频输出");
+ QString text = QString::fromStdWString(a.name.empty() ? L"(未命名设备)" : a.name) + tr(" · %1 声道").arg(a.channels);
+ if (a.downmix) text += tr(" · 下混");
+ if (a.fallback) text = tr("所选设备不可用,已回落到系统默认:") + text;
+ return text;
+}
+bool QmlPlayerBridge::audioOutputFallback() const { return impl_->audioActive.valid && impl_->audioActive.fallback; }
+void QmlPlayerBridge::refreshAudioDevices() {
+ impl_->audioEndpoints = sink::enumerateRenderEndpoints();
+ impl_->audioActive = sink::activeRenderEndpoint();
+ veyra::log::info("ui-audio", std::format("render endpoints={}", impl_->audioEndpoints.size()));
+ emit audioDevicesChanged();
+}
+// --- shortcuts (P4-f) --------------------------------------------------------
+namespace {
+const QVariantMap& shortcutDefaults() {
+ static const QVariantMap d{{"playPause", "Space"}, {"fullscreen", "F"}, {"lock", "Ctrl+L"},
+ {"hold", "V"}, {"screenshot", "Ctrl+S"}, {"toggleMode", "Tab"},
+ {"gamePanel", "Home"}, {"gameExit", "Ctrl+Alt+Home"}};
+ return d;
+}
+}
+QVariantMap QmlPlayerBridge::shortcuts() const {
+ QVariantMap out = shortcutDefaults();
+ const auto custom = impl_->prefs.value("shortcuts").toMap();
+ for (auto it = custom.begin(); it != custom.end(); ++it)
+ if (out.contains(it.key())) {
+ if ((it.key()=="gamePanel"||it.key()=="gameExit") && !ui::gameKey(QKeySequence(it.value().toString(),QKeySequence::PortableText)).vk) continue;
+ out[it.key()] = it.value();
+ }
+ return out;
+}
+bool QmlPlayerBridge::setShortcut(const QString& action, const QString& sequence) {
+ if (!shortcutDefaults().contains(action)) return false;
+ const QKeySequence seq(sequence, QKeySequence::PortableText);
+ if (seq.isEmpty() || seq.count() != 1) { emit notice(tr("无效的按键"), true); return false; }
+ const QString text = seq.toString(QKeySequence::PortableText);
+ if ((action=="gamePanel"||action=="gameExit") && !ui::gameKey(seq).vk) {
+ emit notice(tr("无效的按键"),true); return false;
+ }
+ if ((action=="gamePanel"||action=="gameExit") &&
+ (text=="Ctrl+Alt+Del"||text=="Alt+Tab"||text=="Alt+F4"||text=="Ctrl+Shift+Esc"||text=="Alt+Enter")) {
+ emit notice(tr("%1 已被固定功能占用").arg(text),true); return false;
+ }
+ // Keys the shell already owns cannot be taken over.
+ static const QStringList reserved{"Esc", "F11", "Left", "Right", "Up", "Down", "Ctrl+O", "Ctrl+E",
+ "B", "Z", "X", "T", "Y", "Shift+Z", "Shift+X", "Alt+Return"};
+ if (reserved.contains(text)) { emit notice(tr("%1 已被固定功能占用").arg(text), true); return false; }
+ const auto current = shortcuts();
+ for (auto it = current.begin(); it != current.end(); ++it)
+ if (it.key() != action && it.value().toString() == text) {
+ emit notice(tr("%1 已用于其他操作").arg(text), true); return false;
+ }
+ auto custom = impl_->prefs.value("shortcuts").toMap();
+ custom[action] = text;
+ const auto previous = impl_->prefs;
+ impl_->prefs["shortcuts"] = custom;
+ if (!impl_->savePrefs()) { impl_->prefs = previous; emit notice(tr("快捷键保存失败"), true); return false; }
+ veyra::log::info("ui-prefs", std::format("shortcut {}={}", action.toStdString(), text.toStdString()));
+ const auto keys=shortcuts();
+ impl_->game.setHotkeys(ui::gameKey(QKeySequence(keys.value("gamePanel").toString(),QKeySequence::PortableText)),
+ ui::gameKey(QKeySequence(keys.value("gameExit").toString(),QKeySequence::PortableText)));
+ emit preferencesChanged();
+ return true;
+}
+void QmlPlayerBridge::resetShortcuts() {
+ const auto previous = impl_->prefs;
+ impl_->prefs.remove("shortcuts");
+ if (!impl_->savePrefs()) { impl_->prefs = previous; return; }
+ impl_->game.setHotkeys(ui::gameKey(QKeySequence("Home")),ui::gameKey(QKeySequence("Ctrl+Alt+Home")));
+ emit preferencesChanged();
+}
+bool QmlPlayerBridge::obsGameCaptureActive() const { return qApp && qApp->property("veyraObsGameCapture").toBool(); }
+bool QmlPlayerBridge::overlayCompatActive() const { return qApp && qApp->property("veyraOverlayCompat").toBool(); }
+bool QmlPlayerBridge::softwareUiActive() const { return qApp && qApp->property("veyraSoftwareUi").toBool(); }
+bool QmlPlayerBridge::rivaTunerRunning() const { return gfx::rivaTunerRunning(); }
+bool QmlPlayerBridge::presentationOverlayRunning() const {
+ return gfx::rivaTunerRunning() || gfx::nvidiaOverlayRunning() || gfx::gamePPRunning() || gfx::douyinLiveCompanionRunning();
+}
+// The field hangs with 抖音直播伴侣 (2026-10-15) came with this process at Realtime GPU
+// priority. OBS itself never asks for Realtime when hardware-accelerated GPU scheduling
+// is on (High instead, libobs-d3d11 set_priority); the same class is used here while
+// the companion runs, so neither program can hold the GPU off from the other.
+void QmlPlayerBridge::updateLiveCompanionCompat() {
+ const bool automatic = impl_->prefString("overlayCompat") != QLatin1String("off");
+ const bool running = automatic && !GetEnvironmentVariableW(L"VEYRA_TEST_IGNORE_DOUYIN", nullptr, 0)
+ && gfx::douyinLiveCompanionRunning();
+ if (running == impl_->liveCompanionCap) return;
+ impl_->liveCompanionCap = running;
+ gfx::setGpuPriorityCap(running ? gfx::GpuPriority::High : gfx::GpuPriority::Realtime);
+ const auto status = gfx::gpuPriorityStatus();
+ veyra::log::warn("overlay-hooks", std::format("Douyin live companion {}: GPU priority cap={} requested={} actual={}",
+ running ? "running" : "gone", running ? "high" : "none", int(status.requested), status.actual));
+ if (running && status.capped)
+ emit notice(tr("检测到抖音直播伴侣:GPU 优先级暂时从“实时”降为“高”,避免两个程序争用显卡时卡死;直播伴侣退出后自动恢复"), false);
+ emit preferencesChanged();
+}
+
+int QmlPlayerBridge::uiScaleActive() const { return qApp ? qApp->property("veyraUiScale").toInt() : 0; }
+void QmlPlayerBridge::openFeedbackPage() {
+ copyDiagnostics();
+ QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/Likely7/Veyra-NRVideo/issues")));
+ emit notice(tr("诊断信息已复制,可直接粘贴到反馈里"), false);
+}
+void QmlPlayerBridge::openReleasesPage() {
+ QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/Likely7/Veyra-NRVideo/releases")));
+}
+bool QmlPlayerBridge::openSponsorLink(const QString& id) {
+ // The author's pages as the author gave them (2026-10-19); the page shows buttons,
+ // never these addresses.
+ static constexpr std::pair<const char*, const char*> links[] = {
+ {"bilibili", "https://space.bilibili.com/19500532?spm_id_from=333.1007.0.0"},
+ {"douyin", "https://v.douyin.com/9s06Bf2Inqc/"},
+ {"x", "https://x.com/likely2002"},
+ {"github", "https://github.com/Likely7"},
+ {"youtube", "https://www.youtube.com/@Likely7Ai"},
+ {"kofi", "https://ko-fi.com/likely7"},
+ };
+ for (const auto& [name, url] : links) {
+ if (id != QLatin1StringView(name)) continue;
+ veyra::log::info("ui-sponsor", std::format("open {}", name));
+ // Acceptance runs click every card: they read the address from the log
+ // instead of opening a browser on the test machine.
+ if (qEnvironmentVariableIsSet("VEYRA_TEST_SPONSOR_NO_BROWSER")) {
+ veyra::log::info("ui-sponsor", std::format("test url {}", url));
+ return true;
+ }
+ if (QDesktopServices::openUrl(QUrl(QString::fromLatin1(url)))) return true;
+ emit notice(tr("无法打开浏览器"), true);
+ return false;
+ }
+ return false;
+}
+QObject* QmlPlayerBridge::updates() const { return updates_; }
+bool QmlPlayerBridge::eventFilter(QObject* watched, QEvent* event) {
+ const auto type = event->type();
+ if (watched == impl_->gameWindow && (type == QEvent::WinIdChange ||
+ (type == QEvent::PlatformSurface && static_cast<QPlatformSurfaceEvent*>(event)->surfaceEventType() ==
+ QPlatformSurfaceEvent::SurfaceCreated))) {
+ // Rebind after Qt's platform-window transition, never during teardown.
+ QMetaObject::invokeMethod(this, [this] {
+ if (!impl_->gameWindow || !impl_->gameWindow->handle()) return;
+ impl_->game.attach(reinterpret_cast<HWND>(impl_->gameWindow->winId()));
+ updateGameGeometry(); updateGameMode();
+ }, Qt::QueuedConnection);
+ }
+ if (type == QEvent::KeyPress || type == QEvent::KeyRelease) {
+ auto* key = static_cast<QKeyEvent*>(event);
+ if (!key->isAutoRepeat() && qobject_cast<QWindow*>(watched)) {
+ const QKeySequence hold(shortcuts().value("hold").toString(), QKeySequence::PortableText);
+ const int pressed = key->key() | int(key->modifiers() & ~Qt::KeypadModifier);
+ // Typing into a text field never compares.
+ const QObject* focus = QGuiApplication::focusObject();
+ const bool typing = focus && (focus->inherits("QQuickTextInput") || focus->inherits("QQuickTextEdit"));
+ if (!hold.isEmpty() && hold[0].toCombined() == pressed && !typing && impl_->prefBool("holdCompare", true)) {
+ const bool down = type == QEvent::KeyPress;
+ if (down != impl_->holdKeyDown) { impl_->holdKeyDown = down; holdOriginal(down); }
+ return true;
+ }
+ if (type == QEvent::KeyRelease && impl_->holdKeyDown && key->key() == QKeySequence(hold)[0].key()) {
+ impl_->holdKeyDown = false; holdOriginal(false);
+ }
+ }
+ } else if (type == QEvent::ApplicationDeactivate && impl_->holdKeyDown) {
+ impl_->holdKeyDown = false; holdOriginal(false);
+ }
+ return QObject::eventFilter(watched, event);
+}
+// Remembered playback positions: files only, the last 40, saved on switch/stop/exit.
+void QmlPlayerBridge::rememberPosition(bool flush) {
+ const auto& s = impl_->snapshot;
+ const QString file = QString::fromStdWString(impl_->sourceLabel);
+ if (s.running && !s.image && !s.capture && s.duration > 0 && !file.isEmpty() && QFileInfo(file).isFile()) {
+ auto positions = impl_->prefs.value("positions").toMap();
+ const double at = s.position;
+ if (at >= 0.5 && at < s.duration - 0.5) positions[file] = QVariantMap{{"at", at}, {"t", QDateTime::currentSecsSinceEpoch()}};
+ else positions.remove(file); // finished or barely started: next time from the top
+ while (positions.size() > 40) {
+ auto oldest = positions.begin();
+ for (auto it = positions.begin(); it != positions.end(); ++it)
+ if (it.value().toMap().value("t").toLongLong() < oldest.value().toMap().value("t").toLongLong()) oldest = it;
+ positions.erase(oldest);
+ }
+ impl_->prefs["positions"] = positions;
+ }
+ if (flush) impl_->savePrefs();
+}
+
+QString QmlPlayerBridge::screenshotDirectory() const {
+ const QString chosen = impl_->prefString("screenshotDir");
+ if (!chosen.isEmpty()) return chosen;
+ const QString pictures = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
+ return QDir(pictures.isEmpty() ? QDir::homePath() : pictures).filePath(QStringLiteral("Veyra"));
+}
+QString QmlPlayerBridge::lastScreenshot() const { return impl_->lastScreenshot; }
+QString QmlPlayerBridge::dataDirectory() const { return QString::fromStdWString(impl_->dataDir.wstring()); }
+// main() records the file it actually opened (it falls back to a per-process name).
+QString QmlPlayerBridge::logFile() const { return qApp ? qApp->property("veyraLogFile").toString() : QString(); }
+void QmlPlayerBridge::chooseScreenshotDirectory() {
+ const QString dir = QFileDialog::getExistingDirectory(nullptr, tr("选择截图目录"), screenshotDirectory());
+ if (!dir.isEmpty()) setPreference(QStringLiteral("screenshotDir"), dir);
+}
+void QmlPlayerBridge::openScreenshotDirectory() {
+ const QString dir = screenshotDirectory();
+ QDir().mkpath(dir);
+ if (!QDesktopServices::openUrl(QUrl::fromLocalFile(dir))) emit notice(tr("无法打开目录:%1").arg(dir), true);
+}
+void QmlPlayerBridge::openLogFolder() {
+ const QString file = logFile();
+ const QString dir = file.isEmpty() ? QString() : QFileInfo(file).absolutePath();
+ if (dir.isEmpty() || !QDesktopServices::openUrl(QUrl::fromLocalFile(dir))) emit notice(tr("日志目录不可用"), true);
+}
+void QmlPlayerBridge::openDataFolder() {
+ if (!QDesktopServices::openUrl(QUrl::fromLocalFile(dataDirectory()))) emit notice(tr("无法打开数据目录"), true);
+}
+
+// --- P5 (2026-09-29): headers, colour history, export rows, presets -------
+QString QmlPlayerBridge::sourceKind() const {
+ const auto& s = impl_->snapshot;
+ if (!hasSource()) return {};
+ if (s.image) return QStringLiteral("image");
+ if (s.remotePlay) return QStringLiteral("ps5");
+ if (!impl_->liveKind.isEmpty()) return impl_->liveKind;
+ if (s.capture) return QStringLiteral("capture");
+ return QStringLiteral("file");
+}
+QString QmlPlayerBridge::sourceTitle() const {
+ const QString kind = sourceKind();
+ if (kind.isEmpty()) return {};
+ if(kind==QLatin1String("url"))return tr("网络视频 · %1").arg(impl_->liveLabel);
+ if (kind == QLatin1String("file") || kind == QLatin1String("image")) return sourceName();
+ if (kind == QLatin1String("capture")) {
+ const QString name = impl_->prefString("captureDeviceName");
+ return tr("采集卡 · %1").arg(name.isEmpty() ? impl_->liveLabel : name);
+ }
+ if (kind == QLatin1String("ps5")) return tr("PS5 串流 · %1").arg(impl_->liveLabel);
+ if (kind == QLatin1String("moonlight")) return tr("PC 串流 · %1").arg(impl_->liveLabel);
+ if (kind == QLatin1String("xbox")) return tr("Xbox 串流 · %1").arg(impl_->liveLabel);
+ return tr("屏幕捕获 · %1").arg(impl_->liveLabel);
+}
+// "1080p60" / "1080p59.94": the reported height and nominal rate only.
+QString QmlPlayerBridge::sourceRateText() const {
+ const auto& s = impl_->snapshot;
+ if (!s.sourceHeight) return {};
+ if (s.image) return QStringLiteral("%1×%2").arg(s.sourceWidth).arg(s.sourceHeight);
+ const double fps = s.nominalSourceFps;
+ if (fps <= 0.0) return QStringLiteral("%1p").arg(s.sourceHeight);
+ const bool whole = std::abs(fps - std::round(fps)) < 0.01;
+ return QStringLiteral("%1p%2").arg(s.sourceHeight)
+ .arg(whole ? QString::number(int(std::round(fps))) : QString::number(fps, 'f', 2));
+}
+QString QmlPlayerBridge::sourceFormatText() const {
+ QStringList parts;
+ const QString rate = sourceRateText();
+ if (rate.isEmpty()) return {};
+ parts << rate;
+ if (sourceKind() == QLatin1String("capture")) {
+ for (const auto& f : impl_->captureFormatList)
+ if (f.key == impl_->captureFormatKey) {
+ const QString label = uiText(f.label);
+ const int dot = label.lastIndexOf(QString::fromUtf8("·"));
+ if (dot >= 0) parts << label.mid(dot + 1).trimmed();
+ break;
+ }
+ }
+ const QString colour = uiText(impl_->snapshot.colorStatus);
+ if (!colour.isEmpty()) parts << colour.section(QString::fromUtf8(" → "), 0, 0).trimmed();
+ return parts.join(QString::fromUtf8(" · "));
+}
+
+bool QmlPlayerBridge::colourCanUndo() const { return !impl_->colourUndo.empty(); }
+bool QmlPlayerBridge::colourCanRedo() const { return !impl_->colourRedo.empty(); }
+bool QmlPlayerBridge::colourCanPaste() const { return impl_->colourClip.has_value(); }
+namespace {
+bool isColourNode(const engine::EffectChain& chain, int index) {
+ return index >= 0 && uint32_t(index) < chain.nodeCount && chain.nodes[index].type == engine::EffectType::Color;
+}
+}
+// Undo and redo re-commit a stored state through the normal path (validation,
+// chain rebuild), marked as a replay so it does not push history of its own.
+bool QmlPlayerBridge::colourUndo() {
+ while (!impl_->colourUndo.empty()) {
+ const auto step = impl_->colourUndo.back();
+ impl_->colourUndo.pop_back();
+ if (!isColourNode(impl_->chain, step.index)) continue;
+ impl_->selectedColour = step.index;
+ const auto current = selectedColourSettings();
+ impl_->colourReplaying = true;
+ const bool ok = commitColour(step.colour);
+ impl_->colourReplaying = false;
+ if (ok) impl_->colourRedo.push_back({step.index, current});
+ impl_->colourLastIndex = -1;
+ veyra::log::info("ui-colour", std::format("undo layer={} ok={} left={}", step.index, ok, impl_->colourUndo.size()));
+ emit settingsChanged();
+ return ok;
+ }
+ emit settingsChanged();
+ return false;
+}
+bool QmlPlayerBridge::colourRedo() {
+ while (!impl_->colourRedo.empty()) {
+ const auto step = impl_->colourRedo.back();
+ impl_->colourRedo.pop_back();
+ if (!isColourNode(impl_->chain, step.index)) continue;
+ impl_->selectedColour = step.index;
+ const auto current = selectedColourSettings();
+ impl_->colourReplaying = true;
+ const bool ok = commitColour(step.colour);
+ impl_->colourReplaying = false;
+ if (ok) impl_->colourUndo.push_back({step.index, current});
+ impl_->colourLastIndex = -1;
+ veyra::log::info("ui-colour", std::format("redo layer={} ok={}", step.index, ok));
+ emit settingsChanged();
+ return ok;
+ }
+ emit settingsChanged();
+ return false;
+}
+void QmlPlayerBridge::colourCopy() {
+ if (impl_->colourIndex() < 0) { emit notice(tr("处理链中没有调色节点"), true); return; }
+ impl_->colourClip = selectedColourSettings();
+ veyra::log::info("ui-colour", "copy");
+ emit settingsChanged();
+ emit notice(tr("已复制调色参数"), false);
+}
+bool QmlPlayerBridge::colourPaste() {
+ if (!impl_->colourClip) return false;
+ auto next = *impl_->colourClip;
+ next.enabled = selectedColourSettings().enabled; // paste the grade, not the switch
+ impl_->colourLastIndex = -1; // a paste is its own step
+ const bool ok = commitColour(next);
+ veyra::log::info("ui-colour", std::format("paste ok={}", ok));
+ return ok;
+}
+
+QVariantList QmlPlayerBridge::exportItems() const {
+ QVariantList result;for(int i=0;i<impl_->exportQueue.count();++i)result<<impl_->exportQueue.get(i);return result;
+}
+void QmlPlayerBridge::addCurrentExportFile(){
+ if(!QFileInfo(utf8Of(impl_->sourceLabel)).isFile())return;
+ const auto id=impl_->exportQueue.addFile(utf8Of(impl_->sourceLabel));
+ impl_->exportQueue.queue().setTrim(id,impl_->exportTrimStartSeconds,impl_->exportTrimEndSeconds);
+ impl_->exportQueue.setSelectedId(id);emit exportChanged();
+}
+QObject* QmlPlayerBridge::exportQueueModel() const{return &impl_->exportQueue;}
+int QmlPlayerBridge::exportContainer()const{return impl_->exportContainer;}
+void QmlPlayerBridge::setExportContainer(int value){
+ if(value<0||value>1||value==impl_->exportContainer)return;
+ impl_->exportContainer=value;impl_->exportQueue.queue().setContainer(static_cast<engine::ExportContainer>(value));
+ impl_->exportQueue.refresh();
+}
+int QmlPlayerBridge::exportReadyCount()const{return int(impl_->exportQueue.queue().readyCount());}
+bool QmlPlayerBridge::exportSelectionEditable()const{
+ const auto* item=impl_->exportQueue.queue().find(impl_->exportQueue.selectedId());
+ return item&&item->state!=engine::ExportItemState::Running&&item->state!=engine::ExportItemState::Queued;
+}
+int QmlPlayerBridge::exportAudioPolicy()const{
+ const auto* item=impl_->exportQueue.queue().find(impl_->exportQueue.selectedId());return item?int(item->media.audio.policy):1;
+}
+int QmlPlayerBridge::exportSubtitlePolicy()const{
+ const auto* item=impl_->exportQueue.queue().find(impl_->exportQueue.selectedId());return item?int(item->media.subtitles.policy):1;
+}
+QVariantList QmlPlayerBridge::exportTracks()const{
+ QVariantList result;const auto* item=impl_->exportQueue.queue().find(impl_->exportQueue.selectedId());if(!item)return result;
+ for(const auto& track:item->info.tracks){const auto& selection=track.audio?item->media.audio:item->media.subtitles;
+ const bool selected=selection.policy==engine::ExportTrackPolicy::All||selection.contains(track.index);
+ result<<QVariantMap{{"index",track.index},{"audio",track.audio},{"selected",selected},{"compatible",track.compatible},
+ {"label",QStringLiteral("%1 · %2 · %3%4").arg(track.index).arg(utf8Of(track.codec)).arg(utf8Of(track.language)).arg(track.channels?QStringLiteral(" · %1 声道").arg(track.channels):QString())},
+ {"title",utf8Of(track.title)},{"action",utf8Of(track.action)}};
+ }
+ return result;
+}
+void QmlPlayerBridge::setExportTrackPolicy(bool audio,int policy){
+ if(policy<1||policy>3)return;
+ auto& queue=impl_->exportQueue.queue();const auto id=impl_->exportQueue.selectedId();const auto* item=queue.find(id);if(!item)return;
+ engine::ExportTrackSelection selection;selection.policy=static_cast<engine::ExportTrackPolicy>(policy);
+ if(selection.policy==engine::ExportTrackPolicy::Selected){
+ for(const auto& track:item->info.tracks)if(track.audio==audio){selection.indices[0]=track.index;selection.count=1;break;}
+ if(!selection.count){emit notice(tr("该文件没有可选轨道"),true);return;}
+ }
+ if(queue.setTracks(id,audio,selection))impl_->exportQueue.refresh();
+}
+void QmlPlayerBridge::toggleExportTrack(bool audio,int index,bool keep){
+ auto& queue=impl_->exportQueue.queue();const auto id=impl_->exportQueue.selectedId();const auto* item=queue.find(id);if(!item)return;
+ const auto& previous=audio?item->media.audio:item->media.subtitles;
+ engine::ExportTrackSelection selection;selection.policy=engine::ExportTrackPolicy::Selected;
+ for(const auto& track:item->info.tracks)if(track.audio==audio){
+ // Leaving "all" keeps what "all" actually carried: tracks it skipped for
+ // this container stay out instead of turning into a hard failure.
+ const bool selected=track.index==index?keep:previous.policy==engine::ExportTrackPolicy::All?track.compatible:previous.contains(track.index);
+ if(selected){if(selection.count>=selection.indices.size()){emit notice(tr("手动选择最多 64 条;保留全部不限制轨道数量"),true);return;}selection.indices[selection.count++]=track.index;}
+ }
+ if(!selection.count)selection.policy=engine::ExportTrackPolicy::None;
+ if(queue.setTracks(id,audio,selection))impl_->exportQueue.refresh();
+}
+void QmlPlayerBridge::previewExportItem(qulonglong id){
+ const auto* item=impl_->exportQueue.queue().find(id);if(!item)return;
+ const QString input=utf8Of(item->input);const double start=item->start,end=item->end;
+ if(input!=utf8Of(impl_->sourceLabel))openPath(input);
+ impl_->exportQueue.setSelectedId(id);impl_->exportTrimStartSeconds=start;impl_->exportTrimEndSeconds=end;
+ emit exportChanged();
+}
+bool QmlPlayerBridge::exportCompletionSound()const{return impl_->prefs.value(QStringLiteral("exportCompletionSound"),true).toBool();}
+void QmlPlayerBridge::setExportCompletionSound(bool enabled){
+ const auto previous=impl_->prefs;impl_->prefs[QStringLiteral("exportCompletionSound")]=enabled;
+ if(!impl_->savePrefs()){impl_->prefs=previous;emit notice(tr("提示音设置保存失败"),true);}
+ emit exportChanged();
+}
+void QmlPlayerBridge::clearFinishedExportItems() {
+ for(int row=impl_->exportQueue.count()-1;row>=0;--row){const auto& item=impl_->exportQueue.queue().items()[row];
+ if(item.state==engine::ExportItemState::Done||item.state==engine::ExportItemState::Failed||item.state==engine::ExportItemState::Cancelled)impl_->exportQueue.removeItem(item.id);
+ }
+ emit exportChanged();
+}
+// A thumbnail of any file (export queue rows), through the same provider.
+QString QmlPlayerBridge::fileThumbnailId(const QString& path, double seconds) const {
+ if (path.isEmpty()) return {};
+ return QStringLiteral("image://veyra-thumb/file/%1/%2/%3")
+ .arg(impl_->thumbnailGeneration)
+ .arg(QString::fromLatin1(path.toUtf8().toBase64(QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals)))
+ .arg(qint64(std::max(0.0, seconds) * 1000.0));
+}
+
+QString QmlPlayerBridge::capturePreviewUrl() const {
+ const auto& s = impl_->snapshot;
+ if (!s.running || s.posterRgba.empty() || !s.posterWidth || !s.posterHeight) return {};
+ if (impl_->posterSession != s.sessionId || impl_->posterUrl.isEmpty()) {
+ const QImage image(s.posterRgba.data(), int(s.posterWidth), int(s.posterHeight), int(s.posterWidth * 4),
+ QImage::Format_RGBA8888);
+ QByteArray png;
+ QBuffer buffer(&png);
+ buffer.open(QIODevice::WriteOnly);
+ image.save(&buffer, "PNG");
+ impl_->posterSession = s.sessionId;
+ impl_->posterUrl = png.isEmpty() ? QString()
+ : QStringLiteral("data:image/png;base64,") + QString::fromLatin1(png.toBase64());
+ }
+ return impl_->posterUrl;
+}
+QString QmlPlayerBridge::captureSignalLevel() const {
+ const auto& s = impl_->snapshot;
+ if (!s.running || !s.capture) return QStringLiteral("idle");
+ if (s.captureRecovering) return QStringLiteral("warn");
+ if (s.captureSampledBlack) return QStringLiteral("warn");
+ return s.captureFps > 0.5 ? QStringLiteral("ok") : QStringLiteral("warn");
+}
+QString QmlPlayerBridge::captureSignalText() const {
+ const auto& s = impl_->snapshot;
+ if (captureSignalLevel() == QLatin1String("idle")) return tr("未连接");
+ if (s.captureRecovering) return tr("正在恢复");
+ if (s.captureFps > 0.5 && s.captureSampledBlack) return tr("收到黑帧 · 检查输入制式");
+ return s.captureFps > 0.5 ? tr("正在收帧") : tr("等待信号");
+}
+
+void QmlPlayerBridge::importPresetDialog() {
+ const QString path = QFileDialog::getOpenFileName(nullptr, tr("导入预设"), QString(),
+ tr("Veyra 预设 (*.vpreset);;所有文件 (*)"));
+ if (!path.isEmpty()) importPreset(path);
+}
+bool QmlPlayerBridge::importPreset(const QString& path) {
+ std::wstring name;
+ auto& library = impl_->facade.presets();
+ const bool ok = library.importFile(std::filesystem::path(wideOf(path)), name);
+ veyra::log::info("ui-preset", std::format("import ok={} name={}", ok, utf8Of(name).toStdString()));
+ if (!ok) { emit notice(tr("导入失败:%1").arg(uiText(library.error())), true); return false; }
+ emit presetsChanged();
+ emit notice(tr("已导入预设:%1").arg(utf8Of(name)), false);
+ return true;
+}
+void QmlPlayerBridge::exportPresetDialog(int index) {
+ const auto& entries = impl_->facade.presets().entries();
+ if (index < 0 || size_t(index) >= entries.size()) return;
+ const QString path = QFileDialog::getSaveFileName(nullptr, tr("导出预设"),
+ utf8Of(entries[size_t(index)].name) + QStringLiteral(".vpreset"),
+ tr("Veyra 预设 (*.vpreset)"));
+ if (!path.isEmpty()) exportPreset(index, path);
+}
+bool QmlPlayerBridge::exportPreset(int index, const QString& path) {
+ auto& library = impl_->facade.presets();
+ if (index < 0 || size_t(index) >= library.entries().size()) return false;
+ const bool ok = library.exportEntry(size_t(index), std::filesystem::path(wideOf(path)));
+ veyra::log::info("ui-preset", std::format("export index={} ok={}", index, ok));
+ if (!ok) { emit notice(tr("导出失败:%1").arg(uiText(library.error())), true); return false; }
+ emit notice(tr("预设已导出到:%1").arg(QDir::toNativeSeparators(path)), false);
+ return true;
+}
+
+QString QmlPlayerBridge::liveOpeningText() const {
+ if (!impl_->pendingLiveText.isEmpty()) return impl_->pendingLiveText;
+ const auto& s = impl_->snapshot;
+ if (s.running || s.failed || s.transport != engine::TransportState::Opening) return {};
+ const QString status = veyra::ui::i18n::text(s.status);
+ if (s.remotePlay)
+ return status.contains(QStringLiteral("PIN")) ? status : tr("正在连接 PS5 · %1").arg(impl_->liveLabel);
+ if (impl_->liveKind == QLatin1String("screen")) return tr("正在开始屏幕捕获…");
+ if (s.capture) return tr("正在打开采集设备…");
+ return {};
+}
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Recording.cpp b/src/ui/bridge/Recording.cpp
new file mode 100644
index 00000000..f5dffc3b
--- /dev/null
+++ b/src/ui/bridge/Recording.cpp
@@ -0,0 +1,134 @@
+// QML bridge: Recording responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- live recording of the processed picture --------------------------------
+// The engine owns the encoder and the file; this side only starts, stops and
+// shows the state. The 3 second countdown is an interface animation and runs
+// before the request is sent.
+QString QmlPlayerBridge::recordingDirectory() const {
+ const QString chosen = impl_->prefString("recordDir");
+ if (!chosen.isEmpty()) return chosen;
+ const QString videos = QStandardPaths::writableLocation(QStandardPaths::MoviesLocation);
+ return QDir(videos.isEmpty() ? QDir::homePath() : videos).filePath(QStringLiteral("Veyra"));
+}
+// 0 = automatic from the picture size and frame rate (LiveRecorder).
+int QmlPlayerBridge::recordingBitrateMbps() const { return std::clamp(impl_->prefInt("recordBitrateMbps", 0), 0, 400); }
+int QmlPlayerBridge::recordingFpsLimit() const { return std::clamp(impl_->prefInt("recordFps", 0), 0, 240); }
+bool QmlPlayerBridge::recordingHevc() const { return impl_->prefBool("recordHevc", false); }
+bool QmlPlayerBridge::recordingAudio() const { return impl_->prefBool("recordAudio", true); }
+bool QmlPlayerBridge::recording() const { return impl_->recordingState.value("active").toBool(); }
+QVariantMap QmlPlayerBridge::recordingState() const { return impl_->recordingState; }
+
+void QmlPlayerBridge::startRecording() {
+ if (recording()) { emit notice(tr("录制已在进行中"), true); return; }
+ if (!hasSource()) { emit notice(tr("没有正在播放的画面,无法录制"), true); return; }
+ engine::RecordingSettings options;
+ options.directory = wideOf(recordingDirectory());
+ options.bitrateMbps = uint32_t(recordingBitrateMbps());
+ options.hevc = recordingHevc();
+ options.fpsLimit = uint32_t(std::max(0, recordingFpsLimit()));
+ options.audio = recordingAudio();
+ std::wstring error;
+ if (!impl_->engine.requestRecording(options, error)) { emit notice(uiText(error), true); return; }
+ // Shown at once; the poll fills in the file and the counters.
+ impl_->recordingState["active"] = true;
+ impl_->recordingState["failed"] = false;
+ emit recordingChanged();
+}
+void QmlPlayerBridge::stopRecording() {
+ if (!recording()) return;
+ impl_->engine.stopRecording();
+ impl_->recordingState["active"] = false;
+ emit recordingChanged();
+}
+void QmlPlayerBridge::toggleRecording() { if (recording()) stopRecording(); else startRecording(); }
+void QmlPlayerBridge::chooseRecordingDirectory() {
+ const QString dir = QFileDialog::getExistingDirectory(nullptr, tr("选择录制保存位置"), recordingDirectory());
+ if (!dir.isEmpty()) setPreference(QStringLiteral("recordDir"), dir);
+}
+void QmlPlayerBridge::openRecordingDirectory() {
+ const QString dir = recordingDirectory();
+ QDir().mkpath(dir);
+ if (!QDesktopServices::openUrl(QUrl::fromLocalFile(dir))) emit notice(tr("无法打开目录:%1").arg(dir), true);
+}
+
+void QmlPlayerBridge::chooseExportPath() {
+ if (impl_->chain.mode == engine::ChainMode::Node) {
+ emit notice(tr("节点链尚未接入导出执行器,请切换列表模式后导出"), true);
+ return;
+ }
+ const QString path = QFileDialog::getExistingDirectory(nullptr,tr("选择导出目录"),exportTarget());
+ setExportPath(path);
+}
+
+void QmlPlayerBridge::setExportPath(const QString& path) {
+ if (path.isEmpty()) return;
+ impl_->exportOutput = wideOf(path);
+ impl_->exportStatus = QFileInfo(path).fileName();
+ emit exportChanged();
+}
+
+void QmlPlayerBridge::startExport() {
+ QString error;auto settings=impl_->exportSettings(error);
+ if(!settings){emit notice(error,true);return;}
+ if(impl_->exportQueue.count()==0){
+ if(!QFileInfo(utf8Of(impl_->sourceLabel)).isFile()){emit notice(tr("请先添加要导出的文件"),true);return;}
+ const QString target=exportTarget();
+ const bool fileTarget=!target.isEmpty()&&!QFileInfo(target).isDir();
+ const auto id=impl_->exportQueue.addFile(utf8Of(impl_->sourceLabel),fileTarget?target:QString());
+ impl_->exportQueue.queue().setTrim(id,impl_->exportTrimStartSeconds,impl_->exportTrimEndSeconds);
+ impl_->exportQueue.setSelectedId(id);
+ }
+ if(impl_->exportOutput.empty())chooseExportPath();
+ if(impl_->exportOutput.empty())return;
+ const QFileInfo target(exportTarget());
+ const QString folder=target.isDir()?target.absoluteFilePath():target.absolutePath();
+ std::wstring reason;
+ if(!impl_->exportQueue.queue().start(wideOf(folder),*settings,impl_->exportHevc,impl_->exportRateControl,reason)){
+ emit notice(uiText(reason),true);emit exportChanged();return;
+ }
+ veyra::log::info("qml-export",std::format("export frozen bitrateMbps={} rateControl={} hevc={} srTarget={}",
+ settings->exportBitrateMbps,int(impl_->exportRateControl),impl_->exportHevc,int(settings->srTarget)));
+ impl_->exportQueue.refresh();pollExport();emit navigate(QStringLiteral("exp"));
+ // Leave the GPU to the export (field request 2026-10-02): whatever plays is closed,
+ // unless 导出页 → 导出时关闭正在播放的内容 is off.
+ if(impl_->prefBool("exportStopsPlayback",true)&&(hasSource()||impl_->openingSource)){
+ veyra::log::info("qml-export","export started: closing the playing source");
+ stopPlayback();emit notice(tr("已关闭正在播放的内容,显卡全部留给导出"),false);
+ }
+}
+void QmlPlayerBridge::cancelExport() {
+ impl_->exportQueue.queue().cancel();impl_->exportQueue.refresh();pollExport();emit exportChanged();
+}
+
+void QmlPlayerBridge::restartApplication() {
+ requestApplicationRestart(false);
+}
+void QmlPlayerBridge::restartForOverlayCompatibility() {
+ requestApplicationRestart(true);
+}
+void QmlPlayerBridge::requestApplicationRestart(bool overlayCompatibility) {
+ if (exportRunning()) {
+ emit notice(tr("设置已保存,请等待导出结束后重启软件"), true);
+ return;
+ }
+ rememberPosition(true);
+ qApp->setProperty("veyraOverlayCompatRestart", overlayCompatibility);
+ // main launches the replacement only after UI/engine owners unwind.
+ QCoreApplication::exit(42);
+}
+
+void QmlPlayerBridge::quit() {
+ rememberPosition(true);
+ if (auto* app = qobject_cast<QGuiApplication*>(QCoreApplication::instance())) app->quit();
+}
+
+void QmlPlayerBridge::openCaptureDialog() { emit navigate(QStringLiteral("capture")); }
+void QmlPlayerBridge::openPs5Dialog() { emit navigate(QStringLiteral("ps5")); }
+void QmlPlayerBridge::openScreenCaptureDialog() { emit navigate(QStringLiteral("screen")); }
+void QmlPlayerBridge::openAudioDialog() { emit navigate(QStringLiteral("audio")); }
+void QmlPlayerBridge::openSubtitleDialog() { emit navigate(QStringLiteral("subtitle")); }
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/RemotePlay.cpp b/src/ui/bridge/RemotePlay.cpp
new file mode 100644
index 00000000..d6574fb4
--- /dev/null
+++ b/src/ui/bridge/RemotePlay.cpp
@@ -0,0 +1,811 @@
+// QML bridge: RemotePlay responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- PS5 Remote Play (P4-e) ---------------------------------------------------
+namespace {
+constexpr uint32_t kPs5Bitrates[] = {5000, 10000, 15000, 20000, 30000, 50000, 80000, 100000};
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+std::filesystem::path ps5Settings() { return remoteplay::profileDirectory() / L"settings.ini"; }
+#endif
+}
+QVariantMap QmlPlayerBridge::ps5() const {
+ QVariantMap out = impl_->ps5Form;
+ out["status"] = impl_->ps5Status;
+ out["busy"] = impl_->ps5Busy;
+ out["profile"] = QString::fromStdWString(impl_->ps5Profile);
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ out["available"] = true;
+ out["psnReady"] = remoteplay::loadPsnAuthorization().has_value();
+ const auto& s = impl_->snapshot;
+ out["active"] = s.remotePlay && (s.running || s.transport == engine::TransportState::Opening || s.transport == engine::TransportState::Stopping);
+ const auto c = impl_->controller.capabilities();
+ out["controller"] = c.connected;
+ out["gyro"] = c.gyro && c.accel;
+ out["calibrating"] = c.calibrating;
+#else
+ out["available"] = false;
+#endif
+ return out;
+}
+QVariantList QmlPlayerBridge::ps5Profiles() const { return impl_->ps5ProfileList; }
+
+// --- PC streaming (Moonlight / Sunshine) -----------------------------------------------------------
+QObject* QmlPlayerBridge::moonlightModel() const {
+#ifdef VEYRA_ENABLE_MOONLIGHT
+ return impl_->moonlight.get();
+#else
+ return nullptr;
+#endif
+}
+bool QmlPlayerBridge::moonlightCaptured() const {
+#ifdef VEYRA_ENABLE_MOONLIGHT
+ return impl_->moonlightCapture && impl_->moonlightCapture->captured();
+#else
+ return false;
+#endif
+}
+bool QmlPlayerBridge::moonlightStatsVisible() const {
+#ifdef VEYRA_ENABLE_MOONLIGHT
+ return impl_->moonlightStatsVisible;
+#else
+ return false;
+#endif
+}
+void QmlPlayerBridge::setMoonlightStatsVisible(bool visible) {
+#ifdef VEYRA_ENABLE_MOONLIGHT
+ if (impl_->moonlightStatsVisible == visible) return;
+ impl_->moonlightStatsVisible = visible;
+ emit moonlightUiChanged();
+#else
+ (void)visible;
+#endif
+}
+void QmlPlayerBridge::openMoonlightDialog() { emit navigate(QStringLiteral("moonlight")); }
+
+// --- Xbox home streaming (unofficial) ------------------------------------------------------------------
+QObject* QmlPlayerBridge::xboxModel() const {
+#ifdef VEYRA_ENABLE_XBOX
+ return impl_->xbox.get();
+#else
+ return nullptr;
+#endif
+}
+void QmlPlayerBridge::openXboxDialog() { emit navigate(QStringLiteral("xbox")); }
+void QmlPlayerBridge::xboxDisconnect() {
+#ifdef VEYRA_ENABLE_XBOX
+ if (impl_->snapshot.xboxActive) stopPlayback();
+#endif
+}
+
+#ifdef VEYRA_ENABLE_XBOX
+void QmlPlayerBridge::setupXbox() {
+ auto& i = *impl_;
+ i.xbox = std::make_unique<ui::XboxModel>();
+ connect(i.xbox.get(), &ui::XboxModel::notice, this, &QmlPlayerBridge::notice);
+ i.xbox->setLaunchHandler([this](ui::XboxModel::Launch launch) -> bool {
+ auto& j = *impl_;
+ if (!j.videoWindow) return false;
+ rememberPosition(true);
+ j.openingSource = true;
+ j.openingSessionId = 0;
+ j.sourceLabel = L"Xbox · " + launch.label.toStdWString();
+ j.resumeSession = 0;
+ j.screenFillActive = false;
+ const bool pad = launch.desc.gamepad;
+ const QString label = launch.label;
+ auto request = std::make_shared<source::XboxConnectDesc>(std::move(launch.desc));
+ openAfterCinema(tr("正在连接 Xbox · %1").arg(label), [this, request, pad] {
+ auto& k = *impl_;
+ if (k.preOpen) k.preOpen();
+ k.engine.previewView({});
+ k.engine.openXbox(k.videoWindow, std::move(*request), k.options);
+ k.openingSessionId = k.engine.snapshot().sessionId;
+ refreshSubtitles({});
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ // The pad is polled on the UI thread at 250 Hz; the session sends changes and a 33 ms heartbeat.
+ if (pad) {
+ if (!k.acquirePad(Impl::PadXbox)) veyra::log::warn("xbox-input", "SDL gamepad initialization failed");
+ if (!k.xboxTimer) {
+ k.xboxTimer = new QTimer(this);
+ k.xboxTimer->setTimerType(Qt::PreciseTimer);
+ connect(k.xboxTimer, &QTimer::timeout, this, [this] {
+ auto& m = *impl_;
+ if (!m.snapshot.xboxActive) { m.releasePad(Impl::PadXbox); m.xboxTimer->stop(); return; }
+ const bool focused = QGuiApplication::focusWindow() != nullptr;
+ m.engine.xboxController(m.controller.poll(focused));
+ m.controller.feedback(m.engine.xboxFeedback(), focused);
+ });
+ }
+ k.xboxTimer->start(4);
+ } else {
+ if (k.xboxTimer) k.xboxTimer->stop();
+ k.releasePad(Impl::PadXbox);
+ }
+#else
+ (void)pad;
+#endif
+ });
+ rememberSource(QStringLiteral("xbox"), label);
+ return true;
+ });
+}
+
+void QmlPlayerBridge::tickXbox() {
+ auto& i = *impl_;
+ if (!i.xbox) return;
+ const auto& s = i.snapshot;
+ const bool active = s.xboxActive;
+ if (active != i.xboxWasActive) {
+ i.xboxWasActive = active;
+ i.xbox->updateStream(active, s.xbox);
+ } else if (active && ++i.xboxStatsTicks >= 15) {
+ i.xboxStatsTicks = 0;
+ i.xbox->updateStream(true, s.xbox);
+ }
+}
+#else
+void QmlPlayerBridge::tickXbox() {}
+#endif
+
+void QmlPlayerBridge::moonlightCapture(bool on) {
+#ifdef VEYRA_ENABLE_MOONLIGHT
+ auto& i = *impl_;
+ if (!i.moonlightCapture) return;
+ if (!on) {
+ i.moonlightWantCapture = false;
+ i.moonlightCapture->capture(false);
+ return;
+ }
+ if (!i.snapshot.moonlightActive || !i.videoWindow) return;
+ i.moonlightCapture->setWindow(GetAncestor(i.videoWindow, GA_ROOT));
+ // The tick keeps trying until the window is in the foreground (right after connecting it may not be yet).
+ i.moonlightWantCapture = !i.moonlightCapture->capture(true);
+#else
+ (void)on;
+#endif
+}
+
+void QmlPlayerBridge::moonlightDisconnect() {
+#ifdef VEYRA_ENABLE_MOONLIGHT
+ moonlightCapture(false);
+ if (impl_->snapshot.moonlightActive) stopPlayback();
+#endif
+}
+
+#ifdef VEYRA_ENABLE_MOONLIGHT
+void QmlPlayerBridge::setupMoonlight() {
+ auto& i = *impl_;
+ i.moonlight = std::make_unique<ui::MoonlightModel>();
+ i.moonlightCapture = std::make_unique<ui::MoonlightInputCapture>(i.engine);
+ connect(i.moonlightCapture.get(), &ui::MoonlightInputCapture::capturedChanged, this, [this](bool) { emit moonlightUiChanged(); });
+ connect(i.moonlightCapture.get(), &ui::MoonlightInputCapture::releaseRequested, this, [this] {
+ impl_->moonlightWantCapture = false;
+ emit notice(tr("已释放键盘和鼠标(点击画面重新捕获)"), false);
+ });
+ connect(i.moonlightCapture.get(), &ui::MoonlightInputCapture::quitRequested, this, [this] { moonlightDisconnect(); });
+ connect(i.moonlightCapture.get(), &ui::MoonlightInputCapture::statsRequested, this, [this] { setMoonlightStatsVisible(!moonlightStatsVisible()); });
+ connect(i.moonlight.get(), &ui::MoonlightModel::notice, this, &QmlPlayerBridge::notice);
+ i.moonlight->setLaunchHandler([this](ui::MoonlightModel::Launch launch) -> bool {
+ auto& j = *impl_;
+ if (!j.videoWindow) return false;
+ rememberPosition(true);
+ j.openingSource = true;
+ j.openingSessionId = 0;
+ j.sourceLabel = L"PC · " + launch.label.toStdWString();
+ j.resumeSession = 0;
+ j.screenFillActive = false;
+ const bool pad = (launch.desc.options.gamepadMask & 1) != 0;
+ j.moonlightWantCapture = launch.captureInput;
+ const QString label = launch.label;
+ auto request = std::make_shared<source::MoonlightConnectDesc>(std::move(launch.desc));
+ openAfterCinema(tr("正在连接 %1").arg(label), [this, request, pad] {
+ auto& k = *impl_;
+ if (k.preOpen) k.preOpen();
+ k.engine.previewView({});
+ k.engine.openMoonlight(k.videoWindow, std::move(*request), k.options);
+ k.openingSessionId = k.engine.snapshot().sessionId;
+ refreshSubtitles({});
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ // The pad is polled on the UI thread at 250 Hz and sent only when it changes.
+ if (pad) {
+ if (!k.acquirePad(Impl::PadMoonlight)) veyra::log::warn("moonlight-input", "SDL gamepad initialization failed");
+ if (!k.moonlightTimer) {
+ k.moonlightTimer = new QTimer(this);
+ k.moonlightTimer->setTimerType(Qt::PreciseTimer);
+ connect(k.moonlightTimer, &QTimer::timeout, this, [this] {
+ auto& m = *impl_;
+ if (!m.snapshot.moonlightActive) { m.releasePad(Impl::PadMoonlight); m.moonlightTimer->stop(); return; }
+ const bool focused = QGuiApplication::focusWindow() != nullptr;
+ m.engine.moonlightController(m.controller.poll(focused));
+ m.controller.feedback(m.engine.moonlightFeedback(), focused);
+ });
+ }
+ k.moonlightTimer->start(4);
+ } else {
+ if (k.moonlightTimer) k.moonlightTimer->stop();
+ k.releasePad(Impl::PadMoonlight);
+ }
+#else
+ (void)pad;
+#endif
+ });
+ rememberSource(QStringLiteral("moonlight"), label);
+ return true;
+ });
+}
+
+void QmlPlayerBridge::tickMoonlight() {
+ auto& i = *impl_;
+ if (!i.moonlight) return;
+ const auto& s = i.snapshot;
+ const bool active = s.moonlightActive;
+ if (active != i.moonlightWasActive) {
+ i.moonlightWasActive = active;
+ if (!active) {
+ i.moonlightWantCapture = false;
+ if (i.moonlightCapture) i.moonlightCapture->capture(false);
+ }
+ i.moonlight->updateStream(active, s.moonlight);
+ } else if (active && ++i.moonlightStatsTicks >= 15) {
+ i.moonlightStatsTicks = 0;
+ i.moonlight->updateStream(true, s.moonlight);
+ }
+ // Take the keyboard and mouse as soon as the picture is up (and again when the window comes to the front).
+ if (active && i.moonlightWantCapture && s.moonlight.state == source::MoonlightStats::State::Streaming) moonlightCapture(true);
+}
+#else
+void QmlPlayerBridge::tickMoonlight() {}
+#endif
+void QmlPlayerBridge::ps5Load() {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ auto& i = *impl_;
+ try {
+ const auto directory = remoteplay::profileDirectory();
+ if (i.ps5Profile.empty()) {
+ wchar_t last[80]{};
+ GetPrivateProfileStringW(L"RemotePlay", L"LastProfile", L"", last, 80, ps5Settings().c_str());
+ const std::wstring name = last;
+ if (!name.empty() && name.find_first_of(L"/\\:") == std::wstring::npos) i.ps5Profile = name;
+ }
+ i.ps5ProfileList.clear();
+ unsigned failures = 0;
+ auto add = [&](const std::filesystem::path& path) {
+ remoteplay::ProfileLoadError error{};
+ auto saved = remoteplay::loadProfile(path, &error);
+ if (saved) i.ps5ProfileList << QVariantMap{{"id", QString::fromStdWString(path.filename().wstring())},
+ {"label", QString::fromStdString(saved->host)}};
+ else if (error != remoteplay::ProfileLoadError::Missing) ++failures;
+ };
+ add(directory / "remoteplay-profile.dat");
+ std::error_code ec; size_t scanned = 0;
+ for (std::filesystem::directory_iterator it(directory, ec), end; !ec && it != end && i.ps5ProfileList.size() < 64 && scanned < 256; it.increment(ec), ++scanned) {
+ const auto id = it->path().stem().wstring();
+ if (it->path().extension() == ".dat" && id.size() == 32 &&
+ std::all_of(id.begin(), id.end(), [](wchar_t c) { return (c >= L'0' && c <= L'9') || (c >= L'a' && c <= L'f'); }))
+ add(it->path());
+ }
+ // A pairing made or found in the PS5 dialog lets a waiting PS5 手柄控制 start.
+ if (!i.ps5ProfileList.isEmpty()) i.ps5ControlNoPair = false;
+ bool known = false;
+ for (const auto& p : i.ps5ProfileList) known = known || p.toMap().value("id").toString() == QString::fromStdWString(i.ps5Profile);
+ if (!known) i.ps5Profile = i.ps5ProfileList.isEmpty() ? std::wstring{} : i.ps5ProfileList.front().toMap().value("id").toString().toStdWString();
+ // Form defaults, then the selected pairing's own values.
+ i.ps5Form = QVariantMap{{"host", QString()}, {"account", QString()}, {"quality", 3}, {"codec", 0}, {"bitrate", 2}, {"viewOnly", false},
+ {"decode", int(std::min(2u, GetPrivateProfileIntW(L"RemotePlay", L"DecodeMode", 0, ps5Settings().c_str())))},
+ {"sampling", int(std::min(1u, GetPrivateProfileIntW(L"RemotePlay", L"FineSampling", 1, ps5Settings().c_str())))}};
+ if (!i.ps5Profile.empty())
+ if (auto saved = remoteplay::loadProfile(directory / i.ps5Profile)) {
+ i.ps5Form["host"] = QString::fromStdString(saved->host);
+ i.ps5Form["account"] = QString::fromStdString(remoteplay::accountIdToBase64(saved->credentials.accountId));
+ i.ps5Form["quality"] = (saved->video.height == 1080 ? 2 : 0) + (saved->video.fps == 60 ? 1 : 0);
+ i.ps5Form["codec"] = int(saved->video.codec);
+ const auto found = std::find(std::begin(kPs5Bitrates), std::end(kPs5Bitrates), saved->video.bitrateKbps);
+ i.ps5Form["bitrate"] = found == std::end(kPs5Bitrates) ? 2 : int(found - std::begin(kPs5Bitrates));
+ i.ps5Form["viewOnly"] = saved->viewOnly;
+ }
+ if (i.ps5Status.isEmpty())
+ i.ps5Status = failures ? tr("有配对存档无法读取或解密,详情见日志。请使用原 Windows 账户;不要删除原件。")
+ : !i.ps5Profile.empty() ? tr("已加载保存的主机,直接点“连接”,无需重新填写 8 位配对码。")
+ : tr("首次使用:PS5 设置 → 系统 → 远程游玩 → 关联设备,填写账号 ID 与 8 位配对码后配对。");
+ veyra::log::info("remoteplay-ui", std::format("profiles={} readFailures={}", i.ps5ProfileList.size(), failures));
+ } catch (...) {
+ impl_->ps5Status = tr("无法读取远程游玩目录;原有配对文件不会被改动。");
+ }
+#else
+ impl_->ps5Status = tr("此版本未包含 PS5 远程游玩组件。");
+#endif
+ emit ps5Changed();
+}
+bool QmlPlayerBridge::ps5Set(const QString& key, const QVariant& value) {
+ static const QHash<QString, std::pair<int, int>> ranges{{"quality", {0, 3}}, {"codec", {0, 2}}, {"bitrate", {0, 7}}, {"decode", {0, 2}}, {"sampling", {0, 1}}};
+ if (ranges.contains(key)) {
+ bool ok = false; const int n = value.toInt(&ok); const auto [low, high] = ranges.value(key);
+ if (!ok || n < low || n > high) return false;
+ impl_->ps5Form[key] = n;
+ } else if (key == QLatin1String("viewOnly")) impl_->ps5Form[key] = value.toBool();
+ else if (key == QLatin1String("host") || key == QLatin1String("account")) impl_->ps5Form[key] = value.toString().trimmed();
+ else return false;
+ emit ps5Changed();
+ return true;
+}
+void QmlPlayerBridge::ps5SelectProfile(const QString& id) {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ if (impl_->ps5Busy) return;
+ impl_->ps5Profile = id.toStdWString();
+ WritePrivateProfileStringW(L"RemotePlay", L"LastProfile", impl_->ps5Profile.c_str(), ps5Settings().c_str());
+ impl_->ps5Status.clear();
+ ps5Load();
+ if (impl_->engine.remoteControlRequested()) startPs5Control(true);
+#else
+ Q_UNUSED(id);
+#endif
+}
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+namespace {
+remoteplay::VideoProfile ps5Video(const QVariantMap& f) {
+ remoteplay::VideoProfile p; const int q = f.value("quality").toInt();
+ p.width = q < 2 ? 1280 : 1920; p.height = q < 2 ? 720 : 1080; p.fps = (q == 0 || q == 2) ? 30 : 60;
+ p.codec = static_cast<remoteplay::Codec>(std::clamp(f.value("codec").toInt(), 0, 2));
+ p.bitrateKbps = kPs5Bitrates[std::clamp(f.value("bitrate").toInt(), 0, 7)];
+ return p;
+}
+std::string asciiOnly(const QString& s) {
+ std::string out;
+ for (const QChar c : s) { if (c.unicode() > 127) return {}; out.push_back(char(c.unicode())); }
+ return out;
+}
+}
+#endif
+// One worker at a time, as the 1.4.4 panel; results are picked up in tickPs5().
+#define VEYRA_PS5_LAUNCH(body) \
+ do { if (impl_->ps5Busy) return; if (impl_->ps5Worker.joinable()) impl_->ps5Worker.join(); \
+ impl_->ps5Busy = true; impl_->ps5Done = false; impl_->ps5Status = tr("正在处理…可随时取消"); emit ps5Changed(); \
+ impl_->ps5Worker = std::jthread([this, fn = std::move(body)](std::stop_token stop) mutable { \
+ Impl::Ps5Outcome result; \
+ try { result = fn(stop); } catch (...) { result.message = L"操作失败;请检查网络、输入和可用磁盘空间。"; } \
+ { std::lock_guard lock(impl_->ps5Mutex); impl_->ps5Outcome = std::move(result); } impl_->ps5Done = true; }); } while (0)
+void QmlPlayerBridge::ps5Scan() {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ auto work = [](std::stop_token stop) {
+ Impl::Ps5Outcome out; auto report = remoteplay::discoverLocalPs5(stop);
+ for (const auto& line : report.diagnostics) veyra::log::info("remoteplay-discovery", line);
+ for (auto& h : report.hosts) {
+ std::string id = h.consoleId;
+ std::transform(id.begin(), id.end(), id.begin(), [](unsigned char c) { return char(std::tolower(c)); });
+ out.hosts.push_back({h.host, id});
+ }
+ out.message = stop.stop_requested() ? L"已取消查找" : out.hosts.empty()
+ ? (report.error ? std::format(L"主机搜索发生错误({}),详情见日志;可手填 IP。", report.error) : L"搜索完成,未发现 PS5;确认同一局域网,或手动填写 IP。")
+ : std::format(L"发现 {} 台 PS5。", out.hosts.size());
+ return out;
+ };
+ VEYRA_PS5_LAUNCH(work);
+#endif
+}
+void QmlPlayerBridge::ps5Pair(const QString& pinText) {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ auto host = asciiOnly(impl_->ps5Form.value("host").toString()), id = asciiOnly(impl_->ps5Form.value("account").toString()), pin = asciiOnly(pinText);
+ auto account = remoteplay::accountIdFromBase64(id); if (!account) account = remoteplay::accountIdFromDecimal(id);
+ if (!remoteplay::validHost(host) || !account || !remoteplay::parsePairingPin(pin)) {
+ impl_->ps5Status = tr("请填写有效主机地址、Account ID 和 8 位配对码。"); emit ps5Changed(); return;
+ }
+ // Same host + account reuses its file; otherwise a fresh random name.
+ std::filesystem::path target;
+ for (const auto& p : impl_->ps5ProfileList) {
+ const auto path = remoteplay::profileDirectory() / p.toMap().value("id").toString().toStdWString();
+ if (auto saved = remoteplay::loadProfile(path); saved && saved->host == host && saved->credentials.accountId == *account) target = path;
+ }
+ if (target.empty()) {
+ GUID guid{}; if (FAILED(CoCreateGuid(&guid))) { impl_->ps5Status = tr("无法分配配对存档,请重试。"); emit ps5Changed(); return; }
+ std::string name; const auto* bytes = reinterpret_cast<const unsigned char*>(&guid);
+ for (size_t k = 0; k < sizeof(guid); ++k) name += std::format("{:02x}", bytes[k]);
+ target = remoteplay::profileDirectory() / (name + ".dat");
+ }
+ const auto format = ps5Video(impl_->ps5Form);
+ auto work = [host = std::move(host), account = *account, pin = std::move(pin), format, target](std::stop_token stop) mutable {
+ auto result = remoteplay::pairLocalPs5(host, account, pin, stop); SecureZeroMemory(pin.data(), pin.size());
+ Impl::Ps5Outcome out;
+ if (result.result.ok && !stop.stop_requested()) {
+ remoteplay::NativeConnectRequest request; request.host = host; request.video = format; request.credentials = std::move(result.credentials);
+ for (auto byte : result.mac) request.consoleId += std::format("{:02x}", byte);
+ if (request.consoleId == "000000000000") request.consoleId.clear();
+ if (remoteplay::saveProfile(target, request)) { out.savedPath = target.filename().wstring(); out.message = L"配对成功并已加密保存;现在可以连接。"; }
+ else out.message = L"配对成功,但保存失败;请检查用户目录权限。";
+ } else out.message = result.canceled || stop.stop_requested() ? L"已取消配对" : std::format(L"配对失败({}),检查 PS5 配对码、Account ID 与网络。", result.result.code);
+ return out;
+ };
+ VEYRA_PS5_LAUNCH(work);
+#else
+ Q_UNUSED(pinText);
+#endif
+}
+bool QmlPlayerBridge::ps5Connect() {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ auto& i = *impl_;
+ if (i.ps5Busy) return false;
+ const auto path = i.ps5Profile.empty() ? std::filesystem::path{} : remoteplay::profileDirectory() / i.ps5Profile;
+ auto saved = path.empty() ? std::nullopt : remoteplay::loadProfile(path);
+ const auto host = asciiOnly(i.ps5Form.value("host").toString());
+ if (!saved || !remoteplay::validHost(host)) { i.ps5Status = tr("请先完成配对,并填写有效主机地址。"); emit ps5Changed(); return false; }
+ saved->host = host; saved->video = ps5Video(i.ps5Form); saved->viewOnly = i.ps5Form.value("viewOnly").toBool();
+ if (!remoteplay::saveProfile(path, *saved)) { i.ps5Status = tr("保存连接设置失败,请检查目录权限。"); emit ps5Changed(); return false; }
+ source::RemotePlayConnectDesc desc; desc.request = std::move(*saved);
+ const int decode = std::clamp(i.ps5Form.value("decode").toInt(), 0, 2);
+ desc.decodeMode = static_cast<source::RemotePlayConnectDesc::DecodeMode>(decode);
+ desc.highQualitySampling = i.ps5Form.value("sampling").toInt() == 1;
+ WritePrivateProfileStringW(L"RemotePlay", L"DecodeMode", std::to_wstring(decode).c_str(), ps5Settings().c_str());
+ WritePrivateProfileStringW(L"RemotePlay", L"FineSampling", desc.highQualitySampling ? L"1" : L"0", ps5Settings().c_str());
+ const bool viewOnly = desc.request.viewOnly;
+ // The console has one Remote Play slot; the engine ends PS5 手柄控制 first.
+ if (i.engine.remoteControlRequested()) emit notice(tr("已结束 PS5 手柄控制:PS5 同一时间只允许一个远程游玩连接"), false);
+ rememberPosition(true);
+ // The session id is cleared with the flag: the previous session's id left over here
+ // ended "opening" on the next snapshot while the old source still ran.
+ i.openingSource = true; i.openingSessionId = 0; i.sourceLabel = L"PS5 · " + std::wstring(host.begin(), host.end()); i.resumeSession = 0; i.screenFillActive = false;
+ auto request = std::make_shared<source::RemotePlayConnectDesc>(std::move(desc));
+ openAfterCinema(tr("正在连接 PS5 · %1").arg(QString::fromStdString(host)), [this, request, viewOnly] {
+ auto& i = *impl_;
+ if (i.preOpen) i.preOpen();
+ i.engine.previewView({});
+ i.engine.openRemotePlay(i.videoWindow, std::move(*request), i.options);
+ i.openingSessionId = i.engine.snapshot().sessionId;
+ refreshSubtitles({});
+ // Controller forwarding at 8 ms, as 1.4.4; view-only leaves the pad to the PS5.
+ // Started with the session: the poll stops the pad when no session runs.
+ if (!viewOnly) {
+ if (!i.acquirePad(Impl::PadPs5)) veyra::log::warn("remoteplay-input", "SDL gamepad initialization failed");
+ if (!i.controllerTimer) {
+ i.controllerTimer = new QTimer(this);
+ connect(i.controllerTimer, &QTimer::timeout, this, [this] {
+ auto& j = *impl_;
+ const auto s = j.engine.snapshot();
+ if (s.remotePlay && (s.running || s.transport == engine::TransportState::Opening)) {
+ const bool focused = QGuiApplication::focusWindow() != nullptr;
+ j.engine.remotePlayController(j.controller.poll(focused));
+ j.controller.feedback(j.engine.remotePlayFeedback(), focused);
+ } else {
+ j.engine.remotePlayController({}); j.releasePad(Impl::PadPs5); j.controllerTimer->stop();
+ }
+ });
+ }
+ i.controllerTimer->start(8);
+ } else {
+ if (i.controllerTimer) i.controllerTimer->stop();
+ i.releasePad(Impl::PadPs5);
+ }
+ });
+ i.ps5Watching = true;
+ rememberSource(QStringLiteral("ps5"), QString::fromStdString(host));
+ i.ps5Status = tr("连接已开始。需要登录 PIN 时在下方提交。关闭面板不停止串流。");
+ veyra::log::info("remoteplay-ui", std::format("connect quality={} codec={} bitrate={} decode={} viewOnly={}",
+ i.ps5Form.value("quality").toInt(), i.ps5Form.value("codec").toInt(), i.ps5Form.value("bitrate").toInt(), decode, viewOnly));
+ emit ps5Changed();
+ return true;
+#else
+ return false;
+#endif
+}
+void QmlPlayerBridge::ps5Wake() {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ auto saved = impl_->ps5Profile.empty() ? std::nullopt : remoteplay::loadProfile(remoteplay::profileDirectory() / impl_->ps5Profile);
+ if (!saved) { impl_->ps5Status = tr("需要先配对才能唤醒。"); emit ps5Changed(); return; }
+ saved->host = asciiOnly(impl_->ps5Form.value("host").toString());
+ auto work = [request = std::move(*saved)](std::stop_token stop) {
+ Impl::Ps5Outcome out; if (stop.stop_requested()) { out.message = L"已取消唤醒"; return out; }
+ auto r = remoteplay::wakeLocalPs5(request);
+ out.message = r.ok ? L"已发送唤醒请求,等待 PS5 开机后再连接。" : std::format(L"唤醒失败({});确认 PS5 处于待机而不是关机。", r.code);
+ return out;
+ };
+ VEYRA_PS5_LAUNCH(work);
+#endif
+}
+void QmlPlayerBridge::ps5Forget() {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ if (impl_->ps5Busy || impl_->ps5Profile.empty()) return;
+ std::error_code ec;
+ const bool removed = std::filesystem::remove(remoteplay::profileDirectory() / impl_->ps5Profile, ec);
+ impl_->ps5Status = removed ? tr("配对已删除。现有串流会保留;下次连接需选择其他主机或重新配对。") : tr("删除失败,请检查目录权限。");
+ if (removed) impl_->ps5Profile.clear();
+ ps5Load();
+#endif
+}
+void QmlPlayerBridge::ps5PsnLogin() {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ if (QDesktopServices::openUrl(QUrl(QString::fromStdWString(remoteplay::psnLoginUrl())))) {
+ impl_->psnLoginStarted = GetTickCount64();
+ impl_->ps5Status = tr("在 Sony 网页完成登录,复制最终回调地址,再点“提交登录结果”。");
+ } else impl_->ps5Status = tr("无法打开浏览器,请检查默认浏览器设置。");
+ emit ps5Changed();
+#endif
+}
+void QmlPlayerBridge::ps5PsnComplete() {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ if (impl_->ps5Busy) return;
+ if (!impl_->psnLoginStarted || GetTickCount64() - impl_->psnLoginStarted > 600000) {
+ impl_->ps5Status = tr("请先点登录 PSN,完成网页授权后再提交。"); emit ps5Changed(); return;
+ }
+ std::wstring callback = QGuiApplication::clipboard() ? QGuiApplication::clipboard()->text().left(8192).toStdWString() : std::wstring{};
+ if (!remoteplay::validPsnCallback(callback)) {
+ SecureZeroMemory(callback.data(), callback.size() * sizeof(wchar_t));
+ impl_->ps5Status = tr("剪贴板不是有效的 Sony 授权回调地址。请复制登录完成后的完整 URL。"); emit ps5Changed(); return;
+ }
+ impl_->psnLoginStarted = 0;
+ auto work = [callback = std::move(callback)](std::stop_token stop) mutable {
+ auto result = remoteplay::authorizePsn(std::move(callback), stop); Impl::Ps5Outcome out;
+ if (result.account) out.account = remoteplay::accountIdToBase64(*result.account);
+ out.message = result.ok ? L"PSN 登录已保存,Account ID 已填入。首次仍需配对;已配对主机直接连接。"
+ : std::format(L"PSN 授权失败({});原有配对不受影响,可重新登录。", result.error);
+ return out;
+ };
+ VEYRA_PS5_LAUNCH(work);
+#endif
+}
+void QmlPlayerBridge::ps5PsnForget() {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ if (impl_->ps5Busy) return;
+ impl_->ps5Status = remoteplay::forgetPsnAuthorization() ? tr("PSN 授权已删除,局域网配对保留。") : tr("删除授权失败,请检查目录权限。");
+ emit ps5Changed();
+#endif
+}
+void QmlPlayerBridge::ps5SendLoginPin(const QString& pin) {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ const auto text = pin.trimmed();
+ if (text.isEmpty() || !std::all_of(text.begin(), text.end(), [](QChar c) { return c.isDigit(); })) {
+ impl_->ps5Status = tr("登录 PIN 必须为数字。"); emit ps5Changed(); return;
+ }
+ impl_->engine.remotePlayLoginPin(text.toStdString());
+#else
+ (void)pin; // RemotePlay disabled: keep the QML-callable symbol but no backend.
+#endif
+}
+void QmlPlayerBridge::ps5Cancel() {
+ if (impl_->ps5Busy && impl_->ps5Worker.joinable()) { impl_->ps5Worker.request_stop(); return; }
+ if (impl_->snapshot.remotePlay) stopPlayback();
+}
+void QmlPlayerBridge::ps5Calibrate() {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ impl_->ps5Status = impl_->controller.calibrate() ? tr("将手柄平放并保持静止:采集 120 个稳定样本完成校准;10 秒内不稳定则保留原校准。")
+ : tr("请先连接串流及带陀螺仪的电脑手柄。仅观看模式不使用电脑手柄。");
+ emit ps5Changed();
+#endif
+}
+void QmlPlayerBridge::tickPs5() {
+ auto& i = *impl_;
+ bool changed = false;
+ if (i.ps5Busy && i.ps5Done.load()) {
+ if (i.ps5Worker.joinable()) i.ps5Worker.join();
+ i.ps5Busy = false;
+ Impl::Ps5Outcome r; { std::lock_guard lock(i.ps5Mutex); r = std::move(i.ps5Outcome); }
+ i.ps5Status = veyra::ui::i18n::text(r.message);
+ if (!r.account.empty()) i.ps5Form["account"] = QString::fromStdString(r.account);
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ if (!r.savedPath.empty()) {
+ i.ps5Profile = r.savedPath;
+ WritePrivateProfileStringW(L"RemotePlay", L"LastProfile", i.ps5Profile.c_str(), ps5Settings().c_str());
+ const auto status = i.ps5Status; ps5Load(); i.ps5Status = status;
+ }
+ if (!r.hosts.empty()) {
+ // A found console updates the selected pairing's address only when its
+ // id matches (or the legacy profile had no id and the same host).
+ const auto path = i.ps5Profile.empty() ? std::filesystem::path{} : remoteplay::profileDirectory() / i.ps5Profile;
+ auto selected = path.empty() ? std::nullopt : remoteplay::loadProfile(path);
+ bool matched = false;
+ if (selected) for (const auto& [host, id] : r.hosts) {
+ if ((!selected->consoleId.empty() && selected->consoleId == id) || (selected->consoleId.empty() && selected->host == host)) {
+ selected->host = host; if (id.size() == 12) selected->consoleId = id;
+ if (remoteplay::saveProfile(path, *selected)) { i.ps5Form["host"] = QString::fromStdString(host); matched = true; }
+ break;
+ }
+ }
+ if (!selected && r.hosts.size() == 1) i.ps5Form["host"] = QString::fromStdString(r.hosts.front().first);
+ else if (selected && !matched) i.ps5Status = tr("发现主机,但无法确认是已配对的这一台。保留原地址,可核对后手动修改。");
+ else if (!selected && r.hosts.size() > 1) i.ps5Status = tr("发现多台 PS5,请填写要配对的主机 IP,避免选错主机。");
+ }
+#endif
+ changed = true;
+ }
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ if (i.ps5Watching && !i.ps5Busy) {
+ const auto& s = i.snapshot;
+ const bool active = s.remotePlay && (s.running || s.transport == engine::TransportState::Opening || s.transport == engine::TransportState::Stopping);
+ QString message = veyra::ui::i18n::text(s.failed ? s.status : s.remoteRecovering ? s.remoteRecoveryMessage
+ : s.remotePlay && s.running ? std::wstring(L"PS5 画面已进入播放;关闭此面板不停止串流。") : active ? s.status : std::wstring(L"PS5 串流已停止,可以重新连接。"));
+ if (s.remotePlay && s.running && !s.failed && !s.remoteRecovering) {
+ const auto& r = s.remoteStream; const auto& p = r.requestedProfile;
+ message = veyra::ui::i18n::text(std::format(L"生效:{}p / {} fps / {} / 请求 {} Mbps · 实收视频 {:.1f} Mbps", p.height, p.fps,
+ p.codec == remoteplay::Codec::H264 ? L"H.264" : p.codec == remoteplay::Codec::H265Hdr ? L"H.265 HDR" : L"H.265", p.bitrateKbps / 1000, r.videoMbps));
+ const auto c = i.controller.capabilities();
+ if (i.ps5Form.value("viewOnly").toBool()) message += tr("\n仅观看:电脑输入已关闭,手柄由 PS5 处理。");
+ else if (!c.connected) message += tr("\n未检测到电脑手柄。");
+ else message += veyra::ui::i18n::text(std::format(L"\n陀螺仪 {} · 触摸板 {} · 扳机 {} · 触觉 {}{}", c.gyro && c.accel ? L"已启用" : L"不可用",
+ c.touch ? L"可用" : L"不可用", c.triggers ? L"已接入" : L"不可用", c.haptics ? L"端点已打开" : L"未打开", c.calibrating ? L" · 校准中" : L""));
+ }
+ if (message != i.ps5Status) { i.ps5Status = message; changed = true; }
+ if (!active && !s.remotePlay) i.ps5Watching = false;
+ }
+#endif
+ if (changed) emit ps5Changed();
+ tickPs5Control();
+}
+
+// --- PS5 手柄控制 (capture card dialog) ----------------------------------------
+QVariantMap QmlPlayerBridge::ps5Control() const {
+ QVariantMap out = impl_->ps5ControlState;
+ if (!out.contains(QStringLiteral("state"))) out[QStringLiteral("state")] = QStringLiteral("off");
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ out[QStringLiteral("available")] = true;
+#else
+ out[QStringLiteral("available")] = false;
+#endif
+ out[QStringLiteral("enabled")] = impl_->prefBool("ps5CaptureControl", false);
+ out[QStringLiteral("background")] = impl_->prefBool("ps5ControlBackground", false);
+ return out;
+}
+// liveKind is "ps5", "screen", "moonlight" or "xbox" for those sources; a file
+// leaves it alone but does not set snapshot.capture.
+bool QmlPlayerBridge::captureCardLive() const {
+ const auto& s = impl_->snapshot;
+ // Not while Stopping: after 断开 the run keeps `running` until it has torn
+ // down, and the tick would start PS5 手柄控制 again in that window.
+ const bool playing = s.running && !s.image && !s.remotePlay &&
+ (s.transport == engine::TransportState::Playing || s.transport == engine::TransportState::Paused);
+ // Tests only: any playing source stands in for the capture card (no card needed).
+ if (playing && qEnvironmentVariableIsSet("VEYRA_TEST_PS5_CONTROL_ANY_SOURCE")) return true;
+ return playing && s.capture && impl_->liveKind == QLatin1String("capture");
+}
+void QmlPlayerBridge::ps5ControlSet(const QString& key, const QVariant& value) {
+ static const QHash<QString, QString> keys{{QStringLiteral("enabled"), QStringLiteral("ps5CaptureControl")},
+ {QStringLiteral("background"), QStringLiteral("ps5ControlBackground")}};
+ if (!keys.contains(key)) return;
+ const bool on = value.toBool();
+ const auto previous = impl_->prefs;
+ impl_->prefs[keys.value(key)] = on;
+ if (!impl_->savePrefs()) { impl_->prefs = previous; emit notice(tr("PS5 手柄控制设置保存失败"), true); emit ps5ControlChanged(); return; }
+ veyra::log::info("remoteplay-control", std::format("ui {}={}", key.toStdString(), on));
+ if (key == QLatin1String("enabled")) {
+ impl_->ps5ControlNoPair = false;
+ if (!on) stopPs5Control();
+ else if (captureCardLive()) startPs5Control(false);
+ tickPs5Control(true);
+ }
+ emit ps5ControlChanged();
+}
+void QmlPlayerBridge::ps5ControlRestart() {
+ if (impl_->prefBool("ps5CaptureControl", false) && captureCardLive()) startPs5Control(true);
+}
+void QmlPlayerBridge::startPs5Control(bool restart) {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ auto& i = *impl_;
+ source::RemotePlayConnectDesc desc;
+ std::wstring profile;
+ // Tests only: a dummy pairing to this host (an unroutable test address); the
+ // saved pairings are not read, so no real console is ever contacted.
+ const QString testHost = qEnvironmentVariable("VEYRA_TEST_PS5_CONTROL_HOST");
+ if (!testHost.isEmpty()) {
+ desc.request.host = testHost.toStdString();
+ profile = L"test:" + testHost.toStdWString();
+ } else {
+ if (i.ps5Profile.empty()) ps5Load();
+ auto saved = i.ps5Profile.empty() ? std::nullopt : remoteplay::loadProfile(remoteplay::profileDirectory() / i.ps5Profile);
+ if (!saved) {
+ i.engine.stopRemoteControl();
+ if (!i.ps5ControlNoPair) emit notice(tr("PS5 手柄控制:还没有配对的 PS5,先在「PS5 串流」里配对一次"), true);
+ i.ps5ControlNoPair = true;
+ tickPs5Control(true);
+ return;
+ }
+ desc.request = std::move(*saved);
+ profile = i.ps5Profile;
+ }
+ const auto running = i.engine.remoteControlStatus();
+ if (!restart && running.requested && (running.alive || running.starting) && profile == i.ps5ControlProfile) {
+ if (!(i.padUsers & Impl::PadPs5Control)) i.acquirePad(Impl::PadPs5Control);
+ if (i.ps5ControlTimer && !i.ps5ControlTimer->isActive()) i.ps5ControlTimer->start(8);
+ return;
+ }
+ // Keepalive profile, the lightest the console accepts. Never written back to the pairing.
+ remoteplay::VideoProfile keepalive;
+ keepalive.width = 1280; keepalive.height = 720; keepalive.fps = 30; keepalive.bitrateKbps = 5000; keepalive.codec = remoteplay::Codec::H264;
+ desc.request.video = keepalive;
+ veyra::log::info("remoteplay-control", std::format("start host={} restart={} background={}", desc.request.host, restart, i.prefBool("ps5ControlBackground", false)));
+ i.ps5ControlProfile = profile;
+ i.ps5ControlNoticed.clear();
+ i.ps5ControlNoPair = false;
+ i.engine.startRemoteControl(std::move(desc));
+ // The pad is read on the UI thread every 8 ms, as for the PS5 stream (the
+ // session sends one state per 4 ms and queues the rest).
+ if (!i.acquirePad(Impl::PadPs5Control)) veyra::log::warn("remoteplay-input", "SDL gamepad initialization failed");
+ if (!i.ps5ControlTimer) {
+ i.ps5ControlTimer = new QTimer(this);
+ connect(i.ps5ControlTimer, &QTimer::timeout, this, [this] {
+ auto& j = *impl_;
+ // A PS5 stream polls the pad with its own timer and takes the slot.
+ if (j.snapshot.remotePlay || !j.engine.remoteControlRequested()) {
+ j.ps5ControlTimer->stop(); j.releasePad(Impl::PadPs5Control); return;
+ }
+ const bool focused = QGuiApplication::focusWindow() != nullptr || j.prefBool("ps5ControlBackground", false);
+ j.engine.remotePlayController(j.controller.poll(focused));
+ j.controller.feedback(j.engine.remotePlayFeedback(), focused);
+ });
+ }
+ i.ps5ControlTimer->start(8);
+ tickPs5Control(true);
+#else
+ (void)restart;
+#endif
+}
+void QmlPlayerBridge::stopPs5Control() {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ auto& i = *impl_;
+ if (!i.engine.remoteControlRequested()) return;
+ veyra::log::info("remoteplay-control", "stop");
+ i.engine.stopRemoteControl();
+ i.ps5ControlProfile.clear();
+ tickPs5Control(true);
+#endif
+}
+void QmlPlayerBridge::tickPs5Control(bool force) {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ auto& i = *impl_;
+ if (!force && ++i.ps5ControlTicks % 15) return; // ~4 Hz from the 60 Hz poll
+ // Switched on while the capture card was still opening, or the capture came
+ // back by itself: start once it is live. A failed session stays requested
+ // until the user restarts it, so this never loops.
+ if (!force && !i.ps5ControlNoPair && i.prefBool("ps5CaptureControl", false) && captureCardLive() && !i.engine.remoteControlRequested())
+ startPs5Control(false);
+ const auto st = i.engine.remoteControlStatus();
+ QString state = QStringLiteral("off");
+ if (i.ps5ControlNoPair && !st.requested) state = QStringLiteral("nopair");
+ else if (st.requested) {
+ state = st.pinRequired ? QStringLiteral("pin")
+ : st.recovering ? QStringLiteral("recovering")
+ : st.alive && st.connected ? QStringLiteral("connected")
+ : !st.alive && !st.starting ? QStringLiteral("failed")
+ : QStringLiteral("starting");
+ }
+ // Tests only: show a state no console is available to produce here.
+ if (const QString forced = qEnvironmentVariable("VEYRA_TEST_PS5_CONTROL_STATE"); !forced.isEmpty() && st.requested) state = forced;
+ QVariantMap next;
+ next[QStringLiteral("state")] = state;
+ next[QStringLiteral("message")] = state == QLatin1String("nopair") ? tr("还没有配对的 PS5,先在「PS5 串流」里配对一次") : uiText(st.message);
+ next[QStringLiteral("keepaliveFps")] = st.keepaliveReady ? std::round(st.keepaliveFps) : -1.0;
+ const auto c = i.controller.capabilities();
+ next[QStringLiteral("pad")] = (i.padUsers & Impl::PadPs5Control) && c.connected ? QString::fromStdString(c.name) : QString();
+ next[QStringLiteral("gyro")] = c.gyro && c.accel;
+ next[QStringLiteral("touch")] = c.touch;
+ if (next == i.ps5ControlState) return;
+ i.ps5ControlState = next;
+ if (state != i.ps5ControlNoticed) {
+ if (state == QLatin1String("connected")) emit notice(tr("PS5 手柄控制已连接"), false);
+ else if (state == QLatin1String("pin")) emit notice(tr("PS5 要求输入登录 PIN:在采集卡面板「PS5 手柄控制」里填写"), false);
+ else if (state == QLatin1String("failed")) {
+ const QString reason = next.value(QStringLiteral("message")).toString();
+ emit notice(reason.isEmpty() ? tr("PS5 手柄控制已停止") : reason, true);
+ }
+ if (state == QLatin1String("connected") || state == QLatin1String("pin") || state == QLatin1String("failed")) i.ps5ControlNoticed = state;
+ }
+ emit ps5ControlChanged();
+#else
+ (void)force;
+#endif
+}
+
+// --- ps5 dialog --------------------------------------------------------------
+QString QmlPlayerBridge::remotePlayHost() const { return impl_->remotePlayHost; }
+void QmlPlayerBridge::setRemotePlayHost(const QString& value) {
+ impl_->remotePlayHost = value;
+ emit settingsChanged();
+}
+QString QmlPlayerBridge::remotePlayPin() const { return impl_->remotePlayPin; }
+void QmlPlayerBridge::setRemotePlayPin(const QString& value) {
+ // Held only until the connect command runs; it is never written to the session
+ // file, and the engine keeps PSN credentials encrypted in the user data
+ // directory rather than here.
+ impl_->remotePlayPin = value;
+ emit settingsChanged();
+}
+
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Status.cpp b/src/ui/bridge/Status.cpp
new file mode 100644
index 00000000..f8f1c426
--- /dev/null
+++ b/src/ui/bridge/Status.cpp
@@ -0,0 +1,491 @@
+// QML bridge: Status responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- professional-page readouts ---------------------------------------------
+// These read fields the engine genuinely publishes. Where it publishes nothing,
+// the getter says so and the UI shows an explicit "unmeasured" rather than a
+// zero or a stand-in.
+QString QmlPlayerBridge::outputSummary() const {
+ const auto& s = impl_->snapshot;
+ const auto& plan = s.metrics.resolution;
+ if (!s.running || !plan.output.valid() || plan.settingsRevision != s.applied.revision) return {};
+ return QStringLiteral("%1x%2").arg(plan.output.width).arg(plan.output.height);
+}
+
+// A display rate is only real when the system's display event can be read. No
+// counter is wired in this build, so it reports unknown and the UI shows "未测" -
+// which is exactly what the design requires instead of passing the submit rate off
+// as a measurement that was never taken.
+double QmlPlayerBridge::displayFps() const { return 0.0; }
+bool QmlPlayerBridge::displayFpsKnown() const { return false; }
+
+double QmlPlayerBridge::queuedFrames() const {
+ // Valid output opportunities held by presenter jobs, not cumulative skips
+ // and not the OS/display queue. Zero is meaningful only with a live window.
+ return queuedFramesKnown() ? double(impl_->snapshot.metrics.flow.pendingOutputFrames) : 0.0;
+}
+bool QmlPlayerBridge::queuedFramesKnown() const {
+ const auto& s = impl_->snapshot;
+ const auto& flow = s.metrics.flow;
+ return s.running && !s.image && s.sessionId != 0 &&
+ flow.latest.sessionId == s.sessionId && flow.lastReady100ns > 0 &&
+ flow.latest.frame.settingsRevision == s.applied.revision;
+}
+
+int QmlPlayerBridge::skippedFrames() const { return int(impl_->snapshot.previewSkipped); }
+
+QString QmlPlayerBridge::flowBackend() const {
+ // The snapshot carries a performance figure and a content rate, not a backend
+ // name; report the fact we do have and let it read as unmeasured otherwise.
+ const auto& s = impl_->snapshot;
+ if (s.flowPerf == 0) return {};
+ return QStringLiteral("GPU 光流");
+}
+
+int QmlPlayerBridge::opticalFlowChoice() const { return int(settings().opticalFlowBackend); }
+bool QmlPlayerBridge::setOpticalFlowChoice(int backend) {
+ if(backend<0||backend>2)return false;
+ const auto cap = effectCapabilities().value("flow" + QString::number(backend)).toMap();
+ if (!cap.value("available").toBool()) { emit notice(cap.value("reason").toString(), true); return false; }
+ const auto before=settings();auto next=before;
+ next.opticalFlowBackend=engine::OpticalFlowBackend(backend);
+ if(next.opticalFlowBackend==before.opticalFlowBackend)return true;
+ if(!impl_->commit(next)){
+ emit notice(tr("引擎未接受光流配置,原设置保留"),true);return false;
+ }
+ emit settingsChanged();return true;
+}
+
+QVariantList QmlPlayerBridge::stageTimings() const {
+ // Consume the existing GPU timestamp aggregates. Repeated NR layers share
+ // a timestamp slot: this is stage sampling, NOT per-node attribution.
+ // XeSS-internal FG is not measured by the graph's DLSS FG batch query.
+ const auto& s = impl_->snapshot;
+ QVariantList out;
+ using Stage = diagnostics::GpuStage;
+ struct Row { const char* label; Stage stage; const char* color; };
+ const Row rows[] = {
+ {"输入", Stage::Color, "#A8A8B8"},
+ {"抗锯齿", Stage::AaNode0, "#7FD4FF"},
+ {"抗锯齿 2", Stage::AaNode1, "#A9E2FF"},
+ {"人脸识别", Stage::BeautyDetect, "#FFB3D1"},
+ {"美颜", Stage::BeautyNode0, "#FF8FBF"},
+ {"美颜 2", Stage::BeautyNode1, "#FF9DC7"},
+ {"美颜 3", Stage::BeautyNode2, "#FFABCF"},
+ {"美颜 4", Stage::BeautyNode3, "#FFB9D7"},
+ {"美颜 5", Stage::BeautyNode4, "#FFC7DF"},
+ {"美颜 6", Stage::BeautyNode5, "#FFD5E7"},
+ {"超分", Stage::Sr, "#6EA8FF"},
+ {"光流", Stage::Flow, "#9A85FF"},
+ {"NR采样", Stage::Nr, "#FF8A3D"},
+ {"残差", Stage::Residual, "#E7B868"},
+ {"FG", Stage::FgBatch, "#3DDC84"},
+ {"HDR", Stage::VideoHdr, "#E58BD9"},
+ {"呈现", Stage::Blit, "#58CAD4"},
+ };
+ const double budget = stageBudgetMs();
+ // Several NR layers: every layer marks the shared NR slot, so it only ever held the last
+ // layer's time (field report 2026-10-01). Each layer also has its own slot; with two or
+ // more layers measured, show those instead of the shared row.
+ std::vector<Row> shown;
+ unsigned measuredLayers = 0;
+ for (unsigned i = 0; i < diagnostics::kTimedNrLayers; ++i)
+ if (s.metrics.flow.gpuTiming[size_t(diagnostics::nrLayerStage(i))].samples > 0) ++measuredLayers;
+ static const char* const layerLabels[] = {"NR 第1层", "NR 第2层", "NR 第3层", "NR 第4层"};
+ static const char* const layerColors[] = {"#FF8A3D", "#FFA866", "#FFC28F", "#FFD9B8"};
+ for (const auto& r : rows) {
+ // Anti-aliasing and beauty rows appear only while those nodes run.
+ const bool optional = r.stage == Stage::AaNode0 || r.stage == Stage::AaNode1 ||
+ (r.stage >= Stage::BeautyNode0 && r.stage <= Stage::BeautyDetect);
+ if (optional && s.metrics.flow.gpuTiming[size_t(r.stage)].samples == 0) continue;
+ if (r.stage == Stage::Nr && measuredLayers >= 2) {
+ for (unsigned i = 0; i < diagnostics::kTimedNrLayers; ++i)
+ if (s.metrics.flow.gpuTiming[size_t(diagnostics::nrLayerStage(i))].samples > 0)
+ shown.push_back({layerLabels[i], diagnostics::nrLayerStage(i), layerColors[i]});
+ } else shown.push_back(r);
+ }
+ for (const auto& r : shown) {
+ const auto& sample = s.metrics.flow.gpuTiming[size_t(r.stage)];
+ // The mean of the last second, as 1.4.4's dashboard showed; P95 rides along for the
+ // tooltip. Showing P95 alone read as "slower than 1.4.4" for the same work.
+ const bool measured = queuedFramesKnown() && sample.samples > 0 &&
+ sample.mean && std::isfinite(*sample.mean) && *sample.mean >= 0.0;
+ const double ms = measured ? *sample.mean : 0.0;
+ QVariantMap item;
+ item["label"] = uiText(std::string_view(r.label));
+ item["ms"] = ms;
+ item["p95"] = measured && sample.p95 ? *sample.p95 : 0.0;
+ item["measured"] = measured;
+ item["samples"] = measured ? QVariant::fromValue<qulonglong>(sample.samples) : QVariant::fromValue<qulonglong>(0);
+ item["domain"] = QStringLiteral("GPU timestamp P95");
+ item["color"] = QString::fromUtf8(r.color);
+ item["fraction"] = (measured && budget > 0.01) ? ms / budget : 0.0;
+ out << item;
+ }
+ return out;
+}
+
+QVariantMap QmlPlayerBridge::nodeTimings() const {
+ // Per-node GPU timestamp P95, keyed by the card id chain() publishes. An
+ // editor node borrows a number only when the wired path it sits on is the
+ // chain actually running; drafts, detached and disabled nodes never do.
+ using Stage = diagnostics::GpuStage;
+ const auto& c = impl_->chain;
+ const auto& flow = impl_->snapshot.metrics.flow;
+ const bool node = c.mode == engine::ChainMode::Node;
+ std::vector<int> path;
+ bool draft = false;
+ if (!node) {
+ for (uint32_t i = 0; i < c.nodeCount; ++i) path.push_back(int(i));
+ } else {
+ uint32_t id = impl_->layout.inputNext;
+ while (id > engine::NodeGraphLayout::Output && path.size() <= c.nodeCount) {
+ const int index = impl_->layout.indexOf(c, id);
+ if (index < 0) break;
+ path.push_back(index);
+ id = impl_->layout.next[size_t(index)];
+ }
+ engine::EffectChain projected;
+ draft = id != engine::NodeGraphLayout::Output || !impl_->layout.project(c, projected).accepted ||
+ engine::runtimeOrder(projected) != engine::runtimeOrder(impl_->acceptedChain);
+ if (draft) path.clear();
+ }
+ const bool live = queuedFramesKnown();
+ const auto& snapshot = impl_->snapshot;
+ // A failed optical-flow/NR backend can leave the requested editor layer
+ // enabled while the engine has deliberately resumed playback without NR.
+ // Show that confirmed recovery, not an endless timing warmup or stale ms.
+ const bool nrRejected = live && !snapshot.applying && snapshot.rejectedRevision != 0 &&
+ snapshot.desired.revision == snapshot.applied.revision &&
+ !snapshot.desired.nr && !snapshot.applied.nr && !snapshot.backendWarning.empty();
+ const bool xess = fgBackendName() == QLatin1String("xess");
+ QVariantMap out;
+ auto publish = [&](uint32_t i, const QString& state, std::optional<Stage> stage) {
+ QVariantMap item{{"state", state}, {"ms", 0.0}, {"samples", QVariant::fromValue<qulonglong>(0)}};
+ if (state == QLatin1String("failed")) item["reason"] = uiText(snapshot.backendWarning);
+ if (stage) {
+ const auto& sample = flow.gpuTiming[size_t(*stage)];
+ if (live && sample.samples > 0 && sample.mean && std::isfinite(*sample.mean) && *sample.mean >= 0.0) {
+ item["state"] = QStringLiteral("measured");
+ item["ms"] = *sample.mean;
+ item["samples"] = QVariant::fromValue<qulonglong>(sample.samples);
+ }
+ }
+ const QVariant key = node ? QVariant(impl_->layout.ids[i]) : QVariant(i + 2);
+ out[key.toString()] = item;
+ };
+ std::vector<bool> onPath(c.nodeCount, false);
+ for (const int i : path) onPath[size_t(i)] = true;
+ for (uint32_t i = 0; i < c.nodeCount; ++i)
+ if (!onPath[i]) publish(i, draft ? QStringLiteral("draft") : QStringLiteral("idle"), std::nullopt);
+ unsigned enabledNr = 0, colour = 0, antiAlias = 0, beauty = 0;
+ for (const int index : path) {
+ const auto i = uint32_t(index);
+ const auto& n = c.nodes[i];
+ std::optional<Stage> stage;
+ QString waiting = live ? QStringLiteral("pending") : QStringLiteral("stopped");
+ switch (n.type) {
+ case engine::EffectType::NrEnhance:
+ if (nrRejected) waiting = QStringLiteral("failed");
+ else if (n.enabled && enabledNr < diagnostics::kTimedNrLayers) stage = diagnostics::nrLayerStage(enabledNr);
+ if (n.enabled) ++enabledNr;
+ break;
+ case engine::EffectType::Color:
+ // Parameter 0 before any SR/NR is fused into the input conversion
+ // shader: it has no separable GPU span of its own.
+ if (colour < diagnostics::kTimedColorNodes) stage = diagnostics::colorNodeStage(colour);
+ if (colour == 0) waiting = live ? QStringLiteral("fused") : waiting;
+ ++colour;
+ break;
+ case engine::EffectType::AntiAliasing:
+ // Indexed by parameter ordinal, like Color: every anti-aliasing node on the path counts.
+ if (antiAlias < diagnostics::kTimedAaNodes) stage = diagnostics::aaNodeStage(antiAlias);
+ ++antiAlias;
+ break;
+ case engine::EffectType::Beauty:
+ if (beauty < diagnostics::kTimedBeautyNodes) stage = diagnostics::beautyNodeStage(beauty);
+ ++beauty;
+ break;
+ case engine::EffectType::SuperResolution: stage = Stage::Sr; break;
+ case engine::EffectType::VideoHdr:
+ stage = Stage::VideoHdr;
+ // SDR display path: the node is wired but TrueHDR is not built.
+ if (live && !impl_->snapshot.videoHdrActive) waiting = QStringLiteral("hdr-sdr");
+ break;
+ case engine::EffectType::FrameGeneration:
+ if (xess) waiting = QStringLiteral("sdk"); else stage = Stage::FgBatch;
+ // Realtime admission declined the pairs inside this window.
+ if (!xess && live && flow.counters.fgSkippedBeforeEval > 0 && flow.counters.fgEvaluated < flow.counters.fgCandidate)
+ waiting = QStringLiteral("fg-skipped");
+ break;
+ default: waiting = QStringLiteral("untimed"); break;
+ }
+ if (!n.enabled) { publish(i, QStringLiteral("disabled"), std::nullopt); continue; }
+ publish(i, waiting, stage);
+ }
+ return out;
+}
+
+double QmlPlayerBridge::stageBudgetMs() const {
+ // Budget per content frame entering enhancement. Intentional dedup and
+ // playback speed change that interval; a presentation cap alone does not.
+ // Reuse the bounded status sample, without sampling or repainting faster.
+ const auto& s=impl_->snapshot;const auto& h=impl_->history;
+ const double fps=h.session==s.sessionId&&h.revision==s.applied.revision&&h.output.contentFps>0
+ ?h.output.contentFps:s.nominalSourceFps*(s.captureHalfRate?.5:1.0);
+ return fps > 0.01 ? 1000.0 / fps : 0.0;
+}
+
+double QmlPlayerBridge::scheduleP95Ms() const { return impl_->snapshot.schedulingWaitP95Ms; }
+
+double QmlPlayerBridge::chainTotalMs() const {
+ // Engine merges same-frame measured intervals before aggregation. Never
+ // sum unrelated percentiles. This excludes uninstrumented stages/nodes.
+ // Mean of the last second, the same statistic as the stage rows (see stageTimings).
+ return chainTotalMsKnown() ? *impl_->snapshot.metrics.flow.enhancementProcessing.mean : 0.0;
+}
+bool QmlPlayerBridge::chainTotalMsKnown() const {
+ const auto& sample = impl_->snapshot.metrics.flow.enhancementProcessing;
+ return queuedFramesKnown() && sample.samples > 0 && sample.mean &&
+ std::isfinite(*sample.mean) && *sample.mean >= 0.0;
+}
+
+
+// --- performance orbs and status light (#13) --------------------------------
+double QmlPlayerBridge::gpuUtilization() const { return std::max(0.0, impl_->gpuUtil.load()); }
+bool QmlPlayerBridge::gpuUtilizationKnown() const { return impl_->gpuUtil.load() >= 0.0; }
+QString QmlPlayerBridge::runStatus() const { return impl_->runStatus; }
+QString QmlPlayerBridge::runStatusLevel() const { return impl_->runLevel; }
+QString QmlPlayerBridge::runStatusDetail() const { return impl_->runDetail; }
+QStringList QmlPlayerBridge::runOptions() const { return impl_->runOptions; }
+double QmlPlayerBridge::effectiveOutputFps() const { return impl_->effectiveOutputFps; }
+double QmlPlayerBridge::outputRateRatio() const { return impl_->rateRatio; }
+
+void QmlPlayerBridge::startGpuSampler() {
+ // Task Manager's source: the "GPU Engine" utilization counters, summed per
+ // engine type across processes, busiest type wins. Sampled once a second on
+ // its own thread; -1 means the counters are unavailable.
+ auto* impl = impl_.get();
+ impl->gpuSampler = std::jthread([impl](std::stop_token stop) {
+ PDH_HQUERY query = nullptr; PDH_HCOUNTER counter = nullptr;
+ if (PdhOpenQueryW(nullptr, 0, &query) != ERROR_SUCCESS) return;
+ if (PdhAddEnglishCounterW(query, L"\\GPU Engine(*)\\Utilization Percentage", 0, &counter) != ERROR_SUCCESS) {
+ PdhCloseQuery(query); veyra::log::warn("perf", "GPU engine counters unavailable"); return;
+ }
+ PdhCollectQueryData(query);
+ std::vector<unsigned char> buffer;
+ while (!stop.stop_requested()) {
+ for (int i = 0; i < 10 && !stop.stop_requested(); ++i) std::this_thread::sleep_for(std::chrono::milliseconds(100));
+ if (stop.stop_requested()) break;
+ if (PdhCollectQueryData(query) != ERROR_SUCCESS) continue;
+ DWORD bytes = 0, count = 0;
+ if (PdhGetFormattedCounterArrayW(counter, PDH_FMT_DOUBLE, &bytes, &count, nullptr) != PDH_MORE_DATA) continue;
+ buffer.resize(bytes);
+ auto* items = reinterpret_cast<PDH_FMT_COUNTERVALUE_ITEM_W*>(buffer.data());
+ if (PdhGetFormattedCounterArrayW(counter, PDH_FMT_DOUBLE, &bytes, &count, items) != ERROR_SUCCESS) continue;
+ std::map<std::wstring, double> byType;
+ // Instance names carry the adapter: pid_<n>_luid_0x<high>_0x<low>_phys_..._engtype_<type>.
+ const uint64_t luid = impl->gpuMonitorLuid.load();
+ const std::wstring luidKey = luid ? std::format(L"luid_0x{:08x}_0x{:08x}_", uint32_t(luid >> 32), uint32_t(luid)) : std::wstring{};
+ for (DWORD i = 0; i < count; ++i) {
+ if (items[i].FmtValue.CStatus != PDH_CSTATUS_VALID_DATA && items[i].FmtValue.CStatus != PDH_CSTATUS_NEW_DATA) continue;
+ std::wstring name = items[i].szName ? items[i].szName : L"";
+ std::transform(name.begin(), name.end(), name.begin(), [](wchar_t ch) { return wchar_t(towlower(ch)); });
+ if (!luidKey.empty() && name.find(luidKey) == std::wstring::npos) continue;
+ const auto at = name.find(L"engtype_");
+ byType[at == std::wstring::npos ? std::wstring{} : name.substr(at + 8)] += items[i].FmtValue.doubleValue;
+ }
+ double busiest = 0;
+ for (const auto& [type, value] : byType) busiest = std::max(busiest, value);
+ impl->gpuUtil = std::clamp(busiest, 0.0, 100.0);
+ }
+ PdhCloseQuery(query);
+ });
+}
+
+void QmlPlayerBridge::updateRunStatus() {
+ auto& i = *impl_;
+ const auto& s = i.snapshot;
+ // QScreen's cached rate for the actual video host, not an arbitrary popup
+ // or another monitor. This uses the existing bounded status cadence.
+ double refresh=0;
+ const HWND owner=i.videoWindow?GetAncestor(i.videoWindow,GA_ROOT):nullptr;
+ for(auto* window:QGuiApplication::topLevelWindows())
+ if(window->isVisible()&&window->screen()&&reinterpret_cast<HWND>(window->winId())==owner){refresh=window->screen()->refreshRate();break;}
+ i.history.sample(s,{refresh,i.compareMode!=0});
+ const auto& rate=i.history.output;
+ const auto& f = s.metrics.flow;
+ const bool active = s.running && !s.image && s.transport == engine::TransportState::Playing;
+ QString status = tr("待机"), level = QStringLiteral("idle");
+ if (s.failed) { status = tr("错误"); level = QStringLiteral("err"); }
+ else if (s.remoteRecovering) { status = tr("恢复中"); level = QStringLiteral("warn"); }
+ // Paused to buffer a network source (#48): no pictures are due, so the output rate is not judged.
+ else if (s.running && s.network.active && (s.network.holding() || s.network.state == media::NetworkStats::State::Reconnecting)) {
+ status = tr("缓冲中"); level = QStringLiteral("warn");
+ }
+ else if (active && !s.applying && f.rateWindowReady) {
+ // Judged on the engine's own words, shown in the interface language.
+ const std::wstring rate = i.history.rateStatus(s);
+ status = uiText(rate);
+ level = rate == L"正常" ? QStringLiteral("ok") : QStringLiteral("warn");
+ }
+ else if (s.applying && s.running) { status = tr("调整中"); level = QStringLiteral("warn"); }
+ else if (active) status = tr("采样中");
+ else if (s.transport == engine::TransportState::Paused) status = tr("已暂停");
+ QStringList options;
+ const auto chosen=settings();
+ if(chosen.content!=engine::ContentRate::Transport){
+ QString cadence;
+ switch(chosen.content){
+ case engine::ContentRate::Auto:cadence=tr("自动识别内容节奏");break;
+ case engine::ContentRate::Fps30:cadence=tr("识别 %1 fps 内容").arg(30);break;
+ case engine::ContentRate::Fps50:cadence=tr("识别 %1 fps 内容").arg(50);break;
+ case engine::ContentRate::Fps60:cadence=tr("识别 %1 fps 内容").arg(60);break;
+ case engine::ContentRate::Capture60To30:cadence=tr("采集 60→30");break;
+ default:break;
+ }
+ if(s.running&&rate.halfRate)options<<tr("%1 · 当前约 %2 fps").arg(cadence).arg(rate.contentFps,0,'f',0);
+ else if(s.running&&rate.deduplicating)options<<tr("%1 · 去重后约 %2 fps").arg(cadence).arg(rate.contentFps,0,'f',0);
+ else if(s.running&&!s.capture)options<<tr("%1 · 当前来源未去重").arg(cadence);
+ else if(s.running)options<<tr("%1 · 尚未观察到去重").arg(cadence);
+ else options<<cadence;
+ }
+ if(i.presentation.display!=engine::DisplaySync::Tearing){
+ const auto sync=i.presentation.display==engine::DisplaySync::Vsync?tr("垂直同步"):tr("自动显示同步");
+ options<<((refresh>0)?tr("%1 · 屏幕 %2 Hz").arg(sync).arg(refresh,0,'f',1):sync);
+ }
+ // Variable refresh (NVIDIA G-SYNC / G-SYNC Compatible), Windows HDR and the
+ // refresh rate: the presenting monitor while playing, otherwise the main
+ // window's monitor. They come from the engine's DisplayStateService,
+ // queried in the background on events only (startup, another monitor,
+ // WM_DISPLAYCHANGE, the switch turned on, 刷新显示器状态), never on a timer.
+ // The driver and Windows settings are the user's; the 可变刷新 switch decides
+ // how Veyra presents when it is possible.
+ auto& displays=i.engine.displayStates();
+ if(i.displayChanged){i.displayChanged=false;displays.invalidate("display-change");}
+ HWND host=s.running&&i.videoWindow?i.videoWindow:owner;
+ if(!host)if(auto* window=QGuiApplication::focusWindow())host=reinterpret_cast<HWND>(window->winId());
+ // request() starts a query only when this monitor's state is stale or
+ // missing (the presenter asks for the same monitor while playing).
+ if(host)displays.request(host,i.displayRecheckPending?"manual":"ui");
+ const auto display=host?displays.state(displays.monitorOf(host)):std::nullopt;
+ const int vrrLevel=s.running?int(s.displayVrr):display?int(gfx::vrrLevel(display->vrr)):0;
+ const int hdr=display&&display->color.hdr?int(*display->color.hdr):-1;
+ const double refreshHz=display?display->refreshHz:0;
+ QString recheckNotice;bool recheckFailed=false;
+ if(i.displayRecheckPending){
+ // Answered once the shown monitor has a state of the re-check's generation.
+ if(display&&display->generation>=i.displayRecheckGeneration){
+ i.displayRecheckPending=false;
+ recheckNotice=tr("已刷新显示器状态:系统 HDR %1 · 可变刷新 %2")
+ .arg(hdr>0?tr("开"):hdr==0?tr("关"):tr("未知"),vrrSummaryText(int(gfx::vrrLevel(display->vrr))));
+ }else if(std::chrono::steady_clock::now()-i.displayRecheckSince>std::chrono::seconds(5)){
+ i.displayRecheckPending=false;recheckNotice=tr("刷新显示器状态没有完成,请稍后再试");recheckFailed=true;
+ }
+ }
+ const bool displayChecking=i.displayRecheckPending||displays.busy();
+ if(i.presentation.variableRefresh){
+ if(vrrLevel>=4)options<<tr("可变刷新 · 生效中");
+ else if(vrrLevel==3)options<<tr("可变刷新 · 等待驱动确认");
+ else options<<tr("可变刷新 · 当前屏幕不可用");
+ }else if(s.running&&vrrLevel>=4)options<<tr("屏幕可变刷新生效中");
+ if(i.presentation.outputRate!=engine::OutputRateMode::Off){
+ if(s.running&&s.presentationEffective.outputRate==engine::OutputRateMode::Off)
+ options<<tr("输出限帧 · 当前未生效");
+ else if(i.presentation.outputRate==engine::OutputRateMode::FollowDisplay)
+ options<<tr("输出限帧 · 跟随屏幕");
+ else options<<tr("输出限帧 · %1 fps").arg(i.presentation.customFps,0,'f',1);
+ }
+ if(i.presentation.enabled)options<<(s.running&&!s.presentationEffective.enabled?tr("低延迟队列 · 当前未生效"):tr("低延迟队列"));
+ if(!s.capture&&std::abs(s.playbackRate-1.0)>.001)options<<tr("播放速度 %1×").arg(s.playbackRate,0,'f',2);
+ if(i.compareMode!=0)options<<tr("画面对比 · 补帧暂停");
+ QStringList detail;
+ // Live output hint: also shown under the 倍率 control (fgDisplayHint).
+ QString fgHint;
+ if (s.running && !s.image && s.applied.multiplier > 1 && i.compareMode == 0 && s.displayFgSuggestion > 0 &&
+ s.displayFgContentFps > 0 && s.displayFgRefreshHz > 0) {
+ const double output = s.displayFgContentFps * s.applied.multiplier;
+ fgHint = s.displayFgSuggestion == 1
+ ? tr("当前帧率 %1 fps 超出屏幕刷新率 %2 Hz,建议关闭补帧来获得更好的延迟体验")
+ .arg(output, 0, 'f', 0).arg(s.displayFgRefreshHz, 0, 'f', 0)
+ : tr("当前帧率 %1 fps 超出屏幕刷新率 %2 Hz,建议降至 %3X 来获得更好的延迟体验")
+ .arg(output, 0, 'f', 0).arg(s.displayFgRefreshHz, 0, 'f', 0).arg(s.displayFgSuggestion);
+ }
+ if (s.running && !s.image) {
+ if (s.applied.multiplier > 1) {
+ QString backend;
+ switch (s.applied.frameGenerationBackend) {
+ case engine::FrameGenerationBackend::Dlss: backend = tr("DLSS"); break;
+ case engine::FrameGenerationBackend::XeSS: backend = tr("XeSS"); break;
+ case engine::FrameGenerationBackend::Fsr: backend = tr("FSR 3.1"); break;
+ case engine::FrameGenerationBackend::Fsr4: backend = tr("FSR 4 ML"); break;
+ case engine::FrameGenerationBackend::Vfg: backend = QStringLiteral("NVIDIA VFG"); break;
+ }
+ detail << tr("补帧 %1X · %2").arg(s.applied.multiplier)
+ .arg(backend);
+ }
+ else detail << tr("未补帧");
+ if (s.applied.multiplier > 1 && impl_->compareMode != 0) detail << tr("补帧暂停");
+ // Live output hint (DisplayFgBudget.h): a suggestion only, the
+ // multiplier stays the user's choice.
+ else if (!fgHint.isEmpty()) detail << fgHint;
+ else if (s.applied.multiplier > 1 && (s.fgBudgetLimited || s.xessGenerationSuppressed) &&
+ (!rate.policyLimited()||i.history.overloaded)) detail << tr("调度降档");
+ // Why VFG cannot hold the requested multiplier. One VFG interpolation
+ // costs about the same at any resolution, so what fits follows from its
+ // measured cost, the rest of the chain and the source interval; the
+ // display refresh caps what can be shown. A hint only: no setting changes.
+ if (s.applied.multiplier > 1 && s.applied.frameGenerationBackend == engine::FrameGenerationBackend::Vfg && i.compareMode == 0) {
+ const double source = rate.contentFps;
+ const auto perRun = f.gpuTiming[size_t(diagnostics::GpuStage::Fg1)].p95;
+ const auto batch = f.gpuTiming[size_t(diagnostics::GpuStage::FgBatch)].p95;
+ const auto whole = f.enhancementProcessing.p95;
+ // A mixed tier runs its first model once per pair (the middle
+ // subframe) and the second model for the others; Fg1 is then a
+ // second-model subframe whenever the group has more than one.
+ const bool mixed = engine::vfgMixedQuality(s.applied.vfgQuality) && s.applied.multiplier > 2;
+ const auto middleStage = diagnostics::GpuStage(unsigned(diagnostics::GpuStage::Fg1) + engine::vfgPrimarySubframe(s.applied.multiplier) - 1);
+ const auto middle = mixed ? f.gpuTiming[size_t(middleStage)].p95 : perRun;
+ if (s.fgBudgetLimited && (!rate.policyLimited()||i.history.overloaded) && source > 1 && perRun && *perRun > 0 && middle && *middle > 0 && batch && whole) {
+ const double base = std::max(0.0, *whole - *batch), budget = 1000.0 / source - base;
+ // generated = 1 middle + k others; fits = generated + the real frame.
+ const int generated = budget < *middle ? 0 : 1 + int(std::floor((budget - *middle) / *perRun));
+ const int fits = std::clamp(1 + generated, 1, int(s.applied.multiplier));
+ if (fits < int(s.applied.multiplier)) {
+ if (mixed) detail << tr("VFG 中间帧约 %1 ms、其余每张约 %2 ms,当前负载约可稳定 %3X").arg(*middle, 0, 'f', 1).arg(*perRun, 0, 'f', 1).arg(fits);
+ else detail << tr("VFG 每张约 %1 ms,当前负载约可稳定 %2X").arg(*perRun, 0, 'f', 1).arg(fits);
+ }
+ }
+ if (fgHint.isEmpty() && refresh > 1 && source > 1 && source * s.applied.multiplier > refresh * 1.02)
+ detail << tr("屏幕 %1 Hz 最多显示约 %2X").arg(refresh, 0, 'f', 0).arg(std::max(1, int(refresh / source)));
+ }
+ if (s.nominalSourceFps > 0.01) detail << tr("源 %1 fps").arg(s.nominalSourceFps, 0, 'f', 2);
+ if(active&&f.rateWindowReady&&rate.targetFps>0)detail<<tr("有效目标 %1 fps").arg(rate.targetFps,0,'f',1);
+ const auto autoState=nrAutoStatus();if(!autoState.isEmpty())detail<<autoState;
+ }
+ double ratio = -1.0;
+ if (active && f.rateWindowReady && rate.targetFps>0)ratio=rate.actualFps/rate.targetFps;
+ const bool ratioChanged = std::abs(ratio - i.rateRatio) > 0.005;
+ i.rateRatio = ratio;
+ // Frame-time line: the submit interval while playing (a real display rate is
+ // not available here), 48 samples = 12 s at the 250 ms cadence.
+ if (active && submitFpsKnown() && submitFps() > 0.5) {
+ i.frameTimes.push_back(1000.0 / submitFps());
+ while (i.frameTimes.size() > 48) i.frameTimes.pop_front();
+ } else if (!s.running && !i.frameTimes.empty()) i.frameTimes.clear();
+ const QString text = detail.join(QStringLiteral(" · "));
+ const double gpu = i.gpuUtil.load();
+ const double target=active&&f.rateWindowReady&&rate.targetFps>0?rate.targetFps:-1;
+ const bool changed = ratioChanged || active || status != i.runStatus || level != i.runLevel || text != i.runDetail || options!=i.runOptions || std::abs(target-i.effectiveOutputFps)>.05 || std::abs(gpu - i.gpuPublished) > 0.05 ||
+ fgHint != i.fgDisplayHint || vrrLevel != i.vrrState || displayChecking != i.displayChecking ||
+ hdr != i.displayHdr || std::abs(refreshHz - i.displayRefreshHz) > .01;
+ i.runStatus = status; i.runLevel = level; i.runDetail = text; i.gpuPublished = gpu;
+ i.runOptions=options;i.effectiveOutputFps=target;i.fgDisplayHint=fgHint;i.vrrState=vrrLevel;i.displayChecking=displayChecking;
+ i.displayHdr=hdr;i.displayRefreshHz=refreshHz;
+ if (changed) emit perfChanged();
+ if (!recheckNotice.isEmpty()) emit notice(recheckNotice, recheckFailed);
+}
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/Subtitles.cpp b/src/ui/bridge/Subtitles.cpp
new file mode 100644
index 00000000..3441a124
--- /dev/null
+++ b/src/ui/bridge/Subtitles.cpp
@@ -0,0 +1,363 @@
+// QML bridge: Subtitles responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- subtitles (P4-c) --------------------------------------------------------
+namespace {
+const wchar_t* const kSubtitleFonts[] = {L"Microsoft YaHei UI", L"SimHei", L"SimSun", L"DengXian", L"Arial", L"Segoe UI"};
+bool subtitleIsChinese(const engine::SubtitleTrack& t) {
+ const auto has = [](const std::wstring& s, const wchar_t* k) { return s.find(k) != std::wstring::npos; };
+ return has(t.language, L"chi") || has(t.language, L"zho") || has(t.language, L"zh") || has(t.name, L"中") ||
+ has(t.name, L"简") || has(t.name, L"繁");
+}
+} // namespace
+void ensureGdiplus() {
+ static ULONG_PTR token = 0;
+ if (token) return;
+ Gdiplus::GdiplusStartupInput input;
+ if (Gdiplus::GdiplusStartup(&token, &input, nullptr) != Gdiplus::Ok) token = 0;
+}
+void QmlPlayerBridge::refreshSubtitles(const std::wstring& media) {
+ auto& i = *impl_;
+ i.subTracks.clear(); i.subExternal = i.subLoaded = 0;
+ i.subPrimary = i.subSecondary = -1; i.subPrimaryChosen = i.subSecondaryChosen = false;
+ i.subStatus=QFileInfo(QString::fromStdWString(media)).isFile()?tr("正在读取字幕"):QString{}; i.subMedia = media;
+ if(i.subFileLoader)i.subFileGeneration=i.subFileLoader->requestFile(L"");
+ i.subFilePath.clear();
+ if (i.subAlignWorker.joinable()) { i.subAlignWorker.request_stop(); i.subAlignWorker = {}; }
+ i.subAligning = false; i.subAlignReady = false;
+ if (!i.subLoader) i.subLoader = std::make_unique<engine::SubtitleLoader>();
+ // A file on a server is scanned only while playback has its buffer (#48): a second reader
+ // that takes the same share's bandwidth would starve the picture it is meant to subtitle.
+ const bool server = !media.empty() && engine::subtitleServerFile(media);
+ i.subScanGate = server ? std::make_shared<std::atomic<bool>>(false) : nullptr;
+ i.subScanOpen = false;
+ i.subLoader->setReadGate(i.subScanGate);
+ if (server) i.subStatus = tr("字幕将在视频缓冲好后读取");
+ i.subGeneration = i.subLoader->request(media);
+ emit subtitlesChanged();
+}
+void QmlPlayerBridge::tickSubtitles() {
+ auto& i = *impl_;
+ bool changed = false;
+ if (i.subScanGate) {
+ // Opens once playback holds a few seconds ahead (or has read the whole file), closes when
+ // it runs short, and never opens for a server too slow for the stream itself.
+ const auto& n = i.snapshot.network;
+ const bool ended = n.active && n.state == media::NetworkStats::State::Ended;
+ const bool healthy = n.active && !n.bandwidthLow && n.state == media::NetworkStats::State::Playing;
+ const bool open = i.subScanOpen ? (ended || (healthy && n.bufferedSeconds >= 1.0))
+ : (ended || (healthy && n.bufferedSeconds >= 3.0));
+ if (open != i.subScanOpen) {
+ i.subScanOpen = open;
+ i.subScanGate->store(open);
+ veyra::log::info("subtitle", std::format("server scan gate {} (buffer {:.1f}s)", open ? "open" : "closed", n.bufferedSeconds));
+ if (open && i.subStatus == tr("字幕将在视频缓冲好后读取")) { i.subStatus = tr("正在读取字幕"); changed = true; }
+ }
+ }
+ if (i.subLoader) {
+ if (auto result = i.subLoader->poll(); result && result->generation == i.subGeneration) {
+ // Replace the loader's tracks, keep user-loaded files and per-track offsets.
+ const size_t count = result->tracks.size();
+ for (size_t k = 0; k < std::min(i.subLoaded, count); ++k)
+ result->tracks[k].offsetMs = i.subTracks[i.subExternal + k].offsetMs;
+ i.subTracks.erase(i.subTracks.begin() + std::ptrdiff_t(i.subExternal),
+ i.subTracks.begin() + std::ptrdiff_t(i.subExternal + i.subLoaded));
+ i.subTracks.insert(i.subTracks.begin() + std::ptrdiff_t(i.subExternal),
+ std::make_move_iterator(result->tracks.begin()), std::make_move_iterator(result->tracks.end()));
+ i.subLoaded = count;
+ if(result->complete&&(i.subStatus==tr("正在读取字幕")||i.subStatus==tr("字幕将在视频缓冲好后读取")))i.subStatus.clear();
+ int firstUsable = -1, firstChinese = -1;
+ for (size_t k = 0; k < i.subTracks.size(); ++k) {
+ if (!i.subTracks[k].usable()) continue;
+ if (firstUsable < 0) firstUsable = int(k);
+ if (firstChinese < 0 && subtitleIsChinese(i.subTracks[k])) firstChinese = int(k);
+ }
+ if (!i.subPrimaryChosen) i.subPrimary = firstChinese >= 0 ? firstChinese : firstUsable;
+ if (!i.subSecondaryChosen && i.prefBool("subtitleSecondLanguage", false)) {
+ int candidate = -1;
+ for (size_t k = 0; k < i.subTracks.size(); ++k)
+ if (i.subTracks[k].usable() && int(k) != i.subPrimary) { candidate = int(k); break; }
+ i.subSecondary = candidate;
+ }
+ if (result->complete)
+ for (const auto& t : i.subTracks)
+ veyra::log::info("subtitle", std::format("track name={} codec={} embedded={} cues={} usable={}",
+ QString::fromStdWString(t.name).toStdString(), QString::fromStdWString(t.codec).toStdString(),
+ t.embedded ? 1 : 0, t.cues.size(), t.usable() ? 1 : 0));
+ veyra::log::info("subtitle", std::format("tracks={} primary={} secondary={}", i.subTracks.size(), i.subPrimary, i.subSecondary));
+ changed = true;
+ }
+ }
+ if(i.subFileLoader){
+ if(auto result=i.subFileLoader->poll();result&&result->generation==i.subFileGeneration&&result->complete&&!i.subFilePath.empty()){
+ const auto file=QFileInfo(QString::fromStdWString(i.subFilePath)).fileName();
+ i.subFilePath.clear();
+ const bool usable=std::any_of(result->tracks.begin(),result->tracks.end(),[](const auto& t){return t.usable();});
+ if(!usable){
+ const auto detail=result->tracks.empty()?tr("文件格式不支持、数据损坏或没有字幕内容"):uiText(result->tracks.front().note);
+ i.subStatus=tr("外部字幕加载失败:%1 · %2").arg(file,detail);
+ emit notice(i.subStatus,true);
+ }else{
+ const int added=int(result->tracks.size());
+ int first=0;
+ while(!result->tracks[size_t(first)].usable())++first;
+ i.subTracks.insert(i.subTracks.begin(),std::make_move_iterator(result->tracks.begin()),std::make_move_iterator(result->tracks.end()));
+ i.subExternal+=size_t(added);
+ if(i.subSecondary>=0)i.subSecondary+=added;
+ if(i.subAlignTrack>=0)i.subAlignTrack+=added;
+ i.subPrimary=first;i.subPrimaryChosen=true;
+ i.subStatus=tr("已加载外部字幕:%1").arg(file);
+ veyra::log::info("subtitle",std::format("external loaded tracks={} file={}",added,file.toStdString()));
+ }
+ changed=true;
+ }
+ }
+ if (i.subAlignReady.exchange(false) && i.subAlignGeneration == i.subGeneration &&
+ i.subAlignTrack >= 0 && size_t(i.subAlignTrack) < i.subTracks.size()) {
+ i.subTracks[size_t(i.subAlignTrack)].offsetMs = i.subAlignOffset.load();
+ std::lock_guard lock(i.subAlignMutex);
+ i.subStatus = tr("自动对齐:%1(Z/X 可微调)").arg(QString::fromStdWString(i.subAlignDetail));
+ veyra::log::info("subtitle", std::format("auto align applied offsetMs={}", i.subAlignOffset.load()));
+ changed = true;
+ }
+ if (i.subAligning.load() != (i.subStatus.startsWith(tr("正在自动对齐")))) changed = true;
+ if (changed) emit subtitlesChanged();
+
+ // Draw. The overlay is a layered child of the video window: it moves with the
+ // picture and is clipped by the same window region as the video itself.
+ if (!i.videoWindow || !IsWindow(i.videoWindow)) return;
+ if (!i.subOverlay) {
+ // A refused layered child (missing compatibility manifest, old OS) is
+ // reported once; retrying every tick would only flood the log.
+ if (i.subOverlayFailed) return;
+ ensureGdiplus();
+ i.subOverlay = createSubtitleOverlay(i.videoWindow);
+ const DWORD error = i.subOverlay ? 0 : GetLastError();
+ veyra::log::info("subtitle", std::format("overlay created ok={} err={}", i.subOverlay != nullptr, error));
+ if (!i.subOverlay) { i.subOverlayFailed = true; return; }
+ }
+ RECT client{}; GetClientRect(i.videoWindow, &client);
+ RECT current{}; GetClientRect(i.subOverlay, &current);
+ if (current.right != client.right || current.bottom != client.bottom)
+ SetWindowPos(i.subOverlay, HWND_TOP, 0, 0, client.right, client.bottom, SWP_NOACTIVATE);
+ const auto& s = i.snapshot;
+ std::vector<SubtitleLine> draw;
+ const bool show = i.prefBool("subtitleEnabled", true) && (s.running && !s.image && !s.capture) && !i.subTracks.empty();
+ if (show) {
+ auto append = [&](int index, bool secondary) {
+ if (index < 0 || size_t(index) >= i.subTracks.size()) return;
+ const auto& track = i.subTracks[size_t(index)];
+ if (!track.usable()) return;
+ const double at = s.position + double(track.offsetMs) / 1000.0;
+#ifdef VEYRA_HAS_LIBASS
+ if (track.ass) {
+ // ASS/SSA: libass draws the whole script (effects, karaoke,
+ // container fonts). The parsed text only feeds diagnostics.
+ SubtitleLine line;
+ line.ass = track.ass; line.assTimeMs = at * 1000.0; line.secondary = secondary;
+ line.text = engine::textAt(track, at);
+ draw.push_back(std::move(line));
+ return;
+ }
+#endif
+ for (const auto* cue : engine::cuesAt(track, at, 3)) {
+ SubtitleLine line;
+ line.text = cue->text; line.bitmap = cue->bitmap;
+ line.style = track.styles.empty() ? engine::SubtitleStyle{}
+ : track.styles[size_t(std::clamp(cue->style, 0, int(track.styles.size()) - 1))];
+ if (cue->alignOverride) line.style.alignment = cue->alignOverride;
+ line.alignOverride = cue->alignOverride;
+ line.posX = cue->posX >= 0 ? cue->posX / std::max(1.0, track.scriptWidth) : -1.0;
+ line.posY = cue->posY >= 0 ? cue->posY / std::max(1.0, track.scriptHeight) : -1.0;
+ line.secondary = secondary;
+ // Outline level 0..3: none / thin / normal / thick, over the track's own width.
+ const int outline = i.prefInt("subtitleOutline", 2);
+ if (outline == 0) line.style.outlineWidth = 0;
+ else if (line.style.outlineWidth <= 0) line.style.outlineWidth = outline == 1 ? 1.0 : outline == 2 ? 2.0 : 3.5;
+ else line.style.outlineWidth *= outline == 1 ? 0.6 : outline == 3 ? 1.6 : 1.0;
+ draw.push_back(std::move(line));
+ }
+ };
+ append(i.subSecondary, true); // the painter stacks bottom-up
+ append(i.subPrimary, false);
+ }
+ SubtitleView view;
+ view.scale = double(i.prefInt("subtitleSize", 22)) / 22.0;
+ const int font = i.prefInt("subtitleFont", 0);
+ view.fontOverride = font > 0 ? std::wstring(kSubtitleFonts[std::clamp(font, 0, 5)]) : std::wstring{};
+ view.outline = i.prefInt("subtitleOutline", 2) > 0;
+ view.background = i.prefBool("subtitleBackground", false);
+ view.bottomMargin = i.prefInt("subtitleMargin", 0) + i.subBottomInset;
+ view.targetLines = i.prefInt("subtitleLines", 2);
+ view.fitToLines = i.prefBool("subtitleFit", false);
+ view.preview = i.engine.previewView();
+ view.videoWidth = s.metrics.resolution.output.width;
+ view.videoHeight = s.metrics.resolution.output.height;
+ updateSubtitleOverlay(i.subOverlay, draw, view);
+ QString joined;
+ for (const auto& line : draw) { if (line.text.empty()) continue; if (!joined.isEmpty()) joined += QStringLiteral(" | "); joined += QString::fromStdWString(line.text); }
+ if (joined != i.subText) {
+ i.subText = joined;
+ if (!joined.isEmpty()) veyra::log::info("subtitle-overlay", "text=" + joined.toStdString());
+ emit subtitleTextChanged();
+ }
+}
+QVariantList QmlPlayerBridge::subtitleTracks() const {
+ QVariantList out;
+ for (size_t k = 0; k < impl_->subTracks.size(); ++k) {
+ const auto& t = impl_->subTracks[k];
+ QString label = QString::fromStdWString(t.name);
+ if (label.isEmpty()) label = QString::fromStdWString(t.language);
+ if (label.isEmpty()) label = tr("字幕 %1").arg(k + 1);
+ QString note = t.embedded ? tr("内嵌") : tr("外挂");
+ if (!t.codec.empty()) note += QStringLiteral(" · ") + QString::fromStdWString(t.codec).toUpper();
+ if (!t.note.empty()) note += QStringLiteral(" · ") + uiText(t.note);
+ else if(!t.usable()) note += QStringLiteral(" · ") + tr("未解码出可显示的字幕");
+ out << QVariantMap{{"index", int(k)}, {"label", label}, {"note", note}, {"usable", t.usable()},
+ {"embedded", t.embedded}, {"cues", int(t.cues.size())}, {"offsetMs", t.offsetMs}};
+ }
+ return out;
+}
+int QmlPlayerBridge::subtitlePrimary() const { return impl_->subPrimary; }
+void QmlPlayerBridge::setSubtitlePrimary(int index) {
+ if (index < -1 || index >= int(impl_->subTracks.size())) return;
+ if (index >= 0 && !impl_->subTracks[size_t(index)].usable()) { emit notice(tr("该字幕轨没有可显示的内容"), true); return; }
+ impl_->subPrimaryChosen = true;
+ if (impl_->subPrimary == index) return;
+ impl_->subPrimary = index;
+ if (impl_->subSecondary == index) impl_->subSecondary = -1;
+ veyra::log::info("subtitle", std::format("primary={} secondary={}", impl_->subPrimary, impl_->subSecondary));
+ emit subtitlesChanged();
+}
+int QmlPlayerBridge::subtitleSecondary() const { return impl_->subSecondary; }
+void QmlPlayerBridge::setSubtitleSecondary(int index) {
+ if (index < -1 || index >= int(impl_->subTracks.size())) return;
+ if (index >= 0 && (!impl_->subTracks[size_t(index)].usable() || index == impl_->subPrimary)) return;
+ impl_->subSecondaryChosen = true;
+ if (impl_->subSecondary == index) return;
+ impl_->subSecondary = index;
+ veyra::log::info("subtitle", std::format("primary={} secondary={}", impl_->subPrimary, impl_->subSecondary));
+ emit subtitlesChanged();
+}
+int QmlPlayerBridge::subtitleOffsetMs() const {
+ const int p = impl_->subPrimary;
+ return p >= 0 && size_t(p) < impl_->subTracks.size() ? impl_->subTracks[size_t(p)].offsetMs : 0;
+}
+void QmlPlayerBridge::setSubtitleOffsetMs(int ms) {
+ const int p = impl_->subPrimary;
+ if (p < 0 || size_t(p) >= impl_->subTracks.size()) return;
+ auto& track = impl_->subTracks[size_t(p)];
+ ms = std::clamp(ms, -30000, 30000);
+ if (track.offsetMs == ms) return;
+ track.offsetMs = ms;
+ impl_->subStatus = tr("字幕延时 %1 ms").arg(ms);
+ veyra::log::info("subtitle", std::format("offset track={} offsetMs={}", p, ms));
+ emit subtitlesChanged();
+}
+QString QmlPlayerBridge::subtitleStatus() const { return impl_->subStatus; }
+bool QmlPlayerBridge::subtitleAligning() const { return impl_->subAligning.load(); }
+QString QmlPlayerBridge::subtitleText() const { return impl_->subText; }
+int QmlPlayerBridge::subtitleBottomInset() const { return impl_->subBottomInset; }
+void QmlPlayerBridge::setSubtitleBottomInset(int value) {
+ value = std::clamp(value, 0, 400);
+ if (impl_->subBottomInset == value) return;
+ impl_->subBottomInset = value;
+ emit subtitlesChanged();
+}
+void QmlPlayerBridge::loadSubtitleDialog() {
+ const QString start = impl_->subMedia.empty() ? QString() : QFileInfo(QString::fromStdWString(impl_->subMedia)).absolutePath();
+ const QString path = QFileDialog::getOpenFileName(nullptr, tr("加载外部字幕"), start,
+ tr("字幕文件 (*.srt *.ass *.ssa *.vtt *.sup *.pgs *.idx *.sub *.smi *.sami *.sbv *.mpl *.stl *.txt);;所有文件 (*.*)"));
+ if (!path.isEmpty()) loadSubtitleFile(path);
+}
+bool QmlPlayerBridge::loadSubtitleFile(const QString& path) {
+ if(!QFileInfo(path).isFile()){
+ emit notice(tr("字幕文件不存在或无法读取"),true);
+ return false;
+ }
+ if(!impl_->subFileLoader)impl_->subFileLoader=std::make_unique<engine::SubtitleLoader>();
+ impl_->subFilePath=wideOf(path);
+ impl_->subFileGeneration=impl_->subFileLoader->requestFile(impl_->subFilePath);
+ impl_->subStatus=tr("正在加载外部字幕:%1").arg(QFileInfo(path).fileName());
+ emit subtitlesChanged();
+ return true;
+}
+void QmlPlayerBridge::nudgeSubtitle(int deltaMs) {
+ if (impl_->subPrimary < 0) { emit notice(tr("没有正在显示的字幕"), true); return; }
+ setSubtitleOffsetMs(subtitleOffsetMs() + deltaMs);
+ emit notice(impl_->subStatus, false);
+}
+void QmlPlayerBridge::cycleSubtitle(bool secondary) {
+ auto& i = *impl_;
+ if (i.subTracks.empty()) { emit notice(tr("当前片源没有字幕"), true); return; }
+ int slot = secondary ? i.subSecondary : i.subPrimary;
+ for (size_t n = 0; n <= i.subTracks.size(); ++n) { // -1 -> 0 -> ... -> -1, skipping unusable
+ slot = slot + 1 >= int(i.subTracks.size()) ? -1 : slot + 1;
+ if (slot < 0 || (i.subTracks[size_t(slot)].usable() && !(secondary && slot == i.subPrimary))) break;
+ }
+ if (secondary) setSubtitleSecondary(slot); else setSubtitlePrimary(slot);
+ const int now = secondary ? i.subSecondary : i.subPrimary;
+ emit notice(now < 0 ? (secondary ? tr("副字幕已关闭") : tr("主字幕已关闭"))
+ : (secondary ? tr("副字幕:%1") : tr("主字幕:%1")).arg(subtitleTracks()[now].toMap().value("label").toString()), false);
+}
+void QmlPlayerBridge::toggleSubtitles() {
+ const bool on = !impl_->prefBool("subtitleEnabled", true);
+ setPreference(QStringLiteral("subtitleEnabled"), on);
+ emit notice(on ? tr("字幕:开") : tr("字幕:关"), false);
+}
+void QmlPlayerBridge::autoAlignSubtitle() {
+ auto& i = *impl_;
+ if (i.subAligning.load()) { emit notice(tr("已有一个自动对齐在进行"), true); return; }
+ if (i.subMedia.empty() || i.subPrimary < 0 || !i.subTracks[size_t(i.subPrimary)].usable()) {
+ emit notice(tr("没有可用的主字幕,无法自动对齐"), true); return;
+ }
+ const std::wstring media = i.subMedia;
+ const auto track = i.subTracks[size_t(i.subPrimary)];
+ i.subAlignGeneration = i.subGeneration; i.subAlignTrack = i.subPrimary;
+ i.subAligning = true; i.subAlignReady = false;
+ i.subStatus = tr("正在自动对齐:分析音轨(最多前 30 分钟)…");
+ emit subtitlesChanged();
+ i.subAlignWorker = std::jthread([&i, media, track](std::stop_token stop) {
+ const auto result = engine::alignSubtitleToAudio(media, track, 30, stop);
+ if (stop.stop_requested()) { i.subAligning = false; return; }
+ { std::lock_guard lock(i.subAlignMutex); i.subAlignDetail = result.detail; }
+ i.subAlignOffset = result.ok ? result.offsetMs : 0;
+ i.subAlignReady = result.ok;
+ i.subAligning = false;
+ });
+}
+
+void QmlPlayerBridge::attachVideoWindow(qulonglong nativeHandle) {
+ impl_->videoWindow = reinterpret_cast<HWND>(nativeHandle);
+}
+
+void QmlPlayerBridge::setPreOpenHook(std::function<void()> hook) {
+ impl_->preOpen = std::move(hook);
+}
+
+QString QmlPlayerBridge::appName() const { return QStringLiteral("Veyra"); }
+QString QmlPlayerBridge::version() const { return QStringLiteral(VEYRA_DISPLAY_VERSION); }
+
+// --- audio sync (1.4.4 声音补偿, #12) ------------------------------------------
+int QmlPlayerBridge::audioSyncMode() const { return int(settings().audioSync); }
+void QmlPlayerBridge::setAudioSyncMode(int value) {
+ if (value < 0 || value > 2) return;
+ auto s = settings();
+ if (int(s.audioSync) == value) return;
+ s.audioSync = static_cast<engine::AudioSyncMode>(value);
+ if (!impl_->commit(std::move(s))) return;
+ impl_->prefs[QStringLiteral("audioSync")] = value;
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "sound sync mode not saved");
+ emit settingsChanged();
+}
+bool QmlPlayerBridge::audioSyncLive() const {
+ const auto& s = impl_->snapshot;
+ return s.running && (s.capture || s.remotePlay);
+}
+double QmlPlayerBridge::audioCompensationMs() const {
+ return audioSyncLive() ? impl_->snapshot.captureAudio.compensationMs : 0.0;
+}
+
+
+} // namespace veyra::ui
diff --git a/src/ui/bridge/View.cpp b/src/ui/bridge/View.cpp
new file mode 100644
index 00000000..986abe5d
--- /dev/null
+++ b/src/ui/bridge/View.cpp
@@ -0,0 +1,370 @@
+// QML bridge: View responsibilities.
+#include "../QmlPlayerBridge_p.h"
+
+namespace veyra::ui {
+// --- NR protection regions drawn on the picture (#8) ------------------------
+namespace {
+// Outline of the region being drawn, on a layered child of the video window
+// (the swapchain is never read or touched), as 1.4.4's ProtectionOverlay.
+void drawProtectionOutline(HWND overlay, HWND video, RECT box, bool ellipse) {
+ RECT r{}; GetClientRect(video, &r);
+ if (r.right < 1 || r.bottom < 1) return;
+ SetWindowPos(overlay, HWND_TOP, 0, 0, r.right, r.bottom, SWP_NOACTIVATE);
+ BITMAPINFO info{}; info.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); info.bmiHeader.biWidth = r.right;
+ info.bmiHeader.biHeight = -r.bottom; info.bmiHeader.biPlanes = 1; info.bmiHeader.biBitCount = 32;
+ HDC screen = GetDC(nullptr), memory = CreateCompatibleDC(screen); void* bits = nullptr;
+ HBITMAP bitmap = CreateDIBSection(screen, &info, DIB_RGB_COLORS, &bits, nullptr, 0);
+ if (!bitmap || !bits) { if (bitmap) DeleteObject(bitmap); DeleteDC(memory); ReleaseDC(nullptr, screen); return; }
+ auto previous = SelectObject(memory, bitmap);
+ memset(bits, 0, size_t(r.right) * size_t(r.bottom) * 4);
+ {
+ Gdiplus::Bitmap canvas(r.right, r.bottom, r.right * 4, PixelFormat32bppPARGB, static_cast<BYTE*>(bits));
+ Gdiplus::Graphics g(&canvas); g.SetSmoothingMode(Gdiplus::SmoothingModeAntiAlias);
+ Gdiplus::Pen pen(Gdiplus::Color(255, 255, 138, 61), 2.0f);
+ Gdiplus::SolidBrush fill(Gdiplus::Color(40, 255, 138, 61));
+ const Gdiplus::Rect rect(box.left, box.top, std::max(1L, box.right - box.left), std::max(1L, box.bottom - box.top));
+ if (ellipse) { g.FillEllipse(&fill, rect); g.DrawEllipse(&pen, rect); }
+ else { g.FillRectangle(&fill, rect); g.DrawRectangle(&pen, rect); }
+ }
+ SIZE size{r.right, r.bottom}; POINT origin{}; BLENDFUNCTION blend{AC_SRC_OVER, 0, 255, AC_SRC_ALPHA};
+ if (UpdateLayeredWindow(overlay, screen, nullptr, &size, memory, &origin, 0, &blend, ULW_ALPHA))
+ ShowWindow(overlay, SW_SHOWNOACTIVATE);
+ SelectObject(memory, previous); DeleteObject(bitmap); DeleteDC(memory); ReleaseDC(nullptr, screen);
+}
+}
+
+QVariantList QmlPlayerBridge::protectionRegions() const {
+ QVariantList out;
+ const auto& p = settings().protection;
+ for (int i = 0; i < int(p.regions.size()); ++i) {
+ const auto& q = p.regions[size_t(i)];
+ if (q.empty()) continue;
+ out << QVariantMap{{"index", i}, {"left", double(q.left)}, {"top", double(q.top)}, {"right", double(q.right)},
+ {"bottom", double(q.bottom)}, {"ellipse", q.ellipse}};
+ }
+ return out;
+}
+QString QmlPlayerBridge::protectionDrawShape() const { return impl_->protDraw; }
+
+bool QmlPlayerBridge::editProtection(const std::function<bool(engine::ChainNode&)>& edit) {
+ if (impl_->chain.mode != engine::ChainMode::List) { emit notice(tr("NR 保护区域仅在列表模式可用"), true); return false; }
+ for (uint32_t i = 0; i < impl_->chain.nodeCount; ++i) {
+ auto& node = impl_->chain.nodes[i];
+ if (node.type != engine::EffectType::Protection) continue;
+ const auto before = node; const bool wasValid = chainValid();
+ if (!edit(node)) return false;
+ if (node == before) return true;
+ const bool accepted = impl_->revalidate(true);
+ if (!accepted) { const auto error = impl_->validation.message; node = before; impl_->revalidate(); emit notice(uiText(error), true); }
+ emit settingsChanged();
+ if (before.enabled != node.enabled) emitChainChanged(); else emitParameterChanged(&QmlPlayerBridge::protectionChanged, wasValid);
+ return accepted;
+ }
+ emit notice(tr("处理链中没有 NR 保护节点,未更改设置"), true);
+ return false;
+}
+
+bool QmlPlayerBridge::beginProtectionDraw(const QString& shape) {
+ auto& i = *impl_;
+ if (shape.isEmpty()) {
+ if (i.protOverlay) ShowWindow(i.protOverlay, SW_HIDE);
+ if (!i.protDraw.isEmpty()) { i.protDraw.clear(); emit protectionDrawChanged(); }
+ return true;
+ }
+ if (shape != QLatin1String("rect") && shape != QLatin1String("ellipse")) return false;
+ if (i.chain.mode != engine::ChainMode::List) { emit notice(tr("NR 保护区域仅在列表模式可用"), true); return false; }
+ if (!i.snapshot.running || !i.videoWindow) { emit notice(tr("请先打开视频,再在画面上绘制保护区域"), true); return false; }
+ bool space = false;
+ for (const auto& q : settings().protection.regions) space |= q.empty();
+ if (!space) { emit notice(tr("最多 4 个保护区域,请先删除一个"), true); return false; }
+ i.protDraw = shape;
+ emit protectionDrawChanged();
+ return true;
+}
+
+void QmlPlayerBridge::updateProtectionDraw(double x0, double y0, double x1, double y1) {
+ auto& i = *impl_;
+ if (i.protDraw.isEmpty() || !i.videoWindow) return;
+ if (!i.protOverlay) { ensureGdiplus(); i.protOverlay = createSubtitleOverlay(i.videoWindow); }
+ if (!i.protOverlay) return;
+ RECT client{}; GetClientRect(i.videoWindow, &client);
+ const auto px = [&](double f, LONG extent) { return LONG(std::lround(std::clamp(f, 0.0, 1.0) * extent)); };
+ const RECT box{px(std::min(x0, x1), client.right), px(std::min(y0, y1), client.bottom),
+ px(std::max(x0, x1), client.right), px(std::max(y0, y1), client.bottom)};
+ drawProtectionOutline(i.protOverlay, i.videoWindow, box, i.protDraw == QLatin1String("ellipse"));
+}
+
+bool QmlPlayerBridge::commitProtectionDraw(double x0, double y0, double x1, double y1) {
+ auto& i = *impl_;
+ const bool ellipse = i.protDraw == QLatin1String("ellipse");
+ const bool armed = !i.protDraw.isEmpty();
+ beginProtectionDraw(QString());
+ if (!armed || !i.videoWindow) return false;
+ RECT client{}; GetClientRect(i.videoWindow, &client);
+ if (client.right < 1 || client.bottom < 1) return false;
+ const double w = client.right, h = client.bottom;
+ // Too small to be intended (1.4.4: at least 3 px each way).
+ if (std::abs(x1 - x0) * w < 3 || std::abs(y1 - y0) * h < 3) return false;
+ // Host pixels -> source-normalized, through the current zoom/pan (1.4.4).
+ const auto e = i.snapshot.metrics.resolution.output;
+ const auto view = i.engine.previewView();
+ const auto a = view.sourcePoint(float(x0 * w), float(y0 * h), float(w), float(h), float(e.width), float(e.height));
+ const auto b = view.sourcePoint(float(x1 * w), float(y1 * h), float(w), float(h), float(e.width), float(e.height));
+ engine::ProtectionRect q{std::clamp(std::min(a.first, b.first), 0.0f, 1.0f), std::clamp(std::min(a.second, b.second), 0.0f, 1.0f),
+ std::clamp(std::max(a.first, b.first), 0.0f, 1.0f), std::clamp(std::max(a.second, b.second), 0.0f, 1.0f), ellipse};
+ if (q.empty()) return false;
+ const bool ok = editProtection([&](engine::ChainNode& node) {
+ for (auto& slot : node.protection.regions)
+ if (slot.empty()) { slot = q; node.enabled = true; node.protection.enabled = true; return true; }
+ emit notice(tr("最多 4 个保护区域,请先删除一个"), true);
+ return false;
+ });
+ veyra::log::info("ui-protection", std::format("{} accepted={} bounds={:.3f},{:.3f},{:.3f},{:.3f} source-normalized NR-only",
+ ellipse ? "ellipse" : "rectangle", ok, q.left, q.top, q.right, q.bottom));
+ return ok;
+}
+
+bool QmlPlayerBridge::removeProtectionRegion(int index) {
+ if (index < 0 || index >= int(engine::ProtectionSettings{}.regions.size())) return false;
+ return editProtection([&](engine::ChainNode& node) {
+ // Keep the remaining regions packed in order.
+ auto& regions = node.protection.regions;
+ for (int k = index; k + 1 < int(regions.size()); ++k) regions[size_t(k)] = regions[size_t(k + 1)];
+ regions.back() = {};
+ return true;
+ });
+}
+bool QmlPlayerBridge::clearProtectionRegions() {
+ return editProtection([](engine::ChainNode& node) { node.protection.regions = {}; return true; });
+}
+bool QmlPlayerBridge::setProtectionFeather(double pixels) {
+ if (!std::isfinite(pixels) || pixels < 0 || pixels > 64) return false;
+ return editProtection([&](engine::ChainNode& node) { node.protection.featherPixels = float(pixels); return true; });
+}
+
+
+// --- design gap B8-B11: compare and aspect ------------------------------------
+int QmlPlayerBridge::compareMode() const { return impl_->compareMode; }
+void QmlPlayerBridge::setCompareMode(int value) {
+ if (value < 0 || value > 2 || impl_->compareMode == value) return;
+ impl_->compareMode = value;
+ if (!impl_->holdKeyDown) impl_->engine.comparison(value, impl_->compareBase, float(impl_->compareSplit));
+ veyra::log::info("ui-compare", std::format("mode={} base={} split={:.3f}", value, impl_->compareBase, impl_->compareSplit));
+ // Comparison shows real frames only (a generated frame has no original to set beside
+ // it), so frame generation pauses while it is on. A field user left split compare on
+ // for 24 minutes and reported "补帧无效" (logs9, 2026-10-01): say so.
+ if (value != 0 && impl_->snapshot.running && impl_->snapshot.applied.multiplier > 1)
+ emit notice(tr("对比模式下补帧暂停(对比只能用真实帧),关闭对比后自动恢复"), false);
+ emit compareChanged();
+}
+bool QmlPlayerBridge::compareBase() const { return impl_->compareBase; }
+void QmlPlayerBridge::setCompareBase(bool value) {
+ if (impl_->compareBase == value) return;
+ impl_->compareBase = value;
+ if (!impl_->holdKeyDown) impl_->engine.comparison(impl_->compareMode, value, float(impl_->compareSplit));
+ emit compareChanged();
+}
+double QmlPlayerBridge::compareSplit() const { return impl_->compareSplit; }
+void QmlPlayerBridge::setCompareSplitAt(double fx) {
+ // 1.4.4 AppShell: the split is a fraction of the displayed picture, which is
+ // letterboxed and may be zoomed/panned inside the host.
+ auto& i = *impl_;
+ if (!i.videoWindow || !std::isfinite(fx)) return;
+ RECT r{}; GetClientRect(i.videoWindow, &r);
+ if (r.right < 1 || r.bottom < 1) return;
+ const auto e = i.snapshot.metrics.resolution.output;
+ const auto view = i.engine.previewView();
+ float contentWidth = float(r.right);
+ if (e.width && e.height) contentWidth = view.renderedSize(float(r.right),float(r.bottom),float(e.width),float(e.height)).first;
+ const float left = r.right * .5f - contentWidth * view.centerX;
+ i.compareSplit = std::clamp((float(fx) * r.right - left) / std::max(1.0f, contentWidth), 0.0f, 1.0f);
+ if (!i.holdKeyDown) i.engine.comparison(i.compareMode, i.compareBase, float(i.compareSplit));
+ emit compareChanged();
+}
+int QmlPlayerBridge::aspectMode() const { return impl_->screenFillActive ? 2 : impl_->aspectMode; }
+void QmlPlayerBridge::setAspectMode(int value) {
+ if (value < 0 || value > 6 || (impl_->aspectMode == value && !impl_->screenFillActive)) return;
+ impl_->aspectMode = value;
+ impl_->screenFillActive = false;
+ impl_->prefs[QStringLiteral("aspect")] = value;
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "aspect mode not saved");
+ applyAspect(true);
+ if (gameMode()) { updateGameGeometry(); updateGameMode(); emit gameModeChanged(); }
+ emit compareChanged();
+}
+void QmlPlayerBridge::applyAspect(bool force) {
+ auto& i = *impl_;
+ const bool aligned=gameMode()&&i.presentation.fullscreen&&!gameScaledPreview();
+ const int mode = i.screenFillActive ? 2 : i.aspectMode;
+ if (!i.videoWindow) return;
+ RECT r{}; GetClientRect(i.videoWindow, &r);
+ const auto e = i.snapshot.metrics.resolution.output;
+ const QSize client(r.right, r.bottom), image(int(e.width), int(e.height));
+ const double dar=sourceAspect();
+ if (!force && mode == i.aspectApplied && client == i.screenFitClient && image == i.screenFitImage && dar == i.screenFitAspect) return;
+ i.screenFitClient = client; i.screenFitImage = image; i.aspectApplied = mode; i.screenFitAspect = dar;
+ auto view=force||aligned?engine::PreviewView{}:i.engine.previewView();
+ view.mode=mode;
+ view.displayAspect=dar>0&&image.height()>0&&std::abs(dar-double(image.width())/image.height())>.001?dar:0;
+ i.engine.previewView(view);
+ veyra::log::info("ui-aspect", std::format("mode={} zoom={:.3f} dar={:.4f} client={}x{} image={}x{}",mode,view.zoom,dar,
+ client.width(),client.height(),image.width(),image.height()));
+}
+
+// --- design gap D18 / C15 / E20 / F21 / F24 ------------------------------------
+double QmlPlayerBridge::audioSkewMs() const {
+ const auto& skew = impl_->snapshot.captureAudio.skewMs;
+ return audioSkewKnown() ? *skew : 0.0;
+}
+bool QmlPlayerBridge::audioSkewKnown() const {
+ const auto& skew = impl_->snapshot.captureAudio.skewMs;
+ return audioSyncLive() && skew.has_value() && std::isfinite(*skew) && std::abs(*skew) < 5000.0;
+}
+
+QString QmlPlayerBridge::exportSizeEstimate() const {
+ const auto gb = [](double bytes) {
+ return bytes >= 1024.0 * 1024 * 1024 ? QStringLiteral("%1 GB").arg(bytes / (1024.0 * 1024 * 1024), 0, 'f', 2)
+ : QStringLiteral("%1 MB").arg(bytes / (1024.0 * 1024), 0, 'f', 0);
+ };
+ if (exportRunning()) {
+ const double progress = exportProgress();
+ const QFileInfo partial(exportTarget() + QStringLiteral(".partial"));
+ if (progress > 0.02 && partial.exists() && partial.size() > 0)
+ return tr("预计约 %1(按已写入 %2 推算)").arg(gb(partial.size() / progress)).arg(gb(double(partial.size())));
+ return tr("开始写入后按已写入量推算");
+ }
+ const double end = impl_->exportTrimEndSeconds > 0 ? impl_->exportTrimEndSeconds : impl_->snapshot.duration;
+ const double seconds = std::max(0.0, end - impl_->exportTrimStartSeconds);
+ if (seconds <= 0) return QString();
+ if (impl_->exportBitrateMbps > 0)
+ return tr("约 %1(视频 %2 Mbps × %3,音轨另计)").arg(gb(impl_->exportBitrateMbps * 1e6 / 8.0 * seconds))
+ .arg(impl_->exportBitrateMbps).arg(formatTime(seconds));
+ return tr("恒定质量:大小取决于画面,开始后按已写入量推算");
+}
+
+QVariantMap QmlPlayerBridge::lastSource() const {
+ auto saved = impl_->prefs.value(QStringLiteral("lastSource")).toMap();
+ const QString kind = saved.value(QStringLiteral("kind")).toString();
+ if (kind == QLatin1String("file")) {
+ saved[QStringLiteral("summary")]=QFileInfo(saved.value(QStringLiteral("label")).toString()).fileName();
+ } else if (kind == QLatin1String("capture")) {
+ if (!hasCaptureSession()) return {};
+ saved[QStringLiteral("summary")] = captureSessionSummary();
+ } else if (kind == QLatin1String("ps5")) {
+ saved[QStringLiteral("summary")] = tr("PS5 串流 · %1").arg(saved.value(QStringLiteral("label")).toString());
+ } else if (kind == QLatin1String("moonlight")) {
+ saved[QStringLiteral("summary")] = tr("PC 串流 · %1").arg(saved.value(QStringLiteral("label")).toString());
+ } else if (kind == QLatin1String("xbox")) {
+ saved[QStringLiteral("summary")] = tr("Xbox 串流 · %1").arg(saved.value(QStringLiteral("label")).toString());
+ } else if (kind == QLatin1String("screen")) {
+ saved[QStringLiteral("summary")] = tr("屏幕捕获 · %1").arg(saved.value(QStringLiteral("label")).toString());
+ } else if (hasCaptureSession()) {
+ // Before this was recorded, only capture sessions were remembered.
+ return QVariantMap{{"kind", "capture"}, {"summary", captureSessionSummary()}};
+ } else return {};
+ return saved;
+}
+void QmlPlayerBridge::rememberSource(const QString& kind, const QString& label) {
+ if(kind!=QLatin1String("file")){impl_->liveKind = kind;impl_->liveLabel = label;}
+ QVariantMap value{{"kind", kind}, {"label", label}};
+ if (kind == QLatin1String("screen")) value[QStringLiteral("screenKind")] = screenOptions().value(QStringLiteral("kind")).toInt();
+ if (impl_->prefs.value(QStringLiteral("lastSource")).toMap() == value) return;
+ impl_->prefs[QStringLiteral("lastSource")] = value;
+ if (!impl_->savePrefs()) veyra::log::warn("ui-prefs", "last source not saved");
+ emit preferencesChanged();
+}
+void QmlPlayerBridge::autoResumeLastSource() {
+ if(!impl_->prefBool("autoResume",false)||impl_->openingSource||impl_->snapshot.running)return;
+ if(lastSource().isEmpty())return;
+ veyra::log::info("ui-startup","automatically resuming the last source");
+ resumeLastSource();
+}
+void QmlPlayerBridge::resumeLastSource() {
+ const auto last = lastSource();
+ const QString kind = last.value(QStringLiteral("kind")).toString();
+ veyra::log::info("ui-resume-source", "kind=" + kind.toStdString());
+ if(kind==QLatin1String("file")){
+ const QString path=last.value(QStringLiteral("label")).toString();
+ if(!QFileInfo(path).isFile()){emit notice(tr("上次的视频文件不存在:%1").arg(path),true);return;}
+ openPath(path);return;
+ }
+ if (kind == QLatin1String("capture")) { resumeCaptureSession(); return; }
+ if (kind == QLatin1String("ps5")) {
+#ifdef VEYRA_ENABLE_REMOTEPLAY
+ ps5Load();
+ if (!ps5Connect()) emit notice(tr("没能继续上次的 PS5 串流:%1").arg(impl_->ps5Status), true);
+#else
+ emit notice(tr("此版本不含 PS5 串流"), true);
+#endif
+ return;
+ }
+ if (kind == QLatin1String("xbox")) {
+#ifdef VEYRA_ENABLE_XBOX
+ if (!impl_->xbox || !impl_->xbox->resumeLast()) {
+ emit notice(tr("没能继续上次的 Xbox 串流,请在 Xbox 串流窗口里重新选择"), true);
+ emit navigate(QStringLiteral("xbox"));
+ }
+#else
+ emit notice(tr("此版本不含 Xbox 串流"), true);
+#endif
+ return;
+ }
+ if (kind == QLatin1String("moonlight")) {
+#ifdef VEYRA_ENABLE_MOONLIGHT
+ if (!impl_->moonlight || !impl_->moonlight->resumeLast()) {
+ emit notice(tr("没能继续上次的 PC 串流,请在 PC 串流窗口里重新选择"), true);
+ emit navigate(QStringLiteral("moonlight"));
+ }
+#else
+ emit notice(tr("此版本不含 PC 串流"), true);
+#endif
+ return;
+ }
+ if (kind == QLatin1String("screen")) {
+ const int screenKind = last.value(QStringLiteral("screenKind")).toInt();
+ if (screenOptions().value(QStringLiteral("kind")).toInt() != screenKind) setScreenOption(QStringLiteral("kind"), screenKind);
+ refreshCaptureTargets();
+ const QString label = last.value(QStringLiteral("label")).toString();
+ for (const auto& item : screenTargets()) {
+ const auto map = item.toMap();
+ if (map.value(QStringLiteral("label")).toString() == label) {
+ setScreenTargetId(map.value(QStringLiteral("id")).toString());
+ startScreenCapture();
+ return;
+ }
+ }
+ emit notice(tr("上次的捕获目标「%1」已不在,请重新选择").arg(label), true);
+ emit navigate(QStringLiteral("screen"));
+ return;
+ }
+ emit notice(tr("还没有可以继续的片源"), true);
+}
+
+bool QmlPlayerBridge::resetNrLayer(int index) {
+ auto& c = impl_->chain;
+ if (c.mode != engine::ChainMode::List || index < 0 || index >= int(c.nodeCount) ||
+ c.nodes[size_t(index)].type != engine::EffectType::NrEnhance) return false;
+ auto& node = c.nodes[size_t(index)];
+ const auto before = node;
+ const engine::NrLayerSettings defaults;
+ // The model and residual parameters, the size and the temporal option go
+ // back to their defaults; the shared runtime and the on/off state stay.
+ node.nr.model = defaults.model; node.nr.residual = defaults.residual;
+ node.nr.temporal = defaults.temporal; node.nr.sizePolicy = defaults.sizePolicy;
+ if (node == before) return true;
+ if (!impl_->revalidate(true)) {
+ const auto error = impl_->validation.message; node = before; impl_->revalidate();
+ emit notice(uiText(error), true); return false;
+ }
+ emit settingsChanged(); emitChainChanged();
+ return true;
+}
+
+QVariantList QmlPlayerBridge::frameTimes() const {
+ QVariantList out;
+ for (const double v : impl_->frameTimes) out << v;
+ return out;
+}
+
+
+} // namespace veyra::ui