#include "controlverifyclockwidget.h" #include "ui_controlverifyclockwidget.h" #include #include "tools.h" #include extern QWidget *gMainWin; ControlVerifyClockWidget::ControlVerifyClockWidget(QWidget *parent, QList *list) : QWidget(parent), ui(new Ui::ControlVerifyClockWidget) { m_pLedlist=list; ui->setupUi(this); refreshLable(); setStyleSheet(Tools::styleSheet()); ui->pushButtonSetNtp->setProperty("ssType", "progManageTool"); ui->pushButtonSetSync->setProperty("ssType", "progManageTool"); ui->pushButtonSetToCptTime->setProperty("ssType", "progManageTool"); ui->pushButtonReadBackSync->setProperty("ssType", "progManageTool"); ui->pushButton_ReadbackNtp->setProperty("ssType", "progManageTool"); ui->pushButtonSetLoraMaster->setProperty("ssType", "progManageTool"); ui->pushButtonReadbackLoraMaster->setProperty("ssType", "progManageTool"); ui->pushButtonCurTimeOfController->setProperty("ssType", "progManageTool"); ui->pushButtonSetTimeZone->setProperty("ssType", "progManageTool"); 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())); connect(ui->pushButtonSetLang, SIGNAL(clicked()), this, SLOT(OnSetLang())); connect(ui->pushButtonGetLang, SIGNAL(clicked()), this, SLOT(OnGetLang())); 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->labelLanguage->setText(tr("Language:")); ui->pushButtonSetNtp->setText(tr("Set")); ui->pushButtonSetSync->setText(tr("Set")); ui->pushButtonSetLang->setText(tr("Set")); ui->pushButtonSetToCptTime->setText(tr("Set")); ui->pushButtonSetTimeZone->setText(tr("Set")); ui->pushButtonSetLoraMaster->setText(tr("Set")); ui->pushButtonGetLang->setText(tr("Readback")); ui->pushButtonReadbackLoraMaster->setText(tr("Readback")); ui->pushButton_ReadbackNtp->setText(tr("Readback")); ui->pushButtonReadBackSync->setText(tr("Readback")); ui->pushButtonCurTimeOfController->setText(tr("Readback")); 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->groupBox_3->setTitle(tr("Sync clock to computer time")); 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->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")); } 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() { 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==Setting_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); json = QJsonObject(); json.insert("_id", getRandomString(10)); json.insert("_type", "GetTimezone"); HttpPostByTypeJsonObject(pHpptClientAll, m_strUrl, json); json = QJsonObject(); json.insert("_id", getRandomString(10)); json.insert("_type", "GetLanguage"); HttpPostByTypeJsonObject(pHpptClientAll, m_strUrl, json); MACRO_DEFINE_TIPDLG_ALL_FUCN(tr("Readback"),tr("Success"),tr("failed")) } //获取到httpPost的应答,如果参数变化需要出发修改控件item的内容 void ControlVerifyClockWidget::OnProHttpResponse(QString url, QString, QByteArray data){ 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 == "GetLanguage") { if(jsonObject["language"].toInt()==1) ui->radioButtonCn->setChecked(true); else ui->radioButtonEn->setChecked(true); } else if(strType == "SetNtpServer") ;//alahover 新增协议类型 else if(strType == "GetNtpServer") ui->lineEditNtpServer->setText(jsonObject["ntpServer"].toString()); else if(strType == "GetNtpAndTimezone") ui->lineEditNtpServer->setText(jsonObject["ntpServer"].toString()); 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, QByteArray data){ 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 +"----All----"+ strType; if(strType == "GetLanguage") { if(jsonObject["language"].toInt()==1) ui->radioButtonCn->setChecked(true); else ui->radioButtonEn->setChecked(true); } else if(strType == "GetTimezone"){ QString strtemp=jsonObject["timezone"].toString(); ui->comboBox_Timezone->setCurrentText(strtemp); MACRO_ASKTIME_STOP MACRO_POSTING_DLG_UNLOCK } 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");//东加塔布 ui->comboBox_Timezone->addItems(listTimezone); } void ControlVerifyClockWidget::OnSetTimeZone(){ QString strTimeZone=ui->comboBox_Timezone->currentText(); CHECK_CARD_SELECTED 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")) } void ControlVerifyClockWidget::OnSetLang(){ CHECK_CARD_SELECTED int lang = ui->radioButtonCn->isChecked() ? 1 : 0; QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "SetLanguage"); json.insert("language", lang); MACRO_DEFINE_TIPDLG_FUCN("设置语言", "成功", "失败") } void ControlVerifyClockWidget::OnGetLang() { QJsonObject json; json.insert("_id", getRandomString(10)); json.insert("_type", "GetLanguage"); MACRO_DEFINE_TIPDLG_FUCN("回读语言", "成功", "失败") }