This commit is contained in:
curtis
2024-11-25 17:15:44 +08:00
commit 32e5360a91
3749 changed files with 1432905 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
#include "armandleg.h"
#include "ui_armandleg.h"
ArmAndLeg::ArmAndLeg(QWidget *parent) :
QWidget(parent),
ui(new Ui::ArmAndLeg)
{
ui->setupUi(this);
}
ArmAndLeg::~ArmAndLeg()
{
delete ui;
}

View File

@@ -0,0 +1,22 @@
#ifndef ARMANDLEG_H
#define ARMANDLEG_H
#include <QWidget>
namespace Ui {
class ArmAndLeg;
}
class ArmAndLeg : public QWidget
{
Q_OBJECT
public:
explicit ArmAndLeg(QWidget *parent = nullptr);
~ArmAndLeg();
private:
Ui::ArmAndLeg *ui;
};
#endif // ARMANDLEG_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,137 @@
#ifndef ARMORLEG_H
#define ARMORLEG_H
#include <QWidget>
#include <QSound>
#include "Prescriptiondialog.h"
#include "dataformate.h"
#include "machinestartdialog.h"
#include "verticaltohorizondialog.h"
#include "horizontaltoverticaldialog.h"
#include "protectgamestart.h"
class AdvancedDialog;
namespace Ui {
class ArmOrLeg;
}
class ArmOrLeg : public QWidget
{
Q_OBJECT
public:
explicit ArmOrLeg(QWidget *parent = nullptr);
~ArmOrLeg();
/*****设置训练类型****
* 参数@int8_t type 0-单踏车 1-FES踏车
* *****/
void setTrainType(int8_t type);
//保存训练界面所有参数,便于导入处方
void saveTrainParam();
signals:
//发送数据库的训练参数,给参数展示页面
void signalBicycleParamChanged(ST_BicycleParam);
void signalGetBicycleParam();
void saveUpPictureSignal(); //让提title页面保存上面的截图
protected:
void showEvent(QShowEvent *event);
virtual void changeEvent(QEvent* event);
public slots:
//从电刺激界面开启游戏
void slotStartGame();
void slotRecvTrainParamChanged(ST_BicycleParam);
private slots:
//void on_upDownLimp_RadioButton_toggled(bool checked);
void on_advanced1_Btn_clicked();
void on_upAdvanced2_Btn_clicked();
void on_downAdvanced2_Btn_clicked();
void on_next_Btn_clicked();
void on_confirm_Btn_clicked();
// void on_spasmClose2_RadioButton_toggled(bool checked);
// void on_spasmClose1_RadioButton_toggled(bool checked);
// void on_speed1_ComboBox_currentTextChanged(const QString &arg1);
void on_upSpeed2_ComboBox_currentTextChanged(const QString &arg1);
//导出处方信息
void on_importPrescription_Btn_clicked();
// void on_verticalUpLimp_RadioButton_toggled(bool checked);
// void on_downLimp_RadioButton_toggled(bool checked);
void on_moreConfigure_Btn_clicked();
void on_upLimp_Button_toggled(bool checked);
void on_verticalUpLimp_Button_toggled(bool checked);
void on_downLimp_Button_toggled(bool checked);
void on_upDownLimp_Button_toggled(bool checked);
void on_activePassive1_Button_toggled(bool checked);
void on_passive1_Button_toggled(bool checked);
void on_active1_Button_toggled(bool checked);
void on_assistant1_Button_toggled(bool checked);
void on_speedTrain_Button_toggled(bool checked);
void on_forward_Btn_clicked();
void on_backward_Btn_clicked();
void on_YiJianShangJi_Btn_clicked();
private:
void initWidget();
void startFESGamme();
private:
Ui::ArmOrLeg *ui;
AdvancedDialog *m_advanceDialog;
bool m_gameState;
PrescriptionDialog *m_prescriptionDialog;
MachineStartDialog *m_machineStartDialog;
ProtectGameStart *m_protectGameStart;
VerticalToHorizonDialog *m_verticalToHorizontal;
HorizontalToVerticalDialog *m_horizontalToVertical;
ST_BicycleParam m_st_bicycleParam; //从训练界面接收参数
int m_checkedGame;
int m_userID; //保存当前用户,一旦修改用户调整参数
int m_gameIDChecked; //所选择的游戏
bool m_isImportParamWidget; //是否从导入参数界面进来
bool isClickedSave; //是否在参数界面点接了保存数据这样不断返回也不清空m_st_bicycleParam的参数
// bool m_handState; //手的状态是垂直还是水平出现提示框0水平1垂直
bool isMoreConfgClick; //是否从参数页面进来
int m_isClickedGameStart; //是否点击了游戏开始0进入游戏。1不进入游戏防止新游戏被Windows阻塞两次开启游戏
int m_trainType; //0是单他车、1为FES塌车
};
#endif // ARMORLEG_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,36 @@
#include "braintrain.h"
#include "ui_braintrain.h"
brainTrain::brainTrain(QWidget *parent) :
QWidget(parent),
ui(new Ui::brainTrain)
{
ui->setupUi(this);
}
brainTrain::~brainTrain()
{
delete ui;
}
//实现绘制函数:绘制线段
void brainTrain::paintEvent(QPaintEvent *)
{
QPainter painter(this);
QPen pen(QColor("#DBDBDB"));
pen.setWidth(4);
pen.setStyle(Qt::DashLine);
painter.setPen(pen);
painter.drawLine(639, 108, 639,838);
painter.drawLine(1280, 108, 1280,838);
}
void brainTrain::on_startTrain_clicked()
{
MainWindowPageControl::getInstance()->setCurrentPage(visionTrain);
}

View File

@@ -0,0 +1,29 @@
#ifndef BRAINTRAIN_H
#define BRAINTRAIN_H
#include <QWidget>
#include <QPainter>
#include "mainwindowpagecontrol.h"
namespace Ui {
class brainTrain;
}
class brainTrain : public QWidget
{
Q_OBJECT
public:
explicit brainTrain(QWidget *parent = nullptr);
~brainTrain();
private:
Ui::brainTrain *ui;
void paintEvent(QPaintEvent*);
private slots:
void on_startTrain_clicked();
};
#endif // BRAINTRAIN_H

View File

@@ -0,0 +1,197 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>brainTrain</class>
<widget class="QWidget" name="brainTrain">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1920</width>
<height>980</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">#brainTrain{background-color: rgb(255, 255, 255);}</string>
</property>
<widget class="QLabel" name="pictureLabel">
<property name="geometry">
<rect>
<x>170</x>
<y>190</y>
<width>300</width>
<height>300</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/DependFile/Source/brainTrain/brain_icon_vision.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="pictureLabel2">
<property name="geometry">
<rect>
<x>810</x>
<y>190</y>
<width>300</width>
<height>300</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/DependFile/Source/brainTrain/brain_icon_attention.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="pictureLabel3">
<property name="geometry">
<rect>
<x>1450</x>
<y>190</y>
<width>300</width>
<height>300</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/DependFile/Source/brainTrain/brain_icon_both.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>144</x>
<y>646</y>
<width>361</width>
<height>44</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color:#333333;
font-size:44px;
font-weight:500;</string>
</property>
<property name="text">
<string>视觉脑机康复训练</string>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>190</x>
<y>720</y>
<width>271</width>
<height>32</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color:#ADADAD;
font-size:26px;
font-weight:500;</string>
</property>
<property name="text">
<string>视觉诱发肢体运动康复</string>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>806</x>
<y>646</y>
<width>321</width>
<height>44</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color:#333333;
font-size:44px;
font-weight:500;</string>
</property>
<property name="text">
<string>注意力集中训练</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>869</x>
<y>720</y>
<width>191</width>
<height>32</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color:#ADADAD;
font-size:26px;
font-weight:500;</string>
</property>
<property name="text">
<string>注意力集中训练</string>
</property>
</widget>
<widget class="QLabel" name="label_5">
<property name="geometry">
<rect>
<x>1512</x>
<y>646</y>
<width>181</width>
<height>44</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color:#333333;
font-size:44px;
font-weight:500;</string>
</property>
<property name="text">
<string>综合训练</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>1548</x>
<y>716</y>
<width>106</width>
<height>32</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color:#ADADAD;
font-size:26px;
font-weight:500;</string>
</property>
<property name="text">
<string>综合训练</string>
</property>
</widget>
<widget class="QPushButton" name="startTrain">
<property name="geometry">
<rect>
<x>817</x>
<y>812</y>
<width>286</width>
<height>88</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(65, 185, 98);
color: rgb(255, 255, 255);
font-size:36px;
border-radius:10px;</string>
</property>
<property name="text">
<string>进入训练</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,114 @@
#include "eyetrainwidget.h"
#include "ui_eyetrainwidget.h"
eyeTrainWidget::eyeTrainWidget(QWidget *parent) :
QWidget(parent),
ui(new Ui::eyeTrainWidget)
{
ui->setupUi(this);
heartTimer = new QTimer();
heartTimer->setInterval(1000);
heartTimer->start();
connect(heartTimer, SIGNAL(timeout()), this, SLOT(slotHeartTimer()));
m_st_bicycleParam.trainMode = 0; //被动
m_st_bicycleParam.spasmSwitch = 1; //开启
m_st_bicycleParam.spasmLevel = 1; //默认一级
m_st_bicycleParam.configPower = 0; //默认低
m_st_bicycleParam.switchDirectonTime = 10; //换向时间默认10
m_st_bicycleParam.phaseValue = 0; //协同相位值
m_st_bicycleParam.direction = 1; //方向正向
m_st_bicycleParam.speed = 10; //速度 10
m_st_bicycleParam.resistance = 10; //阻力 Nm 0~20挡
m_st_bicycleParam.spasmType = 0; //默认逆向
// int8_t controlState;//状态控制 0-停止 1启动 2-暂停 3-继续
// int8_t bodyPart; //训练部位 0-上肢 1-下肢 2-四肢 3-垂直上肢
// int8_t trainMode; //训练模式 0-被动 1-主动 2-助力 3-等速 4-上下肢协同被动 7-四肢主被动 9-单独主动 10-被动可切主动(主被动)
// int8_t spasmSwitch; //痉挛开关 0-关 1-开
// int8_t spasmLevel; //痉挛等级1~3挡
// int8_t configPower; //配置功率0~2 低中高
// int8_t switchDirectonTime;//换向时间
// int8_t phaseValue; //协同相位值
// int8_t direction; //方向 0-逆向 1-正向
// int8_t speed; //速度 2~60r/min
// int8_t resistance; //阻力 Nm 0~20挡
// int8_t spasmType; //痉挛后方向 1-正向 0-逆向,默认逆向,没有了
// uint8_t trainTime; //训练时间 0~120min
}
eyeTrainWidget::~eyeTrainWidget()
{
heartTimer->stop();
delete ui;
}
void eyeTrainWidget::startTrain(int8_t Part, uint8_t Time)
{
// heartTimer->start();
//状态控制 0-停止 1启动 2-暂停 3-继续
m_st_bicycleParam.controlState = 1;
m_st_bicycleParam.bodyPart = Part; //训练部位 0-上肢 1-下肢 2-四肢 3-垂直上肢
m_st_bicycleParam.trainTime = Time;
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
}
void eyeTrainWidget::stopTrain()
{
heartTimer->stop();
m_st_bicycleParam.controlState = 0;
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
}
void eyeTrainWidget::pauseTrain()
{
m_st_bicycleParam.controlState = 2;
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
}
void eyeTrainWidget::continueTrain()
{
m_st_bicycleParam.controlState = 3;
CCommunicateAPI::getInstance()->sendBicycleParam(m_st_bicycleParam);
}
void eyeTrainWidget::slotQmlStatusChanged(QQuickWidget::Status emStatus)
{
qDebug() << "3342" << emStatus;
}
void eyeTrainWidget::slotHeartTimer()
{
//qDebug()<<"上位机发送心跳";
CCommunicateAPI::getInstance()->sendHeartBeat();
static int num = 0;
++num;
if(num > 3)
{
num = 0;
QPixmap pixmap;
if(heartCount < 1)
{
}
else
{
}
if(heartCount >= 3)
{
heartCount = 0;
}
}
}
/*void eyeTrainWidget::on_startButton_clicked()
{
startTrain(0, 10);
}
void eyeTrainWidget::on_closeButton_clicked()
{
stopTrain();
}*/

View File

@@ -0,0 +1,42 @@
#ifndef EYETRAINWIDGET_H
#define EYETRAINWIDGET_H
#include <QWidget>
#include <QTimer>
#include <QMessageBox>
#include <QDebug>
#include "ccommunicateapi.h"
#include <QQuickWidget>
namespace Ui
{
class eyeTrainWidget;
}
class eyeTrainWidget : public QWidget
{
Q_OBJECT
public:
explicit eyeTrainWidget(QWidget *parent = nullptr);
~eyeTrainWidget();
ST_BicycleParam m_st_bicycleParam; //启动参数
void startTrain(int8_t Part, uint8_t Time);
void stopTrain();
void pauseTrain();
void continueTrain();
private slots:
void slotQmlStatusChanged(QQuickWidget::Status emStatus);
private:
Ui::eyeTrainWidget *ui;
QTimer *heartTimer;
int heartCount; //心跳次数,用于检测通信
private slots:
void slotHeartTimer();
//void on_startButton_clicked();
//void on_closeButton_clicked();
};
#endif // EYETRAINWIDGET_H

View File

@@ -0,0 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>eyeTrainWidget</class>
<widget class="QWidget" name="eyeTrainWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1920</width>
<height>980</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">background-color: rgb(255, 255, 255);</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QQuickWidget" name="quickWidget">
<property name="resizeMode">
<enum>QQuickWidget::SizeRootObjectToView</enum>
</property>
<property name="source">
<url>
<string>qrc:/DependFile/QML/Ssvep.qml</string>
</url>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QQuickWidget</class>
<extends>QWidget</extends>
<header location="global">QtQuickWidgets/QQuickWidget</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,14 @@
#include "fesparamset.h"
#include "ui_fesparamset.h"
FesParamSet::FesParamSet(QWidget *parent) :
QWidget(parent),
ui(new Ui::FesParamSet)
{
ui->setupUi(this);
}
FesParamSet::~FesParamSet()
{
delete ui;
}

View File

@@ -0,0 +1,22 @@
#ifndef FESPARAMSET_H
#define FESPARAMSET_H
#include <QWidget>
namespace Ui {
class FesParamSet;
}
class FesParamSet : public QWidget
{
Q_OBJECT
public:
explicit FesParamSet(QWidget *parent = nullptr);
~FesParamSet();
private:
Ui::FesParamSet *ui;
};
#endif // FESPARAMSET_H

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,822 @@
#include "fessetting.h"
#include "ui_fessetting.h"
#include "festotalparamdialog.h"
#include "channeldialog.h"
#include "channelonlydialog.h"
//#include "mainwindowpagecontrol.h"
//#include "icemodule.h"
#include <QDebug>
#include <QTimer>
#include "languagemanager.h"
#include "fescontroldialog.h"
FesSetting::FesSetting(QWidget *parent) :
QWidget(parent),
ui(new Ui::FesSetting),
m_FesTotalParamDialog(nullptr),
m_ChannelDialog(nullptr),
m_recipeXmlControl(nullptr),
isRunning(false),
m_fesTrainTimer(NULL)
{
ui->setupUi(this);
for(int i = 0;i < 30;i++)
FESABoxList<<true;
for(int i=0; i<=8; i++)
{
isCheckedMuscle[i] = 0;
isChannelConnected[i] = 1; //默认每个是通道打开的
}
//默认显示A电刺激盒
ui->stackedWidget->setCurrentIndex(0);
m_FesTotalParamDialog = new FesTotalParamDialog();
m_ChannelDialog = new ChannelDialog();
m_ChannelOnlyDialog = new ChannelOnlyDialog();
m_recipeXmlControl = new RecipeXmlControl();
initWidget();
m_fesTrainTimer = new QTimer();
batteryTimer = new QTimer();
m_fesTrainTimer->setInterval(60000);
batteryTimer->setInterval(5000); //5s查询电量
batteryTimer->start();
connect(m_fesTrainTimer,&QTimer::timeout,this,&FesSetting::slotTrainTimer);
connect(batteryTimer,&QTimer::timeout,this,&FesSetting::slotGetBattery);
connect(FesControlDialog::getInstance(),SIGNAL(signalGetBattery(int,int)),this,SLOT(slotBatteryChanged(int,int)));
connect(FesControlDialog::getInstance(),SIGNAL(signalDeviceStateChanged(QList<uint8_t>)),this,SLOT(slotDeviceStateChanged(QList<uint8_t>)));
}
FesSetting::~FesSetting()
{
if(m_FesTotalParamDialog)
delete m_FesTotalParamDialog;
if(m_ChannelDialog)
delete m_ChannelDialog;
if(m_recipeXmlControl)
delete m_recipeXmlControl;
if(batteryTimer)
delete batteryTimer;
if(m_ChannelOnlyDialog)
delete m_ChannelOnlyDialog;
delete ui;
}
void FesSetting::switchPage(E_FES_PAGE page)
{
E_fesType = page;
switch(page)
{
case ONLY_FES_E:
{
ui->trainTime_Widget->setVisible(true);
ui->upTime_Widget->setVisible(true);
ui->downTime_Widget->setVisible(true);
ui->openTime_Widget->setVisible(true);
ui->closeTime_Widget->setVisible(true);
ui->plus_Widget->setVisible(false);
}
break;
case BICYCLE_FES_E:
{
ui->trainTime_Widget->setVisible(false);
ui->upTime_Widget->setVisible(false);
ui->downTime_Widget->setVisible(false);
ui->openTime_Widget->setVisible(false);
ui->closeTime_Widget->setVisible(false);
ui->plus_Widget->setVisible(true);
}
break;
}
}
void FesSetting::setChannelState()
{
}
void FesSetting::initWidget()
{
ui->trainTime_Widget->initButton(tr("治疗时间"),"min");
ui->frequent_Widget->initButton(tr("全局频率"),"Hz");
ui->upTime_Widget->initButton(tr("上升时间"),"s");
ui->downTime_Widget->initButton(tr("下降时间"),"s");
ui->openTime_Widget->initButton(tr("打开时间"),"s");
ui->closeTime_Widget->initButton(tr("关闭时间"),"s");
ui->plus_Widget->initButton(tr("全局脉宽"),"μs");
/*
else if (language == English_E) //初始化英文暂停和结束
{
ui->trainTime_Widget->initButton("Treatment Time","min");
ui->frequent_Widget->initButton("Global Frequency","Hz");
ui->upTime_Widget->initButton("Rise Time","s");
ui->downTime_Widget->initButton("Fall Time","s");
ui->openTime_Widget->initButton("Open Time","s");
ui->closeTime_Widget->initButton("Close Time","s");
ui->plus_Widget->initButton("Global pulse duration","μs");
}*/
ui->channelA1_Widget->initWidget(tr("A1"),1);
channelList.append(ui->channelA1_Widget);
ui->channelA2_Widget->initWidget(tr("A2"),2);
channelList.append(ui->channelA2_Widget);
ui->channelA3_Widget->initWidget(tr("B1"),3);
channelList.append(ui->channelA3_Widget);
ui->channelA4_Widget->initWidget(tr("B2"),4);
channelList.append(ui->channelA4_Widget);
ui->channelA5_Widget->initWidget(tr("C1"),5);
channelList.append(ui->channelA5_Widget);
ui->channelA6_Widget->initWidget(tr("C2"),6);
channelList.append(ui->channelA6_Widget);
ui->channelA7_Widget->initWidget(tr("D1"),7);
channelList.append(ui->channelA7_Widget);
ui->channelA8_Widget->initWidget(tr("D2"),8);
channelList.append(ui->channelA8_Widget);
foreach(QWidget *widget,channelList)
{
connect(widget,SIGNAL(muscleButtonClicked(int)),this,SLOT(slotChannelWidgetClicked(int)));
//测试使用2024.9.30
widget->setEnabled(false);
}
connect(ui->trainTime_Widget,SIGNAL(fesButtonClicked()),this,SLOT(slotTrainTimeBtnClicked()));
connect(ui->frequent_Widget,SIGNAL(fesButtonClicked()),this,SLOT(slotFrequentBtnClicked()));
connect(ui->upTime_Widget,SIGNAL(fesButtonClicked()),this,SLOT(slotUpTimeBtnClicked()));
connect(ui->downTime_Widget,SIGNAL(fesButtonClicked()),this,SLOT(slotDownTimeBtnClicked()));
connect(ui->openTime_Widget,SIGNAL(fesButtonClicked()),this,SLOT(slotOpenTimeBtnClicked()));
connect(ui->closeTime_Widget,SIGNAL(fesButtonClicked()),this,SLOT(slotCloseTimeBtnClicked()));
connect(ui->plus_Widget,SIGNAL(fesButtonClicked()),this,SLOT(slotPlusBtnClicked()));
QButtonGroup *buttonGroup = new QButtonGroup();
buttonGroup->addButton(ui->FESA_Btn);
buttonGroup->addButton(ui->FESB_Btn);
ui->FESA_Btn->setVisible(false);
ui->FESB_Btn->setVisible(false);
// buttonGroup->setExclusive(true);
}
void FesSetting::sendAllChannelParam()
{
//发送单FES数据给打开的的电刺激修改全局变量
for(int i = 1;i <= 8;++i)
{
int channel = i;
//if(channel > 8)
//channel-=8;
MuscleButton* muscleChannel = dynamic_cast<MuscleButton*>(channelList.at(i-1));
if(muscleChannel->isEnabled() == false)
continue; //如果该通道是灰色的
ST_MuscleParam st_muscleParam = muscleChannel->getMuscleParam();
ST_OnlyFESParam st_onlyFesParam;
st_onlyFesParam.mode = 2;
st_onlyFesParam.sampleRate = 1;
st_onlyFesParam.frequency = st_muscleParam.frequency;
st_onlyFesParam.pulseWidth = st_muscleParam.plus;
st_onlyFesParam.waveRise = ui->upTime_Widget->getValue()*1000;
st_onlyFesParam.waveFall = ui->downTime_Widget->getValue()*1000;
st_onlyFesParam.keepTime = ui->openTime_Widget->getValue()*1000;
st_onlyFesParam.sleepTime = ui->closeTime_Widget->getValue()*1000;
int deviceNo = channel/2 + (channel%2?1:0);
int devcieChannle = channel%2 ? 1:2;
FesControlDialog::getInstance()->setOnlyFesParam(deviceNo,devcieChannle,st_onlyFesParam);
}
}
void FesSetting::slotChannelWidgetClicked(int id)
{
int channel = id;
if(channel > 8)
channel-=8;
if(E_fesType == BICYCLE_FES_E) //点击了肌肉,必然会有肌肉
{
isCheckedMuscle[id] = 1;
}
else if(E_fesType == ONLY_FES_E)
{
}
qDebug()<<"Hello1";
//qDebug() <<"按钮ID:"<<id;
foreach(QWidget *widget,channelList)
{
MuscleButton* muscleChannel = dynamic_cast<MuscleButton*>(widget);
int muscleId = muscleChannel->getMuscleParam().muscleId;
qDebug() <<"muscleId:"<<muscleId;
if(muscleId && E_fesType == BICYCLE_FES_E)//此状态list应从muscleButton中去找而不应从弹窗中找
FESABoxList[muscleId-1] = false; //单独电刺激没有肌肉ID
}
qDebug()<<"Hello2";
MuscleButton* muscleChannel = dynamic_cast<MuscleButton*>(channelList.at(id-1));
ST_MuscleParam st_muscleParam = muscleChannel->getMuscleParam();
//设置可调节的参数
//频率
int tempValue = ui->frequent_Widget->getValue();
//脉宽
tempValue = ui->plus_Widget->getValue();
int deviceNo = channel/2 + (channel%2?1:0);
int devcieChannle = channel%2 ? 1:2;
if(E_fesType == ONLY_FES_E)
{
m_ChannelOnlyDialog->setTitle(channel);
m_ChannelOnlyDialog->setMuscleState(FESABoxList);
m_ChannelOnlyDialog->setPlusRange(50,500);
m_ChannelOnlyDialog->setFrequentRange(10,tempValue);
m_ChannelOnlyDialog->setFrequentValue(st_muscleParam.frequency);
m_ChannelOnlyDialog->setPlusValue(st_muscleParam.plus);
m_ChannelOnlyDialog->setMaxCurrentValue(0);
m_ChannelOnlyDialog->setMinCurrentValue(0);
m_ChannelOnlyDialog->setMuscleConnectState(isChannelConnected[id]);
//m_ChannelOnlyDialog->setMuscleId(st_muscleParam.muscleId);
//设置调参界面状态(运行期间只可以调节最大电流)
// m_ChannelDialog->setChannleDialogState(isRunning);
//显示通道对话框
m_ChannelOnlyDialog->exec();
ST_MuscleParam st_OnlyChannelMuscleParam = m_ChannelOnlyDialog->getValue();
muscleChannel->setMuscleParamButton(st_OnlyChannelMuscleParam);
muscleChannel->setMuscleEnabled(st_OnlyChannelMuscleParam.connectState);
muscleChannel->setCheckedFesType(E_fesType); //
isChannelConnected[id] = st_OnlyChannelMuscleParam.connectState; //保存肌肉通道连接状态
//单独电刺激参数
ST_OnlyFESParam st_onlyFesParam;
st_onlyFesParam.mode = 2;
st_onlyFesParam.sampleRate = 1;
st_onlyFesParam.waveStyle = 1;
st_onlyFesParam.frequency = st_OnlyChannelMuscleParam.frequency;
st_onlyFesParam.pulseWidth = st_OnlyChannelMuscleParam.plus;
st_onlyFesParam.waveRise = ui->upTime_Widget->getValue()*1000;
st_onlyFesParam.waveFall = ui->downTime_Widget->getValue()*1000;
st_onlyFesParam.keepTime = ui->openTime_Widget->getValue()*1000;
st_onlyFesParam.sleepTime = ui->closeTime_Widget->getValue()*1000;
if(st_OnlyChannelMuscleParam.connectState)
FesControlDialog::getInstance()->setOnlyFesParam(deviceNo,devcieChannle,st_onlyFesParam);
}
else if(E_fesType == BICYCLE_FES_E)
{
m_ChannelDialog->setTitle(channel);
m_ChannelDialog->setMuscleState(FESABoxList);
m_ChannelDialog->setFrequentRange(10,tempValue);
m_ChannelDialog->setPlusRange(50,tempValue);
//设置参数
m_ChannelDialog->setFrequentValue(st_muscleParam.frequency);
m_ChannelDialog->setPlusValue(st_muscleParam.plus);
m_ChannelDialog->setMaxCurrentValue(0);
m_ChannelDialog->setMinCurrentValue(0);
m_ChannelDialog->setMuscleId(st_muscleParam.muscleId);
//设置调参界面状态(运行期间只可以调节最大电流)
m_ChannelDialog->setChannleDialogState(isRunning);
m_ChannelDialog->setMuscleConnectState(isChannelConnected[id]);
//显示通道对话框
m_ChannelDialog->exec();
ST_MuscleParam st_tempMuscleParam = m_ChannelDialog->getValue(); //单独电刺激肌肉名称为空
st_channelChangedMuscleParams[id] = st_tempMuscleParam;
//qDebug() <<"i"<<id<<st_tempMuscleParam.minCurrent<<st_tempMuscleParam.maxCurrent;
isChannelConnected[id] = st_tempMuscleParam.connectState;
ST_MuscleParam st_MuscleParam = m_ChannelDialog->getValue(); //单独电刺激肌肉名称为空
muscleChannel->setMuscleParamButton(st_MuscleParam);
muscleChannel->setCheckedFesType(E_fesType);
//根据状态设置按钮的状态
muscleChannel->setMuscleEnabled(st_MuscleParam.connectState);
//将参数发送给下位机
ST_FESSetParam st_fesParam;
st_fesParam.mode = 2;
st_fesParam.sampleRate = 1;
st_fesParam.waveStyle = 1;
st_fesParam.frequency = st_MuscleParam.frequency;
st_fesParam.pulseWidth = st_MuscleParam.plus;
st_fesParam.minCurrent = st_MuscleParam.minCurrent;
st_fesParam.maxCurrent = st_MuscleParam.maxCurrent;
//设置起止电流
if(!m_recipeXmlControl->getFESRecipes().isEmpty() && !m_recipeXmlControl->getFESRecipesReverse().isEmpty())
{
int muscleId = st_MuscleParam.muscleId;
if(muscleId > 15)
muscleId -= 15;
st_fesParam.startAngle = m_recipeXmlControl->getFESRecipes().at(muscleId-1).startAngle;
st_fesParam.stopAgnle = m_recipeXmlControl->getFESRecipes().at(muscleId-1).stopAngle;
st_fesParam.startAngleReverse = m_recipeXmlControl->getFESRecipesReverse().at(muscleId-1).startAngle;
st_fesParam.stopAgnleReverse = m_recipeXmlControl->getFESRecipesReverse().at(muscleId-1).stopAngle;
qDebug() <<""<<st_fesParam.startAngle<<" "<<st_fesParam.stopAgnle<<" "<<st_fesParam.startAngleReverse<< " "<<st_fesParam.stopAgnleReverse;
//判断上下肢
if(muscleId <= 8)
{
qDebug()<<"上肢";
st_fesParam.upDownLimp = 1;
}
else
{
qDebug()<<"下肢";
st_fesParam.upDownLimp = 2;
}
//判断左右手
if(st_MuscleParam.muscleId > 15)
{
qDebug()<<"右侧";
st_fesParam.leftRightLimp = 2;
}
else
{
qDebug()<<"左侧";
st_fesParam.leftRightLimp = 1;
}
}
else qDebug() <<"XML为空";
qDebug() <<"Hello1";
if(st_MuscleParam.connectState)
{
FesControlDialog::getInstance()->setFesParam(deviceNo,devcieChannle,st_fesParam);
qDebug()<<"11111111111"<<st_fesParam.startAngle<<st_fesParam.stopAgnle;
}
}
//保存参数
//if(E_fesType == ONLY_FES_E)
// FesControlDialog::getInstance()->saveOnlyFesParam(st_onlyFesParam);
// // else if(E_fesType == BICYCLE_FES_E)
// FesControlDialog::getInstance()->saveBicycleFesParam(st_fesParam);
}
//该函数在换成英文后调用两次,不知道啥原因,切换导致出现调用次数增加
void FesSetting::slotTrainTimeBtnClicked()
{
m_FesTotalParamDialog->setTitleAndUnit(tr("训练时间"),"min");
m_FesTotalParamDialog->setRange(1,120);
int oldValue = ui->trainTime_Widget->getValue();
m_FesTotalParamDialog->setValue(oldValue);
m_FesTotalParamDialog->show();
m_FesTotalParamDialog->exec();
int newValue = m_FesTotalParamDialog->getValue();
ui->trainTime_Widget->setData(newValue);
}
void FesSetting::slotFrequentBtnClicked()
{
m_FesTotalParamDialog->setTitleAndUnit(tr("全局频率"),"Hz");
m_FesTotalParamDialog->setRange(10,100);
int oldValue = ui->frequent_Widget->getValue();
m_FesTotalParamDialog->setValue(oldValue);
m_FesTotalParamDialog->show();
m_FesTotalParamDialog->exec();
int newValue = m_FesTotalParamDialog->getValue();
ui->frequent_Widget->setData(newValue);
sendAllChannelParam();
}
void FesSetting::slotPlusBtnClicked()
{
m_FesTotalParamDialog->setTitleAndUnit(tr("全局脉宽"),"μs");
m_FesTotalParamDialog->setRange(50,500);
int oldValue = ui->plus_Widget->getValue();
m_FesTotalParamDialog->setValue(oldValue);
m_FesTotalParamDialog->show();
m_FesTotalParamDialog->exec();
int newValue = m_FesTotalParamDialog->getValue();
ui->plus_Widget->setData(newValue);
sendAllChannelParam();
}
void FesSetting::slotUpTimeBtnClicked()
{
m_FesTotalParamDialog->setRange(0,30);
m_FesTotalParamDialog->setTitleAndUnit(tr("上升时间"),"s");
int oldValue = ui->upTime_Widget->getValue();
m_FesTotalParamDialog->setValue(oldValue);
m_FesTotalParamDialog->show();
m_FesTotalParamDialog->exec();
int newValue = m_FesTotalParamDialog->getValue();
ui->upTime_Widget->setData(newValue);
sendAllChannelParam();
// if(st_MuscleParam.connectState)
//FesControlDialog::getInstance()->setPreCurrentState(m_deviceNo,m_deviceChannel,false);
}
void FesSetting::slotDownTimeBtnClicked()
{
m_FesTotalParamDialog->setRange(0,30);
m_FesTotalParamDialog->setTitleAndUnit(tr("下降时间"),"s");
int oldValue = ui->downTime_Widget->getValue();
m_FesTotalParamDialog->setValue(oldValue);
m_FesTotalParamDialog->show();
m_FesTotalParamDialog->exec();
int newValue = m_FesTotalParamDialog->getValue();
ui->downTime_Widget->setData(newValue);
sendAllChannelParam();
}
void FesSetting::slotOpenTimeBtnClicked()
{
m_FesTotalParamDialog->setTitleAndUnit(tr("打开时间"),"s");
int oldValue = ui->openTime_Widget->getValue();
m_FesTotalParamDialog->setValue(oldValue);
m_FesTotalParamDialog->show();
m_FesTotalParamDialog->exec();
int newValue = m_FesTotalParamDialog->getValue();
ui->openTime_Widget->setData(newValue);
sendAllChannelParam();
}
void FesSetting::slotCloseTimeBtnClicked()
{
m_FesTotalParamDialog->setTitleAndUnit(tr("关闭时间"),"s");
int oldValue = ui->closeTime_Widget->getValue();
m_FesTotalParamDialog->setValue(oldValue);
m_FesTotalParamDialog->show();
m_FesTotalParamDialog->exec();
int newValue = m_FesTotalParamDialog->getValue();
ui->closeTime_Widget->setData(newValue);
sendAllChannelParam();
}
void FesSetting::on_FESA_Btn_clicked()
{
ui->stackedWidget->setCurrentIndex(0);
}
void FesSetting::on_FESB_Btn_clicked()
{
ui->stackedWidget->setCurrentIndex(1);
}
//从该界面启动游戏
void FesSetting::on_OK_Btn_clicked()
{
switch (E_fesType) {
case ONLY_FES_E://单纯电刺激
{
if(ui->OK_Btn->text() == tr("开始"))
{
m_fesTrainTimer->start();
ui->trainTime_Widget->setTitle(tr("剩余时间"));
m_trainTime = ui->trainTime_Widget->getValue();
isRunning = true;
ui->OK_Btn->setText(tr("结束"));
switchFES(true);//打开电刺激
}
else if(ui->OK_Btn->text() == tr("结束"))
{
switchFES(false);//关闭电刺激
isRunning = false;
ui->OK_Btn->setText(tr("开始"));
m_fesTrainTimer->stop();
ui->trainTime_Widget->setTitle(tr("治疗时间"));
// switchFES(false);//打开电刺激
}
}
break;
case BICYCLE_FES_E: //FES踏车
{
//启动游戏
emit signalStartGame();
}
break;
}
}
void FesSetting::slotTrainTimer()
{
m_trainTime--;
ui->trainTime_Widget->setData(m_trainTime);
//治疗结束
if(0 == m_trainTime)
{
on_OK_Btn_clicked();
}
}
void FesSetting::slotGetBattery()
{
for(int i = 1;i <= 4;++i) //4个设备
{
if(FesControlDialog::getInstance()->getDeviceStateByNo(i))
{
FesControlDialog::getInstance()->queryDeviceState(i);
// qDebug()<<"查询电量:"<<i;
}
// else
// qDebug()<<"未连接:"<<i;
}
}
void FesSetting::slotBatteryChanged(int deviceNo,int batteryValue)//设备1-4
{
//MuscleButton* muscleChannel = dynamic_cast<MuscleButton*>(channelList.at(2*i));
if(FesControlDialog::getInstance()->getDeviceStateByNo(deviceNo))
{
MuscleButton* muscleChannel1 = dynamic_cast<MuscleButton*>(channelList.at(2*(deviceNo-1)));
MuscleButton* muscleChannel2 = dynamic_cast<MuscleButton*>(channelList.at(2*(deviceNo-1)+1));
//int batteryValue1 = FesControlDialog::getInstance()->getBatteryValue(i);
muscleChannel1->setBLEBattery(batteryValue);
muscleChannel2->setBLEBattery(batteryValue);
}
}
void FesSetting::slotDeviceStateChanged(QList<uint8_t> deviceState)
{
if(deviceState.at(0))
{
ui->channelA1_Widget->setEnabled(true);
ui->channelA2_Widget->setEnabled(true);
}
else
{
ui->channelA1_Widget->setEnabled(false);
ui->channelA2_Widget->setEnabled(false);
}
for(int i = 0;i < deviceState.size();++i)
{
if(deviceState.at(i))
{
channelList.at(2*i)->setEnabled(true);
MuscleButton* muscleChannel1 = dynamic_cast<MuscleButton*>(channelList.at(2*i));
muscleChannel1->setConnectState(true);
channelList.at(2*i + 1)->setEnabled(true);
MuscleButton* muscleChannel2 = dynamic_cast<MuscleButton*>(channelList.at(2*i+1));
muscleChannel2->setConnectState(true);
//电量设置
//int batteryValue1 = FesControlDialog::getInstance()->getBatteryValue(i);
//muscleChannel1->setBLEBattery(batteryValue1);
//muscleChannel2->setBLEBattery(batteryValue1);
}
else
{
channelList.at(2*i)->setEnabled(false);
MuscleButton* muscleChannel1 = dynamic_cast<MuscleButton*>(channelList.at(2*i));
muscleChannel1->setConnectState(false);
channelList.at(2*i + 1)->setEnabled(false);
MuscleButton* muscleChannel2 = dynamic_cast<MuscleButton*>(channelList.at(2*i+1));
muscleChannel2->setConnectState(false);
muscleChannel1->setBLEBattery(0);
muscleChannel2->setBLEBattery(0);
}
// qDebug()<< channelList.at(2*i)->isEnabled()<< channelList.at(2*i)->isEnabled()<<" ";
}
}
void FesSetting::switchFES(bool on)
{
for(int i = 0;i < 8;i++)
{
MuscleButton* muscleChannel = dynamic_cast<MuscleButton*>(channelList.at(i));
ST_MuscleParam st_muscleParam = muscleChannel->getMuscleParam();
if(st_muscleParam.connectState)
{
int deviceNo = i/2 + 1;
int devcieChannle = (i+1)%2 ? 1:2;
FesControlDialog::getInstance()->switchDeviceChannel(deviceNo,devcieChannle,on);
}
}
}
void FesSetting::switchBicycleFES(bool on)
{
for(int i = 0;i < 8;i++)
{
MuscleButton* muscleChannel = dynamic_cast<MuscleButton*>(channelList.at(i));
ST_MuscleParam st_muscleParam = muscleChannel->getMuscleParam();
if(st_muscleParam.connectState)
{
int deviceNo = i/2 + 1;
int devcieChannle = (i+1)%2 ? 1:2;
FesControlDialog::getInstance()->switchDeviceChannel(deviceNo,devcieChannle,on);
}
}
}
void FesSetting::changeEvent(QEvent* event)
{
switch (event->type())
{
case QEvent::LanguageChange:
{
E_LANGUAGE language = LanguageManager::getInstance()->getCurrentLanguage();
switch(language)
{
case Chinese_E:
{
ui->trainTime_Widget->initButton(tr("治疗时间"),"min");
ui->frequent_Widget->initButton(tr("全局频率"),"Hz");
ui->upTime_Widget->initButton(tr("上升时间"),"s");
ui->downTime_Widget->initButton(tr("下降时间"),"s");
ui->openTime_Widget->initButton(tr("打开时间"),"s");
ui->closeTime_Widget->initButton(tr("关闭时间"),"s");
ui->plus_Widget->initButton(tr("全局脉宽"),"μs");
}; break;
case English_E:
{
ui->trainTime_Widget->initButton(tr("Treatment Time"),"min");
ui->frequent_Widget->initButton(tr("Global Frequency"),"Hz");
ui->upTime_Widget->initButton(tr("Rise Time"),"s");
ui->downTime_Widget->initButton(tr("Fall Time"),"s");
ui->openTime_Widget->initButton(tr("Open Time"),"s");
ui->closeTime_Widget->initButton(tr("Close Time"),"s");
ui->plus_Widget->initButton(tr("Global pulse duration"),"μs");
qDebug() <<"改变语言"<<language;
};break;
}
ui->retranslateUi(this);
} break;
default:
{
QWidget::changeEvent(event);
}
break;
}
//for(int i=1; i<=8; i++)
// if(E_fesType == BICYCLE_FES_E && isCheckedMuscle[i] == 1)
//{
//qDebug()<<"i:"<<i;
// MuscleButton* muscleChannel = dynamic_cast<MuscleButton*>(channelList.at(i-1));
/*ST_MuscleParam tempMuscleParam;
tempMuscleParam.muscleId = 0;
tempMuscleParam.muscleName = "";
tempMuscleParam.maxCurrent = 0;
tempMuscleParam.minCurrent = 0;
tempMuscleParam.plus = 200;
tempMuscleParam.frequency = 10;
muscleChannel->setMuscleParamButton(tempMuscleParam);
qDebug() <<"FES车点击为0:"<<i;*/
// muscleChannel->setCheckedFesType(BICYCLE_FES_E);
//}
}
void FesSetting::showEvent(QShowEvent *event)
{
Q_UNUSED(event)
ui->trainTime_Widget->setData(20);
ui->frequent_Widget->setData(100);
ui->upTime_Widget->setData(2);
ui->downTime_Widget->setData(2);
ui->openTime_Widget->setData(10);
ui->closeTime_Widget->setData(10);
ui->plus_Widget->setData(200);
ui->OK_Btn->setText(tr("开始"));
switch(E_fesType)
{
case ONLY_FES_E://
{
qDebug() <<"E_fesType:单纯电刺激";
for(int i=1; i<=8; i++)
//if(isCheckedMuscle[i] == 1) //按照上一次显示的
{
MuscleButton* muscleChannel = dynamic_cast<MuscleButton*>(channelList.at(i-1));
ST_MuscleParam tempMuscleParam;
tempMuscleParam.muscleId = 0;
tempMuscleParam.muscleName = "";
tempMuscleParam.maxCurrent = 0;
tempMuscleParam.minCurrent = 0;
tempMuscleParam.plus = 200;
tempMuscleParam.frequency = 10;
muscleChannel->setMuscleParamButton(tempMuscleParam);
qDebug() <<"窗体i:"<<i;
muscleChannel->setCheckedFesType(E_fesType);
}
}
break;
case BICYCLE_FES_E: //FES踏车
{
for(int i=1; i<=8; i++)
if(isCheckedMuscle[i] == 1)
{
//I==2,I==3;
MuscleButton* muscleChannel = dynamic_cast<MuscleButton*>(channelList.at(i-1));
//if()
muscleChannel->setMuscleParamButton(st_channelChangedMuscleParams[i]);
qDebug() <<"FES车点击为1:"<<i;
muscleChannel->setCheckedFesType(E_fesType);
//if(muscleChannel->getMuscleParam().maxCurrent)
//ST_MuscleParam st_MuscleParam = m_ChannelDialog->getValue(); //单独电刺激肌肉名称为空
//st_channelChangedMuscleParams[id] = st_MuscleParam;
}
else if(isCheckedMuscle[i] == 0)
{
//qDebug()<<"i:"<<i;
MuscleButton* muscleChannel = dynamic_cast<MuscleButton*>(channelList.at(i-1));
ST_MuscleParam tempMuscleParam;
tempMuscleParam.muscleId = 0;
tempMuscleParam.muscleName = "";
tempMuscleParam.maxCurrent = 0;
tempMuscleParam.minCurrent = 0;
tempMuscleParam.plus = 200;
tempMuscleParam.frequency = 10;
muscleChannel->setMuscleParamButton(tempMuscleParam);
qDebug() <<"FES车点击为0:"<<i;
muscleChannel->setCheckedFesType(ONLY_FES_E);
}
}
break;
}
//从单独电刺激和游戏电刺激进入,进行初始化,区分显示肌肉和部位
}

View File

@@ -0,0 +1,101 @@
#ifndef FESSETTING_H
#define FESSETTING_H
#include "recipexmlcontrol.h"
#include <QWidget>
#include "dataformate.h"
#include <QMetaType>
class QTimer;
class FesTotalParamDialog;
class ChannelDialog;
class ChannelOnlyDialog;
namespace Ui {
class FesSetting;
}
class FesSetting : public QWidget
{
Q_OBJECT
public:
explicit FesSetting(QWidget *parent = nullptr);
~FesSetting();
void switchPage(E_FES_PAGE);
void initWidget();
//根据刺激盒的反馈来设置通道状态
void setChannelState();
void sendAllChannelParam(); //检查8个通道并发送全局参数
protected:
virtual void changeEvent(QEvent* event);
virtual void showEvent(QShowEvent *event);
public slots:
void slotDeviceStateChanged(QList<uint8_t>);
private slots:
void slotTrainTimeBtnClicked();
void slotFrequentBtnClicked();
void slotUpTimeBtnClicked();
void slotDownTimeBtnClicked();
void slotOpenTimeBtnClicked();
void slotCloseTimeBtnClicked();
void slotPlusBtnClicked();
void slotChannelWidgetClicked(int id);
void on_FESA_Btn_clicked();
void on_FESB_Btn_clicked();
void on_OK_Btn_clicked();
void slotTrainTimer();
void slotGetBattery();
void slotBatteryChanged(int deviceNo,int batteryValue);
signals:
//开启游戏界面
void signalStartGame();
private:
//控制单独电刺激
void switchFES(bool on);
//控制踏车电刺激
void switchBicycleFES(bool on);
private:
Ui::FesSetting *ui;
FesTotalParamDialog *m_FesTotalParamDialog;
QList<QWidget*> channelList; //MuscleButton
ChannelDialog *m_ChannelDialog;
ChannelOnlyDialog *m_ChannelOnlyDialog;
RecipeXmlControl *m_recipeXmlControl;
QList<bool> FESABoxList; //连接通道
E_FES_PAGE E_fesType;
bool isRunning;
QTimer *m_fesTrainTimer;
QTimer *batteryTimer;
int m_trainTime;
bool isCheckedMuscle[9]; //判断8个通道是否选择了肌肉图标用于隐藏和显示
ST_MuscleParam st_channelChangedMuscleParams[9]; //每个通道的肌肉修改值,用于初始化
bool isChannelConnected[9]; //判断每个通道是否开启
};
#endif // FESSETTING_H

View File

@@ -0,0 +1,450 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>FesSetting</class>
<widget class="QWidget" name="FesSetting">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1920</width>
<height>980</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">#FesSetting{background: #FFFFFF;}</string>
</property>
<widget class="QPushButton" name="FESA_Btn">
<property name="geometry">
<rect>
<x>50</x>
<y>230</y>
<width>180</width>
<height>60</height>
</rect>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>15</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">#FESA_Btn{background: #EFEFEF;
border-radius: 4px 4px 0px 0px;}
#FESA_Btn:checked{background: #0D9DDB;
border-radius: 4px 4px 0px 0px;
color:white;}</string>
</property>
<property name="text">
<string>A刺激盒</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="FESB_Btn">
<property name="geometry">
<rect>
<x>240</x>
<y>230</y>
<width>180</width>
<height>60</height>
</rect>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>15</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">#FESB_Btn{background: #EFEFEF;
border-radius: 4px 4px 0px 0px;}
#FESB_Btn:checked{background: #0D9DDB;
border-radius: 4px 4px 0px 0px;
color:white;}</string>
</property>
<property name="text">
<string>B刺激盒</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
<widget class="FesParamBtn" name="trainTime_Widget" native="true">
<property name="geometry">
<rect>
<x>80</x>
<y>30</y>
<width>250</width>
<height>170</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget{background: #E4F4FC;}</string>
</property>
</widget>
<widget class="FesParamBtn" name="frequent_Widget" native="true">
<property name="geometry">
<rect>
<x>380</x>
<y>30</y>
<width>250</width>
<height>170</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget{background: #E4F4FC;}</string>
</property>
</widget>
<widget class="FesParamBtn" name="upTime_Widget" native="true">
<property name="geometry">
<rect>
<x>683</x>
<y>30</y>
<width>250</width>
<height>170</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget{background: #E4F4FC;}</string>
</property>
</widget>
<widget class="FesParamBtn" name="openTime_Widget" native="true">
<property name="geometry">
<rect>
<x>1286</x>
<y>30</y>
<width>250</width>
<height>170</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget{background: #E4F4FC;}</string>
</property>
</widget>
<widget class="FesParamBtn" name="downTime_Widget" native="true">
<property name="geometry">
<rect>
<x>985</x>
<y>30</y>
<width>250</width>
<height>170</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget{background: #E4F4FC;}</string>
</property>
</widget>
<widget class="FesParamBtn" name="closeTime_Widget" native="true">
<property name="geometry">
<rect>
<x>1588</x>
<y>30</y>
<width>250</width>
<height>170</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget{background: #E4F4FC;}</string>
</property>
</widget>
<widget class="QPushButton" name="OK_Btn">
<property name="geometry">
<rect>
<x>1710</x>
<y>860</y>
<width>160</width>
<height>70</height>
</rect>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>15</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">background: #05A6EC;
border-radius: 4px;
color:white;</string>
</property>
<property name="text">
<string>开始</string>
</property>
</widget>
<widget class="QStackedWidget" name="stackedWidget">
<property name="geometry">
<rect>
<x>50</x>
<y>290</y>
<width>1820</width>
<height>532</height>
</rect>
</property>
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="ABox_Page">
<widget class="QGroupBox" name="groupBox_7">
<property name="geometry">
<rect>
<x>1</x>
<y>0</y>
<width>1818</width>
<height>530</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#groupBox_7{background: #FFFFFF;border-radius: 2px 2px 2px 2px;
border: 1px solid #05A6EC;}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="MuscleButton" name="channelA1_Widget" native="true">
<property name="geometry">
<rect>
<x>30</x>
<y>30</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelA5_Widget" native="true">
<property name="geometry">
<rect>
<x>30</x>
<y>275</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelA2_Widget" native="true">
<property name="geometry">
<rect>
<x>475</x>
<y>30</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelA6_Widget" native="true">
<property name="geometry">
<rect>
<x>475</x>
<y>275</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelA7_Widget" native="true">
<property name="geometry">
<rect>
<x>920</x>
<y>275</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelA3_Widget" native="true">
<property name="geometry">
<rect>
<x>920</x>
<y>30</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelA4_Widget" native="true">
<property name="geometry">
<rect>
<x>1365</x>
<y>30</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelA8_Widget" native="true">
<property name="geometry">
<rect>
<x>1365</x>
<y>275</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
</widget>
</widget>
<widget class="QWidget" name="BBox_Page">
<widget class="QGroupBox" name="groupBox_8">
<property name="geometry">
<rect>
<x>1</x>
<y>1</y>
<width>1818</width>
<height>530</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#groupBox_8{background: #FFFFFF;border-radius: 2px 2px 2px 2px;
border: 1px solid #05A6EC;}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="MuscleButton" name="channelB1_Widget" native="true">
<property name="geometry">
<rect>
<x>30</x>
<y>30</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelB5_Widget" native="true">
<property name="geometry">
<rect>
<x>30</x>
<y>275</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelB2_Widget" native="true">
<property name="geometry">
<rect>
<x>475</x>
<y>30</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelB6_Widget" native="true">
<property name="geometry">
<rect>
<x>475</x>
<y>275</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelB7_Widget" native="true">
<property name="geometry">
<rect>
<x>920</x>
<y>275</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelB3_Widget" native="true">
<property name="geometry">
<rect>
<x>920</x>
<y>30</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelB4_Widget" native="true">
<property name="geometry">
<rect>
<x>1365</x>
<y>30</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
<widget class="MuscleButton" name="channelB8_Widget" native="true">
<property name="geometry">
<rect>
<x>1365</x>
<y>275</y>
<width>425</width>
<height>225</height>
</rect>
</property>
</widget>
</widget>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1920</width>
<height>980</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#groupBox{background:white;}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="FesParamBtn" name="plus_Widget" native="true">
<property name="geometry">
<rect>
<x>80</x>
<y>30</y>
<width>250</width>
<height>170</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">QWidget{background: #E4F4FC;}</string>
</property>
</widget>
</widget>
<zorder>groupBox</zorder>
<zorder>stackedWidget</zorder>
<zorder>FESA_Btn</zorder>
<zorder>FESB_Btn</zorder>
<zorder>trainTime_Widget</zorder>
<zorder>frequent_Widget</zorder>
<zorder>upTime_Widget</zorder>
<zorder>openTime_Widget</zorder>
<zorder>downTime_Widget</zorder>
<zorder>closeTime_Widget</zorder>
<zorder>OK_Btn</zorder>
</widget>
<customwidgets>
<customwidget>
<class>MuscleButton</class>
<extends>QWidget</extends>
<header>musclebutton.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>FesParamBtn</class>
<extends>QWidget</extends>
<header>fesparambtn.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@@ -0,0 +1,103 @@
#include "recipexmlcontrol.h"
#include <QFile>
#include <QDebug>
#include <QDomDocument>
RecipeXmlControl::RecipeXmlControl(QObject *parent)
: QObject{parent}
{
readRecipeXml();
}
QList<ST_RecipeParam> RecipeXmlControl::getFESRecipes()
{
return recipeParamList;
}
QList<ST_RecipeParam> RecipeXmlControl::getFESRecipesReverse()
{
return recipeParamReverseList;
}
bool RecipeXmlControl::readRecipeXml()
{
QFile file("./DependFile/ConfigFile/FESRecipeList.xml");
if(!file.open(QIODevice::ReadOnly))
{
qDebug()<<"read FESRecipeList failed";
return false;
}
QDomDocument doc;
QString error;
int row,colum;
if(!doc.setContent(&file,&error,&row,&colum))
{
qDebug()<<"gameList error"<<error<<row<<colum;
file.close();
return false;
}
file.close();
QDomElement root=doc.documentElement(); //返回根节点
QDomNode node=root.firstChild(); //获得第一个子节点
while(!node.isNull())
{
if(node.isElement()) //如果节点是元素
{
ST_RecipeParam st_recipeMsg;
QDomElement e=node.toElement();
st_recipeMsg.muscleId = e.attribute("ID").toInt();
st_recipeMsg.muscleName = e.attribute("name");
st_recipeMsg.startAngle = e.attribute("startAngle").toInt();
st_recipeMsg.stopAngle = e.attribute("stopAngle").toInt();
recipeParamList.append(st_recipeMsg);
}
node = node.nextSibling();
}
qDebug()<<"recipeParamList.count()"<<recipeParamList.count();
QFile file2("./DependFile/ConfigFile/FESRecipeListReverse.xml");
if(!file2.open(QIODevice::ReadOnly))
{
qDebug()<<"read FESRecipeListReverse failed";
return false;
}
QDomDocument doc2;
QString error2;
int row2,colum2;
if(!doc2.setContent(&file2,&error2,&row2,&colum2))
{
qDebug()<<"gameList2 error"<<error2<<row2<<colum2;
file2.close();
return false;
}
file2.close();
QDomElement root2=doc2.documentElement(); //返回根节点
QDomNode node2=root2.firstChild(); //获得第一个子节点
while(!node2.isNull())
{
if(node2.isElement()) //如果节点是元素
{
ST_RecipeParam st_recipeMsg;
QDomElement e=node2.toElement();
st_recipeMsg.muscleId = e.attribute("ID").toInt();
st_recipeMsg.muscleName = e.attribute("name");
st_recipeMsg.startAngle = e.attribute("startAngle").toInt();
st_recipeMsg.stopAngle = e.attribute("stopAngle").toInt();
recipeParamReverseList.append(st_recipeMsg);
}
node2 = node2.nextSibling();
}
qDebug()<<"recipeParamReverseList.count()"<<recipeParamReverseList.count();
return true;
}

View File

@@ -0,0 +1,26 @@
#ifndef RECIPEXMLCONTROL_H
#define RECIPEXMLCONTROL_H
#include <QObject>
#include "dataformate.h"
class RecipeXmlControl : public QObject
{
Q_OBJECT
public:
explicit RecipeXmlControl(QObject *parent = nullptr);
QList<ST_RecipeParam> getFESRecipes();
QList<ST_RecipeParam> getFESRecipesReverse();
bool readRecipeXml();
signals:
private:
private:
QList<ST_RecipeParam> recipeParamList;
QList<ST_RecipeParam> recipeParamReverseList;
};
#endif // RECIPEXMLCONTROL_H

View File

@@ -0,0 +1,488 @@
#include "trainingparamsetting.h"
#include "ui_trainingparamsetting.h"
#include "mainwindowpagecontrol.h"
#include "icemodule.h"
#include "ccommunicateapi.h"
#include "paramtipsdialog.h"
#include "languagemanager.h"
#include <QDebug>
#include "currentuserdata.h"
TrainingParamSetting::TrainingParamSetting(QWidget *parent) :
QWidget(parent),
ui(new Ui::TrainingParamSetting),
m_IsImportPrescription(0),
m_saveParamInWidget(0),
m_trainType(0)
{
ui->setupUi(this);
m_userID = CurrentUserData::getInstace()->getCurrentPatientMsg().ID;
initWidget();
}
TrainingParamSetting::~TrainingParamSetting()
{
delete ui;
}
ST_BicycleParam TrainingParamSetting::get_st_bicycleParam()
{
ST_BicycleParam st_bicycleParam;
st_bicycleParam.trainTime = ui->trainTime1_ComboBox->currentText().toUInt();
//训练阻力
st_bicycleParam.resistance = ui->resistance1_ComboBox->currentText().toInt();
//训练速度
st_bicycleParam.speed = ui->speed1_ComboBox->currentText().toInt();
//转向:1为正向0为逆向
if(ui->CW1_Button->isChecked())
st_bicycleParam.direction = 1;
else if(ui->ACW1_Button->isChecked())
st_bicycleParam.direction = 0;
//痉挛保护
// if(ui->spasmACW2_RadioButton->isChecked())
// st_bicycleParam.spasmType = 0;
if(ui->spasmClose1_Button->isChecked())
st_bicycleParam.spasmSwitch = 1; //保护是1
else
m_st_bicycleParam.spasmSwitch = 0; //不保护是0
//痉挛等级
if(ui->spasmLow1_Button->isChecked())
st_bicycleParam.spasmLevel = 1;
else if(ui->spasmMidd1_Button->isChecked())
st_bicycleParam.spasmLevel = 2;
else if(ui->spasmHigh1_Button->isChecked())
st_bicycleParam.spasmLevel = 3;
return st_bicycleParam;
}
void TrainingParamSetting::setTrainType(bool type)
{
m_trainType = type;
}
void TrainingParamSetting::showEvent(QShowEvent *event)
{
Q_UNUSED(event) //过滤掉同一个用户的多次参数初始化,界面不保存数据
if( m_saveParamInWidget != 1 && m_IsImportPrescription != 1 /*m_userID != CurrentUserData::getInstace()->getCurrentPatientMsg().ID ||*/ ) //过滤掉导入处方事件,第二次进入页面
{//第二次进入要保存:(改用户、游戏结束会跟新)√ 点击返回不更新、不到界面报要保存;
ui->spasmClose1_Button->setChecked(true); //保护打开
//时间
ui->trainTime1_ComboBox->setCurrentIndex(19);
//阻力
ui->resistance1_ComboBox->setCurrentIndex(4);
//速度
ui->speed1_ComboBox->setCurrentIndex(8);
ui->spasmLow1_Button->setChecked(true);
ui->CW1_Button->setChecked(true);
m_userID = CurrentUserData::getInstace()->getCurrentPatientMsg().ID;
}
else
{
m_IsImportPrescription = 0; //重新初始化
}
}
void TrainingParamSetting::changeEvent(QEvent *event)
{
switch (event->type())
{
case QEvent::LanguageChange:
{
E_LANGUAGE language = LanguageManager::getInstance()->getCurrentLanguage();
switch(language)
{
case Chinese_E:
{
// ui->trainPart_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_part.png);");
// ui->trainMode_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_mode.png);");
// ui->trainTime_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_time.png);");
// ui->resistance_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_force.png);");
// ui->speed_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_speed.png);");
// ui->turn_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_turn.png);");
// ui->spasmProtect_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/spasm_control.png);");
// ui->spasmLevel_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/spasm_level.png);");
// ui->game_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_game.png);");
ui->trainTimeIcon_label->move(70,50);
ui->trainTime_label->move(140,40);
ui->trainResistanceIcon_label->move(80,50);
ui->trainResistance_label->move(150,40);
ui->trainSpeedIcon_label->move(90,40);
ui->trainSpeed_label->move(160,30);
//X移动50
ui->spasmProtectIcon_label->move(50,80);
ui->spasmProtect_label->move(120,70);
ui->spasmProtect_label->setStyleSheet("width: 168px;height: 42px;font-size: 42px;font-weight: 500;color: #033333;line-height: 63px;");
ui->trainResistance_label->setStyleSheet("width: 168px;height: 42px;font-size: 42px;font-weight: 500;color: #033333;line-height: 63px;");
}
break;
case English_E:
{
// ui->trainPart_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_part_E.png);");
// ui->trainMode_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_mode_E.png);");
// ui->trainTime_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_time_E.png);");
// ui->resistance_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_force_E.png);");
// ui->speed_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_speed_E.png);");
// ui->turn_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_turn_E.png);");
// ui->spasmProtect_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/spasm_control_E.png);");
// ui->spasmLevel_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/spasm_level_E.png);");
// ui->game_GroupBox->setStyleSheet("border-image: url(:/DependFile/Source/trainPage/train_game_E.png);");
//X移动30
ui->trainTimeIcon_label->move(50,50);
ui->trainTime_label->move(120,40);
ui->trainResistanceIcon_label->move(5,50);
ui->trainResistance_label->move(55,40);
ui->trainSpeedIcon_label->move(40,50);
ui->trainSpeed_label->move(110,40);
//X移动50
ui->spasmProtectIcon_label->move(5,80);
ui->spasmProtect_label->move(55,70);
ui->spasmProtect_label->setStyleSheet("width: 168px;height: 42px;font-size: 32px;font-weight: 500;color: #033333;line-height: 63px;");
ui->trainResistance_label->setStyleSheet("width: 168px;height: 42px;font-size: 36px;font-weight: 500;color: #033333;line-height: 63px;");
}
break;
}
ui->retranslateUi(this);
}
break;
default:
QWidget::changeEvent(event);
break;
}
}
void TrainingParamSetting::initWidget()
{
/*
ui->resistance1_ComboBox->setView(new QListView);
ui->speed1_ComboBox->setView(new QListView);
ui->trainTime1_ComboBox->setView(new QListView);
*/
// ui->CW1_Button->setChecked(true); //优先选择正向
// ui->spasmMidd1_Button->setChecked(true); //中等痉挛
ui->spasmClose1_Button->setChecked(true); //保护打开
//时间
// ui->trainTime1_ComboBox->setView(new QListView);
for(int i = 1;i <= 120;i++)
{
ui->trainTime1_ComboBox->addItem(QString::number(i));
}
ui->trainTime1_ComboBox->setCurrentIndex(19);
//阻力
for(int i = 1;i <= 20;i++)
{
ui->resistance1_ComboBox->addItem(QString::number(i));
}
ui->resistance1_ComboBox->setCurrentIndex(4);
//速度,因为训练速度小于2会出现空
for(int i = 2;i <= 55; i++)
{
ui->speed1_ComboBox->addItem(QString::number(i));
}
//预设定值上肢不超10下肢不超15
ui->speed1_ComboBox->setCurrentIndex(8);
//设置初始化按钮样式
// ui->CW1_Button->setStyleSheet("width: 140px;\nheight: 70px;\nbackground: #05A6EC;\nbox-shadow: 0px 3px 6px 0px rgba(12,49,153,0.59);\nborder-radius: 8px;\nborder: 2px solid #05A6EC;\n\nfont-size: 34px;\n\nfont-weight: 500;\ncolor: #FFFFFF;\nline-height: 51px;\nline-height: 51px;\ntext-shadow: 0px 3px 6px rgba(12,49,153,0.59), 0px 1px 2px #076D99;\n-webkit-background-clip: text;\n-webkit-text-fill-color: transparent;");
//ui->ACW1_Button->setStyleSheet("width: 140px;\nheight: 70px;\nbackground: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);\nborder-radius: 8px;\nborder: 2px solid #B3D7E7;\n\nfont-size: 30px;\n\nfont-weight: 400;\ncolor: #333333;\nline-height: 45px;");
}
void TrainingParamSetting::slotBicycleParamChanged(ST_BicycleParam st_bicycleParam)
{
qDebug() <<"slotBicycleParamChanged";
if(st_bicycleParam.direction == 0)
ui->ACW1_Button->setChecked(true); //不默认则逆向,0表示逆向
if(st_bicycleParam.spasmLevel == 1)
ui->spasmLow1_Button->setChecked(true);
else if(st_bicycleParam.spasmLevel == 2)
ui->spasmMidd1_Button->setChecked(true);
else if(st_bicycleParam.spasmLevel == 3)
ui->spasmHigh1_Button->setChecked(true);
if(st_bicycleParam.spasmSwitch == 0)
ui->spasmClose1_Button->setChecked(false); //不默认则关闭0代表关闭
else if(st_bicycleParam.spasmSwitch == 1)
ui->spasmClose1_Button->setChecked(true);
m_IsImportPrescription = 1;
//时间、速度、阻力
ui->trainTime1_ComboBox->setCurrentIndex(st_bicycleParam.trainTime-1);
ui->resistance1_ComboBox->setCurrentIndex(st_bicycleParam.resistance-1); //从1开始
if(st_bicycleParam.speed < 2) st_bicycleParam.speed = 2;//避免速度为1出现空的
ui->speed1_ComboBox->setCurrentIndex(st_bicycleParam.speed -2); //从2开始
m_saveParamInWidget = true;
}
void TrainingParamSetting::slotResetParam() //已经到了训练管理界面
{
ui->spasmClose1_Button->setChecked(true); //保护打开
//时间
ui->trainTime1_ComboBox->setCurrentIndex(19);
//阻力
ui->resistance1_ComboBox->setCurrentIndex(4);
//速度
ui->speed1_ComboBox->setCurrentIndex(8);
ui->spasmLow1_Button->setChecked(true);
ui->CW1_Button->setChecked(true);
m_saveParamInWidget = false;
}
//1.点击确定保存参数
void TrainingParamSetting::on_confirm_Btn_clicked()
{
m_saveParamInWidget = true;
//收集参数
//训练时间
m_st_bicycleParam.trainTime = ui->trainTime1_ComboBox->currentText().toUInt();
//训练阻力
m_st_bicycleParam.resistance = ui->resistance1_ComboBox->currentText().toInt();
//训练速度
m_st_bicycleParam.speed = ui->speed1_ComboBox->currentText().toInt();
//转向:1为正向0为逆向
if(ui->CW1_Button->isChecked())
m_st_bicycleParam.direction = 1;
else if(ui->ACW1_Button->isChecked())
m_st_bicycleParam.direction = 0;
//痉挛保护
// if(ui->spasmACW2_RadioButton->isChecked())
// st_bicycleParam.spasmType = 0;
if(ui->spasmClose1_Button->isChecked())
m_st_bicycleParam.spasmSwitch = 1; //保护是1
else
m_st_bicycleParam.spasmSwitch = 0; //不保护是0
//痉挛等级
if(ui->spasmLow1_Button->isChecked())
m_st_bicycleParam.spasmLevel = 1;
else if(ui->spasmMidd1_Button->isChecked())
m_st_bicycleParam.spasmLevel = 2;
else if(ui->spasmHigh1_Button->isChecked())
m_st_bicycleParam.spasmLevel = 3;
emit signalTrainParamChanged(m_st_bicycleParam);
//if()
if(m_trainType == 0)
MainWindowPageControl::getInstance()->setCurrentPage(BicycleParamSet_E);
else if(m_trainType == 1)
MainWindowPageControl::getInstance()->setCurrentPage(FesBicycleParamSet_E);
}
//转向:点击正向
void TrainingParamSetting::on_CW1_Button_toggled(bool checked)
{
if(checked)
{
ui->CW1_Button->setStyleSheet("background: #05A6EC;color: #FFFFFF;font-size: 34px;font-weight: 500;line-height: 51px;text-shadow: 0px 3px 6px rgba(12,49,153,0.59), 0px 1px 2px #076D99;border: 2px solid #05A6EC;");
}
else
{
ui->CW1_Button->setStyleSheet("background: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);font-size: 30px;font-weight: 500;border: 2px solid #B3D7E7;");
}
}
//转向:点击逆向
void TrainingParamSetting::on_ACW1_Button_toggled(bool checked)
{
if(checked)
{
ui->ACW1_Button->setStyleSheet("background: #05A6EC;color: #FFFFFF;font-size: 34px;font-weight: 500;line-height: 51px;text-shadow: 0px 3px 6px rgba(12,49,153,0.59), 0px 1px 2px #076D99;border: 2px solid #05A6EC;");
}
else
{
ui->ACW1_Button->setStyleSheet("background: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);font-size: 30px;font-weight: 500;border: 2px solid #B3D7E7;");
}
}
//痉挛等级:高
void TrainingParamSetting::on_spasmHigh1_Button_toggled(bool checked)
{
if(checked)
{
ui->spasmHigh1_Button->setStyleSheet("background: #05A6EC;color: #FFFFFF;font-size: 34px;font-weight: 500;line-height: 51px;text-shadow: 0px 3px 6px rgba(12,49,153,0.59), 0px 1px 2px #076D99;border: 2px solid #05A6EC;");
}
else
{
ui->spasmHigh1_Button->setStyleSheet("background: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);font-size: 30px;font-weight: 500;border: 2px solid #B3D7E7;");
}
}
//痉挛等级:中
void TrainingParamSetting::on_spasmMidd1_Button_toggled(bool checked)
{
if(checked)
{
ui->spasmMidd1_Button->setStyleSheet("background: #05A6EC;color: #FFFFFF;font-size: 34px;font-weight: 500;line-height: 51px;text-shadow: 0px 3px 6px rgba(12,49,153,0.59), 0px 1px 2px #076D99;border: 2px solid #05A6EC;");
}
else
{
ui->spasmMidd1_Button->setStyleSheet("background: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);font-size: 30px;font-weight: 500;border: 2px solid #B3D7E7;");
}
}
//痉挛等级:低
void TrainingParamSetting::on_spasmLow1_Button_toggled(bool checked)
{
if(checked)
{
ui->spasmLow1_Button->setStyleSheet("background: #05A6EC;color: #FFFFFF;font-size: 34px;font-weight: 500;line-height: 51px;text-shadow: 0px 3px 6px rgba(12,49,153,0.59), 0px 1px 2px #076D99;border: 2px solid #05A6EC;");
}
else
{
ui->spasmLow1_Button->setStyleSheet("background: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);font-size: 30px;font-weight: 500;border: 2px solid #B3D7E7;");
}
}
//痉挛保护:开关
void TrainingParamSetting::on_spasmClose1_Button_toggled(bool checked)
{
if(checked)
//if(m_turnState)//当前选择状态,就变为不选择
{
ui->spasmClose1_Button->setStyleSheet("border-image:url(:/DependFile/Source/trainPage/protect_on.png);");
ui->spasmMidd1_Button->setCheckable(true);
ui->spasmMidd1_Button->setChecked(true);
ui->spasmMidd1_Button->setStyleSheet("background: #05A6EC;color: #FFFFFF;font-size: 34px;font-weight: 500;line-height: 51px;text-shadow: 0px 3px 6px rgba(12,49,153,0.59), 0px 1px 2px #076D99;border: 2px solid #05A6EC;");
ui->spasmLow1_Button->setCheckable(true);
ui->spasmLow1_Button->setStyleSheet("background: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);font-size: 30px;font-weight: 500;border: 2px solid #B3D7E7;");
ui->spasmHigh1_Button->setCheckable(true);
ui->spasmHigh1_Button->setStyleSheet("background: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);font-size: 30px;font-weight: 500;border: 2px solid #B3D7E7;");
}
else
{
ui->spasmClose1_Button->setStyleSheet("border-image:url(:/DependFile/Source/trainPage/protect_off.png);");
ui->spasmMidd1_Button->setCheckable(false);
ui->spasmMidd1_Button->setStyleSheet("background: #E0E0E0;width: 30px;height: 30px;font-size: 30px;font-family: SourceHanSansCN-Regular, SourceHanSansCN;font-weight: 400;color: #B2B2B2;line-height: 45px;-webkit-background-clip: text;-webkit-text-fill-color: transparent;");
ui->spasmLow1_Button->setCheckable(false);
ui->spasmLow1_Button->setStyleSheet("background: #E0E0E0;width: 30px;height: 30px;font-size: 30px;font-family: SourceHanSansCN-Regular, SourceHanSansCN;font-weight: 400;color: #B2B2B2;line-height: 45px;-webkit-background-clip: text;-webkit-text-fill-color: transparent;");
ui->spasmHigh1_Button->setCheckable(false);
ui->spasmHigh1_Button->setStyleSheet("background: #E0E0E0;width: 30px;height: 30px;font-size: 30px;font-family: SourceHanSansCN-Regular, SourceHanSansCN;font-weight: 400;color: #B2B2B2;line-height: 45px;-webkit-background-clip: text;-webkit-text-fill-color: transparent;");
}
}
/*
void TrainingParamSetting::on_spasmClose1_Button_clicked()
{
if(ui->spasmClose1_Button->isChecked())
//if(m_turnState)//当前选择状态,就变为不选择
{
ui->spasmClose1_Button->setStyleSheet("border-image:url(:/DependFile/Source/trainPage/protect_off.png);");
}
else
{
ui->spasmClose1_Button->setStyleSheet("border-image:url(:/DependFile/Source/trainPage/protect_on.png);");
}
// m_turnState = ! m_turnState;
}
*/
//点击上升高度
/*
void TrainingParamSetting::on_upSpeedPlus_Btn_clicked()
{
if(!IceModule::getInstance()->getEmergencyState())
CCommunicateAPI::getInstance()->sendRealTimeParam(TUIGAN_UPDOWN,1);
}
//点击下降高度
void TrainingParamSetting::on_upSpeedMinus_Btn_clicked()
{
if(!IceModule::getInstance()->getEmergencyState())
CCommunicateAPI::getInstance()->sendRealTimeParam(TUIGAN_UPDOWN,2);
}
*/
//单肢速度设置:需要修改
void TrainingParamSetting::on_speed1_ComboBox_currentTextChanged(const QString &arg1)
{
int speed = arg1.toInt();
if(speed > 30)
{
ParamTipsDialog tipDialog;
tipDialog.setParamTipsMsg(tr("设定速度已超30r/min确认使用该速度训练吗"));
tipDialog.exec();
if(0 == tipDialog.getResult())
{
ui->speed1_ComboBox->setCurrentIndex(28);
return;
}
}
}
//按住按钮升高
void TrainingParamSetting::on_upSpeedPlus_Btn_pressed()
{
if(!IceModule::getInstance()->getEmergencyState())
CCommunicateAPI::getInstance()->sendRealTimeParam(TUIGAN_UPDOWN,1);
qDebug() <<"发送时间:"<< QDateTime::currentDateTime();
}
//按住按钮降低
void TrainingParamSetting::on_upSpeedMinus_Btn_pressed()
{
if(!IceModule::getInstance()->getEmergencyState())
CCommunicateAPI::getInstance()->sendRealTimeParam(TUIGAN_UPDOWN,2);
qDebug() <<"发送时间:"<< QDateTime::currentDateTime();
}

View File

@@ -0,0 +1,78 @@
#ifndef TRAININGPARAMSETTING_H
#define TRAININGPARAMSETTING_H
#include <QWidget>
#include "dataformate.h"
namespace Ui {
class TrainingParamSetting;
}
class TrainingParamSetting : public QWidget
{
Q_OBJECT
public:
explicit TrainingParamSetting(QWidget *parent = nullptr);
~TrainingParamSetting();
ST_BicycleParam get_st_bicycleParam();
void setTrainType(bool type); //点击保存是显示单车训练还是fes单车训练
protected:
void showEvent(QShowEvent *event);
virtual void changeEvent(QEvent* event);
void initWidget();
signals:
void signalTrainParamChanged(ST_BicycleParam);
public slots:
void slotBicycleParamChanged(ST_BicycleParam);
void slotResetParam(); //在主训练界面,重新设置训练参数
private slots:
void on_confirm_Btn_clicked();
//速度大于30提示
void on_speed1_ComboBox_currentTextChanged(const QString &arg1);
//void on_CW1_Button_clicked(bool checked);
void on_CW1_Button_toggled(bool checked);
void on_ACW1_Button_toggled(bool checked);
void on_spasmHigh1_Button_toggled(bool checked);
void on_spasmMidd1_Button_toggled(bool checked);
void on_spasmLow1_Button_toggled(bool checked);
// void on_spasmClose1_Button_clicked();
// void on_upSpeedPlus_Btn_clicked();
// void on_upSpeedMinus_Btn_clicked();
void on_spasmClose1_Button_toggled(bool checked);
void on_upSpeedPlus_Btn_pressed();
void on_upSpeedMinus_Btn_pressed();
// void on_spasmClose1_Button_clicked();
// void on_spasmClose1_Button_clicked();
private:
Ui::TrainingParamSetting *ui;
int m_turnState;
ST_BicycleParam m_st_bicycleParam;
bool m_IsImportPrescription;//之前是否发生了导入处方
int m_userID; //再次进入参数页面,不再刷新
bool m_saveParamInWidget;
bool m_trainType; //保存之后是否显示fes的训练管理
};
#endif // TRAININGPARAMSETTING_H

View File

@@ -0,0 +1,862 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TrainingParamSetting</class>
<widget class="QWidget" name="TrainingParamSetting">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1920</width>
<height>1160</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">#TrainingParamSetting{background-color: rgb(255, 255, 255);}</string>
</property>
<widget class="QGroupBox" name="groupBox_8">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1911</width>
<height>1141</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#groupBox_8{background:white;border:none;}</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QGroupBox" name="groupBox">
<property name="geometry">
<rect>
<x>70</x>
<y>59</y>
<width>440</width>
<height>371</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background: #EEFDFD;
border-radius: 12px;</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="trainTimeIcon_label">
<property name="geometry">
<rect>
<x>70</x>
<y>50</y>
<width>50</width>
<height>50</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../image.qrc">:/DependFile/Source/trainPage/trainParam_time.png</pixmap>
</property>
</widget>
<widget class="QLabel" name="label_3">
<property name="geometry">
<rect>
<x>230</x>
<y>100</y>
<width>81</width>
<height>51</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">width: 66px;
height: 36px;
font-size: 36px;
font-weight: 400;
color: #666666;
line-height: 54px;</string>
</property>
<property name="text">
<string>min</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
<widget class="QComboBox" name="trainTime1_ComboBox">
<property name="geometry">
<rect>
<x>80</x>
<y>190</y>
<width>260</width>
<height>120</height>
</rect>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>-1</pointsize>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">#trainTime1_ComboBox {
background: #FFFFFF;
border-radius: 6px;
border: 2px solid #05A6EC;
width: 64px;
height: 56px;
font-size: 56px;
font-weight: 500;
color: #333333;
line-height: 84px;
padding-left:100px;
}
#trainTime1_ComboBox::drop-down{
width:0px;
}
#trainTime1_ComboBox QAbstaractItemView{
width:80px;
}</string>
</property>
</widget>
<widget class="QLabel" name="trainTime_label">
<property name="geometry">
<rect>
<x>140</x>
<y>40</y>
<width>291</width>
<height>61</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>-1</pointsize>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">width: 168px;
height: 42px;
font-size: 42px;
font-weight: 500;
color: #033333;
line-height: 63px;</string>
</property>
<property name="text">
<string>训练时间</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_2">
<property name="geometry">
<rect>
<x>540</x>
<y>60</y>
<width>440</width>
<height>380</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background: #EEFDFD;
border-radius: 12px;</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="trainResistanceIcon_label">
<property name="geometry">
<rect>
<x>80</x>
<y>50</y>
<width>50</width>
<height>50</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../image.qrc">:/DependFile/Source/trainPage/trainParam_force.png</pixmap>
</property>
</widget>
<widget class="QComboBox" name="resistance1_ComboBox">
<property name="geometry">
<rect>
<x>90</x>
<y>190</y>
<width>260</width>
<height>120</height>
</rect>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>-1</pointsize>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">#resistance1_ComboBox {
background: #FFFFFF;
border-radius: 6px;
border: 2px solid #05A6EC;
width: 64px;
height: 56px;
font-size: 56px;
font-weight: 500;
color: #333333;
line-height: 84px;
padding-left:100px;
}
#resistance1_ComboBox::drop-down{
width:0px;
}
#resistance1_ComboBox QAbstaractItemView{
width:80px;
}</string>
</property>
</widget>
<widget class="QLabel" name="trainResistance_label">
<property name="geometry">
<rect>
<x>150</x>
<y>40</y>
<width>381</width>
<height>71</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">width: 168px;
height: 42px;
font-size: 42px;
font-weight: 500;
color: #033333;
line-height: 63px;</string>
</property>
<property name="text">
<string>训练阻力</string>
</property>
</widget>
<widget class="QLabel" name="label_4">
<property name="geometry">
<rect>
<x>210</x>
<y>100</y>
<width>101</width>
<height>51</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">width: 66px;
height: 36px;
font-size: 36px;
font-weight: 400;
color: #666666;
line-height: 54px;</string>
</property>
<property name="text">
<string>档</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_3">
<property name="geometry">
<rect>
<x>1010</x>
<y>60</y>
<width>440</width>
<height>380</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background: #EEFDFD;
border-radius: 12px;</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="trainSpeedIcon_label">
<property name="geometry">
<rect>
<x>90</x>
<y>40</y>
<width>50</width>
<height>50</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../image.qrc">:/DependFile/Source/trainPage/trainParam_speed.png</pixmap>
</property>
</widget>
<widget class="QComboBox" name="speed1_ComboBox">
<property name="geometry">
<rect>
<x>80</x>
<y>190</y>
<width>260</width>
<height>120</height>
</rect>
</property>
<property name="font">
<font>
<family>黑体</family>
<pointsize>-1</pointsize>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">#speed1_ComboBox {
background: #FFFFFF;
border-radius: 6px;
border: 2px solid #05A6EC;
width: 64px;
height: 56px;
font-size: 56px;
font-weight: 500;
color: #333333;
line-height: 84px;
padding-left:100px;
}
#speed1_ComboBox::drop-down{
width:0px;
}
#speed1_ComboBox QAbstaractItemView{
width:80px;
}</string>
</property>
</widget>
<widget class="QLabel" name="trainSpeed_label">
<property name="geometry">
<rect>
<x>160</x>
<y>30</y>
<width>331</width>
<height>71</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">width: 168px;
height: 42px;
font-size: 42px;
font-weight: 500;
color: #033333;
line-height: 63px;</string>
</property>
<property name="text">
<string>训练速度</string>
</property>
</widget>
<widget class="QLabel" name="label_6">
<property name="geometry">
<rect>
<x>180</x>
<y>100</y>
<width>141</width>
<height>41</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">width: 66px;
height: 36px;
font-size: 36px;
font-weight: 400;
color: #666666;
line-height: 54px;</string>
</property>
<property name="text">
<string>r/min</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_4">
<property name="geometry">
<rect>
<x>70</x>
<y>460</y>
<width>410</width>
<height>350</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">
background: #EEF7FD;
border-radius: 12px;
</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="label_16">
<property name="geometry">
<rect>
<x>100</x>
<y>90</y>
<width>50</width>
<height>50</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../image.qrc">:/DependFile/Source/trainPage/trainParam_turn.png</pixmap>
</property>
</widget>
<widget class="QPushButton" name="CW1_Button">
<property name="geometry">
<rect>
<x>40</x>
<y>190</y>
<width>140</width>
<height>70</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#CW1_Button{
background: #05A6EC;color: #FFFFFF;font-size: 34px;font-weight: 500;line-height: 51px;text-shadow: 0px 3px 6px rgba(12,49,153,0.59), 0px 1px 2px #076D99;border: 2px solid #05A6EC;
}</string>
</property>
<property name="text">
<string>正向</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="ACW1_Button">
<property name="geometry">
<rect>
<x>210</x>
<y>190</y>
<width>140</width>
<height>70</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);font-size: 30px;font-weight: 500;border: 2px solid #B3D7E7;</string>
</property>
<property name="text">
<string>逆向</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_8">
<property name="geometry">
<rect>
<x>160</x>
<y>80</y>
<width>251</width>
<height>71</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">width: 168px;
height: 42px;
font-size: 42px;
font-weight: 500;
color: #033333;
line-height: 63px;</string>
</property>
<property name="text">
<string>转向</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_5">
<property name="geometry">
<rect>
<x>505</x>
<y>460</y>
<width>580</width>
<height>350</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background: #EEF7FD;
border-radius: 12px;
</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="label_18">
<property name="geometry">
<rect>
<x>140</x>
<y>90</y>
<width>50</width>
<height>50</height>
</rect>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../../image.qrc">:/DependFile/Source/trainPage/trainParam_sapsmLevel.png</pixmap>
</property>
</widget>
<widget class="QPushButton" name="spasmHigh1_Button">
<property name="geometry">
<rect>
<x>50</x>
<y>200</y>
<width>140</width>
<height>70</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);font-size: 30px;font-weight: 500;border: 2px solid #B3D7E7;</string>
</property>
<property name="text">
<string>高</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="spasmMidd1_Button">
<property name="geometry">
<rect>
<x>210</x>
<y>200</y>
<width>140</width>
<height>70</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">
background: linear-gradient(180deg, #EEFEFF 0%, #FCFEFF 100%);font-size: 30px;font-weight: 500;border: 2px solid #B3D7E7;</string>
</property>
<property name="text">
<string>中</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="spasmLow1_Button">
<property name="geometry">
<rect>
<x>380</x>
<y>200</y>
<width>140</width>
<height>70</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background: #05A6EC;color: #FFFFFF;font-size: 34px;font-weight: 500;line-height: 51px;text-shadow: 0px 3px 6px rgba(12,49,153,0.59), 0px 1px 2px #076D99;border: 2px solid #05A6EC;
</string>
</property>
<property name="text">
<string>低</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
<property name="autoExclusive">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_9">
<property name="geometry">
<rect>
<x>230</x>
<y>80</y>
<width>401</width>
<height>71</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">width: 168px;
height: 42px;
font-size: 42px;
font-weight: 500;
color: #033333;
line-height: 63px;</string>
</property>
<property name="text">
<string>痉挛等级</string>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_6">
<property name="geometry">
<rect>
<x>1110</x>
<y>460</y>
<width>342</width>
<height>350</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background: #FFF6F0;
border-radius: 12px;
</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QLabel" name="spasmProtectIcon_label">
<property name="geometry">
<rect>
<x>50</x>
<y>80</y>
<width>50</width>
<height>50</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/DependFile/Source/trainPage/pasume_protece.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="spasmProtect_label">
<property name="geometry">
<rect>
<x>120</x>
<y>70</y>
<width>361</width>
<height>71</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">width: 168px;
height: 42px;
font-size: 42px;
font-weight: 500;
color: #033333;
line-height: 63px;</string>
</property>
<property name="text">
<string>痉挛保护</string>
</property>
</widget>
<widget class="QPushButton" name="spasmClose1_Button">
<property name="geometry">
<rect>
<x>90</x>
<y>190</y>
<width>140</width>
<height>60</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/DependFile/Source/trainPage/protect_on.png);</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_7">
<property name="geometry">
<rect>
<x>1480</x>
<y>60</y>
<width>370</width>
<height>751</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">background: #F5F4FF;border-radius: 12px;
</string>
</property>
<property name="title">
<string/>
</property>
<widget class="QPushButton" name="upSpeedMinus_Btn">
<property name="geometry">
<rect>
<x>115</x>
<y>510</y>
<width>138</width>
<height>138</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/DependFile/Source/trainPage/decrease_height.png);
border-radius: 69px;</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRepeat">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="label_12">
<property name="geometry">
<rect>
<x>-27</x>
<y>40</y>
<width>421</width>
<height>71</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">width: 168px;
height: 42px;
font-size: 42px;
font-weight: 500;
color: #033333;
line-height: 63px;</string>
</property>
<property name="text">
<string>高度调节</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
<widget class="QPushButton" name="upSpeedPlus_Btn_2">
<property name="geometry">
<rect>
<x>120</x>
<y>180</y>
<width>130</width>
<height>461</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/DependFile/Source/trainPage/updown_background.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="upSpeedPlus_Btn">
<property name="geometry">
<rect>
<x>113</x>
<y>140</y>
<width>138</width>
<height>138</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#upSpeedPlus_Btn{border-image: url(:/DependFile/Source/trainPage/plus_height.png);
border-radius: 69px;}</string>
</property>
<property name="text">
<string/>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="autoRepeat">
<bool>true</bool>
</property>
</widget>
<zorder>label_12</zorder>
<zorder>upSpeedPlus_Btn_2</zorder>
<zorder>upSpeedPlus_Btn</zorder>
<zorder>upSpeedMinus_Btn</zorder>
</widget>
<widget class="QPushButton" name="confirm_Btn">
<property name="geometry">
<rect>
<x>1730</x>
<y>870</y>
<width>111</width>
<height>51</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>18</pointsize>
<bold>true</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">background: #05A6EC;
border-radius: 4px;
color:white;</string>
</property>
<property name="text">
<string>保存</string>
</property>
</widget>
</widget>
</widget>
<resources>
<include location="../../image.qrc"/>
</resources>
<connections/>
</ui>

View File

@@ -0,0 +1,188 @@
#include "trainmanager.h"
#include "ui_trainmanager.h"
#include "mainwindowpagecontrol.h"
#include <windows.h>
#include <QDebug>
#include "languagemanager.h"
TrainManager::TrainManager(QWidget *parent) :
QWidget(parent),
ui(new Ui::TrainManager),
m_FesBoxTipDialog(nullptr)
{
ui->setupUi(this);
m_FesBoxTipDialog = new FesBoxTipsDialog();
ui->shutDown_Btn->setVisible(true);
QLabel *bicylePic = new QLabel(ui->bicycleTrain_Btn);
bicylePic->setStyleSheet("border-image:url(:/DependFile/Source/MainPage/nav_icon_limbs.png)");
bicylePic->setGeometry(105,135,240,240);
QLabel *bicyleText = new QLabel(ui->bicycleTrain_Btn);
bicyleText->setStyleSheet("color:rgba(13, 157, 219, 1);font-size:54px;font-weight: 500;");
bicyleText->setGeometry(115,424,216,76);
bicyleText->setText("肢体训练");
QLabel *fesPic = new QLabel(ui->fesTrain_Btn);
fesPic->setStyleSheet("border-image:url(:/DependFile/Source/MainPage/nav_icon_FES.png)");
fesPic->setGeometry(140,36,180,180);
QLabel *fesText = new QLabel(ui->fesTrain_Btn);
fesText->setStyleSheet("color:rgba(13, 157, 219, 1);font-size:54px;font-weight: 500;");
fesText->setGeometry(184,218,93,76);
fesText->setText("FES");
QLabel *fesBicyclePic = new QLabel(ui->fesBicycleTrain_Btn);
fesBicyclePic->setStyleSheet("border-image:url(:/DependFile/Source/MainPage/nav_icon_FesTraining.png)");
fesBicyclePic->setGeometry(140,36,180,180);
QLabel *fesBicycleText = new QLabel(ui->fesBicycleTrain_Btn);
fesBicycleText->setStyleSheet("color:rgba(13, 157, 219, 1);font-size:54px;font-weight: 500;");
fesBicycleText->setGeometry(68,218,323,76);
fesBicycleText->setText("FES肢体训练");
QLabel *brainPic = new QLabel(ui->brain_Btn);
brainPic->setStyleSheet("border-image:url(:/DependFile/Source/MainPage/nav_icon_FesTraining.png)");
brainPic->setGeometry(140,36,180,180);
QLabel *brainText = new QLabel(ui->brain_Btn);
brainText->setStyleSheet("color:rgba(13, 157, 219, 1);font-size:54px;font-weight: 500;");
brainText->setGeometry(122,218,216,76);
brainText->setText("脑控康复");
QLabel *settingPic = new QLabel(ui->setting_Btn);
settingPic->setStyleSheet("border-image:url(:/DependFile/Source/MainPage/nav_icon_settings.png)");
settingPic->setGeometry(140,36,180,180);
QLabel *settingText = new QLabel(ui->setting_Btn);
settingText->setStyleSheet("color:rgba(91, 135, 167, 1);font-size:54px;font-weight: 500;");
settingText->setGeometry(176,218,108,76);
settingText->setText("设置");
//设置隐藏FES
#ifdef NORMALEXE
ui->fesTrain_Btn->setVisible(false);
ui->fesBicycleTrain_Btn->setVisible(false);
ui->bicycleTrain_Btn->move(540,260);
ui->setting_Btn->move(1010,260);
#endif
#ifdef ONLYUPLIMP
ui->fesTrain_Btn->setVisible(false);
ui->fesBicycleTrain_Btn->setVisible(false);
ui->bicycleTrain_Btn->move(540,260);
ui->setting_Btn->move(1010,260);
#endif
#ifdef ONLYDOWNLIMP
ui->fesTrain_Btn->setVisible(false);
ui->fesBicycleTrain_Btn->setVisible(false);
ui->bicycleTrain_Btn->move(540,260);
ui->setting_Btn->move(1010,260);
#endif
#ifdef UpLowLimpNormal
// ui->fesTrain_Btn->setVisible(false);
// ui->fesBicycleTrain_Btn->setVisible(false);
// ui->bicycleTrain_Btn->move(130,260);
// ui->fesTrain_Btn->move(560,260);
// ui->fesBicycleTrain_Btn->move(960,260);
// ui->setting_Btn->move(1420,260);
#endif
// QPalette palette;
// // 设置主窗口背景颜色
// palette.setColor(QPalette::Background, QColor("#FFFFFF"));
// this->setAutoFillBackground(true);
// this->setPalette(palette);
// emit signalOpenTrainManagerPage(); //发送打开了训练管理页面
}
TrainManager::~TrainManager()
{
delete ui;
}
void TrainManager::on_bicycleTrain_Btn_clicked()
{
MainWindowPageControl::getInstance()->setCurrentPage(BicycleParamSet_E);
}
void TrainManager::on_fesBicycleTrain_Btn_clicked()
{
//先踏车设置 后FES
//先判断电刺激是否启用
// if(!FesIceControl::getInstance()->isFesInited())
// {
// m_FesBoxTipDialog->exec();
// return;
// }
MainWindowPageControl::getInstance()->setCurrentPage(FesBicycleParamSet_E);
}
void TrainManager::on_fesTrain_Btn_clicked()
{
//先判断电刺激是否启用
// if(!FesIceControl::getInstance()->isFesInited())
// {
// m_FesBoxTipDialog->exec();
// return;
// }
MainWindowPageControl::getInstance()->setCurrentPage(FesParamSet_E);
}
void TrainManager::on_setting_Btn_clicked()
{
MainWindowPageControl::getInstance()->setCurrentPage(SettingPage_E);
}
void TrainManager::on_shutDown_Btn_clicked()
{
// system("shutdown -s -t 00");
qApp->quit();
}
void TrainManager::on_brain_Btn_clicked()
{
MainWindowPageControl::getInstance()->setCurrentPage(BrainTraining);
}
void TrainManager::changeEvent(QEvent* event)
{
switch (event->type())
{
case QEvent::LanguageChange:
{
E_LANGUAGE language = LanguageManager::getInstance()->getCurrentLanguage();
switch(language)
{
case Chinese_E:
{
ui->bicycleTrain_Btn->setStyleSheet("border-image: url(:/DependFile/Source/MainPage/bicycle.png);");
ui->fesBicycleTrain_Btn->setStyleSheet("border-image: url(:/DependFile/Source/MainPage/FESBicycle.png);");
ui->fesTrain_Btn->setStyleSheet("border-image: url(:/DependFile/Source/MainPage/FES.png);");
ui->setting_Btn->setStyleSheet("border-image: url(:/DependFile/Source/MainPage/setting.png);");
}
break;
case English_E:
{
ui->bicycleTrain_Btn->setStyleSheet("border-image: url(:/DependFile/Source/MainPage/bicycle_E.png);");
ui->fesBicycleTrain_Btn->setStyleSheet("border-image: url(:/DependFile/Source/MainPage/FESBicycle_E.png);");
ui->fesTrain_Btn->setStyleSheet("border-image: url(:/DependFile/Source/MainPage/FES_E.png);");
ui->setting_Btn->setStyleSheet("border-image: url(:/DependFile/Source/MainPage/setting_E.png);");
}
break;
}
ui->retranslateUi(this);
}
break;
default:
QWidget::changeEvent(event);
break;
}
}

View File

@@ -0,0 +1,44 @@
#ifndef TRAINMANAGER_H
#define TRAINMANAGER_H
#include <QWidget>
#include <QLabel>
#include "fesboxtipsdialog.h"
namespace Ui {
class TrainManager;
}
class TrainManager : public QWidget
{
Q_OBJECT
public:
explicit TrainManager(QWidget *parent = nullptr);
~TrainManager();
protected:
virtual void changeEvent(QEvent* event);
signals:
void signalOpenTrainManagerPage();
private slots:
void on_bicycleTrain_Btn_clicked();
void on_fesBicycleTrain_Btn_clicked();
void on_fesTrain_Btn_clicked();
void on_setting_Btn_clicked();
void on_shutDown_Btn_clicked();
void on_brain_Btn_clicked();
private:
Ui::TrainManager *ui;
FesBoxTipsDialog *m_FesBoxTipDialog;
};
#endif // TRAINMANAGER_H

View File

@@ -0,0 +1,154 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>TrainManager</class>
<widget class="QWidget" name="TrainManager">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1920</width>
<height>1080</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<property name="styleSheet">
<string notr="true">#TrainManager{background-color: rgb(255, 255, 255);}
</string>
</property>
<widget class="QPushButton" name="bicycleTrain_Btn">
<property name="geometry">
<rect>
<x>235</x>
<y>260</y>
<width>450</width>
<height>690</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#bicycleTrain_Btn{background-color: rgba(238, 247, 253, 1);border-radius: 40px;}
</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="fesBicycleTrain_Btn">
<property name="geometry">
<rect>
<x>1225</x>
<y>260</y>
<width>460</width>
<height>330</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#fesBicycleTrain_Btn{background-color: rgba(238, 247, 253, 1);border-radius: 40px;}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="fesTrain_Btn">
<property name="geometry">
<rect>
<x>725</x>
<y>260</y>
<width>460</width>
<height>330</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#fesTrain_Btn{background-color: rgba(238, 247, 253, 1);border-radius: 40px;}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="setting_Btn">
<property name="geometry">
<rect>
<x>1230</x>
<y>610</y>
<width>460</width>
<height>330</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#setting_Btn{background-color: rgba(245, 247, 249, 1);border-radius: 40px;}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="shutDown_Btn">
<property name="geometry">
<rect>
<x>1760</x>
<y>40</y>
<width>100</width>
<height>100</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/DependFile/Source/MainPage/index_icon_exit.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QPushButton" name="brain_Btn">
<property name="geometry">
<rect>
<x>725</x>
<y>620</y>
<width>460</width>
<height>330</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">#brain_Btn{background-color: rgba(238, 247, 253, 1);border-radius: 40px;}</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>74</x>
<y>66</y>
<width>360</width>
<height>60</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">border-image: url(:/DependFile/Source/MainPage/index_logo.png);</string>
</property>
<property name="text">
<string/>
</property>
</widget>
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>660</x>
<y>55</y>
<width>621</width>
<height>70</height>
</rect>
</property>
<property name="styleSheet">
<string notr="true">color: rgb(4, 105, 148);
font-size:50px;
font-weight:500;</string>
</property>
<property name="text">
<string>上下肢主被动康复训练系统</string>
</property>
</widget>
</widget>
<resources/>
<connections/>
</ui>