Compare commits
22 Commits
3a6a755ef1
...
v0.6.11c1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7822139a76 | ||
|
|
55a579ea50 | ||
|
|
6e8d198a7a | ||
|
|
d047b77907 | ||
|
|
cfc18ed05e | ||
|
|
614aca056e | ||
|
|
f9825023ad | ||
|
|
fbc2d900f5 | ||
|
|
0bfa7b2377 | ||
|
|
60fa56cc18 | ||
|
|
d268d48bc2 | ||
|
|
d5038bb548 | ||
|
|
3d22dc1512 | ||
|
|
ae89aeffe4 | ||
|
|
6ba9786efb | ||
|
|
a7a5e1e308 | ||
|
|
d18332baed | ||
|
|
f7540385a4 | ||
|
|
1abd387617 | ||
|
|
24f6e4e97c | ||
|
|
2e9fb9960e | ||
|
|
99f19e8b5b |
@@ -8,7 +8,7 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|||||||
# GUI Version
|
# GUI Version
|
||||||
set(GUI_VERSION_MAJOR 0)
|
set(GUI_VERSION_MAJOR 0)
|
||||||
set(GUI_VERSION_MINOR 6)
|
set(GUI_VERSION_MINOR 6)
|
||||||
set(GUI_VERSION_BUILD 10)
|
set(GUI_VERSION_BUILD 11)
|
||||||
set(GUI_VERSION_BETA 1)
|
set(GUI_VERSION_BETA 1)
|
||||||
# use AppVersion.h as a configure file
|
# use AppVersion.h as a configure file
|
||||||
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 "DateSelectDialog.h"
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
#include <QLabel>
|
||||||
|
#include <QDate>
|
||||||
#include "components/DateSlidePickerBox.h"
|
#include "components/DateSlidePickerBox.h"
|
||||||
DateSelectDialog::DateSelectDialog(QWidget *parent, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) {
|
DateSelectDialog::DateSelectDialog(QWidget *parent, Qt::WindowFlags f) : GUIFormBaseDialog(parent, f) {
|
||||||
this->setFixedSize(460, 380);
|
this->setFixedSize(460, 380);
|
||||||
@@ -11,7 +13,12 @@ DateSelectDialog::DateSelectDialog(QWidget *parent, Qt::WindowFlags f) : GUIForm
|
|||||||
box = new DateSlidePickerBox(formWidget);
|
box = new DateSlidePickerBox(formWidget);
|
||||||
box->setObjectName("slider_one");
|
box->setObjectName("slider_one");
|
||||||
box->setSelectedValue("1990-01-01");
|
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(box);
|
||||||
|
layout->addWidget(lbl_error);
|
||||||
}
|
}
|
||||||
|
|
||||||
DateSelectDialog::~DateSelectDialog() {
|
DateSelectDialog::~DateSelectDialog() {
|
||||||
@@ -19,6 +26,7 @@ DateSelectDialog::~DateSelectDialog() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
QString DateSelectDialog::getSelectedValue() {
|
QString DateSelectDialog::getSelectedValue() {
|
||||||
|
|
||||||
return box->getSelectedValue();
|
return box->getSelectedValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -28,6 +36,13 @@ void DateSelectDialog::setSelectedValue(const QString &val) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool DateSelectDialog::updateReferenceData() {
|
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;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include "dialogs/GUIFormBaseDialog.h"
|
#include "dialogs/GUIFormBaseDialog.h"
|
||||||
class DateSlidePickerBox;
|
class DateSlidePickerBox;
|
||||||
|
class QLabel;
|
||||||
class DateSelectDialog:public GUIFormBaseDialog{
|
class DateSelectDialog:public GUIFormBaseDialog{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
@@ -15,9 +16,14 @@ public:
|
|||||||
QString getSelectedValue();
|
QString getSelectedValue();
|
||||||
void setSelectedValue(const QString& val);
|
void setSelectedValue(const QString& val);
|
||||||
void showEvent(QShowEvent *) override;
|
void showEvent(QShowEvent *) override;
|
||||||
|
void setOnlyBackward(bool val){
|
||||||
|
onlyBackward = val;
|
||||||
|
}
|
||||||
protected:
|
protected:
|
||||||
bool updateReferenceData() override;
|
bool updateReferenceData() override;
|
||||||
DateSlidePickerBox* box;
|
DateSlidePickerBox* box;
|
||||||
|
QLabel* lbl_error = nullptr;
|
||||||
|
bool onlyBackward = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,80 +1,107 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include "ShimLib.h"
|
#include "ShimLib.h"
|
||||||
|
|
||||||
|
#include <Windows.h>
|
||||||
|
#include <process.h>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
typedef void(*error_cb)(const char* msg);
|
typedef void(*error_cb)(const char* msg);
|
||||||
|
|
||||||
int statusCountFlag = 0;
|
int statusCountFlag = 0;
|
||||||
error_cb innerCallback = NULL;
|
error_cb innerCallback = NULL;
|
||||||
|
|
||||||
|
void ThreadFunc(void*);
|
||||||
|
HANDLE th;
|
||||||
|
HANDLE e1,e2;
|
||||||
int InitLib(error_cb cb) {
|
int InitLib(error_cb cb) {
|
||||||
innerCallback = cb;
|
innerCallback = cb;
|
||||||
innerCallback("11111");
|
innerCallback("11111");
|
||||||
|
e1 = CreateEvent(NULL, FALSE, FALSE, "e1");
|
||||||
|
e2 = CreateEvent(NULL, FALSE, FALSE, "e2");
|
||||||
|
th = _beginthread(ThreadFunc,0, NULL);
|
||||||
return 0;
|
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) {
|
int ScanControl(ScanAction actionType) {
|
||||||
|
|
||||||
switch (actionType) {
|
switch (actionType) {
|
||||||
case SCAN:
|
case SCAN:
|
||||||
printf("Do Scan!\r\n");
|
printf("Do Scan!\r\n");
|
||||||
statusCountFlag = 2;
|
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;
|
break;
|
||||||
case PREVIEW_SCAN:
|
case PREVIEW_SCAN:
|
||||||
statusCountFlag = 1;
|
statusCountFlag = 1;
|
||||||
|
status = SCANNING;
|
||||||
printf("Do preview!\r\n");
|
printf("Do preview!\r\n");
|
||||||
break;
|
break;
|
||||||
case STOP:
|
case STOP:
|
||||||
statusCountFlag = 0;
|
statusCountFlag = 0;
|
||||||
|
stop_flag = 1;
|
||||||
|
progress = 0;
|
||||||
|
status = READY;
|
||||||
printf("Stop everything!\r\n");
|
printf("Stop everything!\r\n");
|
||||||
break;
|
break;
|
||||||
|
case SCAN_CONTINUE:
|
||||||
|
SetEvent(e2);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
StatusInfo GetStatus() {
|
StatusInfo GetStatus() {
|
||||||
StatusInfo inf;
|
StatusInfo inf;
|
||||||
switch (statusCountFlag)
|
inf.status = status;
|
||||||
{
|
inf.progress = progress;
|
||||||
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;
|
|
||||||
}
|
|
||||||
return inf;
|
return inf;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -114,7 +141,14 @@ const char* GetDeviceInfo(DeviceInfo infoType) {
|
|||||||
case VERSION:
|
case VERSION:
|
||||||
return "6.6.06";
|
return "6.6.06";
|
||||||
case DEV_OUTPATH:
|
case DEV_OUTPATH:
|
||||||
return "path to store bin";
|
return output_path;
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
void StopDevice(){
|
||||||
|
CloseHandle(e1);
|
||||||
|
CloseHandle(e2);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ typedef enum {
|
|||||||
|
|
||||||
typedef struct StatusInfo {
|
typedef struct StatusInfo {
|
||||||
DeviceStatus status;// a enum represent device current status
|
DeviceStatus status;// a enum represent device current status
|
||||||
float progress;// percent value of operation
|
int progress;// percent value of operation
|
||||||
} StatusInfo;
|
} StatusInfo;
|
||||||
|
|
||||||
|
|
||||||
@@ -25,6 +25,7 @@ typedef enum {
|
|||||||
SCAN,// Start scan action
|
SCAN,// Start scan action
|
||||||
PREVIEW_SCAN,// Start preview scan action
|
PREVIEW_SCAN,// Start preview scan action
|
||||||
STOP,// Stop current scan
|
STOP,// Stop current scan
|
||||||
|
SCAN_CONTINUE,//Continue pending scan
|
||||||
} ScanAction;
|
} ScanAction;
|
||||||
|
|
||||||
//kinds of device information
|
//kinds of device information
|
||||||
@@ -46,6 +47,11 @@ extern const char *GetPreviewData();
|
|||||||
|
|
||||||
extern const char *GetDeviceInfo(DeviceInfo infoType);
|
extern const char *GetDeviceInfo(DeviceInfo infoType);
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
extern void StopDevice();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
#define APP_VALUES()\
|
#define APP_VALUES()\
|
||||||
ADD_APP_VALUE(InProcessing)\
|
ADD_APP_VALUE(InProcessing)\
|
||||||
ADD_APP_VALUE(LastOperationTime)\
|
ADD_APP_VALUE(LastOperationTime)\
|
||||||
ADD_APP_VALUE(LastOperation)
|
ADD_APP_VALUE(LastOperation)\
|
||||||
|
ADD_APP_VALUE(EmptyScanFlag)\
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|||||||
@@ -7,9 +7,10 @@
|
|||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QTimerEvent>
|
#include <QTimerEvent>
|
||||||
#include <QDate>
|
#include <QDate>
|
||||||
#include <QDateTime>
|
|
||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include "appvals/AppGlobalValues.h"
|
#include "appvals/AppGlobalValues.h"
|
||||||
|
#include "json/ScanJson.h"
|
||||||
|
#include "json/jsonobject.h"
|
||||||
#define TRIGGER_EVENT EventCenter::Default()->triggerEvent
|
#define TRIGGER_EVENT EventCenter::Default()->triggerEvent
|
||||||
|
|
||||||
#define THROW_ERROR(errormsg)\
|
#define THROW_ERROR(errormsg)\
|
||||||
@@ -31,7 +32,6 @@ const char* getStatusString(int status)
|
|||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string getJsonFromPatInf(QObject* obj)
|
std::string getJsonFromPatInf(QObject* obj)
|
||||||
{
|
{
|
||||||
return ((QString*)obj)->toStdString();
|
return ((QString*)obj)->toStdString();
|
||||||
@@ -58,11 +58,7 @@ void DeviceManager::initDevice() {
|
|||||||
// empty scan
|
// empty scan
|
||||||
connect(EventCenter::Default(), &EventCenter::RequestEmptyScan, [=](QObject* sender, QObject* detail) {
|
connect(EventCenter::Default(), &EventCenter::RequestEmptyScan, [=](QObject* sender, QObject* detail) {
|
||||||
std::string json = getJsonFromPatInf(detail);
|
std::string json = getJsonFromPatInf(detail);
|
||||||
// qDebug()<<json.c_str();
|
startScan(json.c_str(), true);
|
||||||
// void * jss = malloc(json.size());
|
|
||||||
// memcpy(jss,json.c_str(),json.size());
|
|
||||||
// processScan((char*)jss,true);
|
|
||||||
processScan(json.c_str(), true);
|
|
||||||
});
|
});
|
||||||
// Patient scan
|
// Patient scan
|
||||||
connect(EventCenter::Default(), &EventCenter::RequestPatientScan, [=](QObject* sender, QObject* detail) {
|
connect(EventCenter::Default(), &EventCenter::RequestPatientScan, [=](QObject* sender, QObject* detail) {
|
||||||
@@ -70,12 +66,13 @@ void DeviceManager::initDevice() {
|
|||||||
qDebug() << json.c_str();
|
qDebug() << json.c_str();
|
||||||
if (!json.empty())
|
if (!json.empty())
|
||||||
{
|
{
|
||||||
// void * jss = malloc(json.size());
|
startScan(json.c_str());
|
||||||
// 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
|
// stop
|
||||||
connect(EventCenter::Default(), &EventCenter::RequestStop, [=]() {
|
connect(EventCenter::Default(), &EventCenter::RequestStop, [=]() {
|
||||||
qDebug() << "GetStatus";
|
qDebug() << "GetStatus";
|
||||||
@@ -93,11 +90,6 @@ void DeviceManager::initDevice() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if (inf.status == BUSY) {
|
|
||||||
// QString msg("Device is busy, Stop operation fail!");
|
|
||||||
// THROW_ERROR(msg);
|
|
||||||
// return;
|
|
||||||
// };
|
|
||||||
AppGlobalValues::setInProcessing(true);
|
AppGlobalValues::setInProcessing(true);
|
||||||
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, nullptr);
|
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, nullptr);
|
||||||
//ScanControl fail
|
//ScanControl fail
|
||||||
@@ -124,7 +116,6 @@ void DeviceManager::initDevice() {
|
|||||||
TRIGGER_EVENT(GUIEvents::ResponseStop, nullptr, nullptr);
|
TRIGGER_EVENT(GUIEvents::ResponseStop, nullptr, nullptr);
|
||||||
AppGlobalValues::setInProcessing(false);
|
AppGlobalValues::setInProcessing(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
// preview
|
// preview
|
||||||
connect(EventCenter::Default(), &EventCenter::RequestPreviewScan, [=]() {
|
connect(EventCenter::Default(), &EventCenter::RequestPreviewScan, [=]() {
|
||||||
// check device status=========================================
|
// check device status=========================================
|
||||||
@@ -155,7 +146,7 @@ void DeviceManager::initDevice() {
|
|||||||
THROW_ERROR(msg);
|
THROW_ERROR(msg);
|
||||||
qDebug() << "Error thrown!";
|
qDebug() << "Error thrown!";
|
||||||
});
|
});
|
||||||
|
// init the preview data caller thread
|
||||||
previewDataCaller = QThread::create([=]() {
|
previewDataCaller = QThread::create([=]() {
|
||||||
while (!endLoop)
|
while (!endLoop)
|
||||||
{
|
{
|
||||||
@@ -192,58 +183,40 @@ void DeviceManager::initDevice() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char * getPhaseName(int phase){
|
||||||
|
const char* names[3] = {"Initializing","Scanning", "CE Measuring"};
|
||||||
|
return names[phase-1];
|
||||||
|
}
|
||||||
|
|
||||||
void DeviceManager::timerEvent(QTimerEvent* event) {
|
void DeviceManager::timerEvent(QTimerEvent* event) {
|
||||||
if (event->timerId() == deviceInfTimerID) {
|
if (event->timerId() == deviceInfTimerID) {
|
||||||
QString temp = QString(GetDeviceInfo(MEAN_TEMPERATURE));
|
QString temp = QString(GetDeviceInfo(MEAN_TEMPERATURE));
|
||||||
TRIGGER_EVENT(GUIEvents::ResponseDeviceTemperature, nullptr, (QObject*)&temp);
|
TRIGGER_EVENT(GUIEvents::ResponseDeviceTemperature, nullptr, (QObject *) &temp);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
//scanning progress timer
|
//scanning progress timer
|
||||||
{
|
|
||||||
//error exit, callback error
|
//error exit, callback error
|
||||||
if (errorOccurred)
|
if (errorOccurred) {
|
||||||
{
|
exitScanTimer();
|
||||||
// qDebug() << "Error occurred, exit progress timer";
|
return;
|
||||||
// QString msg("Error occurred, exit current operation!");
|
|
||||||
// THROW_ERROR(msg);
|
|
||||||
goto exitTimer;
|
|
||||||
}
|
}
|
||||||
// previewing exit
|
// previewing exit
|
||||||
if (previewing)
|
if (previewing) {
|
||||||
{
|
|
||||||
QString msg("Device is previewing, exit current operation!");
|
QString msg("Device is previewing, exit current operation!");
|
||||||
THROW_ERROR(msg);
|
THROW_ERROR(msg);
|
||||||
goto exitTimer;
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
// check device status=========================================
|
// check device status=========================================
|
||||||
qDebug() << "GetStatus";
|
qDebug() << "GetStatus";
|
||||||
StatusInfo inf = GetStatus();
|
StatusInfo inf = GetStatus();
|
||||||
qDebug() << "Scanning request status, status:" << getStatusString(inf.status);
|
qDebug() << "Scanning request status, status:" << getStatusString(inf.status);
|
||||||
//设备正常扫描中
|
//设备正常扫描中
|
||||||
if (inf.status == SCANNING) {
|
if (inf.status == SCANNING) {
|
||||||
qDebug() <<"current output path:"<<getScanOutputPath();
|
scanProcess(inf.progress);
|
||||||
lastStatus = SCANNING;
|
|
||||||
//normal scan
|
|
||||||
QVariant var(inf.progress);
|
|
||||||
qDebug() << "Normal scan, invoke InvokeOperationProgress:" << inf.progress;
|
|
||||||
TRIGGER_EVENT(GUIEvents::InvokeOperationProgress, nullptr, (QObject*)&var);
|
|
||||||
return;
|
return;
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
//未发生错误并且,之前状态是扫描,代表正常扫描完成
|
//未发生错误并且,之前状态是扫描,代表正常扫描完成
|
||||||
if (lastStatus == SCANNING) {
|
if (lastStatus == SCANNING) {
|
||||||
qDebug() << "Scan finished";
|
prepareFinishScan();
|
||||||
QVariant var(true);
|
|
||||||
qDebug() << "InvokeOperationEnd";
|
|
||||||
|
|
||||||
TRIGGER_EVENT(GUIEvents::InvokeOperationEnd, nullptr, (QObject*)&var);
|
|
||||||
AppGlobalValues::setInProcessing(false);
|
|
||||||
lastStatus = -1;
|
|
||||||
previewing = false;
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
//一般不会出现其他情况
|
//一般不会出现其他情况
|
||||||
else {
|
else {
|
||||||
@@ -252,20 +225,90 @@ void DeviceManager::timerEvent(QTimerEvent* event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
exitTimer:
|
exitScanTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceManager::scanProcess(int sProgress) {
|
||||||
|
qDebug() << "current output path:" << getScanOutputPath();
|
||||||
|
lastStatus = SCANNING;
|
||||||
|
|
||||||
|
//normal scan pending
|
||||||
|
int phase = sProgress / 100 + 1;
|
||||||
|
int progress = sProgress % 100;
|
||||||
|
// scan with phase 3 has a different message
|
||||||
|
QString extraMsg = (AppGlobalValues::EmptyScanFlag().toBool() ||
|
||||||
|
(scanPhase != 3)) ? "": ", patient can leave";
|
||||||
|
QVariant var(QString("%1%3\r\n progress:%2%").arg(getPhaseName(scanPhase)).arg(progress).arg(extraMsg));
|
||||||
|
TRIGGER_EVENT(InvokeOperationProgress, nullptr, (QObject *) &var);
|
||||||
|
// 300 means finished
|
||||||
|
if (sProgress == 300) return;
|
||||||
|
//phase control
|
||||||
|
//no change return
|
||||||
|
if (scanPhase == phase) return;
|
||||||
|
// error phase
|
||||||
|
if (phase > 3 || scanPhase > phase) {
|
||||||
|
QString errorMsg = QString("Error Scan Phase code, current Phase code:%1, new Phase code:%2!").arg(
|
||||||
|
scanPhase).arg(phase);
|
||||||
|
THROW_ERROR(errorMsg)
|
||||||
|
exitScanTimer();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// enter phase 2
|
||||||
|
if ((scanPhase = phase) == 2) {
|
||||||
|
if (!AppGlobalValues::EmptyScanFlag().toBool() && JsonObject::Instance()->getScanConfirm()) {
|
||||||
|
var.setValue(QString("Waiting for operator to start scan!\r\n Click \"Next\" to continue!"));
|
||||||
|
TRIGGER_EVENT(InvokeOperationPending, nullptr, (QObject *) &var);
|
||||||
|
exitScanTimer();
|
||||||
|
}
|
||||||
|
//empty scan no pending, auto continue
|
||||||
|
else {
|
||||||
|
postContinueCommand();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceManager::exitScanTimer() {
|
||||||
qDebug() << "Scanning progress Timer exit";
|
qDebug() << "Scanning progress Timer exit";
|
||||||
killTimer(timerID);
|
killTimer(timerID);
|
||||||
timerID = -1;
|
timerID = -1;
|
||||||
lastStatus = -1;
|
lastStatus = -1;
|
||||||
previewing = false;
|
previewing = false;
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeviceManager::processScan(const char* json, bool empty) {
|
void DeviceManager::prepareFinishScan() {
|
||||||
|
qDebug() << "Scan finished";
|
||||||
|
QVariant var(true);
|
||||||
|
qDebug() << "InvokeOperationEnd";
|
||||||
|
|
||||||
|
TRIGGER_EVENT(InvokeOperationEnd, nullptr, (QObject *) &var);
|
||||||
|
AppGlobalValues::setInProcessing(false);
|
||||||
|
// log, no need
|
||||||
|
// QString s("%1 %2");
|
||||||
|
// s = s.arg(QDateTime::currentDateTime().toString("yyyy/MM/dd HH:mm:ss")).arg("Scan finished");
|
||||||
|
// TRIGGER_EVENT(GlobalBannerMessage, nullptr, (QObject *) &s);
|
||||||
|
|
||||||
|
// get output data path
|
||||||
|
QString outputPath = GetDeviceInfo(DEV_OUTPATH);
|
||||||
|
outputPath = outputPath.replace("\\", "/");
|
||||||
|
// get scan ID from path
|
||||||
|
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());
|
||||||
|
}
|
||||||
|
// save json
|
||||||
|
ScanJson::Current()->save();
|
||||||
|
} else {
|
||||||
|
QString msg("Scan Output Path error!");
|
||||||
|
THROW_ERROR(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceManager::startScan(const char* json, bool empty) {
|
||||||
//clear last error state first
|
//clear last error state first
|
||||||
errorOccurred = false;
|
errorOccurred = false;
|
||||||
// check device status=========================================
|
// check device status=========================================
|
||||||
@@ -282,6 +325,7 @@ void DeviceManager::processScan(const char* json, bool empty) {
|
|||||||
AppGlobalValues::setInProcessing(true);
|
AppGlobalValues::setInProcessing(true);
|
||||||
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, (QObject*)&msg);
|
TRIGGER_EVENT(GUIEvents::InvokeOperationStart, nullptr, (QObject*)&msg);
|
||||||
qDebug() << "SetScanInfo>>>>>>>>>>>>>>>>>>>>";
|
qDebug() << "SetScanInfo>>>>>>>>>>>>>>>>>>>>";
|
||||||
|
AppGlobalValues::setEmptyScanFlag(empty);
|
||||||
int ret = SetScanInfo(json, empty ? 1 : 0);
|
int ret = SetScanInfo(json, empty ? 1 : 0);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>SetScanInfo failed";
|
qDebug() << ">>>>>>>>>>>>>>>>>>>>SetScanInfo failed";
|
||||||
@@ -291,23 +335,42 @@ void DeviceManager::processScan(const char* json, bool empty) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>SetScanInfo success";
|
qDebug() << ">>>>>>>>>>>>>>>>>>>>SetScanInfo success";
|
||||||
//ScanControl fail
|
|
||||||
|
postScanCommand();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DeviceManager::postScanCommand() {
|
||||||
qDebug() << "ScanControl start>>>>>>>>>>>>>>>>>>>>>";
|
qDebug() << "ScanControl start>>>>>>>>>>>>>>>>>>>>>";
|
||||||
if (!ScanControl(SCAN)) {
|
if (!ScanControl(SCAN)) {
|
||||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>ScanControl success";
|
qDebug() << ">>>>>>>>>>>>>>>>>>>>>ScanControl success";
|
||||||
//set current state
|
//set current state
|
||||||
lastStatus = SCANNING;
|
lastStatus = SCANNING;
|
||||||
previewing = false;
|
previewing = false;
|
||||||
|
scanPhase = 1;
|
||||||
qDebug() << "Start progress timer";
|
qDebug() << "Start progress timer";
|
||||||
timerID = startTimer(500);
|
timerID = startTimer(500);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
//ScanControl fail
|
||||||
QString errmsg("ScanControl start fail!");
|
QString errmsg("ScanControl start fail!");
|
||||||
THROW_ERROR(errmsg);
|
THROW_ERROR(errmsg);
|
||||||
qDebug() << ">>>>>>>>>>>>>>>>>>>>>ScanControl failed";
|
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() {
|
void DeviceManager::close() {
|
||||||
|
#ifdef _WIN32
|
||||||
|
StopDevice();
|
||||||
|
#endif
|
||||||
previewDataCaller->terminate();
|
previewDataCaller->terminate();
|
||||||
delete previewDataCaller;
|
delete previewDataCaller;
|
||||||
}
|
}
|
||||||
@@ -319,3 +382,5 @@ QString DeviceManager::getSoftwareVersion() {
|
|||||||
QString DeviceManager::getScanOutputPath() {
|
QString DeviceManager::getScanOutputPath() {
|
||||||
return GetDeviceInfo(DEV_OUTPATH);
|
return GetDeviceInfo(DEV_OUTPATH);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,13 +15,37 @@ public:
|
|||||||
static DeviceManager manager;
|
static DeviceManager manager;
|
||||||
return &manager;
|
return &manager;
|
||||||
}
|
}
|
||||||
|
DeviceManager() = default;
|
||||||
|
~DeviceManager() override = default ;
|
||||||
|
DeviceManager(const DeviceManager&) = delete;
|
||||||
|
DeviceManager operator=(const DeviceManager&) = delete;
|
||||||
|
/**
|
||||||
|
* init device, include Shimlib and it's error call back,
|
||||||
|
* deviceInfTimer to get temperature of water, and the
|
||||||
|
* preview data caller thread.
|
||||||
|
*/
|
||||||
void initDevice();
|
void initDevice();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* close and release the device reference resource.
|
||||||
|
*/
|
||||||
void close();
|
void close();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Firm ware version
|
||||||
|
* @return Firm ware version
|
||||||
|
*/
|
||||||
|
QString getSoftwareVersion();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get Scan data output path
|
||||||
|
* @return Scan data output path
|
||||||
|
*/
|
||||||
|
QString getScanOutputPath();
|
||||||
|
|
||||||
void setErrorOccurred(bool v){
|
void setErrorOccurred(bool v){
|
||||||
errorOccurred = v;
|
errorOccurred = v;
|
||||||
}
|
}
|
||||||
QString getSoftwareVersion();
|
|
||||||
QString getScanOutputPath();
|
|
||||||
bool getErrorOccurred(){
|
bool getErrorOccurred(){
|
||||||
return errorOccurred;
|
return errorOccurred;
|
||||||
}
|
}
|
||||||
@@ -33,14 +57,48 @@ protected:
|
|||||||
void timerEvent(QTimerEvent* event) override;
|
void timerEvent(QTimerEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void processScan(const char* json, bool empty = false);
|
/**
|
||||||
|
* To start a new scan operation
|
||||||
|
* @param json The patient information json string
|
||||||
|
* @param empty Empty scan flag
|
||||||
|
*/
|
||||||
|
void startScan(const char* json, bool empty = false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post Scan start command to Shimlib
|
||||||
|
*/
|
||||||
|
void postScanCommand();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post Continue Scan command to Shimlib
|
||||||
|
* @param useTimer start a new timer flag
|
||||||
|
*/
|
||||||
|
void postContinueCommand(bool useTimer = false);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare for finishing the Scan
|
||||||
|
*/
|
||||||
|
void prepareFinishScan();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* exit the current Scan process timer
|
||||||
|
*/
|
||||||
|
void exitScanTimer();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process scan progress change
|
||||||
|
* @param Scan progress
|
||||||
|
*/
|
||||||
|
void scanProcess(int progress);
|
||||||
|
|
||||||
|
int scanPhase = 1;
|
||||||
int timerID = -1;
|
int timerID = -1;
|
||||||
int deviceInfTimerID = -1;
|
int deviceInfTimerID = -1;
|
||||||
int lastStatus = -1;
|
int lastStatus = -1;
|
||||||
bool previewing = false;
|
bool previewing = false;
|
||||||
volatile bool endLoop = false;
|
volatile bool endLoop = false;
|
||||||
bool errorOccurred = false;
|
bool errorOccurred = false;
|
||||||
QThread* previewDataCaller;
|
QThread* previewDataCaller = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
#include "guimessagedialog.h"
|
#include "guimessagedialog.h"
|
||||||
#include "ui_guimessagedialog.h"
|
#include "ui_guimessagedialog.h"
|
||||||
#include "event/EventCenter.h"
|
#include "event/EventCenter.h"
|
||||||
|
#include <QToolButton>
|
||||||
|
#include <QHBoxLayout>
|
||||||
GUIMessageDialog::GUIMessageDialog(QWidget *parent) :
|
GUIMessageDialog::GUIMessageDialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::GUIMessageDialog)
|
ui(new Ui::GUIMessageDialog)
|
||||||
@@ -12,8 +14,21 @@ GUIMessageDialog::GUIMessageDialog(QWidget *parent) :
|
|||||||
this->showFullScreen ();
|
this->showFullScreen ();
|
||||||
ui->lbl_msg->setVisible(false);
|
ui->lbl_msg->setVisible(false);
|
||||||
ui->lbl_progressicon->setVisible(false);
|
ui->lbl_progressicon->setVisible(false);
|
||||||
ui->btn_main->setVisible(false);
|
btn_main = new QToolButton(this);
|
||||||
ui->btn_main->setText("OK");
|
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);
|
this->setWindowOpacity(0.6);
|
||||||
for (int i=1; i<=6;i++)
|
for (int i=1; i<=6;i++)
|
||||||
{
|
{
|
||||||
@@ -51,14 +66,14 @@ void GUIMessageDialog::stopLoading() {
|
|||||||
killTimer(timerID);
|
killTimer(timerID);
|
||||||
timerID=-1;
|
timerID=-1;
|
||||||
}
|
}
|
||||||
disconnect(ui->btn_main,0,0,0);
|
disconnect(btn_main,0,0,0);
|
||||||
ui->lbl_progressicon->setVisible(false);
|
ui->lbl_progressicon->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageDialog::startLoading() {
|
void GUIMessageDialog::startLoading() {
|
||||||
ui->lbl_progressicon->setVisible(true);
|
ui->lbl_progressicon->setVisible(true);
|
||||||
disconnect(ui->btn_main,0,0,0);
|
disconnect(btn_main,0,0,0);
|
||||||
connect(ui->btn_main,&QToolButton::clicked,[=](){
|
connect(btn_main,&QToolButton::clicked,[=](){
|
||||||
if (timerID != -1){
|
if (timerID != -1){
|
||||||
killTimer(timerID);
|
killTimer(timerID);
|
||||||
timerID = -1;
|
timerID = -1;
|
||||||
@@ -68,9 +83,8 @@ void GUIMessageDialog::startLoading() {
|
|||||||
LOG_USER_OPERATION(Stop);
|
LOG_USER_OPERATION(Stop);
|
||||||
});
|
});
|
||||||
timerID = startTimer(100);
|
timerID = startTimer(100);
|
||||||
ui->btn_main->setText("Stop");
|
btn_main->setText("Stop");
|
||||||
ui->btn_main->setVisible(true);
|
btn_main->setVisible(true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageDialog::showMessage(QString msg) {
|
void GUIMessageDialog::showMessage(QString msg) {
|
||||||
@@ -79,10 +93,10 @@ void GUIMessageDialog::showMessage(QString msg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageDialog::showExitButton() {
|
void GUIMessageDialog::showExitButton() {
|
||||||
ui->btn_main->setText("OK");
|
btn_main->setText("OK");
|
||||||
ui->btn_main->setVisible(true);
|
btn_main->setVisible(true);
|
||||||
disconnect(ui->btn_main,0,0,0);
|
disconnect(btn_main,0,0,0);
|
||||||
connect(ui->btn_main,&QToolButton::clicked,[=](){
|
connect(btn_main,&QToolButton::clicked,[=](){
|
||||||
if (timerID != -1){
|
if (timerID != -1){
|
||||||
killTimer(timerID);
|
killTimer(timerID);
|
||||||
timerID = -1;
|
timerID = -1;
|
||||||
@@ -98,10 +112,27 @@ void GUIMessageDialog::hideMessage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageDialog::hideExitButton() {
|
void GUIMessageDialog::hideExitButton() {
|
||||||
ui->btn_main->setVisible(false);
|
btn_main->setVisible(false);
|
||||||
disconnect(ui->btn_main,0,0,0);
|
disconnect(btn_main,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIMessageDialog::setOpacity(double opacity) {
|
void GUIMessageDialog::setOpacity(double opacity) {
|
||||||
this->setWindowOpacity(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 {
|
namespace Ui {
|
||||||
class GUIMessageDialog;
|
class GUIMessageDialog;
|
||||||
}
|
}
|
||||||
|
class QToolButton;
|
||||||
class GUIMessageDialog : public QDialog
|
class GUIMessageDialog : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -20,14 +20,22 @@ public:
|
|||||||
void hideExitButton();
|
void hideExitButton();
|
||||||
void startLoading();
|
void startLoading();
|
||||||
void stopLoading();
|
void stopLoading();
|
||||||
|
void startPending();
|
||||||
|
void stopPending();
|
||||||
|
bool Pending(){
|
||||||
|
return pending;
|
||||||
|
}
|
||||||
void setOpacity(double);
|
void setOpacity(double);
|
||||||
protected:
|
protected:
|
||||||
void timerEvent(QTimerEvent* event) override ;
|
void timerEvent(QTimerEvent* event) override ;
|
||||||
private:
|
private:
|
||||||
Ui::GUIMessageDialog *ui;
|
Ui::GUIMessageDialog *ui;
|
||||||
QList<QString> frame;
|
QList<QString> frame;
|
||||||
|
QToolButton *btn_main;
|
||||||
|
QToolButton *btn_Append;
|
||||||
int frameIndex=0;
|
int frameIndex=0;
|
||||||
int timerID = -1;
|
int timerID = -1;
|
||||||
|
bool pending = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GUIMESSAGEDIALOG_H
|
#endif // GUIMESSAGEDIALOG_H
|
||||||
|
|||||||
@@ -96,13 +96,6 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item alignment="Qt::AlignHCenter">
|
|
||||||
<widget class="QToolButton" name="btn_main">
|
|
||||||
<property name="text">
|
|
||||||
<string>...</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ ADD_EVENT_VALUE(PatientSelected)\
|
|||||||
ADD_EVENT_VALUE(RequestPreviewScan)\
|
ADD_EVENT_VALUE(RequestPreviewScan)\
|
||||||
ADD_EVENT_VALUE(RequestEmptyScan)\
|
ADD_EVENT_VALUE(RequestEmptyScan)\
|
||||||
ADD_EVENT_VALUE(RequestPatientScan)\
|
ADD_EVENT_VALUE(RequestPatientScan)\
|
||||||
|
ADD_EVENT_VALUE(RequestContinueScan)\
|
||||||
ADD_EVENT_VALUE(RequestStop)\
|
ADD_EVENT_VALUE(RequestStop)\
|
||||||
ADD_EVENT_VALUE(ResponseDeviceTemperature)\
|
ADD_EVENT_VALUE(ResponseDeviceTemperature)\
|
||||||
ADD_EVENT_VALUE(ResponsePreview)\
|
ADD_EVENT_VALUE(ResponsePreview)\
|
||||||
@@ -23,6 +24,7 @@ ADD_EVENT_VALUE(DeviceErrorRaise)\
|
|||||||
ADD_EVENT_VALUE(ShimLibInnerFault)\
|
ADD_EVENT_VALUE(ShimLibInnerFault)\
|
||||||
ADD_EVENT_VALUE(InvokeOperationStart)\
|
ADD_EVENT_VALUE(InvokeOperationStart)\
|
||||||
ADD_EVENT_VALUE(InvokeOperationProgress)\
|
ADD_EVENT_VALUE(InvokeOperationProgress)\
|
||||||
|
ADD_EVENT_VALUE(InvokeOperationPending)\
|
||||||
ADD_EVENT_VALUE(InvokeOperationEnd)\
|
ADD_EVENT_VALUE(InvokeOperationEnd)\
|
||||||
ADD_EVENT_VALUE(PromptDialogOpen)\
|
ADD_EVENT_VALUE(PromptDialogOpen)\
|
||||||
ADD_EVENT_VALUE(GlobalBannerMessage)\
|
ADD_EVENT_VALUE(GlobalBannerMessage)\
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <qdebug.h>
|
#include <qdebug.h>
|
||||||
#include "log/UserOperationLog.h"
|
#include "log/UserOperationLog.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include "json/jsonobject.h"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#else
|
#else
|
||||||
@@ -218,7 +219,7 @@ ScanFormWidget::ScanFormWidget(QWidget* parent) : TabFormWidget(parent) {
|
|||||||
patient_information->setPatientInformation((PatientInformation*)data);
|
patient_information->setPatientInformation((PatientInformation*)data);
|
||||||
});
|
});
|
||||||
connect(btnRefresh, &QToolButton::clicked, [=]() {
|
connect(btnRefresh, &QToolButton::clicked, [=]() {
|
||||||
QString patientInf(patient_information->getCurrentPatientJsonString(false));
|
QString patientInf(patient_information->getCurrentPatientJsonString(true));
|
||||||
LOG_USER_OPERATION(StartRefresh);
|
LOG_USER_OPERATION(StartRefresh);
|
||||||
EventCenter::Default()->triggerEvent(GUIEvents::RequestEmptyScan, nullptr, (QObject*)(&patientInf));
|
EventCenter::Default()->triggerEvent(GUIEvents::RequestEmptyScan, nullptr, (QObject*)(&patientInf));
|
||||||
});
|
});
|
||||||
@@ -229,6 +230,11 @@ ScanFormWidget::ScanFormWidget(QWidget* parent) : TabFormWidget(parent) {
|
|||||||
connect(btnScan, &QToolButton::clicked, [=]() {
|
connect(btnScan, &QToolButton::clicked, [=]() {
|
||||||
QString patientInf(patient_information->getCurrentPatientJsonString(false));
|
QString patientInf(patient_information->getCurrentPatientJsonString(false));
|
||||||
LOG_USER_OPERATION(StartScan);
|
LOG_USER_OPERATION(StartScan);
|
||||||
|
if (!JsonObject::Instance()->getEmptyScanID()){
|
||||||
|
QString msg(tr("No refresh data exists, please do Refresh operation first."));
|
||||||
|
EventCenter::Default()->triggerEvent(GUIEvents::DeviceErrorRaise, nullptr, (QObject*)(&msg));
|
||||||
|
return;
|
||||||
|
}
|
||||||
EventCenter::Default()->triggerEvent(GUIEvents::RequestPatientScan, nullptr, (QObject*)(&patientInf));
|
EventCenter::Default()->triggerEvent(GUIEvents::RequestPatientScan, nullptr, (QObject*)(&patientInf));
|
||||||
});
|
});
|
||||||
connect(btnStop, &QToolButton::clicked, [=]() {
|
connect(btnStop, &QToolButton::clicked, [=]() {
|
||||||
|
|||||||
@@ -2,17 +2,13 @@
|
|||||||
#include "ui_patientinformationform.h"
|
#include "ui_patientinformationform.h"
|
||||||
#include "json/cJSON.h"
|
#include "json/cJSON.h"
|
||||||
#include "event/EventCenter.h"
|
#include "event/EventCenter.h"
|
||||||
|
#include "json/ScanJson.h"
|
||||||
|
|
||||||
PatientInformationForm::PatientInformationForm(QWidget* parent) :
|
PatientInformationForm::PatientInformationForm(QWidget* parent) :
|
||||||
QWidget(parent),
|
QWidget(parent),
|
||||||
ui(new Ui::PatientInformationForm)
|
ui(new Ui::PatientInformationForm)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
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, [=]() {
|
connect(EventCenter::Default(), &EventCenter::ReloadLanguage, [=]() {
|
||||||
ui->retranslateUi(this);
|
ui->retranslateUi(this);
|
||||||
@@ -63,6 +59,6 @@ const char* PatientInformationForm::getCurrentPatientJsonString(bool empty) {
|
|||||||
cJSON_AddItemToObject(root, "InstitutionAddress", cJSON_CreateString("HZ"));
|
cJSON_AddItemToObject(root, "InstitutionAddress", cJSON_CreateString("HZ"));
|
||||||
delete jsonstr;
|
delete jsonstr;
|
||||||
jsonstr = cJSON_Print(root);
|
jsonstr = cJSON_Print(root);
|
||||||
cJSON_Delete(root);
|
ScanJson::Current()->store(root);
|
||||||
return jsonstr;
|
return jsonstr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -143,6 +143,10 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|||||||
connect(table->horizontalHeader(),&QHeaderView::sectionClicked,[=](int index){
|
connect(table->horizontalHeader(),&QHeaderView::sectionClicked,[=](int index){
|
||||||
edit_patient->clearPatientInformation();
|
edit_patient->clearPatientInformation();
|
||||||
prepareButtons(false);
|
prepareButtons(false);
|
||||||
|
if(model->rowCount()>0){
|
||||||
|
table->selectRow(0);
|
||||||
|
model->selectRow(0);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// btn add slot
|
// btn add slot
|
||||||
@@ -155,9 +159,10 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|||||||
if (dialog.exec() == QDialog::Accepted) {
|
if (dialog.exec() == QDialog::Accepted) {
|
||||||
table->selectRow(0);
|
table->selectRow(0);
|
||||||
model->selectRow(0);
|
model->selectRow(0);
|
||||||
}
|
|
||||||
LOG_USER_OPERATION(AddPatient)
|
LOG_USER_OPERATION(AddPatient)
|
||||||
btnSelect->setEnabled(true);
|
btnSelect->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// btn edit slot
|
// btn edit slot
|
||||||
@@ -181,7 +186,7 @@ SelectFormWidget::SelectFormWidget(QWidget* parent) :
|
|||||||
btnSelect->setEnabled(true);
|
btnSelect->setEnabled(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
// btn add slot
|
// EditPatientForm editAccept slot
|
||||||
connect(edit_patient, &EditPatientForm::editAccept, [=](PatientInformation* inf, bool& result) {
|
connect(edit_patient, &EditPatientForm::editAccept, [=](PatientInformation* inf, bool& result) {
|
||||||
int selectedRow = table->currentIndex().row();
|
int selectedRow = table->currentIndex().row();
|
||||||
bool isAdd = inf->PatientUID.isEmpty();
|
bool isAdd = inf->PatientUID.isEmpty();
|
||||||
|
|||||||
@@ -5,6 +5,8 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
|
#include <QGridLayout>
|
||||||
|
|
||||||
|
|
||||||
#include "src/dialogs/SelectDialog.h"
|
#include "src/dialogs/SelectDialog.h"
|
||||||
#include "network/networkcfgdialog.h"
|
#include "network/networkcfgdialog.h"
|
||||||
@@ -48,6 +50,18 @@ systemSettingForm::systemSettingForm(QWidget* parent) :
|
|||||||
ui->btnFlt->setText(JsonObject::Instance()->defaultFilter());
|
ui->btnFlt->setText(JsonObject::Instance()->defaultFilter());
|
||||||
ui->btnFlt->setObjectName("BigBtn");
|
ui->btnFlt->setObjectName("BigBtn");
|
||||||
|
|
||||||
|
QGridLayout* gridLayout = (QGridLayout*)ui->block10->layout();
|
||||||
|
auto btn_needConfirm = new ImageSwitch(this);
|
||||||
|
auto lbl_needConfirm = new QLabel(this);
|
||||||
|
lbl_needConfirm->setText("Scan Confirm");
|
||||||
|
gridLayout->addWidget(btn_needConfirm, 4, 2, 1, 1);
|
||||||
|
gridLayout->addWidget(lbl_needConfirm, 4, 0, 1, 1);
|
||||||
|
btn_needConfirm->setChecked(JsonObject::Instance()->getScanConfirm());
|
||||||
|
QFrame* line5 = new QFrame(this);
|
||||||
|
line5->setFrameShape(QFrame::HLine);
|
||||||
|
line5->setFrameShadow(QFrame::Sunken);
|
||||||
|
gridLayout->addWidget(line5,5,0);
|
||||||
|
|
||||||
////test begin
|
////test begin
|
||||||
//flag_disksize = true;
|
//flag_disksize = true;
|
||||||
//m_disksize = 75.0;
|
//m_disksize = 75.0;
|
||||||
@@ -86,6 +100,9 @@ systemSettingForm::systemSettingForm(QWidget* parent) :
|
|||||||
////
|
////
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
connect(btn_needConfirm, &ImageSwitch::clicked, [=]() {
|
||||||
|
JsonObject::Instance()->setScanConfirm(btn_needConfirm->getChecked());
|
||||||
|
});
|
||||||
connect(ui->btn_network, &QToolButton::clicked, [=]() {
|
connect(ui->btn_network, &QToolButton::clicked, [=]() {
|
||||||
GetAdminPsw dialog(this);
|
GetAdminPsw dialog(this);
|
||||||
if (dialog.exec() == QDialog::Accepted)
|
if (dialog.exec() == QDialog::Accepted)
|
||||||
|
|||||||
25
src/json/ScanJson.cpp
Normal file
25
src/json/ScanJson.cpp
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/5/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "ScanJson.h"
|
||||||
|
#include <QFile>
|
||||||
|
#include <QDir>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
void ScanJson::save() {
|
||||||
|
if (!root) return;
|
||||||
|
QDir d(QCoreApplication::applicationDirPath());
|
||||||
|
if (!d.exists("jsons")){
|
||||||
|
d.mkdir("jsons");
|
||||||
|
}
|
||||||
|
QFile f(QString("%1/jsons/%2.json").arg(QCoreApplication::applicationDirPath(),scanID.c_str()));
|
||||||
|
f.open(QFileDevice::ReadWrite);
|
||||||
|
cJSON_AddItemToObject(root, "EmptyScanID",
|
||||||
|
cJSON_CreateString(emptyScanID.empty()?JsonObject::Instance()->getEmptyScanID():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);
|
||||||
|
}
|
||||||
47
src/json/ScanJson.h
Normal file
47
src/json/ScanJson.h
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
//
|
||||||
|
// Created by Krad on 2022/5/11.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef GUI_SCANJSON_H
|
||||||
|
#define GUI_SCANJSON_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "cJSON.h"
|
||||||
|
#include "jsonobject.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);
|
||||||
|
JsonObject::Instance()->setEmptyScanID(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
|
||||||
@@ -30,7 +30,13 @@ void JsonObject::setJsonString(const char* catergory, const char* stringName, co
|
|||||||
if (!first) return;
|
if (!first) return;
|
||||||
|
|
||||||
cJSON* Item = cJSON_CreateString(stringValue);
|
cJSON* Item = cJSON_CreateString(stringValue);
|
||||||
|
cJSON* valItem = cJSON_GetObjectItem(first, stringName);
|
||||||
|
if (valItem){
|
||||||
cJSON_ReplaceItemInObject(first, stringName, Item);
|
cJSON_ReplaceItemInObject(first, stringName, Item);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
cJSON_AddItemToObject(first, stringName , Item);
|
||||||
|
}
|
||||||
if (save)
|
if (save)
|
||||||
{
|
{
|
||||||
savecfg();
|
savecfg();
|
||||||
@@ -50,6 +56,41 @@ char* JsonObject::getJsonString(const char* catergory, const char* stringName)
|
|||||||
return second->valuestring;
|
return second->valuestring;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JsonObject::setBool(const char *catergory, const char *stringName, bool val, bool save) {
|
||||||
|
if (!loadcfg())
|
||||||
|
return;
|
||||||
|
|
||||||
|
cJSON* first = cJSON_GetObjectItem((cJSON*)json_root, catergory);
|
||||||
|
if (!first) return;
|
||||||
|
|
||||||
|
cJSON* Item = cJSON_CreateBool(val?1:0);
|
||||||
|
cJSON* valItem = cJSON_GetObjectItem(first, stringName);
|
||||||
|
if (valItem){
|
||||||
|
cJSON_ReplaceItemInObject(first, stringName, Item);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
cJSON_AddItemToObject(first, stringName , Item);
|
||||||
|
}
|
||||||
|
if (save)
|
||||||
|
{
|
||||||
|
savecfg();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool JsonObject::getBool(const char* catergory, const char* stringName)
|
||||||
|
{
|
||||||
|
if (!loadcfg())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
cJSON* first = cJSON_GetObjectItem((cJSON*)json_root, catergory);
|
||||||
|
if (!first) return false;
|
||||||
|
|
||||||
|
cJSON* second = cJSON_GetObjectItem(first, stringName);
|
||||||
|
if (!second) return false;
|
||||||
|
return second->valueint;
|
||||||
|
}
|
||||||
|
|
||||||
char* JsonObject::getArrayNode(const char* catergory, const char* stringName, int index, const char* id)
|
char* JsonObject::getArrayNode(const char* catergory, const char* stringName, int index, const char* id)
|
||||||
{
|
{
|
||||||
if (!loadcfg())
|
if (!loadcfg())
|
||||||
@@ -396,6 +437,12 @@ void JsonObject::autoDHCP(bool ena)
|
|||||||
setJsonString("address", "dhcp", str.toStdString().c_str());
|
setJsonString("address", "dhcp", str.toStdString().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool JsonObject::getScanConfirm() {
|
||||||
|
return getBool("general","ScanConfirm");
|
||||||
|
}
|
||||||
|
void JsonObject::setScanConfirm(bool val) {
|
||||||
|
setBool("general","ScanConfirm", val, true);
|
||||||
|
}
|
||||||
|
|
||||||
IpAddr JsonObject::getDefaultIpAddr()
|
IpAddr JsonObject::getDefaultIpAddr()
|
||||||
{
|
{
|
||||||
@@ -474,3 +521,13 @@ void JsonObject::setIpRouteList(const QList<QStringList>& list)
|
|||||||
}
|
}
|
||||||
savecfg();
|
savecfg();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void JsonObject::setEmptyScanID(const char *id) {
|
||||||
|
setJsonString("deviceparam","EmptyScanID",id, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *JsonObject::getEmptyScanID() {
|
||||||
|
return getJsonString("deviceparam","EmptyScanID");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -87,6 +87,12 @@ public:
|
|||||||
bool isDHCP();
|
bool isDHCP();
|
||||||
void autoDHCP(bool);
|
void autoDHCP(bool);
|
||||||
|
|
||||||
|
bool getScanConfirm();
|
||||||
|
void setScanConfirm(bool val);
|
||||||
|
|
||||||
|
const char* getEmptyScanID();
|
||||||
|
void setEmptyScanID(const char* id);
|
||||||
|
|
||||||
IpAddr getDefaultIpAddr();
|
IpAddr getDefaultIpAddr();
|
||||||
void setDefaultIpAddr(const IpAddr& addr);
|
void setDefaultIpAddr(const IpAddr& addr);
|
||||||
|
|
||||||
@@ -104,6 +110,9 @@ private:
|
|||||||
void setJsonString(const char* catergory, const char* stringName, const char* stringValue, bool save = true);
|
void setJsonString(const char* catergory, const char* stringName, const char* stringValue, bool save = true);
|
||||||
char* getJsonString(const char* catergory, const char* stringName);
|
char* getJsonString(const char* catergory, const char* stringName);
|
||||||
|
|
||||||
|
void setBool(const char* catergory, const char* stringName,bool val, bool save = true);
|
||||||
|
bool getBool(const char* catergory, const char* stringName);
|
||||||
|
|
||||||
char* getArrayNode(const char* catergory, const char* stringName, int index, const char* id);
|
char* getArrayNode(const char* catergory, const char* stringName, int index, const char* id);
|
||||||
void setArrayNode(const char* catergory, const char* stringName, int index, const char* id, const char* stringValue);
|
void setArrayNode(const char* catergory, const char* stringName, int index, const char* id, const char* stringValue);
|
||||||
int getArraySize(const char* catergory, const char* stringName);
|
int getArraySize(const char* catergory, const char* stringName);
|
||||||
|
|||||||
@@ -126,7 +126,8 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||||||
if (msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
QVariant* var = (QVariant*)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 {
|
else {
|
||||||
msgDialog->hideMessage();
|
msgDialog->hideMessage();
|
||||||
@@ -134,6 +135,14 @@ MainWindow::MainWindow(QWidget* parent) :
|
|||||||
// msgDialog->showFullScreen();
|
// msgDialog->showFullScreen();
|
||||||
if (msgDialog->isHidden())msgDialog->show();
|
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, [=]() {
|
connect(EventCenter::Default(), &EventCenter::InvokeOperationEnd, [=]() {
|
||||||
if (!msgDialog) return;
|
if (!msgDialog) return;
|
||||||
if (!msgDialog->isHidden())msgDialog->accept();
|
if (!msgDialog->isHidden())msgDialog->accept();
|
||||||
|
|||||||
Reference in New Issue
Block a user