feat(ui): improve device session management, update data directory paths, and add session clearing functionality.

This commit is contained in:
jack
2026-06-15 11:28:28 -07:00
parent 7e584e08e8
commit 2e4763510d
7 changed files with 173 additions and 42 deletions
+27 -3
View File
@@ -24,6 +24,19 @@ Rectangle {
property int selectedTabIndex: 0
property int selectedSideActionIndex: -1 // nothing active on startup
Connections {
target: deviceController
function onParsedDataReady(result) {
if (result.success && result.csv_path) {
// Load the freshly read CSV into the player
streamController.loadFile(result.csv_path)
// Automatically switch to the "Wafer Map Tab" (index 3)
root.selectedTabIndex = 3
}
}
}
// ===== Main Two-Column Layout =====
RowLayout {
anchors.fill: parent
@@ -60,9 +73,19 @@ Rectangle {
onClicked: {
root.selectedSideActionIndex = index
root.selectedTabIndex = 0 // always jump to Status tab
if (index === 0) deviceController.detectWafer()
else if (index === 1) deviceController.readMemoryAsync()
else if (index === 2) deviceController.openCsvFile()
if (index === 0) {
streamController.setMode("review")
streamController.stopStream()
deviceController.detectWafer()
}
else if (index === 1) {
streamController.setMode("review")
streamController.stopStream()
deviceController.readMemoryAsync()
}
else if (index === 2) {
deviceController.openCsvFile()
}
}
background: Rectangle {
@@ -182,6 +205,7 @@ Rectangle {
color: Theme.tabBarBackground
border.color: Theme.workspaceBorder
border.width: Theme.borderThin
radius: Theme.radiusMd
RowLayout {
anchors.fill: parent
+95 -21
View File
@@ -47,11 +47,7 @@ ColumnLayout {
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 86
color: {
if (deviceController.connectionStatus === "Connected") return Theme.statusSuccessColor + "22"
if (deviceController.connectionStatus === "Disconnected") return Theme.statusErrorColor + "22"
return Theme.cardBackground
}
color: Theme.cardBackground
border.color: {
if (deviceController.connectionStatus === "Connected") return Theme.statusSuccessColor
if (deviceController.connectionStatus === "Disconnected") return Theme.statusErrorColor
@@ -187,27 +183,105 @@ ColumnLayout {
}
// --- Activity Log ---
GroupBox {
title: "Activity Log"
Rectangle {
Layout.fillWidth: true
Layout.fillHeight: true
color: Theme.cardBackground
border.color: Theme.cardBorder
radius: Theme.radiusMd
clip: true
ScrollView {
ColumnLayout {
anchors.fill: parent
clip: true
spacing: 0
TextArea {
id: activityLog
width: parent.width
text: ""
readOnly: true
font.family: "monospace"
font.pixelSize: 12
wrapMode: TextArea.WordWrap
leftPadding: 4
rightPadding: 4
color: Theme.bodyColor
}
// Header
Rectangle {
Layout.fillWidth: true
Layout.preferredHeight: 40
color: Theme.subtleSectionBackground
RowLayout {
anchors.fill: parent
anchors.leftMargin: Theme.panelPadding
anchors.rightMargin: Theme.panelPadding
Label {
text: "ACTIVITY LOG"
color: Theme.bodyColor
font.pixelSize: 10
font.letterSpacing: 1.8
font.weight: Font.Medium
Layout.fillWidth: true
Layout.alignment: Qt.AlignVCenter
}
Button {
text: "REFRESH SESSION"
font.pixelSize: 10
implicitHeight: 24
hoverEnabled: true
background: Rectangle {
color: parent.hovered ? Theme.buttonNeutralHover : "transparent"
radius: Theme.radiusSm
}
contentItem: Text {
text: parent.text
color: Theme.bodyColor
font: parent.font
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: deviceController.clearSession()
}
Button {
text: "CLEAR LOG"
font.pixelSize: 10
implicitHeight: 24
hoverEnabled: true
background: Rectangle {
color: parent.hovered ? Theme.buttonNeutralHover : "transparent"
radius: Theme.radiusSm
}
contentItem: Text {
text: parent.text
color: Theme.bodyColor
font: parent.font
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: deviceController.clearActivityLog()
}
}
Rectangle {
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
height: 1
color: Theme.cardBorder
}
}
ScrollView {
Layout.fillWidth: true
Layout.fillHeight: true
Layout.margins: Theme.panelPadding
clip: true
TextArea {
id: activityLog
width: parent.width
text: ""
readOnly: true
font.family: "monospace"
font.pixelSize: 12
wrapMode: TextArea.WordWrap
color: Theme.bodyColor
background: null
}
}
}
Connections {
+14 -1
View File
@@ -81,7 +81,20 @@ Item {
}
}
onCurrentIndexChanged:
streamController.setMode(currentIndex === 0 ? "live" : "review")
if (currentIndex === 0){
// Entering Live mode, only work when wafer detected/connected
streamController.setMode("live")
if (deviceController.connectionStatus === "Connected") {
var fc = ""
if (deviceController.lastWaferInfo && deviceController.lastWaferInfo.length > 0) {
fc = deviceController.lastWaferInfo[0]
}
streamController.startStream(deviceController.selectedPort, fc)
}
} else {
// Entering Review Mode (automatically calls stopStream in backend)
streamController.setMode("review")
}
}
// Live source info: WiFi icon + port · serial
@@ -15,6 +15,8 @@ Item {
sensors: streamController.sensorLayout // [{label,x,y}]
values: streamController.sensorValues // [float]
bands: streamController.sensorBands // ["in_range"|"high"|"low"]
shape: streamController.waferShape
size: streamController.waferSize
target: streamController.target
margin: streamController.margin
blend: root.blend