|
|
@ -7,7 +7,13 @@ |
|
|
|
QString namelist[] = {"传立春","传立夏","传立秋","传立冬"}; |
|
|
|
qint8 gindex = 0; |
|
|
|
|
|
|
|
MainWidget::MainWidget(QWidget *parent) : |
|
|
|
MainWidget::MainWidget(HttpService *httpService, |
|
|
|
WebsocketService *websocketService, |
|
|
|
DeviceService *deviceService, |
|
|
|
QWidget *parent) : |
|
|
|
m_httpService(httpService), |
|
|
|
m_websocketService(websocketService), |
|
|
|
m_deviceService(deviceService), |
|
|
|
QWidget(parent), |
|
|
|
ui(new Ui::MainWidget) |
|
|
|
{ |
|
|
@ -61,6 +67,8 @@ MainWidget::MainWidget(QWidget *parent) : |
|
|
|
m_curX = 0; |
|
|
|
connect(&m_lableScrollTimer,SIGNAL(timeout()),this,SLOT(lableScrollDisplay())); |
|
|
|
m_lableScrollTimer.start(10); |
|
|
|
|
|
|
|
this->setCursor(Qt::BlankCursor); |
|
|
|
} |
|
|
|
|
|
|
|
MainWidget::~MainWidget() |
|
|
@ -73,16 +81,20 @@ void MainWidget::updateUi() |
|
|
|
// m_curX = 0;//内容超出显示区域时,更新患者信息显示从头开始滚动
|
|
|
|
|
|
|
|
//更新statusLabel
|
|
|
|
// ui->statusLabel->setText(QString("%1 | %2")
|
|
|
|
// .arg(m_wsConnectedStatus == 0 ? "未连接" : "已连接")
|
|
|
|
// .arg(m_patientEmergencyInfos.length())
|
|
|
|
// );
|
|
|
|
// ui->statusLabel->setText(QString("%1 | %2")
|
|
|
|
// .arg(m_wsConnectedStatus == 0 ? "未连接" : "已连接")
|
|
|
|
// .arg(m_patientEmergencyInfos.length())
|
|
|
|
// );
|
|
|
|
if(m_wsConnectedStatus){ |
|
|
|
ui->LEDLabel->setStyleSheet("border-image: url(:/image/1LED_green.png);"); |
|
|
|
}else{ |
|
|
|
ui->LEDLabel->setStyleSheet("border-image: url(::/image/1LED_gray.png);"); |
|
|
|
} |
|
|
|
ui->statusLabel->setText(QString::number(m_patientEmergencyInfos.length())); |
|
|
|
if(m_patientEmergencyInfos.length() == 0){ |
|
|
|
ui->statusLabel->setText(QString::number(m_patientEmergencyInfos.length())); |
|
|
|
}else{ |
|
|
|
ui->statusLabel->setText(QString::number(m_patientIndex+1) + "/" + QString::number(m_patientEmergencyInfos.length())); |
|
|
|
} |
|
|
|
|
|
|
|
if(m_patientEmergencyInfos.length() == 0){ |
|
|
|
//不显示
|
|
|
@ -135,8 +147,8 @@ void MainWidget::resizeEvent(QResizeEvent *event) |
|
|
|
//标题
|
|
|
|
// ui->textLabel->setGeometry(0,0,this->width(),(this->height()-30)/2);
|
|
|
|
ui->countdownLabel->setGeometry(0,(this->height()-30)/2,this->width(),(this->height()-30)/2); |
|
|
|
ui->LEDLabel->setGeometry(this->width()-120,this->height()-30,20,30); |
|
|
|
ui->statusLabel->setGeometry(this->width()-80,this->height()-30,20,30); |
|
|
|
ui->LEDLabel->setGeometry(this->width()-110,this->height()-30,30,30); |
|
|
|
ui->statusLabel->setGeometry(this->width()-80,this->height()-30,55,30); |
|
|
|
} |
|
|
|
|
|
|
|
void MainWidget::lableScrollDisplay() |
|
|
@ -180,6 +192,10 @@ void MainWidget::onNewPatientMergencyInfo(QString firstAidId, QString name, QStr |
|
|
|
PatientEmergencyInfo *pInfo = new PatientEmergencyInfo(firstAidId,name,content,realCountDownInSeconds); |
|
|
|
addPatientToList(pInfo); |
|
|
|
qDebug() << "MainWidget::onNewPatientMergencyInfo " << firstAidId << name << content << realCountDownInSeconds; |
|
|
|
m_deviceService->timer1.start(); |
|
|
|
m_deviceService->m_ledStatus ^= 1; |
|
|
|
m_deviceService->ledSet(m_deviceService->m_ledStatus); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
void MainWidget::onPatientMergencyStatusChanged(QString firstAidId,QString time, QString status) |
|
|
@ -213,6 +229,26 @@ void MainWidget::onKeyClicked() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MainWidget::onKeyDown() |
|
|
|
{ |
|
|
|
keyDownPInfo = m_patientEmergencyInfos[m_patientIndex]; |
|
|
|
} |
|
|
|
|
|
|
|
void MainWidget::onKeyWorked(KeyFlag flag) |
|
|
|
{ |
|
|
|
m_deviceService->timer1.stop(); |
|
|
|
if(flag == Click){ |
|
|
|
m_deviceService->m_ledStatus = 0; |
|
|
|
m_deviceService->ledSet(m_deviceService->m_ledStatus); |
|
|
|
}else if(flag == Dbl_Click){ |
|
|
|
updateUi(); |
|
|
|
}else if(flag == Press){ |
|
|
|
deletePatientFromList(keyDownPInfo->id); |
|
|
|
m_deviceService->m_ledStatus = 1; |
|
|
|
m_deviceService->ledSet(m_deviceService->m_ledStatus); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MainWidget::addPatientToList(PatientEmergencyInfo *info) |
|
|
|
{ |
|
|
|
//1.如果有就删除,以保证同一个病人按两次应该重新开始计时
|
|
|
|