|
|
@ -3,6 +3,10 @@ |
|
|
|
#include <QtCore> |
|
|
|
#include "mainconfig.h" |
|
|
|
|
|
|
|
#define NAMELIST_LENGTH 4 |
|
|
|
QString namelist[] = {"传立春","传立夏","传立秋","传立冬"}; |
|
|
|
qint8 gindex = 0; |
|
|
|
|
|
|
|
MainWidget::MainWidget(QWidget *parent) : |
|
|
|
QWidget(parent), |
|
|
|
ui(new Ui::MainWidget) |
|
|
@ -48,9 +52,9 @@ MainWidget::MainWidget(QWidget *parent) : |
|
|
|
ui->textLabel->setStyleSheet("QLabel {color: rgb(255,0,0);}");//设置文本红色
|
|
|
|
ui->countdownLabel->setStyleSheet("QLabel {color: rgb(255,0,0);}");//设置文本红色
|
|
|
|
ui->statusLabel->setStyleSheet("QLabel {color: rgb(85,255,0);}");//设置文本绿色
|
|
|
|
// ui->textLabel->setAlignment(Qt::AlignHCenter);
|
|
|
|
// ui->countdownLabel->setAlignment(Qt::AlignHCenter);
|
|
|
|
// ui->statusLabel->setAlignment(Qt::AlignRight);
|
|
|
|
// ui->textLabel->setAlignment(Qt::AlignHCenter);
|
|
|
|
// ui->countdownLabel->setAlignment(Qt::AlignHCenter);
|
|
|
|
// ui->statusLabel->setAlignment(Qt::AlignRight);
|
|
|
|
|
|
|
|
m_curX = 0; |
|
|
|
connect(&m_lableScrollTimer,SIGNAL(timeout()),this,SLOT(lableScrollDisplay())); |
|
|
@ -67,10 +71,10 @@ 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{ |
|
|
@ -95,13 +99,18 @@ void MainWidget::updateUi() |
|
|
|
ui->textLabel->setText(pInfo->text); |
|
|
|
|
|
|
|
//显示倒计时
|
|
|
|
int hour,min,sec,nTotalSecs; |
|
|
|
nTotalSecs = pInfo->realCountDownInSeconds; |
|
|
|
sec = nTotalSecs % 60; |
|
|
|
// min = nTotalSecs / 60 % 60;
|
|
|
|
min = nTotalSecs / 60 ; //min显示大于60
|
|
|
|
hour = nTotalSecs / 3600; |
|
|
|
QString str = QString("%1:%2").arg(min,2,10,QLatin1Char('0')).arg(sec,2,10,QLatin1Char('0')); |
|
|
|
QString str = ""; |
|
|
|
if(pInfo->realCountDownInSeconds < 0){ |
|
|
|
str = ""; |
|
|
|
}else{ |
|
|
|
int hour,min,sec,nTotalSecs; |
|
|
|
nTotalSecs = pInfo->realCountDownInSeconds; |
|
|
|
sec = nTotalSecs % 60; |
|
|
|
// min = nTotalSecs / 60 % 60;
|
|
|
|
min = nTotalSecs / 60 ; //min显示大于60
|
|
|
|
hour = nTotalSecs / 3600; |
|
|
|
str = QString("%1:%2").arg(min,2,10,QLatin1Char('0')).arg(sec,2,10,QLatin1Char('0')); |
|
|
|
} |
|
|
|
ui->countdownLabel->setText(str); |
|
|
|
} |
|
|
|
|
|
|
@ -110,7 +119,7 @@ void MainWidget::paintEvent(QPaintEvent *event) |
|
|
|
//设置背景图片
|
|
|
|
QPainter p(this); |
|
|
|
p.drawPixmap(0,0,this->width(),this->height(),QPixmap(":/image/black_bg.jpg")); |
|
|
|
// qDebug() << "MainWidget::paintEvent";
|
|
|
|
// qDebug() << "MainWidget::paintEvent";
|
|
|
|
|
|
|
|
//重新调整label字体大小
|
|
|
|
//TODO
|
|
|
@ -121,7 +130,7 @@ void MainWidget::resizeEvent(QResizeEvent *event) |
|
|
|
QWidget::resizeEvent(event); |
|
|
|
|
|
|
|
//标题
|
|
|
|
// ui->textLabel->setGeometry(0,0,this->width(),(this->height()-30)/2);
|
|
|
|
// 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); |
|
|
@ -137,7 +146,7 @@ void MainWidget::lableScrollDisplay() |
|
|
|
else{ |
|
|
|
m_curX ++; |
|
|
|
ui->textLabel->setGeometry(20-m_curX,0,m_width,(this->height()-30)/2); |
|
|
|
// qDebug()<<"move" <<m_curX;
|
|
|
|
// qDebug()<<"move" <<m_curX;
|
|
|
|
} |
|
|
|
if(m_curX > (m_width - this->width())){ |
|
|
|
m_curX = 0; |
|
|
@ -152,7 +161,7 @@ void MainWidget::onWsConnectedStatusChanged(int status) |
|
|
|
updateUi(); |
|
|
|
} |
|
|
|
|
|
|
|
void MainWidget::onNewPatientMergencyInfo(QString firstAidId, QString name, QString content, quint64 realCountDownInSeconds) |
|
|
|
void MainWidget::onNewPatientMergencyInfo(QString firstAidId, QString name, QString content, qint64 realCountDownInSeconds) |
|
|
|
{ |
|
|
|
//TODO 此处是否需要加锁处理
|
|
|
|
PatientEmergencyInfo *pInfo = new PatientEmergencyInfo(firstAidId,name,content,realCountDownInSeconds); |
|
|
@ -181,6 +190,16 @@ void MainWidget::onPatientMergencyStatusChanged(QString firstAidId,QString time, |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MainWidget::onKeyClicked() |
|
|
|
{ |
|
|
|
emit complexOneKeyStart("142733198703123918",::namelist[::gindex],"1","汉族"); |
|
|
|
qDebug() << "Key Clicked"; |
|
|
|
|
|
|
|
if(++::gindex >= NAMELIST_LENGTH){ |
|
|
|
::gindex = 0; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MainWidget::addPatientToList(PatientEmergencyInfo *info) |
|
|
|
{ |
|
|
|
//1.如果有就删除,以保证同一个病人按两次应该重新开始计时
|
|
|
@ -206,3 +225,13 @@ void MainWidget::deletePatientFromList(QString firstAidId) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
void MainWidget::mouseDoubleClickEvent(QMouseEvent *event) |
|
|
|
{ |
|
|
|
if(event->button()==Qt::LeftButton){ |
|
|
|
//TODO
|
|
|
|
} |
|
|
|
else if(event->button()==Qt::RightButton){ |
|
|
|
onKeyClicked(); |
|
|
|
} |
|
|
|
} |
|
|
|