Empty Scan ID Initial check.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
#include <qdebug.h>
|
||||
#include "log/UserOperationLog.h"
|
||||
#include <QLabel>
|
||||
#include "json/jsonobject.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#else
|
||||
@@ -229,6 +230,11 @@ ScanFormWidget::ScanFormWidget(QWidget* parent) : TabFormWidget(parent) {
|
||||
connect(btnScan, &QToolButton::clicked, [=]() {
|
||||
QString patientInf(patient_information->getCurrentPatientJsonString(false));
|
||||
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));
|
||||
});
|
||||
connect(btnStop, &QToolButton::clicked, [=]() {
|
||||
|
||||
@@ -8,7 +8,11 @@
|
||||
#include <QCoreApplication>
|
||||
void ScanJson::save() {
|
||||
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);
|
||||
cJSON_AddItemToObject(root, "EmptyScanID", cJSON_CreateString(emptyScanID.c_str()));
|
||||
cJSON_AddItemToObject(root, "ScanID", cJSON_CreateString(scanID.c_str()));
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
#include <string>
|
||||
#include "cJSON.h"
|
||||
#include "jsonobject.h"
|
||||
|
||||
class ScanJson {
|
||||
public:
|
||||
@@ -27,8 +28,10 @@ public:
|
||||
void setEmptyScanID(const char * id){
|
||||
emptyScanID.clear();
|
||||
emptyScanID.append(id);
|
||||
JsonObject::Instance()->setEmptyScanID(id);
|
||||
setScanID(id);
|
||||
}
|
||||
|
||||
void save();
|
||||
static ScanJson* Current(){
|
||||
static ScanJson instance;
|
||||
|
||||
@@ -30,7 +30,13 @@ void JsonObject::setJsonString(const char* catergory, const char* stringName, co
|
||||
if (!first) return;
|
||||
|
||||
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)
|
||||
{
|
||||
savecfg();
|
||||
@@ -516,4 +522,12 @@ void JsonObject::setIpRouteList(const QList<QStringList>& list)
|
||||
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();
|
||||
void setScanConfirm(bool val);
|
||||
|
||||
const char* getEmptyScanID();
|
||||
void setEmptyScanID(const char* id);
|
||||
|
||||
IpAddr getDefaultIpAddr();
|
||||
void setDefaultIpAddr(const IpAddr& addr);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user