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): the colour page, driven by the engine's own parameter catalogue
Veyra Goal Agent33d65caa1214
diff --git a/include/veyra/ui/QmlPlayerBridge.h b/include/veyra/ui/QmlPlayerBridge.hindex a1c5f882..761013d4 100644--- a/include/veyra/ui/QmlPlayerBridge.h+++ b/include/veyra/ui/QmlPlayerBridge.h@@ -237,6 +237,16 @@ class QmlPlayerBridge : public QObject {// Which preset the app opens with, as the manage page's "set default" uses.Q_PROPERTY(int defaultPresetIndex READ defaultPresetIndex NOTIFY presetsChanged)+ // --- colour page -------------------------------------------------------+ // The engine's ColorSettings carries a large parameter set. Rather than one+ // property per field, the page reads and writes them by name through one pair+ // of calls, and colourParameters() reports the catalogue the UI builds its+ // controls from - so a control can only exist for a parameter that is real.+ Q_PROPERTY(QVariantList colourParameters READ colourParameters NOTIFY chainChanged)+ // The same catalogue grouped by section, so the page can nest its collapsible+ // sub-panels without re-grouping in QML.+ Q_PROPERTY(QVariantList colourGroups READ colourGroups NOTIFY chainChanged)+public:// `engine` must outlive the bridge. `dataDirectory` holds ui-session.v1 and// the preset library; empty means the default user data directory.@@ -421,6 +431,11 @@ public:QVariantList presetChoices() const;QVariantList presetSaveParts() const;int defaultPresetIndex() const;+ QVariantList colourParameters() const;+ QVariantList colourGroups() const;+ Q_INVOKABLE double colourParameter(const QString& name) const;+ Q_INVOKABLE bool setColourParameter(const QString& name, double value);+ Q_INVOKABLE bool resetColourParameter(const QString& name);// 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 QMLdiff --git a/qml/Veyra/ProPage.qml b/qml/Veyra/ProPage.qmlindex 56d929a8..6bca5072 100644--- a/qml/Veyra/ProPage.qml+++ b/qml/Veyra/ProPage.qml@@ -695,66 +695,60 @@ Item {}// --- 色彩 -------------------------------------------------+ // Built from the engine's own parameter catalogue, so a control+ // can only exist for a field ColorSettings really carries. The+ // groups follow the design's sections (亮 / 效果 / 颜色 / 曲线 /+ // 颜色分级 / 校准 / LUT).ColumnLayout {Layout.fillWidth: truespacing: 6visible: root.tab === "color"- VGroup {- VRow {- label: "调色"- VSwitch {- checked: veyra.colorEnabled- onToggled: veyra.colorEnabled = checked- }- }- }- VGroup {- visible: veyra.colorEnabled- VRow {- label: "曝光(EV)"- value: veyra.colorExposure.toFixed(2)- VSlider {- implicitWidth: 150- center: true- from: -5; to: 5; value: veyra.colorExposure- onMoved: veyra.colorExposure = value- }- }- VRow {- label: "对比度"- value: String(Math.round(veyra.colorContrast))- VSlider {- implicitWidth: 150- center: true- from: -100; to: 100; value: veyra.colorContrast- onMoved: veyra.colorContrast = value- }- }- VRow {- label: "饱和度"- value: String(Math.round(veyra.colorSaturation))- VSlider {- implicitWidth: 150- center: true- from: -100; to: 100; value: veyra.colorSaturation- onMoved: veyra.colorSaturation = value- }- }- VRow {- label: "色温(相对)"- value: String(Math.round(veyra.colorTemperature))- VSlider {- implicitWidth: 150- center: true- from: -100; to: 100; value: veyra.colorTemperature- onMoved: veyra.colorTemperature = value++ VAccordion {+ Layout.fillWidth: true+ glyph: "🎨"+ hue: "#E0C341"+ title: "调色"+ summary: veyra.colorEnabled+ ? ("曝光 " + veyra.colourParameter("exposure").toFixed(2)+ + " · 对比 " + Math.round(veyra.colourParameter("contrast")))+ : "已关闭"+ on: veyra.colorEnabled+ open: true+ onToggled: veyra.colorEnabled = on++ Repeater {+ model: veyra.colourGroups+ delegate: VSubGroup {+ required property var modelData+ Layout.fillWidth: true+ label: modelData.group+ count: modelData.items.length+ Repeater {+ model: modelData.items+ delegate: VRow {+ required property var modelData+ label: modelData.label+ value: veyra.colourParameter(modelData.name).toFixed(2)+ VSlider {+ implicitWidth: 130+ center: modelData.center+ from: modelData.min+ to: modelData.max+ value: veyra.colourParameter(modelData.name)+ onMoved: veyra.setColourParameter(modelData.name, value)+ }+ }+ }}}}- // Honest scope note: the design's colour page is much larger- // (curves, mixer, grading wheels, calibration, LUT). Those- // controls are not wired to the bridge yet, so this panel- // says so rather than showing dead sliders.++ // The design's colour page also has a curves editor, a mixer,+ // grading wheels and a LUT picker. Those need drawing widgets+ // (a curve canvas, colour wheels) that are not built yet, so+ // this says so rather than showing sliders that stand in for+ // them.Rectangle {Layout.fillWidth: trueimplicitHeight: noteText.implicitHeight + 20@@ -764,7 +758,8 @@ Item {id: noteTextanchors.fill: parentanchors.margins: 10- text: "曲线、混色器、颜色分级、校准与 LUT 尚未接入界面;引擎已支持,但本轮未接。"+ text: "曲线编辑器、混色器、颜色分级轮、原色校准与 LUT 选择尚未接入:"+ + "引擎已支持这些参数,但界面还需要曲线画布与色轮控件,本轮未做。"color: Theme.t2font.family: Theme.fontUifont.pixelSize: Theme.fsSmalldiff --git a/src/ui/QmlPlayerBridge.cpp b/src/ui/QmlPlayerBridge.cppindex 854ce1a0..aa07ff7a 100644--- a/src/ui/QmlPlayerBridge.cpp+++ b/src/ui/QmlPlayerBridge.cpp@@ -9,6 +9,7 @@#include <QJsonDocument>#include <QJsonObject>#include <QJsonArray>+#include <QHash>#include <QFile>#include <QTimer>@@ -496,6 +497,152 @@ void QmlPlayerBridge::setRemotePlayPin(const QString& 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;+ return nullptr;+}+} // namespace++QVariantList QmlPlayerBridge::colourParameters() const {+ QVariantList out;+ for (const auto& p : kColourParams) {+ QVariantMap item;+ item["name"] = QString::fromUtf8(p.name);+ item["label"] = QString::fromUtf8(p.label);+ item["group"] = QString::fromUtf8(p.group);+ item["min"] = double(p.minimum);+ item["max"] = double(p.maximum);+ item["step"] = double(p.step);+ // 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 = QString::fromUtf8(p.group);+ if (!buckets.contains(group)) order << group;+ QVariantMap item;+ item["name"] = QString::fromUtf8(p.name);+ item["label"] = QString::fromUtf8(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 = settings().color;+ 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) {+ auto s = settings();+ const auto utf8 = name.toUtf8();+ float* field = colourScalar(s.color, utf8.constData());+ if (field == nullptr) return false;+ const float next = float(value);+ if (*field == next) return true;+ *field = next;+ // Colour is live in the engine: it uploads per frame, so this never rebuilds the+ // graph and does not need a rebuild check.+ impl_->commit(std::move(s));+ emit settingsChanged();+ return true;+}++bool QmlPlayerBridge::resetColourParameter(const QString& name) {+ auto s = settings();+ const auto utf8 = name.toUtf8();+ float* field = colourScalar(s.color, utf8.constData());+ if (field == nullptr) return false;+ *field = 0.0f;+ impl_->commit(std::move(s));+ emit settingsChanged();+ return true;+}+void QmlPlayerBridge::attachVideoWindow(qulonglong nativeHandle) {impl_->videoWindow = reinterpret_cast<HWND>(nativeHandle);}