#include "controlverifyclockwidget.h" #include "ui_controlverifyclockwidget.h" #include "LoUIClass/x_uimsgboxok.h" #include ControlVerifyClockWidget::ControlVerifyClockWidget(QWidget *parent,QList *list) : QWidget(parent), ui(new Ui::ControlVerifyClockWidget) { m_pLedlist=list; ui->setupUi(this); refreshLable(); ui->pushButtonSetNtp->setProperty("ssType", "progManageTool"); ui->pushButtonSetNtp->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->pushButtonSetSync->setProperty("ssType", "progManageTool"); ui->pushButtonSetSync->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->pushButtonSetToCptTime->setProperty("ssType", "progManageTool"); ui->pushButtonSetToCptTime->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->pushButtonReadBackSync->setProperty("ssType", "progManageTool"); ui->pushButtonReadBackSync->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->pushButton_ReadbackNtp->setProperty("ssType", "progManageTool"); ui->pushButton_ReadbackNtp->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->pushButtonSetLoraMaster->setProperty("ssType", "progManageTool"); ui->pushButtonSetLoraMaster->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->pushButtonReadbackLoraMaster->setProperty("ssType", "progManageTool"); ui->pushButtonReadbackLoraMaster->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->pushButtonCurTimeOfController->setProperty("ssType", "progManageTool"); ui->pushButtonCurTimeOfController->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->pushButtonSetTimeZone->setProperty("ssType", "progManageTool"); ui->pushButtonSetTimeZone->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}"); ui->buttonGroup_2->setId(ui->radioButton_4, 0); ui->buttonGroup_2->setId(ui->radioButton_5, 1); ui->radioButton_2->setChecked(true); ui->labelIdCode->setVisible(true); ui->lineEditIdCode->setVisible(true); ui->labelTimeOffset->setVisible(true); ui->lineEditTimeOffset->setVisible(true); ui->lineEdit_3->setVisible(false); ui->labelSyncTimeInterval->setVisible(false); ui->labelTimeZone->setVisible(false); ui->lineEdit_TimeZone->setVisible(false); ui->labelmintime->setVisible(false); //按钮事件绑定 connect(ui->pushButtonSetNtp,SIGNAL(clicked()),this,SLOT(OnSetNtp())); connect(ui->pushButtonSetToCptTime,SIGNAL(clicked()),this,SLOT(OnSetSyncToCpt())); connect(ui->pushButton_ReadbackNtp,SIGNAL(clicked()),this,SLOT(OnReadbackNtp())); connect(ui->pushButtonReadBackSync,SIGNAL(clicked()),this,SLOT(OnReadbackSyncInfo())); connect(ui->pushButtonSetSync,SIGNAL(clicked()),this,SLOT(OnSetSync())); connect(ui->radioButton,SIGNAL(clicked()),this,SLOT(OnRadioButton())); connect(ui->radioButton_2,SIGNAL(clicked()),this,SLOT(OnRadioButton2())); connect(ui->radioButton_3,SIGNAL(clicked()),this,SLOT(OnRadioButton3())); connect(ui->radioButton_6,SIGNAL(clicked()),this,SLOT(OnRadioButton6())); connect(ui->pushButtonSetLoraMaster,SIGNAL(clicked()),this,SLOT(OnSetLoraMaster())); connect(ui->pushButtonReadbackLoraMaster,SIGNAL(clicked()),this,SLOT(OnReadbackLoraMaster())); connect(ui->pushButtonCurTimeOfController,SIGNAL(clicked()),this,SLOT(OnReadbackCurTimeOfController())); connect(ui->pushButtonSetTimeZone, SIGNAL(clicked()), this, SLOT(OnSetTimeZone())); initTimezone(); MARCO_DEFINE_CONTROL_FUNC2(parent->parent(),parent) } void ControlVerifyClockWidget::refreshLable() { ui->labelTimeZone->setText(tr("Time zone")); ui->labelNtpServerAddress->setText(tr("NTP Server address")); ui->labelTimeOffset->setText(tr("Time offset(msec)")); ui->labelVerifyClockConfiguration->setText(tr("Verify clock configuration")); ui->pushButtonSetNtp->setText(tr("Set")); ui->pushButtonSetSync->setText(tr("Set")); ui->groupBox_2->setTitle(tr("NTP Server")); ui->groupBox->setTitle(tr("Enable Synchronous playing")); ui->radioButton_4->setText(tr("Master")); ui->radioButton_5->setText(tr("Slave")); ui->pushButtonSetLoraMaster->setText(tr("Set")); ui->pushButtonReadbackLoraMaster->setText(tr("Readback")); ui->pushButton_ReadbackNtp->setText(tr("Readback")); ui->pushButtonReadBackSync->setText(tr("Readback")); ui->groupBox_3->setTitle(tr("Sync clock to computer time")); ui->pushButtonSetToCptTime->setText(tr("Set")); ui->labelSyncTimeInterval->setText(tr("Sync time interval")); ui->labelIdCode->setText(tr("Identification Code")); ui->checkBoxBrightness->setText(tr("Brightness")); ui->checkBoxVolume->setText(tr("Volume")); ui->checkBoxScreenSwitch->setText(tr("Screen on/off")); ui->groupBox_5->setTitle(tr("Cur time of controller")); ui->pushButtonCurTimeOfController->setText(tr("Readback")); ui->lineEditNtpServer->setPlaceholderText(tr("NTP Server address")); ui->lineEdit_3->setPlaceholderText(tr("Sync time interval")); ui->lineEditIdCode->setPlaceholderText(tr("identification code")); ui->label->setText(tr("TimeZone")); ui->pushButtonSetTimeZone->setText(tr("Set")); } ControlVerifyClockWidget::~ControlVerifyClockWidget() { delete ui; if(pHpptClient != nullptr) { qDebug() <<"delete pHpptClient in ~NetComm"; delete pHpptClient; pHpptClient=nullptr; } if(pHpptClientAll != nullptr) { qDebug() <<"delete pHpptClientAll in ~NetComm"; delete pHpptClientAll; pHpptClientAll=nullptr; } } void ControlVerifyClockWidget::OnRadioButton()//gps { ui->labelIdCode->setVisible(false); ui->lineEditIdCode->setVisible(false); ui->labelTimeOffset->setVisible(false); ui->lineEditTimeOffset->setVisible(false); ui->labelSyncTimeInterval->setVisible(false); ui->lineEdit_3->setVisible(false); ui->labelmintime->setVisible(false); ui->groupBox_4->setVisible(false); ui->radioButton_4->setVisible(false); ui->radioButton_5->setVisible(false); ui->pushButtonSetLoraMaster->setVisible(false); ui->pushButtonReadbackLoraMaster->setVisible(false); ui->checkBoxScreenSwitch->setVisible(false); ui->checkBoxVolume->setVisible(false); ui->checkBoxBrightness->setVisible(false); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); } void ControlVerifyClockWidget::OnRadioButton2()//lora { ui->labelIdCode->setVisible(true); ui->lineEditIdCode->setVisible(true); ui->labelTimeOffset->setVisible(true); ui->lineEditTimeOffset->setVisible(true); ui->lineEdit_3->setVisible(false); ui->labelSyncTimeInterval->setVisible(false); ui->labelmintime->setVisible(false); ui->groupBox_4->setVisible(true); ui->radioButton_4->setVisible(true); ui->radioButton_5->setVisible(true); ui->pushButtonSetLoraMaster->setVisible(true); ui->pushButtonReadbackLoraMaster->setVisible(true); ui->checkBoxScreenSwitch->setVisible(true); ui->checkBoxVolume->setVisible(true); ui->checkBoxBrightness->setVisible(true); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); } void ControlVerifyClockWidget::OnRadioButton3()//ntp { ui->labelIdCode->setVisible(false); ui->lineEditIdCode->setVisible(false); ui->labelTimeOffset->setVisible(false); ui->lineEditTimeOffset->setVisible(false); ui->lineEdit_3->setVisible(true); ui->labelSyncTimeInterval->setVisible(true); ui->labelmintime->setVisible(true); ui->groupBox_4->setVisible(false); ui->radioButton_4->setVisible(false); ui->radioButton_5->setVisible(false); ui->pushButtonSetLoraMaster->setVisible(false); ui->pushButtonReadbackLoraMaster->setVisible(false); ui->checkBoxScreenSwitch->setVisible(false); ui->checkBoxVolume->setVisible(false); ui->checkBoxBrightness->setVisible(false); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); } void ControlVerifyClockWidget::OnRadioButton6()//ntp { // ui->labelIdCode->setVisible(false); // ui->lineEditIdCode->setVisible(false); // ui->labelTimeOffset->setVisible(false); // ui->lineEditTimeOffset->setVisible(false); // ui->lineEdit_3->setVisible(false); // ui->labelSyncTimeInterval->setVisible(false); // ui->labelmintime->setVisible(false); // ui->pushButtonSetLoraMaster->setVisible(false); // ui->pushButtonReadbackLoraMaster->setVisible(false); // ui->checkBoxScreenSwitch->setVisible(false); // ui->checkBoxVolume->setVisible(false); // ui->checkBoxBrightness->setVisible(false); // ui->checkBoxBrightness->setVisible(false); // ui->pushButtonSetSync->setVisible(false); // ui->pushButtonReadBackSync->setVisible(false); // ui->groupBox_4->setVisible(true); // ui->radioButton_4->setVisible(true); // ui->radioButton_5->setVisible(true); // ui->pushButtonSetLoraMaster->setVisible(true); // ui->pushButtonReadbackLoraMaster->setVisible(true); ui->labelIdCode->setVisible(true); ui->lineEditIdCode->setVisible(true); ui->labelTimeOffset->setVisible(true); ui->lineEditTimeOffset->setVisible(true); ui->lineEdit_3->setVisible(false); ui->labelSyncTimeInterval->setVisible(false); ui->labelmintime->setVisible(false); ui->groupBox_4->setVisible(true); ui->radioButton_4->setVisible(true); ui->radioButton_5->setVisible(true); ui->pushButtonSetLoraMaster->setVisible(true); ui->pushButtonReadbackLoraMaster->setVisible(true); ui->checkBoxScreenSwitch->setVisible(true); ui->checkBoxVolume->setVisible(true); ui->checkBoxBrightness->setVisible(true); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); } void ControlVerifyClockWidget::OnSetNtp() { QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "SetNtpServer"); json.insert("ntpServer", ui->lineEditNtpServer->text()); MACRO_DEFINE_TIPDLG_FUCN(tr("SetNtpServer"),tr("Success"),tr("failed")) } void ControlVerifyClockWidget::OnSetLoraMaster() { // if(ui->radioButton_6->isChecked())//局域网同步设置主从 // { // QJsonObject json; // json.insert("_id", getRandomString(10)); // json.insert("_type", "SetingSyncMethod"); // json.insert("ntpServer", ui->labelNtpServerAddress->text()); // json.insert("time", "Lan"); // if(ui->checkBoxBrightness->isChecked()) // json.insert("brightness", "serial"); // else // json.insert("brightness", "none"); // // // if(ui->checkBoxVolume->isChecked()) // json.insert("volume", "serial"); // else // json.insert("volume", "none"); // if(ui->checkBoxScreenSwitch->isChecked()) // json.insert("screenSwitch", "serial"); // else // json.insert("screenSwitch", "none"); // MACRO_DEFINE_TIPDLG_FUCN(tr("SetingSyncMethod"),tr("Success"),tr("failed")) // } // else if(ui->radioButton_2->isChecked())//Lora同步设置主从 // { // } QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "MasterSlaveSwitch"); if(ui->buttonGroup_2->checkedId()==0) { json.insert("master", true); qDebug()<<"master"; MACRO_DEFINE_TIPDLG_FUCN(tr("MasterSwitch "),tr("Success"),tr("failed")) } else { json.insert("master", false); qDebug()<<"slave"; MACRO_DEFINE_TIPDLG_FUCN(tr("SlaveSwitch "),tr("Success"),tr("failed")) } } void ControlVerifyClockWidget::OnReadbackLoraMaster() { // if(ui->radioButton_6->isChecked())//局域网同步设置主从 // { // QJsonObject json; // json.insert("_id", getRandomString(10)); // json.insert("_type", "IsOpenNetSyncTime"); // MACRO_DEFINE_TIPDLG_FUCN(tr("IsMasterSlave"),tr("Success"),tr("failed")) // } // else if(ui->radioButton_2->isChecked())//Lora同步设置主从 // { QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "IsMasterSlave"); MACRO_DEFINE_TIPDLG_FUCN(tr("IsMasterSlave"),tr("Success"),tr("failed")) // } } void ControlVerifyClockWidget::OnReadbackCurTimeOfController() { QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "GetControllerDate"); MACRO_DEFINE_TIPDLG_FUCN(tr("GetControllerDate"),tr("Success"),tr("failed")) } void ControlVerifyClockWidget::OnSetSync() { QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "SetingSyncMethod"); json.insert("ntpServer", ui->labelNtpServerAddress->text()); if(ui->radioButton_2->isChecked()) { json.insert("time", "serial"); json.insert("delaySync", ui->lineEditTimeOffset->text().toInt()); json.insert("identificationCode",ui->lineEditIdCode->text()); } else if(ui->radioButton_3->isChecked()) { json.insert("time", "ntp"); json.insert("checkNtpTime", ui->lineEdit_3->text().toInt()); json.insert("delaySync", ui->lineEditTimeOffset->text().toInt()); json.insert("identificationCode",ui->lineEditIdCode->text()); } else if(ui->radioButton->isChecked()) { json.insert("time", "gps"); json.insert("delaySync", ui->lineEditTimeOffset->text().toInt()); json.insert("identificationCode",ui->lineEditIdCode->text()); } else if(ui->radioButton_6->isChecked()) { json.insert("time", "Lan"); json.insert("delaySync", ui->lineEditTimeOffset->text().toInt()); json.insert("identificationCode",ui->lineEditIdCode->text()); } if(ui->checkBoxBrightness->isChecked()) json.insert("brightness", "serial"); else json.insert("brightness", "none"); // if(ui->checkBoxVolume->isChecked()) json.insert("volume", "serial"); else json.insert("volume", "none"); if(ui->checkBoxScreenSwitch->isChecked()) json.insert("screenSwitch", "serial"); else json.insert("screenSwitch", "none"); MACRO_DEFINE_TIPDLG_FUCN(tr("SetingSyncMethod"),tr("Success"),tr("failed")) } void ControlVerifyClockWidget::OnSetSyncToCpt() { QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "SyncTime"); QDateTime *datatime=new QDateTime(QDateTime::currentDateTime()); // qint64 iSecs22=datatime->toSecsSinceEpoch(); qint64 iSecs11=datatime->toMSecsSinceEpoch(); // qDebug()< *list) { m_pLedlist=list; MACRO_DEFINE_CONTROL_FUNC3 } void ControlVerifyClockWidget::OnControlTypeSwitchIndexChanged(int index) { if(index==ENUM_CONTRL_WIDGET_VERIFYCLOCK) { m_bSelected=true; if(m_pLedCard!=nullptr) onReadbackAllThisPage(); } else { m_bSelected=false; } } void ControlVerifyClockWidget::onReadbackAllThisPage() { if(m_pLedlist==nullptr) return; if(m_pLedlist->count()!=1) return; QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "GetingSyncMethod"); HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json); QJsonObject json5; json5.insert("_id", getRandomString(10)); json5.insert("_type", "GetTimezone"); HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json5); MACRO_DEFINE_TIPDLG_ALL_FUCN(tr("Readback"),tr("Success"),tr("failed")) } QString ControlVerifyClockWidget::formatTime(int ms) { int ss = 1000; int mi = ss * 60; int hh = mi * 60; int dd = hh * 24; long day = ms / dd; long hour = (ms - day * dd) / hh; long minute = (ms - day * dd - hour * hh) / mi; long second = (ms - day * dd - hour * hh - minute * mi) / ss; long milliSecond = ms - day * dd - hour * hh - minute * mi - second * ss; QString hou = QString::number(hour,10); QString min = QString::number(minute,10); QString sec = QString::number(second,10); QString msec = QString::number(milliSecond,10); //qDebug() << "minute:" << min << "second" << sec << "ms" << msec <m_strCardId +"---------"+ strType; if(strType == "SetNtpServer")//alahover 新增协议类型 { } else if(strType == "GetNtpServer") { ui->lineEditNtpServer->setText(jsonObject["ntpServer"].toString()); } else if(strType == "GetNtpAndTimezone") { ui->lineEditNtpServer->setText(jsonObject["ntpServer"].toString()); // { // "_type": "DataCallback", // "cardId": "y60-620-40352", // "commandId": "5f5ed8b24a433cb1555c1d3d", // "language": "zh", // "locationFeedback": 0, // "locked": false, // "now": "2020年9月14日 上午10:42:58", // "ntpServer": "ntp1.aliyun.com", // "timezone": "Asia/Shanghai", // "_cardId": "y60-620-40352" // } } else if(strType == "SyncTime") { qDebug()<radioButton_4->setChecked(true); ui->radioButton_5->setChecked(false); } else { ui->radioButton_4->setChecked(false); ui->radioButton_5->setChecked(true); } } else if(strType == "SetingSyncMethod") { } else if(strType == "GetTimezone"){ QString strtemp=jsonObject["timezone"].toString(); ui->comboBox_Timezone->setCurrentText(strtemp); } else if(strType == "SetTimezone"){ } else if(strType == "GetControllerDate") { QString strDate=jsonObject["date"].toString(); //int millis=jsonObject["millis"].toInt(); //strDate+=":"+QString::number(millis); ui->labelCurTime->setText(strDate); } else if(strType == "GetingSyncMethod") { //jsonObject["brightness"].toString(); QString strType=jsonObject["time"].toString(); strType=strType.toLower(); if(strType=="serial"||strType=="lan") { if(strType=="serial") ui->radioButton_2->setChecked(true); else if(strType=="lan") ui->radioButton_6->setChecked(true); ui->lineEditIdCode->setText(jsonObject["identificationCode"].toString()); QString strtempdelaySync=QString::number(jsonObject["delaySync"].toInt()); ui->lineEditTimeOffset->setText(strtempdelaySync); ui->labelIdCode->setVisible(true); ui->lineEditIdCode->setVisible(true); ui->labelTimeOffset->setVisible(true); ui->lineEditTimeOffset->setVisible(true); ui->lineEdit_3->setVisible(false); ui->labelSyncTimeInterval->setVisible(false); ui->labelmintime->setVisible(false); if(jsonObject["screenSwitch"].toString()=="NONE") { ui->checkBoxScreenSwitch->setChecked(false); } else { ui->checkBoxScreenSwitch->setChecked(true); } if(jsonObject["volume"].toString()=="NONE") { ui->checkBoxVolume->setChecked(false); } else { ui->checkBoxVolume->setChecked(true); } if(jsonObject["brightness"].toString()=="NONE") { ui->checkBoxBrightness->setChecked(false); } else { ui->checkBoxBrightness->setChecked(true); } ui->checkBoxScreenSwitch->setVisible(true); ui->checkBoxVolume->setVisible(true); ui->checkBoxBrightness->setVisible(true); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); } else if(strType=="ntp"){ ui->radioButton_3->setChecked(true); QString strtempdelaySync=QString::number(jsonObject["checkNtpTime"].toInt()); ui->lineEdit_3->setText(strtempdelaySync); ui->labelIdCode->setVisible(false); ui->lineEditIdCode->setVisible(false); ui->labelTimeOffset->setVisible(false); ui->lineEditTimeOffset->setVisible(false); ui->lineEdit_3->setVisible(true); ui->labelSyncTimeInterval->setVisible(true); ui->labelmintime->setVisible(true); ui->groupBox_4->setVisible(false); ui->radioButton_4->setVisible(false); ui->radioButton_5->setVisible(false); ui->pushButtonSetLoraMaster->setVisible(false); ui->pushButtonReadbackLoraMaster->setVisible(false); ui->checkBoxScreenSwitch->setVisible(false); ui->checkBoxVolume->setVisible(false); ui->checkBoxBrightness->setVisible(false); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); } else if(strType=="gps"){ ui->radioButton->setChecked(true); ui->labelIdCode->setVisible(false); ui->lineEditIdCode->setVisible(false); ui->labelTimeOffset->setVisible(false); ui->lineEditTimeOffset->setVisible(false); ui->labelSyncTimeInterval->setVisible(false); ui->lineEdit_3->setVisible(false); ui->labelmintime->setVisible(false); ui->groupBox_4->setVisible(false); ui->radioButton_4->setVisible(false); ui->radioButton_5->setVisible(false); ui->pushButtonSetLoraMaster->setVisible(false); ui->pushButtonReadbackLoraMaster->setVisible(false); ui->checkBoxScreenSwitch->setVisible(false); ui->checkBoxVolume->setVisible(false); ui->checkBoxBrightness->setVisible(false); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); } //jsonObject["screenSwitch"].toString(); //jsonObject["lastSynchronousTime"].toInt(); //jsonObject["volume"].toString(); jsonObject["checkNtpTime"].toInt(); } MACRO_ASKTIME_STOP MACRO_POSTING_DLG_UNLOCK } } } //获取到httpPost的应答,如果参数变化需要出发修改控件item的内容 void ControlVerifyClockWidget::OnProHttpResponseAll(QString url, QString postMD5, QByteArray data) { Q_UNUSED(postMD5) //qDebug()<< url + "\r\n"+m_strUrl; if(url == m_strUrl) { QJsonParseError parseJsonErr; QJsonDocument document = QJsonDocument::fromJson(data,&parseJsonErr); if(!(parseJsonErr.error == QJsonParseError::NoError)) { if(data.size()==0) qDebug()<<"json is empty"; else qDebug()<m_strCardId +"---------"+ strType; if(strType == "MasterSlaveSwitch") { } else if(strType == "IsMasterSlave") { if(jsonObject["result"].toBool()) { } else { } } else if(strType == "GetTimezone"){ QString strtemp=jsonObject["timezone"].toString(); ui->comboBox_Timezone->setCurrentText(strtemp); MACRO_ASKTIME_STOP MACRO_POSTING_DLG_UNLOCK } else if(strType == "SetTimezone"){ } else if(strType == "GetingSyncMethod") { //jsonObject["brightness"].toString(); QString strType=jsonObject["time"].toString(); strType=strType.toLower(); if(strType=="serial"||strType=="lan") { if(strType=="serial") ui->radioButton_2->setChecked(true); else if(strType=="lan") ui->radioButton_6->setChecked(true); ui->lineEditIdCode->setText(jsonObject["identificationCode"].toString()); QString strtempdelaySync=QString::number(jsonObject["delaySync"].toInt()); ui->lineEditTimeOffset->setText(strtempdelaySync); ui->labelIdCode->setVisible(true); ui->lineEditIdCode->setVisible(true); ui->labelTimeOffset->setVisible(true); ui->lineEditTimeOffset->setVisible(true); ui->lineEdit_3->setVisible(false); ui->labelSyncTimeInterval->setVisible(false); ui->labelmintime->setVisible(false); if(jsonObject["screenSwitch"].toString()=="NONE") { ui->checkBoxScreenSwitch->setChecked(false); } else { ui->checkBoxScreenSwitch->setChecked(true); } if(jsonObject["volume"].toString()=="NONE") { ui->checkBoxVolume->setChecked(false); } else { ui->checkBoxVolume->setChecked(true); } if(jsonObject["brightness"].toString()=="NONE") { ui->checkBoxBrightness->setChecked(false); } else { ui->checkBoxBrightness->setChecked(true); } ui->checkBoxScreenSwitch->setVisible(true); ui->checkBoxVolume->setVisible(true); ui->checkBoxBrightness->setVisible(true); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); } else if(strType=="ntp"){ ui->radioButton_3->setChecked(true); QString strtempdelaySync=QString::number(jsonObject["checkNtpTime"].toInt()); ui->lineEdit_3->setText(strtempdelaySync); ui->labelIdCode->setVisible(false); ui->lineEditIdCode->setVisible(false); ui->labelTimeOffset->setVisible(false); ui->lineEditTimeOffset->setVisible(false); ui->lineEdit_3->setVisible(true); ui->labelSyncTimeInterval->setVisible(true); ui->labelmintime->setVisible(true); ui->groupBox_4->setVisible(false); ui->radioButton_4->setVisible(false); ui->radioButton_5->setVisible(false); ui->pushButtonSetLoraMaster->setVisible(false); ui->pushButtonReadbackLoraMaster->setVisible(false); ui->checkBoxScreenSwitch->setVisible(false); ui->checkBoxVolume->setVisible(false); ui->checkBoxBrightness->setVisible(false); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); } else if(strType=="gps"){ ui->radioButton->setChecked(true); ui->labelIdCode->setVisible(false); ui->lineEditIdCode->setVisible(false); ui->labelTimeOffset->setVisible(false); ui->lineEditTimeOffset->setVisible(false); ui->labelSyncTimeInterval->setVisible(false); ui->lineEdit_3->setVisible(false); ui->labelmintime->setVisible(false); ui->groupBox_4->setVisible(false); ui->radioButton_4->setVisible(false); ui->radioButton_5->setVisible(false); ui->pushButtonSetLoraMaster->setVisible(false); ui->pushButtonReadbackLoraMaster->setVisible(false); ui->checkBoxScreenSwitch->setVisible(false); ui->checkBoxVolume->setVisible(false); ui->checkBoxBrightness->setVisible(false); ui->pushButtonSetSync->setVisible(true); ui->pushButtonReadBackSync->setVisible(true); } //jsonObject["screenSwitch"].toString(); //jsonObject["lastSynchronousTime"].toInt(); //jsonObject["volume"].toString(); jsonObject["checkNtpTime"].toInt(); } } } } void ControlVerifyClockWidget::DeletePostingDlg() { if(m_PostingDlg!=nullptr) { delete m_PostingDlg; m_PostingDlg=nullptr; } } void ControlVerifyClockWidget::initTimezone() { QStringList listTimezone; listTimezone.append("Pacific/Majuro"); listTimezone.append("Pacific/Midway"); listTimezone.append("Pacific/Honolulu"); listTimezone.append("America/Anchorage");//>安克雷奇 listTimezone.append("America/Los_Angeles");//>美国太平洋时间 (洛杉矶) listTimezone.append("America/Tijuana");//>美国太平洋时间 (提华纳) listTimezone.append("America/Phoenix");//>美国山区时间 (凤凰城) listTimezone.append("America/Chihuahua");//>奇瓦瓦 listTimezone.append("America/Denver");//>美国山区时间 (丹佛) listTimezone.append("America/Costa_Rica");//>美国中部时间 (哥斯达黎加) listTimezone.append("America/Chicago");//>美国中部时间 (芝加哥) listTimezone.append("America/Mexico_City");//>美国中部时间 (墨西哥城) listTimezone.append("America/Regina");//>美国中部时间 (里贾纳) listTimezone.append("America/Bogota");//>哥伦比亚时间 (波哥大) listTimezone.append("America/New_York");//>美国东部时间 (纽约) listTimezone.append("America/Caracas");//>委内瑞拉时间 (加拉加斯) listTimezone.append("America/Barbados");//>大西洋时间 (巴巴多斯) listTimezone.append("America/Manaus");//亚马逊标准时间 (马瑙斯) listTimezone.append("America/Santiago");//圣地亚哥 listTimezone.append("America/St_Johns");//纽芬兰时间 (圣约翰) listTimezone.append("America/Sao_Paulo");//圣保罗 listTimezone.append("America/Argentina/Buenos_Aires");//布宜诺斯艾利斯 listTimezone.append("America/Godthab");//戈特霍布 listTimezone.append("America/Montevideo");//乌拉圭时间 (蒙得维的亚) listTimezone.append("Atlantic/South_Georgia");//南乔治亚 listTimezone.append("Atlantic/Azores");//亚述尔群岛 listTimezone.append("Atlantic/Cape_Verde");//佛得角 listTimezone.append("Africa/Casablanca");//卡萨布兰卡 listTimezone.append("Europe/London");//格林尼治标准时间 (伦敦) listTimezone.append("Europe/Amsterdam");//中欧标准时间 (阿姆斯特丹) listTimezone.append("Europe/Belgrade");//中欧标准时间 (贝尔格莱德) listTimezone.append("Europe/Brussels");//中欧标准时间 (布鲁塞尔) listTimezone.append("Europe/Sarajevo");//中欧标准时间 (萨拉热窝) listTimezone.append("Africa/Windhoek");//温得和克 listTimezone.append("Africa/Brazzaville");//西部非洲标准时间 (布拉扎维) listTimezone.append("Asia/Amman");//东欧标准时间 (安曼) listTimezone.append("Europe/Athens");//东欧标准时间 (雅典) listTimezone.append("Asia/Beirut");//东欧标准时间 (贝鲁特) listTimezone.append("Africa/Cairo");//东欧标准时间 (开罗) listTimezone.append("Europe/Helsinki");//东欧标准时间 (赫尔辛基) listTimezone.append("Asia/Jerusalem");//以色列时间 (耶路撒冷) listTimezone.append("Europe/Minsk");//明斯克 listTimezone.append("Africa/Harare");//中部非洲标准时间 (哈拉雷) listTimezone.append("Asia/Baghdad");//巴格达 listTimezone.append("Europe/Moscow");//莫斯科 listTimezone.append("Asia/Kuwait");//科威特 listTimezone.append("Africa/Nairobi");//东部非洲标准时间 (内罗毕) listTimezone.append("Asia/Tehran");//伊朗标准时间 (德黑兰) listTimezone.append("Asia/Baku");//巴库 listTimezone.append("Asia/Tbilisi");//第比利斯 listTimezone.append("Asia/Yerevan");//埃里温 listTimezone.append("Asia/Dubai");//迪拜 listTimezone.append("Asia/Kabul");//阿富汗时间 (喀布尔) listTimezone.append("Asia/Karachi");//卡拉奇 listTimezone.append("Asia/Oral");//乌拉尔 listTimezone.append("Asia/Yekaterinburg");//叶卡捷林堡 listTimezone.append("Asia/Calcutta");//加尔各答 listTimezone.append("Asia/Colombo");//科伦坡 listTimezone.append("Asia/Katmandu");//尼泊尔时间 (加德满都) listTimezone.append("Asia/Almaty");//阿拉木图 listTimezone.append("Asia/Rangoon");//缅甸时间 (仰光) listTimezone.append("Asia/Krasnoyarsk");//克拉斯诺亚尔斯克 listTimezone.append("Asia/Bangkok");//曼谷 listTimezone.append("Asia/Shanghai");//中国标准时间 (北京) listTimezone.append("Asia/Hong_Kong");//香港时间 (香港) listTimezone.append("Asia/Irkutsk");//伊尔库茨克时间 (伊尔库茨克) listTimezone.append("Asia/Kuala_Lumpur");//吉隆坡 listTimezone.append("Australia/Perth");//佩思 listTimezone.append("Asia/Taipei");//台北时间 (台北) listTimezone.append("Asia/Seoul");//首尔 listTimezone.append("Asia/Tokyo");//日本时间 (东京) listTimezone.append("Asia/Yakutsk");//雅库茨克时间 (雅库茨克) listTimezone.append("Australia/Adelaide");//阿德莱德 listTimezone.append("Australia/Darwin");//达尔文 listTimezone.append("Australia/Brisbane");//布里斯班 listTimezone.append("Australia/Hobart");//霍巴特 listTimezone.append("Australia/Sydney");//悉尼 listTimezone.append("Asia/Vladivostok");//海参崴时间 (符拉迪沃斯托克) listTimezone.append("Pacific/Guam");//关岛 listTimezone.append("Asia/Magadan");//马加丹时间 (马加丹) listTimezone.append("Pacific/Auckland");//奥克兰 listTimezone.append("Pacific/Fiji");//斐济 listTimezone.append("Pacific/Tongatapu");//东加塔布 //listTimezone.append("Majuro"); //listTimezone.append("Midway"); //listTimezone.append("Honolulu"); //listTimezone.append("Anchorage");//>安克雷奇 //listTimezone.append("Los_Angeles");//>美国太平洋时间 (洛杉矶) //listTimezone.append("Tijuana");//>美国太平洋时间 (提华纳) //listTimezone.append("Phoenix");//>美国山区时间 (凤凰城) //listTimezone.append("Chihuahua");//>奇瓦瓦 //listTimezone.append("Denver");//>美国山区时间 (丹佛) //listTimezone.append("Costa_Rica");//>美国中部时间 (哥斯达黎加) //listTimezone.append("Chicago");//>美国中部时间 (芝加哥) //listTimezone.append("Mexico_City");//>美国中部时间 (墨西哥城) //listTimezone.append("Regina");//>美国中部时间 (里贾纳) //listTimezone.append("Bogota");//>哥伦比亚时间 (波哥大) //listTimezone.append("New_York");//>美国东部时间 (纽约) //listTimezone.append("Caracas");//>委内瑞拉时间 (加拉加斯) //listTimezone.append("Barbados");//>大西洋时间 (巴巴多斯) //listTimezone.append("Manaus");//亚马逊标准时间 (马瑙斯) //listTimezone.append("Santiago");//圣地亚哥 //listTimezone.append("St_Johns");//纽芬兰时间 (圣约翰) //listTimezone.append("Sao_Paulo");//圣保罗 //listTimezone.append("Buenos_Aires");//布宜诺斯艾利斯 //listTimezone.append("Godthab");//戈特霍布 //listTimezone.append("Montevideo");//乌拉圭时间 (蒙得维的亚) //listTimezone.append("South_Georgia");//南乔治亚 //listTimezone.append("Azores");//亚述尔群岛 //listTimezone.append("Cape_Verde");//佛得角 //listTimezone.append("Casablanca");//卡萨布兰卡 //listTimezone.append("London");//格林尼治标准时间 (伦敦) //listTimezone.append("Amsterdam");//中欧标准时间 (阿姆斯特丹) //listTimezone.append("Belgrade");//中欧标准时间 (贝尔格莱德) //listTimezone.append("Brussels");//中欧标准时间 (布鲁塞尔) //listTimezone.append("Sarajevo");//中欧标准时间 (萨拉热窝) //listTimezone.append("Windhoek");//温得和克 //listTimezone.append("Brazzaville");//西部非洲标准时间 (布拉扎维) //listTimezone.append("Amman");//东欧标准时间 (安曼) //listTimezone.append("Athens");//东欧标准时间 (雅典) //listTimezone.append("Beirut");//东欧标准时间 (贝鲁特) //listTimezone.append("Cairo");//东欧标准时间 (开罗) //listTimezone.append("Helsinki");//东欧标准时间 (赫尔辛基) //listTimezone.append("Jerusalem");//以色列时间 (耶路撒冷) //listTimezone.append("Minsk");//明斯克 //listTimezone.append("Harare");//中部非洲标准时间 (哈拉雷) //listTimezone.append("Baghdad");//巴格达 //listTimezone.append("Moscow");//莫斯科 //listTimezone.append("Kuwait");//科威特 //listTimezone.append("Nairobi");//东部非洲标准时间 (内罗毕) //listTimezone.append("Tehran");//伊朗标准时间 (德黑兰) //listTimezone.append("Baku");//巴库 //listTimezone.append("Tbilisi");//第比利斯 //listTimezone.append("Yerevan");//埃里温 //listTimezone.append("Dubai");//迪拜 //listTimezone.append("Kabul");//阿富汗时间 (喀布尔) //listTimezone.append("Karachi");//卡拉奇 //listTimezone.append("Oral");//乌拉尔 //listTimezone.append("Yekaterinburg");//叶卡捷林堡 //listTimezone.append("Calcutta");//加尔各答 //listTimezone.append("Colombo");//科伦坡 //listTimezone.append("Katmandu");//尼泊尔时间 (加德满都) //listTimezone.append("Almaty");//阿拉木图 //listTimezone.append("Rangoon");//缅甸时间 (仰光) //listTimezone.append("Krasnoyarsk");//克拉斯诺亚尔斯克 //listTimezone.append("Bangkok");//曼谷 //listTimezone.append("Shanghai");//中国标准时间 (北京) //listTimezone.append("Hong_Kong");//香港时间 (香港) //listTimezone.append("Irkutsk");//伊尔库茨克时间 (伊尔库茨克) //listTimezone.append("Kuala_Lumpur");//吉隆坡 //listTimezone.append("Perth");//佩思 //listTimezone.append("Taipei");//台北时间 (台北) //listTimezone.append("Seoul");//首尔 //listTimezone.append("Tokyo");//日本时间 (东京) //listTimezone.append("Yakutsk");//雅库茨克时间 (雅库茨克) //listTimezone.append("Adelaide");//阿德莱德 //listTimezone.append("Darwin");//达尔文 //listTimezone.append("Brisbane");//布里斯班 //listTimezone.append("Hobart");//霍巴特 //listTimezone.append("Sydney");//悉尼 //listTimezone.append("Vladivostok");//海参崴时间 (符拉迪沃斯托克) //listTimezone.append("Guam");//关岛 //listTimezone.append("Magadan");//马加丹时间 (马加丹) //listTimezone.append("Auckland");//奥克兰 //listTimezone.append("Fiji");//斐济 //listTimezone.append("Tongatapu");//东加塔布 ui->comboBox_Timezone->addItems(listTimezone); } void ControlVerifyClockWidget::OnSetTimeZone() { // QJsonObject obj; //obj.insert("Majuro","Pacific/Majuro"); //obj.insert("Midway","Pacific/Midway"); //obj.insert("Honolulu","Pacific/Honolulu"); //obj.insert("Anchorage" ,"America/Anchorage");//>安克雷奇 //obj.insert("Los_Angeles","America/Los_Angeles");//>美国太平洋时间 (洛杉矶) //obj.insert("Tijuana","America/Tijuana");//>美国太平洋时间 (提华纳) //obj.insert("Phoenix","America/Phoenix");//>美国山区时间 (凤凰城) //obj.insert("Chihuahua","America/Chihuahua");//>奇瓦瓦 //obj.insert("Denver","America/Denver");//>美国山区时间 (丹佛) //obj.insert("Costa_Rica","America/Costa_Rica");//>美国中部时间 (哥斯达黎加) //obj.insert("Chicago","America/Chicago");//>美国中部时间 (芝加哥) //obj.insert("Mexico_City","America/Mexico_City");//>美国中部时间 (墨西哥城) //obj.insert("Regina","America/Regina");//>美国中部时间 (里贾纳) //obj.insert("Bogota","America/Bogota");//>哥伦比亚时间 (波哥大) //obj.insert("New_York","America/New_York");//>美国东部时间 (纽约) //obj.insert("Caracas","America/Caracas");//>委内瑞拉时间 (加拉加斯) //obj.insert("Barbados","America/Barbados");//>大西洋时间 (巴巴多斯) //obj.insert("Manaus","America/Manaus");//亚马逊标准时间 (马瑙斯) //obj.insert("Santiago","America/Santiago");//圣地亚哥 //obj.insert("St_Johns","America/St_Johns");//纽芬兰时间 (圣约翰) //obj.insert("Sao_Paulo","America/Sao_Paulo");//圣保罗 //obj.insert("Buenos_Aires","America/Argentina/Buenos_Aires");//布宜诺斯艾利斯 //obj.insert("Godthab","America/Godthab");//戈特霍布 //obj.insert("Montevideo","America/Montevideo");//乌拉圭时间 (蒙得维的亚) //obj.insert("South_Georgia","Atlantic/South_Georgia");//南乔治亚 //obj.insert("Azores","Atlantic/Azores");//亚述尔群岛 //obj.insert("Cape_Verde","Atlantic/Cape_Verde");//佛得角 //obj.insert("Casablanca","Africa/Casablanca");//卡萨布兰卡 //obj.insert("London","Europe/London");//格林尼治标准时间 (伦敦) //obj.insert("Amsterdam","Europe/Amsterdam");//中欧标准时间 (阿姆斯特丹) //obj.insert("Belgrade","Europe/Belgrade");//中欧标准时间 (贝尔格莱德) //obj.insert("Brussels","Europe/Brussels");//中欧标准时间 (布鲁塞尔) //obj.insert("Sarajevo","Europe/Sarajevo");//中欧标准时间 (萨拉热窝) //obj.insert("Windhoek","Africa/Windhoek");//温得和克 //obj.insert("Brazzaville","Africa/Brazzaville");//西部非洲标准时间 (布拉扎维) //obj.insert("Amman","Asia/Amman");//东欧标准时间 (安曼) //obj.insert("Athens","Europe/Athens");//东欧标准时间 (雅典) //obj.insert("Beirut","Asia/Beirut");//东欧标准时间 (贝鲁特) //obj.insert("Cairo","Africa/Cairo");//东欧标准时间 (开罗) //obj.insert("Helsinki","Europe/Helsinki");//东欧标准时间 (赫尔辛基) //obj.insert("Jerusalem","Asia/Jerusalem");//以色列时间 (耶路撒冷) //obj.insert("Minsk","Europe/Minsk");//明斯克 //obj.insert("Harare","Africa/Harare");//中部非洲标准时间 (哈拉雷) //obj.insert("Baghdad","Asia/Baghdad");//巴格达 //obj.insert("Moscow","Europe/Moscow");//莫斯科 //obj.insert("Kuwait","Asia/Kuwait");//科威特 //obj.insert("Nairobi","Africa/Nairobi");//东部非洲标准时间 (内罗毕) //obj.insert("Tehran","Asia/Tehran");//伊朗标准时间 (德黑兰) //obj.insert("Baku","Asia/Baku");//巴库 //obj.insert("Tbilisi","Asia/Tbilisi");//第比利斯 //obj.insert("Yerevan","Asia/Yerevan");//埃里温 //obj.insert("Dubai","Asia/Dubai");//迪拜 //obj.insert("Kabul","Asia/Kabul");//阿富汗时间 (喀布尔) //obj.insert("Karachi","Asia/Karachi");//卡拉奇 //obj.insert("Oral","Asia/Oral");//乌拉尔 //obj.insert("Yekaterinburg","Asia/Yekaterinburg");//叶卡捷林堡 //obj.insert("Calcutta","Asia/Calcutta");//加尔各答 //obj.insert("Colombo","Asia/Colombo");//科伦坡 //obj.insert("Katmandu","Asia/Katmandu");//尼泊尔时间 (加德满都) //obj.insert("Almaty","Asia/Almaty");//阿拉木图 //obj.insert("Rangoon","Asia/Rangoon");//缅甸时间 (仰光) //obj.insert("Krasnoyarsk","Asia/Krasnoyarsk");//克拉斯诺亚尔斯克 //obj.insert("Bangkok","Asia/Bangkok");//曼谷 //obj.insert("Shanghai","Asia/Shanghai");//中国标准时间 (北京) //obj.insert("Hong_Kong","Asia/Hong_Kong");//香港时间 (香港) //obj.insert("Irkutsk","Asia/Irkutsk");//伊尔库茨克时间 (伊尔库茨克) //obj.insert("Kuala_Lumpur","Asia/Kuala_Lumpur");//吉隆坡 //obj.insert("Perth","Australia/Perth");//佩思 //obj.insert("Taipei","Asia/Taipei");//台北时间 (台北) //obj.insert("Seoul","Asia/Seoul");//首尔 //obj.insert("Tokyo","Asia/Tokyo");//日本时间 (东京) //obj.insert("Yakutsk","Asia/Yakutsk");//雅库茨克时间 (雅库茨克) //obj.insert("Adelaide","Australia/Adelaide");//阿德莱德 //obj.insert("Darwin","Australia/Darwin");//达尔文 //obj.insert("Brisbane","Australia/Brisbane");//布里斯班 //obj.insert("Hobart","Australia/Hobart");//霍巴特 //obj.insert("Sydney","Australia/Sydney");//悉尼 //obj.insert("Vladivostok","Asia/Vladivostok");//海参崴时间 (符拉迪沃斯托克) //obj.insert("Guam","Pacific/Guam");//关岛 //obj.insert("Magadan","Asia/Magadan");//马加丹时间 (马加丹) //obj.insert("Auckland","Pacific/Auckland");//奥克兰 //obj.insert("Fiji","Pacific/Fiji");//斐济 //obj.insert("Tongatapu","Pacific/Tongatapu");//东加塔布 QString strTimeZone=ui->comboBox_Timezone->currentText(); //QString strValue= obj[strTimeZone].toString(); MACRO_DEFINE_NO_SELECTED_CARD_TIP QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "SetTimezone"); json.insert("timezone", strTimeZone); MACRO_DEFINE_TIPDLG_FUCN(tr("SetTimezone"),tr("Success"),tr("failed")) }