108 lines
2.9 KiB
QML
108 lines
2.9 KiB
QML
|
|
import QtQuick
|
|||
|
|
import QtQuick.Controls
|
|||
|
|
import QtQuick.Layouts
|
|||
|
|
import "./common"
|
|||
|
|
Item {
|
|||
|
|
id: self
|
|||
|
|
|
|||
|
|
width: parent.parent.parent.width/2
|
|||
|
|
height: parent.parent.parent.height/2
|
|||
|
|
property var workstate: "idle" // idle, working, error, success
|
|||
|
|
property var cardId: 0
|
|||
|
|
Component.onCompleted: {
|
|||
|
|
|
|||
|
|
sig_updateWorkstate.connect(updateWorkstate)
|
|||
|
|
sig_stopTask.connect(stopTask)
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function updateWorkstate() {
|
|||
|
|
|
|||
|
|
if(curTestInfo) {
|
|||
|
|
if(curTestInfo.position == cardId) {
|
|||
|
|
if( curTestInfo.errorState >= 4)
|
|||
|
|
{
|
|||
|
|
workstate = "error"
|
|||
|
|
}
|
|||
|
|
else
|
|||
|
|
{
|
|||
|
|
workstate = "working"
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
function stopTask(state) {
|
|||
|
|
if(state == "finish") {
|
|||
|
|
if(curTestInfo) {
|
|||
|
|
if(curTestInfo.position == cardId) {
|
|||
|
|
workstate = "success"
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
else{
|
|||
|
|
workstate = "idle"
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
Rectangle {
|
|||
|
|
x: 10
|
|||
|
|
y: 10
|
|||
|
|
width: 32
|
|||
|
|
height: 32
|
|||
|
|
radius: 16
|
|||
|
|
color: "white"
|
|||
|
|
Rectangle {
|
|||
|
|
// 信息灯
|
|||
|
|
id: light
|
|||
|
|
width: 30
|
|||
|
|
height: 30
|
|||
|
|
radius: 15
|
|||
|
|
anchors.centerIn: parent
|
|||
|
|
color: workstate == "idle"? "gray" : (workstate == "error"? "red" : (workstate == "success"? "#3096ff" : (workstate == "working"? "#40a362" : "gray")))
|
|||
|
|
// 闪烁动画
|
|||
|
|
Behavior on opacity {
|
|||
|
|
NumberAnimation {
|
|||
|
|
duration: 500
|
|||
|
|
easing.type: Easing.InOutQuad
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
Timer {
|
|||
|
|
id: blinkTimer
|
|||
|
|
interval: 550
|
|||
|
|
running: workstate != "idle" && workstate!= "success"
|
|||
|
|
repeat: true
|
|||
|
|
onTriggered: {
|
|||
|
|
if(light.opacity == 0) {
|
|||
|
|
light.opacity = 1
|
|||
|
|
} else {
|
|||
|
|
light.opacity = 0
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
Rectangle {
|
|||
|
|
width: 30
|
|||
|
|
height: 30
|
|||
|
|
radius: 15
|
|||
|
|
anchors.centerIn: parent
|
|||
|
|
color: workstate == "idle"? "gray" : (workstate == "error"? "red" : (workstate == "success"? "#3096ff" : (workstate == "working"? "#40a362" : "gray")))
|
|||
|
|
visible: workstate == "idle" || workstate == "success"
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
Text {
|
|||
|
|
anchors.centerIn: parent
|
|||
|
|
text: "板 " + cardId
|
|||
|
|
font.pixelSize: 25
|
|||
|
|
font.bold: true
|
|||
|
|
color: "yellow"
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
// TextEdit {
|
|||
|
|
// anchors.centerIn: parent
|
|||
|
|
// font.pixelSize: 14
|
|||
|
|
// color: "white"
|
|||
|
|
// readOnly: true
|
|||
|
|
// text: "This is a test fixture for ImageItem.qml"
|
|||
|
|
// }
|
|||
|
|
}
|