This commit is contained in:
Gangphon 2023-10-23 15:08:45 +08:00
parent 3a7eaae7a8
commit 8bf38c468d
15 changed files with 202 additions and 120 deletions

View File

@ -1,6 +1,6 @@
#include "ctrladvancedpanel.h"
#include "globaldefine.h"
#include "base/waitingdlg.h"
#include "gutil/qwaitingdlg.h"
#include "base/changepasswordform.h"
#include "tools.h"
#include "gutil/qgui.h"
@ -30,9 +30,14 @@
CtrlAdvancedPanel::CtrlAdvancedPanel() {
setFocusPolicy(Qt::StrongFocus);
auto vBox = new QVBoxLayout(this);
auto vBox = new VBox(this);
vBox->setContentsMargins(6,6,6,0);
lbTitle = new QLabel;
auto ft = lbTitle->font();
ft.setPixelSize(16);
ft.setBold(true);
lbTitle->setFont(ft);
lbTitle->setAlignment(Qt::AlignCenter);
vBox->addWidget(lbTitle);
@ -119,7 +124,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
auto item = findItem(card.id);
if(item) {
item->mCard.alias = alias;
item->setText(DeviceTable_Remark, alias);
item->setText("alias", alias);
}
});
} else {
@ -132,7 +137,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
auto item = findItem(card.id);
if(item) {
item->mCard.alias = alias;
item->setText(DeviceTable_Remark, alias);
item->setText("alias", alias);
}
});
}
@ -185,7 +190,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
fdCompanyId->setFocus();
return;
}
auto res = QMessageBox::question(this, tr("Tip Info"), tr("Do you want to modify webserveraddress and companyId?"));
auto res = QMessageBox::question(this, tr("Tip Info"), tr("This operation will clear current program.")+"\n"+tr("Do you want to continue?"));
if(res != QMessageBox::Yes) return;
QJsonObject json;
json.insert("_id", "SetOnlineAddr");
@ -279,8 +284,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
btnWareUpdate->setMinimumSize(100, 30);
btnWareUpdate->setProperty("ssType", "progManageTool");
connect(btnWareUpdate, &QPushButton::clicked, this, [=] {
UpgradeApkDialog dlg(this);
dlg.exec();
new UpgradeApkDialog(this);
});
hBox->addWidget(btnWareUpdate);
@ -317,7 +321,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
infoDlg->setWindowTitle(tr("Software Version Info"));
auto vBox = new QVBoxLayout(infoDlg);
vBox->setContentsMargins(0, 0, 0, 0);
auto table = new Table{
auto table = new TableWidget{
{"apk", "Apk"},
{"ver", tr("Version")},
{"pkg", tr("Package")}
@ -487,7 +491,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
tcp->connectToHost(card.ip, 3333);
tcp->startTimer(10000);
} else {
foreach(auto card, gSelCards) {
for(auto &card : gSelCards) {
auto tcp = new TcpSocket;
auto cardId = card.id;
connect(tcp, &QTcpSocket::connected, tcp, [=] {
@ -608,23 +612,24 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
waitingDlg->show();
auto card = gSelCards[0];
auto reply = NetReq("http://"+card.ip+":2016/download?file=logs").timeout(120000).get();
waitingDlg->connAbort(reply);
connect(reply, &QNetworkReply::finished, this, [=] {
ConnReply(reply, waitingDlg) [=] {
waitingDlg->close();
QString err = checkReply(reply);
if(! err.isEmpty()) {
QMessageBox::critical(this, tr("Error"), err);
return;
}
QString logFile = QApplication::applicationDirPath()+"/card-log.txt";
QFile file(logFile);
if(! file.open(QIODevice::WriteOnly)) {
QMessageBox::critical(this, tr("Error"), "Open for Write Fail");
return;
}
file.write(reply->readAll());
file.close();
QProcess::execute("notepad", {logFile});
auto wgt = new QWidget(this, Qt::Window);
wgt->setAttribute(Qt::WA_DeleteOnClose);
wgt->resize(800, 800);
auto vv = new VBox(wgt);
vv->setContentsMargins(0,0,0,0);
auto fdLog = new QTextEdit;
fdLog->setPlainText(reply->readAll());
vv->addWidget(fdLog);
wgt->show();
wgt->raise();
wgt->activateWindow();
});
}
});
@ -738,8 +743,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
waitingDlg->show();
NetReq req("http://"+gSelCards[0].ip+":2016/upload?type=update_display");
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
waitingDlg->connAbort(reply);
connect(reply, &QNetworkReply::finished, this, [=] {
ConnReply(reply, waitingDlg) [=] {
QString err = checkReply(reply);
if(! err.isEmpty()) {
waitingDlg->close();
@ -817,7 +821,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSingleGetReply
waitingDlg->success();
setCurrentData(fdDisMode, json["result"].toInt());
SetCurData(fdDisMode, json["result"].toInt());
});
} else {
foreach(auto card, gSelCards) {
@ -973,8 +977,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
auto waitingDlg = new WaitingDlg(this, tr("InvokeTaxiAppFunction"));
waitingDlg->show();
auto reply = NetReq("http://"+gSelCards[0].ip+":3000").timeout(120000).post(json);
waitingDlg->connAbort(reply);
connect(reply, &QNetworkReply::finished, this, [=] {
ConnReply(reply, waitingDlg) [=] {
QString err = checkReply(reply);
if(! err.isEmpty()) {
waitingDlg->close();
@ -1358,8 +1361,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
waitingDlg->show();
NetReq req("http://"+gSelCards[0].ip+":2016/upload?type=mcu_update");
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
waitingDlg->connAbort(reply);
connect(reply, &QNetworkReply::finished, this, [=] {
ConnReply(reply, waitingDlg) [=] {
QString err = checkReply(reply);
if(! err.isEmpty()) {
waitingDlg->close();
@ -1423,7 +1425,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
QString file = QFileDialog::getOpenFileName(this, tr("Select File"), gFileHome, EPhoto::filters());
auto file = QFileDialog::getOpenFileName(this, tr("Select File"), gFileHome, EPhoto::filters());
if(file.isEmpty()) return;
QFileInfo info(file);
if(! info.isFile()) return;
@ -1653,7 +1655,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
lbRotate = new QLabel;
hBox->addWidget(lbRotate);
hBox->addSpacing(20);
hBox->addSpacing(12);
auto fdDeg0 = new QRadioButton("");
hBox->addWidget(fdDeg0);
@ -1735,6 +1737,42 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
hBox->addStretch();
hBox = new HBox(vBox);
lbChargingStation = new QLabel(tr("Charging Station")+" ID:");
hBox->addWidget(lbChargingStation);
auto fdChargingStation = new QLineEdit;
fdChargingStation->setMaximumWidth(120);
hBox->addWidget(fdChargingStation);
btnChargingStationSet = new QPushButton;
btnChargingStationSet->setProperty("ssType", "progManageTool");
connect(btnChargingStationSet, &QPushButton::clicked, this, [=] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "SetChargingStationID");
json.insert("_type", "SetChargingStationID");
json.insert("number", fdChargingStation->text());
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("Setting ")+tr("Charging Station")+" ID ...");
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSetReqAfter
});
} else {
foreach(auto card, gSelCards) {
Def_CtrlSetMulti(tr("Set")+" "+tr("Charging Station")+" ID")
}
}
});
hBox->addWidget(btnChargingStationSet);
hBox->addStretch();
hBox = new HBox(vBox);
lbBaudCfg = new QLabel;
@ -1932,10 +1970,54 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
});
hBox->addWidget(btnSendCustomJson);
btnCustomJsonGet = new QPushButton;
btnCustomJsonGet->setProperty("ssType", "progManageTool");
connect(btnCustomJsonGet, &QPushButton::clicked, this, [=] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
auto text = fdCustomJson->toPlainText().toUtf8();
if(text.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("Text is empty"));
return;
}
QString jsonErr;
auto json = JFrom(text, &jsonErr);
if(! jsonErr.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("Json Parse Error")+" "+jsonErr);
return;
}
if(! json.isObj()) {
QMessageBox::information(this, tr("Tip"), tr("Json isn't an Object"));
return;
}
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, "Custom Json Getting ...");
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
waitingDlg->close();
auto err = errStrWithData(reply);
if(! err.isEmpty()) QMessageBox::critical(this, tr("Error"), err);
else QMessageBox::information(this, tr("Info"), reply->readAll());
});
} else {
foreach(auto card, gSelCards) {
auto reply = NetReq("http://"+card.ip+":2016/settings").timeout(120000).post(json);
connect(reply, &QNetworkReply::finished, gFdResInfo, [=] {
auto err = errStrWithData(reply);
gFdResInfo->append(card.id+" Custom Json Get "+(err.isEmpty()?reply->readAll():err));
});
}
}
});
hBox->addWidget(btnCustomJsonGet);
hBox->addStretch();
fdCustomJson = new QTextEdit;
fdCustomJson->setMinimumHeight(120);
fdCustomJson->setPlainText("{\"_id\":\"0\",\"_type\":\"\"}");
vBox->addWidget(fdCustomJson);
@ -1992,7 +2074,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSingleGetReply
waitingDlg->success();
setCurrentData(fdTraficProtocol, json["protocolType"].toInt());
SetCurData(fdTraficProtocol, json["protocolType"].toInt());
});
} else {
foreach(auto card, gSelCards) {
@ -2079,7 +2161,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSingleGetReply
waitingDlg->success();
setCurrentData(fdServerType, json["serverType"].toInt());
SetCurData(fdServerType, json["serverType"].toInt());
fdPort->setValue(json["port"].toInt());
});
} else {
@ -2108,6 +2190,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
vBox->addWidget(grpBoxHiddenSettings);
vBox->addStretch();
if(QSettings().value("advUiPs", "888").toString().isEmpty()) isPassed = true;
connect(gDevicePanel, &DevicePanel::sigSelectedDeviceList, this, [this] {
if(isVisible()) init();
});
@ -2150,8 +2233,8 @@ void CtrlAdvancedPanel::init() {
vBox->addWidget(btnBox);
connect(btnBox, &QDialogButtonBox::accepted, &dlg, [=, &dlg] {
QString pwdRaw = QSettings().value("advUiPs").toString();
QString password = pwdRaw.isEmpty() ? "888" : QString::fromUtf8(QByteArray::fromBase64(pwdRaw.toLatin1()));
auto pwdVar = QSettings().value("advUiPs");
auto password = pwdVar.isNull() ? "888" : QString::fromUtf8(QByteArray::fromBase64(pwdVar.toString().toLatin1()));
if(fdPassword->text() == password) dlg.accept();
else QMessageBox::critical(&dlg, tr("Tip"),tr("Password is error"));
});
@ -2163,7 +2246,6 @@ void CtrlAdvancedPanel::init() {
bool isSingle = gSelCards.count()==1;
btnApkCheck->setEnabled(isSingle);
btnRestart->setEnabled(isSingle);
btnGetLog->setEnabled(isSingle);
if(! isSingle) {
@ -2195,10 +2277,13 @@ void CtrlAdvancedPanel::init() {
}
auto isY50 = card.id.startsWith("st5", Qt::CaseInsensitive)
|| card.id.startsWith("m5s", Qt::CaseInsensitive)
|| card.id.startsWith("m6s", Qt::CaseInsensitive)
|| card.id.startsWith("m7s", Qt::CaseInsensitive)
|| card.id.startsWith("y5", Qt::CaseInsensitive);
|| card.id.startsWith("m5h", Qt::CaseInsensitive)
|| card.id.startsWith("m5s", Qt::CaseInsensitive)
|| card.id.startsWith("m6s", Qt::CaseInsensitive)
|| card.id.startsWith("m7s", Qt::CaseInsensitive)
|| card.id.startsWith("y1", Qt::CaseInsensitive)
|| card.id.startsWith("y4", Qt::CaseInsensitive)
|| card.id.startsWith("y5", Qt::CaseInsensitive);
grpY50->setVisible(isY50);
QJsonObject json;
@ -2262,6 +2347,7 @@ void CtrlAdvancedPanel::transUi() {
lbRotate->setText(tr("Rotate"));
btnRotateSet->setText(tr("Set"));
btnRotateGet->setText(tr("Get"));
btnChargingStationSet->setText(tr("Set"));
grpBoxHiddenSettings->setTitle(tr("Hidden Settings")+" ("+tr("Click right button to hide")+")");
btnSysUpd->setText(tr("System Update"));
@ -2276,6 +2362,7 @@ void CtrlAdvancedPanel::transUi() {
fdIsOpenADB->setText(tr("Open ADB"));
lbCustomJson->setText(tr("Post Custom JSON"));
btnSendCustomJson->setText(tr("Send"));
btnCustomJsonGet->setText(tr("Get"));
grpHighForBusy->setTitle(tr("Taxi top screen configuration"));
label->setText(tr("Realtimer Server Address:"));
@ -2368,22 +2455,11 @@ void PlayerBackSendThread::run() {
auto remain = info.size();
auto req = QJsonObject();
req.insert("_type", "proStart");
req.insert("proName", "program");
req.insert("proSize", remain);
req.insert("zVer","xixun1");
auto resNum = tcp.write(QJsonDocument(req).toJson(QJsonDocument::Compact));
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
emit emErr(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" when write 'proStart'");
tcp.close();
return;
}
req = QJsonObject();
req.insert("_type", "imgFileStart");
req.insert("id", baseName);
req.insert("size", remain);
req.insert("zVer","xixun1");
resNum = tcp.write(QJsonDocument(req).toJson(QJsonDocument::Compact));
auto resNum = tcp.write(QJsonDocument(req).toJson(QJsonDocument::Compact));
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
emit emErr(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" when write 'imgFileStart'");
tcp.close();
@ -2425,28 +2501,18 @@ void PlayerBackSendThread::run() {
req.insert("zVer","xixun1");
resNum = tcp.write(QJsonDocument(req).toJson(QJsonDocument::Compact));
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
emit emErr(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" when write 'fileEnd'");
emit emErr(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" when write 'imgFileEnd'");
tcp.close();
return;
}
req = QJsonObject();
req.insert("_type", "proEnd");
req.insert("proName", "program");
req.insert("zVer","xixun1");
resNum = tcp.write(QJsonDocument(req).toJson(QJsonDocument::Compact));
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
emit emErr(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" when write 'proEnd'");
tcp.close();
return;
};
if(! tcp.waitForReadyRead()) {
emit emErr(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" when waitForRead 'proEnd'");
emit emErr(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" when waitForRead 'imgFileEnd'");
tcp.close();
return;
}
auto resp = tcp.readAll();
if(resp.isEmpty()) {
emit emErr(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" when read 'proEnd'");
emit emErr(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" when read 'imgFileEnd'");
tcp.close();
return;
}

View File

@ -92,13 +92,13 @@ private:
QGroupBox *grpBoxHiddenSettings;
QPushButton *btnSysUpd, *btnMcuUpd, *btnMcuGet;
QPushButton *btnRotateSet, *btnRotateGet;
QLabel *lbRotate, *lbBaudCfg, *lbBaudModel, *lbUart, *lbBaud;
QPushButton *btnRotateSet, *btnRotateGet, *btnChargingStationSet;
QLabel *lbRotate, *lbChargingStation, *lbBaudCfg, *lbBaudModel, *lbUart, *lbBaud;
QPushButton *btnBaudSet, *btnBaudGet;
QCheckBox *fdIsOpenADB;
QLabel *lbCustomJson;
QTextEdit *fdCustomJson;
QPushButton *btnSendCustomJson;
QPushButton *btnSendCustomJson, *btnCustomJsonGet;
QLabel *lbTraficProtocol, *lbCardMode, *lbTraficPort;
QComboBox *fdServerType;

View File

@ -1,5 +1,5 @@
#include "ctrlbrightpanel.h"
#include "base/waitingdlg.h"
#include "gutil/qwaitingdlg.h"
#include "gutil/qnetwork.h"
#include "globaldefine.h"
#include "tools.h"
@ -17,16 +17,15 @@
CtrlBrightPanel::CtrlBrightPanel() {
auto vBox = new VBox(this);
vBox->setContentsMargins(0,0,0,0);
vBox->addSpacing(8);
vBox->setContentsMargins(6,6,6,0);
lbBrightCfg = new QLabel;
auto font = lbBrightCfg->font();
font.setPixelSize(font.pixelSize()+2);
font.setBold(true);
lbBrightCfg->setFont(font);
lbBrightCfg->setAlignment(Qt::AlignCenter);
vBox->addWidget(lbBrightCfg);
lbTitle = new QLabel;
auto ft = lbTitle->font();
ft.setPixelSize(16);
ft.setBold(true);
lbTitle->setFont(ft);
lbTitle->setAlignment(Qt::AlignCenter);
vBox->addWidget(lbTitle);
vBox->addSpacing(9);
auto hBox = new HBox(vBox);
@ -528,7 +527,7 @@ CtrlBrightPanel::CtrlBrightPanel() {
auto item = findItem(card.id);
if(item) {
item->mCard.bright = bright;
item->setData(DeviceTable_Brightness, 0, QString::number(bright)+"%");
item->setText("brightness", QString::number(bright)+"%");
}
});
} else {
@ -544,7 +543,7 @@ CtrlBrightPanel::CtrlBrightPanel() {
auto item = findItem(card.id);
if(item) {
item->mCard.bright = bright;
item->setData(DeviceTable_Brightness, 0, err);
item->setText("brightness", err);
}
}
gFdResInfo->append(card.id+" "+tr("Brightness")+" "+err);
@ -618,7 +617,6 @@ CtrlBrightPanel::CtrlBrightPanel() {
btnScheClear = new QPushButton;
btnScheClear->setMinimumSize(60, 30);
btnScheClear->setProperty("ssType", "progManageTool");
connect(btnScheClear, &QPushButton::clicked, this, [this] {tableSche->setRowCount(0);});
hBox->addWidget(btnScheClear);
hBox->addStretch();
@ -719,15 +717,17 @@ CtrlBrightPanel::CtrlBrightPanel() {
hBox->addWidget(btnScheExport);
tableSche = new Table({
tableSche = new TableWidget{
{"bright", "", 300},
{"start", "", 100},
{"end", "", 100}
});
};
tableSche->setDefs();
tableSche->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
vBox->addWidget(tableSche);
connect(btnScheClear, &QPushButton::clicked, tableSche, &TableWidget::clearRows);
hBox = new HBox(vBox);
hBox->addStretch();
@ -866,7 +866,7 @@ void CtrlBrightPanel::changeEvent(QEvent *event) {
if(event->type() == QEvent::LanguageChange) transUi();
}
void CtrlBrightPanel::transUi() {
lbBrightCfg->setText(tr("Brightness Configuration"));
lbTitle->setText(tr("Brightness Config"));
radioAuto->setText(tr("Auto"));
radioManual->setText(tr("Manual"));
radioSchedule->setText(tr("Schedule"));

View File

@ -20,7 +20,7 @@ protected:
private:
bool restoreScheduleJson(QJsonDocument &, int);
void getScheduleJson(QJsonObject &, int);
QLabel *lbBrightCfg;
QLabel *lbTitle;
QRadioButton *radioAuto;
QRadioButton *radioManual;
QRadioButton *radioSchedule;
@ -59,7 +59,7 @@ private:
QSlider *fdDefBright;
QPushButton *btnScheImport;
QPushButton *btnScheExport;
Table *tableSche;
TableWidget *tableSche;
QPushButton *btnScheSet;
QPushButton *btnScheGet;
};

View File

@ -3,7 +3,7 @@
#include "gutil/qnetwork.h"
#include "tools.h"
#include "globaldefine.h"
#include "base/waitingdlg.h"
#include "gutil/qwaitingdlg.h"
#include <QMessageBox>
#include <QButtonGroup>
#include <QTimeEdit>
@ -13,16 +13,18 @@
CtrlHdmiPanel::CtrlHdmiPanel() {
auto vBox = new QVBoxLayout(this);
vBox->setContentsMargins(6,6,6,0);
lbHdmiCfg = new QLabel;
auto ft = lbHdmiCfg->font();
ft.setPixelSize(16);
ft.setBold(true);
lbHdmiCfg->setFont(ft);
lbHdmiCfg->setAlignment(Qt::AlignCenter);
vBox->addWidget(lbHdmiCfg);
vBox->addSpacing(9);
auto line = new QFrame;
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
vBox->addWidget(line);
auto hBox = new QHBoxLayout();
auto hBox = new HBox(vBox);
hBox->addStretch();
fdManual = new QRadioButton;
@ -33,8 +35,6 @@ CtrlHdmiPanel::CtrlHdmiPanel() {
hBox->addWidget(fdSchedule);
hBox->addStretch();
vBox->addLayout(hBox);
auto stacked = new QStackedLayout(vBox);
{
auto vBox = new VBox(stacked);
@ -150,7 +150,7 @@ CtrlHdmiPanel::CtrlHdmiPanel() {
auto hBox = new HBox(vBox);
hBox->setSpacing(10);
tableSche = new Table({
tableSche = new TableWidget{
{"start", "", 100},
{"end", "", 100},
{"0", "", 60},
@ -160,9 +160,8 @@ CtrlHdmiPanel::CtrlHdmiPanel() {
{"4", "", 60},
{"5", "", 60},
{"6", "", 60}
});
};
tableSche->setDefs();
tableSche->setStyleSheet("Table {selection-background-color: #8ce;}");
btnScheAdd = new QPushButton;
btnScheAdd->setMinimumSize(QSize(60, 30));
@ -199,7 +198,7 @@ CtrlHdmiPanel::CtrlHdmiPanel() {
btnScheClear = new QPushButton;
btnScheClear->setMinimumSize(QSize(60, 30));
btnScheClear->setProperty("ssType", "progManageTool");
connect(btnScheClear, &QPushButton::clicked, tableSche, &Table::clearRows);
connect(btnScheClear, &QPushButton::clicked, tableSche, &TableWidget::clearRows);
hBox->addWidget(btnScheClear);
hBox->addStretch();

View File

@ -23,7 +23,7 @@ private:
QRadioButton *fdManual, *fdSchedule, *fdAsync, *fdHdmi, *fdHdmi2;
QPushButton *btnSyncSet, *btnSyncGet;
Table *tableSche;
TableWidget *tableSche;
QPushButton *btnScheAdd;
QPushButton *btnScheDel;
QPushButton *btnScheClear;

View File

@ -1,5 +1,5 @@
#include "ctrlnetworkpanel.h"
#include "base/waitingdlg.h"
#include "gutil/qwaitingdlg.h"
#include "globaldefine.h"
#include "tools.h"
#include "devicepanel.h"
@ -346,7 +346,7 @@ CtrlNetworkPanel::CtrlNetworkPanel() {
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("ConfigurationWiFi")+" ...");
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
connect(reply, &QNetworkReply::finished, waitingDlg, [=] {
QString err = checkReplyForJson(reply);
if(! err.isEmpty()) {
waitingDlg->close();
@ -354,8 +354,7 @@ CtrlNetworkPanel::CtrlNetworkPanel() {
return;
}
auto reply = NetReq("http://"+card.ip+":2016/settings").timeout(120000).post(json2);
waitingDlg->connAbort(reply);
connect(reply, &QNetworkReply::finished, this, [=] {
ConnReply(reply, waitingDlg) [=] {
Def_CtrlSetReqAfter
});
});

View File

@ -2,7 +2,7 @@
#include "globaldefine.h"
#include "deviceitem.h"
#include "devicepanel.h"
#include "base/waitingdlg.h"
#include "gutil/qwaitingdlg.h"
#include "gutil/qnetwork.h"
#include "tools.h"
#include <QMessageBox>
@ -12,10 +12,16 @@
CtrlPowerPanel::CtrlPowerPanel() {
auto vBox = new VBox(this);
vBox->setContentsMargins(6,6,6,0);
lbScreenCfg = new QLabel;
auto ft = lbScreenCfg->font();
ft.setPixelSize(16);
ft.setBold(true);
lbScreenCfg->setFont(ft);
lbScreenCfg->setAlignment(Qt::AlignCenter);
vBox->addWidget(lbScreenCfg);
vBox->addSpacing(9);
auto hBox = new HBox(vBox);
hBox->addStretch();
@ -92,8 +98,8 @@ CtrlPowerPanel::CtrlPowerPanel() {
auto item = findItem(card.id);
if(item) {
item->mCard.isScreenOn = json["on"].toBool();
item->setForeground(DeviceTable_Power, item->mCard.isScreenOn ? Qt::green : Qt::red);
item->setData(DeviceTable_Power, 0, item->mCard.isScreenOn ? tr("On") : tr("Off"));
item->setForeground("power", item->mCard.isScreenOn ? Qt::green : Qt::red);
item->setText("power", item->mCard.isScreenOn ? tr("On") : tr("Off"));
}
});
} else {
@ -107,8 +113,8 @@ CtrlPowerPanel::CtrlPowerPanel() {
auto item = findItem(card.id);
if(item) {
item->mCard.isScreenOn = json["on"].toBool();
item->setForeground(DeviceTable_Power, item->mCard.isScreenOn ? Qt::green : Qt::red);
item->setData(DeviceTable_Power, 0, err);
item->setForeground("power", item->mCard.isScreenOn ? Qt::green : Qt::red);
item->setText("power", err);
}
}
gFdResInfo->append(card.id+" "+tr("IsScreenOn")+" "+err);
@ -124,7 +130,7 @@ CtrlPowerPanel::CtrlPowerPanel() {
auto hBox = new HBox(vBox);
hBox->setSpacing(10);
tableSche = new Table({
tableSche = new TableWidget{
{"start", "", 100},
{"end", "", 100},
{"0", "", 60},
@ -134,7 +140,7 @@ CtrlPowerPanel::CtrlPowerPanel() {
{"4", "", 60},
{"5", "", 60},
{"6", "", 60}
});
};
tableSche->setDefs();
pushButtonAdd = new QPushButton;
@ -172,7 +178,7 @@ CtrlPowerPanel::CtrlPowerPanel() {
pushButtonClear = new QPushButton;
pushButtonClear->setMinimumSize(QSize(60, 30));
pushButtonClear->setProperty("ssType", "progManageTool");
connect(pushButtonClear, &QPushButton::clicked, tableSche, &Table::clearRows);
connect(pushButtonClear, &QPushButton::clicked, tableSche, &TableWidget::clearRows);
hBox->addWidget(pushButtonClear);
hBox->addStretch();

View File

@ -34,7 +34,7 @@ private:
QPushButton *pushButtonImport;
QPushButton *pushButtonExport;
QLabel *labelPowerScheduleTip;
Table *tableSche;
TableWidget *tableSche;
QPushButton *pushButtonApply;
QPushButton *pushButtonClearSchedule;
QPushButton *pushButtonReadback;

View File

@ -1,7 +1,7 @@
#include "ctrlpwdpanel.h"
#include "gutil/qgui.h"
#include "gutil/qnetwork.h"
#include "base/waitingdlg.h"
#include "gutil/qwaitingdlg.h"
#include "QFileDialog"
#include <QMessageBox>
#include <QJsonObject>
@ -12,7 +12,13 @@
CtrlPwdPanel::CtrlPwdPanel() {
auto vBox = new VBox(this);
vBox->setContentsMargins(6,6,6,0);
lbPwdConfig = new QLabel;
auto font = lbPwdConfig->font();
font.setPixelSize(16);
font.setBold(true);
lbPwdConfig->setFont(font);
lbPwdConfig->setAlignment(Qt::AlignCenter);
vBox->addWidget(lbPwdConfig);
vBox->addSpacing(20);

View File

@ -2,7 +2,7 @@
#include "tools.h"
#include "gutil/qgui.h"
#include "gutil/qnetwork.h"
#include "base/waitingdlg.h"
#include "gutil/qwaitingdlg.h"
#include <QFileDialog>
#include <QLineEdit>
#include <QJsonObject>

View File

@ -1,5 +1,5 @@
#include "ctrlverifyclockpanel.h"
#include "base/waitingdlg.h"
#include "gutil/qwaitingdlg.h"
#include "gutil/qnetwork.h"
#include "globaldefine.h"
#include "gutil/qgui.h"

View File

@ -1,6 +1,6 @@
#include "ctrlvolumepanel.h"
#include "globaldefine.h"
#include "base/waitingdlg.h"
#include "gutil/qwaitingdlg.h"
#include "gutil/qnetwork.h"
#include "tools.h"
#include <QMessageBox>
@ -11,10 +11,16 @@
CtrlVolumePanel::CtrlVolumePanel() {
auto vBox = new VBox(this);
vBox->setContentsMargins(6,6,6,0);
lbVolumeControl = new QLabel;
auto ft = lbVolumeControl->font();
ft.setPixelSize(16);
ft.setBold(true);
lbVolumeControl->setFont(ft);
lbVolumeControl->setAlignment(Qt::AlignCenter);
vBox->addWidget(lbVolumeControl);
vBox->addSpacing(9);
auto hBox = new HBox(vBox);
hBox->addStretch();
@ -180,7 +186,6 @@ CtrlVolumePanel::CtrlVolumePanel() {
btnScheClear = new QPushButton;
btnScheClear->setMinimumSize(60, 30);
btnScheClear->setProperty("ssType", "progManageTool");
connect(btnScheClear, &QPushButton::clicked, this, [this] {tableSche->setRowCount(0);});
hBox->addWidget(btnScheClear);
lbDefBright = new QLabel;
@ -234,7 +239,7 @@ CtrlVolumePanel::CtrlVolumePanel() {
});
hBox->addWidget(btnScheExport);
tableSche = new Table({
tableSche = new TableWidget{
{"vol", "", 300},
{"start", "", 100},
{"end", "", 100},
@ -245,9 +250,10 @@ CtrlVolumePanel::CtrlVolumePanel() {
{"4", "", 60},
{"5", "", 60},
{"6", "", 60}
});
};
tableSche->setDefs();
vBox->addWidget(tableSche);
connect(btnScheClear, &QPushButton::clicked, tableSche, &TableWidget::clearRows);
hBox = new HBox(vBox);
hBox->addStretch();

View File

@ -36,7 +36,7 @@ private:
QSlider *fdDefBright;
QPushButton *btnScheImport;
QPushButton *btnScheExport;
Table *tableSche;
TableWidget *tableSche;
QPushButton *btnScheSet;
QPushButton *btnScheGet;
};

View File

@ -199,7 +199,7 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) {
item->fdProgress->setValue(bytesSent*100/bytesTotal);
});
ConnReply(reply, item->fdProgress) [=] {
QString err = errStrWithData(reply);
auto err = errStrWithData(reply);
if(! err.isEmpty()) {
item->setResult(tr("Upload error")+": "+err, Qt::red);
item->isUpdating = false;