#include "controlverifyclockwidget.h"
#include "ui_controlverifyclockwidget.h"
#include "LoUIClass/x_uimsgboxok.h"
#include <globaldefine.h>
ControlVerifyClockWidget::ControlVerifyClockWidget(QWidget *parent,QList<LedCard *> *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()<<iSecs22<<","<<iSecs11;
//     json.insert("time", iSecs22);
     json.insert("time", iSecs11);
    MACRO_DEFINE_TIPDLG_FUCN(tr("SyncTime"),tr("Success"),tr("failed"))

}

void ControlVerifyClockWidget::OnReadbackNtp()
{
    QJsonObject json;
    json.insert("_id", getRandomString(10));
    json.insert("_type", "GetNtpServer");
    MACRO_DEFINE_TIPDLG_FUCN(tr("GetNtpServer"),tr("Success"),tr("failed"))


 //           json.insert("_type", "GetNtpAndTimezone");
 //           MACRO_DEFINE_TIPDLG_FUCN(tr("GetNtpAndTimezone"),tr("Success"),tr("failed"))

}
void ControlVerifyClockWidget::OnReadbackSyncInfo()
{
    QJsonObject json;
    json.insert("_id", getRandomString(10));
    json.insert("_type", "GetingSyncMethod");
    MACRO_DEFINE_TIPDLG_FUCN(tr("GetingSyncMethod"),tr("Success"),tr("failed"))

}
void ControlVerifyClockWidget::onSelectedDeviceList(QList<LedCard*> *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 <<endl;

    return hou + ":" + min + ":" + sec ;
}
//获取到httpPost的应答，如果参数变化需要出发修改控件item的内容
void ControlVerifyClockWidget::OnProHttpResponse(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()<<tr("wDevicesItem OnProHttpResponse 解析json文件错误！");
            return;
        }
        QJsonObject jsonObject = document.object();
        QString strType=jsonObject["_type"].toString();
        if(jsonObject["success"].toBool()==true)
        {
            qDebug()<<m_pLedCard->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()<<jsonObject["date"].toString();
            }
            else if(strType == "MasterSlaveSwitch")
            {

            }
            else if(strType == "IsMasterSlave")
            {
               if(jsonObject["result"].toBool())
               {
                    ui->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()<<tr("wDevicesItem OnProHttpResponse 解析json文件错误！");
            return;
        }
        QJsonObject jsonObject = document.object();
        QString strType=jsonObject["_type"].toString();
        if(jsonObject["success"].toBool()==true)
        {
            qDebug()<<m_pLedCard->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");//>安克雷奇</timezone>
    listTimezone.append("America/Los_Angeles");//>美国太平洋时间 (洛杉矶)</timezone>
    listTimezone.append("America/Tijuana");//>美国太平洋时间 (提华纳)</timezone>
    listTimezone.append("America/Phoenix");//>美国山区时间 (凤凰城)</timezone>
    listTimezone.append("America/Chihuahua");//>奇瓦瓦</timezone>
    listTimezone.append("America/Denver");//>美国山区时间 (丹佛)</timezone>
    listTimezone.append("America/Costa_Rica");//>美国中部时间 (哥斯达黎加)</timezone>
    listTimezone.append("America/Chicago");//>美国中部时间 (芝加哥)</timezone>
    listTimezone.append("America/Mexico_City");//>美国中部时间 (墨西哥城)</timezone>
    listTimezone.append("America/Regina");//>美国中部时间 (里贾纳)</timezone>
    listTimezone.append("America/Bogota");//>哥伦比亚时间 (波哥大)</timezone>
    listTimezone.append("America/New_York");//>美国东部时间 (纽约)</timezone>
    listTimezone.append("America/Caracas");//>委内瑞拉时间 (加拉加斯)</timezone>
    listTimezone.append("America/Barbados");//>大西洋时间 (巴巴多斯)</timezone>
    listTimezone.append("America/Manaus");//亚马逊标准时间 (马瑙斯)</timezone>
    listTimezone.append("America/Santiago");//圣地亚哥</timezone>
    listTimezone.append("America/St_Johns");//纽芬兰时间 (圣约翰)</timezone>
    listTimezone.append("America/Sao_Paulo");//圣保罗</timezone>
    listTimezone.append("America/Argentina/Buenos_Aires");//布宜诺斯艾利斯</timezone>
    listTimezone.append("America/Godthab");//戈特霍布</timezone>
    listTimezone.append("America/Montevideo");//乌拉圭时间 (蒙得维的亚)</timezone>
    listTimezone.append("Atlantic/South_Georgia");//南乔治亚</timezone>
    listTimezone.append("Atlantic/Azores");//亚述尔群岛</timezone>
    listTimezone.append("Atlantic/Cape_Verde");//佛得角</timezone>
    listTimezone.append("Africa/Casablanca");//卡萨布兰卡</timezone>
    listTimezone.append("Europe/London");//格林尼治标准时间 (伦敦)</timezone>
    listTimezone.append("Europe/Amsterdam");//中欧标准时间 (阿姆斯特丹)</timezone>
    listTimezone.append("Europe/Belgrade");//中欧标准时间 (贝尔格莱德)</timezone>
    listTimezone.append("Europe/Brussels");//中欧标准时间 (布鲁塞尔)</timezone>
    listTimezone.append("Europe/Sarajevo");//中欧标准时间 (萨拉热窝)</timezone>
    listTimezone.append("Africa/Windhoek");//温得和克</timezone>
    listTimezone.append("Africa/Brazzaville");//西部非洲标准时间 (布拉扎维)</timezone>
    listTimezone.append("Asia/Amman");//东欧标准时间 (安曼)</timezone>
    listTimezone.append("Europe/Athens");//东欧标准时间 (雅典)</timezone>
    listTimezone.append("Asia/Beirut");//东欧标准时间 (贝鲁特)</timezone>
    listTimezone.append("Africa/Cairo");//东欧标准时间 (开罗)</timezone>
    listTimezone.append("Europe/Helsinki");//东欧标准时间 (赫尔辛基)</timezone>
    listTimezone.append("Asia/Jerusalem");//以色列时间 (耶路撒冷)</timezone>
    listTimezone.append("Europe/Minsk");//明斯克</timezone>
    listTimezone.append("Africa/Harare");//中部非洲标准时间 (哈拉雷)</timezone>
    listTimezone.append("Asia/Baghdad");//巴格达</timezone>
    listTimezone.append("Europe/Moscow");//莫斯科</timezone>
    listTimezone.append("Asia/Kuwait");//科威特</timezone>
    listTimezone.append("Africa/Nairobi");//东部非洲标准时间 (内罗毕)</timezone>
    listTimezone.append("Asia/Tehran");//伊朗标准时间 (德黑兰)</timezone>
    listTimezone.append("Asia/Baku");//巴库</timezone>
    listTimezone.append("Asia/Tbilisi");//第比利斯</timezone>
    listTimezone.append("Asia/Yerevan");//埃里温</timezone>
    listTimezone.append("Asia/Dubai");//迪拜</timezone>
    listTimezone.append("Asia/Kabul");//阿富汗时间 (喀布尔)</timezone>
    listTimezone.append("Asia/Karachi");//卡拉奇</timezone>
    listTimezone.append("Asia/Oral");//乌拉尔</timezone>
    listTimezone.append("Asia/Yekaterinburg");//叶卡捷林堡</timezone>
    listTimezone.append("Asia/Calcutta");//加尔各答</timezone>
    listTimezone.append("Asia/Colombo");//科伦坡</timezone>
    listTimezone.append("Asia/Katmandu");//尼泊尔时间 (加德满都)</timezone>
    listTimezone.append("Asia/Almaty");//阿拉木图</timezone>
    listTimezone.append("Asia/Rangoon");//缅甸时间 (仰光)</timezone>
    listTimezone.append("Asia/Krasnoyarsk");//克拉斯诺亚尔斯克</timezone>
    listTimezone.append("Asia/Bangkok");//曼谷</timezone>
    listTimezone.append("Asia/Shanghai");//中国标准时间 (北京)</timezone>
    listTimezone.append("Asia/Hong_Kong");//香港时间 (香港)</timezone>
    listTimezone.append("Asia/Irkutsk");//伊尔库茨克时间 (伊尔库茨克)</timezone>
    listTimezone.append("Asia/Kuala_Lumpur");//吉隆坡</timezone>
    listTimezone.append("Australia/Perth");//佩思</timezone>
    listTimezone.append("Asia/Taipei");//台北时间 (台北)</timezone>
    listTimezone.append("Asia/Seoul");//首尔</timezone>
    listTimezone.append("Asia/Tokyo");//日本时间 (东京)</timezone>
    listTimezone.append("Asia/Yakutsk");//雅库茨克时间 (雅库茨克)</timezone>
    listTimezone.append("Australia/Adelaide");//阿德莱德</timezone>
    listTimezone.append("Australia/Darwin");//达尔文</timezone>
    listTimezone.append("Australia/Brisbane");//布里斯班</timezone>
    listTimezone.append("Australia/Hobart");//霍巴特</timezone>
    listTimezone.append("Australia/Sydney");//悉尼</timezone>
    listTimezone.append("Asia/Vladivostok");//海参崴时间 (符拉迪沃斯托克)</timezone>
    listTimezone.append("Pacific/Guam");//关岛</timezone>
    listTimezone.append("Asia/Magadan");//马加丹时间 (马加丹)</timezone>
    listTimezone.append("Pacific/Auckland");//奥克兰</timezone>
    listTimezone.append("Pacific/Fiji");//斐济</timezone>
    listTimezone.append("Pacific/Tongatapu");//东加塔布</timezone>
//listTimezone.append("Majuro");
//listTimezone.append("Midway");
//listTimezone.append("Honolulu");
//listTimezone.append("Anchorage");//>安克雷奇</timezone>
//listTimezone.append("Los_Angeles");//>美国太平洋时间 (洛杉矶)</timezone>
//listTimezone.append("Tijuana");//>美国太平洋时间 (提华纳)</timezone>
//listTimezone.append("Phoenix");//>美国山区时间 (凤凰城)</timezone>
//listTimezone.append("Chihuahua");//>奇瓦瓦</timezone>
//listTimezone.append("Denver");//>美国山区时间 (丹佛)</timezone>
//listTimezone.append("Costa_Rica");//>美国中部时间 (哥斯达黎加)</timezone>
//listTimezone.append("Chicago");//>美国中部时间 (芝加哥)</timezone>
//listTimezone.append("Mexico_City");//>美国中部时间 (墨西哥城)</timezone>
//listTimezone.append("Regina");//>美国中部时间 (里贾纳)</timezone>
//listTimezone.append("Bogota");//>哥伦比亚时间 (波哥大)</timezone>
//listTimezone.append("New_York");//>美国东部时间 (纽约)</timezone>
//listTimezone.append("Caracas");//>委内瑞拉时间 (加拉加斯)</timezone>
//listTimezone.append("Barbados");//>大西洋时间 (巴巴多斯)</timezone>
//listTimezone.append("Manaus");//亚马逊标准时间 (马瑙斯)</timezone>
//listTimezone.append("Santiago");//圣地亚哥</timezone>
//listTimezone.append("St_Johns");//纽芬兰时间 (圣约翰)</timezone>
//listTimezone.append("Sao_Paulo");//圣保罗</timezone>
//listTimezone.append("Buenos_Aires");//布宜诺斯艾利斯</timezone>
//listTimezone.append("Godthab");//戈特霍布</timezone>
//listTimezone.append("Montevideo");//乌拉圭时间 (蒙得维的亚)</timezone>
//listTimezone.append("South_Georgia");//南乔治亚</timezone>
//listTimezone.append("Azores");//亚述尔群岛</timezone>
//listTimezone.append("Cape_Verde");//佛得角</timezone>
//listTimezone.append("Casablanca");//卡萨布兰卡</timezone>
//listTimezone.append("London");//格林尼治标准时间 (伦敦)</timezone>
//listTimezone.append("Amsterdam");//中欧标准时间 (阿姆斯特丹)</timezone>
//listTimezone.append("Belgrade");//中欧标准时间 (贝尔格莱德)</timezone>
//listTimezone.append("Brussels");//中欧标准时间 (布鲁塞尔)</timezone>
//listTimezone.append("Sarajevo");//中欧标准时间 (萨拉热窝)</timezone>
//listTimezone.append("Windhoek");//温得和克</timezone>
//listTimezone.append("Brazzaville");//西部非洲标准时间 (布拉扎维)</timezone>
//listTimezone.append("Amman");//东欧标准时间 (安曼)</timezone>
//listTimezone.append("Athens");//东欧标准时间 (雅典)</timezone>
//listTimezone.append("Beirut");//东欧标准时间 (贝鲁特)</timezone>
//listTimezone.append("Cairo");//东欧标准时间 (开罗)</timezone>
//listTimezone.append("Helsinki");//东欧标准时间 (赫尔辛基)</timezone>
//listTimezone.append("Jerusalem");//以色列时间 (耶路撒冷)</timezone>
//listTimezone.append("Minsk");//明斯克</timezone>
//listTimezone.append("Harare");//中部非洲标准时间 (哈拉雷)</timezone>
//listTimezone.append("Baghdad");//巴格达</timezone>
//listTimezone.append("Moscow");//莫斯科</timezone>
//listTimezone.append("Kuwait");//科威特</timezone>
//listTimezone.append("Nairobi");//东部非洲标准时间 (内罗毕)</timezone>
//listTimezone.append("Tehran");//伊朗标准时间 (德黑兰)</timezone>
//listTimezone.append("Baku");//巴库</timezone>
//listTimezone.append("Tbilisi");//第比利斯</timezone>
//listTimezone.append("Yerevan");//埃里温</timezone>
//listTimezone.append("Dubai");//迪拜</timezone>
//listTimezone.append("Kabul");//阿富汗时间 (喀布尔)</timezone>
//listTimezone.append("Karachi");//卡拉奇</timezone>
//listTimezone.append("Oral");//乌拉尔</timezone>
//listTimezone.append("Yekaterinburg");//叶卡捷林堡</timezone>
//listTimezone.append("Calcutta");//加尔各答</timezone>
//listTimezone.append("Colombo");//科伦坡</timezone>
//listTimezone.append("Katmandu");//尼泊尔时间 (加德满都)</timezone>
//listTimezone.append("Almaty");//阿拉木图</timezone>
//listTimezone.append("Rangoon");//缅甸时间 (仰光)</timezone>
//listTimezone.append("Krasnoyarsk");//克拉斯诺亚尔斯克</timezone>
//listTimezone.append("Bangkok");//曼谷</timezone>
//listTimezone.append("Shanghai");//中国标准时间 (北京)</timezone>
//listTimezone.append("Hong_Kong");//香港时间 (香港)</timezone>
//listTimezone.append("Irkutsk");//伊尔库茨克时间 (伊尔库茨克)</timezone>
//listTimezone.append("Kuala_Lumpur");//吉隆坡</timezone>
//listTimezone.append("Perth");//佩思</timezone>
//listTimezone.append("Taipei");//台北时间 (台北)</timezone>
//listTimezone.append("Seoul");//首尔</timezone>
//listTimezone.append("Tokyo");//日本时间 (东京)</timezone>
//listTimezone.append("Yakutsk");//雅库茨克时间 (雅库茨克)</timezone>
//listTimezone.append("Adelaide");//阿德莱德</timezone>
//listTimezone.append("Darwin");//达尔文</timezone>
//listTimezone.append("Brisbane");//布里斯班</timezone>
//listTimezone.append("Hobart");//霍巴特</timezone>
//listTimezone.append("Sydney");//悉尼</timezone>
//listTimezone.append("Vladivostok");//海参崴时间 (符拉迪沃斯托克)</timezone>
//listTimezone.append("Guam");//关岛</timezone>
//listTimezone.append("Magadan");//马加丹时间 (马加丹)</timezone>
//listTimezone.append("Auckland");//奥克兰</timezone>
//listTimezone.append("Fiji");//斐济</timezone>
//listTimezone.append("Tongatapu");//东加塔布</timezone>

    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");//>安克雷奇</timezone>
//obj.insert("Los_Angeles","America/Los_Angeles");//>美国太平洋时间 (洛杉矶)</timezone>
//obj.insert("Tijuana","America/Tijuana");//>美国太平洋时间 (提华纳)</timezone>
//obj.insert("Phoenix","America/Phoenix");//>美国山区时间 (凤凰城)</timezone>
//obj.insert("Chihuahua","America/Chihuahua");//>奇瓦瓦</timezone>
//obj.insert("Denver","America/Denver");//>美国山区时间 (丹佛)</timezone>
//obj.insert("Costa_Rica","America/Costa_Rica");//>美国中部时间 (哥斯达黎加)</timezone>
//obj.insert("Chicago","America/Chicago");//>美国中部时间 (芝加哥)</timezone>
//obj.insert("Mexico_City","America/Mexico_City");//>美国中部时间 (墨西哥城)</timezone>
//obj.insert("Regina","America/Regina");//>美国中部时间 (里贾纳)</timezone>
//obj.insert("Bogota","America/Bogota");//>哥伦比亚时间 (波哥大)</timezone>
//obj.insert("New_York","America/New_York");//>美国东部时间 (纽约)</timezone>
//obj.insert("Caracas","America/Caracas");//>委内瑞拉时间 (加拉加斯)</timezone>
//obj.insert("Barbados","America/Barbados");//>大西洋时间 (巴巴多斯)</timezone>
//obj.insert("Manaus","America/Manaus");//亚马逊标准时间 (马瑙斯)</timezone>
//obj.insert("Santiago","America/Santiago");//圣地亚哥</timezone>
//obj.insert("St_Johns","America/St_Johns");//纽芬兰时间 (圣约翰)</timezone>
//obj.insert("Sao_Paulo","America/Sao_Paulo");//圣保罗</timezone>
//obj.insert("Buenos_Aires","America/Argentina/Buenos_Aires");//布宜诺斯艾利斯</timezone>
//obj.insert("Godthab","America/Godthab");//戈特霍布</timezone>
//obj.insert("Montevideo","America/Montevideo");//乌拉圭时间 (蒙得维的亚)</timezone>
//obj.insert("South_Georgia","Atlantic/South_Georgia");//南乔治亚</timezone>
//obj.insert("Azores","Atlantic/Azores");//亚述尔群岛</timezone>
//obj.insert("Cape_Verde","Atlantic/Cape_Verde");//佛得角</timezone>
//obj.insert("Casablanca","Africa/Casablanca");//卡萨布兰卡</timezone>
//obj.insert("London","Europe/London");//格林尼治标准时间 (伦敦)</timezone>
//obj.insert("Amsterdam","Europe/Amsterdam");//中欧标准时间 (阿姆斯特丹)</timezone>
//obj.insert("Belgrade","Europe/Belgrade");//中欧标准时间 (贝尔格莱德)</timezone>
//obj.insert("Brussels","Europe/Brussels");//中欧标准时间 (布鲁塞尔)</timezone>
//obj.insert("Sarajevo","Europe/Sarajevo");//中欧标准时间 (萨拉热窝)</timezone>
//obj.insert("Windhoek","Africa/Windhoek");//温得和克</timezone>
//obj.insert("Brazzaville","Africa/Brazzaville");//西部非洲标准时间 (布拉扎维)</timezone>
//obj.insert("Amman","Asia/Amman");//东欧标准时间 (安曼)</timezone>
//obj.insert("Athens","Europe/Athens");//东欧标准时间 (雅典)</timezone>
//obj.insert("Beirut","Asia/Beirut");//东欧标准时间 (贝鲁特)</timezone>
//obj.insert("Cairo","Africa/Cairo");//东欧标准时间 (开罗)</timezone>
//obj.insert("Helsinki","Europe/Helsinki");//东欧标准时间 (赫尔辛基)</timezone>
//obj.insert("Jerusalem","Asia/Jerusalem");//以色列时间 (耶路撒冷)</timezone>
//obj.insert("Minsk","Europe/Minsk");//明斯克</timezone>
//obj.insert("Harare","Africa/Harare");//中部非洲标准时间 (哈拉雷)</timezone>
//obj.insert("Baghdad","Asia/Baghdad");//巴格达</timezone>
//obj.insert("Moscow","Europe/Moscow");//莫斯科</timezone>
//obj.insert("Kuwait","Asia/Kuwait");//科威特</timezone>
//obj.insert("Nairobi","Africa/Nairobi");//东部非洲标准时间 (内罗毕)</timezone>
//obj.insert("Tehran","Asia/Tehran");//伊朗标准时间 (德黑兰)</timezone>
//obj.insert("Baku","Asia/Baku");//巴库</timezone>
//obj.insert("Tbilisi","Asia/Tbilisi");//第比利斯</timezone>
//obj.insert("Yerevan","Asia/Yerevan");//埃里温</timezone>
//obj.insert("Dubai","Asia/Dubai");//迪拜</timezone>
//obj.insert("Kabul","Asia/Kabul");//阿富汗时间 (喀布尔)</timezone>
//obj.insert("Karachi","Asia/Karachi");//卡拉奇</timezone>
//obj.insert("Oral","Asia/Oral");//乌拉尔</timezone>
//obj.insert("Yekaterinburg","Asia/Yekaterinburg");//叶卡捷林堡</timezone>
//obj.insert("Calcutta","Asia/Calcutta");//加尔各答</timezone>
//obj.insert("Colombo","Asia/Colombo");//科伦坡</timezone>
//obj.insert("Katmandu","Asia/Katmandu");//尼泊尔时间 (加德满都)</timezone>
//obj.insert("Almaty","Asia/Almaty");//阿拉木图</timezone>
//obj.insert("Rangoon","Asia/Rangoon");//缅甸时间 (仰光)</timezone>
//obj.insert("Krasnoyarsk","Asia/Krasnoyarsk");//克拉斯诺亚尔斯克</timezone>
//obj.insert("Bangkok","Asia/Bangkok");//曼谷</timezone>
//obj.insert("Shanghai","Asia/Shanghai");//中国标准时间 (北京)</timezone>
//obj.insert("Hong_Kong","Asia/Hong_Kong");//香港时间 (香港)</timezone>
//obj.insert("Irkutsk","Asia/Irkutsk");//伊尔库茨克时间 (伊尔库茨克)</timezone>
//obj.insert("Kuala_Lumpur","Asia/Kuala_Lumpur");//吉隆坡</timezone>
//obj.insert("Perth","Australia/Perth");//佩思</timezone>
//obj.insert("Taipei","Asia/Taipei");//台北时间 (台北)</timezone>
//obj.insert("Seoul","Asia/Seoul");//首尔</timezone>
//obj.insert("Tokyo","Asia/Tokyo");//日本时间 (东京)</timezone>
//obj.insert("Yakutsk","Asia/Yakutsk");//雅库茨克时间 (雅库茨克)</timezone>
//obj.insert("Adelaide","Australia/Adelaide");//阿德莱德</timezone>
//obj.insert("Darwin","Australia/Darwin");//达尔文</timezone>
//obj.insert("Brisbane","Australia/Brisbane");//布里斯班</timezone>
//obj.insert("Hobart","Australia/Hobart");//霍巴特</timezone>
//obj.insert("Sydney","Australia/Sydney");//悉尼</timezone>
//obj.insert("Vladivostok","Asia/Vladivostok");//海参崴时间 (符拉迪沃斯托克)</timezone>
//obj.insert("Guam","Pacific/Guam");//关岛</timezone>
//obj.insert("Magadan","Asia/Magadan");//马加丹时间 (马加丹)</timezone>
//obj.insert("Auckland","Pacific/Auckland");//奥克兰</timezone>
//obj.insert("Fiji","Pacific/Fiji");//斐济</timezone>
//obj.insert("Tongatapu","Pacific/Tongatapu");//东加塔布</timezone>
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"))
}
