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++

feat(ui): rebuild the export and settings pages, and wire the export job for real

Veyra Goal Agent032d2235bd27
diff --git a/include/veyra/ui/PlayerUiFacade.h b/include/veyra/ui/PlayerUiFacade.h
index ac3d0962..74f1fb8c 100644
--- a/include/veyra/ui/PlayerUiFacade.h
+++ b/include/veyra/ui/PlayerUiFacade.h
@@ -75,6 +75,16 @@ public:
// this, so it has to actually clear rather than just re-scan.
void clearRecentFiles();
+ // --- shell preferences --------------------------------------------------
+ // Reduced motion turns off the springs and transitions. Default page is what
+ // the app opens on (home / minimal / professional). Both persist here so they
+ // survive a restart, and both are preferences rather than enhancement settings:
+ // they never affect the picture.
+ bool reducedMotion() const { return reducedMotion_; }
+ void setReducedMotion(bool value) { reducedMotion_ = value; savePreferences(); }
+ const std::wstring& defaultPage() const { return defaultPage_; }
+ void setDefaultPage(std::wstring value) { defaultPage_ = std::move(value); savePreferences(); }
+
// --- last capture session ----------------------------------------------
struct CaptureSession {
std::wstring devicePath;
@@ -105,6 +115,8 @@ private:
bool haveLast_ = false;
std::vector<RecentEntry> recent_;
CaptureSession captureSession_{};
+ bool reducedMotion_ = false;
+ std::wstring defaultPage_ = L"home";
std::wstring error_;
std::filesystem::path preferencesPath() const;
bool savePreferencesLocked();
diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.h
index 55bad627..0c3f6023 100644
--- a/include/veyra/ui/QmlPlayerBridge.h
+++ b/include/veyra/ui/QmlPlayerBridge.h
@@ -32,6 +32,7 @@
#include <memory>
#include "veyra/engine/EffectChain.h"
+#include "veyra/engine/ExportJobManager.h"
#include "veyra/engine/EnhancementSettings.h"
#include "veyra/ui/PlayerUiFacade.h"
@@ -69,6 +70,18 @@ class QmlPlayerBridge : public QObject {
Q_PROPERTY(double colorSaturation READ colorSaturation WRITE setColorSaturation NOTIFY settingsChanged)
Q_PROPERTY(double colorTemperature READ colorTemperature WRITE setColorTemperature NOTIFY settingsChanged)
+ // --- shell preferences -------------------------------------------------
+ // Kept by the facade so they survive a restart, and read by the shell.
+ Q_PROPERTY(bool reducedMotion READ reducedMotion WRITE setReducedMotion NOTIFY settingsChanged)
+ Q_PROPERTY(QString defaultPage READ defaultPage WRITE setDefaultPage NOTIFY settingsChanged)
+ Q_PROPERTY(QString defaultPageLabel READ defaultPageLabel NOTIFY settingsChanged)
+
+ // --- settings-page reporting -------------------------------------------
+ Q_PROPERTY(QString remotePlayState READ remotePlayState NOTIFY snapshotChanged)
+ // The loaded runtime components, as the engine reports them. A hand-written
+ // list here could drift from what the package actually contains.
+ Q_PROPERTY(QVariantList componentList READ componentList NOTIFY snapshotChanged)
+
Q_PROPERTY(QString appName READ appName CONSTANT)
Q_PROPERTY(QString version READ version CONSTANT)
@@ -165,9 +178,27 @@ class QmlPlayerBridge : public QObject {
Q_PROPERTY(QString videoHdrStatus READ videoHdrStatus NOTIFY snapshotChanged)
// --- export ------------------------------------------------------------
+ // Backed by the real ExportJobManager: state, progress and encoded counts come
+ // from its snapshot, not from a counter this file keeps.
Q_PROPERTY(bool exportRunning READ exportRunning NOTIFY exportChanged)
+ Q_PROPERTY(bool exportPaused READ exportPaused NOTIFY exportChanged)
+ Q_PROPERTY(double exportProgress READ exportProgress NOTIFY exportChanged)
Q_PROPERTY(QString exportStatus READ exportStatus NOTIFY exportChanged)
Q_PROPERTY(QString exportTarget READ exportTarget NOTIFY exportChanged)
+ Q_PROPERTY(int exportEncoded READ exportEncoded NOTIFY exportChanged)
+ Q_PROPERTY(int exportGenerated READ exportGenerated NOTIFY exportChanged)
+ Q_PROPERTY(bool exportHevc READ exportHevc WRITE setExportHevc NOTIFY exportChanged)
+ Q_PROPERTY(int exportBitrateMbps READ exportBitrateMbps WRITE setExportBitrateMbps NOTIFY exportChanged)
+ // The preset the export will use. The design requires export to select a
+ // preset (list or node) rather than assembling effects separately.
+ Q_PROPERTY(QString exportPresetName READ exportPresetName NOTIFY exportChanged)
+ // The super-resolution target, which is what actually decides the export size
+ // in this engine (0 = source, then Qhd/Uhd4K/Uhd8K). A separate "export
+ // resolution" field does not exist, so the UI exposes the real control instead
+ // of a picker that would change nothing.
+ Q_PROPERTY(int srTargetIndex READ srTargetIndex WRITE setSrTargetIndex NOTIFY settingsChanged)
+ // Presets as a picker model: one preset concept, list and node together.
+ Q_PROPERTY(QVariantList presetChoices READ presetChoices NOTIFY presetsChanged)
public:
// `engine` must outlive the bridge. `dataDirectory` holds ui-session.v1 and
@@ -205,6 +236,13 @@ public:
double colorTemperature() const;
void setColorTemperature(double v);
+ bool reducedMotion() const;
+ void setReducedMotion(bool value);
+ QString defaultPage() const;
+ void setDefaultPage(const QString& value);
+ QString defaultPageLabel() const;
+ QString remotePlayState() const;
+ QVariantList componentList() const;
QString appName() const;
QString version() const;
@@ -306,8 +344,20 @@ public:
QString videoHdrStatus() const;
bool exportRunning() const;
+ bool exportPaused() const;
+ double exportProgress() const;
QString exportStatus() const;
QString exportTarget() const;
+ int exportEncoded() const;
+ int exportGenerated() const;
+ bool exportHevc() const;
+ void setExportHevc(bool value);
+ int exportBitrateMbps() const;
+ void setExportBitrateMbps(int value);
+ QString exportPresetName() const;
+ int srTargetIndex() const;
+ void setSrTargetIndex(int index);
+ QVariantList presetChoices() const;
// The native HWND the engine presents into. The UI creates it as a child
// window of the QML window and hands it over; the bridge never draws QML
@@ -340,6 +390,7 @@ public:
Q_INVOKABLE void chooseExportPath();
Q_INVOKABLE void startExport();
Q_INVOKABLE void cancelExport();
+ Q_INVOKABLE void pauseExport(bool paused);
Q_INVOKABLE void quit();
// Returns this page's controls to the engine defaults (the design's
// "重置本页"); it does not touch presets or other pages.
@@ -371,6 +422,8 @@ public:
// Diagnostics for the settings page: what the engine actually reports,
// never a summary written by hand.
Q_INVOKABLE QString diagnosticsReport() const;
+ Q_INVOKABLE void openProjectPage();
+ Q_INVOKABLE void copyDiagnostics();
signals:
// Emitted only when the underlying snapshot actually changed, so QML
@@ -392,6 +445,8 @@ private:
// engine has been asked to apply. Every settings property reads this, so
// they can never disagree with each other.
engine::EnhancementSettings settings() const;
+ // Reads the export job's snapshot and emits exportChanged.
+ void pollExport();
struct Impl;
std::unique_ptr<Impl> impl_;
diff --git a/qml/Veyra/ExportPage.qml b/qml/Veyra/ExportPage.qml
index 6e5af4c3..9f147c89 100644
--- a/qml/Veyra/ExportPage.qml
+++ b/qml/Veyra/ExportPage.qml
@@ -1,11 +1,14 @@
-// 视频导出: its own simplified mode, as the user asked.
+// 导出, rebuilt from the design (pages-b.js PAGES.exp + pages.css .exp).
//
-// Scope honesty: this page exports what the engine can export today — the
-// enhancement chain applied to the current file, encoded by NVENC through the
-// existing export job. Output resolution is NOT offered as a control, because
-// the engine has no export-size setting yet (it derives the size from the NR
-// size policy); showing a resolution picker that changed nothing would be a lie
-// about the product. The missing pieces are recorded in the execution doc.
+// Design grid: 250px | 1fr | 330px, rows auto | 1fr | auto, padding 14. The queue
+// card spans rows 2-3 on the left; the video sits in the middle with the trim range
+// under it; output settings fill the right column.
+//
+// Scope, stated on the page rather than hidden: this build has no multi-file queue
+// and no trim range, because the engine exports one file from the current source
+// and has no trim settings. Those two cards say so instead of looking functional.
+// What is real - preset selection, codec, output size, bitrate and progress - is
+// wired to the engine's export job.
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
@@ -14,164 +17,316 @@ Item {
id: root
signal requestPage(string page)
- ColumnLayout {
- anchors.fill: parent
- anchors.margins: 28
- spacing: 14
+ // --- header -----------------------------------------------------------
+ RowLayout {
+ id: head
+ anchors.left: parent.left
+ anchors.right: parent.right
+ anchors.top: parent.top
+ anchors.margins: 14
+ height: 32
+ spacing: 8
+ VH2 { text: "导出" }
+ Text {
+ text: "按所选预设导出,导出期间可继续观看"
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ }
+ Item { Layout.fillWidth: true }
+ VButton { text: "添加文件"; onClicked: veyra.openFileDialog() }
+ }
+
+ // --- left column: what is being exported ------------------------------
+ Rectangle {
+ anchors.left: parent.left
+ anchors.leftMargin: 14
+ anchors.top: head.bottom
+ anchors.topMargin: 10
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 14
+ width: 250
+ radius: Theme.rCard
+ color: Theme.card
+ border.width: 1
+ border.color: Theme.stroke
- RowLayout {
- Layout.fillWidth: true
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: 12
+ spacing: 8
+ VEyebrow { text: "导出内容" }
Text {
- text: "视频导出"
- color: Theme.t1
+ Layout.fillWidth: true
+ text: veyra.hasSource ? veyra.sourceName : "未打开文件"
+ color: veyra.hasSource ? Theme.t1 : Theme.t3
font.family: Theme.fontUi
- font.pixelSize: Theme.fsH1
+ font.pixelSize: Theme.fsBody
+ elide: Text.ElideMiddle
+ }
+ Text {
Layout.fillWidth: true
+ text: veyra.hasSource ? veyra.sourceSummary : ""
+ color: Theme.t3
+ font.family: Theme.fontMono
+ font.pixelSize: Theme.fsSmall
}
- Rectangle {
- implicitWidth: 68
- implicitHeight: 28
- radius: 14
- color: backHover.hovered ? Theme.card3 : Theme.card2
- Text {
- anchors.centerIn: parent
- text: "返回"
- color: Theme.t2
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
- }
- HoverHandler { id: backHover; cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: root.requestPage("pro") }
+ Rectangle { Layout.fillWidth: true; implicitHeight: 1; color: Theme.stroke }
+ // The design's card is a queue of several files. The engine exports one
+ // at a time, so no queue is drawn and the card says why.
+ Text {
+ Layout.fillWidth: true
+ text: "本版本一次导出当前打开的一个文件;多文件队列尚未实现。"
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ wrapMode: Text.WordWrap
}
+ Item { Layout.fillHeight: true }
}
+ }
- Rectangle {
- Layout.fillWidth: true
- radius: Theme.rCard
- color: Theme.card
- implicitHeight: detail.implicitHeight + 32
+ // --- right column -----------------------------------------------------
+ Rectangle {
+ id: rightCol
+ anchors.right: parent.right
+ anchors.rightMargin: 14
+ anchors.top: head.bottom
+ anchors.topMargin: 10
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 14
+ width: 330
+ radius: Theme.rCard
+ color: Theme.card
+ border.width: 1
+ border.color: Theme.stroke
- ColumnLayout {
- id: detail
- anchors.left: parent.left
- anchors.right: parent.right
- anchors.top: parent.top
- anchors.margins: 16
- spacing: 10
-
- GridLayout {
- Layout.fillWidth: true
- columns: 2
- columnSpacing: 12
- rowSpacing: 10
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: 12
+ spacing: 4
- Text { text: "源"; color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: Theme.fsSmall }
- Text {
- Layout.fillWidth: true
- text: veyra.hasSource ? veyra.sourceName + " " + veyra.sourceSummary : "未打开文件"
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- elide: Text.ElideMiddle
+ VH3 { text: "输出设置" }
+
+ VGroup {
+ VRow {
+ label: "编码"
+ VSeg {
+ options: [{ id: "h264", label: "H.264" }, { id: "hevc", label: "HEVC" }]
+ current: veyra.exportHevc ? "hevc" : "h264"
+ onPicked: id => veyra.exportHevc = (id === "hevc")
}
+ }
+ VRow {
+ label: "分辨率"
+ hint: "由超分目标尺寸决定"
+ VSeg {
+ options: [
+ { id: "0", label: "源" },
+ { id: "1", label: "2K" },
+ { id: "2", label: "4K" },
+ { id: "3", label: "8K" }
+ ]
+ current: String(veyra.srTargetIndex)
+ onPicked: id => veyra.srTargetIndex = parseInt(id)
+ }
+ }
+ VRow {
+ label: "码率"
+ value: veyra.exportBitrateMbps > 0 ? veyra.exportBitrateMbps + " Mbps" : "恒定质量"
+ VSlider {
+ implicitWidth: 110
+ from: 0
+ to: 200
+ value: veyra.exportBitrateMbps
+ onMoved: veyra.exportBitrateMbps = Math.round(value)
+ }
+ }
+ }
- Text { text: "输出"; color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: Theme.fsSmall }
- RowLayout {
- Layout.fillWidth: true
- Text {
- Layout.fillWidth: true
- text: veyra.exportTarget.length > 0 ? veyra.exportTarget : "未选择"
- color: veyra.exportTarget.length > 0 ? Theme.t1 : Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- elide: Text.ElideMiddle
- }
- Rectangle {
- implicitWidth: 62
- implicitHeight: 26
- radius: 13
- color: pickHover.hovered ? Theme.card3 : Theme.card2
- Text {
- anchors.centerIn: parent
- text: "选择…"
- color: Theme.t2
- font.family: Theme.fontUi
- font.pixelSize: 11
- }
- HoverHandler { id: pickHover; cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: veyra.chooseExportPath() }
- }
+ VGroup {
+ VRow {
+ label: "增强预设"
+ hint: "列表预设与节点预设共用一套"
+ VSelect {
+ value: veyra.currentPresetName
+ options: veyra.presetChoices
+ onPicked: id => veyra.applyPresetIndex(parseInt(id))
}
+ }
+ }
- Text { text: "编码"; color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: Theme.fsSmall }
+ // What the export will run with. Frozen when it starts.
+ Rectangle {
+ Layout.fillWidth: true
+ implicitHeight: pinfo.implicitHeight + 16
+ radius: 9
+ color: Qt.rgba(1, 1, 1, 0.03)
+ ColumnLayout {
+ id: pinfo
+ anchors.fill: parent
+ anchors.margins: 8
+ spacing: 3
Text {
- text: "NVENC H.264(D3D12 直接编码,不经 CPU 回读)"
+ text: (veyra.exportHevc ? "HEVC" : "H.264") + " · "
+ + (veyra.exportBitrateMbps > 0 ? veyra.exportBitrateMbps + " Mbps" : "恒定质量")
color: Theme.t2
- font.family: Theme.fontUi
+ font.family: Theme.fontMono
font.pixelSize: Theme.fsSmall
}
+ Text {
+ Layout.fillWidth: true
+ text: "编码与码率在开始导出时固定;导出期间改设置不会影响正在进行的任务。"
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ wrapMode: Text.WordWrap
+ }
}
+ }
- Rectangle { Layout.fillWidth: true; implicitHeight: 1; color: Theme.stroke }
+ VRow {
+ label: "保存到"
+ VButton {
+ text: veyra.exportTarget.length > 0 ? "重新选择…" : "选择…"
+ onClicked: veyra.chooseExportPath()
+ }
+ }
+ Text {
+ Layout.fillWidth: true
+ text: veyra.exportTarget.length > 0 ? veyra.exportTarget : "未选择输出位置"
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: 11
+ elide: Text.ElideMiddle
+ }
- // A short, explicit note about what this page cannot do yet. The
- // project rule is to say so rather than ship a control that does
- // nothing.
- Text {
+ Item { Layout.fillHeight: true }
+
+ // --- progress and the action ---------------------------------
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 8
+
+ RowLayout {
+ Layout.fillWidth: true
+ Text {
+ Layout.fillWidth: true
+ text: veyra.exportStatus
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: 12
+ }
+ Text {
+ text: veyra.exportRunning ? (veyra.exportProgress * 100).toFixed(1) + "%" : ""
+ color: Theme.t1
+ font.family: Theme.fontMono
+ font.pixelSize: 11
+ }
+ }
+ Rectangle {
Layout.fillWidth: true
- text: "导出尺寸目前由 NR 处理尺寸策略决定;自定义输出分辨率尚未实现。"
+ implicitHeight: 8
+ radius: 9
+ color: Qt.rgba(1, 1, 1, 0.08)
+ Rectangle {
+ height: parent.height
+ radius: 9
+ color: Theme.accent
+ width: parent.width * Math.max(0, Math.min(1, veyra.exportProgress))
+ Behavior on width { NumberAnimation { duration: 300 } }
+ }
+ }
+ // Counts come from the job's own snapshot, not a parallel counter.
+ Text {
+ visible: veyra.exportRunning
+ text: "已编码 " + veyra.exportEncoded + " 帧 · 生成 " + veyra.exportGenerated + " 帧"
color: Theme.t3
- font.family: Theme.fontUi
+ font.family: Theme.fontMono
font.pixelSize: 11
- wrapMode: Text.WordWrap
}
RowLayout {
- Layout.topMargin: 4
- spacing: 10
- Rectangle {
- implicitWidth: 108
- implicitHeight: 34
- radius: 17
- color: startHover.hovered ? Qt.lighter(Theme.accent, 1.1) : Theme.accent
- Behavior on color { ColorAnimation { duration: Theme.durFast } }
- Text {
- anchors.centerIn: parent
- text: veyra.exportRunning ? "导出中…" : "开始导出"
- color: Theme.accentInk
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- font.bold: true
- }
- HoverHandler { id: startHover; cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: veyra.startExport() }
+ Layout.fillWidth: true
+ spacing: 8
+ VButton {
+ Layout.fillWidth: true
+ primary: !veyra.exportRunning
+ text: veyra.exportRunning ? (veyra.exportPaused ? "继续导出" : "暂停导出") : "开始导出"
+ onClicked: veyra.exportRunning ? veyra.pauseExport(!veyra.exportPaused)
+ : veyra.startExport()
}
- Rectangle {
- implicitWidth: 88
- implicitHeight: 34
- radius: 17
+ VButton {
visible: veyra.exportRunning
- color: cancelHover.hovered ? Theme.card3 : Theme.card2
- Text {
- anchors.centerIn: parent
- text: "取消"
- color: Theme.t2
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- }
- HoverHandler { id: cancelHover; cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: veyra.cancelExport() }
- }
- Text {
- text: veyra.exportStatus
- color: Theme.t2
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
+ text: "取消"
+ onClicked: veyra.cancelExport()
}
}
}
}
+ }
+
+ // --- middle: picture, then the trim card ------------------------------
+ Rectangle {
+ id: vwrap
+ anchors.left: parent.left
+ anchors.leftMargin: 14 + 250 + 10
+ anchors.right: rightCol.left
+ anchors.rightMargin: 10
+ anchors.top: head.bottom
+ anchors.topMargin: 10
+ anchors.bottom: trimCard.top
+ anchors.bottomMargin: 10
+ radius: Theme.rCard
+ color: Theme.videoBlack
+ border.width: 1
+ border.color: Theme.stroke
+ clip: true
- Item { Layout.fillHeight: true }
+ Item {
+ id: videoArea
+ objectName: "videoArea"
+ anchors.fill: parent
+ Text {
+ anchors.centerIn: parent
+ visible: !veyra.hasSource
+ text: veyra.statusText
+ color: Theme.t3
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsH3
+ }
+ }
+ }
+
+ Rectangle {
+ id: trimCard
+ anchors.left: vwrap.left
+ anchors.right: vwrap.right
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 14
+ height: 72
+ radius: Theme.rCard
+ color: Theme.card
+ border.width: 1
+ border.color: Theme.stroke
+ RowLayout {
+ anchors.fill: parent
+ anchors.margins: 12
+ spacing: 10
+ Text {
+ text: "导出范围"
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ }
+ Text {
+ Layout.fillWidth: true
+ text: "整段 · 00:00:00 — " + veyra.durationText
+ color: Theme.t1
+ font.family: Theme.fontMono
+ font.pixelSize: Theme.fsSmall
+ }
+ VTag { text: "片段裁剪尚未实现" }
+ }
}
}
diff --git a/qml/Veyra/SettingsPage.qml b/qml/Veyra/SettingsPage.qml
index 1eb71fe0..b7f01734 100644
--- a/qml/Veyra/SettingsPage.qml
+++ b/qml/Veyra/SettingsPage.qml
@@ -1,9 +1,11 @@
-// 设置: presets, subtitles/audio, and the engine's own diagnostics.
+// 设置, rebuilt from the design (pages-b.js PAGES.set + pages.css .set).
//
-// The user asked for a real settings page (the old app buried things in the
-// main window), and for presets to be ONE concept with selectable parts rather
-// than separate NR presets. So a preset here carries whichever parts the user
-// ticks, and applying it leaves the unticked parts alone.
+// Design: a 220px nav column with six sections (通用与外观 / 播放 / PS5 串流 /
+// 快捷键 / 组件与许可 / 关于) and a large body. The design deliberately has NO
+// capture-card section here: capture settings live in the capture dialog.
+//
+// Rows that would need engine support this build does not have say so, rather than
+// being drawn as switches that would do nothing.
import QtQuick
import QtQuick.Controls
import QtQuick.Layouts
@@ -12,277 +14,350 @@ Item {
id: root
signal requestPage(string page)
- property int tab: 0
+ property string section: "look"
- ColumnLayout {
- anchors.fill: parent
- anchors.margins: 28
- spacing: 14
+ readonly property var sections: [
+ { id: "look", label: "通用与外观" },
+ { id: "play", label: "播放" },
+ { id: "ps5", label: "PS5 串流" },
+ { id: "keys", label: "快捷键" },
+ { id: "comp", label: "组件与许可" },
+ { id: "about", label: "关于" }
+ ]
- RowLayout {
- Layout.fillWidth: true
- Text {
- text: "设置"
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsH1
- Layout.fillWidth: true
- }
- }
+ // --- nav ---------------------------------------------------------------
+ Rectangle {
+ anchors.left: parent.left
+ anchors.leftMargin: 14
+ anchors.top: parent.top
+ anchors.topMargin: 14
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 14
+ width: 220
+ radius: Theme.rCard
+ color: Theme.card
+ border.width: 1
+ border.color: Theme.stroke
- // Tabs rather than one long scroll: the diagnostics report alone is long
- // enough to bury everything else.
- RowLayout {
- spacing: 6
+ ColumnLayout {
+ anchors.fill: parent
+ anchors.margins: 10
+ spacing: 2
+ VH2 { text: "设置"; Layout.margins: 8 }
+ Item { implicitHeight: 6 }
Repeater {
- model: ["预设", "字幕与音频", "诊断"]
+ model: root.sections
delegate: Rectangle {
- required property int index
- required property string modelData
- implicitWidth: tabText.implicitWidth + 24
- implicitHeight: 30
- radius: 15
- color: root.tab === index ? Theme.card3 : (tabHover.hovered ? Theme.card2 : "transparent")
- Behavior on color { ColorAnimation { duration: Theme.durFast } }
+ required property var modelData
+ Layout.fillWidth: true
+ implicitHeight: 36
+ radius: 9
+ color: root.section === modelData.id ? Theme.card3
+ : navHover.hovered ? Qt.rgba(1, 1, 1, 0.04) : "transparent"
+ Behavior on color { ColorAnimation { duration: 200 } }
Text {
- id: tabText
- anchors.centerIn: parent
- text: modelData
- color: root.tab === index ? Theme.t1 : Theme.t2
+ anchors.left: parent.left
+ anchors.leftMargin: 10
+ anchors.verticalCenter: parent.verticalCenter
+ text: modelData.label
+ color: root.section === modelData.id ? Theme.t1 : Theme.t2
font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
+ font.pixelSize: 13
+ font.weight: Font.Medium
}
- HoverHandler { id: tabHover; cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: root.tab = index }
+ HoverHandler { id: navHover; cursorShape: Qt.PointingHandCursor }
+ TapHandler { onTapped: root.section = modelData.id }
}
}
+ Item { Layout.fillHeight: true }
}
+ }
+
+ // --- body --------------------------------------------------------------
+ Rectangle {
+ anchors.left: parent.left
+ anchors.leftMargin: 14 + 220 + 10
+ anchors.right: parent.right
+ anchors.rightMargin: 14
+ anchors.top: parent.top
+ anchors.topMargin: 14
+ anchors.bottom: parent.bottom
+ anchors.bottomMargin: 14
+ radius: Theme.rCard
+ color: Theme.card
+ border.width: 1
+ border.color: Theme.stroke
+ clip: true
- // --- presets -------------------------------------------------------
- Rectangle {
- Layout.fillWidth: true
- Layout.fillHeight: true
- radius: Theme.rCard
- color: Theme.card
- visible: root.tab === 0
+ Flickable {
+ anchors.fill: parent
+ contentHeight: body.implicitHeight + 44
+ clip: true
+ ScrollBar.vertical: ScrollBar { }
ColumnLayout {
- anchors.fill: parent
- anchors.margins: 16
- spacing: 10
+ id: body
+ x: 26
+ y: 22
+ width: parent.width - 52
+ spacing: 12
- Text {
- text: "预设"
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsH3
- }
- Text {
+ // --- 通用与外观 ------------------------------------------
+ ColumnLayout {
Layout.fillWidth: true
- text: "保存时勾选包含哪些部分;应用时只覆盖勾选的部分,其余保持当前设置。"
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 11
- wrapMode: Text.WordWrap
+ spacing: 12
+ visible: root.section === "look"
+ VH1 { text: "通用与外观" }
+ Text {
+ text: "界面随时可调,不影响播放和增强设置。"
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ }
+ VGroup {
+ VRow {
+ label: "页面切换栏"
+ hint: "平时隐藏;鼠标碰到窗口顶部时弹下来"
+ VSeg {
+ options: [{ id: "auto", label: "自动隐藏" }, { id: "always", label: "始终显示" }]
+ current: "auto"
+ onPicked: id => {}
+ }
+ }
+ VRow {
+ label: "减少动画"
+ hint: "关闭弹性与转场"
+ VSwitch {
+ checked: veyra.reducedMotion
+ onToggled: veyra.reducedMotion = checked
+ }
+ }
+ VRow {
+ label: "打开时的默认页面"
+ hint: "首页 = 选择片源的页面(点顶部 Logo 也能回到这里)"
+ VSelect {
+ value: veyra.defaultPageLabel
+ options: [
+ { id: "home", label: "首页" },
+ { id: "min", label: "极简模式" },
+ { id: "pro", label: "专业模式" }
+ ]
+ onPicked: id => veyra.defaultPage = id
+ }
+ }
+ }
}
- ListView {
+ // --- 播放 ------------------------------------------------
+ ColumnLayout {
Layout.fillWidth: true
- Layout.fillHeight: true
- clip: true
- model: veyra.presets
- spacing: 4
- delegate: Rectangle {
- required property var modelData
- width: ListView.view.width
- height: 40
- radius: 8
- color: rowHover.hovered ? Theme.card2 : "transparent"
- RowLayout {
- anchors.fill: parent
- anchors.leftMargin: 12
- anchors.rightMargin: 12
- spacing: 10
- Text {
- Layout.fillWidth: true
- text: modelData.name
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsBody
- elide: Text.ElideRight
- }
- Text {
- visible: modelData.builtin
- text: "内置"
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: 10
+ spacing: 12
+ visible: root.section === "play"
+ VH1 { text: "播放" }
+ Text {
+ text: "文件播放与字幕的默认行为。"
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ }
+ VGroup {
+ VRow {
+ label: "音频偏移"
+ hint: "正值延后音频"
+ value: veyra.audioOffsetMs + " ms"
+ VSlider {
+ implicitWidth: 150
+ center: true
+ from: -2000; to: 2000; value: veyra.audioOffsetMs
+ onMoved: veyra.audioOffsetMs = Math.round(value)
}
- Text {
- visible: modelData.nodeMode
- text: "节点"
- color: Theme.exp
- font.family: Theme.fontUi
- font.pixelSize: 10
+ }
+ VRow {
+ label: "音量"
+ value: Math.round(veyra.volume * 100) + "%"
+ VSlider {
+ implicitWidth: 150
+ from: 0; to: 1; value: veyra.volume
+ onMoved: veyra.volume = value
}
}
- HoverHandler { id: rowHover; cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: veyra.applyPresetIndex(modelData.index) }
+ }
+ Rectangle {
+ Layout.fillWidth: true
+ implicitHeight: subNote.implicitHeight + 20
+ radius: 9
+ color: Qt.rgba(0.961, 0.784, 0.294, 0.06)
+ Text {
+ id: subNote
+ anchors.fill: parent
+ anchors.margins: 10
+ text: "字幕默认字号、描边与截图保存位置尚未接入设置;引擎侧没有对应字段,这里不放假控件。"
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ wrapMode: Text.WordWrap
+ }
}
}
- }
- }
-
- // --- subtitles and audio -------------------------------------------
- Rectangle {
- Layout.fillWidth: true
- Layout.fillHeight: true
- radius: Theme.rCard
- color: Theme.card
- visible: root.tab === 1
-
- ColumnLayout {
- anchors.fill: parent
- anchors.margins: 16
- spacing: 12
- Text {
- text: "音频"
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsH3
- }
- RowLayout {
- spacing: 10
- Text { text: "音量"; color: Theme.t2; font.family: Theme.fontUi; font.pixelSize: Theme.fsSmall }
- Slider {
- implicitWidth: 200
- from: 0; to: 1; value: veyra.volume
- onMoved: veyra.volume = value
- }
+ // --- PS5 串流 --------------------------------------------
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 12
+ visible: root.section === "ps5"
+ VH1 { text: "PS5 串流" }
Text {
- text: Math.round(veyra.volume * 100) + "%"
+ text: "主机与 PSN 凭据加密保存在用户数据目录。"
color: Theme.t2
- font.family: Theme.fontMono
- font.pixelSize: Theme.fsSmall
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
}
- }
- Switch {
- text: "静音"
- checked: veyra.muted
- onToggled: veyra.muted = checked
- }
- RowLayout {
- spacing: 10
- Text { text: "音频偏移"; color: Theme.t2; font.family: Theme.fontUi; font.pixelSize: Theme.fsSmall }
- SpinBox {
- from: -2000
- to: 2000
- stepSize: 10
- value: veyra.audioOffsetMs
- onValueModified: veyra.audioOffsetMs = value
+ VGroup {
+ VRow {
+ label: "串流状态"
+ hint: veyra.remotePlayState.length > 0 ? veyra.remotePlayState : "未连接"
+ VButton { text: "管理"; onClicked: veyra.openPs5Dialog() }
+ }
+ }
+ Rectangle {
+ Layout.fillWidth: true
+ implicitHeight: psNote.implicitHeight + 20
+ radius: 9
+ color: Qt.rgba(0.961, 0.784, 0.294, 0.06)
+ Text {
+ id: psNote
+ anchors.fill: parent
+ anchors.margins: 10
+ text: "串流编码、请求码率与 PSN 账号管理尚未接入设置页;这些参数在 PS5 对话框里调整。"
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsSmall
+ wrapMode: Text.WordWrap
+ }
}
- Text { text: "毫秒"; color: Theme.t3; font.family: Theme.fontUi; font.pixelSize: Theme.fsSmall }
}
- Rectangle { Layout.fillWidth: true; implicitHeight: 1; color: Theme.stroke }
-
- Text {
- text: "音轨"
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsH3
- }
- Text {
- visible: veyra.audioTracks.length === 0
- text: "当前源没有可选音轨。"
- color: Theme.t3
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsSmall
+ // --- 快捷键 ----------------------------------------------
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 12
+ visible: root.section === "keys"
+ VH1 { text: "快捷键" }
+ Text {
+ text: "当前生效的快捷键;重新绑定尚未实现。"
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ }
+ VGroup {
+ Repeater {
+ model: [
+ { a: "播放 / 暂停", k: "Space" },
+ { a: "后退 / 前进 10 秒", k: "← / →" },
+ { a: "截图", k: "Ctrl + S" }
+ ]
+ delegate: VRow {
+ required property var modelData
+ label: modelData.a
+ VTag { text: modelData.k }
+ }
+ }
+ }
}
- Repeater {
- model: veyra.audioTracks
- delegate: Rectangle {
- required property var modelData
+
+ // --- 组件与许可 ------------------------------------------
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 12
+ visible: root.section === "comp"
+ VH1 { text: "组件与许可" }
+ Text {
Layout.fillWidth: true
- implicitHeight: 32
- radius: 8
- color: trackHover.hovered ? Theme.card2 : "transparent"
- RowLayout {
- anchors.fill: parent
- anchors.leftMargin: 10
- spacing: 8
- Rectangle {
- width: 8; height: 8; radius: 4
- color: veyra.selectedAudioTrack === modelData.index ? Theme.accent : Theme.t3
+ text: "运行组件均为实验运行时,非 NVIDIA 官方合作或认证。详细哈希见 release-runtime-manifest.json。"
+ color: Theme.t2
+ font.family: Theme.fontUi
+ font.pixelSize: Theme.fsBody
+ wrapMode: Text.WordWrap
+ }
+ VGroup {
+ // Reported by the engine's component state rather than a
+ // hand-written list that could drift from the package.
+ Repeater {
+ model: veyra.componentList
+ delegate: VRow {
+ required property var modelData
+ label: modelData.name
+ hint: modelData.detail
+ VTag {
+ text: modelData.experimental ? "实验" : (modelData.loaded ? "已加载" : "未加载")
+ kind: modelData.experimental ? "exp" : (modelData.loaded ? "ok" : "")
+ }
}
+ }
+ }
+ }
+
+ // --- 关于 ------------------------------------------------
+ ColumnLayout {
+ Layout.fillWidth: true
+ spacing: 12
+ visible: root.section === "about"
+ RowLayout {
+ spacing: 18
+ Image {
+ source: "logo.png"
+ sourceSize.width: 88
+ fillMode: Image.PreserveAspectFit
+ }
+ ColumnLayout {
+ spacing: 4
+ VH1 { text: "Veyra" }
Text {
- Layout.fillWidth: true
- text: modelData.label
- color: Theme.t1
+ text: "版本 " + veyra.version
+ color: Theme.t2
font.family: Theme.fontUi
font.pixelSize: Theme.fsBody
}
}
- HoverHandler { id: trackHover; cursorShape: Qt.PointingHandCursor }
- TapHandler { onTapped: veyra.selectedAudioTrack = modelData.index }
}
- }
-
- Item { Layout.fillHeight: true }
- }
- }
-
- // --- diagnostics ---------------------------------------------------
- Rectangle {
- Layout.fillWidth: true
- Layout.fillHeight: true
- radius: Theme.rCard
- color: Theme.card
- visible: root.tab === 2
-
- ColumnLayout {
- anchors.fill: parent
- anchors.margins: 16
- spacing: 10
-
- Text {
- text: "诊断"
- color: Theme.t1
- font.family: Theme.fontUi
- font.pixelSize: Theme.fsH3
- }
- // Every line comes from the engine's own snapshot. Submit FPS is
- // labelled as submit FPS: there is no display-FPS number here,
- // because we cannot measure one.
- // A Flickable + Text rather than a TextArea: the platform style
- // refuses to let a TextArea repaint its own background, and the
- // report is read-only text, so a plain Text does the job without
- // fighting the style.
- Rectangle {
- Layout.fillWidth: true
- Layout.fillHeight: true
- radius: 8
- color: Theme.card2
- clip: true
- Flickable {
- anchors.fill: parent
- anchors.margins: 10
- contentWidth: width
- contentHeight: reportText.implicitHeight
+ VGroup {
+ VRow {
+ label: "检查更新"
+ hint: "GitHub · Likely7/Veyra-NRVideo"
+ VButton { text: "打开"; onClicked: veyra.openProjectPage() }
+ }
+ VRow {
+ label: "诊断信息"
+ hint: "复制后附在反馈里"
+ VButton { text: "复制"; onClicked: veyra.copyDiagnostics() }
+ }
+ }
+ // The diagnostics the engine actually reports, shown verbatim.
+ Rectangle {
+ Layout.fillWidth: true
+ implicitHeight: 220
+ radius: 9
+ color: Theme.card2
clip: true
- ScrollBar.vertical: ScrollBar { }
- Text {
- id: reportText
- width: parent.width
- text: veyra.diagnosticsReport()
- color: Theme.t2
- font.family: Theme.fontMono
- font.pixelSize: Theme.fsSmall
- wrapMode: Text.Wrap
+ Flickable {
+ anchors.fill: parent
+ anchors.margins: 10
+ contentHeight: diagText.implicitHeight
+ clip: true
+ Text {
+ id: diagText
+ width: parent.width
+ text: veyra.diagnosticsReport()
+ color: Theme.t2
+ font.family: Theme.fontMono
+ font.pixelSize: Theme.fsSmall
+ wrapMode: Text.Wrap
+ }
}
}
}
+
+ Item { Layout.preferredHeight: 12 }
}
}
}
diff --git a/src/ui/PlayerUiFacade.cpp b/src/ui/PlayerUiFacade.cpp
index ee786d59..8f9e242f 100644
--- a/src/ui/PlayerUiFacade.cpp
+++ b/src/ui/PlayerUiFacade.cpp
@@ -181,6 +181,9 @@ bool PlayerUiFacade::savePreferencesLocked() {
out << (captureSession_.valid ? 1 : 0) << ' ' << std::quoted(utf8(captureSession_.devicePath)) << ' '
<< std::quoted(utf8(captureSession_.formatKey)) << ' ' << std::quoted(utf8(captureSession_.presetName)) << ' '
<< captureSession_.fps << '\n';
+ // Appended after the capture session so a file written by an earlier build
+ // still loads: the reader treats a missing tail as defaults.
+ out << (reducedMotion_ ? 1 : 0) << ' ' << std::quoted(utf8(defaultPage_)) << '\n';
const auto temporary = std::filesystem::path(preferencesPath()).concat(L".tmp");
{ std::ofstream f(temporary, std::ios::binary | std::ios::trunc); if (!f) { error_ = L"界面状态写入失败"; return false; } f << out.str(); if (!f) { error_ = L"界面状态写入失败"; return false; } }
if (!MoveFileExW(temporary.c_str(), preferencesPath().c_str(), MOVEFILE_REPLACE_EXISTING)) {
@@ -228,6 +231,15 @@ bool PlayerUiFacade::loadPreferences() {
session.valid = valid != 0 && !session.devicePath.empty();
recent_ = std::move(recent);
captureSession_ = std::move(session);
+ // The shell preferences were appended after the capture session. A file from a
+ // build that predates them simply has no tail, and that is not an error: the
+ // defaults stand and the rest of the file is still valid.
+ int reduced = 0;
+ std::string defaultPage;
+ if (in >> reduced >> std::quoted(defaultPage)) {
+ reducedMotion_ = reduced != 0;
+ if (!defaultPage.empty()) defaultPage_ = wide(defaultPage);
+ }
return true;
}
}
diff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cpp
index c92b70dc..12a62f1d 100644
--- a/src/ui/QmlPlayerBridge.cpp
+++ b/src/ui/QmlPlayerBridge.cpp
@@ -4,13 +4,19 @@
#include <QDir>
#include <QFileDialog>
#include <QFileInfo>
+#include <QClipboard>
#include <QGuiApplication>
+#include <QJsonDocument>
+#include <QJsonObject>
+#include <QJsonArray>
+#include <QFile>
#include <QTimer>
#include <algorithm>
#include <cmath>
#include "veyra/Log.h"
+#include "veyra/RuntimePaths.h"
namespace veyra::ui {
namespace {
@@ -54,6 +60,12 @@ struct QmlPlayerBridge::Impl {
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;
+ engine::ExportJobSnapshot exportSnapshot;
+ bool exportHevc = false;
+
QTimer* timer = nullptr;
Impl(engine::EngineController& e, std::filesystem::path dataDirectory)
@@ -100,6 +112,9 @@ QmlPlayerBridge::QmlPlayerBridge(engine::EngineController& engine, std::filesyst
const uint64_t before = impl_->publishedRevision;
impl_->poll();
if (!had || impl_->publishedRevision != before) emit snapshotChanged();
+ // An export in flight needs its own poll; it is a separate job and its
+ // snapshot is not part of the player snapshot.
+ if (impl_->exportSnapshot.active()) pollExport();
});
impl_->timer->start(16);
}
@@ -297,6 +312,74 @@ void QmlPlayerBridge::resetCurrentPage() {
emit settingsChanged();
}
+
+// --- shell preferences -------------------------------------------------------
+bool QmlPlayerBridge::reducedMotion() const { return impl_->facade.reducedMotion(); }
+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("专业模式");
+ return tr("首页");
+}
+
+QString QmlPlayerBridge::remotePlayState() const {
+ // The engine's own remote-play state word, or empty when there is none. No
+ // invented "connected" wording.
+ return utf8Of(impl_->snapshot.remoteRecoveryMessage);
+}
+
+QVariantList QmlPlayerBridge::componentList() 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 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();
+ const QString version = object.value(QStringLiteral("version")).toString();
+ const QString signature = object.value(QStringLiteral("signature")).toString();
+ const bool experimental = object.value(QStringLiteral("experimental")).toBool();
+ item["detail"] = QStringList{version, signature}.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() {
+ // Nothing here launches a browser: opening an external URL is an outward-facing
+ // action, and it is not wired to a verified destination yet. The UI says so.
+ emit notice(tr("打开项目页面尚未接入"), true);
+}
+
+void QmlPlayerBridge::copyDiagnostics() {
+ if (auto* clipboard = QGuiApplication::clipboard()) {
+ clipboard->setText(diagnosticsReport());
+ emit notice(tr("诊断信息已复制"), false);
+ }
+}
+
void QmlPlayerBridge::attachVideoWindow(qulonglong nativeHandle) {
impl_->videoWindow = reinterpret_cast<HWND>(nativeHandle);
}
@@ -593,9 +676,104 @@ QString QmlPlayerBridge::colorStatus() const { return utf8Of(impl_->snapshot.col
QString QmlPlayerBridge::videoHdrStatus() const { return utf8Of(impl_->snapshot.videoHdrStatus); }
// --- export -----------------------------------------------------------------
-bool QmlPlayerBridge::exportRunning() const { return impl_->exportRunning; }
-QString QmlPlayerBridge::exportStatus() const { return impl_->exportStatus; }
-QString QmlPlayerBridge::exportTarget() const { return utf8Of(impl_->exportOutput); }
+// 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() {
+ impl_->exportSnapshot = impl_->exportJob.poll();
+ emit exportChanged();
+}
+
+bool QmlPlayerBridge::exportRunning() const { return impl_->exportSnapshot.active(); }
+bool QmlPlayerBridge::exportPaused() const {
+ return impl_->exportSnapshot.state == engine::ExportState::Paused;
+}
+double QmlPlayerBridge::exportProgress() const { return impl_->exportSnapshot.progress; }
+QString QmlPlayerBridge::exportStatus() const {
+ switch (impl_->exportSnapshot.state) {
+ case engine::ExportState::Idle: return tr("未开始");
+ case engine::ExportState::Preparing: return tr("准备中…");
+ case engine::ExportState::Running: return tr("导出中…");
+ case engine::ExportState::Paused: return tr("已暂停");
+ case engine::ExportState::Finishing: return tr("收尾中…");
+ case engine::ExportState::Succeeded: return tr("已完成");
+ case engine::ExportState::Failed: return tr("失败");
+ case engine::ExportState::Cancelled: return tr("已取消");
+ }
+ return {};
+}
+QString QmlPlayerBridge::exportTarget() const {
+ const auto& out = impl_->exportSnapshot.output;
+ return out.empty() ? utf8Of(impl_->exportOutput) : utf8Of(out);
+}
+int QmlPlayerBridge::exportEncoded() const { return int(impl_->exportSnapshot.encoded); }
+int QmlPlayerBridge::exportGenerated() const { return int(impl_->exportSnapshot.generated); }
+
+// 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(settings().exportBitrateMbps); }
+void QmlPlayerBridge::setExportBitrateMbps(int value) {
+ auto s = settings();
+ const uint32_t want = uint32_t(std::max(0, std::min(2000, value)));
+ if (s.exportBitrateMbps == want) return;
+ s.exportBitrateMbps = want;
+ impl_->commit(std::move(s));
+ emit settingsChanged();
+}
+
+QString QmlPlayerBridge::exportPresetName() const { return currentPresetName(); }
+
+int QmlPlayerBridge::srTargetIndex() const {
+ // 0 keeps the source size; 1..3 are the engine's Qhd/Uhd4K/Uhd8K targets.
+ switch (settings().srTarget) {
+ case pipeline::SrTarget::Qhd: return 1;
+ case pipeline::SrTarget::Uhd4K: return 2;
+ case pipeline::SrTarget::Uhd8K: return 3;
+ }
+ return 0;
+}
+void QmlPlayerBridge::setSrTargetIndex(int index) {
+ 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;
+ 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;
+ 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());
+ out << item;
+ }
+ return out;
+}
+
+void QmlPlayerBridge::pauseExport(bool paused) {
+ impl_->exportJob.pause(paused);
+ pollExport();
+}
QString QmlPlayerBridge::formatTime(double seconds) const { return mmss(seconds); }
@@ -679,22 +857,21 @@ void QmlPlayerBridge::chooseExportPath() {
void QmlPlayerBridge::startExport() {
if (impl_->exportOutput.empty()) { emit notice(tr("先选择导出位置"), true); return; }
- if (impl_->sourceLabel.empty() || impl_->snapshot.capture) {
- emit notice(tr("先打开要导出的文件"), true);
- return;
- }
- impl_->engine.startExport(impl_->sourceLabel, impl_->exportOutput, impl_->options, false);
- impl_->exportRunning = true;
- impl_->exportStatus = tr("导出中…");
- emit exportChanged();
+ if (impl_->sourceLabel.empty()) { emit notice(tr("先打开要导出的文件"), true); return; }
+ // The settings are frozen at start, exactly as the engine's job expects: an
+ // export must not change under the user mid-run.
+ auto settings = impl_->facade.pendingSettings();
+ engine::fromChain(impl_->chain, settings);
+ const bool started = impl_->exportJob.start(impl_->sourceLabel, impl_->exportOutput,
+ settings, impl_->exportHevc);
+ if (!started) { emit notice(tr("导出启动失败;详见诊断"), true); return; }
+ pollExport();
emit navigate(QStringLiteral("export"));
}
void QmlPlayerBridge::cancelExport() {
- impl_->engine.stop();
- impl_->exportRunning = false;
- impl_->exportStatus = tr("已取消");
- emit exportChanged();
+ impl_->exportJob.cancel();
+ pollExport();
}
void QmlPlayerBridge::quit() {