diff --git a/apps/arstack_studio/qml/CalmButton.qml b/apps/arstack_studio/qml/CalmButton.qml index ddddca61c..6aee5e355 100644 --- a/apps/arstack_studio/qml/CalmButton.qml +++ b/apps/arstack_studio/qml/CalmButton.qml @@ -21,7 +21,10 @@ Button { scale: down ? 0.988 : 1.0 Behavior on scale { NumberAnimation { duration: 70; easing.type: Easing.OutCubic } } + // Consistent desktop hover affordance: light fill always pairs with dark + // caption. Applies to Advanced panels because they share CalmButton. readonly property color activeFill: !enabled ? "#10161d" : + hovered ? "#edf4fc" : tone === "success" ? (hovered ? "#1e5c43" : "#194d38") : tone === "danger" ? (hovered ? "#523039" : theme.redSoft) : tone === "accent" ? (hovered ? "#1d3c5e" : theme.accentSoft) : @@ -32,6 +35,7 @@ Button { tone === "accent" ? "#315f8d" : (activeFocus ? theme.accent : hovered ? "#3a4a5b" : theme.line) readonly property color activeText: !enabled ? theme.muted2 : + hovered ? "#142334" : tone === "success" ? "#d6f4e6" : tone === "danger" ? "#ffdce0" : tone === "accent" ? "#dcebff" : theme.textSoft @@ -53,6 +57,8 @@ Button { text: control.text color: control.activeText font: control.font + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter anchors.verticalCenter: parent.verticalCenter Behavior on color { ColorAnimation { duration: 90 } } } diff --git a/apps/arstack_studio/qml/ConfigurationHub.qml b/apps/arstack_studio/qml/ConfigurationHub.qml index fecaa51a3..c53519d52 100644 --- a/apps/arstack_studio/qml/ConfigurationHub.qml +++ b/apps/arstack_studio/qml/ConfigurationHub.qml @@ -32,15 +32,18 @@ Item { font.family: hub.uiFont font.pixelSize: 11 font.weight: checked ? Font.DemiBold : Font.Medium + hoverEnabled: true contentItem: Label { text: parent.text - color: parent.checked ? hub.theme.text : hub.theme.muted + color: parent.hovered ? "#142334" : + parent.checked ? hub.theme.text : hub.theme.muted font: parent.font horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter } background: Rectangle { - color: parent.checked ? hub.theme.raised : "transparent" + color: parent.hovered ? "#edf4fc" : + parent.checked ? hub.theme.raised : "transparent" radius: 6 border.width: parent.checked ? 1 : 0 border.color: hub.theme.line diff --git a/apps/arstack_studio/qml/Main.qml b/apps/arstack_studio/qml/Main.qml index 66a0daf89..831008ac1 100644 --- a/apps/arstack_studio/qml/Main.qml +++ b/apps/arstack_studio/qml/Main.qml @@ -112,13 +112,15 @@ ApplicationWindow { property string uiFont: interFont.status === FontLoader.Ready ? interFont.name : "Inter" property string monoFont: uiFont - property bool phaseLink: false + property bool phaseLink: true property bool profileDirty: false property bool pendingApply: true // Session-only operator intent. Never persist across application launches: // an explicit PTP ON can be restored after a firmware reflash/reconnect // without introducing an uncontrolled power-on publisher. - property bool ptpDesiredForSession: false + // Operator default: PTP SOURCE ON after verified connection; OFF overrides + // this for the remainder of this Studio session. + property bool ptpDesiredForSession: true property string ptpDesiredRole: "SOURCE" property bool ptpRestoreAfterFirmware: false property int ptpRestoreChecks: 0 @@ -198,6 +200,11 @@ ApplicationWindow { function onDeviceVerifiedChanged() { root.pendingApply = true root.offlinePreviewRunning = false + if (device.deviceVerified && root.ptpDesiredForSession && + !device.ptpRunning) { + root.ptpRestoreChecks = 0 + root.ptpRestoreAfterFirmware = true + } } } @@ -251,9 +258,9 @@ ApplicationWindow { ListModel { id: currentModel - ListElement { signalId: "Ia"; magnitude: 1.000; phase: 0.0; enabled: true; quality: 0; traceColor: "#ff6673" } - ListElement { signalId: "Ib"; magnitude: 1.000; phase: -120.0; enabled: true; quality: 0; traceColor: "#e6b552" } - ListElement { signalId: "Ic"; magnitude: 1.000; phase: 120.0; enabled: true; quality: 0; traceColor: "#59a7ff" } + ListElement { signalId: "Ia"; magnitude: 1.000; phase: -30.0; enabled: true; quality: 0; traceColor: "#ff6673" } + ListElement { signalId: "Ib"; magnitude: 1.000; phase: -150.0; enabled: true; quality: 0; traceColor: "#e6b552" } + ListElement { signalId: "Ic"; magnitude: 1.000; phase: 90.0; enabled: true; quality: 0; traceColor: "#59a7ff" } ListElement { signalId: "In"; magnitude: 0.000; phase: 0.0; enabled: true; quality: 0; traceColor: "#9a88df" } } @@ -444,6 +451,30 @@ ApplicationWindow { for (var row = 0; row < 4; ++row) sendSignal(group, row) } + function applyPhaseLink() { + if (!phaseLink || signalFrequency === 0) return + // Preserve each group's selected phase-A setpoint, and derive B/C + // from it consistently in BOTH the model and the next wire batch. + for (var group = 0; group < 2; ++group) { + var model = groupModel(group) + var base = model.get(0).phase + model.setProperty(1, "phase", normalizedAngle(base - 120)) + model.setProperty(2, "phase", normalizedAngle(base + 120)) + } + refreshPreview() + markScenarioDirty() + if (workflowBar.injectionRunning && workflowBar.session && + workflowBar.session.liveControlReady && !pendingApply) { + // Explicit link changes during RUNNING are real setpoint edits. + // Don't silently leave the publisher at its previous angles. + var ok = sendLinkedGroup(1) && sendLinkedGroup(0) + if (!ok) { + pendingApply = true + showMessage("Phase values not sent; Stop then Start to apply.", true) + } + } + } + function editSignal(group, row, field, value) { if ((field === "magnitude" && !validMagnitude(group, value)) || (field === "phase" && !validPhase(value))) @@ -487,6 +518,8 @@ ApplicationWindow { return ok } function startScenarioSnapshot() { + // The visible 4I+4V table is the only START setpoint authority. + // Capture it immediately before the worker queues its FIFO batch. var draft = scenarioSnapshot() draft.currentScale = currentScale draft.voltageScale = voltageScale @@ -1040,7 +1073,8 @@ ApplicationWindow { text: "3-phase link" onToggled: { root.phaseLink = checked - root.markScenarioDirty() + if (checked) root.applyPhaseLink() + else root.markScenarioDirty() } font.family: root.uiFont font.pixelSize: 9 @@ -1049,17 +1083,34 @@ ApplicationWindow { } } - RowLayout { + // At the supported 960x620 viewport two full tables cannot + // occupy 400+ px without clipping the PTP controls. + // Keep both tables stacked, with bounded scrolling only + // when the viewport is shorter than their natural height. + ScrollView { + id: matrixScroll + objectName: "studioMatrixViewport" Layout.fillWidth: true - Layout.preferredHeight: root.compactLayout ? 214 : 224 - Layout.maximumHeight: root.compactLayout ? 214 : 224 - spacing: 9 - SignalMatrix { + Layout.fillHeight: true + clip: true + contentWidth: availableWidth + contentHeight: matrixStack.implicitHeight + ScrollBar.horizontal.policy: ScrollBar.AlwaysOff + ScrollBar.vertical.policy: ScrollBar.AsNeeded + + ColumnLayout { + id: matrixStack + width: matrixScroll.availableWidth + spacing: 8 + SignalMatrix { id: voltageMatrix enabled: !workflowBar.startQueued objectName: "studioVoltageMatrix" Layout.fillWidth: true Layout.fillHeight: true + Layout.minimumHeight: 201 + Layout.preferredHeight: 201 + Layout.maximumHeight: 201 theme: studioTheme controller: root device: device @@ -1079,6 +1130,9 @@ ApplicationWindow { objectName: "studioCurrentMatrix" Layout.fillWidth: true Layout.fillHeight: true + Layout.minimumHeight: 201 + Layout.preferredHeight: 201 + Layout.maximumHeight: 201 theme: studioTheme controller: root device: device @@ -1091,8 +1145,8 @@ ApplicationWindow { symbolText: "I" unitText: root.signalFrequency === 0 ? "A DC" : "A RMS" compact: root.compactLayout + } } - } StudioTimingTray { diff --git a/apps/arstack_studio/qml/ModernRibbon.qml b/apps/arstack_studio/qml/ModernRibbon.qml index aa995b10d..6ed95645b 100644 --- a/apps/arstack_studio/qml/ModernRibbon.qml +++ b/apps/arstack_studio/qml/ModernRibbon.qml @@ -47,24 +47,24 @@ Rectangle { spacing: 6 RowLayout { - Layout.preferredWidth: bar.compact ? 105 : 124 + Layout.preferredWidth: bar.compact ? 155 : 182 Layout.alignment: Qt.AlignVCenter spacing: 8 Rectangle { - width: 28 - height: 28 - radius: 7 + width: 38 + height: 38 + radius: 9 color: "#0d151d" border.width: 1 border.color: bar.theme.lineSoft Image { anchors.centerIn: parent - width: 15 - height: 15 + width: 24 + height: 24 source: Qt.resolvedUrl("../assets/material/smv_injector.svg") - sourceSize.width: 30 - sourceSize.height: 30 + sourceSize.width: 48 + sourceSize.height: 48 } } @@ -73,7 +73,7 @@ Rectangle { text: "SMV Injector" color: bar.theme.text font.family: bar.uiFont - font.pixelSize: 11 + font.pixelSize: 15 font.weight: Font.DemiBold elide: Text.ElideRight verticalAlignment: Text.AlignVCenter diff --git a/apps/arstack_studio/qml/RibbonAction.qml b/apps/arstack_studio/qml/RibbonAction.qml index a882bb495..93c3fbcd0 100644 --- a/apps/arstack_studio/qml/RibbonAction.qml +++ b/apps/arstack_studio/qml/RibbonAction.qml @@ -39,7 +39,8 @@ Button { : tone === "danger" ? "#ffe3e6" : tone === "accent" || checked ? "#e1f1ff" : theme.textSoft contentItem: ColumnLayout { - spacing: 3 + anchors.centerIn: parent + spacing: 4 Image { visible: control.iconSource.toString().length > 0 source: control.hovered && control.enabled ? control.hoverPath : control.iconSource @@ -56,7 +57,7 @@ Button { text: control.text color: control.textColor font: control.font - Layout.alignment: Qt.AlignHCenter + Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter elide: Text.ElideRight diff --git a/apps/arstack_studio/qml/SignalMatrix.qml b/apps/arstack_studio/qml/SignalMatrix.qml index 1c84e2b43..aa739710b 100644 --- a/apps/arstack_studio/qml/SignalMatrix.qml +++ b/apps/arstack_studio/qml/SignalMatrix.qml @@ -196,7 +196,7 @@ Rectangle { } Layout.fillWidth: true - Layout.preferredHeight: matrix.compact ? 40 : 42 + Layout.preferredHeight: matrix.compact ? 34 : 35 color: signalRow.selected ? "#101c27" : (magnitudeField.activeFocus || phaseField.activeFocus) ? "#0f1922" : rowHover.hovered ? "#0d161e" : "transparent" diff --git a/apps/arstack_studio/qml/StudioDarkCheckBox.qml b/apps/arstack_studio/qml/StudioDarkCheckBox.qml index eedfce586..744df83b1 100644 --- a/apps/arstack_studio/qml/StudioDarkCheckBox.qml +++ b/apps/arstack_studio/qml/StudioDarkCheckBox.qml @@ -7,20 +7,26 @@ CheckBox { id: control property var theme property string uiFont: "Inter" - implicitHeight: 30 + implicitHeight: 32 + hoverEnabled: true spacing: 9 font.family: uiFont font.pixelSize: 11 indicator: Rectangle { - implicitWidth: 18 - implicitHeight: 18 + implicitWidth: 20 + implicitHeight: 20 + width: 20 + height: 20 x: control.leftPadding y: (control.height - height) / 2 radius: 5 color: control.checked ? control.theme.accent : control.theme.surface2 border.width: 1 + // Hover changes only the border colour, never checkbox size or + // creates a second overlay/nested platform-native indicator. border.color: control.checked ? control.theme.accent - : control.activeFocus ? control.theme.textSoft : control.theme.line + : (control.hovered || control.activeFocus) + ? control.theme.textSoft : control.theme.line Text { anchors.centerIn: parent visible: control.checked @@ -30,11 +36,15 @@ CheckBox { font.weight: Font.Bold } } + // Disable native platform hover/ripple background: the custom indicator + // is the ONLY checkbox affordance in hover and non-hover states. + background: Item {} contentItem: Text { leftPadding: control.indicator.width + control.spacing text: control.text font: control.font color: control.enabled ? control.theme.textSoft : control.theme.muted + horizontalAlignment: Text.AlignLeft verticalAlignment: Text.AlignVCenter elide: Text.ElideRight } diff --git a/apps/arstack_studio/qml/WorkflowBar.qml b/apps/arstack_studio/qml/WorkflowBar.qml index e49593114..6f8568b1c 100644 --- a/apps/arstack_studio/qml/WorkflowBar.qml +++ b/apps/arstack_studio/qml/WorkflowBar.qml @@ -281,9 +281,11 @@ SurfacePanel { controller.showMessage(ribbon.startReason(), false) return } - const accepted = controller.pendingApply - ? smartSession.requestStartWithScenario(controller.startScenarioSnapshot()) - : smartSession.requestStart() + // START always transmits a fresh snapshot of the visible 4I+4V + // model. The firmware may have different setpoints after reconnect, + // earlier LIVE SETs, or restoring the operator's local scenario. + const accepted = smartSession.requestStartWithScenario( + controller.startScenarioSnapshot()) if (!accepted) { controller.pendingApply = true controller.showMessage("Start rejected. Check device status.", true) diff --git a/apps/arstack_studio/src/main.cpp b/apps/arstack_studio/src/main.cpp index 13518af84..711fc83b3 100644 --- a/apps/arstack_studio/src/main.cpp +++ b/apps/arstack_studio/src/main.cpp @@ -63,13 +63,17 @@ struct UiBounds { const QRectF viewport{QPointF{0, 0}, QSizeF{size}}; const auto bar = findUiBounds(window, "studioWorkflowBar"); const auto surface = findUiBounds(window, "studioInjectionSurface"); + const auto matrixViewport = findUiBounds(window, "studioMatrixViewport"); const auto voltage = findUiBounds(window, "studioVoltageMatrix"); const auto current = findUiBounds(window, "studioCurrentMatrix"); const auto tray = findUiBounds(window, "studioTimingTray"); const auto quality = findUiBounds(window, "studioQualityRow"); - const std::array, 6> areas{{ + // At minimum-height desktop viewports the stacked matrix content scrolls. + // Assert containment of the scroll viewport, not offscreen scrollable + // rows. Offscreen tables remain real, ordered QML items. + const std::array, 5> areas{{ {"toolbar", bar}, {"injection workspace", surface}, - {"voltage matrix", voltage}, {"current matrix", current}, + {"matrix scroll viewport", matrixViewport}, {"PTP timing tray", tray}, {"quality editor", quality} }}; for (const auto& [label, item] : areas) { @@ -82,12 +86,21 @@ struct UiBounds { return false; } } - if (!(voltage.area.right() <= current.area.left() + tolerance - && tray.area.top() >= voltage.area.bottom() - tolerance - && quality.area.top() >= tray.area.bottom() - tolerance - && quality.area.bottom() <= surface.area.bottom() + tolerance)) { + // Matrices must remain stacked with no overlap in scroll content, + // while PTP/quality remain visible OUTSIDE the scroll area. This + // accepts scrollable rows at 960x620 without tolerating a clipped + // operational PTP switch or status row. + if (!(voltage.visible && current.visible && + voltage.area.width() >= 25 && current.area.width() >= 25 && + voltage.area.height() >= 100 && current.area.height() >= 100 && + voltage.area.bottom() <= current.area.top() + tolerance && + matrixViewport.area.top() >= surface.area.top() - tolerance && + tray.area.top() >= matrixViewport.area.bottom() - tolerance && + quality.area.top() >= tray.area.bottom() - tolerance && + quality.area.bottom() <= surface.area.bottom() + tolerance)) { qCritical().noquote() << "Studio UI panel order/overlap violation" << size - << voltage.area << current.area << tray.area << quality.area; + << matrixViewport.area << voltage.area + << current.area << tray.area << quality.area; return false; } const std::array controls{{ diff --git a/apps/arstack_studio/tests/check_operator_workspace.py b/apps/arstack_studio/tests/check_operator_workspace.py index ecca26e80..babcaee55 100644 --- a/apps/arstack_studio/tests/check_operator_workspace.py +++ b/apps/arstack_studio/tests/check_operator_workspace.py @@ -26,6 +26,8 @@ def ordered(data: str, first: str, second: str, reason: str) -> None: def main() -> None: main_qml = source("Main.qml") + workflow = source("WorkflowBar.qml") + ribbon = source("ModernRibbon.qml") preview = source("SignalPreview.qml") tray = source("StudioTimingTray.qml") expert = source("PtpExpertPanel.qml") @@ -54,6 +56,42 @@ def main() -> None: ordered(main_qml, "id: voltageMatrix", "id: currentMatrix", "voltage must precede current in the injection table") + require('objectName: "studioMatrixViewport"' in main_qml + and 'contentHeight: matrixStack.implicitHeight' in main_qml + and 'ScrollBar.vertical.policy: ScrollBar.AsNeeded' in main_qml + and 'id: matrixStack' in main_qml, + "stacked voltage/current matrices must be scrollable at 960x620 without clipping PTP") + geometry = (STUDIO / "src/main.cpp").read_text(encoding="utf-8") + require('findUiBounds(window, "studioMatrixViewport")' in geometry + and 'voltage.area.bottom() <= current.area.top() + tolerance' in geometry + and 'tray.area.top() >= matrixViewport.area.bottom() - tolerance' in geometry, + "native UI viewport regression must validate stacked order and visible PTP controls") + require('property bool ptpDesiredForSession: true' in main_qml + and 'ptpRestoreAfterFirmware = true' in main_qml + and 'ptpDesiredForSession = false' in main_qml + and 'property bool phaseLink: true' in main_qml, + "PTP SOURCE/AUTO and three-phase link start enabled, while OFF remains authoritative") + require('var draft = scenarioSnapshot()' in main_qml + and 'const accepted = smartSession.requestStartWithScenario(' in workflow + and ': smartSession.requestStart()' not in workflow, + "every START must send the latest 4I+4V table, not stale firmware setpoints") + require('function applyPhaseLink()' in main_qml + and 'if (checked) root.applyPhaseLink()' in main_qml + and 'sendLinkedGroup(1) && sendLinkedGroup(0)' in main_qml, + "3-phase link must update the model and send coherent live values") + require('font.pixelSize: 15' in ribbon + and 'width: 38' in ribbon and 'height: 38' in ribbon, + "SMV Injector logo and title must remain legible") + require('hovered ? "#edf4fc"' in source("CalmButton.qml") + and 'hovered ? "#142334"' in source("CalmButton.qml") + and 'parent.hovered ? "#edf4fc"' in config + and 'parent.hovered ? "#142334"' in config, + "Advanced light hover must use dark caption text") + require('width: 20' in source("StudioDarkCheckBox.qml") + and 'height: 20' in source("StudioDarkCheckBox.qml") + and 'control.hovered || control.activeFocus' in source("StudioDarkCheckBox.qml"), + "checkbox may change its colour, never its size on hover") + ordered(preview, "id: voltagePhasorCanvas", "id: currentPhasorCanvas", "voltage must precede current in the phasor view") ordered(preview, "drawWaveGroup(preview.voltageModel, voltageY, false)", @@ -116,7 +154,8 @@ def main() -> None: and 'enabled: !workflowBar.startQueued; onActivated: root.zeroAll()' in main_qml, "scenario editors and shortcuts must be frozen during a pending START snapshot") require("controller.pendingApply = true" in workflow - and "requestStartWithScenario(controller.startScenarioSnapshot())" in workflow + and "smartSession.requestStartWithScenario(" in workflow + and "controller.startScenarioSnapshot())" in workflow and "controller.applyAllSignals()" not in workflow and "startWatchdog" in workflow and "onRunningChanged()" in workflow, "reconnect must not auto-transmit, but one-click Start must stage a bounded scenario") @@ -145,7 +184,8 @@ def main() -> None: and 'toolTipText: "Advanced"' not in ribbon and 'ToolTip.text: "smpSynch mode"' not in timing_ui, "captioned operator controls must not duplicate labels as tooltips") - require('requestStartWithScenario(controller.startScenarioSnapshot())' in workflow + require('smartSession.requestStartWithScenario(' in workflow + and 'controller.startScenarioSnapshot())' in workflow and "Apply to board" not in main_qml, "Edit-to-Start must not regress to a manual Apply-to-board action") require("assets/material/smv_injector.svg" in cmake_icons