GUI standby v1.0

This commit is contained in:
Krad
2021-10-20 15:55:15 +08:00
parent 7867ca7bcc
commit ac8d913b55
12 changed files with 105 additions and 33 deletions

View File

@@ -42,6 +42,10 @@ void InputObject::initUi()
min-height:100px;max-height:100px; min-width:500px;max-width:500px;\
border: 2px solid #ef9cba; border-radius:20px;\
font-family:Arial; color:white;margin:0;font-size:36px;}"
"QTextEdit{background-color: rgba(0,0,0,0.5);\
min-height:300px;max-height:300px; min-width:700px;max-width:700px;\
border: 2px solid #ef9cba; border-radius:20px;\
font-family:Arial; color:white;margin:0;font-size:36px;}"
"QDateEdit::up-button{image: url(:/up.png);height:15px;}"
"QDateEdit::down-button{image:url(:/down.png);height:15px;}"
;
@@ -84,6 +88,7 @@ bool InputObject::eventFilter(QObject *obj, QEvent *event)
if (obj->objectName() == QString("qt_scrollarea_viewport"))
{
QTextEdit *_text= qobject_cast<QTextEdit*>(obj->parent());
if (!_text) return false;
if (_text == ui->textEdit) return true; //
if (_text->isEnabled())
{

View File

@@ -10,7 +10,7 @@ extern "C"{
typedef enum {
BUSY,// device is preparing for scan
READY,// device is ready for scan
SCANING,// device is doing scan
SCANNING,// device is doing scan
ERROR// some device inner error are occured
} DeviceStatus;
@@ -38,11 +38,11 @@ extern int ScanControl(ScanAction actionType);
extern StatusInfo GetStatus();
extern int SetScanInf(const char *jsonString);
extern int SetScanInfo(const char *jsonString,int empty);
extern const char *GetPreviewData();
extern const char *GetDeviceInf(DeviceInfo infoType);
extern const char *GetDeviceInfo(DeviceInfo infoType);
#ifdef __cplusplus
};

View File

@@ -33,7 +33,7 @@ void DeviceManager::initDevice() {
connect(EventCenter::Default(),&EventCenter::RequestEmptyScan,[=](QObject* sender, QObject* detail){
std::string json= getJsonFromPatInf(detail);
printf("%s\r\n",json.c_str());
processScan(json.c_str());
processScan(json.c_str(), true);
});
// Patient scan
connect(EventCenter::Default(),&EventCenter::RequestPatientScan,[=](QObject* sender, QObject* detail){
@@ -48,7 +48,7 @@ void DeviceManager::initDevice() {
connect(EventCenter::Default(),&EventCenter::RequestStop,[=]() {
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, nullptr);
StatusInfo inf = GetStatus();
if (inf.status == SCANING) {
if (inf.status == SCANNING) {
//ScanControl fail
if (ScanControl(STOP)) {
QString msg("Stop operation fail!");
@@ -72,7 +72,7 @@ void DeviceManager::initDevice() {
//ScanControl
if(!ScanControl(PREVIEW_SCAN))
{
lastStatus = SCANING;
lastStatus = SCANNING;
previewing = true;
timerID = startTimer(500);
TRIGGER_EVENT(GUIEvents::ResponsePreview, nullptr, nullptr);
@@ -89,9 +89,9 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
if (event->timerId() !=deviceInfTimerID)
{
StatusInfo inf = GetStatus();
if (inf.status==SCANING)
if (inf.status==SCANNING)
{
lastStatus = SCANING;
lastStatus = SCANNING;
//normal scan
if(!previewing)
{
@@ -107,7 +107,7 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
}
} else{
if (lastStatus == SCANING && !errorOccured)
if (lastStatus == SCANNING && !errorOccured)
{
QVariant var(true);
TRIGGER_EVENT(GUIEvents::InvokeOperationEnd, nullptr, (QObject*)&var);
@@ -115,7 +115,7 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
previewing = false;
}
//内部错误导致Scan停止
else if (lastStatus == SCANING && errorOccured)
else if (lastStatus == SCANNING && errorOccured)
{
//正常情况下设备应该已经调用的错误callback然后会回归Ready状态清理lastStatus即可
lastStatus = -1;
@@ -124,15 +124,15 @@ void DeviceManager::timerEvent(QTimerEvent *event) {
killTimer(timerID);
}
} else{
QString temp = QString(GetDeviceInf(MEAN_TEMPERATURE));
QString temp = QString(GetDeviceInfo(MEAN_TEMPERATURE));
TRIGGER_EVENT(GUIEvents::ResponseDeviceTemperature, nullptr, (QObject*)&temp);
}
}
void DeviceManager::processScan(const char *json) {
void DeviceManager::processScan(const char *json, bool empty) {
static QString msg = "Start scan...";
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, (QObject*)&msg);
int ret = SetScanInf(json);
int ret = SetScanInfo(json,empty?1:0);
if (ret){
QString errmsg("Transfer patient information fail!");
THROW_ERROR(errmsg);
@@ -143,7 +143,7 @@ void DeviceManager::processScan(const char *json) {
{
//ScanControl fail
if(!ScanControl(SCAN)) {
lastStatus = SCANING;
lastStatus = SCANNING;
timerID = startTimer(300);
return;
}

View File

@@ -20,7 +20,7 @@ protected:
void timerEvent(QTimerEvent* event) override ;
private:
void processScan(const char * json);
void processScan(const char * json,bool empty = false);
int timerID = -1;
int deviceInfTimerID = -1;
int lastStatus=-1;

View File

@@ -55,6 +55,7 @@ EditPatientForm::EditPatientForm(QWidget *parent) :
this->setEditEnable(false);
emit editAccept(getPatientInformation());
});
ui->tbx_Dob->setDisplayFormat("yyyy/MM/dd");
}
EditPatientForm::~EditPatientForm()

View File

@@ -8,9 +8,12 @@ int main(int argc, char *argv[])
qputenv("QT_IM_MODULE", QByteArray("qtvirtualkeyboard"));
qputenv("QT_VIRTUALKEYBOARD_STYLE", QByteArray("retro"));
//qputenv("QT_LOGGING_RULES", QByteArray("qt.virtualkeyboard=true"));
qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", "..\\src\\layouts");
QApplication a(argc, argv);
QString layouts_path = QString(QCoreApplication::applicationDirPath()).append("/layouts");
qputenv("QT_VIRTUALKEYBOARD_LAYOUT_PATH", QByteArray(layouts_path.toStdString().c_str()));
//a.installEventFilter(obj);
InputObject *obj = new InputObject();

View File

@@ -39,11 +39,11 @@ void PatientInformationForm::setProtocol(int type) {
const char *PatientInformationForm::getCurrentPatientJsonString(bool empty) {
cJSON* root=cJSON_CreateObject();
cJSON_AddItemToObject(root, "PatientName",cJSON_CreateString(ui->lbl_Name->text().toStdString().data()));
cJSON_AddItemToObject(root, "PatientID",cJSON_CreateString(ui->lbl_ID->text().toStdString().data()));
cJSON_AddItemToObject(root, "PatientSex",cJSON_CreateString(ui->lbl_Sex->text().toStdString().data()));
cJSON_AddItemToObject(root, "PatientName",cJSON_CreateString(ui->lbl_Name->text().replace(' ','.').toStdString().data()));
cJSON_AddItemToObject(root, "PatientID",cJSON_CreateString(ui->lbl_ID->text().replace(' ','.').toStdString().data()));
cJSON_AddItemToObject(root, "PatientSex",cJSON_CreateString(ui->lbl_Sex->text().replace(' ','.').toStdString().data()));
cJSON_AddItemToObject(root, "PatientBirthDate",
cJSON_CreateString(ui->lbl_Date->text().replace("/","").replace("-","").toStdString().data()));
cJSON_CreateString(ui->lbl_Date->text().replace("/","").replace("-","").replace(' ','.').toStdString().data()));
cJSON_AddItemToObject(root, "Laterality",cJSON_CreateString(currentProtocol?"R":"L"));
cJSON_AddItemToObject(root, "EmptyDataFlag",cJSON_CreateNumber(empty?1:0));
cJSON_AddItemToObject(root, "OperatorName",cJSON_CreateString("Bob"));

View File

@@ -10,12 +10,12 @@ TabFormWidget::TabFormWidget(QWidget *parent) :
QPixmap img(":/icons/logo.png");
ui->logo->setPixmap(img.scaledToHeight(33,Qt::SmoothTransformation));
ui->company->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD>ƿƼ<EFBFBD>"));
// ui->company->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҽ<EFBFBD>ƿƼ<EFBFBD>"));
ui->lbl_msglogo->setPixmap(QPixmap(":/icons/msg.png").scaledToHeight(26,Qt::SmoothTransformation));
// ui->lbl_patlogo->setPixmap(QPixmap(":/icons/patient.png").scaledToHeight(26,Qt::SmoothTransformation));
ui->spacer_2->setVisible(false);
QLabel* hosp = new QLabel(this);
hosp->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>ѧҽѧԺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>ҽԺ "));
// hosp->setText(QString::fromLocal8Bit("<EFBFBD><EFBFBD><EFBFBD>ѧҽѧԺ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>ҽԺ "));
QLabel* nowDate = new QLabel(this);
nowDate->setText(QDateTime::currentDateTime().toString("yyyy-MM-dd hh:mm:ss"));
QLabel* linkIcon = new QLabel(this);