1936 lines
72 KiB
C++
1936 lines
72 KiB
C++
![]() |
#include "controladvparamwidget.h"
|
|||
|
#include "ui_controladvparamwidget.h"
|
|||
|
#include "LoUIClass/x_uimsgboxokcancel.h"
|
|||
|
#include "LoUIClass/x_uimsgboxok.h"
|
|||
|
#include <QJsonValue>
|
|||
|
#include <QJsonObject>
|
|||
|
#include <QJsonArray>
|
|||
|
#include <QJsonDocument>
|
|||
|
#include <globaldefine.h>
|
|||
|
#include <wDevicesManager/inputpassworddialog.h>
|
|||
|
#include <QProcess>
|
|||
|
#include <QDir>
|
|||
|
#include <QSettings>
|
|||
|
#include <LoUIClass/updateledset3dialog.h>
|
|||
|
#include "loappconfig.h"
|
|||
|
#include <QFileDialog>
|
|||
|
#include <QUuid>
|
|||
|
#include <QMap>
|
|||
|
#include <QMessageBox>
|
|||
|
#include <QHostAddress>
|
|||
|
#include <LoUIClass/x_uimsgboxyesnocancel.h>
|
|||
|
#include "QTextCodec"
|
|||
|
#include "upgradeapkdialog.h"
|
|||
|
void setDebugOutput(const QString &targetFilePath, const bool &argDateFlag = false);
|
|||
|
|
|||
|
ControlAdvParamWidget::ControlAdvParamWidget(QWidget *parent,QList<LedCard *> *list) :
|
|||
|
QWidget(parent),
|
|||
|
ui(new Ui::ControlAdvParamWidget)
|
|||
|
{
|
|||
|
m_pLedlist=list;
|
|||
|
ui->setupUi(this);
|
|||
|
refreshLable();
|
|||
|
ui->pushButtonSetPhyPixels->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSetPhyPixels->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonStartConfigLedScreenSoft->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonStartConfigLedScreenSoft->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSetWebServerParam->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSetWebServerParam->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSetREaltimeServer->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSetREaltimeServer->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonClearRealtimerAddress->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonClearRealtimerAddress->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
|
|||
|
|
|||
|
ui->pushButtonRestart->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonRestart->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
|
|||
|
|
|||
|
ui->pushButtonSoftUpgrade->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonApkCheck->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButton_unistall->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonRunningCheck->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonFpgaUpgrade->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonFpgaVerCheck->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSyncFpgaVer->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonCheckLog->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonClear->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSoftUpgrade->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonApkCheck->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButton_unistall->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonRunningCheck->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonFpgaUpgrade->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonFpgaVerCheck->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSyncFpgaVer->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonCheckLog->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonClear->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
|
|||
|
ui->pushButtonReadMinBrightness->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonReadMinBrightness->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonReadbackMaxBrightess->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonReadbackMaxBrightess->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSendMinBrightness->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSendMinBrightness->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSendMaxBrightness->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSendMaxBrightness->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButton_M80Set->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButton_M80Set->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButton_M80Refresh->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButton_M80Refresh->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButton_M80Restore->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButton_M80Restore->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
|
|||
|
ui->pushButtonReadbackTaxiTopScreen->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonReadbackTaxiTopScreen->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSetTaxiTopScreen->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSetTaxiTopScreen->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonBindingIc->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonBindingIc->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSetAlias->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSetAlias->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
ui->pushButtonSendCustomJson->setProperty("ssType", "progManageTool");
|
|||
|
ui->pushButtonSendCustomJson->setStyleSheet("QPushButton{background:rgba(28,154,210,1);}");
|
|||
|
|
|||
|
|
|||
|
//按钮事件绑定
|
|||
|
//alahover 20211118 ui->pushButtonSetPhyPixels->setEnabled(false);
|
|||
|
ui->pushButtonStartConfigLedScreenSoft->setEnabled(false);
|
|||
|
|
|||
|
ui->groupBoxRotate->setVisible(false);
|
|||
|
ui->groupBoxMinMaxBrightness->setVisible(false);
|
|||
|
ui->groupBox_2->setVisible(false);
|
|||
|
ui->groupBox_3->setVisible(false);
|
|||
|
ui->groupBox_4->setVisible(false);
|
|||
|
ui->checkBox_ADB->setVisible(false);
|
|||
|
|
|||
|
|
|||
|
oM80ResolutionsObject.insert("640×3840","660×3960");
|
|||
|
oM80ResolutionsObject.insert("800×3200","825×3300");
|
|||
|
oM80ResolutionsObject.insert("864×2686","900×2750");
|
|||
|
oM80ResolutionsObject.insert("1080×2432","1125×2500");
|
|||
|
oM80ResolutionsObject.insert("1080×1920","1125×2200");
|
|||
|
oM80ResolutionsObject.insert("1280×1920","1320×2200");
|
|||
|
oM80ResolutionsObject.insert("1472×1536","1500×1650");
|
|||
|
oM80ResolutionsObject.insert("1536×1472","1650×1500");
|
|||
|
oM80ResolutionsObject.insert("1920×1280","2200×1320");
|
|||
|
oM80ResolutionsObject.insert("1920×1080","2200×1125");
|
|||
|
oM80ResolutionsObject.insert("2048×1152","2200×1320");
|
|||
|
oM80ResolutionsObject.insert("2400×1080","2500×1125");
|
|||
|
oM80ResolutionsObject.insert("2686×864","2750×900");
|
|||
|
oM80ResolutionsObject.insert("3200×800","3300×825");
|
|||
|
oM80ResolutionsObject.insert("3840×640","3960×660");
|
|||
|
oM80ResolutionsObject.insert("4096×480","4500×550");
|
|||
|
QStringList strtempList=oM80ResolutionsObject.keys();
|
|||
|
ui->comboBox_2->clear();
|
|||
|
ui->comboBox_2->addItems(strtempList);
|
|||
|
|
|||
|
|
|||
|
connect(ui->pushButtonSetPhyPixels,SIGNAL(clicked()),this,SLOT(OnSetPhyPixels()));
|
|||
|
connect(ui->pushButtonSetAlias,SIGNAL(clicked()),this,SLOT(OnSetAlias()));
|
|||
|
|
|||
|
connect(ui->pushButtonSetWebServerParam,SIGNAL(clicked()),this,SLOT(OnSetWebServerParam()));
|
|||
|
connect(ui->pushButtonSetREaltimeServer,SIGNAL(clicked()),this,SLOT(OnSetRealtimeServer()));
|
|||
|
connect(ui->pushButtonClearRealtimerAddress,SIGNAL(clicked()),this,SLOT(OnClearRealtimeServer()));
|
|||
|
|
|||
|
connect(ui->pushButtonStartConfigLedScreenSoft,SIGNAL(clicked()),this,SLOT(OnStartConfigLedScreenSoft()));
|
|||
|
connect(ui->pushButtonRestart,SIGNAL(clicked()),this,SLOT(OnRestart()));
|
|||
|
|
|||
|
connect(ui->pushButtonSoftUpgrade,SIGNAL(clicked()),this,SLOT(OnSoftUpgrade()));
|
|||
|
connect(ui->pushButtonApkCheck,SIGNAL(clicked()),this,SLOT(OnApkCheck()));
|
|||
|
connect(ui->pushButton_unistall,SIGNAL(clicked()),this,SLOT(OnUnistall()));
|
|||
|
connect(ui->pushButtonRunningCheck,SIGNAL(clicked()),this,SLOT(OnRunningCheck()));
|
|||
|
connect(ui->pushButtonFpgaUpgrade,SIGNAL(clicked()),this,SLOT(OnFpgaUpgrade()));
|
|||
|
connect(ui->pushButtonFpgaVerCheck,SIGNAL(clicked()),this,SLOT(OnFpgaVerCheck()));
|
|||
|
connect(ui->pushButtonSyncFpgaVer,SIGNAL(clicked()),this,SLOT(OnSyncFpgaVer()));
|
|||
|
connect(ui->pushButtonCheckLog,SIGNAL(clicked()),this,SLOT(OnCheckLog()));
|
|||
|
connect(ui->pushButtonClear,SIGNAL(clicked()),this,SLOT(OnClearPrograms()));
|
|||
|
|
|||
|
connect(ui->radioButton0degrees,SIGNAL(clicked()),this,SLOT(On0degrees()));
|
|||
|
connect(ui->radioButton90degrees,SIGNAL(clicked()),this,SLOT(On90degrees()));
|
|||
|
connect(ui->radioButton180degrees,SIGNAL(clicked()),this,SLOT(On180degrees()));
|
|||
|
connect(ui->radioButton270degrees,SIGNAL(clicked()),this,SLOT(On270degrees()));
|
|||
|
|
|||
|
connect(ui->pushButtonSendMinBrightness,SIGNAL(clicked()),this,SLOT(OnSendMinBrightness()));
|
|||
|
connect(ui->pushButtonSendMaxBrightness,SIGNAL(clicked()),this,SLOT(OnSendMaxBrightness()));
|
|||
|
connect(ui->pushButtonReadMinBrightness,SIGNAL(clicked()),this,SLOT(OnGetMinBrightness()));
|
|||
|
|
|||
|
connect(ui->pushButtonReadbackMaxBrightess,SIGNAL(clicked()),this,SLOT(OnGetMaxBrightness()));
|
|||
|
connect(ui->pushButtonSendCustomJson,SIGNAL(clicked()),this,SLOT(OnSendCustomJson()));
|
|||
|
|
|||
|
MARCO_DEFINE_CONTROL_FUNC2(parent->parent(),parent)
|
|||
|
|
|||
|
connect(pHpptClient,SIGNAL(httpGetRspReady(QString , QByteArray )),this,SLOT(OnProHttpGetResponse(QString , QByteArray)));
|
|||
|
// connect(pHpptClient,SIGNAL(onHttpGetRspProgress(QString , QByteArray )),this,SLOT(OnProHttpGetResponse(QString , QByteArray)));
|
|||
|
// connect(pHpptClient,SIGNAL(onHttpGetRspFinished(QString , QByteArray )),this,SLOT(OnProHttpGetResponseFinished(QString , QByteArray)));
|
|||
|
|
|||
|
|
|||
|
connect(ui->pushButton_M80Set,SIGNAL(clicked()),this,SLOT(OnM80Set()));
|
|||
|
connect(ui->pushButton_M80Refresh,SIGNAL(clicked()),this,SLOT(OnM80Refresh()));
|
|||
|
connect(ui->pushButton_M80Restore,SIGNAL(clicked()),this,SLOT(OnM80Restore()));
|
|||
|
connect(ui->pushButtonSetTaxiTopScreen,SIGNAL(clicked()),this,SLOT(OnSetTaxiTopScreen()));
|
|||
|
connect(ui->pushButtonReadbackTaxiTopScreen,SIGNAL(clicked()),this,SLOT(OnReadbackTaxiTopScreen()));
|
|||
|
connect(ui->pushButtonBindingIc,SIGNAL(clicked()),this,SLOT(OnBindingIc()));
|
|||
|
connect(ui->checkBox_ADB,SIGNAL(clicked()),this,SLOT(OnOpenAdb()));
|
|||
|
|
|||
|
ui->radioButtonHL->setChecked(true);
|
|||
|
// setDebugOutput( "d://%1.log", true );
|
|||
|
}
|
|||
|
|
|||
|
ControlAdvParamWidget::~ControlAdvParamWidget()
|
|||
|
{
|
|||
|
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 ControlAdvParamWidget::refreshLable()
|
|||
|
{
|
|||
|
ui->labelPhyWidth->setText(tr("LED Screen Width(pixel):"));
|
|||
|
ui->labelPhyHeight->setText(tr("Height(pixel):"));
|
|||
|
ui->labelAdvParams->setText(tr("Advanced parameters"));
|
|||
|
ui->pushButtonSetPhyPixels->setText(tr("Set"));
|
|||
|
ui->pushButtonStartConfigLedScreenSoft->setText(tr("Start LedSet3.0 configure LED module"));
|
|||
|
|
|||
|
ui->labelWebServer->setText(tr("Web Server Address:"));
|
|||
|
ui->labelCompanyId->setText(tr("Compant ID:"));
|
|||
|
ui->label->setText(tr("Realtimer Server Address:"));
|
|||
|
ui->pushButtonSetWebServerParam->setText(tr("Set"));
|
|||
|
ui->pushButtonSetREaltimeServer->setText(tr("Set"));
|
|||
|
ui->pushButtonClearRealtimerAddress->setText(tr("Clear"));
|
|||
|
ui->pushButtonSoftUpgrade->setText(tr("Apk upgrade"));
|
|||
|
ui->pushButtonRestart->setText(tr("Restart led controller system"));
|
|||
|
|
|||
|
ui->pushButtonSoftUpgrade->setText(tr("Apk upgrade"));
|
|||
|
ui->pushButtonApkCheck->setText(tr("Check Apk"));
|
|||
|
ui->pushButton_unistall->setText(tr("Uninstall"));
|
|||
|
ui->pushButtonRunningCheck->setText(tr("Running check"));
|
|||
|
ui->pushButtonFpgaUpgrade->setText(tr("FPGA Upgrade"));
|
|||
|
ui->pushButtonFpgaVerCheck->setText(tr("FPGA version check"));
|
|||
|
ui->pushButtonSyncFpgaVer->setText(tr("Sync FPGA version"));
|
|||
|
|
|||
|
ui->lineEdit->setPlaceholderText(tr("Width"));
|
|||
|
ui->lineEdit_2->setPlaceholderText(tr("Height"));
|
|||
|
ui->lineEditCompanyId->setPlaceholderText(tr("Compant ID"));
|
|||
|
ui->lineEditRealtimerServerAddress->setPlaceholderText(tr("Input Realtimer Server Address"));
|
|||
|
ui->pushButtonClear->setText(tr("Clear Program"));
|
|||
|
ui->pushButtonCheckLog->setText(tr("Check Log"));
|
|||
|
|
|||
|
ui->pushButtonReadMinBrightness->setText(tr("Readback"));
|
|||
|
ui->pushButtonReadbackMaxBrightess->setText(tr("Readback"));
|
|||
|
ui->pushButtonSendMinBrightness->setText(tr("Send"));
|
|||
|
ui->pushButtonSendMaxBrightness->setText(tr("Send"));
|
|||
|
ui->label_2->setText(tr("Min brightness"));
|
|||
|
ui->label_4->setText(tr("(min:1)"));
|
|||
|
ui->label_3->setText(tr("Max brightness "));
|
|||
|
ui->label_5->setText(tr("(max:255)"));
|
|||
|
|
|||
|
ui->radioButton0degrees->setText(tr("0 degrees"));
|
|||
|
ui->radioButton90degrees->setText(tr("90 degrees"));
|
|||
|
ui->radioButton180degrees->setText(tr("180 degrees"));
|
|||
|
ui->radioButton270degrees->setText(tr("270 degrees"));
|
|||
|
ui->groupBoxRotate->setTitle(tr("Rotate"));
|
|||
|
|
|||
|
ui->groupBox->setTitle(tr("M80 configuration"));
|
|||
|
ui->groupBox_2->setTitle(tr("Taxi top screen configuration"));
|
|||
|
ui->pushButton_M80Set->setText(tr("Set"));
|
|||
|
ui->pushButton_M80Refresh->setText(tr("Refresh"));
|
|||
|
ui->pushButton_M80Restore->setText(tr("Restore to default"));
|
|||
|
ui->radioButtonHL->setText(tr("Service:High Out of service:Low"));
|
|||
|
ui->radioButtonLH->setText(tr("Service:Low Out of service:High"));
|
|||
|
ui->pushButtonSetTaxiTopScreen->setText(tr("Set"));
|
|||
|
ui->pushButtonReadbackTaxiTopScreen->setText(tr("Readback"));
|
|||
|
|
|||
|
ui->label_6->setText(tr("Alias"));
|
|||
|
ui->pushButtonSetAlias->setText(tr("Set"));
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnSetWebServerParam()
|
|||
|
{
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()<=1)
|
|||
|
{
|
|||
|
if(m_pLedCard==nullptr||m_pLedlist->count()==0)
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("NoSelectedController"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
QString strWebServerAddress=ui->comboBoxWebServerAddress->currentText();
|
|||
|
if(strWebServerAddress.isEmpty())
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("InputWebServerAddressTip"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
ui->lineEdit->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if(ui->lineEditCompanyId->text().isEmpty())
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("InputCompanyIdTip"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
ui->lineEditCompanyId->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
X_UIMsgBoxYesNoCancel *dlg = new X_UIMsgBoxYesNoCancel(tr("Tip Info"),tr("Do you want to modify webserveraddress and companyId?"), this);
|
|||
|
int iresult=dlg->exec();
|
|||
|
if(iresult== QDialog::Accepted && dlg->m_flagSave==1)
|
|||
|
{
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetOnlineAddr");
|
|||
|
json.insert("server", strWebServerAddress);
|
|||
|
json.insert("companyID", ui->lineEditCompanyId->text());
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetOnlineAddr"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnClearRealtimeServer()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
ui->lineEditRealtimerServerAddress->clear();
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetRealtimeServer");
|
|||
|
json.insert("server", "");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("ClearRealtimeServer"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnSetRealtimeServer()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
if(ui->lineEditRealtimerServerAddress->text().isEmpty())
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("InputRealTimeAddressTip"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
ui->lineEditRealtimerServerAddress->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetRealtimeServer");
|
|||
|
json.insert("server", ui->lineEditRealtimerServerAddress->text());
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetRealtimeServer"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
|
|||
|
void ControlAdvParamWidget::OnSetAlias()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
if(ui->lineEditAlias->text().isEmpty())
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("InputAliasTip"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
ui->lineEdit->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetCardAlias");
|
|||
|
json.insert("alias", qs2B64(ui->lineEditAlias->text()));
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetCardAlias"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnSetPhyPixels()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
if(ui->lineEdit->text().isEmpty())
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("InputWidthTip"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
ui->lineEdit->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
if(ui->lineEdit_2->text().isEmpty())
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("InputHeightTip"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
ui->lineEdit_2->setFocus();
|
|||
|
return;
|
|||
|
}
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetScreenSize");
|
|||
|
json.insert("width", ui->lineEdit->text().toInt());
|
|||
|
json.insert("height", ui->lineEdit_2->text().toInt());
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetScreenSize"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnStartConfigLedScreenSoft()
|
|||
|
{
|
|||
|
QString strAppPath=QApplication::applicationDirPath();
|
|||
|
strAppPath.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN);
|
|||
|
QString strLedSetFile=strAppPath+"/LedSet/LedSet3.0.exe";
|
|||
|
QFileInfo cc22(strLedSetFile);
|
|||
|
if(cc22.exists())
|
|||
|
{
|
|||
|
QProcess::startDetached(strLedSetFile,QStringList());
|
|||
|
}
|
|||
|
else {
|
|||
|
QString strReg = "HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\sysolution\\LedSet3.0";
|
|||
|
QSettings *reg = new QSettings(strReg,QSettings::NativeFormat);
|
|||
|
if(reg!=nullptr)//64位系统
|
|||
|
{
|
|||
|
QString strLedsetPath = reg->value("Program_path").toString();
|
|||
|
delete reg;
|
|||
|
QFileInfo cc(strLedsetPath);
|
|||
|
if(!strLedsetPath.isEmpty())
|
|||
|
{
|
|||
|
if(cc.exists())
|
|||
|
{
|
|||
|
QProcess::startDetached(strLedsetPath,QStringList());
|
|||
|
}
|
|||
|
else {
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Tip Info"),tr("Can not find LedSet3.0.exe,down you need download and install it")+strLedsetPath, this,1);
|
|||
|
|
|||
|
if(dlg->exec() == QDialog::Accepted)
|
|||
|
{
|
|||
|
UpdateLedset3Dialog *pDlg=new UpdateLedset3Dialog(this);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
QString strReg1 = "HKEY_LOCAL_MACHINE\\SOFTWARE\\sysolution\\LedSet3.0";
|
|||
|
QSettings *reg1 = new QSettings(strReg1,QSettings::NativeFormat);
|
|||
|
if(reg1!=nullptr)
|
|||
|
{
|
|||
|
QString strLedsetPath = reg1->value("Program_path").toString();
|
|||
|
delete reg1;
|
|||
|
QFileInfo cc(strLedsetPath);
|
|||
|
if(!strLedsetPath.isEmpty())
|
|||
|
{
|
|||
|
if(cc.exists())
|
|||
|
{
|
|||
|
QProcess::startDetached(strLedsetPath,QStringList());
|
|||
|
}
|
|||
|
else {
|
|||
|
QString str1="C:/Program Files/sysolution/LedSet3.0/LedSet3.0.exe";
|
|||
|
QFileInfo cc1(str1);
|
|||
|
if(cc1.exists())
|
|||
|
{
|
|||
|
QProcess::startDetached(str1,QStringList());
|
|||
|
}
|
|||
|
else {
|
|||
|
|
|||
|
QString str2="C:/Program Files (x86)/sysolution/LedSet3.0/LedSet3.0.exe";
|
|||
|
QFileInfo cc2(str1);
|
|||
|
if(cc2.exists())
|
|||
|
{
|
|||
|
QProcess::startDetached(str2,QStringList());
|
|||
|
}
|
|||
|
else {
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Tip Info"),tr("Can not find LedSet3.0.exe,down you need download and install it")+strLedsetPath, this,1);
|
|||
|
|
|||
|
if(dlg->exec() == QDialog::Accepted)
|
|||
|
{
|
|||
|
UpdateLedset3Dialog *pDlg=new UpdateLedset3Dialog(this);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
QString str1="C:/Program Files/sysolution/LedSet3.0/LedSet3.0.exe";
|
|||
|
QFileInfo cc1(str1);
|
|||
|
if(cc1.exists())
|
|||
|
{
|
|||
|
QProcess::startDetached(str1,QStringList());
|
|||
|
}
|
|||
|
else {
|
|||
|
|
|||
|
QString str2="C:/Program Files (x86)/sysolution/LedSet3.0/LedSet3.0.exe";
|
|||
|
QFileInfo cc2(str1);
|
|||
|
if(cc2.exists())
|
|||
|
{
|
|||
|
QProcess::startDetached(str2,QStringList());
|
|||
|
}
|
|||
|
else {
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Tip Info"),tr("Can not find LedSet3.0.exe,down you need download and install it")+strLedsetPath, this,1);
|
|||
|
|
|||
|
if(dlg->exec() == QDialog::Accepted)
|
|||
|
{
|
|||
|
UpdateLedset3Dialog *pDlg=new UpdateLedset3Dialog(this);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
QString str1="C:/Program Files/sysolution/LedSet3.0/LedSet3.0.exe";
|
|||
|
QFileInfo cc1(str1);
|
|||
|
if(cc1.exists())
|
|||
|
{
|
|||
|
QProcess::startDetached(str1,QStringList());
|
|||
|
}
|
|||
|
else {
|
|||
|
|
|||
|
QString str2="C:/Program Files (x86)/sysolution/LedSet3.0/LedSet3.0.exe";
|
|||
|
QFileInfo cc2(str1);
|
|||
|
if(cc2.exists())
|
|||
|
{
|
|||
|
QProcess::startDetached(str2,QStringList());
|
|||
|
}
|
|||
|
else {
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Tip Info"),tr("Can not find LedSet3.0.exe,down you need download and install it")+strLedsetPath, this,1);
|
|||
|
|
|||
|
if(dlg->exec() == QDialog::Accepted)
|
|||
|
{
|
|||
|
UpdateLedset3Dialog *pDlg=new UpdateLedset3Dialog(this);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else//32位系统
|
|||
|
{
|
|||
|
QString strReg1 = "HKEY_LOCAL_MACHINE\\SOFTWARE\\sysolution\\LedSet3.0";
|
|||
|
QSettings *reg1 = new QSettings(strReg1,QSettings::NativeFormat);
|
|||
|
if(reg1!=nullptr)
|
|||
|
{
|
|||
|
QString strLedsetPath = reg1->value("Program_path").toString();
|
|||
|
delete reg1;
|
|||
|
QFileInfo cc(strLedsetPath);
|
|||
|
if(!strLedsetPath.isEmpty())
|
|||
|
{
|
|||
|
if(cc.exists())
|
|||
|
{
|
|||
|
QProcess::startDetached(strLedsetPath,QStringList());
|
|||
|
}
|
|||
|
else {
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Tip Info"),tr("Can not find LedSet3.0.exe,down you need download and install it")+strLedsetPath, this,1);
|
|||
|
|
|||
|
if(dlg->exec() == QDialog::Accepted)
|
|||
|
{
|
|||
|
UpdateLedset3Dialog *pDlg=new UpdateLedset3Dialog(this);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *dlg = new X_UIMsgBoxOk(tr("Tip Info"),tr("Can not find LedSet3.0.exe,down you need download and install it")+strLedsetPath, this,1);
|
|||
|
|
|||
|
if(dlg->exec() == QDialog::Accepted)
|
|||
|
{
|
|||
|
UpdateLedset3Dialog *pDlg=new UpdateLedset3Dialog(this);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnRestart()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "RestartAndroid");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("RestartAndroid"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::onSelectedDeviceList(QList<LedCard*> *list)
|
|||
|
{
|
|||
|
m_pLedlist=list;
|
|||
|
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
|
|||
|
// if(m_bSelected )
|
|||
|
{
|
|||
|
//if(m_passwordOk)
|
|||
|
{
|
|||
|
if(m_pLedlist->count()==1)
|
|||
|
{
|
|||
|
ui->pushButtonSetPhyPixels->setEnabled(true);
|
|||
|
ui->pushButtonStartConfigLedScreenSoft->setEnabled(true);
|
|||
|
|
|||
|
|
|||
|
ui->pushButtonSoftUpgrade->setEnabled(true);
|
|||
|
ui->pushButtonApkCheck->setEnabled(true);
|
|||
|
ui->pushButton_unistall->setEnabled(true);
|
|||
|
ui->pushButtonRunningCheck->setEnabled(true);
|
|||
|
ui->pushButtonFpgaUpgrade->setEnabled(true);
|
|||
|
ui->pushButtonFpgaVerCheck->setEnabled(true);
|
|||
|
ui->pushButtonSyncFpgaVer->setEnabled(true);
|
|||
|
ui->pushButtonRestart->setEnabled(true);
|
|||
|
ui->pushButtonClear->setEnabled(true);
|
|||
|
ui->pushButtonCheckLog->setEnabled(true);
|
|||
|
|
|||
|
|
|||
|
//ui->pushButtonSetREaltimeServer->setEnabled(true);
|
|||
|
if(m_pLedCard!=nullptr)
|
|||
|
{
|
|||
|
if(m_pLedCard->m_strCardId.left(2)=="M8"||m_pLedCard->m_strCardId.left(2)=="m8")
|
|||
|
{
|
|||
|
ui->groupBox->setVisible(true);
|
|||
|
}
|
|||
|
else {
|
|||
|
ui->groupBox->setVisible(false);
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
//alahover 20211118 ui->pushButtonSetPhyPixels->setEnabled(false);
|
|||
|
ui->pushButtonStartConfigLedScreenSoft->setEnabled(true);
|
|||
|
ui->pushButtonSoftUpgrade->setEnabled(false);
|
|||
|
ui->pushButtonApkCheck->setEnabled(false);
|
|||
|
ui->pushButton_unistall->setEnabled(false);
|
|||
|
ui->pushButtonRunningCheck->setEnabled(false);
|
|||
|
ui->pushButtonFpgaUpgrade->setEnabled(false);
|
|||
|
ui->pushButtonFpgaVerCheck->setEnabled(false);
|
|||
|
ui->pushButtonSyncFpgaVer->setEnabled(false);
|
|||
|
ui->pushButtonRestart->setEnabled(false);
|
|||
|
ui->pushButtonClear->setEnabled(false);
|
|||
|
ui->pushButtonCheckLog->setEnabled(false);
|
|||
|
//ui->pushButtonSetREaltimeServer->setEnabled(false);
|
|||
|
ui->groupBox->setVisible(true);
|
|||
|
}
|
|||
|
}
|
|||
|
//else {
|
|||
|
// ui->pushButtonSetPhyPixels->setEnabled(false);
|
|||
|
// ui->pushButtonStartConfigLedScreenSoft->setEnabled(false);
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
MACRO_DEFINE_CONTROL_FUNC3
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
#include "LoUIClass/changepasswordform.h"
|
|||
|
|
|||
|
void ControlAdvParamWidget::OnControlTypeSwitchIndexChanged(int index)
|
|||
|
{
|
|||
|
if(index==ENUM_CONTRL_WIDGET_ADVPARAM)
|
|||
|
{
|
|||
|
this->hide();
|
|||
|
|
|||
|
if(!m_passwordOk)
|
|||
|
{
|
|||
|
InputPasswordDialog *pDlg=new InputPasswordDialog(this,2);
|
|||
|
pDlg->ShowChangePassword();
|
|||
|
connect(pDlg, SIGNAL(sigAcceptData(QString)), this, SLOT(onInputPasswordPro(QString)));
|
|||
|
pDlg->setWindowModality(Qt::WindowModal);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
this->show();
|
|||
|
}
|
|||
|
m_bSelected=true;
|
|||
|
if(m_pLedCard!=nullptr)
|
|||
|
onReadbackAllThisPage();
|
|||
|
ui->lineEdit->setFocus();
|
|||
|
}
|
|||
|
else {
|
|||
|
m_bSelected=false;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
QString ControlAdvParamWidget::GetPasswordPro()
|
|||
|
{
|
|||
|
LoAppConfig *cfg = LoAppConfig::getInstance();
|
|||
|
QSettings *settings = new QSettings(cfg->OrganizationName(), cfg->ApplicationName());
|
|||
|
#ifndef MACRO_YUANHENG_VERSION
|
|||
|
QString strMiWenPs=settings->value("advUiPs").toString();
|
|||
|
#else
|
|||
|
QString strMiWenPs=settings->value("advUiPs_YuanHeng").toString();
|
|||
|
|
|||
|
#endif
|
|||
|
QString result = QTextCodec::codecForName("GBK")->toUnicode(QByteArray::fromBase64(strMiWenPs.toLocal8Bit()));
|
|||
|
|
|||
|
QString strPs=result;
|
|||
|
|
|||
|
if(strPs.isEmpty())
|
|||
|
{
|
|||
|
#ifndef MACRO_YUANHENG_VERSION
|
|||
|
return "888";
|
|||
|
#else
|
|||
|
return "Cargo10065!@#";
|
|||
|
|
|||
|
#endif
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
return strPs;
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::onInputPasswordPro(QString strPassword)
|
|||
|
{
|
|||
|
// #ifndef MACRO_YUANHENG_VERSION
|
|||
|
// if(strPassword==GetPasswordPro())
|
|||
|
// #else
|
|||
|
// if(strPassword=="Cargo10065!@#")
|
|||
|
// #endif
|
|||
|
if(strPassword==GetPasswordPro())
|
|||
|
{
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()==1)
|
|||
|
{
|
|||
|
|
|||
|
ui->pushButtonSetPhyPixels->setEnabled(true);
|
|||
|
}
|
|||
|
else {
|
|||
|
//alahover 20211118 ui->pushButtonSetPhyPixels->setEnabled(false);
|
|||
|
|
|||
|
}
|
|||
|
ui->pushButtonStartConfigLedScreenSoft->setEnabled(true);
|
|||
|
m_passwordOk=true;
|
|||
|
this->show();
|
|||
|
}
|
|||
|
else {
|
|||
|
//alahover 20211118 ui->pushButtonSetPhyPixels->setEnabled(false);
|
|||
|
ui->pushButtonStartConfigLedScreenSoft->setEnabled(false);
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("Password is error"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
m_passwordOk=false;
|
|||
|
this->hide();
|
|||
|
InputPasswordDialog *pDlg1=new InputPasswordDialog(this,2);
|
|||
|
pDlg1->ShowChangePassword();
|
|||
|
connect(pDlg1, SIGNAL(sigAcceptData(QString)), this, SLOT(onInputPasswordPro(QString)));
|
|||
|
pDlg1->setWindowModality(Qt::WindowModal);
|
|||
|
pDlg1->exec();
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::onReadbackAllThisPage()
|
|||
|
{
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()!=1)
|
|||
|
{
|
|||
|
ui->groupBox->setVisible(true);
|
|||
|
return;
|
|||
|
}
|
|||
|
else {
|
|||
|
if(m_pLedCard!=nullptr)
|
|||
|
{
|
|||
|
if(m_pLedCard->m_strCardId.left(2)=="M8"||m_pLedCard->m_strCardId.left(2)=="m8")
|
|||
|
ui->groupBox->setVisible(true);
|
|||
|
else
|
|||
|
ui->groupBox->setVisible(false);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetScreenSize");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json);
|
|||
|
|
|||
|
QJsonObject json1;
|
|||
|
json1.insert("_id", getRandomString(10));
|
|||
|
json1.insert("_type", "GetOnlineAddr");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json1);
|
|||
|
|
|||
|
QJsonObject json2;
|
|||
|
json2.insert("_id", getRandomString(10));
|
|||
|
json2.insert("_type", "GetRealtimeServer");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json2);
|
|||
|
|
|||
|
QJsonObject json3;
|
|||
|
json3.insert("_id", getRandomString(10));
|
|||
|
json3.insert("_type", "GetCardAlias");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json3);
|
|||
|
|
|||
|
if(m_pLedCard!=nullptr)
|
|||
|
{
|
|||
|
if(m_pLedCard->m_strCardId.contains("m8")||m_pLedCard->m_strCardId.contains("M8"))
|
|||
|
{
|
|||
|
|
|||
|
QJsonObject json3;
|
|||
|
json3.insert("_id", getRandomString(10));
|
|||
|
json3.insert("_type", "GetAllScreenSizeM80");
|
|||
|
qDebug()<<"GetAllScreenSizeM80 send";
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json3);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
//获取到httpPost的应答,如果参数变化需要出发修改控件item的内容
|
|||
|
void ControlAdvParamWidget::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;
|
|||
|
qDebug()<<m_pLedCard->m_strCardId +"---------"+ strType;
|
|||
|
if(strType == "SetScreenSize")
|
|||
|
{
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "SetCardAlias"){
|
|||
|
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if(strType == "SetOnlineAddr"){
|
|||
|
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if(strType == "SetRealtimeServer"){
|
|||
|
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if(strType == "RestartAndroid"){
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "GetScreenshotFull"){
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "AliIotSetting")
|
|||
|
{
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if(strType == "GetOnlineAddr"){
|
|||
|
ui->comboBoxWebServerAddress->setCurrentText(jsonObject["server"].toString());
|
|||
|
ui->lineEditCompanyId->setText(jsonObject["companuID"].toString());
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if(strType == "GetRealtimeServer"){
|
|||
|
ui->lineEditRealtimerServerAddress->setText(jsonObject["server"].toString());
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if(strType == "GetCardAlias")
|
|||
|
{
|
|||
|
ui->lineEditAlias->setText(b64ToQs(jsonObject["alias"].toString()));
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
}
|
|||
|
else if(strType =="UpgradeSoftware")
|
|||
|
{
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("UpgradeSoftware")+tr("Success"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "UninstallSoftware"){
|
|||
|
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "SynchronousHardwareVersion"){
|
|||
|
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("SynchronousHardwareVersion")+tr("Success"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "DelPrograms")
|
|||
|
{
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "SetScreenRotation")
|
|||
|
{
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "SetMinBrightness")
|
|||
|
{
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if(strType == "SetMaxBrightness")
|
|||
|
{
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if(strType == "GetMinBrightness")
|
|||
|
{
|
|||
|
|
|||
|
ui->lineEdit_3->setText(QString::number(jsonObject["brightness"].toInt()));
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if(strType == "GetMaxBrightness")
|
|||
|
{
|
|||
|
ui->lineEdit_4->setText(QString::number(jsonObject["brightness"].toInt()));
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if(strType == "GetSpecialResolution")
|
|||
|
{
|
|||
|
|
|||
|
QString strCurDisplayResolution = jsonObject["displayResolution"].toString();
|
|||
|
ui->comboBox_2->setCurrentText(strCurDisplayResolution);
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
|
|||
|
else if(strType == "CheckHardwareVersions"){
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
QString strtempVer="";
|
|||
|
int itempVerCount=0;
|
|||
|
foreach(QJsonValue value, jsonObject["versions"].toArray()) {
|
|||
|
QString strtempIcount=QString::number(itempVerCount);
|
|||
|
strtempVer += "[card"+strtempIcount+"]:"+value.toString()+"\r\n";
|
|||
|
itempVerCount++;
|
|||
|
|
|||
|
}
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("FPGA Version"),strtempVer,this,1);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "IsSoftwareRunning"){
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
if(jsonObject["running"].toBool())
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("running"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("no running"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
else if (strType == "SetHighForBusy") {
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "OpenAdb")
|
|||
|
{
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
}
|
|||
|
else if (strType == "GetStateForBusy") {
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
if(jsonObject["result"].toInt()==0)
|
|||
|
{
|
|||
|
ui->radioButtonLH->setChecked(true);
|
|||
|
ui->radioButtonHL->setChecked(false);
|
|||
|
}
|
|||
|
else {
|
|||
|
ui->radioButtonLH->setChecked(false);
|
|||
|
ui->radioButtonHL->setChecked(true);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
else if(strType == "CheckSoftVersions"){
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
ui->comboBox->clear();
|
|||
|
QString strTip="";
|
|||
|
QStringList strtempApkPackList;
|
|||
|
foreach(QJsonValue value, jsonObject["apps"].toArray()) {
|
|||
|
QJsonObject oApp = value.toObject();
|
|||
|
QString strtempApkPackageName=oApp["packageName"].toString();
|
|||
|
QString strtempVersion=oApp["versionName"].toString();
|
|||
|
strtempApkPackList.append(strtempApkPackageName);
|
|||
|
strTip+=strtempApkPackageName+"["+tr("version")+":"+ strtempVersion +"]\r\n";
|
|||
|
|
|||
|
}
|
|||
|
ui->comboBox->addItems(strtempApkPackList);
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),strTip,this,1);
|
|||
|
pDlg->exec();
|
|||
|
}
|
|||
|
// else {
|
|||
|
|
|||
|
// MACRO_ASKTIME_STOP
|
|||
|
// MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
else {
|
|||
|
if(strType =="UpgradeSoftware")
|
|||
|
{
|
|||
|
qDebug()<<"slotUploadFinished failed ack";
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
if(url == m_strStartUrl)
|
|||
|
{
|
|||
|
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();
|
|||
|
if(jsonObject["result"].toString()=="true")
|
|||
|
{
|
|||
|
if(jsonObject["data"].toString()=="true")
|
|||
|
{
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
MACRO_POSTING_DLG_UNLOCK
|
|||
|
QJsonObject json1;
|
|||
|
json1.insert("_id", getRandomString(10));
|
|||
|
json1.insert("_type", "GetOnlineAddr");
|
|||
|
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json1);
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
//获取到httpPost的应答,如果参数变化需要出发修改控件item的内容
|
|||
|
void ControlAdvParamWidget::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 == "GetScreenSize")
|
|||
|
{
|
|||
|
ui->lineEdit->setText(QString::number(jsonObject["width"].toInt()));
|
|||
|
ui->lineEdit_2->setText(QString::number(jsonObject["height"].toInt()));
|
|||
|
}
|
|||
|
|
|||
|
else if(strType == "GetCardAlias")
|
|||
|
{
|
|||
|
ui->lineEditAlias->setText(b64ToQs(jsonObject["alias"].toString()));
|
|||
|
|
|||
|
}
|
|||
|
else if(strType == "GetOnlineAddr")
|
|||
|
{
|
|||
|
ui->comboBoxWebServerAddress->setCurrentText(jsonObject["server"].toString());
|
|||
|
ui->lineEditCompanyId->setText(jsonObject["companuID"].toString());
|
|||
|
}
|
|||
|
else if(strType == "GetRealtimeServer")
|
|||
|
{
|
|||
|
qDebug()<<"GetRealtimeServer ack"<<jsonObject["server"].toString();
|
|||
|
ui->lineEditRealtimerServerAddress->setText(jsonObject["server"].toString());
|
|||
|
}
|
|||
|
else if(strType == "GetAllScreenSizeM80")
|
|||
|
{
|
|||
|
oM80ResolutionsObject=jsonObject["result"].toObject();
|
|||
|
QStringList strlist=oM80ResolutionsObject.keys();
|
|||
|
ui->comboBox_2->clear();
|
|||
|
ui->comboBox_2->addItems(strlist);
|
|||
|
ui->lineEditRealtimerServerAddress->setText(jsonObject["server"].toString());
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ControlAdvParamWidget::OnSoftUpgrade()
|
|||
|
{
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()<=1)
|
|||
|
{
|
|||
|
if(m_pLedCard!=nullptr)
|
|||
|
{
|
|||
|
OnSyncFirmware();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
// UpgradeApkDialog *pDlg=new UpgradeApkDialog(this,"","");
|
|||
|
// pDlg->exec();
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnApkCheck()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "CheckSoftVersions");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("CheckSoftVersions"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnUnistall()
|
|||
|
{
|
|||
|
if(ui->comboBox->currentText().isEmpty())
|
|||
|
return;
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "UninstallSoftware");
|
|||
|
json.insert("packageName", ui->comboBox->currentText());
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("UninstallSoftware"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnRunningCheck()
|
|||
|
{
|
|||
|
if(ui->comboBox->currentText().isEmpty())
|
|||
|
return;
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "IsSoftwareRunning");
|
|||
|
json.insert("packageName", ui->comboBox->currentText());//包名需要填写?
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("IsSoftwareRunning"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnFpgaUpgrade()
|
|||
|
{
|
|||
|
QString url="http://"+m_pLedCard->m_strCardIp+":2016/upload?type=hardware";
|
|||
|
QFileDialog dlg;
|
|||
|
m_strUpgradeFpgaFile = QFileDialog::getOpenFileName(this, "open file dialog",
|
|||
|
"",
|
|||
|
tr("apk package (*.rpd)"));
|
|||
|
QFileInfo file1(m_strUpgradeFpgaFile);
|
|||
|
QFile file(m_strUpgradeFpgaFile);
|
|||
|
QMap<QString,QString> params_send; //上传的普通参数 在本程序中 需要上传一个普通参数为"username"
|
|||
|
params_send.insert("username","10005");
|
|||
|
UpLoadForm(url,params_send,file1.fileName(),&file,file1.fileName(),1);
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnFpgaVerCheck()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "CheckHardwareVersions");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("CheckHardwareVersions"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnSyncFpgaVer()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SynchronousHardwareVersion");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SynchronousHardwareVersion"),tr("Check Screen untile fpga update finished"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnCheckLog()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
qDebug()<<"OnCheckLog";
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()<=1)
|
|||
|
{
|
|||
|
if(m_pLedCard!=nullptr)
|
|||
|
{
|
|||
|
QString strTempUrl="http://"+m_pLedCard->m_strCardIp+":2016/download?file=logs";
|
|||
|
qDebug()<<strTempUrl;
|
|||
|
pHpptClient->httpGet(strTempUrl);
|
|||
|
}
|
|||
|
}
|
|||
|
// else {
|
|||
|
// emit sigSend(json,TIP);
|
|||
|
// }
|
|||
|
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnClearPrograms()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
|
|||
|
|
|||
|
// QJsonObject json;//=new QJsonObject(new LinkedHashMap());
|
|||
|
// json.insert("_type", "DelPrograms");
|
|||
|
// json.insert("_id", getRandomString(10));
|
|||
|
// json.insert("zVer","xixun1");
|
|||
|
|
|||
|
|
|||
|
// QVariantHash subData1;
|
|||
|
// subData1.insert("_type", "DelPrograms");
|
|||
|
// subData1.insert("_id", getRandomString(10));
|
|||
|
// subData1.insert("zVer","xixun1");
|
|||
|
// QJsonObject json = QJsonObject::fromVariantHash(subData1);
|
|||
|
// QVariantMap subData1;
|
|||
|
|
|||
|
// subData1.insert(const_iterator pos 0,"_type", "DelPrograms");
|
|||
|
// subData1.insert(1,"_id", getRandomString(10));
|
|||
|
// subData1.insert(2,"zVer","xixun1");
|
|||
|
// QJsonObject json = QJsonObject::fromVariantMap(subData1);
|
|||
|
|
|||
|
// QJsonDocument doc1;
|
|||
|
// doc1.setObject(json);
|
|||
|
// int itempLength=json.length();
|
|||
|
if(m_pLedCard==nullptr)
|
|||
|
return;
|
|||
|
QByteArray sendArray;// = doc1.toJson(QJsonDocument::Compact);
|
|||
|
|
|||
|
sendArray.append("{");
|
|||
|
sendArray.append("\"_type\":\"DelPrograms\"");
|
|||
|
sendArray.append(",\"_id\":\""+getRandomString(10)+"\"");
|
|||
|
sendArray.append(",\"zVer\":\"xixun1\"");
|
|||
|
sendArray.append("}");
|
|||
|
|
|||
|
|
|||
|
QTcpSocket *send = new QTcpSocket();
|
|||
|
send->connectToHost(QHostAddress(m_pLedCard->m_strCardIp),3333);
|
|||
|
if(!send->waitForConnected(10000)) //等待连接返回
|
|||
|
{
|
|||
|
return ;
|
|||
|
}
|
|||
|
qint64 iSendLength=send->write(sendArray,sendArray.length());
|
|||
|
qDebug()<<"iSendLength="<<iSendLength<<",itempLength="<<sendArray.length();
|
|||
|
if(!send->waitForBytesWritten(3000))
|
|||
|
{
|
|||
|
qDebug()<<"socket write timeout!";
|
|||
|
return ;
|
|||
|
}
|
|||
|
|
|||
|
if(send->waitForReadyRead(5000))
|
|||
|
{
|
|||
|
QByteArray readBuf=send->read(send->bytesAvailable());
|
|||
|
QJsonParseError parseJsonErr;
|
|||
|
QJsonDocument document = QJsonDocument::fromJson(readBuf,&parseJsonErr);
|
|||
|
QJsonObject jsonObject = document.object();
|
|||
|
if(jsonObject["success"].toBool())
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("Clear program successed!"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
qDebug()<<"tcpsocket read result successed";
|
|||
|
}
|
|||
|
else {
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("Clear program failed!"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
qDebug()<<"tcpsocket read result failed";
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("Clear program timeout!"),this,1);
|
|||
|
pDlg->exec();
|
|||
|
qDebug()<<"tcpsocket read timeout";
|
|||
|
}
|
|||
|
send->close();
|
|||
|
delete send;
|
|||
|
}
|
|||
|
|
|||
|
void ControlAdvParamWidget::OnSyncFirmware()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
if(m_pLedCard->bPassword)
|
|||
|
{
|
|||
|
if(m_pLedCard->m_bLockStatus&& m_lockFlag == true)
|
|||
|
{
|
|||
|
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("This screen is encrypted,Please decrypt and upgrade APK!"),this,0);
|
|||
|
pDlg->exec();
|
|||
|
return;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
QString url="http://"+m_pLedCard->m_strCardIp+":2016/upload?type=software";
|
|||
|
QFileDialog dlg;
|
|||
|
m_strUpgradeApkFile = QFileDialog::getOpenFileName(this, "open file dialog",
|
|||
|
"",
|
|||
|
tr("apk package (*.apk *.zip)"));
|
|||
|
QFileInfo file1(m_strUpgradeApkFile);
|
|||
|
QFile file(m_strUpgradeApkFile);
|
|||
|
QMap<QString,QString> params_send; //上传的普通参数 在本程序中 需要上传一个普通参数为"username"
|
|||
|
params_send.insert("username","10005");
|
|||
|
UpLoadForm(url,params_send,file1.fileName(),&file,file1.fileName(),0);
|
|||
|
//UpLoadForm(url,file1.fileName(),&file,file1.fileName());
|
|||
|
}
|
|||
|
|
|||
|
void ControlAdvParamWidget::slotUploadFpgaFinished()
|
|||
|
{
|
|||
|
QFileInfo file(m_strUpgradeApkFile);
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SynchronousHardwareVersion");
|
|||
|
HttpPostByTypeJsonObject(pHpptClient,m_strUrl,json);
|
|||
|
emit sigSetTipTextContent(tr("SynchronousHardwareVersion"));
|
|||
|
qDebug()<<"slotUploadFinished";
|
|||
|
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::slotUploadFinished()
|
|||
|
{
|
|||
|
QFileInfo file(m_strUpgradeApkFile);
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "UpgradeSoftware");
|
|||
|
json.insert("fileName", file.fileName());
|
|||
|
json.insert("isCustom", true);
|
|||
|
HttpPostByTypeJsonObject(pHpptClient,m_strUrl,json);
|
|||
|
emit sigSetTipTextContent(tr("install start..."));
|
|||
|
MACRO_ASKTIME_STOP
|
|||
|
m_pGetAskTimer->start(50000);
|
|||
|
|
|||
|
qDebug()<<"slotUploadFinished";
|
|||
|
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::slotUploadProgress(qint64 A,qint64 B)
|
|||
|
{
|
|||
|
if(B!=0)
|
|||
|
{
|
|||
|
QString strbaifenbi=tr("Uploadding")+":"+QString("%1%").arg(A*100/B);
|
|||
|
emit sigSetTipTextContent(strbaifenbi);
|
|||
|
m_pGetAskTimer->stop();
|
|||
|
m_pGetAskTimer->start(30000);
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
void ControlAdvParamWidget::UpLoadForm(QString Path,QMap<QString,QString> params,QString fileFormName,QFile *uploadFile,QString newFileName,int iType)
|
|||
|
{
|
|||
|
QString BOUNDARY=QUuid::createUuid().toString();
|
|||
|
QByteArray sb=QByteArray();
|
|||
|
//先上传普通的表单数据
|
|||
|
// for(QMap<QString,QString>::Iteratort=params.begin();t!=params.end();t++)
|
|||
|
for(QMap<QString,QString>::iterator t=params.begin();t!=params.end();t++)
|
|||
|
{
|
|||
|
sb.append("--"+BOUNDARY+"\r\n");
|
|||
|
sb.append(QString("Content-Disposition: form-data;name=\"")+t.key()+QString("\"")+QString("\r\n"));
|
|||
|
sb.append("\r\n");
|
|||
|
sb.append(t.value()+"\r\n");
|
|||
|
}
|
|||
|
//上传文件的头部
|
|||
|
sb.append("--"+BOUNDARY+"\r\n");
|
|||
|
sb.append(QString("Content-Disposition: form-data;name=\"")+fileFormName+QString("\";filename=\"")+newFileName+QString("\"")+QString("\r\n"));
|
|||
|
sb.append("\r\n");
|
|||
|
//上传文件内容
|
|||
|
if(!uploadFile->open(QIODevice::ReadOnly)){
|
|||
|
return;
|
|||
|
}
|
|||
|
sb.append(uploadFile->readAll());
|
|||
|
sb.append("\r\n");
|
|||
|
sb.append("--"+BOUNDARY+"\r\n");
|
|||
|
|
|||
|
//编辑HTTP头部
|
|||
|
|
|||
|
QNetworkAccessManager *_uploadManager=new QNetworkAccessManager();
|
|||
|
QNetworkRequest request=QNetworkRequest(QUrl(Path));
|
|||
|
request.setRawHeader(QString("Content-Type").toLatin1(),QString("multipart/form-data;boundary="+BOUNDARY).toLatin1());
|
|||
|
request.setRawHeader(QString("Content-Length").toLatin1(),QString::number(sb.length()).toLatin1());
|
|||
|
//执行post请求
|
|||
|
if(m_PostingDlg==nullptr)
|
|||
|
{
|
|||
|
m_PostingDlg = new LoEmptyDialog();
|
|||
|
connect(m_PostingDlg,SIGNAL(sigClose()),this,SLOT(DeletePostingDlg()));
|
|||
|
connect(m_pGetAskTimer,SIGNAL(timeout()),m_PostingDlg,SLOT(TimerOutUnlock()));
|
|||
|
m_PostingDlg->lock(tr("UpgradeSoftware"),tr("Success"),tr("UpgradeSoftware")+tr("failed"));
|
|||
|
m_pGetAskTimer->start(60000);
|
|||
|
QNetworkReply * m_netReply =_uploadManager->post(request,sb);
|
|||
|
connect(m_netReply, SIGNAL(uploadProgress(qint64,qint64)), this, SLOT(slotUploadProgress(qint64,qint64)));
|
|||
|
connect(this, SIGNAL(sigSetTipTextContent ( QString )), m_PostingDlg, SLOT( SetTipTextContent(QString)));
|
|||
|
if(iType==0)//apk
|
|||
|
{
|
|||
|
connect(m_netReply, SIGNAL(finished()), this, SLOT(slotUploadFinished()));
|
|||
|
|
|||
|
}
|
|||
|
else if(iType==1)//fpga.rpd
|
|||
|
{
|
|||
|
connect(m_netReply, SIGNAL(finished()), this, SLOT(slotUploadFpgaFinished()));
|
|||
|
|
|||
|
}
|
|||
|
m_PostingDlg->exec();
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
//void ControlAdvParamWidget::UpLoadForm(QString Path,QString fileFormName,QFile *uploadFile,QString newFileName)
|
|||
|
//void ControlAdvParamWidget::UpLoadForm(QString Path,QMap<QString,QString> params,QString fileFormName,QFile *uploadFile,QString newFileName,int iType)
|
|||
|
//{
|
|||
|
// QString BOUNDARY=QUuid::createUuid().toString();
|
|||
|
// QByteArray sb=QByteArray();
|
|||
|
// //先上传普通的表单数据
|
|||
|
//// for(QMap<QString,QString>::Iteratort=params.begin();t!=params.end();t++)
|
|||
|
// for(QMap<QString,QString>::iterator t=params.begin();t!=params.end();t++)
|
|||
|
// {
|
|||
|
// sb.append("--"+BOUNDARY+"\r\n");
|
|||
|
// sb.append(QString("Content-Disposition: form-data;name=\"")+t.key()+QString("\"")+QString("\r\n"));
|
|||
|
// sb.append("\r\n");
|
|||
|
// sb.append(t.value()+"\r\n");
|
|||
|
// }
|
|||
|
// //上传文件的头部
|
|||
|
// sb.append("--"+BOUNDARY+"\r\n");
|
|||
|
// sb.append(QString("Content-Disposition: form-data;name=\"")+fileFormName+QString("\";filename=\"")+newFileName+QString("\"")+QString("\r\n"));
|
|||
|
// sb.append("\r\n");
|
|||
|
// //上传文件内容
|
|||
|
// if(!uploadFile->open(QIODevice::ReadOnly)){
|
|||
|
// return;
|
|||
|
// }
|
|||
|
// sb.append(uploadFile->readAll());
|
|||
|
// sb.append("\r\n");
|
|||
|
// sb.append("--"+BOUNDARY+"\r\n");
|
|||
|
|
|||
|
// //编辑HTTP头部
|
|||
|
// QNetworkAccessManager *_uploadManager=new QNetworkAccessManager();
|
|||
|
// QNetworkRequest request=QNetworkRequest(QUrl(Path));
|
|||
|
// request.setRawHeader(QString("Content-Type").toLatin1(),QString("multipart/form-data;boundary="+BOUNDARY).toLatin1());
|
|||
|
// request.setRawHeader(QString("Content-Length").toLatin1(),QString::number(sb.length()).toLatin1());
|
|||
|
// //执行post请求
|
|||
|
// if(m_PostingDlg==nullptr)
|
|||
|
// {
|
|||
|
// m_PostingDlg = new LoEmptyDialog();
|
|||
|
// connect(m_PostingDlg,SIGNAL(sigClose()),this,SLOT(DeletePostingDlg()));
|
|||
|
// connect(m_pGetAskTimer,SIGNAL(timeout()),m_PostingDlg,SLOT(TimerOutUnlock()));
|
|||
|
// m_PostingDlg->lock(tr("UpgradeSoftware"),tr("Success"),tr("UpgradeSoftware")+tr("failed"));
|
|||
|
// m_pGetAskTimer->start(60000);
|
|||
|
// QNetworkReply * m_netReply =_uploadManager->post(request,sb);
|
|||
|
// connect(m_netReply, SIGNAL(uploadProgress ( qint64 ,qint64 )), this, SLOT( slotUploadProgress(qint64 ,qint64)));
|
|||
|
// connect(this, SIGNAL(sigSetTipTextContent ( QString )), m_PostingDlg, SLOT( SetTipTextContent(QString)));
|
|||
|
// if(iType==0)//apk
|
|||
|
// {
|
|||
|
// connect(m_netReply, SIGNAL(finished()), this, SLOT(slotUploadFinished()));
|
|||
|
|
|||
|
// }
|
|||
|
// else if(iType==1)//fpga.rpd
|
|||
|
// {
|
|||
|
// connect(m_netReply, SIGNAL(finished()), this, SLOT(slotUploadFpgaFinished()));
|
|||
|
|
|||
|
// }
|
|||
|
// m_PostingDlg->exec();
|
|||
|
// }
|
|||
|
|
|||
|
|
|||
|
//}
|
|||
|
void ControlAdvParamWidget::OnProHttpGetResponse(QString url, QByteArray data)
|
|||
|
{
|
|||
|
if(url!="")
|
|||
|
{
|
|||
|
//QString str = QString(data);
|
|||
|
QString strAppPath=QApplication::applicationDirPath();
|
|||
|
strAppPath.replace(MACRO_DANYINFANXIEGAN, MACRO_DANYINXIEGAN);
|
|||
|
|
|||
|
QString strLogFile=strAppPath+"/"+m_pLedCard->m_strCardId+"_log.txt";
|
|||
|
QFile fileTemp(strLogFile);
|
|||
|
fileTemp.remove();
|
|||
|
QFile file(strLogFile);
|
|||
|
|
|||
|
if(!file.open(QIODevice::WriteOnly|QIODevice::Text|QIODevice::Append))
|
|||
|
{
|
|||
|
QMessageBox::warning(this,"sdf","can't open",QMessageBox::Yes);
|
|||
|
}
|
|||
|
QTextStream stream(&file);
|
|||
|
//stream<<str<<"\n";
|
|||
|
stream<<data<<"\n";
|
|||
|
file.close();
|
|||
|
QProcess process;
|
|||
|
process.execute("notepad "+strLogFile);//打开
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::keyPressEvent(QKeyEvent *ev)
|
|||
|
{
|
|||
|
if(ev->key() == Qt::Key_F5)
|
|||
|
{
|
|||
|
if(ui->groupBoxRotate->isVisible())
|
|||
|
ui->groupBoxRotate->setVisible(false);
|
|||
|
else
|
|||
|
ui->groupBoxRotate->setVisible(true);
|
|||
|
}
|
|||
|
else if(ev->key() == Qt::Key_F3)
|
|||
|
{
|
|||
|
m_lockFlag=false;
|
|||
|
}
|
|||
|
else if(ev->key() == Qt::Key_F6)
|
|||
|
{
|
|||
|
if(ui->groupBoxMinMaxBrightness->isVisible())
|
|||
|
ui->groupBoxMinMaxBrightness->setVisible(false);
|
|||
|
else
|
|||
|
ui->groupBoxMinMaxBrightness->setVisible(true);
|
|||
|
}
|
|||
|
else if(ev->key() == Qt::Key_F7)
|
|||
|
{
|
|||
|
if(ui->groupBox_3->isVisible())
|
|||
|
ui->groupBox_3->setVisible(false);
|
|||
|
else
|
|||
|
ui->groupBox_3->setVisible(true);
|
|||
|
}
|
|||
|
else if(ev->key() == Qt::Key_F8)
|
|||
|
{
|
|||
|
if(ui->groupBox_2->isVisible())
|
|||
|
ui->groupBox_2->setVisible(false);
|
|||
|
else
|
|||
|
ui->groupBox_2->setVisible(true);
|
|||
|
}
|
|||
|
else if(ev->key() == Qt::Key_F12)
|
|||
|
{
|
|||
|
setDebugOutput( "d://%1.log", true );
|
|||
|
}
|
|||
|
|
|||
|
QWidget::keyPressEvent(ev);
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::mousePressEvent(QMouseEvent *event)
|
|||
|
{
|
|||
|
if(event->button()==Qt::RightButton)
|
|||
|
{
|
|||
|
ui->groupBox_3->setVisible(true);
|
|||
|
ui->groupBox_4->setVisible(true);
|
|||
|
ui->checkBox_ADB->setVisible(true);
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::On0degrees()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetScreenRotation");
|
|||
|
json.insert("rotation", 0);
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetScreenRotation"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
|
|||
|
void ControlAdvParamWidget::On90degrees()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetScreenRotation");
|
|||
|
json.insert("rotation", 1);
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetScreenRotation"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::On180degrees()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetScreenRotation");
|
|||
|
json.insert("rotation", 2);
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetScreenRotation"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::On270degrees()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetScreenRotation");
|
|||
|
json.insert("rotation", 3);
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetScreenRotation"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnSendMinBrightness()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetMinBrightness");
|
|||
|
json.insert("brightness", ui->lineEdit_3->text().toInt());
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetMinBrightness"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnSendMaxBrightness()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetMaxBrightness");
|
|||
|
json.insert("brightness", ui->lineEdit_4->text().toInt());
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetMaxBrightness"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnGetMinBrightness()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetMinBrightness");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("GetMinBrightness"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnGetMaxBrightness()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetMaxBrightness");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("GetMaxBrightness"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
|
|||
|
void ControlAdvParamWidget::OnM80Set()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetSpecialResolution");
|
|||
|
json.insert("displayResolution",ui->comboBox_2->currentText()), //显示分辨率
|
|||
|
json.insert("totalResolution",oM80ResolutionsObject[ui->comboBox_2->currentText()].toString() ); //显示分辨率
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetSpecialResolution"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
|
|||
|
void ControlAdvParamWidget::OnM80Refresh()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetSpecialResolution");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("GetSpecialResolution"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
|
|||
|
void ControlAdvParamWidget::OnM80Restore()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "CleanDisplayScreenSize");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("CleanDisplayScreenSize"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnSetTaxiTopScreen()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "SetHighForBusy");
|
|||
|
if(ui->radioButtonLH->isChecked())
|
|||
|
json.insert("busyState", 0);
|
|||
|
else if(ui->radioButtonHL->isChecked())
|
|||
|
json.insert("busyState", 1);
|
|||
|
else {
|
|||
|
json.insert("busyState", 1);
|
|||
|
}
|
|||
|
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("SetHighForBusy"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnReadbackTaxiTopScreen()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "GetStateForBusy");
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("GetStateForBusy"),tr("Success"),tr("failed"))
|
|||
|
}
|
|||
|
void setDebugOutput(const QString &rawTargetFilePath_, const bool &argDateFlag_)
|
|||
|
{
|
|||
|
static QString rawTargetFilePath;
|
|||
|
static bool argDateFlag;
|
|||
|
|
|||
|
rawTargetFilePath = rawTargetFilePath_;
|
|||
|
argDateFlag = argDateFlag_;
|
|||
|
|
|||
|
class HelperClass
|
|||
|
{
|
|||
|
public:
|
|||
|
static void messageHandler(QtMsgType type, const QMessageLogContext &, const QString &message_)
|
|||
|
{
|
|||
|
QString message;
|
|||
|
|
|||
|
switch ( type )
|
|||
|
{
|
|||
|
case QtDebugMsg:
|
|||
|
{
|
|||
|
message = message_;
|
|||
|
break;
|
|||
|
}
|
|||
|
case QtWarningMsg:
|
|||
|
{
|
|||
|
message.append("Warning: ");
|
|||
|
message.append(message_);
|
|||
|
break;
|
|||
|
}
|
|||
|
case QtCriticalMsg:
|
|||
|
{
|
|||
|
message.append("Critical: ");
|
|||
|
message.append(message_);
|
|||
|
break;
|
|||
|
}
|
|||
|
case QtFatalMsg:
|
|||
|
{
|
|||
|
message.append("Fatal: ");
|
|||
|
message.append(message_);
|
|||
|
break;
|
|||
|
}
|
|||
|
default: { break; }
|
|||
|
}
|
|||
|
|
|||
|
QString currentTargetFilePath;
|
|||
|
|
|||
|
if ( argDateFlag )
|
|||
|
{
|
|||
|
currentTargetFilePath = rawTargetFilePath.arg( ( ( argDateFlag ) ? ( QDateTime::currentDateTime().toString("yyyy_MM_dd") ) : ( "" ) ) );
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
currentTargetFilePath = rawTargetFilePath;
|
|||
|
}
|
|||
|
|
|||
|
if ( !QFileInfo::exists( currentTargetFilePath ) )
|
|||
|
{
|
|||
|
QDir().mkpath( QFileInfo( currentTargetFilePath ).path() );
|
|||
|
}
|
|||
|
|
|||
|
QFile file( currentTargetFilePath );
|
|||
|
file.open( QIODevice::WriteOnly | QIODevice::Append );
|
|||
|
|
|||
|
QTextStream textStream( &file );
|
|||
|
textStream << QDateTime::currentDateTime().toString( "yyyy-MM-dd hh:mm:ss" ) << ": " << message << endl;
|
|||
|
}
|
|||
|
};
|
|||
|
|
|||
|
qInstallMessageHandler( HelperClass::messageHandler );
|
|||
|
}
|
|||
|
//void ControlAdvParamWidget::OnBindingIc()
|
|||
|
//{
|
|||
|
// MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
// m_strStartUrl="http://"+m_pLedCard->m_strCardIp+":3000";
|
|||
|
// QFileDialog dlg;
|
|||
|
// QString m_strIcFile = QFileDialog::getOpenFileName(this, "open file dialog",
|
|||
|
// "",
|
|||
|
// tr("indentity voucher (*.ic)"));
|
|||
|
// if(m_strIcFile.isEmpty())
|
|||
|
// return;
|
|||
|
// QFileInfo file1(m_strIcFile);
|
|||
|
// QFile file(m_strIcFile);
|
|||
|
// QJsonObject json;
|
|||
|
// json.insert("action", "InvokeTaxiAppFunction");
|
|||
|
|
|||
|
// QJsonObject subJson;
|
|||
|
// subJson.insert("action", "BindAccount");
|
|||
|
|
|||
|
// file.open(QIODevice::ReadOnly);
|
|||
|
// QJsonDocument document=QJsonDocument::fromJson(file.readAll());
|
|||
|
// QJsonObject jsonObject = document.object();
|
|||
|
// subJson.insert("accountIdToken", jsonObject["account_id_token"].toString());
|
|||
|
// json.insert("jsonCommand", subJson);
|
|||
|
// if(m_pLedlist->count()<=1)
|
|||
|
// {
|
|||
|
// if(m_pLedCard!=nullptr)
|
|||
|
// {
|
|||
|
// HttpPostByTypeJsonObject(pHpptClient,m_strStartUrl,json);
|
|||
|
// if(m_PostingDlg==nullptr)
|
|||
|
// {
|
|||
|
// m_PostingDlg = new LoEmptyDialog(this);
|
|||
|
// connect(m_PostingDlg,SIGNAL(sigClose()),this,SLOT(DeletePostingDlg()));
|
|||
|
// connect(m_pGetAskTimer,SIGNAL(timeout()),m_PostingDlg,SLOT(TimerOutUnlock()));
|
|||
|
// m_PostingDlg->lock(tr("InvokeTaxiAppFunction"),tr("Success"),tr("failed"));
|
|||
|
// m_pGetAskTimer->start(5000);
|
|||
|
// m_PostingDlg->exec();
|
|||
|
|
|||
|
// }
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else {
|
|||
|
// emit sigSend(json,tr("InvokeTaxiAppFunction"));
|
|||
|
// }
|
|||
|
// QJsonObject json1;
|
|||
|
// json1.insert("action", "InvokeTaxiAppFunction");
|
|||
|
// json1.insert("type", "SetTaxiServer");
|
|||
|
// json1.insert("server", jsonObject["taxiServerURL"].toString());
|
|||
|
// json1.insert("tlsServer", jsonObject["taxiServerTLSURL"].toString());
|
|||
|
// if(m_pLedlist->count()<=1)
|
|||
|
// {
|
|||
|
// if(m_pLedCard!=nullptr)
|
|||
|
// {
|
|||
|
// HttpPostByTypeJsonObject(pHpptClient,m_strStartUrl,json1);
|
|||
|
|
|||
|
// }
|
|||
|
// }
|
|||
|
// else {
|
|||
|
// emit sigSend(json1,tr("SetTaxiServer"));
|
|||
|
// }
|
|||
|
//}
|
|||
|
void ControlAdvParamWidget::OnOpenAdb()
|
|||
|
{
|
|||
|
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
QJsonObject json;
|
|||
|
json.insert("_id", getRandomString(10));
|
|||
|
json.insert("_type", "OpenAdb");
|
|||
|
if(ui->checkBox_ADB->isChecked())
|
|||
|
{
|
|||
|
json.insert("open", true);
|
|||
|
}
|
|||
|
else {
|
|||
|
json.insert("open", false);
|
|||
|
}
|
|||
|
MACRO_DEFINE_TIPDLG_FUCN(tr("OpenAdb"),tr("Success"),tr("failed"))
|
|||
|
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnBindingIc()
|
|||
|
{
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
m_strStartUrl="http://"+m_pLedCard->m_strCardIp+":3000";
|
|||
|
QFileDialog dlg;
|
|||
|
QString m_strIcFile = QFileDialog::getOpenFileName(this, "open file dialog",
|
|||
|
"",
|
|||
|
tr("indentity voucher (*.ic)"));
|
|||
|
if(m_strIcFile.isEmpty())
|
|||
|
return;
|
|||
|
QFileInfo file1(m_strIcFile);
|
|||
|
QFile file(m_strIcFile);
|
|||
|
QJsonObject json;
|
|||
|
json.insert("action", "InvokeTaxiAppFunction");
|
|||
|
|
|||
|
QJsonObject subJson;
|
|||
|
subJson.insert("action", "BindAccount");
|
|||
|
|
|||
|
file.open(QIODevice::ReadOnly);
|
|||
|
QJsonDocument document=QJsonDocument::fromJson(file.readAll());
|
|||
|
QJsonObject jsonObject = document.object();
|
|||
|
subJson.insert("accountIdToken", jsonObject["account_id_token"].toString());
|
|||
|
subJson.insert("server", jsonObject["taxiServerURL"].toString());
|
|||
|
subJson.insert("tlsServer", jsonObject["taxiServerTLSURL"].toString());
|
|||
|
json.insert("jsonCommand", subJson);
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()<=1)
|
|||
|
{
|
|||
|
if(m_pLedCard!=nullptr)
|
|||
|
{
|
|||
|
HttpPostByTypeJsonObject(pHpptClient,m_strStartUrl,json);
|
|||
|
if(m_PostingDlg==nullptr)
|
|||
|
{
|
|||
|
m_PostingDlg = new LoEmptyDialog(this);
|
|||
|
connect(m_PostingDlg,SIGNAL(sigClose()),this,SLOT(DeletePostingDlg()));
|
|||
|
connect(m_pGetAskTimer,SIGNAL(timeout()),m_PostingDlg,SLOT(TimerOutUnlock()));
|
|||
|
m_PostingDlg->lock(tr("InvokeTaxiAppFunction"),tr("Success"),tr("failed"));
|
|||
|
m_pGetAskTimer->start(5000);
|
|||
|
m_PostingDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
emit sigSend(json,tr("InvokeTaxiAppFunction"));
|
|||
|
}
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::DeletePostingDlg()
|
|||
|
{
|
|||
|
if(m_PostingDlg!=nullptr)
|
|||
|
{
|
|||
|
delete m_PostingDlg;
|
|||
|
m_PostingDlg=nullptr;
|
|||
|
}
|
|||
|
}
|
|||
|
QString ControlAdvParamWidget::qs2B64(QString qs1){//ok
|
|||
|
//
|
|||
|
QByteArray ba;
|
|||
|
ba=qs1.toUtf8(); //QByteArray
|
|||
|
ba=ba.toBase64(); //Base64
|
|||
|
char * cx=ba.data(); //char *
|
|||
|
QString b64qs1=QString(cx);//QString
|
|||
|
//
|
|||
|
return b64qs1;
|
|||
|
}
|
|||
|
QString ControlAdvParamWidget::b64ToQs(QString b64qs1){//ok
|
|||
|
QByteArray ba;
|
|||
|
|
|||
|
std::string stdStr = b64qs1.toStdString();//std::string
|
|||
|
ba=QByteArray(stdStr.c_str() ); //QByteArray
|
|||
|
ba=ba.fromBase64(ba); //unBase64
|
|||
|
|
|||
|
QString qs1=QString::fromUtf8(ba); //QString
|
|||
|
return qs1;
|
|||
|
}
|
|||
|
void ControlAdvParamWidget::OnSendCustomJson(){//ok
|
|||
|
|
|||
|
MACRO_DEFINE_NO_SELECTED_CARD_TIP
|
|||
|
m_strStartUrl="http://"+m_pLedCard->m_strCardIp+":3000";
|
|||
|
|
|||
|
QJsonObject json;
|
|||
|
|
|||
|
QJsonParseError l_err;
|
|||
|
QJsonDocument l_doc = QJsonDocument::fromJson(ui->JsonEdit->toPlainText().toUtf8(), &l_err);
|
|||
|
if (l_err.error == QJsonParseError::NoError)
|
|||
|
{
|
|||
|
if (l_doc.isObject())
|
|||
|
{
|
|||
|
json = l_doc.object();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if(json.count()<=0)
|
|||
|
{
|
|||
|
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("Json format is error!"),this,0);
|
|||
|
pDlg->exec();
|
|||
|
|
|||
|
return;
|
|||
|
}
|
|||
|
if(m_pLedlist==nullptr)
|
|||
|
return;
|
|||
|
if(m_pLedlist->count()<=1)
|
|||
|
{
|
|||
|
if(m_pLedCard!=nullptr)
|
|||
|
{
|
|||
|
HttpPostByTypeJsonObject(pHpptClient,m_strStartUrl,json);
|
|||
|
if(m_PostingDlg==nullptr)
|
|||
|
{
|
|||
|
m_PostingDlg = new LoEmptyDialog(this);
|
|||
|
connect(m_PostingDlg,SIGNAL(sigClose()),this,SLOT(DeletePostingDlg()));
|
|||
|
connect(m_pGetAskTimer,SIGNAL(timeout()),m_PostingDlg,SLOT(TimerOutUnlock()));
|
|||
|
m_PostingDlg->lock(tr("AliIotSetting"),tr("Success"),tr("failed"));
|
|||
|
m_pGetAskTimer->start(5000);
|
|||
|
m_PostingDlg->exec();
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
else {
|
|||
|
emit sigSend(json,tr("AliIotSetting"));
|
|||
|
}
|
|||
|
|
|||
|
}
|