New Json logic
This commit is contained in:
69
src/json/jsonobject.h
Normal file
69
src/json/jsonobject.h
Normal file
@@ -0,0 +1,69 @@
|
||||
#ifndef JSONOBJECT_H
|
||||
#define JSONOBJECT_H
|
||||
|
||||
//#include <QObject>
|
||||
#include "json/cJSON.h"
|
||||
class QString;
|
||||
class QStringList;
|
||||
class QTranslator;
|
||||
|
||||
//#define setJsonString(catergory,stringName,stringValue)\
|
||||
// if (!loadcfg())\
|
||||
// return;\
|
||||
// cJSON* first = cJSON_FindItemInObject(json_root, #catergory);\
|
||||
// if (first){\
|
||||
// cJSON* Item = cJSON_CreateString(#stringValue);\
|
||||
// cJSON_ReplaceItemInObject(first, #stringName, Item);\
|
||||
// }\
|
||||
// savecfg();
|
||||
|
||||
class JsonObject
|
||||
{
|
||||
public:
|
||||
static JsonObject* Instance()
|
||||
{
|
||||
static JsonObject obj;
|
||||
return &obj;
|
||||
}
|
||||
|
||||
QStringList language();
|
||||
void setDefaultLanguage(QString str);
|
||||
QString defaultLanguage();
|
||||
|
||||
QString institutionName();
|
||||
void setInstitutionName(QString str);
|
||||
|
||||
QString institutionAddr();
|
||||
void setInstitutionAddr(QString str);
|
||||
|
||||
int lockerCount();
|
||||
QString lockScreenTimeout();
|
||||
void setLockScreenTimeout(QString str);
|
||||
|
||||
|
||||
QStringList protocals();
|
||||
QString defaultProtocal();
|
||||
void setDefaultProtocal(QString str);
|
||||
|
||||
|
||||
QStringList worklistFilters();
|
||||
QString defaultFilter();
|
||||
void setDefaultFilter(QString str);
|
||||
|
||||
private:
|
||||
void setJsonString(const char* catergory, const char* stringName, const char* stringValue);
|
||||
char* getJsonString(const char* catergory, const char* stringName);
|
||||
|
||||
bool loadcfg();
|
||||
bool savecfg();
|
||||
|
||||
JsonObject();
|
||||
~JsonObject();
|
||||
cJSON* json_root = nullptr;
|
||||
bool m_bLoaded = false;
|
||||
|
||||
int counter;
|
||||
|
||||
};
|
||||
|
||||
#endif // JSONOBJECT_H
|
||||
Reference in New Issue
Block a user