1067 lines
39 KiB
QML
Raw Normal View History

2024-11-25 17:15:44 +08:00
import QtQuick 2.0
2024-11-29 17:47:45 +08:00
import QtQuick.Controls 2.0
2024-11-26 16:21:02 +08:00
import TcpSocket 2.0
2024-11-28 13:38:22 +08:00
import BCIManager 2.0
2024-11-25 17:15:44 +08:00
Item {
2024-11-26 13:43:59 +08:00
property int hitIndex: -1
property bool bStimulate: false
2024-12-18 17:33:35 +08:00
property int responseTime: 6
2024-12-03 13:41:51 +08:00
property bool bTest: false
2024-11-26 16:21:02 +08:00
property bool bConnect: false;
2024-11-29 17:47:45 +08:00
property var brainTrainForm: null
2024-12-02 17:31:09 +08:00
property string red: "#EE6352"
property string green: "#41B962"
property string yellow: "#F8C434"
2024-11-29 17:47:45 +08:00
2024-11-25 17:15:44 +08:00
2024-11-26 13:43:59 +08:00
property int currentIndexTenHz: 0
property var imageFilesTenHz:
[
2024-12-18 17:33:35 +08:00
/*"qrc:/DependFile/Source/brainTrain/girl/girl_00.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_01.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_02.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_03.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_04.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_05.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_06.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_07.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_08.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_09.png",*/
"qrc:/DependFile/Source/brainTrain/test/up/upper_0.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_1.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_2.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_3.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_4.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_5.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_6.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_7.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_8.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_9.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_10.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_11.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_12.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_13.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_14.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_15.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_16.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_17.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_18.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_19.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_20.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_21.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_22.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_23.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_24.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_25.png",
"qrc:/DependFile/Source/brainTrain/test/up/upper_26.png"
2024-11-26 13:43:59 +08:00
]
2024-11-25 17:15:44 +08:00
2024-11-26 13:43:59 +08:00
property int currentIndexTwelevHz: 0
property var imageFilesTwelevHz:
[
2024-12-18 17:33:35 +08:00
/*"qrc:/DependFile/Source/brainTrain/girl/girl_00.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_01.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_02.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_03.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_04.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_05.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_06.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_07.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_08.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_09.png"*/
"qrc:/DependFile/Source/brainTrain/test/down/lower_0.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_1.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_2.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_3.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_4.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_5.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_6.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_7.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_8.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_9.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_10.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_11.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_12.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_13.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_14.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_15.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_16.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_17.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_18.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_19.png",
"qrc:/DependFile/Source/brainTrain/test/down/lower_20.png"
2024-11-26 13:43:59 +08:00
]
2024-11-25 17:15:44 +08:00
2024-11-26 13:43:59 +08:00
property int currentIndexFifteenHz: 0
property var imageFilesFifteenHz:
[
2024-12-18 17:33:35 +08:00
/*"qrc:/DependFile/Source/brainTrain/girl/girl_00.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_01.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_02.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_03.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_04.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_05.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_06.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_07.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_08.png",
"qrc:/DependFile/Source/brainTrain/girl/girl_09.png"*/
"qrc:/DependFile/Source/brainTrain/test/updown/UL_01.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_02.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_03.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_04.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_05.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_06.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_07.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_08.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_09.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_10.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_11.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_12.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_13.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_14.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_15.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_16.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_17.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_18.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_19.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_20.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_21.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_22.png",
"qrc:/DependFile/Source/brainTrain/test/updown/UL_23.png"
2024-12-03 13:41:51 +08:00
];
2024-11-26 13:43:59 +08:00
function startStimulate()
{
2024-12-18 17:33:35 +08:00
if(stimulateTimer.running)
{
stimulateTimer.stop()
}
stimulateTimer.start();
2024-11-26 13:43:59 +08:00
animationTenHz.start();
animationTwelveHz.start();
animationFifteenHz.start();
2024-11-26 16:21:02 +08:00
if(!bConnect)
{
clientSocket.connectToHost();
}
2024-12-03 13:41:51 +08:00
clientSocket.writeBytes(getIntArr("1"));
2024-11-26 13:43:59 +08:00
}
2024-11-29 17:47:45 +08:00
2024-11-26 13:43:59 +08:00
function stopStimulate()
{
2024-12-18 17:33:35 +08:00
if(stimulateTimer.running)
{
stimulateTimer.stop()
}
2024-11-26 13:43:59 +08:00
if(animationTenHz.running)
{
animationTenHz.stop();
flashingImageTenHz.opacity = 1;
}
if(animationTwelveHz.running)
{
animationTwelveHz.stop();
flashingImageTwelveHz.opacity = 1;
}
if(animationFifteenHz.running)
{
animationFifteenHz.stop();
flashingImageFifteenHz.opacity = 1;
}
}
2024-11-29 17:47:45 +08:00
2024-11-26 13:43:59 +08:00
function clearHit()
{
if(hitIndex === 0)
{
ssvepTenHzTimer.stop();
imageTenHz.source = imageFilesTenHz[0];
}else if(hitIndex === 1)
{
ssvepTwelveHzTimer.stop();
imageTwelveHz.source = imageFilesTwelevHz[0];
}else if(hitIndex === 2)
{
ssvepFifteenHzTimer.stop();
imageFifteenHz.source = imageFilesFifteenHz[0];
}
if(hitTimer.running)
{
hitTimer.stop();
}
hitIndex = -1;
}
Timer {
id: hitTimer
2024-11-28 13:38:22 +08:00
interval: responseTime*1000;
2024-11-26 13:43:59 +08:00
repeat: false
onTriggered: {
clearHit();
startStimulate();
}
}
2024-12-18 17:33:35 +08:00
Timer {
id: stimulateTimer
interval: 10*1000;
repeat: false
onTriggered: {
animationTip.start()
if(bStimulate)
{
stimulateTimer.start();
}
}
}
2024-12-03 13:41:51 +08:00
Timer {
id: connectTimer
interval: 3*1000;
onTriggered: {
clientSocket.connected();
}
}
2024-11-26 13:43:59 +08:00
function ssvepHit(index)
{
if(!bStimulate)
{
return;
}
if(hitIndex !== -1)
{
return;
}
2024-12-18 17:33:35 +08:00
if(stimulateTimer.running)
{
stimulateTimer.stop()
}
if(index === "2")
2024-11-26 13:43:59 +08:00
{
ssvepTenHzTimer.start();
hitTimer.start();
2024-12-18 17:33:35 +08:00
bci.startTrain(0,responseTime-2);
2024-12-03 17:57:34 +08:00
hitIndex = 0;
2024-12-18 17:33:35 +08:00
}else if(index === "0")
2024-11-26 13:43:59 +08:00
{
ssvepTwelveHzTimer.start();
hitTimer.start();
2024-12-18 17:33:35 +08:00
bci.startTrain(1,responseTime-2);
2024-12-03 17:57:34 +08:00
hitIndex = 1;
2024-12-18 17:33:35 +08:00
}else if(index === "1")
2024-11-26 13:43:59 +08:00
{
ssvepFifteenHzTimer.start();
hitTimer.start();
2024-12-18 17:33:35 +08:00
bci.startTrain(2,responseTime-2);
2024-12-03 17:57:34 +08:00
hitIndex = 2;
2024-11-26 13:43:59 +08:00
}else
{
2024-12-03 17:57:34 +08:00
hitIndex = -1;
2024-11-26 13:43:59 +08:00
return;
}
2024-12-03 17:57:34 +08:00
2024-11-26 13:43:59 +08:00
}
2024-11-26 16:21:02 +08:00
function getStr(intArr){
var str = "";
for(var i=0;i<intArr.length;i++)
str += String.fromCharCode(intArr[i]);
return str;
}
function getIntArr(str){
var ret = [];
for(var i=0;i<str.length;i++)
ret.push(str.charCodeAt(i));
return ret;
}
2024-11-27 11:21:05 +08:00
function onExit(){
if(bConnect)
{
clientSocket.writeBytes(getIntArr("2"));
return true;
}
return false;
}
function onConnectAndExit(){
clientSocket.connectToHost();
clientSocket.writeBytes(getIntArr("2"));
}
Component.onCompleted:
{
2024-11-28 13:38:22 +08:00
bci.initTrain();
2024-12-03 13:41:51 +08:00
clientSocket.connectToHost();
2024-11-27 11:21:05 +08:00
}
2024-11-29 17:47:45 +08:00
2024-12-03 13:41:51 +08:00
2024-11-26 16:21:02 +08:00
TcpSocket{
id: clientSocket
peer: "127.0.0.1"
port: 8099
onBytesReceived:
{
var cmd = getStr(bytes);
console.info("Client received: " + cmd);
if(cmd !== "0" && cmd !== "1" && cmd !== "2")
{
2024-12-18 17:33:35 +08:00
//判断是不是阻抗数据
var parts = cmd.split(":");
//通道序列号
var channels = [0,1,2,3,4,5,6,7]
for(var i=0;i<channels.length;i++)
{
if(channels[i] < parts.length)
{
if(Number(parts[channels[i]]) < popimpedance.minImpedance)
{
popimpedance.colorChange(i,green)
}else if(Number(parts[channels[i]]) > popimpedance.maxImpedance)
{
popimpedance.colorChange(i,red)
}else
{
popimpedance.colorChange(i,yellow)
}
}
}
2024-11-26 16:21:02 +08:00
return;
}
ssvepHit(cmd);
stopStimulate();
}
onConnected:
{
console.info("Client socket connected");
2024-12-03 13:41:51 +08:00
bConnect = true;
bci.deviceStatus(true);
if(connectTimer.running)
{
connectTimer.stop();
}
2024-11-26 16:21:02 +08:00
}
onDisconnected:
{
console.info("Client socket disconnected");
bConnect = false;
2024-12-03 13:41:51 +08:00
bci.deviceStatus(false);
2024-11-26 16:21:02 +08:00
}
onPeerChanged:
{
console.info("Client socket peer changed: " + peer);
}
onPortChanged:
{
console.info("Client socket port changed: " + port);
}
onError:
2024-12-03 13:41:51 +08:00
{
console.info("Client socket error",socketError);
if(socketError === 0 || socketError === 1)
{
connectTimer.start();
}
2024-11-26 16:21:02 +08:00
}
}
2024-11-28 13:38:22 +08:00
BCIManager
{
id:bci;
}
2024-11-26 16:21:02 +08:00
2024-12-18 17:33:35 +08:00
Rectangle {
width: 300;
height: 60;
anchors.centerIn: parent
opacity: 0
color:"#F9FAFD";
border.width: 1
border.color: "#ADCFDD"
radius: 20;
z:1
Text {
text: qsTr("请集中注意力!")
width: 144;
height: 46;
anchors.top: parent.top;
anchors.topMargin: 6;
anchors.left: parent.left;
anchors.leftMargin: 31;
color: "#10275A";
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pixelSize: 36;
font.family: "Medium";
font.bold: true;
}
SequentialAnimation on opacity {
id: animationTip
running: false;
NumberAnimation { to: 1; duration: 0 }
NumberAnimation { to: 0; duration: 2000 }
}
}
2024-11-26 13:43:59 +08:00
Rectangle{
anchors.top: parent.top
anchors.topMargin: 42
anchors.left: parent.left
anchors.leftMargin: 100
anchors.right: parent.right
anchors.rightMargin: 100
anchors.bottom: parent.bottom
anchors.bottomMargin: 178
Row
{
anchors.centerIn: parent
spacing: 80
Rectangle
{
id:ssvepTenHz
width: 520;
height: 760;
Rectangle
{
width: 520;
height: 450;
anchors.top: parent.top
color:"#F9FAFD";
border.width: 1
border.color: "#ADCFDD"
radius: 20;
Rectangle
{
id:tenHzHit
visible: ssvepTenHzTimer.running
width: 100;
height: 36;
anchors.top: parent.top;
anchors.topMargin: 40;
anchors.right: parent.right;
anchors.rightMargin: 40;
color:Qt.rgba(52,196,163,0.1);
border.width: 1;
border.color: "#34C4A3";
radius: 18;
Rectangle
{
width: 14;
height: 14;
anchors.top: parent.top;
anchors.topMargin: 11;
anchors.left: parent.left;
anchors.leftMargin: 14;
color:"#34C4A3";
border.width: 1;
border.color: "#34C4A3";
radius: 7;
}
Text {
text: qsTr("训练中")
width: 72;
height: 26;
anchors.top: parent.top;
anchors.topMargin: 4;
anchors.left: parent.left;
anchors.leftMargin: 32;
color: "#10275A";
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pixelSize: 18
font.family: "Medium"
}
}
Text {
text: qsTr("上肢训练")
width: 144;
height: 46;
anchors.top: parent.top;
anchors.topMargin: 34;
anchors.left: parent.left;
anchors.leftMargin: 40;
color: "#10275A";
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pixelSize: 36;
font.family: "Medium";
font.bold: true;
}
Text {
text: qsTr("Upper Limbs Training")
width: 194;
height: 28;
anchors.top: parent.top;
anchors.topMargin: 84;
anchors.left: parent.left;
anchors.leftMargin: 40;
color: "#8586A9";
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pixelSize: 20;
font.family: "Medium";
}
Image {
id: flashingImageTenHz
width: 238;
height: 238;
anchors.top: parent.top;
anchors.topMargin: 162;
anchors.left: parent.left;
anchors.leftMargin: 141;
source: "qrc:/DependFile/Source/brainTrain/vision_img_board.png"
opacity: 1
SequentialAnimation on opacity {
id: animationTenHz
running: false;
loops: Animation.Infinite
NumberAnimation { to: 0; duration: 50 }
NumberAnimation { to: 1; duration: 50 }
}
}
}
Item {
width: 520;
height: 280;
anchors.bottom: parent.bottom
Timer {
id: ssvepTenHzTimer
2024-11-28 13:38:22 +08:00
interval: 70;
2024-11-26 13:43:59 +08:00
repeat: true
onTriggered: {
currentIndexTenHz = (currentIndexTenHz + 1) % imageFilesTenHz.length;
imageTenHz.source = imageFilesTenHz[currentIndexTenHz];
}
}
Image {
id: imageTenHz
anchors.centerIn: parent
source: imageFilesTenHz[0]
}
Image {
visible: !ssvepTenHzTimer.running
anchors.centerIn: parent
source: "qrc:/DependFile/Source/brainTrain/vision_btn_start.png"
z:1
}
}
}
Rectangle
{
id:ssvepTwelveHz
width: 520;
height: 760;
Rectangle
{
width: 520;
height: 450;
anchors.top: parent.top
color:"#F9FAFD";
border.width: 1
border.color: "#ADCFDD"
radius: 20;
Rectangle
{
id:twelveHzHit
visible: ssvepTwelveHzTimer.running
width: 100;
height: 36;
anchors.top: parent.top;
anchors.topMargin: 40;
anchors.right: parent.right;
anchors.rightMargin: 40;
color:Qt.rgba(52,196,163,0.1);
border.width: 1;
border.color: "#34C4A3";
radius: 18;
Rectangle
{
width: 14;
height: 14;
anchors.top: parent.top;
anchors.topMargin: 11;
anchors.left: parent.left;
anchors.leftMargin: 14;
color:"#34C4A3";
border.width: 1;
border.color: "#34C4A3";
radius: 7;
}
Text {
text: qsTr("训练中")
width: 72;
height: 26;
anchors.top: parent.top;
anchors.topMargin: 4;
anchors.left: parent.left;
anchors.leftMargin: 32;
color: "#10275A";
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pixelSize: 18
font.family: "Medium"
}
}
Text {
text: qsTr("下肢训练")
width: 144;
height: 46;
anchors.top: parent.top;
anchors.topMargin: 34;
anchors.left: parent.left;
anchors.leftMargin: 40;
color: "#10275A";
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pixelSize: 36;
font.family: "Medium";
font.bold: true;
}
Text {
text: qsTr("Lower Limbs Training")
width: 194;
height: 28;
anchors.top: parent.top;
anchors.topMargin: 84;
anchors.left: parent.left;
anchors.leftMargin: 40;
color: "#8586A9";
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pixelSize: 20;
font.family: "Medium";
}
Image {
id: flashingImageTwelveHz
width: 238;
height: 238;
anchors.top: parent.top;
anchors.topMargin: 162;
anchors.left: parent.left;
anchors.leftMargin: 141;
source: "qrc:/DependFile/Source/brainTrain/vision_img_board.png"
opacity: 1
SequentialAnimation on opacity {
id: animationTwelveHz
running: false;
loops: Animation.Infinite
NumberAnimation { to: 0; duration: 42 }
NumberAnimation { to: 1; duration: 42 }
}
}
}
2024-12-18 17:33:35 +08:00
Rectangle {
2024-11-26 13:43:59 +08:00
width: 520;
height: 280;
anchors.bottom: parent.bottom
2024-12-18 17:33:35 +08:00
radius:20
2024-11-26 13:43:59 +08:00
Timer {
id: ssvepTwelveHzTimer
2024-12-18 17:33:35 +08:00
interval: 70;
2024-11-26 13:43:59 +08:00
repeat: true
onTriggered: {
currentIndexTwelevHz = (currentIndexTwelevHz + 1) % imageFilesTwelevHz.length;
imageTwelveHz.source = imageFilesTwelevHz[currentIndexTwelevHz];
}
}
Image {
id: imageTwelveHz
anchors.centerIn: parent
source: imageFilesTwelevHz[0]
}
Image {
visible: !ssvepTwelveHzTimer.running
anchors.centerIn: parent
source: "qrc:/DependFile/Source/brainTrain/vision_btn_start.png"
z:1
}
}
}
Rectangle
{
id:ssvepFifteenHz
width: 520;
height: 760;
Rectangle
{
width: 520;
height: 450;
anchors.top: parent.top
color:"#F9FAFD";
border.width: 1
border.color: "#ADCFDD"
radius: 20;
Rectangle
{
id:fifteenHzHit
visible: ssvepFifteenHzTimer.running
width: 100;
height: 36;
anchors.top: parent.top;
anchors.topMargin: 40;
anchors.right: parent.right;
anchors.rightMargin: 40;
color:Qt.rgba(52,196,163,0.1);
border.width: 1;
border.color: "#34C4A3";
radius: 18;
Rectangle
{
width: 14;
height: 14;
anchors.top: parent.top;
anchors.topMargin: 11;
anchors.left: parent.left;
anchors.leftMargin: 14;
color:"#34C4A3";
border.width: 1;
border.color: "#34C4A3";
radius: 7;
}
Text {
text: qsTr("训练中")
width: 72;
height: 26;
anchors.top: parent.top;
anchors.topMargin: 4;
anchors.left: parent.left;
anchors.leftMargin: 32;
color: "#10275A";
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pixelSize: 18
font.family: "Medium"
}
}
Text {
text: qsTr("上下肢训练")
width: 144;
height: 46;
anchors.top: parent.top;
anchors.topMargin: 34;
anchors.left: parent.left;
anchors.leftMargin: 40;
color: "#10275A";
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pixelSize: 36;
font.family: "Medium";
font.bold: true;
}
Text {
text: qsTr("Upper and Lower Limb")
width: 194;
height: 28;
anchors.top: parent.top;
anchors.topMargin: 84;
anchors.left: parent.left;
anchors.leftMargin: 40;
color: "#8586A9";
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
font.pixelSize: 20;
font.family: "Medium";
}
Image {
id: flashingImageFifteenHz
width: 238;
height: 238;
anchors.top: parent.top;
anchors.topMargin: 162;
anchors.left: parent.left;
anchors.leftMargin: 141;
source: "qrc:/DependFile/Source/brainTrain/vision_img_board.png"
opacity: 1
SequentialAnimation on opacity {
id: animationFifteenHz
running: false;
loops: Animation.Infinite
NumberAnimation { to: 0; duration: 33 }
NumberAnimation { to: 1; duration: 33 }
}
}
}
Item {
width: 520;
height: 280;
anchors.bottom: parent.bottom
Timer {
id: ssvepFifteenHzTimer
2024-12-18 17:33:35 +08:00
interval: 70;
2024-11-26 13:43:59 +08:00
repeat: true
onTriggered: {
currentIndexFifteenHz = (currentIndexFifteenHz + 1) % imageFilesFifteenHz.length;
imageFifteenHz.source = imageFilesFifteenHz[currentIndexFifteenHz];
}
}
Image {
id: imageFifteenHz
anchors.centerIn: parent
source: imageFilesFifteenHz[0]
}
Image {
visible: !ssvepFifteenHzTimer.running
anchors.centerIn: parent
source: "qrc:/DependFile/Source/brainTrain/vision_btn_start.png"
z:1
}
}
}
}
}
2024-11-29 17:47:45 +08:00
2024-11-26 13:43:59 +08:00
Rectangle
{
width: 286;
height: 88;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 60;
anchors.left: parent.left;
anchors.leftMargin: 817;
color:"#41B962";
border.width: 1
border.color: "#41B962"
radius: 10;
2024-11-29 17:47:45 +08:00
2024-11-26 13:43:59 +08:00
Text {
id:stimulateText
text: qsTr("开始训练")
width: 144;
height: 51;
anchors.top: parent.top;
anchors.topMargin: 18;
anchors.left: parent.left;
anchors.leftMargin: 71;
color: "#FFFFFF";
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 36;
font.family: "Medium";
}
MouseArea
{
anchors.fill: parent
onClicked: {
if(bStimulate)
{
stimulateText.text = "继续";
stopStimulate();
clearHit();
}else
{
stimulateText.text = "暂停";
startStimulate();
}
bStimulate = !bStimulate;
}
}
}
Rectangle
{
width: 86;
height: 88;
visible: bTest
anchors.bottom: parent.bottom;
anchors.bottomMargin: 60;
anchors.left: parent.left;
anchors.leftMargin: 1200;
color:"#41B962";
border.width: 1
border.color: "#41B962"
radius: 10;
Text {
text: qsTr("0")
width: 86;
height: 51;
anchors.top: parent.top;
anchors.topMargin: 18;
anchors.left: parent.left;
anchors.leftMargin: 0;
color: "#FFFFFF";
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 36;
font.family: "Medium";
}
MouseArea
{
anchors.fill: parent
onClicked: {
2024-11-28 13:38:22 +08:00
ssvepHit("0");
2024-11-26 13:43:59 +08:00
stopStimulate();
}
}
}
Rectangle
{
width: 86;
height: 88;
visible: bTest
anchors.bottom: parent.bottom;
anchors.bottomMargin: 60;
anchors.left: parent.left;
anchors.leftMargin: 1300;
color:"#41B962";
border.width: 1
border.color: "#41B962"
radius: 10;
Text {
text: qsTr("1")
width: 86;
height: 51;
anchors.top: parent.top;
anchors.topMargin: 18;
anchors.left: parent.left;
anchors.leftMargin: 0;
color: "#FFFFFF";
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 36;
font.family: "Medium";
}
MouseArea
{
anchors.fill: parent
onClicked: {
2024-11-28 13:38:22 +08:00
ssvepHit("1");
2024-11-26 13:43:59 +08:00
stopStimulate();
}
}
}
Rectangle
{
width: 86;
height: 88;
visible: bTest
anchors.bottom: parent.bottom;
anchors.bottomMargin: 60;
anchors.left: parent.left;
anchors.leftMargin: 1400;
color:"#41B962";
border.width: 1
border.color: "#41B962"
radius: 10;
Text {
text: qsTr("2")
width: 86;
height: 51;
anchors.top: parent.top;
anchors.topMargin: 18;
anchors.left: parent.left;
anchors.leftMargin: 0;
color: "#FFFFFF";
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 36;
font.family: "Medium";
}
MouseArea
{
anchors.fill: parent
onClicked: {
2024-11-28 13:38:22 +08:00
ssvepHit("2");
2024-11-26 13:43:59 +08:00
stopStimulate();
}
}
}
2024-11-29 17:47:45 +08:00
Rectangle
{
width: 160;
height: 70;
anchors.bottom: parent.bottom;
anchors.bottomMargin: 60;
anchors.left: parent.left;
anchors.leftMargin: 100;
color:"#EEF7FD";
// border.width: 1
// border.color: "#41B962"
radius: 10;
Text {
id:impedance
text: qsTr("阻抗")
width: 31;
height: 32;
anchors.top: parent.top;
anchors.topMargin: 18;
anchors.left: parent.left;
anchors.leftMargin: 71;
color: "#0D9DDB";
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: 32;
font.family: "Medium";
}
Image {
id:impedance_image
width:32
height: 32
anchors.top: parent.top;
anchors.topMargin: 18;
anchors.left: parent.left;
anchors.leftMargin: 20;
source: "qrc:/DependFile/Source/brainTrain/btn_Z.png"
}
MouseArea
{
anchors.fill: parent
onClicked: {
2024-12-02 17:07:29 +08:00
popimpedance.show()
2024-12-18 17:33:35 +08:00
popimpedance.colorChange(9,green)
popimpedance.colorChange(10,green)
2024-11-29 17:47:45 +08:00
}
}
}
2024-12-02 17:07:29 +08:00
PopImpedance{
id:popimpedance
2024-12-18 17:33:35 +08:00
property int maxImpedance: 6
property int minImpedance: 3
Timer {
id: impedanceTimer
interval: 1000
repeat: true
onTriggered: {
clientSocket.writeBytes(getIntArr("0"));
}
}
onVisibleChanged:
{
if(visible)
{
impedanceTimer.start();
}else
{
impedanceTimer.stop();
}
}
2024-12-02 17:07:29 +08:00
}
2024-11-25 17:15:44 +08:00
}
2024-11-29 17:47:45 +08:00