Compare commits
10 Commits
3a6a755ef1
...
v0.6.11
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3d22dc1512 | ||
|
|
ae89aeffe4 | ||
|
|
6ba9786efb | ||
|
|
a7a5e1e308 | ||
|
|
d18332baed | ||
|
|
f7540385a4 | ||
|
|
1abd387617 | ||
|
|
24f6e4e97c | ||
|
|
2e9fb9960e | ||
|
|
99f19e8b5b |
@@ -8,7 +8,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
# GUI Version
|
||||
set(GUI_VERSION_MAJOR 0)
|
||||
set(GUI_VERSION_MINOR 6)
|
||||
set(GUI_VERSION_BUILD 10)
|
||||
set(GUI_VERSION_BUILD 11)
|
||||
set(GUI_VERSION_BETA 1)
|
||||
# use AppVersion.h as a configure file
|
||||
configure_file(
|
||||
|
||||
8
docs/v0.6.11.txt
Normal file
8
docs/v0.6.11.txt
Normal file
@@ -0,0 +1,8 @@
|
||||
v0.6.11
|
||||
1. 修复CMake导致的UI构建错误
|
||||
2. ShimLib加入了DEV_OUTPATH(当前Scan的数据存储目录)功能
|
||||
3. 给日期滑块加入了日期限制。
|
||||
4. 修复了TableView列头点击导致的选中行丢失问题。
|
||||
5. Windows下新增了异步仿真逻辑。
|
||||
6. 实现了Scan json的生成。
|
||||
7. 实现了新的分段Scan逻辑。
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
#include "DateSelectDialog.h"
|
||||
#include <QVBoxLayout>
|
||||
#include <QLabel>
|
||||
#include <QDate>
|
||||
#include "components/DateSlidePickerBox.h"
|
||||
DateSelectDialog::DateSelectDialog(QWidget *parent, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) {
|
||||
this->setFixedSize(460, 380);
|
||||
@@ -11,7 +13,12 @@ DateSelectDialog::DateSelectDialog(QWidget *parent, Qt::WindowFlags f) : GUIForm
|
||||
box = new DateSlidePickerBox(formWidget);
|
||||
box->setObjectName("slider_one");
|
||||
box->setSelectedValue("1990-01-01");
|
||||
lbl_error = new QLabel(this);
|
||||
lbl_error->setObjectName("warn");
|
||||
lbl_error->setVisible(false);
|
||||
lbl_error->setText(tr("Date exceeded!"));
|
||||
layout->addWidget(box);
|
||||
layout->addWidget(lbl_error);
|
||||
}
|
||||
|
||||
DateSelectDialog::~DateSelectDialog() {
|
||||
@@ -19,6 +26,7 @@ DateSelectDialog::~DateSelectDialog() {
|
||||
}
|
||||
|
||||
QString DateSelectDialog::getSelectedValue() {
|
||||
|
||||
return box->getSelectedValue();
|
||||
}
|
||||
|
||||
@@ -28,6 +36,13 @@ void DateSelectDialog::setSelectedValue(const QString &val) {
|
||||
}
|
||||
|
||||
bool DateSelectDialog::updateReferenceData() {
|
||||
if (onlyBackward){
|
||||
QDate v = QDate::fromString(box->getSelectedValue(),"yyyy-MM-dd");
|
||||
bool flag = QDate::currentDate()>=v;
|
||||
this->setFixedHeight(flag? 380:410);
|
||||
lbl_error->setVisible(!flag);
|
||||
return flag;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include "dialogs/GUIFormBaseDialog.h"
|
||||
class DateSlidePickerBox;
|
||||
class QLabel;
|
||||
class DateSelectDialog:public GUIFormBaseDialog{
|
||||
Q_OBJECT
|
||||
public:
|
||||
@@ -15,9 +16,14 @@ public:
|
||||
QString getSelectedValue();
|
||||
void setSelectedValue(const QString& val);
|
||||
void showEvent(QShowEvent *) override;
|
||||
void setOnlyBackward(bool val){
|
||||
onlyBackward = val;
|
||||
}
|
||||
protected:
|
||||
bool updateReferenceData() override;
|
||||
DateSlidePickerBox* box;
|
||||
QLabel* lbl_error = nullptr;
|
||||
bool onlyBackward = true;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -1,80 +1,106 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include "ShimLib.h"
|
||||
|
||||
#include <Windows.h>
|
||||
#include <process.h>
|
||||
#include <time.h>
|
||||
|
||||
typedef void(*error_cb)(const char* msg);
|
||||
|
||||
int statusCountFlag = 0;
|
||||
error_cb innerCallback = NULL;
|
||||
|
||||
|
||||
void ThreadFunc(void*);
|
||||
HANDLE th;
|
||||
HANDLE e1,e2;
|
||||
int InitLib(error_cb cb) {
|
||||
innerCallback = cb;
|
||||
innerCallback("11111");
|
||||
e1 = CreateEvent(NULL, FALSE, FALSE, "e1");
|
||||
e2 = CreateEvent(NULL, FALSE, FALSE, "e2");
|
||||
th = _beginthread(ThreadFunc,0, NULL);
|
||||
return 0;
|
||||
}
|
||||
|
||||
volatile int running = 1;
|
||||
volatile int progress = 0;
|
||||
volatile int status = READY;
|
||||
volatile int stop_flag = 0;
|
||||
char output_path[256] = {0};
|
||||
|
||||
void ThreadFunc(void* args){
|
||||
while (running){
|
||||
WaitForSingleObject(e1, INFINITE);
|
||||
status = SCANNING;
|
||||
stop_flag = 0;
|
||||
progress = 0;
|
||||
for (int i = 0; i < 50; ++i) {
|
||||
if (stop_flag > 0){
|
||||
stop_flag = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if (i == 20){
|
||||
progress = 139;
|
||||
WaitForSingleObject(e2, INFINITE);
|
||||
}
|
||||
else if ( i > 20 && i<35){
|
||||
progress = i * 2 + 100;
|
||||
}
|
||||
else if(i >= 35){
|
||||
progress = i * 2 + 200;
|
||||
}
|
||||
else{
|
||||
progress = i *2;
|
||||
}
|
||||
Sleep(300);
|
||||
}
|
||||
status = READY;
|
||||
}
|
||||
}
|
||||
|
||||
int ScanControl(ScanAction actionType) {
|
||||
|
||||
switch (actionType) {
|
||||
case SCAN:
|
||||
printf("Do Scan!\r\n");
|
||||
statusCountFlag = 2;
|
||||
break;
|
||||
case PREVIEW_SCAN:
|
||||
statusCountFlag = 1;
|
||||
printf("Do preview!\r\n");
|
||||
break;
|
||||
case STOP:
|
||||
statusCountFlag = 0;
|
||||
printf("Stop everything!\r\n");
|
||||
break;
|
||||
}
|
||||
case SCAN:
|
||||
printf("Do Scan!\r\n");
|
||||
statusCountFlag = 2;
|
||||
SYSTEMTIME st = {0};
|
||||
GetLocalTime(&st);
|
||||
sprintf(output_path, "%d%02d%02dT%02d%02d%02d",
|
||||
st.wYear,
|
||||
st.wMonth,
|
||||
st.wDay,
|
||||
st.wHour,
|
||||
st.wMinute,
|
||||
st.wSecond);
|
||||
SetEvent(e1);
|
||||
break;
|
||||
case PREVIEW_SCAN:
|
||||
statusCountFlag = 1;
|
||||
printf("Do preview!\r\n");
|
||||
break;
|
||||
case STOP:
|
||||
statusCountFlag = 0;
|
||||
stop_flag = 1;
|
||||
progress = 0;
|
||||
status = READY;
|
||||
printf("Stop everything!\r\n");
|
||||
break;
|
||||
case SCAN_CONTINUE:
|
||||
SetEvent(e2);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
StatusInfo GetStatus() {
|
||||
StatusInfo inf;
|
||||
switch (statusCountFlag)
|
||||
{
|
||||
case 0:
|
||||
inf.status = READY;
|
||||
break;
|
||||
case 1:
|
||||
inf.status = SCANNING;
|
||||
inf.progress = 0.0f;
|
||||
break;
|
||||
case 2:
|
||||
inf.status = SCANNING;
|
||||
inf.progress = 0.3f;
|
||||
statusCountFlag++;
|
||||
break;
|
||||
case 3:
|
||||
inf.status = SCANNING;
|
||||
inf.progress = 0.6f;
|
||||
statusCountFlag++;
|
||||
break;
|
||||
case 4:
|
||||
inf.status = SCANNING;
|
||||
inf.progress = 0.9f;
|
||||
statusCountFlag++;
|
||||
break;
|
||||
case 5:
|
||||
inf.status = SCANNING;
|
||||
inf.progress = 1.0f;
|
||||
statusCountFlag = 0;
|
||||
break;
|
||||
case 6:
|
||||
// case 7:
|
||||
// inf.status = BUSY;
|
||||
// statusCountFlag++;
|
||||
// break;
|
||||
// case 8:
|
||||
inf.status = BUSY;
|
||||
statusCountFlag = 0;
|
||||
break;
|
||||
default:
|
||||
inf.status = BUSY;
|
||||
statusCountFlag = 0;
|
||||
}
|
||||
inf.status = status;
|
||||
inf.progress = progress;
|
||||
return inf;
|
||||
}
|
||||
|
||||
@@ -109,12 +135,19 @@ const char* GetPreviewData() {
|
||||
|
||||
const char* GetDeviceInfo(DeviceInfo infoType) {
|
||||
switch (infoType) {
|
||||
case MEAN_TEMPERATURE:
|
||||
return "28";
|
||||
case VERSION:
|
||||
return "6.6.06";
|
||||
case DEV_OUTPATH:
|
||||
return "path to store bin";
|
||||
case MEAN_TEMPERATURE:
|
||||
return "28";
|
||||
case VERSION:
|
||||
return "6.6.06";
|
||||
case DEV_OUTPATH:
|
||||
return output_path;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
void StopDevice(){
|
||||
CloseHandle(e1);
|
||||
CloseHandle(e2);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -16,7 +16,7 @@ typedef enum {
|
||||
|
||||
typedef struct StatusInfo {
|
||||
DeviceStatus status;// a enum represent device current status
|
||||
float progress;// percent value of operation
|
||||
int progress;// percent value of operation
|
||||
} StatusInfo;
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ typedef enum {
|
||||
SCAN,// Start scan action
|
||||
PREVIEW_SCAN,// Start preview scan action
|
||||
STOP,// Stop current scan
|
||||
SCAN_CONTINUE,//Continue pending scan
|
||||
} ScanAction;
|
||||
|
||||
//kinds of device information
|
||||
@@ -46,6 +47,11 @@ extern const char *GetPreviewData();
|
||||
|
||||
extern const char *GetDeviceInfo(DeviceInfo infoType);
|
||||
|
||||
#ifdef _WIN32
|
||||
extern void StopDevice();
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,8 @@
|
||||
#define APP_VALUES()\
|
||||
ADD_APP_VALUE(InProcessing)\
|
||||
ADD_APP_VALUE(LastOperationTime)\
|
||||
ADD_APP_VALUE(LastOperation)
|
||||
ADD_APP_VALUE(LastOperation)\
|
||||
ADD_APP_VALUE(EmptyScanFlag)\
|
||||
|
||||
#include <QApplication>
|
||||
#include <QVariant>
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include <QDateTime>
|
||||
#include <qdebug.h>
|
||||
#include "appvals/AppGlobalValues.h"
|
||||
#include "json/ScanJson.h"
|
||||
#define TRIGGER_EVENT EventCenter::Default()->triggerEvent
|
||||
|
||||
#define THROW_ERROR(errormsg)\
|
||||
@@ -31,7 +32,6 @@ const char* getStatusString(int status)
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
std::string getJsonFromPatInf(QObject* obj)
|
||||
{
|
||||
return ((QString*)obj)->toStdString();
|
||||
@@ -58,10 +58,6 @@ void DeviceManager::initDevice() {
|
||||
// empty scan
|
||||
connect(EventCenter::Default(), &EventCenter::RequestEmptyScan, [=](QObject* sender, QObject* detail) {
|
||||
std::string json = getJsonFromPatInf(detail);
|
||||
// qDebug()<<json.c_str();
|
||||
// void * jss = malloc(json.size());
|
||||
// memcpy(jss,json.c_str(),json.size());
|
||||
// processScan((char*)jss,true);
|
||||
processScan(json.c_str(), true);
|
||||
});
|
||||
// Patient scan
|
||||
@@ -70,12 +66,13 @@ void DeviceManager::initDevice() {
|
||||
qDebug() << json.c_str();
|
||||
if (!json.empty())
|
||||
{
|
||||
// void * jss = malloc(json.size());
|
||||
// memcpy(jss,json.c_str(),json.size());
|
||||
// processScan((char*)jss);
|
||||
processScan(json.c_str());
|
||||
}
|
||||
});
|
||||
// Continue Scan
|
||||
connect(EventCenter::Default(), &EventCenter::RequestContinueScan, [=](QObject* sender, QObject* detail) {
|
||||
postContinueCommand(true);
|
||||
});
|
||||
// stop
|
||||
connect(EventCenter::Default(), &EventCenter::RequestStop, [=]() {
|
||||
qDebug() << "GetStatus";
|
||||
@@ -93,11 +90,6 @@ void DeviceManager::initDevice() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if (inf.status == BUSY) {
|
||||
// QString msg("Device is busy, Stop operation fail!");
|
||||
// THROW_ERROR(msg);
|
||||
// return;
|
||||
// };
|
||||
AppGlobalValues::setInProcessing(true);
|
||||
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, nullptr);
|
||||
//ScanControl fail
|
||||
@@ -203,9 +195,6 @@ void DeviceManager::timerEvent(QTimerEvent* event) {
|
||||
//error exit, callback error
|
||||
if (errorOccurred)
|
||||
{
|
||||
// qDebug() << "Error occurred, exit progress timer";
|
||||
// QString msg("Error occurred, exit current operation!");
|
||||
// THROW_ERROR(msg);
|
||||
goto exitTimer;
|
||||
}
|
||||
// previewing exit
|
||||
@@ -222,14 +211,36 @@ void DeviceManager::timerEvent(QTimerEvent* event) {
|
||||
qDebug() << "Scanning request status, status:" << getStatusString(inf.status);
|
||||
//设备正常扫描中
|
||||
if (inf.status == SCANNING) {
|
||||
qDebug() <<"current output path:"<<getScanOutputPath();
|
||||
lastStatus = SCANNING;
|
||||
//normal scan
|
||||
QVariant var(inf.progress);
|
||||
qDebug() << "Normal scan, invoke InvokeOperationProgress:" << inf.progress;
|
||||
TRIGGER_EVENT(GUIEvents::InvokeOperationProgress, nullptr, (QObject*)&var);
|
||||
return;
|
||||
}
|
||||
qDebug() << "current output path:" << getScanOutputPath();
|
||||
lastStatus = SCANNING;
|
||||
|
||||
//normal scan pending
|
||||
int phase = inf.progress/100 + 1;
|
||||
int progress = inf.progress % 100;
|
||||
QString extraMsg = (AppGlobalValues::EmptyScanFlag().toBool()||(scanPhase != 3))?"":", patient can leave";
|
||||
QVariant var(QString("Phase %1%3\r\n progress:%2%").arg(scanPhase).arg(progress).arg(extraMsg));
|
||||
TRIGGER_EVENT(GUIEvents::InvokeOperationProgress, nullptr, (QObject *) &var);
|
||||
if (scanPhase != phase) {
|
||||
if (phase > 3 || scanPhase > phase ){
|
||||
QString errorMsg = QString("Error Scan Phase code, current Phase code:%1, new Phase code:%2!").arg(scanPhase,phase);
|
||||
THROW_ERROR(errorMsg)
|
||||
goto exitTimer;
|
||||
}
|
||||
scanPhase = phase;
|
||||
if (scanPhase == 2){
|
||||
if (!AppGlobalValues::EmptyScanFlag().toBool()) {
|
||||
var.setValue(QString("Scan phase 2 waiting for patient!\r\n Click \"Next\" to continue!"));
|
||||
TRIGGER_EVENT(GUIEvents::InvokeOperationPending, nullptr, (QObject *) &var);
|
||||
goto exitTimer;
|
||||
}
|
||||
//empty scan no pending, auto continue
|
||||
else {
|
||||
postContinueCommand();
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
else {
|
||||
//未发生错误并且,之前状态是扫描,代表正常扫描完成
|
||||
if (lastStatus == SCANNING) {
|
||||
@@ -244,6 +255,22 @@ void DeviceManager::timerEvent(QTimerEvent* event) {
|
||||
QString s("%1 %2");
|
||||
s = s.arg(QDateTime::currentDateTime().toString("yyyy/MM/dd HH:mm:ss")).arg("Scan finished");
|
||||
TRIGGER_EVENT(GUIEvents::GlobalBannerMessage, nullptr, (QObject*)&s);
|
||||
QString outputPath = GetDeviceInfo(DeviceInfo::DEV_OUTPATH);
|
||||
outputPath = outputPath.replace("\\","/");
|
||||
if (outputPath.endsWith('/')) outputPath = outputPath.remove(outputPath.length()-1,1);
|
||||
QStringList list = outputPath.split('/');
|
||||
if (list.length()){
|
||||
if (AppGlobalValues::EmptyScanFlag().toBool()){
|
||||
ScanJson::Current()->setEmptyScanID(list.last().toStdString().c_str());
|
||||
}else{
|
||||
ScanJson::Current()->setScanID(list.last().toStdString().c_str());
|
||||
}
|
||||
ScanJson::Current()->save();
|
||||
}
|
||||
else{
|
||||
QString msg("Scan Output Path error!");
|
||||
THROW_ERROR(msg);
|
||||
}
|
||||
}
|
||||
//一般不会出现其他情况
|
||||
else {
|
||||
@@ -282,6 +309,7 @@ void DeviceManager::processScan(const char* json, bool empty) {
|
||||
AppGlobalValues::setInProcessing(true);
|
||||
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, (QObject*)&msg);
|
||||
qDebug() << "SetScanInfo>>>>>>>>>>>>>>>>>>>>";
|
||||
AppGlobalValues::setEmptyScanFlag(empty);
|
||||
int ret = SetScanInfo(json, empty ? 1 : 0);
|
||||
if (ret) {
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>SetScanInfo failed";
|
||||
@@ -291,23 +319,42 @@ void DeviceManager::processScan(const char* json, bool empty) {
|
||||
return;
|
||||
}
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>SetScanInfo success";
|
||||
//ScanControl fail
|
||||
qDebug() << "ScanControl start>>>>>>>>>>>>>>>>>>>>>";
|
||||
if (!ScanControl(SCAN)) {
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>ScanControl success";
|
||||
//set current state
|
||||
lastStatus = SCANNING;
|
||||
previewing = false;
|
||||
qDebug() << "Start progress timer";
|
||||
timerID = startTimer(500);
|
||||
return;
|
||||
}
|
||||
QString errmsg("ScanControl start fail!");
|
||||
THROW_ERROR(errmsg);
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>ScanControl failed";
|
||||
|
||||
postScanCommand();
|
||||
}
|
||||
|
||||
void DeviceManager::postScanCommand() {
|
||||
qDebug() << "ScanControl start>>>>>>>>>>>>>>>>>>>>>";
|
||||
if (!ScanControl(SCAN)) {
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>ScanControl success";
|
||||
//set current state
|
||||
lastStatus = SCANNING;
|
||||
previewing = false;
|
||||
scanPhase = 1;
|
||||
qDebug() << "Start progress timer";
|
||||
timerID = startTimer(500);
|
||||
return;
|
||||
}
|
||||
//ScanControl fail
|
||||
QString errmsg("ScanControl start fail!");
|
||||
THROW_ERROR(errmsg);
|
||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>ScanControl failed";
|
||||
}
|
||||
|
||||
void DeviceManager::postContinueCommand(bool useTimer) {
|
||||
if (!ScanControl(SCAN_CONTINUE)) {
|
||||
if (useTimer)timerID = startTimer(500);
|
||||
return;
|
||||
}
|
||||
//ScanControl fail
|
||||
QString errmsg("ScanControl start fail!");
|
||||
THROW_ERROR(errmsg);
|
||||
}
|
||||
|
||||
void DeviceManager::close() {
|
||||
#ifdef _WIN32
|
||||
StopDevice();
|
||||
#endif
|
||||
previewDataCaller->terminate();
|
||||
delete previewDataCaller;
|
||||
}
|
||||
@@ -319,3 +366,5 @@ QString DeviceManager::getSoftwareVersion() {
|
||||
QString DeviceManager::getScanOutputPath() {
|
||||
return GetDeviceInfo(DEV_OUTPATH);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@ protected:
|
||||
|
||||
private:
|
||||
void processScan(const char* json, bool empty = false);
|
||||
void postScanCommand();
|
||||
void postContinueCommand(bool useTimer = false);
|
||||
int scanPhase = 1;
|
||||
int timerID = -1;
|
||||
int deviceInfTimerID = -1;
|
||||
int lastStatus = -1;
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
#include "guimessagedialog.h"
|
||||
#include "ui_guimessagedialog.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include <QToolButton>
|
||||
#include <QHBoxLayout>
|
||||
GUIMessageDialog::GUIMessageDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::GUIMessageDialog)
|
||||
@@ -12,8 +14,21 @@ GUIMessageDialog::GUIMessageDialog(QWidget *parent) :
|
||||
this->showFullScreen ();
|
||||
ui->lbl_msg->setVisible(false);
|
||||
ui->lbl_progressicon->setVisible(false);
|
||||
ui->btn_main->setVisible(false);
|
||||
ui->btn_main->setText("OK");
|
||||
btn_main = new QToolButton(this);
|
||||
btn_main->setObjectName("btn_main");
|
||||
btn_main->setVisible(false);
|
||||
btn_main->setText("OK");
|
||||
btn_Append = new QToolButton(this);
|
||||
btn_Append->setObjectName("btn_main");
|
||||
btn_Append->setVisible(false);
|
||||
btn_Append->setText("Stop");
|
||||
QWidget* btnContainer = new QWidget(this);
|
||||
QHBoxLayout* hlayout = new QHBoxLayout(btnContainer);
|
||||
hlayout->setMargin(0);
|
||||
hlayout->addWidget(btn_main);
|
||||
hlayout->addWidget(btn_Append);
|
||||
|
||||
ui->widget_2->layout()->addWidget(btnContainer);
|
||||
this->setWindowOpacity(0.6);
|
||||
for (int i=1; i<=6;i++)
|
||||
{
|
||||
@@ -51,14 +66,14 @@ void GUIMessageDialog::stopLoading() {
|
||||
killTimer(timerID);
|
||||
timerID=-1;
|
||||
}
|
||||
disconnect(ui->btn_main,0,0,0);
|
||||
disconnect(btn_main,0,0,0);
|
||||
ui->lbl_progressicon->setVisible(false);
|
||||
}
|
||||
|
||||
void GUIMessageDialog::startLoading() {
|
||||
ui->lbl_progressicon->setVisible(true);
|
||||
disconnect(ui->btn_main,0,0,0);
|
||||
connect(ui->btn_main,&QToolButton::clicked,[=](){
|
||||
disconnect(btn_main,0,0,0);
|
||||
connect(btn_main,&QToolButton::clicked,[=](){
|
||||
if (timerID != -1){
|
||||
killTimer(timerID);
|
||||
timerID = -1;
|
||||
@@ -68,9 +83,8 @@ void GUIMessageDialog::startLoading() {
|
||||
LOG_USER_OPERATION(Stop);
|
||||
});
|
||||
timerID = startTimer(100);
|
||||
ui->btn_main->setText("Stop");
|
||||
ui->btn_main->setVisible(true);
|
||||
|
||||
btn_main->setText("Stop");
|
||||
btn_main->setVisible(true);
|
||||
}
|
||||
|
||||
void GUIMessageDialog::showMessage(QString msg) {
|
||||
@@ -79,10 +93,10 @@ void GUIMessageDialog::showMessage(QString msg) {
|
||||
}
|
||||
|
||||
void GUIMessageDialog::showExitButton() {
|
||||
ui->btn_main->setText("OK");
|
||||
ui->btn_main->setVisible(true);
|
||||
disconnect(ui->btn_main,0,0,0);
|
||||
connect(ui->btn_main,&QToolButton::clicked,[=](){
|
||||
btn_main->setText("OK");
|
||||
btn_main->setVisible(true);
|
||||
disconnect(btn_main,0,0,0);
|
||||
connect(btn_main,&QToolButton::clicked,[=](){
|
||||
if (timerID != -1){
|
||||
killTimer(timerID);
|
||||
timerID = -1;
|
||||
@@ -98,10 +112,27 @@ void GUIMessageDialog::hideMessage() {
|
||||
}
|
||||
|
||||
void GUIMessageDialog::hideExitButton() {
|
||||
ui->btn_main->setVisible(false);
|
||||
disconnect(ui->btn_main,0,0,0);
|
||||
btn_main->setVisible(false);
|
||||
disconnect(btn_main,0,0,0);
|
||||
}
|
||||
|
||||
void GUIMessageDialog::setOpacity(double opacity) {
|
||||
this->setWindowOpacity(opacity);
|
||||
}
|
||||
|
||||
void GUIMessageDialog::startPending() {
|
||||
disconnect(btn_Append,0,0,0);
|
||||
connect(btn_Append,&QToolButton::clicked,[=](){
|
||||
EventCenter::Default()->triggerEvent(GUIEvents::RequestContinueScan, nullptr, nullptr);
|
||||
stopPending();
|
||||
});
|
||||
btn_Append->setText("Next");
|
||||
btn_Append->setVisible(true);
|
||||
pending = true;
|
||||
}
|
||||
|
||||
void GUIMessageDialog::stopPending() {
|
||||
disconnect(btn_Append,0,0,0);
|
||||
btn_Append->setVisible(false);
|
||||
pending = false;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
namespace Ui {
|
||||
class GUIMessageDialog;
|
||||
}
|
||||
|
||||
class QToolButton;
|
||||
class GUIMessageDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -20,14 +20,22 @@ public:
|
||||
void hideExitButton();
|
||||
void startLoading();
|
||||
void stopLoading();
|
||||
void startPending();
|
||||
void stopPending();
|
||||
bool Pending(){
|
||||
return pending;
|
||||
}
|
||||
void setOpacity(double);
|
||||
protected:
|
||||
void timerEvent(QTimerEvent* event) override ;
|
||||
private:
|
||||
Ui::GUIMessageDialog *ui;
|
||||
QList<QString> frame;
|
||||
QToolButton *btn_main;
|
||||
QToolButton *btn_Append;
|
||||
int frameIndex=0;
|
||||
int timerID = -1;
|
||||
bool pending = false;
|
||||
};
|
||||
|
||||
#endif // GUIMESSAGEDIALOG_H
|
||||
|
||||
@@ -96,13 +96,6 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item alignment="Qt::AlignHCenter">
|
||||
<widget class="QToolButton" name="btn_main">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
||||
@@ -14,6 +14,7 @@ ADD_EVENT_VALUE(PatientSelected)\
|
||||
ADD_EVENT_VALUE(RequestPreviewScan)\
|
||||
ADD_EVENT_VALUE(RequestEmptyScan)\
|
||||
ADD_EVENT_VALUE(RequestPatientScan)\
|
||||
ADD_EVENT_VALUE(RequestContinueScan)\
|
||||
ADD_EVENT_VALUE(RequestStop)\
|
||||
ADD_EVENT_VALUE(ResponseDeviceTemperature)\
|
||||
ADD_EVENT_VALUE(ResponsePreview)\
|
||||
@@ -23,6 +24,7 @@ ADD_EVENT_VALUE(DeviceErrorRaise)\
|
||||
ADD_EVENT_VALUE(ShimLibInnerFault)\
|
||||
ADD_EVENT_VALUE(InvokeOperationStart)\
|
||||
ADD_EVENT_VALUE(InvokeOperationProgress)\
|
||||
ADD_EVENT_VALUE(InvokeOperationPending)\
|
||||
ADD_EVENT_VALUE(InvokeOperationEnd)\
|
||||
ADD_EVENT_VALUE(PromptDialogOpen)\
|
||||
ADD_EVENT_VALUE(GlobalBannerMessage)\
|
||||
|
||||
@@ -2,17 +2,13 @@
|
||||
#include "ui_patientinformationform.h"
|
||||
#include "json/cJSON.h"
|
||||
#include "event/EventCenter.h"
|
||||
#include "json/ScanJson.h"
|
||||
|
||||
PatientInformationForm::PatientInformationForm(QWidget* parent) :
|
||||
QWidget(parent),
|
||||
ui(new Ui::PatientInformationForm)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
//ui->lbl_ID->setText(tr(""));
|
||||
//ui->lbl_Date->setText(tr(""));
|
||||
//ui->lbl_Name->setText(tr(""));
|
||||
//ui->lbl_Sex->setText(tr(""));
|
||||
//ui->lbl_Acc->setText(tr(""));
|
||||
|
||||
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
||||
ui->retranslateUi(this);
|
||||
@@ -63,6 +59,6 @@ const char* PatientInformationForm::getCurrentPatientJsonString(bool empty) {
|
||||
cJSON_AddItemToObject(root, "InstitutionAddress", cJSON_CreateString("HZ"));
|
||||
delete jsonstr;
|
||||
jsonstr = cJSON_Print(root);
|
||||
cJSON_Delete(root);
|
||||
ScanJson::Current()->store(root);
|
||||
return jsonstr;
|
||||
}
|
||||
|
||||
@@ -143,6 +143,10 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
||||
connect(table->horizontalHeader(),&QHeaderView::sectionClicked,[=](int index){
|
||||
edit_patient->clearPatientInformation();
|
||||
prepareButtons(false);
|
||||
if(model->rowCount()>0){
|
||||
table->selectRow(0);
|
||||
model->selectRow(0);
|
||||
}
|
||||
});
|
||||
|
||||
// btn add slot
|
||||
@@ -155,9 +159,10 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
||||
if (dialog.exec() == QDialog::Accepted) {
|
||||
table->selectRow(0);
|
||||
model->selectRow(0);
|
||||
LOG_USER_OPERATION(AddPatient)
|
||||
btnSelect->setEnabled(true);
|
||||
}
|
||||
LOG_USER_OPERATION(AddPatient)
|
||||
btnSelect->setEnabled(true);
|
||||
|
||||
});
|
||||
|
||||
// btn edit slot
|
||||
@@ -181,7 +186,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
||||
btnSelect->setEnabled(true);
|
||||
});
|
||||
|
||||
// btn add slot
|
||||
// EditPatientForm editAccept slot
|
||||
connect(edit_patient, &EditPatientForm::editAccept, [=](PatientInformation* inf, bool& result) {
|
||||
int selectedRow = table->currentIndex().row();
|
||||
bool isAdd = inf->PatientUID.isEmpty();
|
||||
|
||||
20
src/json/ScanJson.cpp
Normal file
20
src/json/ScanJson.cpp
Normal file
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// Created by Krad on 2022/5/11.
|
||||
//
|
||||
|
||||
#include "ScanJson.h"
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
#include <QCoreApplication>
|
||||
void ScanJson::save() {
|
||||
if (!root) return;
|
||||
QFile f(QString("%1/%2.json").arg(QCoreApplication::applicationDirPath(),scanID.c_str()));
|
||||
f.open(QFileDevice::ReadWrite);
|
||||
cJSON_AddItemToObject(root, "EmptyScanID", cJSON_CreateString(emptyScanID.c_str()));
|
||||
cJSON_AddItemToObject(root, "ScanID", cJSON_CreateString(scanID.c_str()));
|
||||
char* content = cJSON_Print(root);
|
||||
f.write(content);
|
||||
f.flush();
|
||||
f.close();
|
||||
free(content);
|
||||
}
|
||||
44
src/json/ScanJson.h
Normal file
44
src/json/ScanJson.h
Normal file
@@ -0,0 +1,44 @@
|
||||
//
|
||||
// Created by Krad on 2022/5/11.
|
||||
//
|
||||
|
||||
#ifndef GUI_SCANJSON_H
|
||||
#define GUI_SCANJSON_H
|
||||
|
||||
#include <string>
|
||||
#include "cJSON.h"
|
||||
|
||||
class ScanJson {
|
||||
public:
|
||||
~ScanJson(){
|
||||
if(root)cJSON_Delete(root);
|
||||
}
|
||||
void store(cJSON* json){
|
||||
if(root){
|
||||
cJSON_Delete(root);
|
||||
root = nullptr;
|
||||
}
|
||||
root = json;
|
||||
}
|
||||
void setScanID(const char * id){
|
||||
scanID.clear();
|
||||
scanID.append(id);
|
||||
}
|
||||
void setEmptyScanID(const char * id){
|
||||
emptyScanID.clear();
|
||||
emptyScanID.append(id);
|
||||
setScanID(id);
|
||||
}
|
||||
void save();
|
||||
static ScanJson* Current(){
|
||||
static ScanJson instance;
|
||||
return &instance;
|
||||
}
|
||||
private:
|
||||
std::string emptyScanID;
|
||||
std::string scanID;
|
||||
cJSON* root = nullptr;
|
||||
};
|
||||
|
||||
|
||||
#endif //GUI_SCANJSON_H
|
||||
@@ -126,7 +126,8 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
if (msg)
|
||||
{
|
||||
QVariant* var = (QVariant*)msg;
|
||||
msgDialog->showMessage(QString("Scanning %1%").arg((int)(var->toFloat() * 100.0f)));
|
||||
if (msgDialog->Pending())msgDialog->stopPending();
|
||||
msgDialog->showMessage(var->toString());
|
||||
}
|
||||
else {
|
||||
msgDialog->hideMessage();
|
||||
@@ -134,6 +135,14 @@ MainWindow::MainWindow(QWidget* parent) :
|
||||
// msgDialog->showFullScreen();
|
||||
if (msgDialog->isHidden())msgDialog->show();
|
||||
});
|
||||
connect(EventCenter::Default(), &EventCenter::InvokeOperationPending, [=](QObject*, QObject* msg) {
|
||||
if (!msgDialog) return;
|
||||
if (!msgDialog->Pending()){
|
||||
msgDialog->startPending();
|
||||
QVariant* var = (QVariant*)msg;
|
||||
msgDialog->showMessage(var->toString());
|
||||
}
|
||||
});
|
||||
connect(EventCenter::Default(), &EventCenter::InvokeOperationEnd, [=]() {
|
||||
if (!msgDialog) return;
|
||||
if (!msgDialog->isHidden())msgDialog->accept();
|
||||
|
||||
Reference in New Issue
Block a user