1 Star 1 Fork 0

xiongqiumin/LockServer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
setting.cpp 1.52 KB
一键复制 编辑 原始数据 按行查看 历史
xiongqiumin 提交于 2021-01-25 23:23 . init
#include "Setting.h"
#include <QDataStream>
#include <QApplication>
#include <QFile>
QDataStream &operator << (QDataStream &s, const Setting &param)
{
s << param.dllType;
s << param.ICDLL_dbtype;
s << param.ICDLL_dbpath;
s << param.V9RF_coid;
s << param.cardType;
s << param.CVR100UD_type;
s << param.CVR100UD_usb;
s << param.CVR100UD_uart;
s << param.RFV42DLL_com;
s << param.RFV42DLL_sysNo;
s << param.ProUSb_coID;
return s;
}
QDataStream &operator >> (QDataStream &s, Setting &param)
{
s >> param.dllType;
s >> param.ICDLL_dbtype;
s >> param.ICDLL_dbpath;
s >> param.V9RF_coid;
s >> param.cardType;
s >> param.CVR100UD_type;
s >> param.CVR100UD_usb;
s >> param.CVR100UD_uart;
s >> param.RFV42DLL_com;
s >> param.RFV42DLL_sysNo;
s >> param.ProUSb_coID;
return s;
}
Setting g_setting;
Setting::Setting()
{
dllType = 0;
ICDLL_dbtype = 0;
TPDLL_type = 1;
cardType = 0;
CVR100UD_type = 0;
CVR100UD_usb = 0;
CVR100UD_uart = 0;
RFV42DLL_com = 0;
RFV42DLL_sysNo = 0;
ProUSb_coID = 0;
}
void Setting::save()
{
QString filename = QApplication::applicationDirPath() + "/setting.dat";
QFile file(filename);
if (file.open(QFile::WriteOnly | QFile::Truncate))
{
QDataStream s(&file);
s << *this;
file.close();
}
}
void Setting::load()
{
QString filename = QApplication::applicationDirPath() + "/setting.dat";
QFile file(filename);
if (file.open(QFile::ReadOnly))
{
QDataStream s(&file);
s >> *this;
file.close();
}
if(dllType < 0)
dllType = 0;
if(cardType < 0)
cardType = 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xiongqiumin/lock-server.git
[email protected]:xiongqiumin/lock-server.git
xiongqiumin
lock-server
LockServer
master

搜索帮助