fix: comparison results never reached QML; restore click-box run selection
This commit is contained in:
+89
-143
@@ -16,6 +16,7 @@ Item {
|
||||
anchors.fill: parent
|
||||
|
||||
// Properties for DTW Comparison
|
||||
property int activeBox: 1 // 1 for Reference (Run A), 2 for Session (Run B), 0 for inactive
|
||||
property string compareFileA: ""
|
||||
property string compareFileB: ""
|
||||
property real warpingDistance: -1
|
||||
@@ -43,17 +44,6 @@ Item {
|
||||
return path ? path.split("/").pop() : ""
|
||||
}
|
||||
|
||||
// Badge colors per wafer type, matching the mockup's file-row chips
|
||||
function badgeFg(t) {
|
||||
return t === "Z" ? "#a78bfa" : t === "B" ? "#93c5fd" : t === "A" ? "#6ee7b7" : "#fde047"
|
||||
}
|
||||
function badgeBg(t) {
|
||||
return t === "Z" ? Qt.rgba(139 / 255, 92 / 255, 246 / 255, 0.15)
|
||||
: t === "B" ? Qt.rgba(59 / 255, 130 / 255, 246 / 255, 0.15)
|
||||
: t === "A" ? Qt.rgba(16 / 255, 185 / 255, 129 / 255, 0.15)
|
||||
: Qt.rgba(245 / 255, 158 / 255, 11 / 255, 0.15)
|
||||
}
|
||||
|
||||
function clearResults() {
|
||||
root.warpingDistance = -1
|
||||
root.frameOffset = 0
|
||||
@@ -69,15 +59,26 @@ Item {
|
||||
root.compareFileA = ""
|
||||
root.compareFileB = ""
|
||||
root.comparing = false
|
||||
runACombo.currentIndex = -1
|
||||
runBCombo.currentIndex = -1
|
||||
root.activeBox = 1
|
||||
clearResults()
|
||||
}
|
||||
|
||||
Component.onCompleted: file_browser.refreshFiles()
|
||||
|
||||
// Clicking a file in the left rail's browser populates the armed run slot
|
||||
Connections {
|
||||
target: streamController
|
||||
function onLoadedFileChanged() {
|
||||
if (streamController.loadedFile && root.activeBox > 0) {
|
||||
if (root.activeBox === 1) {
|
||||
root.compareFileA = streamController.loadedFile
|
||||
root.activeBox = 2 // Auto-advance to box 2
|
||||
} else if (root.activeBox === 2) {
|
||||
root.compareFileB = streamController.loadedFile
|
||||
root.activeBox = 0 // Finished selecting
|
||||
}
|
||||
}
|
||||
}
|
||||
function onComparisonResult(result) {
|
||||
root.comparing = false
|
||||
if (result && result.success) {
|
||||
@@ -183,124 +184,79 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
// Run selector dropdown fed by the left-rail file browser model
|
||||
component RunSelector: ComboBox {
|
||||
id: selector
|
||||
property string placeholder: "Select CSV…"
|
||||
// Run slot card: click to arm, then pick a file in the left rail's browser
|
||||
component RunSlot: Rectangle {
|
||||
id: slotBox
|
||||
property int boxIndex: 1
|
||||
property string title
|
||||
property string filePath: ""
|
||||
property color accent: Theme.primaryAccent
|
||||
signal cleared()
|
||||
|
||||
Layout.fillWidth: true
|
||||
implicitHeight: 36
|
||||
model: file_browser.files
|
||||
currentIndex: -1
|
||||
implicitHeight: 58
|
||||
radius: Theme.radiusSm
|
||||
color: Theme.fieldBackground
|
||||
border.width: root.activeBox === boxIndex ? 2 : 1
|
||||
border.color: root.activeBox === boxIndex ? accent : Theme.cardBorder
|
||||
|
||||
readonly property var currentFile: (currentIndex >= 0 && currentIndex < file_browser.files.length)
|
||||
? file_browser.files[currentIndex] : null
|
||||
Behavior on border.color { ColorAnimation { duration: Theme.durationFast } }
|
||||
|
||||
background: Rectangle {
|
||||
radius: Theme.radiusXs
|
||||
color: Theme.fieldBackground
|
||||
border.color: selector.popup.visible ? Theme.fieldBorderFocus : Theme.fieldBorder
|
||||
border.width: 1
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onClicked: root.activeBox = slotBox.boxIndex
|
||||
}
|
||||
|
||||
contentItem: RowLayout {
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
anchors.margins: 10
|
||||
spacing: 8
|
||||
|
||||
Rectangle {
|
||||
Layout.leftMargin: 8
|
||||
width: 16; height: 16; radius: 4
|
||||
visible: selector.currentFile !== null
|
||||
color: root.badgeBg(selector.currentFile ? selector.currentFile.waferType : "")
|
||||
width: 8; height: 8; radius: 4
|
||||
color: slotBox.accent
|
||||
Layout.alignment: Qt.AlignVCenter
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 2
|
||||
Label {
|
||||
anchors.centerIn: parent
|
||||
text: selector.currentFile ? selector.currentFile.waferType : ""
|
||||
text: slotBox.title
|
||||
font.pixelSize: 9
|
||||
font.bold: true
|
||||
color: root.badgeFg(selector.currentFile ? selector.currentFile.waferType : "")
|
||||
font.letterSpacing: 1.0
|
||||
color: root.activeBox === slotBox.boxIndex ? slotBox.accent : Theme.sideMutedText
|
||||
}
|
||||
}
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
Layout.leftMargin: selector.currentFile === null ? 8 : 0
|
||||
text: selector.currentFile ? selector.currentFile.baseName : selector.placeholder
|
||||
font.pixelSize: Theme.fontSm
|
||||
font.weight: selector.currentFile ? Font.Medium : Font.Normal
|
||||
color: selector.currentFile ? Theme.fieldText : Theme.fieldPlaceholder
|
||||
elide: Text.ElideMiddle
|
||||
}
|
||||
}
|
||||
|
||||
indicator: Label {
|
||||
x: selector.width - width - 8
|
||||
y: (selector.height - height) / 2
|
||||
text: "▾"
|
||||
font.pixelSize: Theme.fontSm
|
||||
color: Theme.sideMutedText
|
||||
}
|
||||
|
||||
delegate: ItemDelegate {
|
||||
id: fileDelegate
|
||||
width: selector.width
|
||||
highlighted: selector.highlightedIndex === index
|
||||
|
||||
background: Rectangle {
|
||||
radius: Theme.radiusXs
|
||||
color: fileDelegate.highlighted ? Theme.buttonNeutralHover : "transparent"
|
||||
}
|
||||
contentItem: RowLayout {
|
||||
spacing: 8
|
||||
Rectangle {
|
||||
width: 20; height: 20; radius: 4
|
||||
color: root.badgeBg(modelData.waferType)
|
||||
Label {
|
||||
anchors.centerIn: parent
|
||||
text: modelData.waferType
|
||||
font.pixelSize: Theme.fontXs
|
||||
font.bold: true
|
||||
color: root.badgeFg(modelData.waferType)
|
||||
}
|
||||
}
|
||||
ColumnLayout {
|
||||
Label {
|
||||
text: slotBox.filePath !== ""
|
||||
? root.shortName(slotBox.filePath)
|
||||
: (root.activeBox === slotBox.boxIndex ? "← Select file from left panel…" : "Click to select")
|
||||
font.pixelSize: Theme.fontXs
|
||||
color: slotBox.filePath !== "" ? Theme.headingColor : Theme.bodyColor
|
||||
opacity: slotBox.filePath !== "" ? 1.0 : 0.6
|
||||
elide: Text.ElideMiddle
|
||||
Layout.fillWidth: true
|
||||
spacing: 0
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: modelData.baseName
|
||||
font.pixelSize: Theme.fontSm
|
||||
font.weight: Font.Medium
|
||||
color: Theme.headingColor
|
||||
elide: Text.ElideMiddle
|
||||
}
|
||||
Label {
|
||||
Layout.fillWidth: true
|
||||
text: modelData.date || modelData.chamber || ""
|
||||
visible: text !== ""
|
||||
font.pixelSize: 9
|
||||
color: Theme.sideMutedText
|
||||
elide: Text.ElideRight
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
popup: Popup {
|
||||
y: selector.height + 4
|
||||
width: selector.width
|
||||
implicitHeight: Math.min(contentItem.implicitHeight + 8, 220)
|
||||
padding: 4
|
||||
|
||||
background: Rectangle {
|
||||
radius: Theme.radiusXs
|
||||
color: Theme.cardBackground
|
||||
border.color: Theme.cardBorder
|
||||
border.width: 1
|
||||
}
|
||||
contentItem: ListView {
|
||||
clip: true
|
||||
implicitHeight: contentHeight
|
||||
model: selector.popup.visible ? selector.delegateModel : null
|
||||
currentIndex: selector.highlightedIndex
|
||||
ScrollIndicator.vertical: ScrollIndicator {}
|
||||
Button {
|
||||
visible: slotBox.filePath !== ""
|
||||
flat: true
|
||||
implicitWidth: 24; implicitHeight: 24
|
||||
onClicked: slotBox.cleared()
|
||||
background: Rectangle {
|
||||
radius: Theme.radiusSm
|
||||
color: parent.hovered ? Qt.rgba(1, 1, 1, 0.08) : "transparent"
|
||||
}
|
||||
contentItem: Label {
|
||||
text: "✕"
|
||||
color: Theme.bodyColor
|
||||
font.pixelSize: Theme.fontSm
|
||||
horizontalAlignment: Text.AlignHCenter
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -565,7 +521,7 @@ Item {
|
||||
Label {
|
||||
Layout.alignment: Qt.AlignHCenter
|
||||
visible: !root.comparing
|
||||
text: "Pick Run A and Run B in the panel on the right."
|
||||
text: "Click a run box on the right, then select a file from the left panel."
|
||||
color: Theme.sideMutedText
|
||||
font.pixelSize: Theme.fontXs
|
||||
}
|
||||
@@ -739,37 +695,27 @@ Item {
|
||||
|
||||
SectionTitle { text: "RUN SELECTION" }
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 4
|
||||
Label {
|
||||
text: "Reference CSV (Run A)"
|
||||
font.pixelSize: 9
|
||||
color: Theme.sideMutedText
|
||||
}
|
||||
RunSelector {
|
||||
id: runACombo
|
||||
onActivated: function (index) {
|
||||
root.compareFileA = file_browser.files[index].fileName
|
||||
root.clearResults()
|
||||
}
|
||||
RunSlot {
|
||||
title: "REFERENCE (RUN A)"
|
||||
boxIndex: 1
|
||||
accent: Theme.primaryAccent
|
||||
filePath: root.compareFileA
|
||||
onCleared: {
|
||||
root.compareFileA = ""
|
||||
root.activeBox = 1
|
||||
root.clearResults()
|
||||
}
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
Layout.fillWidth: true
|
||||
spacing: 4
|
||||
Label {
|
||||
text: "Session CSV (Run B)"
|
||||
font.pixelSize: 9
|
||||
color: Theme.sideMutedText
|
||||
}
|
||||
RunSelector {
|
||||
id: runBCombo
|
||||
onActivated: function (index) {
|
||||
root.compareFileB = file_browser.files[index].fileName
|
||||
root.clearResults()
|
||||
}
|
||||
RunSlot {
|
||||
title: "SESSION (RUN B)"
|
||||
boxIndex: 2
|
||||
accent: Theme.themeSkill
|
||||
filePath: root.compareFileB
|
||||
onCleared: {
|
||||
root.compareFileB = ""
|
||||
root.activeBox = 2
|
||||
root.clearResults()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user