ledok
This commit is contained in:
parent
7f44fd1ca5
commit
fed2665a90
|
@ -4,12 +4,21 @@
|
||||||
#include "basedlg.h"
|
#include "basedlg.h"
|
||||||
#include "base/customprogressindicator.h"
|
#include "base/customprogressindicator.h"
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
|
||||||
class WaitingDlg : public BaseDlg {
|
class WaitingDlg : public BaseDlg {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit WaitingDlg(QWidget *parent = nullptr, QString text = 0, QString sucText = 0);
|
explicit WaitingDlg(QWidget *parent = nullptr, QString text = 0, QString sucText = 0);
|
||||||
|
|
||||||
|
inline void connAbort(QNetworkReply *reply) {
|
||||||
|
connect(this, &WaitingDlg::rejected, reply, [reply] {
|
||||||
|
reply->blockSignals(true);
|
||||||
|
reply->abort();
|
||||||
|
reply->blockSignals(false);
|
||||||
|
reply->deleteLater();
|
||||||
|
});
|
||||||
|
}
|
||||||
QPushButton *btnAbort;
|
QPushButton *btnAbort;
|
||||||
QLabel *fdText;
|
QLabel *fdText;
|
||||||
QString sucText;
|
QString sucText;
|
||||||
|
|
|
@ -87,13 +87,12 @@ ControlPowerWidget::ControlPowerWidget(QWidget *parent, QList<LedCard *> *list)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
if(err.isEmpty()) err = json["on"].toBool() ? tr("On") : tr("Off");
|
if(err.isEmpty()) err = json["on"].toBool() ? tr("On") : tr("Off");
|
||||||
gFdResInfo->append(cardId+" "+tr("IsScreenOn")+" "+err);
|
gFdResInfo->append(card->m_strCardId+" "+tr("IsScreenOn")+" "+err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -129,7 +128,7 @@ void ControlPowerWidget::init() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "IsScreenOn");
|
json.insert("_id", "IsScreenOn");
|
||||||
json.insert("_type", "IsScreenOn");
|
json.insert("_type", "IsScreenOn");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
|
|
@ -87,7 +87,7 @@ ControlVolumeWidget::ControlVolumeWidget(QWidget *parent,QList<LedCard *> *list)
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -129,7 +129,7 @@ void ControlVolumeWidget::init() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "GetVolume");
|
json.insert("_id", "GetVolume");
|
||||||
json.insert("_type", "GetVolume");
|
json.insert("_type", "GetVolume");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
|
|
@ -387,7 +387,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -532,13 +532,8 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
auto waitingDlg = new WaitingDlg(this, tr("Getting Log")+" ...");
|
auto waitingDlg = new WaitingDlg(this, tr("Getting Log")+" ...");
|
||||||
waitingDlg->show();
|
waitingDlg->show();
|
||||||
auto card = gSelCards->at(0);
|
auto card = gSelCards->at(0);
|
||||||
auto reply = Tools::netManager().get(netReq("http://"+card->m_strCardIp+":2016/download?file=logs"));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/download?file=logs").timeout(120000).get();
|
||||||
connect(waitingDlg, &WaitingDlg::rejected, reply, [reply] {
|
waitingDlg->connAbort(reply);
|
||||||
reply->blockSignals(true);
|
|
||||||
reply->abort();
|
|
||||||
reply->blockSignals(false);
|
|
||||||
reply->deleteLater();
|
|
||||||
});
|
|
||||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||||
waitingDlg->close();
|
waitingDlg->close();
|
||||||
QString err = checkReply(reply);
|
QString err = checkReply(reply);
|
||||||
|
@ -546,7 +541,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QString logFile = QApplication::applicationDirPath()+"/log_"+card->m_strCardId+".txt";
|
QString logFile = QApplication::applicationDirPath()+"/card-log.txt";
|
||||||
QFile file(logFile);
|
QFile file(logFile);
|
||||||
if(! file.open(QIODevice::WriteOnly)) {
|
if(! file.open(QIODevice::WriteOnly)) {
|
||||||
QMessageBox::critical(gMainWin, tr("Error"), "Open for Write Fail");
|
QMessageBox::critical(gMainWin, tr("Error"), "Open for Write Fail");
|
||||||
|
@ -613,7 +608,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -681,7 +676,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -757,12 +752,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
waitingDlg->show();
|
waitingDlg->show();
|
||||||
NetReq req("http://"+gSelCards->at(0)->m_strCardIp+":2016/upload?type=update_display");
|
NetReq req("http://"+gSelCards->at(0)->m_strCardIp+":2016/upload?type=update_display");
|
||||||
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
|
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
|
||||||
connect(waitingDlg, &WaitingDlg::rejected, reply, [reply] {
|
waitingDlg->connAbort(reply);
|
||||||
reply->blockSignals(true);
|
|
||||||
reply->abort();
|
|
||||||
reply->blockSignals(false);
|
|
||||||
reply->deleteLater();
|
|
||||||
});
|
|
||||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||||
QString err = checkReply(reply);
|
QString err = checkReply(reply);
|
||||||
if(! err.isEmpty()) {
|
if(! err.isEmpty()) {
|
||||||
|
@ -836,7 +826,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -916,7 +906,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -1049,13 +1039,8 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
if(gSelCards->count() == 1) {
|
if(gSelCards->count() == 1) {
|
||||||
auto waitingDlg = new WaitingDlg(this, tr("InvokeTaxiAppFunction"));
|
auto waitingDlg = new WaitingDlg(this, tr("InvokeTaxiAppFunction"));
|
||||||
waitingDlg->show();
|
waitingDlg->show();
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+gSelCards->at(0)->m_strCardIp+":3000"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+gSelCards->at(0)->m_strCardIp+":3000").timeout(120000).post(json);
|
||||||
connect(waitingDlg, &WaitingDlg::rejected, reply, [reply] {
|
waitingDlg->connAbort(reply);
|
||||||
reply->blockSignals(true);
|
|
||||||
reply->abort();
|
|
||||||
reply->blockSignals(false);
|
|
||||||
reply->deleteLater();
|
|
||||||
});
|
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||||
QString err = checkReply(reply);
|
QString err = checkReply(reply);
|
||||||
if(! err.isEmpty()) {
|
if(! err.isEmpty()) {
|
||||||
|
@ -1080,7 +1065,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":3000"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":3000").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QString err = checkReply(reply);
|
QString err = checkReply(reply);
|
||||||
|
@ -1165,7 +1150,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -1240,7 +1225,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -1309,7 +1294,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -1418,12 +1403,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
waitingDlg->show();
|
waitingDlg->show();
|
||||||
NetReq req("http://"+gSelCards->at(0)->m_strCardIp+":2016/upload?type=mcu_update");
|
NetReq req("http://"+gSelCards->at(0)->m_strCardIp+":2016/upload?type=mcu_update");
|
||||||
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
|
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
|
||||||
connect(waitingDlg, &WaitingDlg::rejected, reply, [reply] {
|
waitingDlg->connAbort(reply);
|
||||||
reply->blockSignals(true);
|
|
||||||
reply->abort();
|
|
||||||
reply->blockSignals(false);
|
|
||||||
reply->deleteLater();
|
|
||||||
});
|
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||||
QString err = checkReply(reply);
|
QString err = checkReply(reply);
|
||||||
if(! err.isEmpty()) {
|
if(! err.isEmpty()) {
|
||||||
|
@ -1467,7 +1447,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -1779,7 +1759,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -1925,7 +1905,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId, fdTraficProtocol] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId, fdTraficProtocol] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -2013,7 +1993,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -2081,7 +2061,7 @@ void CtrlAdvancedPanel::init() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "GetAllScreenSizeM80");
|
json.insert("_id", "GetAllScreenSizeM80");
|
||||||
json.insert("_type", "GetAllScreenSizeM80");
|
json.insert("_type", "GetAllScreenSizeM80");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -2103,7 +2083,7 @@ void CtrlAdvancedPanel::init() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "GetScreenSize");
|
json.insert("_id", "GetScreenSize");
|
||||||
json.insert("_type", "GetScreenSize");
|
json.insert("_type", "GetScreenSize");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -2115,7 +2095,7 @@ void CtrlAdvancedPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetCardAlias");
|
json.insert("_id", "GetCardAlias");
|
||||||
json.insert("_type", "GetCardAlias");
|
json.insert("_type", "GetCardAlias");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -2126,7 +2106,7 @@ void CtrlAdvancedPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetOnlineAddr");
|
json.insert("_id", "GetOnlineAddr");
|
||||||
json.insert("_type", "GetOnlineAddr");
|
json.insert("_type", "GetOnlineAddr");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -2138,7 +2118,7 @@ void CtrlAdvancedPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetRealtimeServer");
|
json.insert("_id", "GetRealtimeServer");
|
||||||
json.insert("_type", "GetRealtimeServer");
|
json.insert("_type", "GetRealtimeServer");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -2245,66 +2225,6 @@ void CtrlAdvancedPanel::transUi() {
|
||||||
btnTraficGet->setText(tr("Get"));
|
btnTraficGet->setText(tr("Get"));
|
||||||
}
|
}
|
||||||
|
|
||||||
//void CtrlAdvancedPanel::onUpload(QString file) {
|
|
||||||
// if(file.length() < 3) return;
|
|
||||||
// QFile qFile(file);
|
|
||||||
// if(! qFile.exists()) return;
|
|
||||||
// bool isApk = ! file.endsWith(".rpd", Qt::CaseInsensitive);
|
|
||||||
// auto BOUNDARY = QUuid::createUuid().toByteArray();
|
|
||||||
// QByteArray data;
|
|
||||||
// data.append("--").append(BOUNDARY).append("\r\n");
|
|
||||||
// data.append("Content-Disposition: form-data;name=\"username\"\r\n\r\n");
|
|
||||||
// data.append("10005\r\n");
|
|
||||||
// //上传文件的头部
|
|
||||||
// data.append("--").append(BOUNDARY).append("\r\n");
|
|
||||||
// QFileInfo fileinfo(file);
|
|
||||||
// auto name = fileinfo.fileName().toUtf8();
|
|
||||||
// data.append("Content-Disposition: form-data;name=\"").append(name).append("\";filename=\"").append(name).append("\"\r\n\r\n");
|
|
||||||
// //上传文件内容
|
|
||||||
// if(! qFile.open(QIODevice::ReadOnly)) return;
|
|
||||||
// data.append(qFile.readAll());
|
|
||||||
// qFile.close();
|
|
||||||
// data.append("\r\n");
|
|
||||||
// data.append("--").append(BOUNDARY).append("\r\n");
|
|
||||||
|
|
||||||
// auto waitingDlg = new WaitingDlg(this, tr("Uploading")+" ...");
|
|
||||||
// waitingDlg->show();
|
|
||||||
// auto request = netReq("http://"+gSelCards->at(0)->m_strCardIp+":2016/upload?type="+(isApk ? "software":"hardware"), "multipart/form-data;boundary="+BOUNDARY, 0);
|
|
||||||
// auto reply = Tools::netManager().post(request, data);
|
|
||||||
// connect(waitingDlg, &WaitingDlg::rejected, reply, [reply] {
|
|
||||||
// reply->blockSignals(true);
|
|
||||||
// reply->abort();
|
|
||||||
// reply->blockSignals(false);
|
|
||||||
// reply->deleteLater();
|
|
||||||
// });
|
|
||||||
// connect(reply, &QNetworkReply::uploadProgress, this, [=](qint64 bytesSent, qint64 bytesTotal) {
|
|
||||||
// if(bytesTotal<=0) return;
|
|
||||||
// waitingDlg->fdText->setText(tr("Uploading")+" "+QString::number(bytesSent*100/bytesTotal)+"%");
|
|
||||||
// });
|
|
||||||
// connect(reply, &QNetworkReply::finished, this, [=] {
|
|
||||||
// QString err = checkReply(reply);
|
|
||||||
// if(! err.isEmpty()) {
|
|
||||||
// waitingDlg->close();
|
|
||||||
// QMessageBox::critical(gMainWin, tr("Error"), err);
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// waitingDlg->fdText->setText(tr("Installing")+" ...");
|
|
||||||
// QJsonObject json;
|
|
||||||
// if(isApk) {
|
|
||||||
// json.insert("_id", "UpgradeSoftware");
|
|
||||||
// json.insert("_type", "UpgradeSoftware");
|
|
||||||
// json.insert("fileName", QFileInfo(file).fileName());
|
|
||||||
// json.insert("isCustom", true);
|
|
||||||
// } else {
|
|
||||||
// json.insert("_id", "SynchronousHardwareVersion");
|
|
||||||
// json.insert("_type", "SynchronousHardwareVersion");
|
|
||||||
// }
|
|
||||||
// auto reply = Tools::netManager().post(reqForJson("http://"+gSelCards->at(0)->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
|
||||||
// connect(reply, &QNetworkReply::finished, this, [=] {
|
|
||||||
// Def_CtrlSetReqAfter
|
|
||||||
// });
|
|
||||||
// });
|
|
||||||
//}
|
|
||||||
void messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg) {
|
void messageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg) {
|
||||||
auto cur = QDateTime::currentDateTime();
|
auto cur = QDateTime::currentDateTime();
|
||||||
QFile file("D:/LedOK-advanced-"+cur.toString("yy-MM-dd")+".log");
|
QFile file("D:/LedOK-advanced-"+cur.toString("yy-MM-dd")+".log");
|
||||||
|
|
|
@ -128,7 +128,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -218,7 +218,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
auto brightLevel = card->BrightnessLevel;
|
auto brightLevel = card->BrightnessLevel;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId, brightLevel] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId, brightLevel] {
|
||||||
|
@ -420,7 +420,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, card] {
|
connect(reply, &QNetworkReply::finished, this, [reply, card] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -525,7 +525,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, card] {
|
connect(reply, &QNetworkReply::finished, this, [reply, card] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -809,7 +809,7 @@ void CtrlBrightPanel::init() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "GetAutoBrightnessTask");
|
json.insert("_id", "GetAutoBrightnessTask");
|
||||||
json.insert("_type", "GetAutoBrightnessTask");
|
json.insert("_type", "GetAutoBrightnessTask");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply, card] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply, card] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -823,7 +823,7 @@ void CtrlBrightPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetBrightnessSensitivity");
|
json.insert("_id", "GetBrightnessSensitivity");
|
||||||
json.insert("_type", "GetBrightnessSensitivity");
|
json.insert("_type", "GetBrightnessSensitivity");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -838,7 +838,7 @@ void CtrlBrightPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetMinBrightness");
|
json.insert("_id", "GetMinBrightness");
|
||||||
json.insert("_type", "GetMinBrightness");
|
json.insert("_type", "GetMinBrightness");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply, card] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply, card] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -851,7 +851,7 @@ void CtrlBrightPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetBrightness");
|
json.insert("_id", "GetBrightness");
|
||||||
json.insert("_type", "GetBrightness");
|
json.insert("_type", "GetBrightness");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply, card] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply, card] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
|
|
@ -112,7 +112,7 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -322,7 +322,7 @@ void CtrlHdmiPanel::init() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "IsSync");
|
json.insert("_id", "IsSync");
|
||||||
json.insert("_type", "IsSync");
|
json.insert("_type", "IsSync");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "globaldefine.h"
|
#include "globaldefine.h"
|
||||||
#include "tools.h"
|
#include "tools.h"
|
||||||
#include "gutil/qgui.h"
|
#include "gutil/qgui.h"
|
||||||
|
#include "gutil/qnetwork.h"
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QStackedLayout>
|
#include <QStackedLayout>
|
||||||
|
@ -184,7 +185,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -324,39 +325,57 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
||||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if(fdIsWifi->isChecked()) {
|
auto isWifi = fdIsWifi->isChecked();
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "ConfigurationWiFi");
|
json.insert("_id", "SetSwitchWiFi");
|
||||||
json.insert("_type", "ConfigurationWiFi");
|
json.insert("_type", "SetSwitchWiFi");
|
||||||
json.insert("ssid", fdWifiName->currentText());
|
json.insert("enable", isWifi);
|
||||||
json.insert("password", fdWifiPassword->text());
|
QString tip;
|
||||||
if(gSelCards->count() == 1) {
|
QJsonObject json2;
|
||||||
auto waitingDlg = new WaitingDlg(this, tr("ConfigurationWiFi")+" ...");
|
if(isWifi) {
|
||||||
Def_CtrlReqPre
|
tip = tr("ConfigurationWiFi");
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
json2.insert("_id", "ConfigurationWiFi");
|
||||||
Def_CtrlSetReqAfter
|
json2.insert("_type", "ConfigurationWiFi");
|
||||||
});
|
json2.insert("ssid", fdWifiName->currentText());
|
||||||
} else {
|
json2.insert("password", fdWifiPassword->text());
|
||||||
foreach(auto card, *gSelCards) {
|
|
||||||
Def_CtrlSetMulti(tr("ConfigurationWiFi"))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if(fdIsHotspot->isChecked()) {
|
} else if(fdIsHotspot->isChecked()) {
|
||||||
QJsonObject json;
|
tip = tr("ConfigurationHotSpot");
|
||||||
json.insert("_id", "ConfigurationHotSpot");
|
json2.insert("_id", "ConfigurationHotSpot");
|
||||||
json.insert("_type", "ConfigurationHotSpot");
|
json2.insert("_type", "ConfigurationHotSpot");
|
||||||
json.insert("apName", fdHotspotName->text());
|
json2.insert("apName", fdHotspotName->text());
|
||||||
json.insert("password", fdHotspotPassword->text());
|
json2.insert("password", fdHotspotPassword->text());
|
||||||
if(gSelCards->count() == 1) {
|
}
|
||||||
auto waitingDlg = new WaitingDlg(this, tr("ConfigurationHotSpot")+" ...");
|
if(gSelCards->count() == 1) {
|
||||||
Def_CtrlReqPre
|
auto waitingDlg = new WaitingDlg(this, tip+" ...");
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
Def_CtrlReqPre
|
||||||
|
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||||
|
QString err = checkReplyForJson(reply);
|
||||||
|
if(! err.isEmpty()) {
|
||||||
|
waitingDlg->close();
|
||||||
|
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json2);
|
||||||
|
waitingDlg->connAbort(reply);
|
||||||
|
connect(reply, &QNetworkReply::finished, card, [reply, waitingDlg] {
|
||||||
Def_CtrlSetReqAfter
|
Def_CtrlSetReqAfter
|
||||||
});
|
});
|
||||||
} else {
|
});
|
||||||
foreach(auto card, *gSelCards) {
|
} else {
|
||||||
Def_CtrlSetMulti(tr("ConfigurationHotSpot"))
|
foreach(auto card, *gSelCards) {
|
||||||
}
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
|
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||||
|
QString err = checkReplyForJson(reply);
|
||||||
|
if(! err.isEmpty()) {
|
||||||
|
gFdResInfo->append(card->m_strCardId+" "+tip+" "+err);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json2);
|
||||||
|
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||||
|
QString err = checkReplyForJson(reply);
|
||||||
|
gFdResInfo->append(card->m_strCardId+" "+tip+" "+(err.isEmpty()?QCoreApplication::translate("Def","Success"):err));
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -388,7 +407,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -709,7 +728,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -790,7 +809,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -826,7 +845,7 @@ void CtrlNetworkPanel::init() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "GetEthernet");
|
json.insert("_id", "GetEthernet");
|
||||||
json.insert("_type", "GetEthernet");
|
json.insert("_type", "GetEthernet");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -848,7 +867,7 @@ void CtrlNetworkPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetWifiList");
|
json.insert("_id", "GetWifiList");
|
||||||
json.insert("_type", "GetWifiList");
|
json.insert("_type", "GetWifiList");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -860,7 +879,7 @@ void CtrlNetworkPanel::init() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "IsPortableHotSpot");
|
json.insert("_id", "IsPortableHotSpot");
|
||||||
json.insert("_type", "IsPortableHotSpot");
|
json.insert("_type", "IsPortableHotSpot");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -878,7 +897,7 @@ void CtrlNetworkPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetSwitchSimData");
|
json.insert("_id", "GetSwitchSimData");
|
||||||
json.insert("_type", "GetSwitchSimData");
|
json.insert("_type", "GetSwitchSimData");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -892,7 +911,7 @@ void CtrlNetworkPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetAPNList");
|
json.insert("_id", "GetAPNList");
|
||||||
json.insert("_type", "GetAPNList");
|
json.insert("_type", "GetAPNList");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -919,7 +938,7 @@ void CtrlNetworkPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetFlightModeState");
|
json.insert("_id", "GetFlightModeState");
|
||||||
json.insert("_type", "GetFlightModeState");
|
json.insert("_type", "GetFlightModeState");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -985,7 +1004,7 @@ void CtrlNetworkPanel::getCurrentAPN(QString &ip) {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "GetCurrentAPN");
|
json.insert("_id", "GetCurrentAPN");
|
||||||
json.insert("_type", "GetCurrentAPN");
|
json.insert("_type", "GetCurrentAPN");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+ip+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+ip+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
|
|
@ -106,7 +106,7 @@ CtrlPwdPanel::CtrlPwdPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, card, [=] {
|
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -173,7 +173,7 @@ CtrlPwdPanel::CtrlPwdPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, card, [=] {
|
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -216,7 +216,7 @@ void CtrlPwdPanel::init() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "HasControllerPassword");
|
json.insert("_id", "HasControllerPassword");
|
||||||
json.insert("_type", "HasControllerPassword");
|
json.insert("_type", "HasControllerPassword");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, card, [=] {
|
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
|
|
@ -179,7 +179,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -257,7 +257,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -415,7 +415,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -501,7 +501,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, card, isMaster] {
|
connect(reply, &QNetworkReply::finished, this, [reply, card, isMaster] {
|
||||||
QString err = checkReplyForJson(reply);
|
QString err = checkReplyForJson(reply);
|
||||||
gFdResInfo->append(card->m_strCardId+" "+(isMaster ? tr("MasterSwitch ") : tr("SlaveSwitch "))+" "+(err.isEmpty()?QCoreApplication::translate("Def","Success"):err));
|
gFdResInfo->append(card->m_strCardId+" "+(isMaster ? tr("MasterSwitch ") : tr("SlaveSwitch "))+" "+(err.isEmpty()?QCoreApplication::translate("Def","Success"):err));
|
||||||
|
@ -533,7 +533,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -614,7 +614,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
foreach(auto card, *gSelCards) {
|
foreach(auto card, *gSelCards) {
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
auto cardId = card->m_strCardId;
|
auto cardId = card->m_strCardId;
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
|
@ -680,7 +680,7 @@ void CtrlVerifyClockPanel::init() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "GetingSyncMethod");
|
json.insert("_id", "GetingSyncMethod");
|
||||||
json.insert("_type", "GetingSyncMethod");
|
json.insert("_type", "GetingSyncMethod");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -691,7 +691,7 @@ void CtrlVerifyClockPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetTimezone");
|
json.insert("_id", "GetTimezone");
|
||||||
json.insert("_type", "GetTimezone");
|
json.insert("_type", "GetTimezone");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -702,7 +702,7 @@ void CtrlVerifyClockPanel::init() {
|
||||||
json = QJsonObject();
|
json = QJsonObject();
|
||||||
json.insert("_id", "GetLanguage");
|
json.insert("_id", "GetLanguage");
|
||||||
json.insert("_type", "GetLanguage");
|
json.insert("_type", "GetLanguage");
|
||||||
reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
|
|
@ -39,7 +39,7 @@ void wUpgradeApkItem::OnCheckFpgaVersions() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "CheckHardwareVersions");
|
json.insert("_id", "CheckHardwareVersions");
|
||||||
json.insert("_type", "CheckHardwareVersions");
|
json.insert("_type", "CheckHardwareVersions");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+mCard->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+mCard->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, this] {
|
connect(reply, &QNetworkReply::finished, this, [reply, this] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -59,7 +59,7 @@ void wUpgradeApkItem::OnCheckSoftVersions() {
|
||||||
QJsonObject json;
|
QJsonObject json;
|
||||||
json.insert("_id", "CheckSoftVersions");
|
json.insert("_id", "CheckSoftVersions");
|
||||||
json.insert("_type", "CheckSoftVersions");
|
json.insert("_type", "CheckSoftVersions");
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+mCard->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+mCard->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, this] {
|
connect(reply, &QNetworkReply::finished, this, [reply, this] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
@ -88,7 +88,7 @@ void wUpgradeApkItem::onVerifyLockPassword() {
|
||||||
json.insert("_id", "VerifyPassword");
|
json.insert("_id", "VerifyPassword");
|
||||||
json.insert("_type", "VerifyPassword");
|
json.insert("_type", "VerifyPassword");
|
||||||
json.insert("pwd", pwd);
|
json.insert("pwd", pwd);
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+mCard->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+mCard->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, this, [reply, this] {
|
connect(reply, &QNetworkReply::finished, this, [reply, this] {
|
||||||
QJsonDocument json;
|
QJsonDocument json;
|
||||||
QString err = checkReplyForJson(reply, &json);
|
QString err = checkReplyForJson(reply, &json);
|
||||||
|
|
|
@ -380,7 +380,7 @@ void DevicePanel::addLedCard(LedCard *card) {
|
||||||
json.insert("_id", "SyncTime");
|
json.insert("_id", "SyncTime");
|
||||||
json.insert("_type", "SyncTime");
|
json.insert("_type", "SyncTime");
|
||||||
json.insert("time", QDateTime::currentDateTime().toMSecsSinceEpoch());
|
json.insert("time", QDateTime::currentDateTime().toMSecsSinceEpoch());
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||||
connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater);
|
connect(reply, &QNetworkReply::finished, reply, &QNetworkReply::deleteLater);
|
||||||
}
|
}
|
||||||
void DevicePanel::clearUdpHeartbeat(LedCard *p) {
|
void DevicePanel::clearUdpHeartbeat(LedCard *p) {
|
||||||
|
|
|
@ -11,13 +11,6 @@ bool gTextAntialiasing = false;
|
||||||
bool gShowLoraScreen = false;
|
bool gShowLoraScreen = false;
|
||||||
bool gWidthSplit = false;
|
bool gWidthSplit = false;
|
||||||
|
|
||||||
QNetworkRequest netReq(const QString &url, const QByteArray &contentType, int timeout) {
|
|
||||||
QNetworkRequest request{url};
|
|
||||||
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
|
|
||||||
if(timeout) request.setTransferTimeout(timeout);
|
|
||||||
if(! contentType.isEmpty()) request.setRawHeader("Content-Type", contentType);
|
|
||||||
return request;
|
|
||||||
}
|
|
||||||
QString replyErr(QNetworkReply *reply) {
|
QString replyErr(QNetworkReply *reply) {
|
||||||
reply->deleteLater();
|
reply->deleteLater();
|
||||||
auto error = reply->error();
|
auto error = reply->error();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#ifndef GLOBALDEFINE_H
|
#ifndef GLOBALDEFINE_H
|
||||||
#define GLOBALDEFINE_H
|
#define GLOBALDEFINE_H
|
||||||
|
#include "gutil/qnetwork.h"
|
||||||
#include <QString>
|
#include <QString>
|
||||||
#include <QJsonValue>
|
#include <QJsonValue>
|
||||||
#include <QJsonObject>
|
#include <QJsonObject>
|
||||||
|
@ -171,10 +172,6 @@ enum _ENUM_CONTRL_WIDGET {
|
||||||
Setting_End,
|
Setting_End,
|
||||||
};
|
};
|
||||||
|
|
||||||
QNetworkRequest netReq(const QString &url, const QByteArray & = QByteArray(), int = QNetworkRequest::DefaultTransferTimeoutConstant);
|
|
||||||
inline QNetworkRequest reqForJson(const QString &url, int timeout = QNetworkRequest::DefaultTransferTimeoutConstant) {
|
|
||||||
return netReq(url, "application/json", timeout);
|
|
||||||
}
|
|
||||||
QString replyErr(QNetworkReply *);
|
QString replyErr(QNetworkReply *);
|
||||||
QString checkReply(QNetworkReply *, QJsonDocument * = 0);
|
QString checkReply(QNetworkReply *, QJsonDocument * = 0);
|
||||||
QString checkReplyForJson(QNetworkReply *, QJsonDocument * = 0, QByteArray * = 0);
|
QString checkReplyForJson(QNetworkReply *, QJsonDocument * = 0, QByteArray * = 0);
|
||||||
|
@ -182,13 +179,8 @@ QString checkReplyForJson(QNetworkReply *, QJsonDocument * = 0, QByteArray * = 0
|
||||||
#define Def_CtrlReqPre \
|
#define Def_CtrlReqPre \
|
||||||
waitingDlg->show();\
|
waitingDlg->show();\
|
||||||
auto card = gSelCards->at(0);\
|
auto card = gSelCards->at(0);\
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));\
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);\
|
||||||
connect(waitingDlg, &WaitingDlg::rejected, reply, [reply] {\
|
waitingDlg->connAbort(reply);
|
||||||
reply->blockSignals(true);\
|
|
||||||
reply->abort();\
|
|
||||||
reply->blockSignals(false);\
|
|
||||||
reply->deleteLater();\
|
|
||||||
});
|
|
||||||
|
|
||||||
#define Def_CtrlSetReqAfter \
|
#define Def_CtrlSetReqAfter \
|
||||||
QString err = checkReplyForJson(reply);\
|
QString err = checkReplyForJson(reply);\
|
||||||
|
@ -209,7 +201,7 @@ QString checkReplyForJson(QNetworkReply *, QJsonDocument * = 0, QByteArray * = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
#define Def_CtrlSetMulti(tip) \
|
#define Def_CtrlSetMulti(tip) \
|
||||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));\
|
auto reply = NetReq("http://"+card->m_strCardIp+":2016/settings").timeout(120000).post(json);\
|
||||||
connect(reply, &QNetworkReply::finished, card, [=] {\
|
connect(reply, &QNetworkReply::finished, card, [=] {\
|
||||||
QString err = checkReplyForJson(reply);\
|
QString err = checkReplyForJson(reply);\
|
||||||
gFdResInfo->append(card->m_strCardId+" "+tip+" "+(err.isEmpty()?QCoreApplication::translate("Def","Success"):err));\
|
gFdResInfo->append(card->m_strCardId+" "+tip+" "+(err.isEmpty()?QCoreApplication::translate("Def","Success"):err));\
|
||||||
|
|
|
@ -6,6 +6,16 @@
|
||||||
#include <QTableWidget>
|
#include <QTableWidget>
|
||||||
#include <QHeaderView>
|
#include <QHeaderView>
|
||||||
|
|
||||||
|
#define MainMust \
|
||||||
|
#if(QT_VERSION_MAJOR > 5) \
|
||||||
|
QImageReader::setAllocationLimit(0);\
|
||||||
|
#else\
|
||||||
|
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);\
|
||||||
|
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);\
|
||||||
|
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);\
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
extern const int AlignRight;
|
extern const int AlignRight;
|
||||||
|
|
||||||
inline int setCurrentData(QComboBox *combo, const QVariant &data) {
|
inline int setCurrentData(QComboBox *combo, const QVariant &data) {
|
||||||
|
@ -259,6 +269,12 @@ public:
|
||||||
obj->setFont(font);
|
obj->setFont(font);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
inline Wrp& font(int size){
|
||||||
|
auto font = obj->font();
|
||||||
|
font.setPixelSize(size);
|
||||||
|
obj->setFont(font);
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
inline Wrp& width(int w){
|
inline Wrp& width(int w){
|
||||||
obj->setFixedWidth(w);
|
obj->setFixedWidth(w);
|
||||||
|
|
|
@ -12,10 +12,16 @@ QNetworkAccessManager &netAccess();
|
||||||
|
|
||||||
class NetReq : public QNetworkRequest {
|
class NetReq : public QNetworkRequest {
|
||||||
public:
|
public:
|
||||||
NetReq();
|
NetReq() {init();};
|
||||||
explicit NetReq(const QString &url) : QNetworkRequest{url}{};
|
explicit NetReq(const QString &url) : QNetworkRequest{url} {init();};
|
||||||
explicit NetReq(const QUrl &url) : QNetworkRequest{url}{};
|
explicit NetReq(const QUrl &url) : QNetworkRequest{url} {init();};
|
||||||
NetReq(const QNetworkRequest &other) : QNetworkRequest{other}{};
|
NetReq(const QNetworkRequest &other) : QNetworkRequest{other} {init();};
|
||||||
|
|
||||||
|
inline void init() {
|
||||||
|
#if(QT_VERSION_MAJOR < 6)
|
||||||
|
setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
inline NetReq &type(const QByteArray &value) {
|
inline NetReq &type(const QByteArray &value) {
|
||||||
setRawHeader("Content-Type", value);
|
setRawHeader("Content-Type", value);
|
||||||
|
@ -29,10 +35,6 @@ public:
|
||||||
setTransferTimeout(timeout);
|
setTransferTimeout(timeout);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
inline NetReq &v5() {
|
|
||||||
setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QNetworkReply *get() {
|
inline QNetworkReply *get() {
|
||||||
return netAccess().get(*this);
|
return netAccess().get(*this);
|
||||||
|
@ -40,13 +42,15 @@ public:
|
||||||
inline QNetworkReply *post(const QByteArray &data) {
|
inline QNetworkReply *post(const QByteArray &data) {
|
||||||
return netAccess().post(*this, data);
|
return netAccess().post(*this, data);
|
||||||
}
|
}
|
||||||
inline QNetworkReply *post(const QJsonObject &json) {
|
inline QNetworkReply *post(const QJsonDocument &json) {
|
||||||
setRawHeader("Content-Type", "application/json");
|
setRawHeader("Content-Type", "application/json");
|
||||||
return netAccess().post(*this, QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
return netAccess().post(*this, json.toJson(QJsonDocument::Compact));
|
||||||
|
}
|
||||||
|
inline QNetworkReply *post(const QJsonObject &json) {
|
||||||
|
return post(QJsonDocument{json});
|
||||||
}
|
}
|
||||||
inline QNetworkReply *post(const QJsonArray &json) {
|
inline QNetworkReply *post(const QJsonArray &json) {
|
||||||
setRawHeader("Content-Type", "application/json");
|
return post(QJsonDocument{json});
|
||||||
return netAccess().post(*this, QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
|
||||||
}
|
}
|
||||||
inline QNetworkReply *post(QHttpMultiPart *multiPart) {
|
inline QNetworkReply *post(QHttpMultiPart *multiPart) {
|
||||||
return netAccess().post(*this, multiPart);
|
return netAccess().post(*this, multiPart);
|
||||||
|
@ -56,6 +60,13 @@ public:
|
||||||
QString errStr(QNetworkReply *);
|
QString errStr(QNetworkReply *);
|
||||||
QString errStrWithData(QNetworkReply *, QJsonDocument * = 0);
|
QString errStrWithData(QNetworkReply *, QJsonDocument * = 0);
|
||||||
|
|
||||||
|
inline void abortSilence(QNetworkReply *reply) {
|
||||||
|
reply->blockSignals(true);
|
||||||
|
reply->abort();
|
||||||
|
reply->blockSignals(false);
|
||||||
|
reply->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
const char* socketErrKey(int value);
|
const char* socketErrKey(int value);
|
||||||
|
|
||||||
class TcpSocket : public QTcpSocket {
|
class TcpSocket : public QTcpSocket {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user