798 lines
41 KiB
C++
798 lines
41 KiB
C++
#include "ChannelList.h"
|
||
#include "ui_channellist.h"
|
||
#include <QCheckBox>
|
||
#include "sqlitedb.h"
|
||
#include <QLabel>
|
||
#include <QDateTime>
|
||
#include <QDate>
|
||
#include <QTime>
|
||
#include <QInputDialog>
|
||
#include <QListView>
|
||
#include "NetMgr.h"
|
||
|
||
CChannelList::CChannelList(QWidget *parent) :
|
||
QWidget(parent),
|
||
ui(new Ui::CChannelList)
|
||
{
|
||
ui->setupUi(this);
|
||
ui->comboBox_operate->setView(new QListView());
|
||
// this->setWindowTitle("QTableView简单使用");
|
||
|
||
// //建立模型对象空间并指定父对象
|
||
// m_pModel = new QStandardItemModel(ui->tableView);
|
||
// //添加列标题
|
||
// //m_pModel->setHorizontalHeaderLabels(QStringList() << "one" << "two"\
|
||
// << "three" << "four");
|
||
// m_pModel->setColumnCount(5);
|
||
// //将数据模型设置到表对象上
|
||
// ui->tableView->setModel(m_pModel);
|
||
|
||
|
||
// //建立表头对象空间并指定父对象
|
||
// m_pHeaderView = new CHeaderView(Qt::Horizontal, ui->tableView);
|
||
// //将表对象的表头设为自定义表头
|
||
// ui->tableView->setHorizontalHeader(m_pHeaderView);
|
||
// //连接表头点击信号槽
|
||
// connect(m_pHeaderView, &CHeaderView::columnSectionClicked
|
||
// , this, &CChannelList::on_columnSectionClicked);
|
||
|
||
// //循环添加三行数据
|
||
// for(int index = 0; index != 3; ++index)
|
||
// {
|
||
// m_pModel->appendRow(QList<QStandardItem *>()
|
||
// << new QStandardItem(QString("第%1行,第0列").arg(index))
|
||
// << new QStandardItem(QString("第%1行,第1列").arg(index))
|
||
// << new QStandardItem(QString("第%1行,第2列").arg(index))
|
||
// << new QStandardItem(QString("第%1行,第3列").arg(index)));
|
||
// }
|
||
// //m_pModel->appendRow(new QStandardItem(QString("第%1行,第0列")));
|
||
// //设置第0列和第2列为可选
|
||
// this->setColumnCheckable(0, true);
|
||
// //this->setColumnCheckable(2, true);
|
||
//--1 初始化
|
||
headerStr = QObject::tr(" ,通道名称,模块编号,通道滤波状态,通道状态,通道类型,采样频率(Hz),灵敏度,工程单位,范围检查,最小值,\
|
||
最大值,1x幅值补偿,1x相位补偿,初始间距,安装角度,安装位置,转向,速度参考,转速比,关联通道,\
|
||
轴承间隙,启动位置,IEPE,耦合性,0值电压,满程电压,自动转速,触发沿,触发次数,Hysteresis(V),\
|
||
触发阈值,热电偶类型,配置时间,滤波器,起始频率,截止频率,备注");
|
||
|
||
|
||
iniVar();
|
||
iniUi();
|
||
iniConnect();
|
||
|
||
connect(ui->tableView, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotRowDoubleClicked(const QModelIndex &)));
|
||
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||
ui->tableView->setColumnWidth(33, 256);
|
||
|
||
m_nCurRow = -1;
|
||
ui->comboBox_operate->addItem("通道");
|
||
ui->comboBox_operate->addItem("带通滤波");
|
||
|
||
//--2 创建表格项
|
||
// QStringList workingConditionName;
|
||
// workingConditionName<<tr("工况1")<<tr("工况2")<<tr("工况3");
|
||
// createItem(workingConditionName);
|
||
|
||
#ifdef QT_DEBUG
|
||
initReadConfig();
|
||
#endif
|
||
#ifdef NO_FILTER
|
||
initReadConfig();
|
||
#endif
|
||
|
||
}
|
||
|
||
CChannelList::~CChannelList()
|
||
{
|
||
delete ui;
|
||
}
|
||
void CChannelList::initReadConfig()
|
||
{
|
||
|
||
//model->clear();
|
||
for (int i = 0; i < g_channelSetting.size(); i++) {
|
||
|
||
QString strChannelType;
|
||
QMap<QString,QString>::Iterator iter = g_MapChannelType.begin();
|
||
for (; iter != g_MapChannelType.end(); iter++) {
|
||
if(iter.key() == g_channelSetting[i].sensorType){
|
||
strChannelType = iter.value();
|
||
break;
|
||
}
|
||
}
|
||
|
||
|
||
QVariantList strRowItem ;
|
||
QString strChannelStatus,strChannelFilterStatus,strChannelNo;
|
||
if(g_channelSetting[i].isEnable)
|
||
strChannelStatus = "启用";
|
||
else
|
||
strChannelStatus = "关闭";
|
||
|
||
if(g_channelSetting[i].filterStatus)
|
||
strChannelFilterStatus = "启用";
|
||
else
|
||
strChannelFilterStatus = "关闭";
|
||
QString strcouplingACDC;
|
||
if(g_channelSetting[i].couplingACDC)
|
||
strcouplingACDC = "AC";
|
||
else
|
||
strcouplingACDC = "DC";
|
||
|
||
strChannelNo = QString("%1-%2").arg(g_channelSetting[i].sensorModuleNo).arg(g_channelSetting[i].sensorNo);
|
||
QString TStr = QDateTime::fromSecsSinceEpoch(g_channelSetting[i].sensorConfigureDate.toInt()).toString("yyyy-MM-dd hh:mm:ss");
|
||
strRowItem << g_channelSetting[i].channelName << strChannelNo << strChannelFilterStatus\
|
||
<< strChannelStatus << strChannelType << g_channelSetting[i].samplingRate\
|
||
<< g_channelSetting[i].sensorSensitivity <<g_channelSetting[i].sensorEngineeringUnit <<g_channelSetting[i].sensorRangeCheck \
|
||
<< g_channelSetting[i].sensorRangeMin <<g_channelSetting[i].sensorRangeMax <<g_channelSetting[i].sensor1xAmplitudeRunout\
|
||
<< g_channelSetting[i].sensor1xPhaseRunout <<g_channelSetting[i].sensorGapVoltage <<g_channelSetting[i].sensorLocationInDegree\
|
||
<< g_channelSetting[i].sensorLeftOrRight <<g_channelSetting[i].shaftRotationDirection <<g_channelSetting[i].speedRefChannelName\
|
||
<< g_channelSetting[i].rpmMultiplier <<g_channelSetting[i].pairChannelName <<g_channelSetting[i].bearingClearance \
|
||
<< g_channelSetting[i].bearingStartPosition <<g_channelSetting[i].sensorICP << strcouplingACDC \
|
||
<< g_channelSetting[i].zeroScalePosition <<g_channelSetting[i].fullScalePosition <<g_channelSetting[i].tachAutoTach\
|
||
<< g_channelSetting[i].tachTriggerEdge <<g_channelSetting[i].tachTriggerPerRev <<g_channelSetting[i].tachTriggerHysteresis\
|
||
<< g_channelSetting[i].tachTriggerVoltageLevel <<g_channelSetting[i].thermalCoupleType \
|
||
<< TStr <<g_channelSetting[i].filter <<g_channelSetting[i].startBrands \
|
||
<< g_channelSetting[i].stopBrands << g_channelSetting[i].comments << g_channelSetting[i].channelId << g_channelSetting[i].boardType;
|
||
|
||
createRowItem(i,strRowItem);
|
||
//g_MapTableList.insert(g_channelSetting[i].channelId,strRowItem);
|
||
}
|
||
// ui->tableView->sortByColumn(2,Qt::AscendingOrder);//第3列是按照升序来排列
|
||
// ui->tableView->setSortingEnabled(true);
|
||
}
|
||
void CChannelList::iniVar()
|
||
{
|
||
myHeader = new TableHeaderView(Qt::Horizontal, ui->tableView);
|
||
model = new QStandardItemModel(ui->tableView);
|
||
}
|
||
|
||
void CChannelList::iniUi()
|
||
{
|
||
ui->tableView->setHorizontalHeader(myHeader);
|
||
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows); //选中行
|
||
QStringList headerList = headerStr.split(",");
|
||
model->setHorizontalHeaderLabels(headerList);
|
||
model->setColumnCount(headerList.size());
|
||
CheckBoxDelegate *pCheckDelegate = new CheckBoxDelegate(this);
|
||
ui->tableView->setItemDelegateForColumn(0, pCheckDelegate);
|
||
ui->tableView->setModel(model);
|
||
ui->tableView->setAlternatingRowColors(true);
|
||
for (int i = 0; i < model->columnCount() ; i++) {
|
||
if(i == 1){
|
||
ui->tableView->setColumnWidth(i, 200);
|
||
}else{
|
||
ui->tableView->setColumnWidth(i, 130);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
void CChannelList::iniConnect()
|
||
{
|
||
connect(myHeader, &TableHeaderView::stateChanged, this, &CChannelList::headerStateChangedSlot);
|
||
connect(model, SIGNAL(itemChanged(QStandardItem*)), this, SLOT(itemChangedSlot(QStandardItem*)));
|
||
|
||
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||
#ifndef NO_FILTER
|
||
QJsonObject sendData;
|
||
sendData["cmd"] = "97";
|
||
QJsonArray chan_list;
|
||
for (int i = 0; i < g_channelSetting.size(); i++) {
|
||
if(g_channelSetting[i].boardType != "5" && g_channelSetting[i].boardType != "6" )
|
||
chan_list.append(g_channelSetting[i].channelId);
|
||
}
|
||
sendData["chan_list"] = chan_list;
|
||
QNetworkRequest req;
|
||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||
req.setUrl(sUrl);
|
||
g_NetMgr->PostJson(req,sendData);
|
||
#endif
|
||
}
|
||
|
||
void CChannelList::createItem(QStringList filename)
|
||
{
|
||
qDebug()<< "createItem" << endl;
|
||
int rowCount = filename.size();
|
||
model->setRowCount(rowCount);
|
||
for(int i = 0; i < rowCount; ++i)
|
||
{
|
||
model->setItem(i,1,new QStandardItem(filename.at(i)));
|
||
QModelIndex index = model->index(i, 1, QModelIndex());
|
||
QStandardItem *item = model->itemFromIndex(index);
|
||
item->setData(QColor(Qt::green), Qt::BackgroundRole);
|
||
}
|
||
}
|
||
|
||
void CChannelList::createRowItem(int Row,QVariantList RowItem)
|
||
{
|
||
model->setRowCount(Row+1);
|
||
|
||
{
|
||
for (int j = 1; j < RowItem.size()+1; ++j)
|
||
{
|
||
//model->setItem(i,j,new QStandardItem(filename.at(j-1)));
|
||
model->setData(model->index(Row,j,QModelIndex()),RowItem.at(j-1));
|
||
//model->set
|
||
}
|
||
}
|
||
}
|
||
void CChannelList::headerStateChangedSlot(int state)
|
||
{
|
||
int rowCount = model->rowCount();
|
||
if (state == 2)//全选
|
||
{
|
||
for (int j = 0; j<rowCount; j++)
|
||
{
|
||
QModelIndex index = model->index(j, 0, QModelIndex());
|
||
model->setData(index, true, Qt::UserRole);
|
||
}
|
||
}
|
||
else if (state == 0) //全不选
|
||
{
|
||
for (int j = 0; j<rowCount; j++)
|
||
{
|
||
QModelIndex index = model->index(j, 0, QModelIndex());
|
||
model->setData(index, false, Qt::UserRole);
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
void CChannelList::itemChangedSlot(QStandardItem *item)
|
||
{
|
||
int rowCount = model->rowCount();
|
||
int column = item->index().column();
|
||
if (column == 0) //第0列 checkbox
|
||
{
|
||
Qt::CheckState state = Qt::Unchecked;
|
||
int nSelectedCount = 0;
|
||
for (int i = 0; i< rowCount; i++)
|
||
{
|
||
if (model->index(i, 0).data(Qt::UserRole).toBool())
|
||
{
|
||
nSelectedCount++;
|
||
}
|
||
}
|
||
if (nSelectedCount >= rowCount)
|
||
{
|
||
state = Qt::Checked;
|
||
}
|
||
else if (nSelectedCount > 0)
|
||
{
|
||
state = Qt::PartiallyChecked;
|
||
}
|
||
myHeader->onStateChanged(state);
|
||
}
|
||
}
|
||
void CChannelList::slotChannelSettingClose()
|
||
{
|
||
on_pushButton_refresh_clicked();
|
||
}
|
||
void CChannelList::slotSetChannelData(ChannelSetting channelSetting)
|
||
{
|
||
qDebug() << "slotSetChannelData" << endl;
|
||
int i;
|
||
for (i = 0;i <g_channelSetting.size() ; i++) {
|
||
if(g_channelSetting[i].channelId == channelSetting.channelId){
|
||
g_channelSetting[i] = channelSetting;
|
||
break;
|
||
}
|
||
}
|
||
QString strChannelType;
|
||
QMap<QString,QString>::Iterator iter = g_MapChannelType.begin();
|
||
for (; iter != g_MapChannelType.end(); iter++) {
|
||
if(iter.key() == channelSetting.sensorType){
|
||
strChannelType = iter.value();
|
||
break;
|
||
}
|
||
}
|
||
QVariantList strRowItem ;
|
||
QString strChannelStatus;
|
||
if(channelSetting.isEnable)
|
||
strChannelStatus = "启用";
|
||
else
|
||
strChannelStatus = "关闭";
|
||
|
||
|
||
|
||
QString TStr = QDateTime::fromSecsSinceEpoch(channelSetting.sensorConfigureDate.toInt()).toString("yyyy-MM-dd hh:mm:ss");
|
||
strRowItem << channelSetting.channelName << channelSetting.sensorModuleNo << channelSetting.sensorNo\
|
||
<< strChannelStatus << strChannelType << channelSetting.samplingRate\
|
||
<< channelSetting.sensorSensitivity <<channelSetting.sensorEngineeringUnit <<channelSetting.sensorRangeCheck \
|
||
<< channelSetting.sensorRangeMin <<channelSetting.sensorRangeMax <<channelSetting.sensor1xAmplitudeRunout\
|
||
<< channelSetting.sensor1xPhaseRunout <<channelSetting.bearingClearance <<channelSetting.sensorLocationInDegree\
|
||
<< channelSetting.sensorLeftOrRight <<channelSetting.shaftRotationDirection <<channelSetting.speedRefChannelId\
|
||
<< channelSetting.rpmMultiplier <<channelSetting.pairChannelId <<channelSetting.bearingClearance \
|
||
<< channelSetting.bearingStartPosition <<channelSetting.sensorICP << channelSetting.couplingACDC \
|
||
<< channelSetting.zeroScalePosition <<channelSetting.fullScalePosition <<channelSetting.tachAutoTach\
|
||
<< channelSetting.tachTriggerEdge <<channelSetting.tachTriggerPerRev <<channelSetting.tachTriggerHysteresis\
|
||
<< channelSetting.tachTriggerVoltageLevel <<channelSetting.thermalCoupleType \
|
||
<< TStr <<channelSetting.filter <<channelSetting.startBrands \
|
||
<< channelSetting.stopBrands << channelSetting.comments << g_channelSetting[i].channelId << g_channelSetting[i].boardType;
|
||
|
||
|
||
// for (int j = 1; j < strRowItem.size()+1; ++j)
|
||
// {
|
||
// model->setData(model->index(m_nCurRow,j,QModelIndex()),strRowItem.at(j-1));
|
||
// }
|
||
// model->setData(model->index(m_nCurRow,1,QModelIndex()),g_channelSetting[i].channelName);
|
||
|
||
// QJsonDocument document;
|
||
// document.setArray(m_JsonArray);
|
||
// QByteArray byteArray = document.toJson(QJsonDocument::Compact);
|
||
// QString name = QCoreApplication::applicationDirPath() + "\\config\\channelSettings.json";
|
||
// QFile file(name);
|
||
// file.open(QIODevice::WriteOnly);
|
||
// file.write(byteArray);
|
||
// file.close();
|
||
QString strUpdateSql = QString(" set ChUnitCoeff = '%1' , ChUnitDot = %2,SensorICP = '%3', \
|
||
SensorType = '%4',bearingClearance='%5',bearingStartPosition='%6',\
|
||
channelIntDiff = '%7',channelName='%8',channelRMSPkPk2Pk='%9',channelSensorType='%10',\
|
||
comments = '%11',couplingACDC='%12',envelopeHighpassband=%13,envelopeLowpassband=%14,\
|
||
equipmentId = %15,filter='%16',frequencyRangeMax='%17',frequencyRangeMin='%18',\
|
||
fullScalePosition=%19,highPassFrequency='%20',installMethod='%21',isEnable=%22,\
|
||
isWork=%23,lowPassFrequency='%24',measuringRange='%25',offset=%26,pairChannelId='%27',\
|
||
pairChannelName='%28',rpmMultiplier='%29',samplingRate=%30,sensor1xAmplitudeRunout='%31',\
|
||
sensor1xPhaseRunout='%32',sensorConfigureDate='%33',sensorEngineeringUnit='%34',\
|
||
sensorGapVoltage='%35',sensorLeftOrRight='%36',sensorLocationInDegree=%37,sensorModuleNo=%38,\
|
||
sensorNo=%39,sensorRange='%40',sensorRangeCheck='%41',sensorRangeMax='%42',sensorRangeMin='%43',\
|
||
sensorSensitivity='%44',shaftRotationDirection='%45',speedRefChannelId='%46',\
|
||
startBrands='%47',stopBrands='%48',tachAutoTach='%49',tachTriggerEdge='%50',tachTriggerHysteresis=%51,\
|
||
tachTriggerPerRev='%52',tachTriggerVoltageLevel='%53',thermalCoupleType = '%54',xFullScalePosition='%55',\
|
||
xProcessVariableName='%56',xZeroScalePosition='%57',zeroScalePosition='%58',speedRefChannelName = '%59',defaultDisplay = '%60',sensorTypes = '%61',\
|
||
confidenceDegree = %62,sectionNum = %63,EngineeringUnit2 = '%64',firstPoleNum = '%65' where channelId = '%66'").\
|
||
arg(channelSetting.ChUnitCoeff).arg(channelSetting.ChUnitDot).arg(channelSetting.sensorICP).\
|
||
arg(channelSetting.sensorType).arg(channelSetting.bearingClearance).arg(channelSetting.bearingStartPosition).\
|
||
arg(channelSetting.channelIntDiff).arg(channelSetting.channelName).arg(channelSetting.channelRMSPkPk2Pk).arg(channelSetting.channelSensorType).\
|
||
arg(channelSetting.comments).arg(channelSetting.couplingACDC).arg(channelSetting.envelopeHighpassband).arg(channelSetting.envelopeLowpassband).\
|
||
arg(channelSetting.equipmentId).arg(channelSetting.filter).arg(channelSetting.frequencyRangeMax).\
|
||
arg(channelSetting.frequencyRangeMin).arg(channelSetting.fullScalePosition).arg(channelSetting.highPassFrequency).\
|
||
arg(channelSetting.installMethod).arg(channelSetting.isEnable).arg(channelSetting.isWork).\
|
||
arg(channelSetting.lowPassFrequency).arg(channelSetting.measuringRange).arg(channelSetting.offset).\
|
||
arg(channelSetting.pairChannelId).arg(channelSetting.pairChannelName).arg(channelSetting.rpmMultiplier).\
|
||
arg(channelSetting.samplingRate).arg(channelSetting.sensor1xAmplitudeRunout).arg(channelSetting.sensor1xPhaseRunout).\
|
||
arg(channelSetting.sensorConfigureDate).arg(channelSetting.sensorEngineeringUnit).arg(channelSetting.sensorGapVoltage).\
|
||
arg(channelSetting.sensorLeftOrRight).arg(channelSetting.sensorLocationInDegree).arg(channelSetting.sensorModuleNo).\
|
||
arg(channelSetting.sensorNo).arg(channelSetting.sensorRange).arg(channelSetting.sensorRangeCheck).\
|
||
arg(channelSetting.sensorRangeMax).arg(channelSetting.sensorRangeMin).arg(channelSetting.sensorSensitivity).\
|
||
arg(channelSetting.shaftRotationDirection).arg(channelSetting.speedRefChannelId).\
|
||
arg(channelSetting.startBrands).arg(channelSetting.stopBrands).arg(channelSetting.tachAutoTach).arg(channelSetting.tachTriggerEdge).\
|
||
arg(channelSetting.tachTriggerHysteresis).arg(channelSetting.tachTriggerPerRev).arg(channelSetting.tachTriggerVoltageLevel).\
|
||
arg(channelSetting.thermalCoupleType).arg(channelSetting.xFullScalePosition).arg(channelSetting.xProcessVariableName).arg(channelSetting.xZeroScalePosition).\
|
||
arg(channelSetting.zeroScalePosition).arg(channelSetting.speedRefChannelName).arg(channelSetting.defaultDisplay).arg(channelSetting.sensorTypes).\
|
||
arg(channelSetting.confidenceDegree).arg(channelSetting.sectionNum).arg(channelSetting.EngineeringUnit).arg(channelSetting.firstPoleNum).arg(channelSetting.channelId);
|
||
|
||
QString tableName = "t_ChannelSetting ";
|
||
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
|
||
|
||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||
|
||
putJson();
|
||
|
||
//disconnect(ChannelSettingdialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
|
||
//disconnect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
|
||
}
|
||
void CChannelList::putJson()
|
||
{
|
||
QJsonArray channelArray;
|
||
for(int i = 0; i < g_channelSetting.size();i++){
|
||
QJsonObject channelObj;
|
||
channelObj["ChUnitCoeff"] = g_channelSetting[i].ChUnitCoeff;
|
||
channelObj["ChUnitDot"] = g_channelSetting[i].ChUnitDot;
|
||
channelObj["sensorICP"] = g_channelSetting[i].sensorICP;
|
||
channelObj["bearingClearance"] = g_channelSetting[i].bearingClearance.toDouble();
|
||
channelObj["bearingStartPosition"] = g_channelSetting[i].bearingStartPosition;
|
||
channelObj["channel1P5XAMP"] = g_channelSetting[i].channel1P5XAMP;
|
||
channelObj["channel1P5XAMPDefaultValue"] = g_channelSetting[i].channel1P5XAMPDefaultValue;
|
||
channelObj["channel1xAmpl"] = g_channelSetting[i].channel1xAmpl;
|
||
channelObj["channel1xAmpleDefaultValue"] = g_channelSetting[i].channel1xAmpleDefaultValue;
|
||
channelObj["channel2P5XAMP"] = g_channelSetting[i].channel2P5XAMP;
|
||
channelObj["channel2P5XAMPDefaultValue"] = g_channelSetting[i].channel2P5XAMPDefaultValue;
|
||
channelObj["channel2p5xAmpl"] = g_channelSetting[i].channel2p5xAmpl;
|
||
channelObj["channel2p5xAmplDefaultValue"] = g_channelSetting[i].channel2p5xAmplDefaultValue;
|
||
channelObj["channel2xAmpl"] = g_channelSetting[i].channel2xAmpl;
|
||
channelObj["channel2xAmplDefaultValue"] = g_channelSetting[i].channel2xAmplDefaultValue;
|
||
channelObj["channel3XAmpl"] = g_channelSetting[i].channel3XAmpl;
|
||
channelObj["channel3XAmplDefaultValue"] = g_channelSetting[i].channel3XAmplDefaultValue;
|
||
channelObj["channelACHighpassband"] = g_channelSetting[i].channelACHighpassband;
|
||
channelObj["channelDefaultValueEU"] = g_channelSetting[i].channelDefaultValueEU;
|
||
channelObj["channelDirect"] = g_channelSetting[i].channelDirect;
|
||
channelObj["channelDirectDefaultValue"] = g_channelSetting[i].channelDirectDefaultValue;
|
||
channelObj["channelElement"] = g_channelSetting[i].channelElement;
|
||
channelObj["channelElementDefaultValue"] = g_channelSetting[i].channelElementDefaultValue;
|
||
channelObj["channelGapVoltage"] = g_channelSetting[i].channelGapVoltage;
|
||
channelObj["channelGapVoltageDefaultValue"] = g_channelSetting[i].channelGapVoltageDefaultValue;
|
||
channelObj["channelId"] = g_channelSetting[i].channelId;
|
||
channelObj["channelIntDiff"] = g_channelSetting[i].channelIntDiff;
|
||
channelObj["channelName"] = g_channelSetting[i].channelName;
|
||
channelObj["channelNot1xAmp"] = g_channelSetting[i].channelNot1xAmp;
|
||
channelObj["channelNot1xAmpDefaultValue"] = g_channelSetting[i].channelNot1xAmpDefaultValue;
|
||
channelObj["channelOP5XAMP"] = g_channelSetting[i].channelOP5XAMP;
|
||
channelObj["channelOP5XAMPDefaultValue"] = g_channelSetting[i].channelOP5XAMPDefaultValue;
|
||
channelObj["channelRMSPkPk2Pk"] = g_channelSetting[i].channelRMSPkPk2Pk;
|
||
channelObj["channelRecorderOutput"] = g_channelSetting[i].channelRecorderOutput;
|
||
channelObj["channelRecorderOutputDefaultVal"] = g_channelSetting[i].channelRecorderOutputDefaultVal;
|
||
channelObj["channelRotor"] = g_channelSetting[i].channelRotor;
|
||
channelObj["channelRotorDefaultValue"] = g_channelSetting[i].channelRotorDefaultValue;
|
||
channelObj["channelSensorType"] = g_channelSetting[i].channelSensorType;
|
||
channelObj["channelSmax"] = g_channelSetting[i].channelSmax;
|
||
channelObj["channelSmaxDefaultValue"] = g_channelSetting[i].channelSmaxDefaultValue;
|
||
channelObj["channelSpike"] = g_channelSetting[i].channelSpike;
|
||
channelObj["channelSpikeDefaultValue"] = g_channelSetting[i].channelSpikeDefaultValue;
|
||
channelObj["comments"] = g_channelSetting[i].comments;
|
||
channelObj["couplingACDC"] = g_channelSetting[i].couplingACDC;
|
||
channelObj["dataWatchNo"] = g_channelSetting[i].dataWatchNo;
|
||
channelObj["envelopeHighpassband"] = g_channelSetting[i].envelopeHighpassband;
|
||
channelObj["envelopeLowpassband"] = g_channelSetting[i].envelopeLowpassband;
|
||
channelObj["equipmentId"] = g_channelSetting[i].equipmentId;
|
||
channelObj["filter"] = g_channelSetting[i].filter;
|
||
channelObj["frequencyRangeMax"] = g_channelSetting[i].frequencyRangeMax.toDouble();
|
||
channelObj["frequencyRangeMin"] = g_channelSetting[i].frequencyRangeMin.toDouble();
|
||
channelObj["fullScalePosition"] = g_channelSetting[i].fullScalePosition;
|
||
channelObj["highPassFrequency"] = g_channelSetting[i].highPassFrequency.toDouble();
|
||
channelObj["installMethod"] = g_channelSetting[i].installMethod;
|
||
channelObj["isEnable"] = g_channelSetting[i].isEnable;
|
||
channelObj["isWork"] = g_channelSetting[i].isWork;
|
||
channelObj["lowPassFrequency"] = g_channelSetting[i].lowPassFrequency.toDouble();
|
||
channelObj["measuringRange"] = g_channelSetting[i].measuringRange.toDouble();
|
||
channelObj["offset"] = g_channelSetting[i].offset;
|
||
channelObj["pairChannelId"] = g_channelSetting[i].pairChannelId;
|
||
channelObj["pairChannelName"] = g_channelSetting[i].pairChannelName;
|
||
channelObj["rpmMultiplier"] = g_channelSetting[i].rpmMultiplier.toDouble();
|
||
channelObj["samplingRate"] = g_channelSetting[i].samplingRate;
|
||
channelObj["sensor1xAmplitudeRunout"] = g_channelSetting[i].sensor1xAmplitudeRunout.toDouble();
|
||
channelObj["sensor1xPhaseRunout"] = g_channelSetting[i].sensor1xPhaseRunout.toDouble();
|
||
channelObj["sensorConfigureDate"] = g_channelSetting[i].sensorConfigureDate.toInt();
|
||
channelObj["sensorEngineeringUnit"] = g_channelSetting[i].sensorEngineeringUnit;
|
||
channelObj["sensorGapVoltage"] = g_channelSetting[i].sensorGapVoltage.toDouble();
|
||
channelObj["sensorLeftOrRight"] = g_channelSetting[i].sensorLeftOrRight;
|
||
channelObj["sensorLocationInDegree"] = g_channelSetting[i].sensorLocationInDegree;
|
||
channelObj["sensorModuleNo"] = g_channelSetting[i].sensorModuleNo;
|
||
channelObj["sensorNo"] = g_channelSetting[i].sensorNo;
|
||
channelObj["sensorRange"] = g_channelSetting[i].sensorRange;
|
||
channelObj["sensorRangeCheck"] = g_channelSetting[i].sensorRangeCheck;
|
||
channelObj["sensorRangeMax"] = g_channelSetting[i].sensorRangeMax.toDouble();
|
||
channelObj["sensorRangeMin"] = g_channelSetting[i].sensorRangeMin.toDouble();
|
||
channelObj["sensorSensitivity"] = g_channelSetting[i].sensorSensitivity.toDouble();
|
||
channelObj["sensorType"] = g_channelSetting[i].sensorType;
|
||
channelObj["shaftRotationDirection"] = g_channelSetting[i].shaftRotationDirection;
|
||
channelObj["speedRefChannelId"] = g_channelSetting[i].speedRefChannelId;
|
||
channelObj["startBrands"] = g_channelSetting[i].startBrands;
|
||
channelObj["stopBrands"] = g_channelSetting[i].stopBrands;
|
||
channelObj["tachAutoTach"] = g_channelSetting[i].tachAutoTach;
|
||
channelObj["tachTriggerEdge"] = g_channelSetting[i].tachTriggerEdge;
|
||
channelObj["tachTriggerHysteresis"] = g_channelSetting[i].tachTriggerHysteresis;
|
||
channelObj["tachTriggerPerRev"] = g_channelSetting[i].tachTriggerPerRev.toInt();
|
||
channelObj["tachTriggerVoltageLevel"] = g_channelSetting[i].tachTriggerVoltageLevel;
|
||
channelObj["thermalCoupleType"] = g_channelSetting[i].thermalCoupleType;
|
||
channelObj["xFullScalePosition"] = g_channelSetting[i].xFullScalePosition.toDouble();
|
||
channelObj["xProcessVariableName"] = g_channelSetting[i].xProcessVariableName;
|
||
channelObj["xZeroScalePosition"] = g_channelSetting[i].xZeroScalePosition.toDouble();
|
||
channelObj["zeroScalePosition"] = g_channelSetting[i].zeroScalePosition.toDouble();
|
||
channelObj["boardType"] = g_channelSetting[i].boardType;
|
||
channelObj["defaultDisplay"] = g_channelSetting[i].defaultDisplay;
|
||
channelObj["sectionNum"] = g_channelSetting[i].sectionNum;
|
||
channelObj["confidenceDegree"] = g_channelSetting[i].confidenceDegree;
|
||
channelObj["EngineeringUnit"] = g_channelSetting[i].EngineeringUnit;
|
||
channelObj["firstPoleNum"] = g_channelSetting[i].firstPoleNum;
|
||
channelArray.append(channelObj);
|
||
}
|
||
QJsonDocument jsonDoc;
|
||
jsonDoc.setArray(channelArray);
|
||
|
||
#ifdef Q_OS_WIN32
|
||
QString name = QCoreApplication::applicationDirPath() + "\\config\\ChannelSettings.json";
|
||
#endif
|
||
#ifdef Q_OS_LINUX
|
||
QString name = QCoreApplication::applicationDirPath() + "/config/ChannelSettings.json";
|
||
#endif
|
||
QFile file(name);
|
||
file.open(QIODevice::WriteOnly);
|
||
file.write(jsonDoc.toJson());
|
||
file.close();
|
||
|
||
QVector<ChannelSetting>().swap(g_channelSetting);
|
||
QVector<channelBaseInfo>().swap(g_ChannelBaseInfo);
|
||
QMap<QString,QMap<QString,QString>>().swap(g_MapChannel);
|
||
|
||
|
||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||
for (int i = 0; i < g_channelSetting.size(); i++)
|
||
{
|
||
QMap<QString,QString> mapChannelType;
|
||
mapChannelType.insert(g_channelSetting[i].sensorType,g_channelSetting[i].channelName);
|
||
g_MapChannel.insert(g_channelSetting[i].channelId,mapChannelType);
|
||
channelBaseInfo tempchannelbaseinfo;
|
||
tempchannelbaseinfo.bordNo = g_channelSetting[i].sensorModuleNo;
|
||
tempchannelbaseinfo.channelID = g_channelSetting[i].channelId;
|
||
tempchannelbaseinfo.channelNoInBoard = g_channelSetting[i].sensorNo;
|
||
tempchannelbaseinfo.channelName = g_channelSetting[i].channelName;
|
||
tempchannelbaseinfo.channelType = g_channelSetting[i].sensorType;
|
||
tempchannelbaseinfo.sensorEngineeringUnit = g_channelSetting[i].sensorEngineeringUnit;
|
||
tempchannelbaseinfo.defaultDisplay = g_channelSetting[i].defaultDisplay;
|
||
tempchannelbaseinfo.speedRefChannelId = g_channelSetting[i].speedRefChannelId;
|
||
tempchannelbaseinfo.boardType = g_channelSetting[i].boardType;
|
||
tempchannelbaseinfo.isEnable = g_channelSetting[i].isEnable;
|
||
tempchannelbaseinfo.ChUnitDot = g_channelSetting[i].ChUnitDot;
|
||
g_ChannelBaseInfo.append(tempchannelbaseinfo);
|
||
}
|
||
initReadConfig();
|
||
#if QT_NO_DEBUG
|
||
QString str = QString("ftp://%1/CIDW/qtconfig/%2").arg(IP).arg("ChannelSettings.json");
|
||
g_FtpClient->SetServerInfo(str);
|
||
g_FtpClient->SetUserInfo("root","@#cidw!@123456");
|
||
g_FtpClient->UpLoadFile(name,"ChannelSettings.json");
|
||
#endif
|
||
}
|
||
|
||
void CChannelList::slotRowDoubleClicked(const QModelIndex &index)
|
||
{
|
||
|
||
if (index.isValid())
|
||
{
|
||
m_nCurRow = ui->tableView->currentIndex().row();//选中行
|
||
QAbstractItemModel *modessl = ui->tableView->model();
|
||
QModelIndex indextemp = modessl->index(m_nCurRow,1);//遍历第一行的所有列
|
||
QModelIndex indexCheck = modessl->index(m_nCurRow,0);
|
||
QVariant datatemp = modessl->data(indextemp);
|
||
qDebug() << datatemp << m_nCurRow << endl;
|
||
qDebug() << g_channelSetting[m_nCurRow].channelId << endl;
|
||
qDebug() << g_channelSetting[m_nCurRow].boardType << endl;
|
||
|
||
bool check = model->data(indexCheck, Qt::UserRole).toBool();
|
||
|
||
qDebug() << check << endl;
|
||
|
||
for (int i = 0; i < g_channelSetting.size(); i++)
|
||
{
|
||
|
||
if(g_channelSetting[m_nCurRow].boardType.toInt() == 1 && g_channelSetting[i].channelId == g_channelSetting[m_nCurRow].channelId){//开入开出板卡
|
||
|
||
SlowSpeeddialog = new CSlowSpeedChannelSetting();
|
||
connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
|
||
SlowSpeeddialog->channelSetting = g_channelSetting[i];
|
||
SlowSpeeddialog->setWindowModality(Qt::ApplicationModal);
|
||
SlowSpeeddialog->displayChannelSetting();
|
||
SlowSpeeddialog->show();
|
||
}
|
||
else if(g_channelSetting[m_nCurRow].boardType.toInt() > 1 && g_channelSetting[m_nCurRow].boardType.toInt() < 5 && g_channelSetting[i].channelId == g_channelSetting[m_nCurRow].channelId){//高速板卡
|
||
|
||
qDebug() << g_channelSetting[m_nCurRow].boardType << g_channelSetting[i].channelId << g_channelSetting[m_nCurRow].channelId<< endl;
|
||
ChannelSettingdialog = new CChannelSetting();
|
||
connect(ChannelSettingdialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
|
||
connect(ChannelSettingdialog, SIGNAL(ChannelSettingClose_sg()), this, SLOT(slotChannelSettingClose()));
|
||
ChannelSettingdialog->channelSetting = g_channelSetting[i];
|
||
ChannelSettingdialog->setWindowModality(Qt::ApplicationModal);
|
||
ChannelSettingdialog->displayChannelSetting();
|
||
ChannelSettingdialog->show();
|
||
}else if((g_channelSetting[m_nCurRow].boardType.toInt() == 5) && g_channelSetting[i].channelId == g_channelSetting[m_nCurRow].channelId){//低速板卡
|
||
SlowSpeeddialog = new CSlowSpeedChannelSetting();
|
||
connect(SlowSpeeddialog, SIGNAL(sgSetChannelData(ChannelSetting)), this, SLOT(slotSetChannelData(ChannelSetting)));
|
||
SlowSpeeddialog->channelSetting = g_channelSetting[i];
|
||
SlowSpeeddialog->setWindowModality(Qt::ApplicationModal);
|
||
SlowSpeeddialog->displayChannelSetting();
|
||
SlowSpeeddialog->show();
|
||
|
||
}else if(g_channelSetting[m_nCurRow].boardType.toInt() == 6 && g_channelSetting[i].channelId == g_channelSetting[m_nCurRow].channelId){//开入开出板卡
|
||
QString strTips = "输入开入开出板卡通道名称";
|
||
bool ok;
|
||
QString channleName = QInputDialog::getText(this, tr("输入名称对话框"), strTips, QLineEdit::Normal,"",&ok);
|
||
if(!ok) return;
|
||
qDebug() << channleName << endl;
|
||
QString strUpdateSql = QString(" set channelName = '%1' where sensorModuleNo = %2 and sensorNo = %3 ")\
|
||
.arg(channleName).arg(g_channelSetting[m_nCurRow].sensorModuleNo).arg(g_channelSetting[m_nCurRow].sensorNo);
|
||
QString tableName = "t_ChannelSetting ";
|
||
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
|
||
|
||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||
putJson();
|
||
}
|
||
}
|
||
|
||
}
|
||
|
||
}
|
||
|
||
|
||
void CChannelList::setColumnCheckable(int column, bool checkable)
|
||
{
|
||
m_pHeaderView->setColumnCheckable(column, checkable);
|
||
for(int row = 0; row != m_pModel->rowCount(); ++row)
|
||
{
|
||
m_pModel->item(row, column)->setCheckable(checkable);
|
||
}
|
||
}
|
||
|
||
void CChannelList::on_columnSectionClicked(int column, bool checked)
|
||
{
|
||
//遍历行
|
||
for(int row = 0; row != m_pModel->rowCount(); ++row)
|
||
{
|
||
//获取指定列当前行的item,根据checked设置选中状态
|
||
if(checked)
|
||
{
|
||
m_pModel->item(row, column)->setCheckState(Qt::Checked);
|
||
}
|
||
else
|
||
{
|
||
m_pModel->item(row, column)->setCheckState(Qt::Unchecked);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
void CChannelList::on_pushButton_open_clicked()
|
||
{
|
||
if(ui->comboBox_operate->currentText() == "通道"){
|
||
for (int i = 0; i < model->rowCount(); i++) {
|
||
QModelIndex indexCheck = model->index(i,0);
|
||
bool check = model->data(indexCheck, Qt::UserRole).toBool();
|
||
if(check){
|
||
// QLabel *pLabel = new QLabel(this);
|
||
// pLabel->setText("启用");
|
||
// QPalette palette;
|
||
// palette.setColor(QPalette::Background, QColor(Qt::green));
|
||
// //palette.setColor(QPalette::WindowText,Qt::white);
|
||
// //pLabel->setAutoFillBackground(true);
|
||
// pLabel->setPalette(palette);
|
||
// ui->tableView->setIndexWidget(model->index(i,4),pLabel);
|
||
//model->setData(model->index(i,4),QBrush(Qt::red), Qt::BackgroundRole);
|
||
model->setItem(i,4,new QStandardItem("启用"));
|
||
QString strChannelID = model->data(model->index(i,38)).toString();
|
||
QString strUpdateSql = QString(" set isEnable = %1 , isWork = %2 where channelId = '%3' ").arg(1).arg(1).arg(g_channelSetting[i].channelId);
|
||
QString tableName = "t_ChannelSetting ";
|
||
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
|
||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||
}
|
||
}
|
||
putJson();
|
||
}else if(ui->comboBox_operate->currentText() == "带通滤波")
|
||
{
|
||
QJsonArray channleList;
|
||
for (int i = 0; i < model->rowCount(); i++) {
|
||
QModelIndex indexCheck = model->index(i,0);
|
||
bool check = model->data(indexCheck, Qt::UserRole).toBool();
|
||
if(check){
|
||
model->setItem(i,3,new QStandardItem("启用"));
|
||
QString strChannelID = model->data(model->index(i,38)).toString();
|
||
QString strUpdateSql = QString(" set filterStatus = %1 where channelId = '%2' ").arg(1).arg(g_channelSetting[i].channelId);
|
||
QString tableName = "t_ChannelSetting ";
|
||
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
|
||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||
channleList.append(g_channelSetting[i].channelId);
|
||
}
|
||
|
||
}
|
||
operateChannelFilter(true,channleList);
|
||
}
|
||
}
|
||
|
||
|
||
void CChannelList::on_pushButton_close_clicked()
|
||
{
|
||
|
||
if(ui->comboBox_operate->currentText() == "通道"){
|
||
for (int i = 0; i < model->rowCount(); i++) {
|
||
QModelIndex indexCheck = model->index(i,0);
|
||
bool check = model->data(indexCheck, Qt::UserRole).toBool();
|
||
if(check){
|
||
model->setItem(i,4,new QStandardItem("关闭"));
|
||
QString strChannelID = model->data(model->index(i,39)).toString();
|
||
QString strUpdateSql = QString(" set isEnable = %1, isWork = %2 where channelId = '%3' ").arg(0).arg(0).arg(g_channelSetting[i].channelId);
|
||
QString tableName = "t_ChannelSetting ";
|
||
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
|
||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||
}
|
||
}
|
||
putJson();
|
||
}else if(ui->comboBox_operate->currentText() == "带通滤波"){
|
||
QJsonArray channleList;
|
||
for (int i = 0; i < model->rowCount(); i++) {
|
||
QModelIndex indexCheck = model->index(i,0);
|
||
bool check = model->data(indexCheck, Qt::UserRole).toBool();
|
||
if(check){
|
||
model->setItem(i,3,new QStandardItem("关闭"));
|
||
QString strChannelID = model->data(model->index(i,38)).toString();
|
||
QString strUpdateSql = QString(" set filterStatus = %1 where channelId = '%2' ").arg(0).arg(g_channelSetting[i].channelId);
|
||
QString tableName = "t_ChannelSetting ";
|
||
g_SqliteDB->UpdateDataSql(tableName,strUpdateSql);
|
||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||
channleList.append(g_channelSetting[i].channelId);
|
||
}
|
||
|
||
}
|
||
operateChannelFilter(false,channleList);
|
||
}
|
||
}
|
||
|
||
|
||
void CChannelList::on_pushButton_refresh_clicked()
|
||
{
|
||
model->removeRows(0, model->rowCount());
|
||
g_channelSetting = g_SqliteDB->GetDataMultiLine("t_ChannelSetting");
|
||
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||
#ifndef NO_FILTER
|
||
QJsonObject sendData;
|
||
sendData["cmd"] = "97";
|
||
QJsonArray chan_list;
|
||
for (int i = 0; i < g_channelSetting.size(); i++) {
|
||
chan_list.append(g_channelSetting[i].channelId);
|
||
}
|
||
sendData["chan_list"] = chan_list;
|
||
QNetworkRequest req;
|
||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||
req.setUrl(sUrl);
|
||
g_NetMgr->PostJson(req,sendData);
|
||
#else
|
||
initReadConfig();
|
||
#endif
|
||
#ifdef QT_DEBUG
|
||
initReadConfig();
|
||
#endif
|
||
}
|
||
|
||
void CChannelList::slotNetMgr(QString sAddr, const QVariant &msg)
|
||
{
|
||
QJsonObject objec = msg.value<QJsonObject>();
|
||
if(objec.contains("cmd"))
|
||
{
|
||
QJsonValue arrays_value = objec.take("cmd");
|
||
//qDebug()<<"cmd ="<<arrays_value.toString();
|
||
if(arrays_value.toString() == "08" || arrays_value.toString() == "96"){
|
||
bool Status = objec.take("success").toBool();
|
||
QString strMessage = objec.take("message").toString();
|
||
if(Status){
|
||
QMessageBox::information(NULL, QStringLiteral("提示"), "保存成功!");
|
||
}else{
|
||
QMessageBox::information(NULL, QStringLiteral("提示"), strMessage);
|
||
}
|
||
}else if(arrays_value.toString() == "97"){
|
||
QJsonArray chan_list = objec["chan_list"].toArray();
|
||
QJsonArray status = objec["status"].toArray();
|
||
for (int i = 0; i < g_channelSetting.size(); i++) {
|
||
for (int j = 0; j < chan_list.size(); j++) {
|
||
if(g_channelSetting[i].channelId == chan_list[j].toString()){
|
||
g_channelSetting[i].filterStatus = status[j].toInt();
|
||
}
|
||
}
|
||
}
|
||
#ifndef NO_FILTER
|
||
initReadConfig();
|
||
#endif
|
||
}
|
||
}
|
||
disconnect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||
}
|
||
void CChannelList::on_pushButton_restart_clicked()
|
||
{
|
||
QMessageBox::StandardButton reply;
|
||
reply = QMessageBox::question(NULL, "提示", "确认后将重启服务",
|
||
QMessageBox::Yes | QMessageBox::No, QMessageBox::No);
|
||
if (reply == QMessageBox::Yes)
|
||
{
|
||
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||
QJsonObject allObj,cmdBody;
|
||
allObj.insert("cmd", "08");
|
||
allObj["cmdBody"] = cmdBody;
|
||
QNetworkRequest req;
|
||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||
req.setUrl(sUrl);
|
||
g_NetMgr->PostJson(req,allObj);
|
||
}
|
||
|
||
}
|
||
|
||
void CChannelList::operateChannelFilter(bool type,QJsonArray& channleList)
|
||
{
|
||
connect(g_NetMgr,SIGNAL(sigNetMgr(QString, const QVariant&)), this, SLOT(slotNetMgr(QString,const QVariant&)));
|
||
QJsonObject sendData;
|
||
sendData["cmd"] = "96";
|
||
sendData["open"] = type;
|
||
sendData["chan_list"] = channleList;
|
||
QNetworkRequest req;
|
||
QString sUrl = QString("http://%1/cgi-bin/General.cgi/").arg(IP);
|
||
req.setUrl(sUrl);
|
||
g_NetMgr->PostJson(req,sendData);
|
||
}
|