2021-12-07 14:09:24 +08:00
|
|
|
#ifndef JSONOBJECT_H
|
|
|
|
|
#define JSONOBJECT_H
|
|
|
|
|
|
|
|
|
|
//#include <QObject>
|
2021-12-13 17:01:17 +08:00
|
|
|
#include <QString>
|
2021-12-07 14:09:24 +08:00
|
|
|
class QStringList;
|
|
|
|
|
class QTranslator;
|
|
|
|
|
|
2021-12-10 10:25:02 +08:00
|
|
|
#include <QString>
|
2021-12-09 10:00:01 +08:00
|
|
|
struct host {
|
|
|
|
|
QString name;
|
|
|
|
|
QString ae;
|
|
|
|
|
QString ip;
|
|
|
|
|
QString port;
|
|
|
|
|
//QString isDefault;
|
|
|
|
|
};
|
2021-12-17 18:02:39 +08:00
|
|
|
|
|
|
|
|
struct IpAddr {
|
2021-12-09 10:00:01 +08:00
|
|
|
QString ip;
|
|
|
|
|
QString mask;
|
2021-12-17 18:02:39 +08:00
|
|
|
};
|
|
|
|
|
struct IpRoute
|
|
|
|
|
{
|
|
|
|
|
QString des;
|
|
|
|
|
QString gw;
|
|
|
|
|
QString mask;
|
2021-12-09 10:00:01 +08:00
|
|
|
};
|
2021-12-07 14:09:24 +08:00
|
|
|
|
2021-12-17 18:02:39 +08:00
|
|
|
|
2021-12-07 14:09:24 +08:00
|
|
|
class JsonObject
|
|
|
|
|
{
|
|
|
|
|
public:
|
2021-12-09 10:00:01 +08:00
|
|
|
|
2021-12-07 14:09:24 +08:00
|
|
|
static JsonObject* Instance()
|
|
|
|
|
{
|
|
|
|
|
static JsonObject obj;
|
|
|
|
|
return &obj;
|
|
|
|
|
}
|
2021-12-09 10:00:01 +08:00
|
|
|
enum ServerType
|
|
|
|
|
{
|
|
|
|
|
WORKLIST, PACS, DAQ, RECON
|
|
|
|
|
};
|
2021-12-07 14:09:24 +08:00
|
|
|
|
2021-12-28 11:49:07 +08:00
|
|
|
//for login
|
|
|
|
|
void setDefaultUser(const QString& str);
|
|
|
|
|
QString defaultUser();
|
|
|
|
|
|
|
|
|
|
|
2021-12-07 14:09:24 +08:00
|
|
|
QStringList language();
|
2021-12-28 11:49:07 +08:00
|
|
|
void setDefaultLanguage(const QString& str);
|
2021-12-07 14:09:24 +08:00
|
|
|
QString defaultLanguage();
|
|
|
|
|
|
|
|
|
|
QString institutionName();
|
2021-12-28 11:49:07 +08:00
|
|
|
void setInstitutionName(const QString& str);
|
2021-12-07 14:09:24 +08:00
|
|
|
|
|
|
|
|
QString institutionAddr();
|
2021-12-28 11:49:07 +08:00
|
|
|
void setInstitutionAddr(const QString& str);
|
2021-12-07 14:09:24 +08:00
|
|
|
|
|
|
|
|
int lockerCount();
|
|
|
|
|
QString lockScreenTimeout();
|
2021-12-28 11:49:07 +08:00
|
|
|
void setLockScreenTimeout(const QString& str);
|
2021-12-07 14:09:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
QStringList protocals();
|
|
|
|
|
QString defaultProtocal();
|
2021-12-28 11:49:07 +08:00
|
|
|
void setDefaultProtocal(const QString& str);
|
2021-12-07 14:09:24 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
QStringList worklistFilters();
|
|
|
|
|
QString defaultFilter();
|
2021-12-28 11:49:07 +08:00
|
|
|
void setDefaultFilter(const QString& str);
|
2021-12-07 14:09:24 +08:00
|
|
|
|
2021-12-09 10:00:01 +08:00
|
|
|
host getServer(ServerType type);
|
|
|
|
|
void setServer(ServerType type, const host& list);
|
|
|
|
|
|
2021-12-17 18:02:39 +08:00
|
|
|
//for network manager
|
2021-12-20 18:08:32 +08:00
|
|
|
|
2021-12-17 18:02:39 +08:00
|
|
|
QString passWord();
|
2021-12-20 18:08:32 +08:00
|
|
|
void setPassword(const QString& pwd);
|
2021-12-17 18:02:39 +08:00
|
|
|
|
|
|
|
|
QString interfaceName();
|
|
|
|
|
void setInterfaceName(const QString& name);
|
|
|
|
|
|
|
|
|
|
bool isDHCP();
|
|
|
|
|
void autoDHCP(bool);
|
|
|
|
|
|
|
|
|
|
IpAddr getDefaultIpAddr();
|
|
|
|
|
void setDefaultIpAddr(const IpAddr& addr);
|
|
|
|
|
|
|
|
|
|
QList<QStringList> getIpAddrList();
|
|
|
|
|
void setIpAddrList(const QList<QStringList>& list);
|
|
|
|
|
|
|
|
|
|
QString getDefaultGateway();
|
|
|
|
|
void setDefaultGateway(const QString& gw);
|
|
|
|
|
|
|
|
|
|
QList<QStringList> getIpRouteList();
|
|
|
|
|
void setIpRouteList(const QList<QStringList>& list);
|
2021-12-09 10:00:01 +08:00
|
|
|
|
2021-12-07 14:09:24 +08:00
|
|
|
private:
|
2021-12-09 10:00:01 +08:00
|
|
|
void setJsonString(const char* catergory, const char* stringName, const char* stringValue, bool save = true);
|
2021-12-07 14:09:24 +08:00
|
|
|
char* getJsonString(const char* catergory, const char* stringName);
|
|
|
|
|
|
2021-12-17 18:02:39 +08:00
|
|
|
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);
|
|
|
|
|
int getArraySize(const char* catergory, const char* stringName);
|
|
|
|
|
|
|
|
|
|
|
2021-12-07 14:09:24 +08:00
|
|
|
bool loadcfg();
|
|
|
|
|
bool savecfg();
|
|
|
|
|
|
|
|
|
|
JsonObject();
|
|
|
|
|
~JsonObject();
|
2021-12-20 18:08:32 +08:00
|
|
|
|
2021-12-08 10:52:38 +08:00
|
|
|
void* json_root = nullptr;
|
2021-12-07 14:09:24 +08:00
|
|
|
bool m_bLoaded = false;
|
|
|
|
|
|
2021-12-20 18:08:32 +08:00
|
|
|
QString tmp_psw;
|
2021-12-07 14:09:24 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endif // JSONOBJECT_H
|