Empty Scan ID Initial check.
This commit is contained in:
@@ -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
|
||||||
@@ -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, [=]() {
|
||||||
|
|||||||
@@ -8,7 +8,11 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
void ScanJson::save() {
|
void ScanJson::save() {
|
||||||
if (!root) return;
|
if (!root) return;
|
||||||
QFile f(QString("%1/%2.json").arg(QCoreApplication::applicationDirPath(),scanID.c_str()));
|
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);
|
f.open(QFileDevice::ReadWrite);
|
||||||
cJSON_AddItemToObject(root, "EmptyScanID", cJSON_CreateString(emptyScanID.c_str()));
|
cJSON_AddItemToObject(root, "EmptyScanID", cJSON_CreateString(emptyScanID.c_str()));
|
||||||
cJSON_AddItemToObject(root, "ScanID", cJSON_CreateString(scanID.c_str()));
|
cJSON_AddItemToObject(root, "ScanID", cJSON_CreateString(scanID.c_str()));
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "cJSON.h"
|
#include "cJSON.h"
|
||||||
|
#include "jsonobject.h"
|
||||||
|
|
||||||
class ScanJson {
|
class ScanJson {
|
||||||
public:
|
public:
|
||||||
@@ -27,8 +28,10 @@ public:
|
|||||||
void setEmptyScanID(const char * id){
|
void setEmptyScanID(const char * id){
|
||||||
emptyScanID.clear();
|
emptyScanID.clear();
|
||||||
emptyScanID.append(id);
|
emptyScanID.append(id);
|
||||||
|
JsonObject::Instance()->setEmptyScanID(id);
|
||||||
setScanID(id);
|
setScanID(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void save();
|
void save();
|
||||||
static ScanJson* Current(){
|
static ScanJson* Current(){
|
||||||
static ScanJson instance;
|
static ScanJson instance;
|
||||||
|
|||||||
@@ -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_ReplaceItemInObject(first, stringName, Item);
|
cJSON* valItem = cJSON_GetObjectItem(first, stringName);
|
||||||
|
if (valItem){
|
||||||
|
cJSON_ReplaceItemInObject(first, stringName, Item);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
cJSON_AddItemToObject(first, stringName , Item);
|
||||||
|
}
|
||||||
if (save)
|
if (save)
|
||||||
{
|
{
|
||||||
savecfg();
|
savecfg();
|
||||||
@@ -516,4 +522,12 @@ 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");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -90,6 +90,9 @@ public:
|
|||||||
bool getScanConfirm();
|
bool getScanConfirm();
|
||||||
void setScanConfirm(bool val);
|
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);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user