refactor: update UI layout for wafer data display and add file browser auto-refresh on tab switch

This commit is contained in:
jack
2026-06-30 22:15:14 -07:00
parent 0d5cf9e4ff
commit 0a2d6b78ba
2 changed files with 115 additions and 96 deletions
+5
View File
@@ -19,6 +19,11 @@ Rectangle {
// ===== View State =====
property int selectedTabIndex: 0
onSelectedTabIndexChanged: {
if (selectedTabIndex === 2) {
file_browser.refreshFiles();
}
}
property bool memoryRead: false
property bool waferDetected: false
+110 -96
View File
@@ -51,29 +51,31 @@ ColumnLayout {
}
}
component GridCell : ColumnLayout {
component GridCell : RowLayout {
property alias label: labelText.text
property alias value: valueText.text
property bool isRight: false
property bool active: root.waferDetected
spacing: 1
Layout.alignment: isRight ? Qt.AlignRight : Qt.AlignLeft
spacing: 8
Layout.fillWidth: true
Text {
id: labelText
color: Theme.sideMutedText
font.pixelSize: Theme.fontXs
font.family: Theme.uiFontFamily
Layout.alignment: isRight ? Qt.AlignRight : Qt.AlignLeft
Layout.fillWidth: true
elide: Text.ElideRight
verticalAlignment: Text.AlignVCenter
}
Text {
id: valueText
color: active ? Theme.headingColor : Theme.sideMutedText
font.pixelSize: Theme.fontMd
font.pixelSize: Theme.fontSm
font.weight: Font.Bold
font.family: Theme.uiFontFamily
Layout.alignment: isRight ? Qt.AlignRight : Qt.AlignLeft
Layout.alignment: Qt.AlignRight
verticalAlignment: Text.AlignVCenter
}
}
@@ -107,6 +109,12 @@ ColumnLayout {
function parseAndSavePendingRead() {
deviceController.parseAndSaveData(root.currentFamilyCode(), deviceController.selectedPort || "");
}
function getCsvFileName() {
var path = root.csvPath;
if (!path) return "";
var parts = path.split(/[\/\\]/);
return parts[parts.length - 1].toUpperCase();
}
FolderDialog {
id: saveDirDialog
@@ -292,64 +300,32 @@ ColumnLayout {
spacing: 2
Text {
text: "DIRECTORY"
color: Theme.sideMutedText
font.pixelSize: Theme.fontMd
font.weight: Font.Medium
font.letterSpacing: 1.2
text: root.csvPath !== "" ? root.getCsvFileName() : "DIRECTORY"
color: root.csvPath !== "" ? Theme.headingColor : Theme.sideMutedText
font.pixelSize: root.csvPath !== "" ? Theme.fontSm : Theme.fontMd
font.weight: root.csvPath !== "" ? Font.Bold : Font.Medium
font.letterSpacing: root.csvPath !== "" ? 0 : 1.2
font.family: Theme.uiFontFamily
}
Text {
text: deviceController.saveDataDir || "Not configured"
color: Theme.bodyColor
font.pixelSize: Theme.fontSm
font.family: Theme.uiFontFamily
font.italic: true
opacity: 0.7
elide: Text.ElideMiddle
elide: Text.ElideRight
Layout.fillWidth: true
}
}
Item { Layout.fillHeight: true }
RowLayout {
Layout.fillWidth: true
spacing: 8
Button {
id: browseBtn
text: "Browse"
font.pixelSize: Theme.fontSm
font.weight: Font.Medium
Text {
text: deviceController.saveDataDir || "Not configured"
color: Theme.bodyColor
font.pixelSize: Theme.fontXs
font.family: Theme.uiFontFamily
implicitHeight: 24
implicitWidth: 60
hoverEnabled: true
background: Rectangle {
color: browseBtn.hovered ? Theme.buttonNeutralHover : Theme.buttonNeutralBackground
border.color: Theme.cardBorder
border.width: 1
radius: Theme.radiusSm
}
contentItem: Text {
text: browseBtn.text
color: Theme.bodyColor
font: browseBtn.font
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: saveDirDialog.open()
}
Item { Layout.fillWidth: true }
Row {
spacing: 4
visible: root.isConnected
Rectangle {
width: 6; height: 6; radius: 3
color: Theme.statusSuccessColor
anchors.verticalCenter: parent.verticalCenter
}
font.italic: true
opacity: 0.6
elide: Text.ElideMiddle
Layout.fillWidth: true
}
Rectangle {
@@ -372,6 +348,31 @@ ColumnLayout {
font.letterSpacing: 0.6
}
}
Button {
id: browseBtn
text: "Save As"
font.pixelSize: Theme.fontSm
font.weight: Font.Medium
font.family: Theme.uiFontFamily
implicitHeight: 24
implicitWidth: 70
hoverEnabled: true
background: Rectangle {
color: browseBtn.hovered ? Theme.buttonNeutralHover : Theme.buttonNeutralBackground
border.color: Theme.cardBorder
border.width: 1
radius: Theme.radiusSm
}
contentItem: Text {
text: browseBtn.text
color: Theme.bodyColor
font: browseBtn.font
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
}
onClicked: saveDirDialog.open()
}
}
}
}
@@ -386,53 +387,66 @@ ColumnLayout {
ColumnLayout {
anchors.fill: parent
anchors.margins: Theme.panelPadding
spacing: 8
anchors.margins: 10
spacing: 4
Item {
Text {
text: "WAFER & SENSOR DATA"
color: Theme.sideMutedText
font.pixelSize: Theme.fontXs
font.weight: Font.Bold
font.family: Theme.uiFontFamily
font.letterSpacing: 0.6
Layout.bottomMargin: 2
}
GridLayout {
Layout.fillWidth: true
Layout.fillHeight: true
columns: 2
rowSpacing: 4
columnSpacing: 16
GridLayout {
anchors.fill: parent
columns: 2
rowSpacing: 6
columnSpacing: 16
GridCell {
id: waferInfoFamilyCell
label: "Family Code"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 0 && info[0]) ? info[0] : "—";
}
}
GridCell {
id: waferCyclesCell
label: "Cycles Completed"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 5 && info[5] !== undefined) ? String(info[5]) : "—";
}
active: root.waferDetected
}
GridCell {
id: waferInfoFamilyCell
label: "Family Code"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 0 && info[0]) ? info[0] : "—";
}
Rectangle {
Layout.columnSpan: 2
Layout.fillWidth: true
height: 1
color: Theme.cardBorder
opacity: 0.5
}
GridCell {
id: waferSerialCell
label: "Serial"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 1 && info[1]) ? info[1] : "—";
}
GridCell {
id: waferCyclesCell
label: "Cycles Completed"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 5 && info[5] !== undefined) ? String(info[5]) : "—";
}
isRight: true
active: root.waferDetected
}
GridCell {
id: waferSerialCell
label: "Serial"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 1 && info[1]) ? info[1] : "—";
}
}
GridCell {
id: waferSensorsCell
label: "Sensors"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 2 && info[2]) ? String(info[2]) : "—";
}
isRight: true
}
GridCell {
id: waferSensorsCell
label: "Sensors"
value: {
var info = deviceController.lastWaferInfo;
return (info && info.length > 2 && info[2]) ? String(info[2]) : "—";
}
}
}