ledok去除全局变量
This commit is contained in:
parent
c1b21b55af
commit
2f1adb07e6
|
@ -116,7 +116,6 @@ SOURCES += \
|
|||
device/wupgradeapkitem.cpp \
|
||||
program/copydirthread.cpp \
|
||||
program/eaclock.cpp \
|
||||
program/eaudio.cpp \
|
||||
program/ebase.cpp \
|
||||
program/edclock.cpp \
|
||||
program/eenviron.cpp \
|
||||
|
@ -203,7 +202,6 @@ HEADERS += \
|
|||
device/wupgradeapkitem.h \
|
||||
program/copydirthread.h \
|
||||
program/eaclock.h \
|
||||
program/eaudio.h \
|
||||
program/ebase.h \
|
||||
program/edclock.h \
|
||||
program/eenviron.h \
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
#include "Downloader.h"
|
||||
|
||||
static const QString PARTIAL_DOWN (".part");
|
||||
extern QWidget *gMainWin;
|
||||
|
||||
Downloader::Downloader (QWidget* parent) : QDialog (parent) {
|
||||
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
|
||||
|
@ -185,8 +184,8 @@ void Downloader::finished()
|
|||
* user about the error.
|
||||
*/
|
||||
void Downloader::openDownload() {
|
||||
if(!m_fileName.isEmpty()) QDesktopServices::openUrl(QUrl::fromLocalFile(m_downloadDir.filePath(m_fileName)));
|
||||
else QMessageBox::critical (gMainWin, tr("Error"), tr("Cannot find downloaded update!"), QMessageBox::Close);
|
||||
if(! m_fileName.isEmpty()) QDesktopServices::openUrl(QUrl::fromLocalFile(m_downloadDir.filePath(m_fileName)));
|
||||
else QMessageBox::critical(this, tr("Error"), tr("Cannot find downloaded update!"), QMessageBox::Close);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -216,7 +215,7 @@ void Downloader::installUpdate(){
|
|||
// box.setInformativeText (tr ("Click \"OK\" to begin installing the update"));
|
||||
|
||||
QString text = m_mandatoryUpdate ? tr("In order to install the update, you may need to quit the application. This is a mandatory update, exiting now will close the application") : tr("In order to install the update ");
|
||||
auto res = QMessageBox::information(gMainWin, tr("Tip Info"), text, QMessageBox::Ok, QMessageBox::Cancel);
|
||||
auto res = QMessageBox::information(this, tr("Tip Info"), text, QMessageBox::Ok, QMessageBox::Cancel);
|
||||
if(m_mandatoryUpdate) QApplication::quit();
|
||||
if(res == QMessageBox::Ok) {
|
||||
if(!useCustomInstallProcedures()) openDownload();
|
||||
|
|
|
@ -401,17 +401,16 @@ void ControlPowerSchedule:: OnClickClear()
|
|||
|
||||
}
|
||||
}
|
||||
extern QWidget *gMainWin;
|
||||
void ControlPowerSchedule::OnClickApply() {
|
||||
if(m_pLedlist==nullptr) return;
|
||||
if(m_pLedlist->count()<=1){
|
||||
if(m_pLedCard==nullptr||m_pLedlist->count()==0){
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
if(m_pModel->rowCount()<=0) {
|
||||
auto btn = QMessageBox::question(gMainWin, tr("Tip Info"), tr("Clear schedule task?"));
|
||||
auto btn = QMessageBox::question(this, tr("Tip Info"), tr("Clear schedule task?"));
|
||||
if(btn == QMessageBox::Yes) {
|
||||
QJsonObject json;
|
||||
json.insert("_id", getRandomString(10));
|
||||
|
@ -432,7 +431,7 @@ void ControlPowerSchedule::OnClickReadback() {
|
|||
if(m_pLedlist==nullptr) return;
|
||||
if(m_pLedlist->count()<=1) {
|
||||
if(m_pLedCard==nullptr||m_pLedlist->count()==0) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"),tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"),tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -450,11 +449,11 @@ void ControlPowerSchedule::OnClickClearSchedule()
|
|||
{
|
||||
if(m_pLedCard==nullptr||m_pLedlist->count()==0)
|
||||
{
|
||||
QMessageBox::information(gMainWin, tr("Tip"),tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"),tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
auto btn = QMessageBox::question(gMainWin, tr("Tip Info"), tr("Clear schedule task?"));
|
||||
auto btn = QMessageBox::question(this, tr("Tip Info"), tr("Clear schedule task?"));
|
||||
if(btn == QMessageBox::Yes) {
|
||||
QJsonObject json;
|
||||
json.insert("_id", getRandomString(10));
|
||||
|
|
|
@ -41,7 +41,7 @@ ControlPowerWidget::ControlPowerWidget(QWidget *parent, QList<LedCard *> *list)
|
|||
fdScreen->setTextColor(QColor(100,100,100), QColor(0, 160, 230));
|
||||
connect(fdScreen, &SwitchControl::checkedChanged, this, [this](bool checked) {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -51,7 +51,7 @@ ControlPowerWidget::ControlPowerWidget(QWidget *parent, QList<LedCard *> *list)
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, (checked ? tr("SetScreenOn") : tr("SetScreenOff"))+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -71,7 +71,7 @@ ControlPowerWidget::ControlPowerWidget(QWidget *parent, QList<LedCard *> *list)
|
|||
btnScreenGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnScreenGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
|
|
@ -39,7 +39,7 @@ ControlVolumeWidget::ControlVolumeWidget(QWidget *parent,QList<LedCard *> *list)
|
|||
fdVolume->setRange(0, 15);
|
||||
connect(fdVolume, &QSlider::sliderReleased, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -49,7 +49,7 @@ ControlVolumeWidget::ControlVolumeWidget(QWidget *parent,QList<LedCard *> *list)
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetVolume")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -71,7 +71,7 @@ ControlVolumeWidget::ControlVolumeWidget(QWidget *parent,QList<LedCard *> *list)
|
|||
fdVolumeGet->setProperty("ssType", "progManageTool");
|
||||
connect(fdVolumeGet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
|
|
@ -53,18 +53,18 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnScreenSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnScreenSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto width = fdScreenWidth->text();
|
||||
if(width.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"),tr("InputWidthTip"));
|
||||
QMessageBox::information(this, tr("Tip"),tr("InputWidthTip"));
|
||||
fdScreenWidth->setFocus();
|
||||
return;
|
||||
}
|
||||
auto height = fdScreenHeight->text();
|
||||
if(height.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"),tr("InputHeightTip"));
|
||||
QMessageBox::information(this, tr("Tip"),tr("InputHeightTip"));
|
||||
fdScreenHeight->setFocus();
|
||||
return;
|
||||
}
|
||||
|
@ -76,7 +76,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetScreenSize"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -100,12 +100,12 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnAliasSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnAliasSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto alias = fdAlias->text();
|
||||
if(alias.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"),tr("InputAliasTip"));
|
||||
QMessageBox::information(this, tr("Tip"),tr("InputAliasTip"));
|
||||
fdAlias->setFocus();
|
||||
return;
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetCardAlias"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -156,23 +156,23 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnWebServerSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnWebServerSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
|
||||
QString serverAddr = fdWebServerAddr->currentText();
|
||||
if(serverAddr.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"),tr("InputWebServerAddressTip"));
|
||||
QMessageBox::information(this, tr("Tip"),tr("InputWebServerAddressTip"));
|
||||
fdWebServerAddr->setFocus();
|
||||
return;
|
||||
}
|
||||
auto companyId = fdCompanyId->text();
|
||||
if(companyId.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"),tr("InputCompanyIdTip"));
|
||||
QMessageBox::information(this, tr("Tip"),tr("InputCompanyIdTip"));
|
||||
fdCompanyId->setFocus();
|
||||
return;
|
||||
}
|
||||
auto res = QMessageBox::question(gMainWin, tr("Tip Info"), tr("Do you want to modify webserveraddress and companyId?"));
|
||||
auto res = QMessageBox::question(this, tr("Tip Info"), tr("Do you want to modify webserveraddress and companyId?"));
|
||||
if(res != QMessageBox::Yes) return;
|
||||
QJsonObject json;
|
||||
json.insert("_id", "SetOnlineAddr");
|
||||
|
@ -182,7 +182,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetOnlineAddr"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -210,7 +210,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnRealtimeServerSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnRealtimeServerSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -220,7 +220,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetRealtimeServer")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -235,7 +235,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnRealtimeClear->setProperty("ssType", "progManageTool");
|
||||
connect(btnRealtimeClear, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
fdRealtimeServer->clearEditText();
|
||||
|
@ -246,7 +246,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("ClearRealtimeServer")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -265,8 +265,8 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnWareUpdate = new QPushButton;
|
||||
btnWareUpdate->setMinimumSize(100, 30);
|
||||
btnWareUpdate->setProperty("ssType", "progManageTool");
|
||||
connect(btnWareUpdate, &QPushButton::clicked, this, [] {
|
||||
UpgradeApkDialog dlg(gMainWin);
|
||||
connect(btnWareUpdate, &QPushButton::clicked, this, [=] {
|
||||
UpgradeApkDialog dlg(this);
|
||||
dlg.exec();
|
||||
});
|
||||
hBox->addWidget(btnWareUpdate);
|
||||
|
@ -281,7 +281,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnApkCheck->setProperty("ssType", "progManageTool");
|
||||
connect(btnApkCheck, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -332,12 +332,12 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
fdUninstall->setProperty("ssType", "progManageTool");
|
||||
connect(fdUninstall, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto pkg = fdPkg->currentText();
|
||||
if(pkg.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("Package name is null"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("Package name is null"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -347,7 +347,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("UninstallSoftware"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -362,12 +362,12 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnIsRunning->setProperty("ssType", "progManageTool");
|
||||
connect(btnIsRunning, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto pkg = fdPkg->currentText();
|
||||
if(pkg.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("Package name is null"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("Package name is null"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -377,10 +377,10 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Check apk running status"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSingleGetReply
|
||||
waitingDlg->close();
|
||||
QMessageBox::information(gMainWin, tr("Tip"), json["running"].toBool() ? tr("running") : tr("no running"));
|
||||
QMessageBox::information(this, tr("Tip"), json["running"].toBool() ? tr("running") : tr("no running"));
|
||||
});
|
||||
} else {
|
||||
foreach(auto card, *gSelCards) {
|
||||
|
@ -403,7 +403,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnRestart->setProperty("ssType", "progManageTool");
|
||||
connect(btnRestart, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -412,7 +412,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("RestartAndroid")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -427,7 +427,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnClearProg->setProperty("ssType", "progManageTool");
|
||||
connect(btnClearProg, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
if(gSelCards->count() == 1) {
|
||||
|
@ -441,19 +441,19 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
waitingDlg->close();
|
||||
tcp->abort();
|
||||
tcp->deleteLater();
|
||||
QMessageBox::critical(gMainWin, tr("Tip"), tr("Clear Program")+" "+tr("Timeout"));
|
||||
QMessageBox::critical(this, tr("Tip"), tr("Clear Program")+" "+tr("Timeout"));
|
||||
});
|
||||
connect(waitingDlg, &WaitingDlg::rejected, tcp, [=] {
|
||||
timer->stop();
|
||||
tcp->abort();
|
||||
tcp->deleteLater();
|
||||
});
|
||||
connect(tcp, &QTcpSocket::connected, tcp, [tcp, timer] {
|
||||
connect(tcp, &QTcpSocket::connected, tcp, [=] {
|
||||
timer->stop();
|
||||
tcp->write("{\"_type\":\"DelPrograms\",\"_id\":\"DelPrograms\",\"zVer\":\"xixun1\"}");
|
||||
timer->start(10000);
|
||||
});
|
||||
connect(tcp, &QTcpSocket::readyRead, tcp, [tcp, timer, waitingDlg] {
|
||||
connect(tcp, &QTcpSocket::readyRead, tcp, [=] {
|
||||
timer->stop();
|
||||
QByteArray resp = tcp->readAll();
|
||||
tcp->close();
|
||||
|
@ -462,18 +462,18 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
QJsonDocument json = QJsonDocument::fromJson(resp, &parseErr);
|
||||
if(parseErr.error != QJsonParseError::NoError) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Tip"), parseErr.errorString());
|
||||
QMessageBox::critical(this, tr("Tip"), parseErr.errorString());
|
||||
} else if(! json["success"].toBool()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Tip"), tr("Clear Program")+" "+tr("Failed"));
|
||||
QMessageBox::critical(this, tr("Tip"), tr("Clear Program")+" "+tr("Failed"));
|
||||
} else waitingDlg->success();
|
||||
});
|
||||
connect(tcp, &QTcpSocket::errorOccurred, tcp, [tcp, timer, waitingDlg](QAbstractSocket::SocketError err) {
|
||||
connect(tcp, &QTcpSocket::errorOccurred, tcp, [=](QAbstractSocket::SocketError err) {
|
||||
timer->stop();
|
||||
tcp->close();
|
||||
tcp->deleteLater();
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Tip"), QString(socketErrKey(err))+" ("+QString::number(err)+") "+tcp->errorString());
|
||||
QMessageBox::critical(this, tr("Tip"), QString(socketErrKey(err))+" ("+QString::number(err)+") "+tcp->errorString());
|
||||
});
|
||||
tcp->connectToHost(card->m_strCardIp, 3333);
|
||||
timer->start(10000);
|
||||
|
@ -522,7 +522,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnGetLog->setProperty("ssType", "progManageTool");
|
||||
connect(btnGetLog, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
if(gSelCards->count() == 1) {
|
||||
|
@ -535,13 +535,13 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
waitingDlg->close();
|
||||
QString err = checkReply(reply);
|
||||
if(! err.isEmpty()) {
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
QMessageBox::critical(this, tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
QString logFile = QApplication::applicationDirPath()+"/card-log.txt";
|
||||
QFile file(logFile);
|
||||
if(! file.open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::critical(gMainWin, tr("Error"), "Open for Write Fail");
|
||||
QMessageBox::critical(this, tr("Error"), "Open for Write Fail");
|
||||
return;
|
||||
}
|
||||
file.write(reply->readAll());
|
||||
|
@ -564,7 +564,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnTimingRebootSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnTimingRebootSet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -574,7 +574,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Setting Timing Reboot")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -589,7 +589,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnTimingRebootGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnTimingRebootGet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -631,7 +631,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnM80Set->setProperty("ssType", "progManageTool");
|
||||
connect(btnM80Set, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -642,7 +642,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetSpecialResolution"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -657,7 +657,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnM80Refresh->setProperty("ssType", "progManageTool");
|
||||
connect(btnM80Refresh, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -690,7 +690,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnM80Restore->setProperty("ssType", "progManageTool");
|
||||
connect(btnM80Restore, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -699,7 +699,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("CleanDisplayScreenSize"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -728,12 +728,12 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnY50Set->setProperty("ssType", "progManageTool");
|
||||
connect(btnY50Set, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QFile qFile(QApplication::applicationDirPath()+"/y50 param/"+fdY50Resolu->currentText()+"/rk_lcd_parameters");
|
||||
if(! qFile.exists()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("File not exist"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("File not exist"));
|
||||
return;
|
||||
}
|
||||
if(! qFile.open(QIODevice::ReadOnly)) return;
|
||||
|
@ -754,7 +754,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
QString err = checkReply(reply);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
QMessageBox::critical(this, tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
waitingDlg->success();
|
||||
|
@ -782,7 +782,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnDisModeSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnDisModeSet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController")+" ...");
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController")+" ...");
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -792,7 +792,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Set Display Mode"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -807,7 +807,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnDisModeGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnDisModeGet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -860,7 +860,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnScreenOffSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnScreenOffSet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -871,7 +871,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Set Screen Offset")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -886,7 +886,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnScreenOffGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnScreenOffGet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -924,7 +924,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnLedSet3 = new QPushButton;
|
||||
btnLedSet3->setMinimumHeight(34);
|
||||
btnLedSet3->setProperty("ssType", "progManageTool");
|
||||
connect(btnLedSet3, &QPushButton::clicked, this, [] {
|
||||
connect(btnLedSet3, &QPushButton::clicked, this, [=] {
|
||||
QString strLedSetFile = QApplication::applicationDirPath()+"/LedSet/LedSet3.0.exe";
|
||||
QFileInfo cc22(strLedSetFile);
|
||||
if(cc22.exists()) {
|
||||
|
@ -936,7 +936,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(!strLedsetPath.isEmpty()) {
|
||||
QFileInfo cc(strLedsetPath);
|
||||
if(cc.exists()) QProcess::startDetached(strLedsetPath,QStringList());
|
||||
else QMessageBox::critical(gMainWin, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath);
|
||||
else QMessageBox::critical(this, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath);
|
||||
return;
|
||||
}
|
||||
QSettings reg1("HKEY_LOCAL_MACHINE\\SOFTWARE\\sysolution\\LedSet3.0", QSettings::NativeFormat);
|
||||
|
@ -952,7 +952,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
QString str2="C:/Program Files (x86)/sysolution/LedSet3.0/LedSet3.0.exe";
|
||||
QFileInfo cc2(str1);
|
||||
if(cc2.exists()) QProcess::startDetached(str2,QStringList());
|
||||
else QMessageBox::critical(gMainWin, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath);
|
||||
else QMessageBox::critical(this, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
@ -963,7 +963,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
QString str2="C:/Program Files (x86)/sysolution/LedSet3.0/LedSet3.0.exe";
|
||||
QFileInfo cc2(str1);
|
||||
if(cc2.exists())QProcess::startDetached(str2,QStringList());
|
||||
else QMessageBox::critical(gMainWin, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath);
|
||||
else QMessageBox::critical(this, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -993,14 +993,14 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnBindTaxiIc->setProperty("ssType", "progManageTool");
|
||||
connect(btnBindTaxiIc, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QString icFile = QFileDialog::getOpenFileName(this, "open file dialog", "", tr("indentity voucher (*.ic)"));
|
||||
if(icFile.isEmpty()) return;
|
||||
QFile file(icFile);
|
||||
if(! file.open(QIODevice::ReadOnly)) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("Open file Failed"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("Open file Failed"));
|
||||
return;
|
||||
}
|
||||
auto data = file.readAll();
|
||||
|
@ -1008,7 +1008,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
QJsonParseError jsonErr;
|
||||
QJsonDocument icJson = QJsonDocument::fromJson(data, &jsonErr);
|
||||
if(jsonErr.error != QJsonParseError::NoError) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), "JsonError "+jsonErr.errorString()+"\n"+data);
|
||||
QMessageBox::information(this, tr("Tip"), "JsonError "+jsonErr.errorString()+"\n"+data);
|
||||
return;
|
||||
}
|
||||
QJsonObject jsonCommand;
|
||||
|
@ -1024,11 +1024,11 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
waitingDlg->show();
|
||||
auto reply = NetReq("http://"+gSelCards->at(0)->m_strCardIp+":3000").timeout(120000).post(json);
|
||||
waitingDlg->connAbort(reply);
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
QString err = checkReply(reply);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
QMessageBox::critical(this, tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
auto data = reply->readAll();
|
||||
|
@ -1036,12 +1036,12 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
QJsonDocument json = QJsonDocument::fromJson(data, &jsonErr);
|
||||
if(jsonErr.error != QJsonParseError::NoError) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), "JsonError "+jsonErr.errorString()+"\n"+data);
|
||||
QMessageBox::critical(this, tr("Error"), "JsonError "+jsonErr.errorString()+"\n"+data);
|
||||
return;
|
||||
}
|
||||
if(json["result"].toString() != "true") {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), data);
|
||||
QMessageBox::critical(this, tr("Error"), data);
|
||||
return;
|
||||
}
|
||||
waitingDlg->success();
|
||||
|
@ -1091,7 +1091,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnHighForBusySet->setProperty("ssType", "progManageTool");
|
||||
connect(btnHighForBusySet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1101,7 +1101,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetHighForBusy")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1116,7 +1116,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnGetTopLevel->setProperty("ssType", "progManageTool");
|
||||
connect(btnGetTopLevel, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1167,7 +1167,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnMinBrightSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnMinBrightSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1177,7 +1177,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetMinBrightness"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1192,7 +1192,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnMinBrightGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnMinBrightGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1244,7 +1244,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnMaxBrightSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnMaxBrightSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1254,7 +1254,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetMaxBrightness"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1269,7 +1269,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnMaxBrightGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnMaxBrightGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1323,7 +1323,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnSetBack->setProperty("ssType", "progManageTool");
|
||||
connect(btnSetBack, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QColorDialog colorDlg(this);
|
||||
|
@ -1339,7 +1339,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Setting Wallpaper")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1354,7 +1354,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnSysUpd->setProperty("ssType", "progManageTool");
|
||||
connect(btnSysUpd, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1363,7 +1363,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("System Updating")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1380,7 +1380,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnMcuUpd->setProperty("ssType", "progManageTool");
|
||||
connect(btnMcuUpd, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto filePath = QFileDialog::getOpenFileName(this, "Open File", QString(), ".bin file (*.bin)");
|
||||
|
@ -1403,11 +1403,11 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
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);
|
||||
waitingDlg->connAbort(reply);
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
QString err = checkReply(reply);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
QMessageBox::critical(this, tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
waitingDlg->success();
|
||||
|
@ -1430,7 +1430,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnMcuGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnMcuGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1439,10 +1439,10 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Getting MCU Version")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSingleGetReply
|
||||
waitingDlg->close();
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("MCU Version")+": "+json["mcuVersion"].toString());
|
||||
QMessageBox::information(this, tr("Tip"), tr("MCU Version")+": "+json["mcuVersion"].toString());
|
||||
});
|
||||
} else {
|
||||
foreach(auto card, *gSelCards) {
|
||||
|
@ -1465,10 +1465,10 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnPlayerBackSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnPlayerBackSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QString file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, EPhoto::filters());
|
||||
QString file = QFileDialog::getOpenFileName(this, tr("Select File"), gFileHome, EPhoto::filters());
|
||||
if(file.isEmpty()) return;
|
||||
QFileInfo info(file);
|
||||
if(! info.isFile()) return;
|
||||
|
@ -1477,11 +1477,11 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
waitingDlg->btnAbort->hide();
|
||||
waitingDlg->show();
|
||||
auto thread = new PlayerBackSendThread(file, gSelCards->at(0)->m_strCardIp);
|
||||
connect(thread, &PlayerBackSendThread::emErr, this, [waitingDlg](QString err) {
|
||||
connect(thread, &PlayerBackSendThread::emErr, this, [=](QString err) {
|
||||
if(err.isEmpty()) waitingDlg->success();
|
||||
else {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
QMessageBox::critical(this, tr("Error"), err);
|
||||
}
|
||||
});
|
||||
thread->start();
|
||||
|
@ -1502,7 +1502,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnPlayerBackClear->setProperty("ssType", "progManageTool");
|
||||
connect(btnPlayerBackClear, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
if(gSelCards->count() == 1) {
|
||||
|
@ -1512,11 +1512,11 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
auto tcp = new QTcpSocket();
|
||||
auto timer = new QTimer(tcp);
|
||||
timer->setSingleShot(true);
|
||||
connect(timer, &QTimer::timeout, tcp, [tcp, waitingDlg] {
|
||||
connect(timer, &QTimer::timeout, tcp, [=] {
|
||||
waitingDlg->close();
|
||||
tcp->abort();
|
||||
tcp->deleteLater();
|
||||
QMessageBox::critical(gMainWin, tr("Tip"), tr("Clear player background")+" "+tr("Timeout"));
|
||||
QMessageBox::critical(this, tr("Tip"), tr("Clear player background")+" "+tr("Timeout"));
|
||||
});
|
||||
connect(waitingDlg, &WaitingDlg::rejected, tcp, [=] {
|
||||
timer->stop();
|
||||
|
@ -1528,7 +1528,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
tcp->write("{\"_type\":\"DelBackImg\",\"_id\":\"DelBackImg\",\"zVer\":\"xixun1\"}");
|
||||
timer->start(10000);
|
||||
});
|
||||
connect(tcp, &QTcpSocket::readyRead, tcp, [tcp, timer, waitingDlg] {
|
||||
connect(tcp, &QTcpSocket::readyRead, tcp, [=] {
|
||||
timer->stop();
|
||||
QByteArray resp = tcp->readAll();
|
||||
tcp->close();
|
||||
|
@ -1537,18 +1537,18 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
QJsonDocument json = QJsonDocument::fromJson(resp, &parseErr);
|
||||
if(parseErr.error != QJsonParseError::NoError) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Tip"), parseErr.errorString());
|
||||
QMessageBox::critical(this, tr("Tip"), parseErr.errorString());
|
||||
} else if(! json["success"].toBool()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Tip"), tr("Clear player background")+" "+tr("Failed"));
|
||||
QMessageBox::critical(this, tr("Tip"), tr("Clear player background")+" "+tr("Failed"));
|
||||
} else waitingDlg->success();
|
||||
});
|
||||
connect(tcp, &QTcpSocket::errorOccurred, tcp, [tcp, timer, waitingDlg](QAbstractSocket::SocketError err) {
|
||||
connect(tcp, &QTcpSocket::errorOccurred, tcp, [=](QAbstractSocket::SocketError err) {
|
||||
timer->stop();
|
||||
tcp->close();
|
||||
tcp->deleteLater();
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Tip"), QString(socketErrKey(err))+" ("+QString::number(err)+") "+tcp->errorString());
|
||||
QMessageBox::critical(this, tr("Tip"), QString(socketErrKey(err))+" ("+QString::number(err)+") "+tcp->errorString());
|
||||
});
|
||||
tcp->connectToHost(card->m_strCardIp, 3333);
|
||||
timer->start(10000);
|
||||
|
@ -1623,7 +1623,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
connect(btnGrp, &QButtonGroup::idToggled, this, [this](int value, bool checked) {
|
||||
if(! checked) return;
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1633,7 +1633,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetScreenRotation"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1715,7 +1715,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnBaudSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnBaudSet, &QPushButton::clicked, this, [this, fdUart, fdBaud] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1726,7 +1726,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Setting Baud Rate")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1741,7 +1741,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnBaudGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnBaudGet, &QPushButton::clicked, this, [this, fdUart, fdBaud] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1751,7 +1751,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Getting Baud Rate")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, fdBaud, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSingleGetReply
|
||||
waitingDlg->success();
|
||||
fdBaud->setText(QString::number(json["baud"].toInt()));
|
||||
|
@ -1776,7 +1776,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
fdIsOpenADB = new QCheckBox;
|
||||
connect(fdIsOpenADB, &QCheckBox::toggled, this, [this](bool checked) {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1786,7 +1786,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("OpenAdb")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1808,28 +1808,28 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnSendCustomJson->setProperty("ssType", "progManageTool");
|
||||
connect(btnSendCustomJson, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto text = fdCustomJson->toPlainText().toUtf8();
|
||||
if(text.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("Text is empty"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("Text is empty"));
|
||||
return;
|
||||
}
|
||||
QJsonParseError jsonErr;
|
||||
QJsonDocument json = QJsonDocument::fromJson(text, &jsonErr);
|
||||
if(jsonErr.error != QJsonParseError::NoError) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("Json Parse Error")+jsonErr.errorString());
|
||||
QMessageBox::information(this, tr("Tip"), tr("Json Parse Error")+jsonErr.errorString());
|
||||
return;
|
||||
}
|
||||
if(! json.isObject()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("Json isn't an Object"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("Json isn't an Object"));
|
||||
return;
|
||||
}
|
||||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("AliIotSetting"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1863,7 +1863,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnTraficProtSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnTraficProtSet, &QPushButton::clicked, this, [this, fdTraficProtocol] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1873,7 +1873,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Setting protocol ..."));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1888,7 +1888,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnTraficProtGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnTraficProtGet, &QPushButton::clicked, this, [this, fdTraficProtocol] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1897,7 +1897,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Getting protocol ..."));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg, fdTraficProtocol] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSingleGetReply
|
||||
waitingDlg->success();
|
||||
setCurrentData(fdTraficProtocol, json["protocolType"].toInt());
|
||||
|
@ -1949,7 +1949,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnTraficSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnTraficSet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -1960,7 +1960,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Setting card work mode ..."));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -1975,7 +1975,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnTraficGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnTraficGet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -2029,7 +2029,7 @@ void CtrlAdvancedPanel::showEvent(QShowEvent *event) {
|
|||
void CtrlAdvancedPanel::init() {
|
||||
if(! isPassed) {
|
||||
hide();
|
||||
PasswordInChDlg dlg(gMainWin);
|
||||
PasswordInChDlg dlg(this);
|
||||
connect(dlg.btnBox, &QDialogButtonBox::accepted, &dlg, [&dlg]() {
|
||||
QString pwdRaw = QSettings().value("advUiPs").toString();
|
||||
QString password = pwdRaw.isEmpty() ? "888" : QString::fromUtf8(QByteArray::fromBase64(pwdRaw.toLatin1()));
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include "ctrlbrightpanel.h"
|
||||
#include "base/waitingdlg.h"
|
||||
#include "globaldefine.h"
|
||||
#include "deviceitem.h"
|
||||
#include "tools.h"
|
||||
#include "xlsxdocument.h"
|
||||
#include "xlsxworkbook.h"
|
||||
|
@ -86,7 +85,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnSensiSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnSensiSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -96,7 +95,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetBrightnessSensitivity")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, card, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -112,7 +111,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnSensiGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnSensiGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -121,7 +120,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("GetBrightnessSensitivity")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSingleGetReply
|
||||
waitingDlg->success();
|
||||
fdSensi->setValue(json["sensitivity"].toInt());
|
||||
|
@ -169,7 +168,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnMinBrightSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnMinBrightSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto isAdaptToOld = fdAdaptToOld->isChecked();
|
||||
|
@ -182,7 +181,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(isAdaptToOld) json.insert("brightness", (brightPercent * gSelCards->at(0)->BrightnessLevel + 50) / 100);
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetMinBrightness")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -199,7 +198,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnMinBrightGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnMinBrightGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -266,14 +265,14 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnUpload->setProperty("ssType", "progManageTool");
|
||||
connect(btnUpload, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QString sensorName;
|
||||
if(fdRL2->isChecked()) sensorName = fdRL2->text();
|
||||
else if(fdR68->isChecked()) sensorName = fdR68->text();
|
||||
else {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NeedSelectSensorTypeTip"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NeedSelectSensorTypeTip"));
|
||||
return;
|
||||
}
|
||||
QString xlsxFile = QFileDialog::getOpenFileName(this, tr("Open file dialog"), "/", "brightness files(*.xlsx)");
|
||||
|
@ -284,7 +283,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(workbook->sheetCount() < 2) {
|
||||
sheet = xlsx.currentWorksheet();
|
||||
if(sheet==0) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("Not found current worksheet"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("Not found current worksheet"));
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
|
@ -298,7 +297,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
}
|
||||
}
|
||||
if(sheet==0) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), "Not found sheet "+sensorName);
|
||||
QMessageBox::information(this, tr("Tip"), "Not found sheet "+sensorName);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -306,7 +305,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
for(int j=0; j<255; j++) {
|
||||
auto val = sheet->read(3, j+3).toString();
|
||||
if(val.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), "Cell is empty at 3, "+QString::number(j+3));
|
||||
QMessageBox::information(this, tr("Tip"), "Cell is empty at 3, "+QString::number(j+3));
|
||||
return;
|
||||
}
|
||||
values.append(val);
|
||||
|
@ -318,7 +317,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SensorBrightnessTable"));
|
||||
Def_CtrlReqPre;
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter;
|
||||
});
|
||||
} else {
|
||||
|
@ -334,14 +333,14 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnTableGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnTableGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QString strSensorType;
|
||||
if(fdRL2->isChecked()) strSensorType = fdRL2->text();
|
||||
else if(fdR68->isChecked()) strSensorType = fdR68->text();
|
||||
else {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NeedSelectSensorTypeTip"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NeedSelectSensorTypeTip"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -355,13 +354,13 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
waitingDlg->close();
|
||||
QStringList values = json["values"].toVariant().value<QStringList>();
|
||||
if(values.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("no sensorBrightnessTable"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("no sensorBrightnessTable"));
|
||||
return;
|
||||
}
|
||||
QString tempFile = QCoreApplication::applicationDirPath()+"/bright-template.xlsx";
|
||||
QFile tempQFile(tempFile);
|
||||
if(! tempQFile.exists()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tempFile+" is not exist");
|
||||
QMessageBox::information(this, tr("Tip"), tempFile+" is not exist");
|
||||
return;
|
||||
}
|
||||
QString selectFilter = "*.xlsx";
|
||||
|
@ -395,7 +394,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnCurBrightGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnCurBrightGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -410,7 +409,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
QString err = checkReplyForJson(reply, &json, &data);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
QMessageBox::critical(this, tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
waitingDlg->success();
|
||||
|
@ -424,7 +423,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
connect(reply, &QNetworkReply::finished, this, [reply, card] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(err.isEmpty()) err = QString::number(qRound(json["value"].toInt() * 100.0 / card->BrightnessLevel))+"%";
|
||||
if(err.isEmpty()) err = (json["is485"].toBool() ? "R60 " : "RL1 ") + QString::number(qRound(json["value"].toInt() * 100.0 / card->BrightnessLevel))+"%";
|
||||
gFdResInfo->append(card->m_strCardId+" "+tr("GetCurrentSensorBrightness")+" "+err);
|
||||
});
|
||||
}
|
||||
|
@ -470,7 +469,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnFixedSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnFixedSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto isAdaptToOld = fdAdaptToOld->isChecked();
|
||||
|
@ -483,7 +482,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(isAdaptToOld) json.insert("brightness", (percent * gSelCards->at(0)->BrightnessLevel + 50) / 100);
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetBrightness"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -500,7 +499,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnFixedGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnFixedGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -515,7 +514,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
QString err = checkReplyForJson(reply, &json, &data);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
QMessageBox::critical(this, tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
waitingDlg->success();
|
||||
|
@ -725,7 +724,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnScheSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnScheSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto isAdaptToOld = fdAdaptToOld->isChecked();
|
||||
|
@ -737,7 +736,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(isAdaptToOld) getScheduleJson(json, gSelCards->at(0)->BrightnessLevel);
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetAutoBrightnessTask"));
|
||||
Def_CtrlReqPre;
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -756,7 +755,7 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnScheGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnScheGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
|
|
@ -65,7 +65,7 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnSyncSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnSyncSet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto id = btnGroup->checkedId();
|
||||
|
@ -77,7 +77,7 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, id ? tr("SyncSwitch") : tr("AnSyncSwitch"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -98,7 +98,7 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnSyncGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnSyncGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -248,7 +248,7 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnScheSet->setMinimumSize(QSize(60, 30));
|
||||
connect(btnScheSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -258,7 +258,7 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) {
|
|||
json.insert("HdmiInTask", getScheduleJson());
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetTimingHdmiInTask"));
|
||||
Def_CtrlReqPre;
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -276,7 +276,7 @@ CtrlHdmiPanel::CtrlHdmiPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnScheGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnScheGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
|
|
@ -102,7 +102,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnLanSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnLanSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QString ip = fdIP->text();
|
||||
|
@ -116,22 +116,22 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(dns=="...") dns = "0.255.255.255";
|
||||
} else {
|
||||
if(ip=="...") {
|
||||
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input IP address!"));
|
||||
QMessageBox::warning(this, tr("Attention"), tr("Please input IP address!"));
|
||||
fdIP->setFocus();
|
||||
return;
|
||||
}
|
||||
if(mask=="...") {
|
||||
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input Mask address!"));
|
||||
QMessageBox::warning(this, tr("Attention"), tr("Please input Mask address!"));
|
||||
fdMask->setFocus();
|
||||
return;
|
||||
}
|
||||
if(gateWay=="...") {
|
||||
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input Gateway address!"));
|
||||
QMessageBox::warning(this, tr("Attention"), tr("Please input Gateway address!"));
|
||||
fdGateWay->setFocus();
|
||||
return;
|
||||
}
|
||||
if(dns=="...") {
|
||||
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input DNS address!"));
|
||||
QMessageBox::warning(this, tr("Attention"), tr("Please input DNS address!"));
|
||||
fdDns->setFocus();
|
||||
return;
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetEthernet"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -165,7 +165,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnLanGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnLanGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -255,7 +255,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnScan->setProperty("ssType", "progManageTool");
|
||||
connect(btnScan, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -328,7 +328,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnWiFiSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnWiFiSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
auto isWifi = fdIsWifi->isChecked();
|
||||
|
@ -349,12 +349,12 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
QString err = checkReplyForJson(reply);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
QMessageBox::critical(this, 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] {
|
||||
connect(reply, &QNetworkReply::finished, card, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
});
|
||||
|
@ -402,7 +402,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnWiFiGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnWiFiGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -465,7 +465,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
fdCarrierName->setEnabled(checked);
|
||||
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -475,7 +475,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetSwitchSimData")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -491,7 +491,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnSIMStatusGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnSIMStatusGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -557,7 +557,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
}
|
||||
str4GStatus += tr("信号强度:") + QString::number(json["signalStrength"].toInt())+"\n";
|
||||
}
|
||||
QMessageBox::information(gMainWin, tr("Tip"), str4GStatus);
|
||||
QMessageBox::information(this, tr("Tip"), str4GStatus);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -679,7 +679,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnAPNCusSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnAPNCusSet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -717,7 +717,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnAPNCusGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnAPNCusGet, &QPushButton::clicked, this, [=] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -781,7 +781,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
fdFightModel->setText(tr("OFF"), tr("ON"));
|
||||
connect(fdFightModel, &SwitchControl::checkedChanged, this, [=](bool checked) {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -791,7 +791,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("ContrFlightMode")+" ...");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -807,7 +807,7 @@ CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnFlightModelGet->setProperty("ssType", "progManageTool");
|
||||
connect(btnFlightModelGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
|
|
@ -52,26 +52,26 @@ CtrlPwdPanel::CtrlPwdPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnPwdSet->setProperty("ssType", "progManageTool");
|
||||
connect(btnPwdSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
if(fdOldPwd->isVisible() && fdOldPwd->text().isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("InputOriginalPasswordTip"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("InputOriginalPasswordTip"));
|
||||
return;
|
||||
}
|
||||
if(fdNewPwd->text().isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("InputNewPasswordTip"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("InputNewPasswordTip"));
|
||||
return;
|
||||
}
|
||||
if(fdPwdAgain->text().isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("InputRepeatPasswordTip"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("InputRepeatPasswordTip"));
|
||||
return;
|
||||
}
|
||||
if(fdNewPwd->text() != fdPwdAgain->text()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("InputRepeatPasswordNotSameTip"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("InputRepeatPasswordNotSameTip"));
|
||||
return;
|
||||
}
|
||||
auto res = QMessageBox::information(gMainWin, tr("Tip Info"), tr("After setting the password, please remember the password and record it. If you forget the password, the device will be unable to operate. Are you sure you want to continue with this operation?"), QMessageBox::Ok, QMessageBox::Cancel);
|
||||
auto res = QMessageBox::information(this, tr("Tip Info"), tr("After setting the password, please remember the password and record it. If you forget the password, the device will be unable to operate. Are you sure you want to continue with this operation?"), QMessageBox::Ok, QMessageBox::Cancel);
|
||||
if(res != QMessageBox::Ok) return;
|
||||
QJsonObject json;
|
||||
json.insert("_id", "SetControllerPassword");
|
||||
|
@ -86,12 +86,12 @@ CtrlPwdPanel::CtrlPwdPanel(QWidget *parent) : QWidget(parent) {
|
|||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
QMessageBox::critical(this, tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
if(json["result"].toInt()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Tip"), tr("OriginalPasswordErrorTip"));
|
||||
QMessageBox::critical(this, tr("Tip"), tr("OriginalPasswordErrorTip"));
|
||||
return;
|
||||
}
|
||||
waitingDlg->success();
|
||||
|
@ -133,11 +133,11 @@ CtrlPwdPanel::CtrlPwdPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnPwdClear->setProperty("ssType", "progManageTool");
|
||||
connect(btnPwdClear, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
if(fdOldPwd->isVisible() && fdOldPwd->text().isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("InputOriginalPasswordTip"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("InputOriginalPasswordTip"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -153,12 +153,12 @@ CtrlPwdPanel::CtrlPwdPanel(QWidget *parent) : QWidget(parent) {
|
|||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
QMessageBox::critical(this, tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
if(json["result"].toInt()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(gMainWin, tr("Tip"), tr("OriginalPasswordErrorTip"));
|
||||
QMessageBox::critical(this, tr("Tip"), tr("OriginalPasswordErrorTip"));
|
||||
return;
|
||||
}
|
||||
waitingDlg->success();
|
||||
|
@ -221,19 +221,11 @@ void CtrlPwdPanel::init() {
|
|||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) return;
|
||||
if(json["result"].toBool()) {
|
||||
lbOldPwd->show();
|
||||
fdOldPwd->show();
|
||||
btnPwdClear->show();
|
||||
btnPwdSet->setText(tr("Modify password"));
|
||||
card->bPassword = true;
|
||||
} else {
|
||||
lbOldPwd->hide();
|
||||
fdOldPwd->hide();
|
||||
btnPwdClear->hide();
|
||||
btnPwdSet->setText(tr("Set encryption"));
|
||||
card->bPassword = false;
|
||||
}
|
||||
card->bPassword = json["result"].toBool();
|
||||
lbOldPwd->setVisible(card->bPassword);
|
||||
fdOldPwd->setVisible(card->bPassword);
|
||||
btnPwdClear->setVisible(card->bPassword);
|
||||
btnPwdSet->setText(card->bPassword ? tr("Modify password") : tr("Set encryption"));
|
||||
});
|
||||
}
|
||||
void CtrlPwdPanel::changeEvent(QEvent *event) {
|
||||
|
|
|
@ -104,7 +104,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
fdTimeZoneSet = new QPushButton;
|
||||
connect(fdTimeZoneSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -114,7 +114,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetTimezone"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -138,7 +138,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnLangSet = new QPushButton;
|
||||
connect(btnLangSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -148,7 +148,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, "设置语言");
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -162,7 +162,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnLangGet = new QPushButton;
|
||||
connect(btnLangGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -210,7 +210,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnSyncTime->setMinimumSize(QSize(60, 30));
|
||||
connect(btnSyncTime, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -220,7 +220,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SyncTime"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -241,7 +241,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnDateGet->setMinimumSize(QSize(0, 30));
|
||||
connect(btnDateGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -363,7 +363,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnSyncSet->setMinimumSize(QSize(60, 30));
|
||||
connect(btnSyncSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -384,7 +384,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetingSyncMethod"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -399,7 +399,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
fdSyncGet->setMinimumSize(QSize(60, 30));
|
||||
connect(fdSyncGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -485,7 +485,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnLoraMasterSet->setMinimumSize(QSize(0, 30));
|
||||
connect(btnLoraMasterSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -496,7 +496,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, isMaster ? tr("MasterSwitch ") : tr("SlaveSwitch "));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -515,7 +515,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnLoraMasterGet->setMinimumSize(QSize(0, 30));
|
||||
connect(btnLoraMasterGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -573,7 +573,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnNtpSet->setMinimumSize(QSize(60, 30));
|
||||
connect(btnNtpSet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
@ -583,7 +583,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
if(gSelCards->count() == 1) {
|
||||
auto waitingDlg = new WaitingDlg(this, tr("SetNtpServer"));
|
||||
Def_CtrlReqPre
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
Def_CtrlSetReqAfter
|
||||
});
|
||||
} else {
|
||||
|
@ -598,7 +598,7 @@ CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
|
|||
btnNtpGet->setMinimumSize(QSize(60, 30));
|
||||
connect(btnNtpGet, &QPushButton::clicked, this, [this] {
|
||||
if(gSelCards->isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
|
||||
return;
|
||||
}
|
||||
QJsonObject json;
|
||||
|
|
|
@ -196,11 +196,11 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) {
|
|||
item->isUpdating = true;
|
||||
NetReq req("http://"+item->mCard->m_strCardIp+":2016/upload?type="+(isApk ? "software":"hardware"));
|
||||
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
|
||||
connect(reply, &QNetworkReply::uploadProgress, item, [item](qint64 bytesSent, qint64 bytesTotal) {
|
||||
connect(reply, &QNetworkReply::uploadProgress, item->mProgress, [item](qint64 bytesSent, qint64 bytesTotal) {
|
||||
if(bytesTotal<=0) return;
|
||||
item->mProgress->setValue(bytesSent*100/bytesTotal);
|
||||
});
|
||||
connect(reply, &QNetworkReply::finished, item, [=] {
|
||||
connect(reply, &QNetworkReply::finished, item->mProgress, [=] {
|
||||
QString err = errStrWithData(reply);
|
||||
if(! err.isEmpty()) {
|
||||
item->setResult(tr("Upload error")+": "+err, Qt::red);
|
||||
|
@ -220,7 +220,7 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) {
|
|||
json.insert("_type", "SynchronousHardwareVersion");
|
||||
}
|
||||
auto reply = NetReq("http://"+item->mCard->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||
connect(reply, &QNetworkReply::finished, item, [=] {
|
||||
connect(reply, &QNetworkReply::finished, item->mProgress, [=] {
|
||||
item->isUpdating = false;
|
||||
QString err = errStrWithData(reply);
|
||||
if(! err.isEmpty()) {
|
||||
|
@ -259,10 +259,10 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) {
|
|||
connect(btnUninstall, &QPushButton::clicked, this, [this, fdApk] {
|
||||
auto strApkName = fdApk->currentText();
|
||||
if(strApkName.isEmpty()) {
|
||||
QMessageBox::information(gMainWin, tr("Tip"), "APK is Empty");
|
||||
QMessageBox::information(this, tr("Tip"), "APK is Empty");
|
||||
return;
|
||||
}
|
||||
if(! strApkName.endsWith(".xixunplayer") && ! strApkName.endsWith(".taxiapp") && QMessageBox::warning(gMainWin, tr("Reminder"), tr("Reminder: Uninstalling this program may cause the device to offline, cannot be found, lost configs and have a black screen. Please uninstall with caution!")+"\n"+tr("Do you want to continue?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) return;
|
||||
if(! strApkName.endsWith(".xixunplayer") && ! strApkName.endsWith(".taxiapp") && QMessageBox::warning(this, tr("Reminder"), tr("Reminder: Uninstalling this program may cause the device to offline, cannot be found, lost configs and have a black screen. Please uninstall with caution!")+"\n"+tr("Do you want to continue?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::No) != QMessageBox::Yes) return;
|
||||
int cnt = table->topLevelItemCount();
|
||||
for(int i=0; i<cnt; i++) if(table->topLevelItem(i)->checkState(0) == Qt::Checked) {
|
||||
auto item = static_cast<wUpgradeApkItem *>(table->topLevelItem(i));
|
||||
|
@ -411,7 +411,8 @@ void UpgradeApkDialog::onAddLedCard(LedCard *card) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(iExistFlg==0) new wUpgradeApkItem(card, table, this);
|
||||
if(iExistFlg) return;
|
||||
new wUpgradeApkItem(card, table);
|
||||
}
|
||||
|
||||
void UpgradeApkDialog::keyPressEvent(QKeyEvent *ev) {
|
||||
|
|
|
@ -1,38 +1,67 @@
|
|||
#include "wupgradeapkitem.h"
|
||||
#include "tools.h"
|
||||
#include "base/x_uimsgboxok.h"
|
||||
#include "passwordindlg.h"
|
||||
#include "base/waitingdlg.h"
|
||||
#include "gutil/qgui.h"
|
||||
#include <QMessageBox>
|
||||
#include <QJsonValue>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QProgressBar>
|
||||
#include <globaldefine.h>
|
||||
#include <QSizePolicy>
|
||||
#include <QUuid>
|
||||
#include <QMap>
|
||||
#include <QMessageBox>
|
||||
#include <QHostAddress>
|
||||
#include <QInputDialog>
|
||||
|
||||
wUpgradeApkItem::wUpgradeApkItem(LedCard *pLedCard, LoQTreeWidget *parent, QWidget *pWnd) : QObject(parent), QTreeWidgetItem(UserType), m_parent(parent) {
|
||||
m_pWnd=pWnd;
|
||||
mCard=pLedCard;
|
||||
wUpgradeApkItem::wUpgradeApkItem(LedCard *pLedCard, LoQTreeWidget *parent) : QTreeWidgetItem(UserType), mCard(pLedCard), m_parent(parent) {
|
||||
setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||
setCheckState(0, Qt::Unchecked);
|
||||
m_parent->addTopLevelItem(this);
|
||||
m_ImageOnline = new QLabel();
|
||||
m_parent->setItemWidget(this, Upgrade_ONLINE, m_ImageOnline);
|
||||
m_ImageOnline->setAlignment(Qt::AlignCenter);
|
||||
m_parent->setItemWidget(this, Upgrade_ONLINE, m_ImageOnline);
|
||||
for(int i=1; i<Upgrade_END; i++) setTextAlignment(i, Qt::AlignCenter);
|
||||
SetItemParam(mCard);
|
||||
mProgress = new QProgressBar;
|
||||
mProgress->setAlignment(Qt::AlignCenter);
|
||||
mProgress->setStyleSheet("margin-top:8px; margin-bottom:8px; ");
|
||||
m_parent->setItemWidget(this, Upgrade_PROGRESS, mProgress);
|
||||
OnCheckSoftVersions();
|
||||
OnCheckFpgaVersions();
|
||||
|
||||
btnUnlock = new QPushButton;
|
||||
btnUnlock->setMaximumHeight(40);
|
||||
auto wgt = new QWidget;
|
||||
auto vBox = new VBox(wgt);
|
||||
vBox->setContentsMargins(0,0,0,0);
|
||||
vBox->addWidget(btnUnlock);
|
||||
m_parent->setItemWidget(this, Upgrade_ENCRYPT, wgt);
|
||||
QObject::connect(btnUnlock, &QPushButton::clicked, mProgress, [this] {
|
||||
if(! mCard->m_bLockStatus) return;
|
||||
bool ok;
|
||||
auto pwd = QInputDialog::getText(treeWidget(), QObject::tr("Input password"), QObject::tr("Input password"), QLineEdit::Password, QString(), &ok);
|
||||
if(! ok) return;
|
||||
QJsonObject json;
|
||||
json.insert("_id", "VerifyPassword");
|
||||
json.insert("_type", "VerifyPassword");
|
||||
json.insert("pwd", pwd);
|
||||
auto waitingDlg = new WaitingDlg(treeWidget(), QObject::tr("VerifyPassword")+" ...");
|
||||
waitingDlg->show();
|
||||
auto reply = NetReq("http://"+mCard->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||
waitingDlg->connAbort(reply);
|
||||
QObject::connect(reply, &QNetworkReply::finished, mProgress, [=] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(treeWidget(), QObject::tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
if(! json["result"].toBool()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(treeWidget(), QObject::tr("Tip Info"), QObject::tr("password is wrong"));
|
||||
return;
|
||||
}
|
||||
waitingDlg->success();
|
||||
mCard->m_bLockStatus = false;
|
||||
btnUnlock->setIcon(QIcon(":/res/device/UnLock.png"));
|
||||
});
|
||||
});
|
||||
|
||||
SetItemParam(mCard);
|
||||
}
|
||||
|
||||
void wUpgradeApkItem::OnCheckFpgaVersions() {
|
||||
|
@ -40,7 +69,7 @@ void wUpgradeApkItem::OnCheckFpgaVersions() {
|
|||
json.insert("_id", "CheckHardwareVersions");
|
||||
json.insert("_type", "CheckHardwareVersions");
|
||||
auto reply = NetReq("http://"+mCard->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, this] {
|
||||
QObject::connect(reply, &QNetworkReply::finished, mProgress, [reply, this] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) {
|
||||
|
@ -60,7 +89,7 @@ void wUpgradeApkItem::OnCheckSoftVersions() {
|
|||
json.insert("_id", "CheckSoftVersions");
|
||||
json.insert("_type", "CheckSoftVersions");
|
||||
auto reply = NetReq("http://"+mCard->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, this] {
|
||||
QObject::connect(reply, &QNetworkReply::finished, mProgress, [reply, this] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) {
|
||||
|
@ -80,58 +109,24 @@ void wUpgradeApkItem::OnCheckSoftVersions() {
|
|||
}
|
||||
});
|
||||
}
|
||||
void wUpgradeApkItem::onVerifyLockPassword() {
|
||||
bool ok;
|
||||
auto pwd = QInputDialog::getText(gMainWin, tr("Input password"), tr("Input password"), QLineEdit::Password, QString(), &ok);
|
||||
if(! ok) return;
|
||||
QJsonObject json;
|
||||
json.insert("_id", "VerifyPassword");
|
||||
json.insert("_type", "VerifyPassword");
|
||||
json.insert("pwd", pwd);
|
||||
auto reply = NetReq("http://"+mCard->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||
connect(reply, &QNetworkReply::finished, this, [reply, this] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) {
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
if(json["result"].toBool()) mCard->m_bLockStatus = false;
|
||||
else {
|
||||
mCard->m_bLockStatus = true;
|
||||
QMessageBox::critical(gMainWin, tr("Tip Info"), tr("password is wrong"));
|
||||
}
|
||||
SetPasswordItem(mCard);
|
||||
});
|
||||
}
|
||||
void wUpgradeApkItem::SetPasswordItem(LedCard *p){
|
||||
if(p->bPassword) {//加过密
|
||||
if(m_bnLock==nullptr){
|
||||
m_bnLock = new QPushButton(m_pWnd);
|
||||
m_bnLock->setStyleSheet("background-color:transparent;");
|
||||
m_bnLock->setStyleSheet("margin-left:12px; margin-right:12px;margin-top:12px; margin-bottom:12px;");
|
||||
m_parent->setItemWidget(this, Upgrade_ENCRYPT, m_bnLock);
|
||||
connect(m_bnLock, SIGNAL(clicked()), this, SLOT(onVerifyLockPassword()));
|
||||
}
|
||||
if(p->m_bLockStatus) m_bnLock->setIcon(QIcon(":/res/device/Lock.png")); //如果已经验证通过密码显示绿色图标
|
||||
else m_bnLock->setIcon(QIcon(":/res/device/UnLock.png")); //如果没有验证显示蓝色锁图标
|
||||
m_parent->setItemWidget(this, Upgrade_ENCRYPT, m_bnLock);
|
||||
}
|
||||
}
|
||||
void wUpgradeApkItem::setResult(QString tip, QColor color) {
|
||||
setText(Upgrade_Remark, tip);
|
||||
setToolTip(Upgrade_Remark, tip);
|
||||
setForeground(Upgrade_Remark, color);
|
||||
}
|
||||
void wUpgradeApkItem::SetItemParam(LedCard *p) {
|
||||
setData(Upgrade_SCREEN_ID, 0, p->m_strCardId);
|
||||
setData(Upgrade_SCREEN_IP, 0, p->m_strCardIp);
|
||||
mCard->m_strCardId = p->m_strCardId;
|
||||
mCard->m_strCardIp = p->m_strCardIp;
|
||||
mCard->m_bOnLine = p->m_bOnLine;
|
||||
if(mCard->m_bOnLine) m_ImageOnline->setPixmap(QPixmap(mCard->m_bOnLine ? ":/res/device/O_Online.png" : ":/res/device/O_Offline.png"));
|
||||
SetPasswordItem(mCard);
|
||||
setData(Upgrade_REMARK_NAME, 0, p->m_strCardRemarkName);
|
||||
void wUpgradeApkItem::SetItemParam(LedCard *card) {
|
||||
mCard->m_strCardId = card->m_strCardId;
|
||||
mCard->m_strCardIp = card->m_strCardIp;
|
||||
mCard->m_bOnLine = card->m_bOnLine;
|
||||
setData(Upgrade_SCREEN_ID, 0, card->m_strCardId);
|
||||
setData(Upgrade_SCREEN_IP, 0, card->m_strCardIp);
|
||||
setData(Upgrade_REMARK_NAME, 0, card->m_strCardRemarkName);
|
||||
m_ImageOnline->setPixmap(QPixmap(mCard->m_bOnLine ? ":/res/device/O_Online.png" : ":/res/device/O_Offline.png"));
|
||||
OnCheckSoftVersions();
|
||||
OnCheckFpgaVersions();
|
||||
if(! card->bPassword) btnUnlock->hide();
|
||||
else {
|
||||
if(! btnUnlock->isVisible()) btnUnlock->show();
|
||||
btnUnlock->setIcon(QIcon(card->m_bLockStatus ? ":/res/device/Lock.png" : ":/res/device/UnLock.png")); //如果已经验证通过密码显示绿色图标 没有验证显示蓝色锁图标
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef WUPGRADEAPKITEM_H
|
||||
#define WUPGRADEAPKITEM_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QDir>
|
||||
|
@ -15,10 +14,9 @@
|
|||
#include <QProgressBar>
|
||||
#include <QLabel>
|
||||
|
||||
class wUpgradeApkItem : public QObject, public QTreeWidgetItem {
|
||||
Q_OBJECT
|
||||
class wUpgradeApkItem : public QTreeWidgetItem {
|
||||
public:
|
||||
explicit wUpgradeApkItem(LedCard *pLedCard, LoQTreeWidget *parent = nullptr,QWidget *pWnd=nullptr);
|
||||
explicit wUpgradeApkItem(LedCard *pLedCard, LoQTreeWidget *parent);
|
||||
void SetItemParam(LedCard *p);
|
||||
void setResult(QString, QColor cr = Qt::blue);
|
||||
|
||||
|
@ -27,24 +25,16 @@ public:
|
|||
bool m_lockFlag=true;
|
||||
QLabel *m_ImageOnline=nullptr;
|
||||
LoQTreeWidget *m_parent = nullptr;
|
||||
QWidget *m_pWnd=nullptr;
|
||||
QProgressBar *mProgress=nullptr;
|
||||
QPushButton *m_bnLock = nullptr;
|
||||
signals:
|
||||
void sigUpgradeSuccess();
|
||||
void sigUpgradeFail();
|
||||
QPushButton *btnUnlock = nullptr;
|
||||
|
||||
public slots:
|
||||
void onVerifyLockPassword();
|
||||
void OnCheckSoftVersions();
|
||||
void OnCheckFpgaVersions();
|
||||
|
||||
private:
|
||||
void SetPasswordItem(LedCard *p);
|
||||
void postFileTask(const QString& strUrl, const QString& strFilePath);//需要的数据
|
||||
};
|
||||
enum ENUM_DEVICE_PUBLISH_HEADERITEM
|
||||
{
|
||||
enum ENUM_DEVICE_PUBLISH_HEADERITEM {
|
||||
Upgrade_Check=0,
|
||||
Upgrade_SCREEN_ID,
|
||||
Upgrade_ONLINE,
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
#include "deviceitem.h"
|
||||
#include "tools.h"
|
||||
#include "passwordindlg.h"
|
||||
#include "base/x_uimsgboxok.h"
|
||||
#include "base/waitingdlg.h"
|
||||
#include "gutil/qgui.h"
|
||||
#include <QMessageBox>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QJsonArray>
|
||||
#include <QJsonDocument>
|
||||
#include <QPainter>
|
||||
#include <globaldefine.h>
|
||||
#include <QSettings>
|
||||
#include <cfg.h>
|
||||
|
@ -17,14 +16,12 @@
|
|||
#include <QHostAddress>
|
||||
#include <QInputDialog>
|
||||
|
||||
DeviceItem::DeviceItem(LedCard *pLedCard, LoQTreeWidget *parent,QWidget *pWnd) : QObject(parent), QTreeWidgetItem(UserType), m_parent(parent){
|
||||
m_pWnd=pWnd;
|
||||
mCard=pLedCard;
|
||||
DeviceItem::DeviceItem(LedCard *pLedCard, LoQTreeWidget *parent) : QObject(parent), QTreeWidgetItem(UserType), m_parent(parent) {
|
||||
mCard = pLedCard;
|
||||
pHpptClient = new HpptClient(this);
|
||||
setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||
setCheckState(0, Qt::Unchecked);
|
||||
m_parent->addTopLevelItem(this);
|
||||
m_bnLock = new QPushButton();
|
||||
m_bnCardDetailInfo = new QPushButton();
|
||||
m_bnCardDetailInfo->setToolTip(tr("GetScreenDetailInfo"));
|
||||
m_bnCardDetailInfo->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
|
@ -49,7 +46,7 @@ QPushButton:hover{background-color: #ccc;}
|
|||
strTip.append(tr("Android OS Resolution:")).append(mCard->ScreenResolution).append("\r\n");
|
||||
strTip.append(tr("Firmware Version:")).append(mCard->FirmwareVersion).append("\r\n");
|
||||
strTip.append(tr("Player Version:")).append(mCard->strXixunplayerVersion).append("\r\n");
|
||||
QMessageBox::information(gMainWin, tr("Detail Info"), strTip);
|
||||
QMessageBox::information(treeWidget(), tr("Detail Info"), strTip);
|
||||
});
|
||||
|
||||
m_bnReadbackPic = new QPushButton();
|
||||
|
@ -62,7 +59,26 @@ QPushButton {
|
|||
}
|
||||
QPushButton:hover{background-color: #ccc;}
|
||||
)rrr");
|
||||
connect(m_bnReadbackPic, SIGNAL(clicked()), this, SLOT(onReadbackPic()));
|
||||
connect(m_bnReadbackPic, &QPushButton::clicked, this, [this] {
|
||||
QJsonObject json;
|
||||
json.insert("_id", "GetScreenshotFull");
|
||||
json.insert("_type", "GetScreenshotFull");
|
||||
auto waitingDlg = new WaitingDlg(treeWidget(), tr("GetScreenshotFull")+" ...");
|
||||
waitingDlg->show();
|
||||
auto reply = NetReq("http://"+mCard->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||
waitingDlg->connAbort(reply);
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
waitingDlg->close();
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) {
|
||||
QMessageBox::critical(treeWidget(), tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
ImgDlg dlg(QByteArray::fromBase64(json["data"].toString().toLatin1()), treeWidget());
|
||||
dlg.exec();
|
||||
});
|
||||
});
|
||||
|
||||
m_ImageOnline = new QLabel();
|
||||
mCard->m_bOnLine=true;
|
||||
|
@ -75,7 +91,47 @@ QPushButton:hover{background-color: #ccc;}
|
|||
m_parent->setItemWidget(this, DeviceTable_Online, m_ImageOnline);
|
||||
m_ImageOnline->setAlignment(Qt::AlignCenter);
|
||||
|
||||
SetPasswordItem(mCard);
|
||||
btnUnlock = new QPushButton;
|
||||
btnUnlock->setMaximumHeight(40);
|
||||
if(mCard->bPassword) btnUnlock->setIcon(QIcon(mCard->m_bLockStatus ? ":/res/device/Lock.png" : ":/res/device/UnLock.png"));
|
||||
else btnUnlock->hide();
|
||||
connect(btnUnlock, &QPushButton::clicked, this, [this] {
|
||||
if(! mCard->m_bLockStatus) return;
|
||||
bool ok;
|
||||
auto pwd = QInputDialog::getText(treeWidget(), tr("Input password"), tr("Input password"), QLineEdit::Password, QString(), &ok);
|
||||
if(! ok) return;
|
||||
QJsonObject json;
|
||||
json.insert("_id", "VerifyPassword");
|
||||
json.insert("_type", "VerifyPassword");
|
||||
json.insert("pwd", pwd);
|
||||
auto waitingDlg = new WaitingDlg(treeWidget(), tr("VerifyPassword")+" ...");
|
||||
waitingDlg->show();
|
||||
auto reply = NetReq("http://"+mCard->m_strCardIp+":2016/settings").timeout(60000).post(json);
|
||||
waitingDlg->connAbort(reply);
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(treeWidget(), tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
if(! json["result"].toBool()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(treeWidget(), tr("Tip Info"), tr("password is wrong"));
|
||||
return;
|
||||
}
|
||||
waitingDlg->success();
|
||||
mCard->m_bLockStatus = false;
|
||||
btnUnlock->setIcon(QIcon(":/res/device/UnLock.png"));
|
||||
});
|
||||
});
|
||||
auto wgt = new QWidget;
|
||||
auto hBox = new HBox(wgt);
|
||||
hBox->setContentsMargins(0,0,0,0);
|
||||
hBox->addWidget(btnUnlock);
|
||||
m_parent->setItemWidget(this, DeviceTable_Password, wgt);
|
||||
|
||||
for(int i=1; i<DeviceTable_Screenshot; i++) setTextAlignment(i, Qt::AlignCenter);
|
||||
|
||||
//启动心跳,监测设备在线和下线,3次超时表示下线
|
||||
|
@ -98,7 +154,7 @@ QPushButton:hover{background-color: #ccc;}
|
|||
}
|
||||
});
|
||||
mHeartbeatTimer.start(60000);
|
||||
connect(m_bnLock, SIGNAL(clicked()), this, SLOT(onVerifyLockPassword()));
|
||||
|
||||
m_pGetAskTimer=new QTimer(this);
|
||||
connect(pHpptClient,SIGNAL(httpPostRspReady(QString , QString , QByteArray)),this,SLOT(OnProHttpResponse(QString , QString , QByteArray)));
|
||||
//连接item的响应信号到信息输出框的显示槽函数
|
||||
|
@ -141,15 +197,27 @@ void DeviceItem::DeviceItemHttpPost() {
|
|||
json5.insert("_id", getRandomString(10));
|
||||
json5.insert("_type", "CheckSoftVersions");
|
||||
HttpPostByTypeJsonObject(json5);
|
||||
QJsonObject json3;
|
||||
json3.insert("_id", getRandomString(10));
|
||||
json3.insert("_type", "HasControllerPassword");
|
||||
HttpPostByTypeJsonObject(json3);
|
||||
QJsonObject json8;
|
||||
json8.insert("_id", getRandomString(10));
|
||||
json8.insert("_type", "GetCardAlias");
|
||||
HttpPostByTypeJsonObject(json8);
|
||||
|
||||
{
|
||||
QJsonObject json;
|
||||
json.insert("_id", "HasControllerPassword");
|
||||
json.insert("_type", "HasControllerPassword");
|
||||
auto reply = NetReq("http://"+mCard->m_strCardIp+":2016/settings").timeout(120000).post(json);
|
||||
connect(reply, &QNetworkReply::finished, mCard, [=] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) return;
|
||||
mCard->bPassword = json["result"].toBool();
|
||||
if(mCard->bPassword) {//加过密
|
||||
btnUnlock->show();
|
||||
btnUnlock->setIcon(QIcon(mCard->m_bLockStatus ? ":/res/device/Lock.png" : ":/res/device/UnLock.png"));
|
||||
} else btnUnlock->hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
void DeviceItem::OnControlTcpSend(int iProgramIndex) {
|
||||
QTcpSocket *send = new QTcpSocket();
|
||||
|
@ -226,48 +294,12 @@ void DeviceItem::refreshLable(){
|
|||
}
|
||||
}
|
||||
|
||||
void DeviceItem::onVerifyLockPassword() {
|
||||
bool ok;
|
||||
auto pwd = QInputDialog::getText(gMainWin, tr("Input password"), tr("Input password"), QLineEdit::Password, QString(), &ok);
|
||||
if(ok) {
|
||||
QJsonObject json;
|
||||
json.insert("_id", getRandomString(10));
|
||||
json.insert("_type", "VerifyPassword");
|
||||
json.insert("pwd", pwd);
|
||||
HttpPostByTypeJsonObject(json);
|
||||
}
|
||||
}
|
||||
void DeviceItem::onReadbackPic() {
|
||||
QJsonObject json;
|
||||
json.insert("_id", getRandomString(10));
|
||||
json.insert("_type", "GetScreenshotFull");
|
||||
HttpPostByTypeJsonObject(json);
|
||||
if(m_PostingDlg==nullptr)
|
||||
{
|
||||
m_PostingDlg = new LoEmptyDialog(m_pWnd);
|
||||
connect(m_PostingDlg,SIGNAL(sigClose()),this,SLOT(DeletePostingDlg()));
|
||||
connect(m_pGetAskTimer,SIGNAL(timeout()),m_PostingDlg,SLOT(TimerOutUnlock()));
|
||||
m_PostingDlg->lock(tr("GetScreenshotFull"),tr("Success"),tr("GetScreenshotFull")+tr("failed"));
|
||||
m_pGetAskTimer->start(20000);
|
||||
m_PostingDlg->exec();
|
||||
}
|
||||
}
|
||||
void DeviceItem::SetPasswordItem(LedCard *p){
|
||||
if(p->bPassword) {//加过密
|
||||
if(p->m_bLockStatus) m_bnLock->setIcon(QIcon(":/res/device/Lock.png")); //如果已经验证通过密码显示绿色图标
|
||||
else m_bnLock->setIcon(QIcon(":/res/device/UnLock.png")); //如果没有验证显示蓝色锁图标
|
||||
m_parent->setItemWidget(this, DeviceTable_Password, m_bnLock);
|
||||
} else m_bnLock->setIcon(QIcon()); //显示空白
|
||||
}
|
||||
//获取到httpPost的应答,如果参数变化需要出发修改控件item的内容
|
||||
void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data) {
|
||||
Q_UNUSED(postMD5)
|
||||
//qDebug()<< url + "\r\n"+m_strUrl;
|
||||
if(url == m_strUrl)
|
||||
{
|
||||
// qDebug()<<"POST";
|
||||
//qDebug()<<postMD5;
|
||||
//qDebug()<<data;
|
||||
QJsonParseError parseJsonErr;
|
||||
QJsonDocument document = QJsonDocument::fromJson(data,&parseJsonErr);
|
||||
if(!(parseJsonErr.error == QJsonParseError::NoError))
|
||||
|
@ -312,9 +344,8 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
|
|||
mCard->ScreenResolution=jsonObject["ScreenResolution"].toString();
|
||||
mCard->FirmwareVersion=jsonObject["FirmwareVersion"].toString();
|
||||
}
|
||||
else if(strType=="CheckSoftVersions" )
|
||||
else if(strType=="CheckSoftVersions")
|
||||
{
|
||||
|
||||
foreach(QJsonValue value, jsonObject["apps"].toArray()) {
|
||||
QJsonObject oApp = value.toObject();
|
||||
if(oApp["packageName"].toString().contains("xixunplayer"))
|
||||
|
@ -323,19 +354,10 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
|
|||
mCard->strXixunplayerVersionCode=oApp["versionCode"].toInt();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else if(strType == "HasControllerPassword")
|
||||
{
|
||||
{
|
||||
mCard->bPassword=jsonObject["result"].toBool();
|
||||
SetPasswordItem(mCard);
|
||||
}
|
||||
}
|
||||
else if(strType == "AliIotSetting")
|
||||
{
|
||||
emit sigOutputInfo(mCard->m_strCardId+":"+tr("receive")+"<-"+tr("AliIotSetting")+":"+tr("success"));
|
||||
|
||||
}
|
||||
else if(strType == "IsScreenOn")
|
||||
{
|
||||
|
@ -351,23 +373,6 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
|
|||
emit sigOutputInfo(mCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetScreenStatus")+tr("success")+","+tr("Status")+":"+tr("off"));
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(strType == "VerifyPassword")
|
||||
{
|
||||
bool bStatus=jsonObject["result"].toBool();
|
||||
if(bStatus)//解密成功
|
||||
{
|
||||
qDebug()<<"解密成功";
|
||||
mCard->m_bLockStatus=false;
|
||||
}
|
||||
else
|
||||
{
|
||||
qDebug()<<"解密失败";
|
||||
X_UIMsgBoxOk *mb = new X_UIMsgBoxOk(tr("Tip Info"),tr("password is wrong"), m_pWnd,0);
|
||||
mb->exec();
|
||||
mCard->m_bLockStatus=true;
|
||||
}
|
||||
SetPasswordItem(mCard);
|
||||
} else if(strType == "GetBrightness") {
|
||||
mCard->bright = jsonObject["brightnessPercentage"].toInt(-1);
|
||||
if(mCard->bright==-1) mCard->bright = qRound(jsonObject["brightness"].toInt() * 100.0 / mCard->BrightnessLevel);
|
||||
|
@ -383,16 +388,6 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
|
|||
{
|
||||
emit sigOutputInfo(mCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetAutoVolumeTask")+":"+tr("success"));
|
||||
}
|
||||
else if(strType == "SetVolume")
|
||||
{
|
||||
emit sigOutputInfo(mCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetVolume")+":"+tr("success"));
|
||||
}
|
||||
else if(strType == "GetVolume")
|
||||
{
|
||||
int itempVolume=jsonObject["volume"].toInt();
|
||||
QString strCurVolume=QString::number(itempVolume);
|
||||
emit sigOutputInfo(mCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetVolume")+":"+tr("success")+","+tr("volume")+"="+strCurVolume);
|
||||
}
|
||||
else if(strType == "SetTimingScreenTask")
|
||||
{
|
||||
emit sigOutputInfo(mCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetTimingScreenTask")+":"+tr("success"));
|
||||
|
@ -401,35 +396,6 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
|
|||
{
|
||||
emit sigOutputInfo(mCard->m_strCardId+":"+tr("receive")+"<-"+tr("TestScreen")+":"+tr("success"));
|
||||
}
|
||||
else if(strType == "SetOnlineAddr")
|
||||
{
|
||||
emit sigOutputInfo(mCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetOnlineAddr")+":"+tr("success"));
|
||||
}
|
||||
else if(strType == "SetRealtimeServer")
|
||||
{
|
||||
emit sigOutputInfo(mCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetRealtimeServer")+":"+tr("success"));
|
||||
}
|
||||
else if(strType == "GetCurrentSensorBrightness")
|
||||
{
|
||||
bool b485=jsonObject["is485"].toBool();
|
||||
QString strSensorType="RL1";
|
||||
if(b485)
|
||||
{
|
||||
strSensorType="R60";
|
||||
}
|
||||
else {
|
||||
strSensorType= "RL1";
|
||||
}
|
||||
int iTempValue=jsonObject["value"].toInt();
|
||||
QString strSensorValue=QString::number(iTempValue);
|
||||
|
||||
emit sigOutputInfo(mCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetCurrentSensorBrightness")+":"+strSensorType+","+tr("Cur brightness")+":"+strSensorValue);
|
||||
} else if(strType == "GetScreenshotFull") {
|
||||
MACRO_ASKTIME_STOP
|
||||
MACRO_POSTING_DLG_UNLOCK
|
||||
ImgDlg dlg(QByteArray::fromBase64(jsonObject["data"].toString().toLatin1()), m_pWnd);
|
||||
dlg.exec();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class DeviceItem : public QObject, public QTreeWidgetItem {
|
|||
friend class DevicePanel;
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DeviceItem(LedCard *pLedCard, LoQTreeWidget *parent = nullptr,QWidget *pWnd=nullptr);
|
||||
explicit DeviceItem(LedCard *pLedCard, LoQTreeWidget *parent);
|
||||
~DeviceItem();
|
||||
void HttpPostByTypeJsonObject(QJsonObject json);
|
||||
void OnControlTcpSend(int iProgramIndex);
|
||||
|
@ -53,23 +53,16 @@ public slots:
|
|||
void DeletePostingDlg();
|
||||
void OnProHttpResponse(QString url, QString postMD5, QByteArray data);
|
||||
void DeviceItemHttpPost();
|
||||
protected slots:
|
||||
void onReadbackPic();
|
||||
void onVerifyLockPassword();
|
||||
private:
|
||||
int m_intIndexFlagOfInfoOrControl=0;
|
||||
void SetPasswordItem(LedCard *p);
|
||||
private:
|
||||
QPushButton *m_bnCardDetailInfo = nullptr;//
|
||||
QPushButton *m_bnReadbackPic = nullptr;//
|
||||
QPushButton *m_bnLock = nullptr;//
|
||||
QPushButton *btnUnlock = nullptr;//
|
||||
QLabel *m_ImageOnline=nullptr;
|
||||
|
||||
|
||||
LoQTreeWidget *m_parent = nullptr;
|
||||
HpptClient *pHpptClient = nullptr;
|
||||
QString m_strUrl="";
|
||||
QWidget *m_pWnd=nullptr;
|
||||
int m_HeartbeatCount=0;
|
||||
LoEmptyDialog * m_PostingDlg=nullptr;
|
||||
QTimer *m_pGetAskTimer=nullptr;
|
||||
|
|
|
@ -219,18 +219,16 @@ QPushButton:hover {background-color: #08b;}
|
|||
connect(bnSearch, &QPushButton::clicked, this, [this] {
|
||||
QString ipsStr = fdIP->toPlainText();
|
||||
if(ipsStr.isEmpty()) {
|
||||
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input IP address!"));
|
||||
QMessageBox::warning(this, tr("Attention"), tr("Please input IP address!"));
|
||||
return;
|
||||
}
|
||||
auto ips = ipsStr.split("\n", Qt::SkipEmptyParts);
|
||||
if(ips.isEmpty()) {
|
||||
QMessageBox::warning(gMainWin, tr("Attention"), tr("Please input IP address!"));
|
||||
QMessageBox::warning(this, tr("Attention"), tr("Please input IP address!"));
|
||||
return;
|
||||
}
|
||||
QByteArray data = QJsonDocument({{"action", "getInfo"}}).toJson(QJsonDocument::Compact);
|
||||
foreach(auto ip, ips) {
|
||||
if(gDevicePanel->mUdpSocket.writeDatagram(data, QHostAddress(ip), 22222) != data.length()) qDebug() << "Specify IP write Failed." << ip;
|
||||
}
|
||||
foreach(auto ip, ips) if(mUdpSocket.writeDatagram(data, QHostAddress(ip), 22222) != data.length()) qDebug() << "Specify IP write Failed." << ip;
|
||||
specifyIPDlg->accept();
|
||||
});
|
||||
hBox->addWidget(bnSearch);
|
||||
|
@ -373,7 +371,7 @@ void DevicePanel::addLedCard(LedCard *card) {
|
|||
item->setData(DeviceTable_ScreenSize, 0, QString("%1 x %2").arg(card->m_iWidth).arg(card->m_iHeight));
|
||||
return;
|
||||
}
|
||||
new DeviceItem(card, mDeviceTable, this);
|
||||
new DeviceItem(card, mDeviceTable);
|
||||
nDeviceNum->setText(QString::number(mDeviceTable->topLevelItemCount()));
|
||||
|
||||
QJsonObject json;
|
||||
|
|
|
@ -186,7 +186,7 @@ QString checkReplyForJson(QNetworkReply *, QJsonDocument * = 0, QByteArray * = 0
|
|||
QString err = checkReplyForJson(reply);\
|
||||
if(! err.isEmpty()) {\
|
||||
waitingDlg->close();\
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);\
|
||||
QMessageBox::critical(this, tr("Error"), err);\
|
||||
return;\
|
||||
}\
|
||||
waitingDlg->success();
|
||||
|
@ -196,7 +196,7 @@ QString checkReplyForJson(QNetworkReply *, QJsonDocument * = 0, QByteArray * = 0
|
|||
QString err = checkReplyForJson(reply, &json);\
|
||||
if(! err.isEmpty()) {\
|
||||
waitingDlg->close();\
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);\
|
||||
QMessageBox::critical(this, tr("Error"), err);\
|
||||
return;\
|
||||
}
|
||||
|
||||
|
@ -209,7 +209,7 @@ QString checkReplyForJson(QNetworkReply *, QJsonDocument * = 0, QByteArray * = 0
|
|||
|
||||
#define CHECK_CARD_SELECTED \
|
||||
if(gSelCards->isEmpty()) {\
|
||||
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));\
|
||||
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));\
|
||||
return;\
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
#include <QStandardPaths>
|
||||
#include "QSimpleUpdater.h"
|
||||
|
||||
QWidget *gMainWin;
|
||||
extern QPoint gPlayPos;
|
||||
|
||||
class ImgBtn : public QToolButton {
|
||||
|
@ -52,7 +51,6 @@ protected:
|
|||
|
||||
MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
|
||||
setAttribute(Qt::WA_AlwaysShowToolTips);
|
||||
gMainWin = this;
|
||||
auto menuLang = new QMenu();
|
||||
|
||||
auto actCN = new QAction("中文");
|
||||
|
|
|
@ -53,10 +53,10 @@ ProgPanel::ProgPanel(QSettings &settings, QWidget *parent) : QWidget(parent) {
|
|||
}
|
||||
if(ttl > width) widths.last() -= ttl - width;
|
||||
}
|
||||
auto item = new ProgItem(mProgsDir, dlg.fdName->text(), width, dlg.fdHeight->value(), dlg.fdRemark->toPlainText(), widths, max, mProgTree, this);
|
||||
auto item = new ProgItem(mProgsDir, dlg.fdName->text(), width, dlg.fdHeight->value(), dlg.fdRemark->toPlainText(), widths, max, mProgTree);
|
||||
item->save();//保存pro.json
|
||||
mProgTree->adjustCheckState();
|
||||
auto editor = new ProgEditorWin(item, gMainWin);
|
||||
auto editor = new ProgEditorWin(item, this);
|
||||
editor->show();
|
||||
});
|
||||
|
||||
|
@ -94,7 +94,7 @@ ProgPanel::ProgPanel(QSettings &settings, QWidget *parent) : QWidget(parent) {
|
|||
auto subdir = dir + "/" + subdirName;
|
||||
if(! QFileInfo::exists(subdir + "/pro.json")) continue;
|
||||
if(QFileInfo::exists(progsDir + "/" + subdirName)) {
|
||||
auto res = QMessageBox::information(gMainWin, tr("Tip Info"), subdirName + tr(":solution(s) already exist.are you sure you want to overwrite the existing solution(s)?"), QMessageBox::Yes, QMessageBox::No);
|
||||
auto res = QMessageBox::information(this, tr("Tip Info"), subdirName + tr(":solution(s) already exist.are you sure you want to overwrite the existing solution(s)?"), QMessageBox::Yes, QMessageBox::No);
|
||||
if(res == QMessageBox::No) continue;
|
||||
}
|
||||
progDirs.append(subdir);
|
||||
|
@ -127,7 +127,7 @@ ProgPanel::ProgPanel(QSettings &settings, QWidget *parent) : QWidget(parent) {
|
|||
if(! jFile.open(QIODevice::ReadOnly)) continue;
|
||||
auto data = jFile.readAll();
|
||||
jFile.close();
|
||||
m_pwPorgramItemList.append(new ProgItem(mProgsDir, QJsonDocument::fromJson(data).object(), mProgTree,this));
|
||||
m_pwPorgramItemList.append(new ProgItem(mProgsDir, QJsonDocument::fromJson(data).object(), mProgTree));
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -285,7 +285,7 @@ ProgPanel::ProgPanel(QSettings &settings, QWidget *parent) : QWidget(parent) {
|
|||
fPro.open(QIODevice::ReadOnly);
|
||||
QJsonDocument pro = QJsonDocument::fromJson(fPro.readAll());
|
||||
fPro.close();
|
||||
m_pwPorgramItemList.append(new ProgItem(mProgsDir, pro.object(), mProgTree,this));
|
||||
m_pwPorgramItemList.append(new ProgItem(mProgsDir, pro.object(), mProgTree));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ void ProgPanel::onEditClicked(bool){
|
|||
for(int i=0; i<cnt; i++) {
|
||||
if(mProgTree->topLevelItem(i)->checkState(0) == Qt::Checked) {
|
||||
auto item = static_cast<ProgItem*>(mProgTree->topLevelItem(i));
|
||||
auto editor = new ProgEditorWin(item, gMainWin);
|
||||
auto editor = new ProgEditorWin(item, this);
|
||||
editor->show();
|
||||
break;
|
||||
}
|
||||
|
@ -350,10 +350,10 @@ bool ProgPanel::checkIfNameRepeated(const QString &name, QTreeWidgetItem *skip){
|
|||
void ProgPanel::onCreateNewProgramOnOpenEditProgramWidget(QString name, QSize res, QString remarks, QList<int> &splitWidths, int max)
|
||||
{
|
||||
if(checkIfNameRepeated(name)) return;
|
||||
auto item = new ProgItem(mProgsDir, name, res.width(), res.height(), remarks, splitWidths, max, mProgTree, this);
|
||||
auto item = new ProgItem(mProgsDir, name, res.width(), res.height(), remarks, splitWidths, max, mProgTree);
|
||||
item->save();//保存pro.json
|
||||
mProgTree->adjustCheckState();
|
||||
auto editor = new ProgEditorWin(item, gMainWin);
|
||||
auto editor = new ProgEditorWin(item, this);
|
||||
editor->show();
|
||||
}
|
||||
void ProgPanel::onDeleteClicked(bool){
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
#include "eaclock.h"
|
||||
#include "QtWidgets/qgraphicsscene.h"
|
||||
#include "cfg.h"
|
||||
#include "globaldefine.h"
|
||||
#include "gutil/qgui.h"
|
||||
|
@ -305,8 +306,8 @@ QWidget* EAClock::attrWgt() {
|
|||
|
||||
auto btnSelImg = new QPushButton(tr("Select"));
|
||||
btnSelImg->setProperty("ssType", "progManageTool");
|
||||
connect(btnSelImg, &QPushButton::clicked, this, [this, fdDialImg] {
|
||||
QString fileName = QFileDialog::getOpenFileName(gMainWin, tr("Select Dail file"), "./AClock/", "Dail files(*.png)");
|
||||
connect(btnSelImg, &QPushButton::clicked, wgtAttr, [=] {
|
||||
QString fileName = QFileDialog::getOpenFileName(wgtAttr, tr("Select Dail file"), "./AClock/", "Dail files(*.png)");
|
||||
if(fileName.isEmpty()) return;
|
||||
fdDialImg->setText(fileName);
|
||||
QFileInfo info(fileName);
|
||||
|
|
|
@ -1,167 +0,0 @@
|
|||
#include "eaudio.h"
|
||||
#include "cfg.h"
|
||||
#include "tools.h"
|
||||
#include "base/ffutil.h"
|
||||
#include <QBoxLayout>
|
||||
#include <QDir>
|
||||
#include <QLabel>
|
||||
#include <QLineEdit>
|
||||
#include <QMessageBox>
|
||||
#include <QMovie>
|
||||
#include <QPainter>
|
||||
#include <QPushButton>
|
||||
#include <QSpinBox>
|
||||
|
||||
EAudio *EAudio::create(const QString &file, PageListItem *pageItem, EBase *multiWin) {
|
||||
int64_t dur;
|
||||
QString err = audioInfo(file.toUtf8(), &dur);
|
||||
if(! err.isEmpty()) {
|
||||
QMessageBox::critical(gMainWin, "Audio Error", err+"\n"+file);
|
||||
return nullptr;
|
||||
}
|
||||
QFileInfo info(file);
|
||||
return new EAudio(info.absolutePath(), info.fileName(), dur/1000000, pageItem, multiWin);
|
||||
}
|
||||
EAudio *EAudio::create(const QJsonObject &json, PageListItem *pageItem, EBase *multiWin) {
|
||||
auto dir = json["fileDir"].toString();
|
||||
auto name = json["fileName"].toString();
|
||||
if(! QFileInfo::exists(dir)) dir = pageItem->mPageDir;
|
||||
QString file = dir + "/" + name;
|
||||
if(QFileInfo::exists(file)) ;
|
||||
else if(QFileInfo::exists(file = pageItem->mPageDir + "/" + name)) dir = pageItem->mPageDir;
|
||||
else return nullptr;
|
||||
auto ins = new EAudio(dir, name, json["duration"].toInt(), pageItem, multiWin);
|
||||
ins->setBaseAttr(json);
|
||||
return ins;
|
||||
}
|
||||
QJsonObject EAudio::genProg(const QJsonObject &ele, const QString &dstDir) {
|
||||
auto name = ele["fileName"].toString();
|
||||
QString srcFile = ele["fileDir"].toString() + "/" + name;
|
||||
QFileInfo srcInfo(srcFile);
|
||||
if(! srcInfo.isFile()) return QJsonObject();
|
||||
QString id = Tools::fileMd5(srcFile);
|
||||
if(id.isEmpty()) return QJsonObject();
|
||||
QFile::copy(srcFile, dstDir+"/"+id);
|
||||
QJsonObject oRes;
|
||||
oRes["_type"] = "Audio";
|
||||
oRes["id"] = id;
|
||||
oRes["md5"] = id;
|
||||
oRes["name"] = name;
|
||||
oRes["size"] = srcInfo.size();
|
||||
oRes["fileExt"] = srcInfo.suffix().toLower();
|
||||
oRes["timeSpan"] = ele["duration"].toInt();
|
||||
oRes["enabled"] = true;
|
||||
return oRes;
|
||||
}
|
||||
|
||||
EAudio::EAudio(const QString &dir, const QString &name, int dur, PageListItem *pageItem, EBase *multiWin) : EBase(multiWin), mDir(dir), mName(name), mDuration(dur), mPageItem(pageItem) {
|
||||
mType = EBase::Audio;
|
||||
}
|
||||
|
||||
QJsonObject EAudio::attrJson() const {
|
||||
QJsonObject obj;
|
||||
addBaseAttr(obj);
|
||||
obj["elementType"] = "Audio";
|
||||
obj["fileDir"] = mDir;
|
||||
obj["fileName"] = mName;
|
||||
obj["duration"] = mDuration;
|
||||
return obj;
|
||||
}
|
||||
|
||||
bool EAudio::save(const QString &pageDir) {
|
||||
QString oldFile = mDir + PAGEDEL_SUFFIX + "/" + mName;
|
||||
if(QFileInfo::exists(oldFile)) ;
|
||||
else if(QFileInfo::exists(oldFile = mDir + "/" + mName)) ;
|
||||
else return false;
|
||||
QFile::copy(oldFile, pageDir + "/" + mName);
|
||||
mDir = pageDir;
|
||||
return true;
|
||||
}
|
||||
|
||||
void EAudio::paint(QPainter *painter, const QStyleOptionGraphicsItem *a, QWidget *b) {
|
||||
painter->setRenderHints(QPainter::Antialiasing|QPainter::SmoothPixmapTransform);
|
||||
static auto img = QPixmap(":/res/program/Audio.png");
|
||||
auto inner = innerRect();
|
||||
if(inner.width() > inner.height()) inner.setWidth(inner.height());
|
||||
else if(inner.height() > inner.width()) inner.setHeight(inner.width());
|
||||
painter->drawPixmap(inner, img, QRectF());
|
||||
EBase::paint(painter, a, b);
|
||||
}
|
||||
|
||||
QWidget* EAudio::attrWgt() {
|
||||
auto wgtAttr = new QWidget();
|
||||
auto vBox = new QVBoxLayout(wgtAttr);
|
||||
vBox->setContentsMargins(6, 0, 6, 0);
|
||||
if(mMultiWin!=nullptr) vBox->setSpacing(3);
|
||||
|
||||
addBaseAttrWgt(vBox);
|
||||
|
||||
auto hBox = new QHBoxLayout();
|
||||
hBox->addWidget(new QLabel(tr("Basic Properties")));
|
||||
|
||||
auto line = new QFrame();
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
hBox->addWidget(line, 1);
|
||||
|
||||
vBox->addLayout(hBox);
|
||||
|
||||
hBox = new QHBoxLayout();
|
||||
hBox->addSpacing(6);
|
||||
hBox->addWidget(new QLabel(tr("File")));
|
||||
|
||||
auto fdFileName = new QLineEdit(mName);
|
||||
fdFileName->setReadOnly(true);
|
||||
hBox->addWidget(fdFileName);
|
||||
|
||||
auto bnSelectFile = new QPushButton("...");
|
||||
bnSelectFile->setFixedWidth(30);
|
||||
bnSelectFile->setObjectName("bnSelectFile");
|
||||
hBox->addWidget(bnSelectFile);
|
||||
|
||||
vBox->addLayout(hBox);
|
||||
|
||||
hBox = new QHBoxLayout();
|
||||
hBox->addWidget(new QLabel(tr("Play Properties")));
|
||||
|
||||
line = new QFrame();
|
||||
line->setFrameShape(QFrame::HLine);
|
||||
line->setFrameShadow(QFrame::Sunken);
|
||||
hBox->addWidget(line, 1);
|
||||
|
||||
vBox->addLayout(hBox);
|
||||
|
||||
hBox = new QHBoxLayout();
|
||||
hBox->addSpacing(6);
|
||||
hBox->addWidget(new QLabel(tr("Play Duration")));
|
||||
|
||||
auto fdDuration = new QSpinBox();
|
||||
fdDuration->setRange(1, 99999);
|
||||
fdDuration->setValue(mDuration);
|
||||
connect(fdDuration, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this](int value) {
|
||||
mDuration = value;
|
||||
});
|
||||
connect(bnSelectFile, &QPushButton::clicked, this, [this, fdFileName, fdDuration] {
|
||||
auto file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, EAudio::filters());
|
||||
if(file.isEmpty()) return;
|
||||
int64_t dur;
|
||||
QString err = audioInfo(file.toUtf8(), &dur);
|
||||
if(! err.isEmpty()) {
|
||||
QMessageBox::critical(gMainWin, "Audio Error", err+"\n"+file);
|
||||
return;
|
||||
}
|
||||
QFileInfo info(file);
|
||||
mDir = info.absolutePath();
|
||||
gFileHome = mDir;
|
||||
mName = info.fileName();
|
||||
fdFileName->setText(mName);
|
||||
fdDuration->setValue(dur/1000000);
|
||||
});
|
||||
hBox->addWidget(fdDuration);
|
||||
hBox->addWidget(new QLabel(tr("s")));
|
||||
hBox->addStretch();
|
||||
|
||||
vBox->addLayout(hBox);
|
||||
vBox->addStretch();
|
||||
return wgtAttr;
|
||||
}
|
|
@ -1,29 +0,0 @@
|
|||
#ifndef EAUDIO_H
|
||||
#define EAUDIO_H
|
||||
|
||||
#include "ebase.h"
|
||||
#include "pagelistitem.h"
|
||||
|
||||
class EAudio : public EBase {
|
||||
Q_OBJECT
|
||||
public:
|
||||
static QString filters() { return tr("Audio")+"(*.mp3 *.wav *.wma *.flac *.ape *.amr *.aac *.ac3 *.mka *.m4a *.ogg)"; }
|
||||
static EAudio *create(const QString &file, PageListItem *pageItem, EBase *multiWin = nullptr);
|
||||
static EAudio *create(const QJsonObject &, PageListItem *pageItem, EBase *multiWin = nullptr);
|
||||
static QJsonObject genProg(const QJsonObject &, const QString &);
|
||||
|
||||
explicit EAudio(const QString &dir, const QString &name, int dur, PageListItem *pageItem, EBase *multiWin = nullptr);
|
||||
virtual int type() const override { return EBase::Gif; }
|
||||
void paint(QPainter*, const QStyleOptionGraphicsItem *, QWidget *) override;
|
||||
QWidget* attrWgt() override;
|
||||
bool save(const QString &pRoot) override;
|
||||
QJsonObject attrJson() const override;
|
||||
|
||||
QString mDir;
|
||||
QString mName;
|
||||
protected:
|
||||
int mDuration = 10;
|
||||
PageListItem *mPageItem;
|
||||
};
|
||||
|
||||
#endif // EAUDIO_H
|
|
@ -14,7 +14,7 @@
|
|||
EGif *EGif::create(const QString &file, PageListItem *pageItem, EBase *multiWin) {
|
||||
auto movie = new QMovie(file);
|
||||
if(! movie->isValid()) {
|
||||
QMessageBox::critical(gMainWin, "Gif Error", Tools::readErrStr(movie->lastError())+": "+movie->lastErrorString()+"\n"+file);
|
||||
QMessageBox::critical(pageItem->listWidget(), "Gif Error", Tools::readErrStr(movie->lastError())+": "+movie->lastErrorString()+"\n"+file);
|
||||
delete movie;
|
||||
return 0;
|
||||
}
|
||||
|
@ -120,12 +120,12 @@ QWidget* EGif::attrWgt() {
|
|||
auto bnSelectFile = new QPushButton("...");
|
||||
bnSelectFile->setFixedWidth(30);
|
||||
bnSelectFile->setObjectName("bnSelectFile");
|
||||
connect(bnSelectFile, &QPushButton::clicked, this, [this, wFile] {
|
||||
auto file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, EGif::filters());
|
||||
connect(bnSelectFile, &QPushButton::clicked, wgtAttr, [=] {
|
||||
auto file = QFileDialog::getOpenFileName(wgtAttr, tr("Select File"), gFileHome, EGif::filters());
|
||||
if(file.isEmpty()) return;
|
||||
auto movie = new QMovie(file);
|
||||
if(! movie->isValid()) {
|
||||
QMessageBox::critical(gMainWin, "Gif Error", Tools::readErrStr(movie->lastError())+": "+movie->lastErrorString()+"\n"+file);
|
||||
QMessageBox::critical(wgtAttr, "Gif Error", Tools::readErrStr(movie->lastError())+": "+movie->lastErrorString()+"\n"+file);
|
||||
delete movie;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ QWidget* EMultiWin::attrWgt() {
|
|||
EBase *ele = 0;
|
||||
QListWidgetItem *item = 0;
|
||||
if(type==EBase::Photo) {
|
||||
auto files = QFileDialog::getOpenFileNames(gMainWin, tr("Select File"), gFileHome, EPhoto::filters());
|
||||
auto files = QFileDialog::getOpenFileNames(wgtAttr, tr("Select File"), gFileHome, EPhoto::filters());
|
||||
for(int i=0; i<files.count(); i++) {
|
||||
auto ePhoto = EPhoto::create(files[i], mPageItem, this);
|
||||
if(ePhoto==0) continue;
|
||||
|
@ -155,7 +155,7 @@ QWidget* EMultiWin::attrWgt() {
|
|||
}
|
||||
}
|
||||
} else if(type==EBase::Gif) {
|
||||
auto files = QFileDialog::getOpenFileNames(gMainWin, tr("Select File"), gFileHome, EGif::filters());
|
||||
auto files = QFileDialog::getOpenFileNames(wgtAttr, tr("Select File"), gFileHome, EGif::filters());
|
||||
for(int i=0; i<files.count(); i++) {
|
||||
auto eGif = EGif::create(files[i], mPageItem, this);
|
||||
if(eGif==0) continue;
|
||||
|
@ -172,7 +172,7 @@ QWidget* EMultiWin::attrWgt() {
|
|||
}
|
||||
}
|
||||
} else if(type==EBase::Video) {
|
||||
auto file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, EVideo::filters());
|
||||
auto file = QFileDialog::getOpenFileName(wgtAttr, tr("Select File"), gFileHome, EVideo::filters());
|
||||
if(! file.isEmpty()) {
|
||||
auto eVideo = EVideo::create(file, mPageItem, this);
|
||||
if(eVideo==0) return;
|
||||
|
|
|
@ -13,8 +13,8 @@ EPhoto *EPhoto::create(const QString &file, PageListItem *pageItem, EBase *multi
|
|||
QImageReader reader(file);
|
||||
QImage img = reader.read();
|
||||
if(img.isNull()) {
|
||||
QMessageBox::critical(gMainWin, "Image Error", Tools::readErrStr(reader.error())+": "+reader.errorString()+"\n"+file);
|
||||
return nullptr;
|
||||
QMessageBox::critical(pageItem->listWidget(), "Image Error", Tools::readErrStr(reader.error())+": "+reader.errorString()+"\n"+file);
|
||||
return 0;
|
||||
}
|
||||
QFileInfo info(file);
|
||||
return new EPhoto(img, info.absolutePath(), info.fileName(), pageItem, multiWin);
|
||||
|
@ -134,14 +134,14 @@ QWidget* EPhoto::attrWgt() {
|
|||
auto bnSelectFile = new QPushButton("...");
|
||||
bnSelectFile->setFixedWidth(30);
|
||||
bnSelectFile->setObjectName("bnSelectFile");
|
||||
connect(bnSelectFile, &QPushButton::clicked, this, [this, fdFile] {
|
||||
connect(bnSelectFile, &QPushButton::clicked, wgtAttr, [=] {
|
||||
QString home = mDir.startsWith(gProgItem->mProgDir) ? gFileHome : mDir;
|
||||
QString file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), home, EPhoto::filters());
|
||||
QString file = QFileDialog::getOpenFileName(wgtAttr, tr("Select File"), home, EPhoto::filters());
|
||||
if(file.isEmpty()) return;
|
||||
QImageReader reader(file);
|
||||
QImage aimg = reader.read();
|
||||
if(aimg.isNull()) {
|
||||
QMessageBox::critical(gMainWin, tr("Image Read Error"), Tools::readErrStr(reader.error())+": "+reader.errorString()+"\n"+file);
|
||||
QMessageBox::critical(wgtAttr, tr("Image Read Error"), Tools::readErrStr(reader.error())+": "+reader.errorString()+"\n"+file);
|
||||
return;
|
||||
}
|
||||
img = aimg;
|
||||
|
|
|
@ -356,12 +356,12 @@ QWidget* EText::attrWgt() {
|
|||
|
||||
auto btnImport = new QPushButton(tr("Import txt File"));
|
||||
btnImport->setProperty("ssType", "progManageTool");
|
||||
connect(btnImport, &QPushButton::clicked, fdText, [fdText] {
|
||||
auto filePath = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, "Txt(*.txt)");
|
||||
connect(btnImport, &QPushButton::clicked, fdText, [=] {
|
||||
auto filePath = QFileDialog::getOpenFileName(wgtAttr, tr("Select File"), gFileHome, "Txt(*.txt)");
|
||||
if(filePath.isEmpty()) return;
|
||||
QFile file(filePath);
|
||||
if(! file.open(QFile::ReadOnly)) {
|
||||
QMessageBox::critical(gMainWin, tr("Fail"), tr("File Open Fail"));
|
||||
QMessageBox::critical(wgtAttr, tr("Fail"), tr("File Open Fail"));
|
||||
return;
|
||||
}
|
||||
auto data = file.readAll();
|
||||
|
@ -485,11 +485,11 @@ QWidget* EText::attrWgt() {
|
|||
vBox->addLayout(hBox);
|
||||
vBox->addStretch();
|
||||
|
||||
connect(fdPageDur, &QTimeEdit::timeChanged, this, [this, wEffectSpeed, fdPageDur, fdDur](const QTime &time) {
|
||||
connect(fdPageDur, &QTimeEdit::timeChanged, this, [=](const QTime &time) {
|
||||
int effDur = wEffectSpeed->value();
|
||||
int pageDur = time.msecsSinceStartOfDay()/1000;
|
||||
if(pageDur < effDur) {
|
||||
QMessageBox::warning(gMainWin, tr("Tip Info"), tr("Effect time cannot be longer than duration time"));
|
||||
QMessageBox::warning(wgtAttr, tr("Tip Info"), tr("Effect time cannot be longer than duration time"));
|
||||
pageDur = effDur;
|
||||
fdPageDur->setTime(QTime::fromMSecsSinceStartOfDay(pageDur*1000));
|
||||
fdPageDur->setFocus();
|
||||
|
@ -497,10 +497,10 @@ QWidget* EText::attrWgt() {
|
|||
m_attr.flip.pageDuration = pageDur;
|
||||
fdDur->setTime(QTime::fromMSecsSinceStartOfDay(pageDur * mImgs.size() * 1000));
|
||||
});
|
||||
connect(wEffectSpeed, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this, wEffectSpeed, fdPageDur](int value) {
|
||||
connect(wEffectSpeed, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [=](int value) {
|
||||
int pageDur = fdPageDur->time().msecsSinceStartOfDay()/1000;
|
||||
if(value > pageDur) {
|
||||
QMessageBox::warning(gMainWin, tr("Tip Info"), tr("Effect time cannot be longer than duration time"));
|
||||
QMessageBox::warning(wgtAttr, tr("Tip Info"), tr("Effect time cannot be longer than duration time"));
|
||||
if(pageDur>1) value = pageDur-1;
|
||||
else value = 0;
|
||||
wEffectSpeed->setValue(value);
|
||||
|
|
|
@ -17,7 +17,7 @@ EVideo *EVideo::create(const QString &file, PageListItem *pageItem, EBase *multi
|
|||
QImage img;
|
||||
QString err = videoInfo(file.toUtf8(), img, &dur, &codecId);
|
||||
if(! err.isEmpty()) {
|
||||
QMessageBox::critical(gMainWin, "Video Error", err+"\n"+file);
|
||||
QMessageBox::critical(pageItem->listWidget(), "Video Error", err+"\n"+file);
|
||||
return 0;
|
||||
}
|
||||
QFileInfo rawInfo(file);
|
||||
|
@ -170,15 +170,15 @@ QWidget* EVideo::attrWgt() {
|
|||
connect(fdDuration, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this](int value) {
|
||||
playDuration = value;
|
||||
});
|
||||
connect(bnSelectFile, &QPushButton::clicked, this, [this, fdFileName, fdDuration] {
|
||||
auto rawFile = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, EVideo::filters());
|
||||
connect(bnSelectFile, &QPushButton::clicked, this, [=] {
|
||||
auto rawFile = QFileDialog::getOpenFileName(wgtAttr, tr("Select File"), gFileHome, EVideo::filters());
|
||||
if(rawFile.isEmpty()) return;
|
||||
QFileInfo rawInfo(rawFile);
|
||||
int64_t dur;
|
||||
AVCodecID codecId;
|
||||
QString err = videoInfo(rawFile.toUtf8(), mCoverImg, &dur, &codecId);
|
||||
if(! err.isEmpty()) {
|
||||
QMessageBox::critical(gMainWin, "Video Error", err+"\n"+rawFile);
|
||||
QMessageBox::critical(wgtAttr, "Video Error", err+"\n"+rawFile);
|
||||
return;
|
||||
};
|
||||
mRawDir = rawInfo.absolutePath();
|
||||
|
@ -230,14 +230,11 @@ bool EVideo::save(const QString &pageDir) {
|
|||
QFile(oldFile).copy(saveFile);
|
||||
mDir = pageDir;
|
||||
if(gProgItem->mMaxWidth) {
|
||||
QWidget *paren;
|
||||
QObject obj;
|
||||
scene()->parent();
|
||||
auto waitingDlg = new WaitingDlg(gProgEditorWin, "正在转码视频 ...");
|
||||
auto waitingDlg = new WaitingDlg(parentWgt(scene()), "正在转码视频 ...");
|
||||
auto thread = new VideoSplitThread(mWidth, mHeight, gProgItem->mMaxWidth, gProgItem->mHeight, gProgItem->mSplitWidths, pos(), saveFile.toUtf8());
|
||||
connect(thread, &VideoSplitThread::emErr, this, [saveFile, waitingDlg](QString err) {
|
||||
connect(thread, &VideoSplitThread::emErr, this, [=](QString err) {
|
||||
waitingDlg->close();
|
||||
if(! err.isEmpty()) QMessageBox::critical(gProgEditorWin, "Video trans error", err+"\n"+saveFile);
|
||||
if(! err.isEmpty()) QMessageBox::critical(parentWgt(scene()), "Video trans error", err+"\n"+saveFile);
|
||||
});
|
||||
connect(thread, &VideoSplitThread::emProgress, this, [saveFile, waitingDlg](int progress) {
|
||||
waitingDlg->fdText->setText(QString("正在转码视频 %1%").arg(progress));
|
||||
|
@ -282,7 +279,7 @@ QString EVideo::transcoding(QString rawFile, QString rawName, QString dir, int w
|
|||
|
||||
QProcess process;
|
||||
process.setWorkingDirectory(QApplication::applicationDirPath());
|
||||
QMessageBox msgBox(gMainWin);
|
||||
QMessageBox msgBox;
|
||||
msgBox.setWindowFlag(Qt::WindowCloseButtonHint, false);
|
||||
msgBox.setStandardButtons(QMessageBox::NoButton);
|
||||
msgBox.setWindowTitle(tr("Video Transcoding"));
|
||||
|
@ -292,7 +289,7 @@ QString EVideo::transcoding(QString rawFile, QString rawName, QString dir, int w
|
|||
});
|
||||
connect(&process, &QProcess::errorOccurred, &msgBox, [&msgBox](QProcess::ProcessError error) {
|
||||
msgBox.accept();
|
||||
QMessageBox::critical(gMainWin, tr("Error"), QString(QMetaEnum::fromType<QProcess::ProcessError>().valueToKey(error))+" ("+QString::number(error)+")");
|
||||
QMessageBox::critical(0, tr("Error"), QString(QMetaEnum::fromType<QProcess::ProcessError>().valueToKey(error))+" ("+QString::number(error)+")");
|
||||
});
|
||||
connect(&process, &QProcess::readyReadStandardOutput, &msgBox, [&process] {
|
||||
auto data = process.readAllStandardOutput();
|
||||
|
@ -319,8 +316,8 @@ QString EVideo::transcoding(QString rawFile, QString rawName, QString dir, int w
|
|||
});
|
||||
process.start("ffmpeg", {"-y", "-i", rawFile, "-vcodec", "h264", "-s", QString::number(w)+"x"+QString::number(h), "-profile:v", "main", "-b:v", QString::number(w*h/150)+"k", outFile});
|
||||
msgBox.exec();
|
||||
if(err.right(32).contains("Conversion failed!")) {
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
if(err.rightRef(32).contains("Conversion failed!")) {
|
||||
QMessageBox::critical(0, tr("Error"), err);
|
||||
return "";
|
||||
}
|
||||
return outFile;
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
#include "cfg.h"
|
||||
#include "globaldefine.h"
|
||||
#include "tools.h"
|
||||
#include "program/eaudio.h"
|
||||
#include "program/eenviron.h"
|
||||
#include "program/etext.h"
|
||||
#include "program/evideo.h"
|
||||
|
@ -11,11 +10,8 @@
|
|||
#include <QProcess>
|
||||
#include <QMessageBox>
|
||||
|
||||
GenTmpThread::GenTmpThread(ProgItem *progItem, const QString &prog_name, const QString &zip_file, const QString &password, QObject *parent) : QThread(parent), mProgItem(progItem), prog_name(prog_name), zip_file(zip_file), password(password) {
|
||||
GenTmpThread::GenTmpThread(ProgItem *progItem, const QString &prog_name, const QString &zip_file, const QString &password) : mProgItem(progItem), prog_name(prog_name), zip_file(zip_file), password(password) {
|
||||
connect(this, &QThread::finished, this, &QThread::deleteLater);
|
||||
connect(this, &GenTmpThread::onErr, this, [](QString err) {
|
||||
QMessageBox::warning(gMainWin, "GenTmpThread Error", err);
|
||||
});
|
||||
}
|
||||
|
||||
void GenTmpThread::run() {
|
||||
|
@ -285,7 +281,6 @@ QJsonObject GenTmpThread::cvtEle(const QString &type, const QJsonObject &ele) {
|
|||
else if(type=="Temp") return EEnviron::genProg(ele, dstDir, srcPageDir);
|
||||
else if(type=="Web") return convertWeb(ele);
|
||||
else if(type=="Timer") return convertTimer(ele);
|
||||
else if(type=="Audio") return EAudio::genProg(ele, dstDir);
|
||||
return QJsonObject();
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ class ProgItem;
|
|||
class GenTmpThread : public QThread {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit GenTmpThread(ProgItem *progItem, const QString &prog_name, const QString &zip_file, const QString &password, QObject *parent = nullptr);
|
||||
explicit GenTmpThread(ProgItem *progItem, const QString &prog_name, const QString &zip_file, const QString &password);
|
||||
|
||||
ProgItem *mProgItem;
|
||||
protected:
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
#include "base/lodateselector.h"
|
||||
#include "cfg.h"
|
||||
#include "program/eaclock.h"
|
||||
#include "program/eaudio.h"
|
||||
#include "program/ebase.h"
|
||||
#include "program/edclock.h"
|
||||
#include "program/eenviron.h"
|
||||
|
@ -45,7 +44,6 @@ PageListItem::PageListItem(const QJsonObject &attr, const QString &pageDir) : mA
|
|||
else if(type=="Photo") element = EPhoto::create(ele.toObject(), this);
|
||||
else if(type=="Gif") element = EGif::create(ele.toObject(), this);
|
||||
else if(type=="Movie") element = EVideo::create(ele.toObject(), this);
|
||||
else if(type=="Audio") element = EAudio::create(ele.toObject(), this);
|
||||
else if(type=="DClock") element = new EDClock(ele.toObject());
|
||||
else if(type=="AClock") element = new EAClock(ele.toObject());
|
||||
else if(type=="Temp") element = new EEnviron(ele.toObject());
|
||||
|
@ -89,10 +87,10 @@ bool PageListItem::saveFiles() {
|
|||
auto items = mScene->items();
|
||||
foreach(auto item, items) {
|
||||
auto element = static_cast<EBase*>(item);
|
||||
if(element->mMultiWin == nullptr && element->save(mPageDir)) elements.append(element->attrJson());
|
||||
if(element->mMultiWin == 0 && element->save(mPageDir)) elements.append(element->attrJson());
|
||||
}
|
||||
mAttr.insert("elements", elements);
|
||||
if(mAttrWgt!=0) {
|
||||
if(mAttrWgt) {
|
||||
QJsonArray audios;
|
||||
auto cnt = mAudiosList->count();
|
||||
for(int i=0; i<cnt; i++) {
|
||||
|
@ -115,7 +113,7 @@ bool PageListItem::saveFiles() {
|
|||
|
||||
QFile file(mPageDir + "/page.json");
|
||||
if(! file.open(QIODevice::WriteOnly)) {
|
||||
QMessageBox::critical(gMainWin, "Write Error", mPageDir + "/page.json "+file.errorString());
|
||||
QMessageBox::critical(listWidget(), "Write Error", mPageDir + "/page.json "+file.errorString());
|
||||
return false;
|
||||
}
|
||||
file.write(QJsonDocument(mAttr).toJson());
|
||||
|
@ -147,7 +145,7 @@ QWidget *PageListItem::itemWgt() {
|
|||
}
|
||||
|
||||
QWidget *PageListItem::attrWgt() {
|
||||
if(mAttrWgt!=0) return mAttrWgt;
|
||||
if(mAttrWgt) return mAttrWgt;
|
||||
mAttrWgt = new QWidget();
|
||||
mAttrWgt->setStyleSheet(R"rrr(
|
||||
QPushButton {
|
||||
|
@ -276,14 +274,14 @@ QPushButton[ssName="weeklySelector"]:checked {
|
|||
btnAdd->setProperty("style","multiTool");
|
||||
|
||||
mAudiosList = new QListWidget();
|
||||
connect(btnAdd, &QPushButton::clicked, this, [this, fdTtlDur] {
|
||||
auto files = QFileDialog::getOpenFileNames(gMainWin, tr("Select File"), gFileHome, EAudio::filters());
|
||||
connect(btnAdd, &QPushButton::clicked, mAttrWgt, [this, fdTtlDur] {
|
||||
auto files = QFileDialog::getOpenFileNames(mAttrWgt, tr("Select File"), gFileHome);
|
||||
int durs = fdTtlDur->text().toInt();
|
||||
for(int i=0; i<files.count(); i++) {
|
||||
int64_t dur;
|
||||
QString err = audioInfo(files[i].toUtf8(), &dur);
|
||||
if(! err.isEmpty()) {
|
||||
QMessageBox::critical(gMainWin, "Audio Error", err+"\n"+files[i]);
|
||||
QMessageBox::critical(mAttrWgt, "Audio Error", err+"\n"+files[i]);
|
||||
continue;
|
||||
}
|
||||
QFileInfo fInfo(files[i]);
|
||||
|
@ -439,7 +437,7 @@ QPushButton[ssName="weeklySelector"]:checked {
|
|||
connect(fdStart, &QDateEdit::dateChanged, this, [this, wValidDate, fdStart, fdEnd](const QDate &date) {
|
||||
auto end = fdEnd->date();
|
||||
if(! date.isValid() || date > end) {
|
||||
QMessageBox::warning(gMainWin, tr("Warning"), tr("Start Time can't be later than End Time"));
|
||||
QMessageBox::warning(mAttrWgt, tr("Warning"), tr("Start Time can't be later than End Time"));
|
||||
fdStart->setDate(end);
|
||||
}
|
||||
mAttr["validDate"] = QJsonObject{
|
||||
|
@ -448,10 +446,10 @@ QPushButton[ssName="weeklySelector"]:checked {
|
|||
{"end", end.toString("yyyy-MM-dd")}
|
||||
};
|
||||
});
|
||||
connect(fdEnd, &QDateEdit::dateChanged, this, [this, wValidDate, fdStart, fdEnd](const QDate &date) {
|
||||
connect(fdEnd, &QDateEdit::dateChanged, mAttrWgt, [this, wValidDate, fdStart, fdEnd](const QDate &date) {
|
||||
QDate start = fdStart->date();
|
||||
if(! date.isValid() || start > date) {
|
||||
QMessageBox::warning(gMainWin, tr("Warning"), tr("End Time can't be earlier than Start Time"));
|
||||
QMessageBox::warning(mAttrWgt, tr("Warning"), tr("End Time can't be earlier than Start Time"));
|
||||
fdEnd->setDate(start);
|
||||
}
|
||||
mAttr["validDate"] = QJsonObject{
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#include "progeditorwin.h"
|
||||
#include "progpanel.h"
|
||||
#include "base/customprogressindicator.h"
|
||||
#include "base/loemptydialog.h"
|
||||
#include "cfg.h"
|
||||
#include "ebase.h"
|
||||
#include "pagelistitem.h"
|
||||
|
@ -13,7 +11,6 @@
|
|||
#include "program/etext.h"
|
||||
#include "program/ephoto.h"
|
||||
#include "program/evideo.h"
|
||||
#include "program/eaudio.h"
|
||||
#include "program/egif.h"
|
||||
#include "program/edclock.h"
|
||||
#include "program/eaclock.h"
|
||||
|
@ -36,22 +33,21 @@
|
|||
#include <QMovie>
|
||||
|
||||
ProgItem *gProgItem{0};
|
||||
QWidget *gProgEditorWin;
|
||||
|
||||
ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QWidget(parent), mProgItem(progItem) {
|
||||
gProgEditorWin = this;
|
||||
gProgItem = progItem;
|
||||
setWindowFlag(Qt::Window);
|
||||
setWindowTitle(progItem->mName);
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
if(! parent->isMaximized()) resize(parent->size());
|
||||
setAttribute(Qt::WA_AlwaysShowToolTips);
|
||||
auto parentWin = parentWidget()->window();
|
||||
if(! parentWin->isMaximized()) resize(parentWin->size());
|
||||
else resize(1280, 720);
|
||||
#ifdef Q_OS_WIN
|
||||
setWindowModality(Qt::WindowModal);
|
||||
#else
|
||||
parentWidget()->hide();
|
||||
parentWin->hide();
|
||||
#endif
|
||||
setAttribute(Qt::WA_AlwaysShowToolTips);
|
||||
setWindowTitle(progItem->mName);
|
||||
|
||||
auto vBox = new QVBoxLayout(this);
|
||||
vBox->setContentsMargins(0, 0, 0, 0);
|
||||
|
@ -65,41 +61,41 @@ ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QWidget(pare
|
|||
auto action = new QAction(QIcon(":/res/program/Save.png"), tr("Save"));
|
||||
connect(action, &QAction::triggered, this, &ProgEditorWin::onSave);
|
||||
toolBar->addAction(action);
|
||||
action = new QAction(QIcon(":/res/program/SaveAs.png"), tr("Save as"));
|
||||
connect(action, &QAction::triggered, this, [this] {
|
||||
auto saveThread = QThread::create([this](){
|
||||
save();
|
||||
});
|
||||
connect(saveThread, SIGNAL(finished()), saveThread, SLOT(deleteLater()));
|
||||
connect(saveThread, &QThread::finished, this, [this] {
|
||||
mProgItem->m_last = QDateTime::currentDateTime();
|
||||
mProgItem->m_fsize = dirFileSize(mProgItem->mProgDir);
|
||||
mProgItem->onSetProgram();
|
||||
});
|
||||
saveThread->start();
|
||||
bool isOK;
|
||||
QString progName = QInputDialog::getText(this, tr("Save as"), tr("Save as"), QLineEdit::Normal, QString(), &isOK, Qt::Dialog | Qt::WindowCloseButtonHint);
|
||||
if(! isOK || progName.isEmpty()) return;
|
||||
mProgItem->mProgDir = mProgItem->mProgsDir + "/" + progName;
|
||||
LoEmptyDialog *dlgTip = new LoEmptyDialog(this);
|
||||
saveThread = QThread::create([this](){
|
||||
save();
|
||||
});
|
||||
dlgTip->lock(tr("Saving..."),tr("Success"),tr("Save failed"));
|
||||
connect(saveThread, SIGNAL(finished()), dlgTip, SLOT(unlock()));//显示正在保存提示对话框
|
||||
connect(saveThread, SIGNAL(finished()), saveThread, SLOT(deleteLater()));
|
||||
connect(saveThread, &QThread::finished, this, [this] {
|
||||
mProgItem->m_last = QDateTime::currentDateTime();
|
||||
mProgItem->m_fsize = dirFileSize(mProgItem->mProgDir);
|
||||
mProgItem->onSetProgram();
|
||||
});
|
||||
saveThread->start();
|
||||
dlgTip->exec();
|
||||
close();
|
||||
setWindowTitle(progName);
|
||||
mProgItem->mProgPanel->onCreateNewProgramOnOpenEditProgramWidget(progName, QSize(mProgItem->mWidth, mProgItem->mHeight), mProgItem->mRemark, mProgItem->mSplitWidths, mProgItem->mMaxWidth);
|
||||
});
|
||||
toolBar->addAction(action);
|
||||
// action = new QAction(QIcon(":/res/program/SaveAs.png"), tr("Save as"));
|
||||
// connect(action, &QAction::triggered, this, [this] {
|
||||
// auto saveThread = QThread::create([this](){
|
||||
// save();
|
||||
// });
|
||||
// connect(saveThread, SIGNAL(finished()), saveThread, SLOT(deleteLater()));
|
||||
// connect(saveThread, &QThread::finished, this, [this] {
|
||||
// mProgItem->m_last = QDateTime::currentDateTime();
|
||||
// mProgItem->m_fsize = dirFileSize(mProgItem->mProgDir);
|
||||
// mProgItem->onSetProgram();
|
||||
// });
|
||||
// saveThread->start();
|
||||
// bool isOK;
|
||||
// QString progName = QInputDialog::getText(this, tr("Save as"), tr("Save as"), QLineEdit::Normal, QString(), &isOK, Qt::Dialog | Qt::WindowCloseButtonHint);
|
||||
// if(! isOK || progName.isEmpty()) return;
|
||||
// mProgItem->mProgDir = mProgItem->mProgsDir + "/" + progName;
|
||||
// LoEmptyDialog *dlgTip = new LoEmptyDialog(this);
|
||||
// saveThread = QThread::create([this](){
|
||||
// save();
|
||||
// });
|
||||
// dlgTip->lock(tr("Saving..."),tr("Success"),tr("Save failed"));
|
||||
// connect(saveThread, SIGNAL(finished()), dlgTip, SLOT(unlock()));//显示正在保存提示对话框
|
||||
// connect(saveThread, SIGNAL(finished()), saveThread, SLOT(deleteLater()));
|
||||
// connect(saveThread, &QThread::finished, this, [this] {
|
||||
// mProgItem->m_last = QDateTime::currentDateTime();
|
||||
// mProgItem->m_fsize = dirFileSize(mProgItem->mProgDir);
|
||||
// mProgItem->onSetProgram();
|
||||
// });
|
||||
// saveThread->start();
|
||||
// dlgTip->exec();
|
||||
// close();
|
||||
// setWindowTitle(progName);
|
||||
// mProgItem->mProgPanel->onCreateNewProgramOnOpenEditProgramWidget(progName, QSize(mProgItem->mWidth, mProgItem->mHeight), mProgItem->mRemark, mProgItem->mSplitWidths, mProgItem->mMaxWidth);
|
||||
// });
|
||||
// toolBar->addAction(action);
|
||||
action = new QAction(QIcon(":/res/program/Setting.png"), tr("Setting"));
|
||||
connect(action, &QAction::triggered, this, [this]() {
|
||||
QString widthsStr;
|
||||
|
@ -199,10 +195,13 @@ ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QWidget(pare
|
|||
else {
|
||||
if(isProgChanged()) onSave();
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Generate preview data")+" ...");
|
||||
auto converter = new GenTmpThread(mProgItem, mProgItem->mName, "", "" ,this);
|
||||
connect(converter, &QThread::finished, waitingDlg, &WaitingDlg::close);
|
||||
connect(converter, &GenTmpThread::sProgress, waitingDlg->mIndicator, &CustomProgressIndicator::onProgress);
|
||||
converter->start();
|
||||
auto gen = new GenTmpThread(mProgItem, mProgItem->mName, "", "");
|
||||
connect(gen, &GenTmpThread::onErr, this, [=](QString err) {
|
||||
QMessageBox::warning(this, "GenTmpThread Error", err);
|
||||
});
|
||||
connect(gen, &QThread::finished, waitingDlg, &WaitingDlg::close);
|
||||
connect(gen, &GenTmpThread::sProgress, waitingDlg->mIndicator, &CustomProgressIndicator::onProgress);
|
||||
gen->start();
|
||||
waitingDlg->exec();
|
||||
QFile file(mProgItem->mProgDir+"_tmp/program");
|
||||
if(! file.open(QIODevice::ReadOnly | QIODevice::Text)) return;
|
||||
|
@ -224,10 +223,13 @@ ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QWidget(pare
|
|||
connect(action, &QAction::triggered, this, [this]{
|
||||
onSave();
|
||||
auto waitingDlg = new WaitingDlg(this, tr("Convertering")+" ...");
|
||||
auto converter = new GenTmpThread(mProgItem, mProgItem->mName, "", "", this);
|
||||
connect(converter, &QThread::finished, waitingDlg, &WaitingDlg::close);
|
||||
connect(converter, &GenTmpThread::sProgress, waitingDlg->mIndicator, &CustomProgressIndicator::onProgress);
|
||||
converter->start();
|
||||
auto gen = new GenTmpThread(mProgItem, mProgItem->mName, "", "");
|
||||
connect(gen, &GenTmpThread::onErr, this, [=](QString err) {
|
||||
QMessageBox::warning(this, "GenTmpThread Error", err);
|
||||
});
|
||||
connect(gen, &QThread::finished, waitingDlg, &WaitingDlg::close);
|
||||
connect(gen, &GenTmpThread::sProgress, waitingDlg->mIndicator, &CustomProgressIndicator::onProgress);
|
||||
gen->start();
|
||||
waitingDlg->exec();
|
||||
SendProgramDialog dlg(mProgItem->mName, this);
|
||||
dlg.exec();
|
||||
|
@ -293,37 +295,21 @@ ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QWidget(pare
|
|||
eVideo->setSize(rect.width(), rect.height());
|
||||
gFileHome = eVideo->mRawDir;
|
||||
element = eVideo;
|
||||
} else if(type== EBase::Audio) {
|
||||
auto file = QFileDialog::getOpenFileName(this, tr("Select File"), gFileHome, EAudio::filters());
|
||||
if(file.isEmpty()) return;
|
||||
auto eAudio = EAudio::create(file, mPageItem);
|
||||
if(eAudio==nullptr) return;
|
||||
int i=0;
|
||||
for(; i<mProgItem->mWidth; i+=50) if(nullptr==scene->itemAt(i+20, mProgItem->mHeight+20, QTransform())) break;
|
||||
eAudio->setPos(i, mProgItem->mHeight);
|
||||
eAudio->setSize(50, 50);
|
||||
gFileHome = eAudio->mDir;
|
||||
element = eAudio;
|
||||
}
|
||||
else if(type==EBase::Text) {
|
||||
} else if(type==EBase::Text) {
|
||||
if(iNewHeight > 80 && (mProgItem->mWidth >= mProgItem->mHeight)) iNewHeight = 80;
|
||||
element = new EText();
|
||||
}
|
||||
else if(type==EBase::DClock) {
|
||||
} else if(type==EBase::DClock) {
|
||||
if(iNewHeight>80 && (mProgItem->mWidth>=mProgItem->mHeight)) iNewHeight=80;
|
||||
element = new EDClock();
|
||||
}
|
||||
else if(type==EBase::AClock) {
|
||||
} else if(type==EBase::AClock) {
|
||||
if(iNewWidth > 120) iNewWidth = 120;
|
||||
if(iNewHeight > 120) iNewHeight = 120;
|
||||
element = new EAClock();
|
||||
}
|
||||
else if(type==EBase::Environ) element = new EEnviron();
|
||||
} else if(type==EBase::Environ) element = new EEnviron();
|
||||
else if(type==EBase::Web) {
|
||||
element = new EWeb();
|
||||
element->setSize(mProgItem->mWidth, mProgItem->mHeight);
|
||||
}
|
||||
else if(type==EBase::Timer) element = new ETimer();
|
||||
} else if(type==EBase::Timer) element = new ETimer();
|
||||
else if(type==EBase::Window) element = new EMultiWin(mPageItem);
|
||||
if(element) {
|
||||
if(element->mWidth==0) {
|
||||
|
@ -554,7 +540,7 @@ void ProgEditorWin::closeEvent(QCloseEvent *event) {
|
|||
else if(res == QMessageBox::Cancel) event->ignore();
|
||||
}
|
||||
#ifdef Q_OS_MAC
|
||||
if(event->isAccepted()) parentWidget()->show();
|
||||
if(event->isAccepted()) parentWidget()->window()->show();
|
||||
#endif
|
||||
}
|
||||
//停止每个页面元素的播放,将节目目录下的每个页面的文件夹另命名
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
#include "progitem.h"
|
||||
#include "progpanel.h"
|
||||
#include "QtWidgets/qdialogbuttonbox.h"
|
||||
#include "QtWidgets/qlineedit.h"
|
||||
#include "gutil/qcore.h"
|
||||
#include "gutil/qgui.h"
|
||||
#include "base/waitingdlg.h"
|
||||
#include "tools.h"
|
||||
#include "progeditorwin.h"
|
||||
#include "base/waitingdlg.h"
|
||||
#include "gentmpthread.h"
|
||||
|
@ -15,15 +13,15 @@
|
|||
#include <QMessageBox>
|
||||
#include <QStorageInfo>
|
||||
|
||||
ProgItem::ProgItem(const QString &progsDir, const QString &name, int w, int h, const QString &remarks, QList<int> &splitWidths, int maxWidth, LoQTreeWidget *tree, ProgPanel *progPanel) : QTreeWidgetItem(UserType),
|
||||
mName(name), mWidth(w), mHeight(h), mRemark(remarks), mSplitWidths(splitWidths), mMaxWidth(maxWidth), mProgsDir(progsDir), mProgPanel(progPanel), mTree(tree) {
|
||||
ProgItem::ProgItem(const QString &progsDir, const QString &name, int w, int h, const QString &remarks, QList<int> &splitWidths, int maxWidth, LoQTreeWidget *tree) : QTreeWidgetItem(UserType),
|
||||
mName(name), mWidth(w), mHeight(h), mRemark(remarks), mSplitWidths(splitWidths), mMaxWidth(maxWidth), mProgsDir(progsDir), mTree(tree) {
|
||||
m_last = QDateTime::currentDateTime();
|
||||
mProgDir = progsDir + "/" + mName;
|
||||
m_orgName = mName;
|
||||
init();
|
||||
}
|
||||
|
||||
ProgItem::ProgItem(const QString &progsDir, const QJsonObject &json, LoQTreeWidget *tree, ProgPanel *progPanel) : QTreeWidgetItem(UserType), mProgsDir(progsDir), mProgPanel(progPanel), mTree(tree) {
|
||||
ProgItem::ProgItem(const QString &progsDir, const QJsonObject &json, LoQTreeWidget *tree) : QTreeWidgetItem(UserType), mProgsDir(progsDir), mTree(tree) {
|
||||
mName = json["name"].toString();
|
||||
mWidth = json["resolution"]["w"].toInt();
|
||||
mHeight = json["resolution"]["h"].toInt();
|
||||
|
@ -38,7 +36,6 @@ ProgItem::ProgItem(const QString &progsDir, const QJsonObject &json, LoQTreeWidg
|
|||
m_last = QDateTime::fromString(json["last_edit"].toString(), "yyyy-MM-dd hh:mm:ss");
|
||||
mProgDir = progsDir + "/" + mName;
|
||||
m_orgName = mName;
|
||||
mProgPanel = progPanel;
|
||||
init();
|
||||
}
|
||||
|
||||
|
@ -66,13 +63,13 @@ QPushButton:hover {
|
|||
|
||||
m_bnName->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
mTree->setItemWidget(this, ENUM_PROGRAMLISTHEADERITEM_NAME, m_bnName);
|
||||
connect(m_bnName, &QPushButton::clicked, this, [this] {
|
||||
auto editor = new ProgEditorWin(this, gMainWin);
|
||||
QObject::connect(m_bnName, &QPushButton::clicked, mTree, [this] {
|
||||
auto editor = new ProgEditorWin(this, mTree->parentWidget());
|
||||
editor->show();
|
||||
});
|
||||
m_bnExport = new QPushButton();
|
||||
m_bnExport->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
m_bnExport->setToolTip(tr("ExportButtonTip"));
|
||||
m_bnExport->setToolTip(QObject::tr("ExportButtonTip"));
|
||||
m_bnExport->setStyleSheet(R"rrr(
|
||||
QPushButton {
|
||||
border-radius: 4px;
|
||||
|
@ -83,11 +80,63 @@ QPushButton:hover{background-color: #cccccc;}
|
|||
)rrr");
|
||||
|
||||
mTree->setItemWidget(this, ENUM_PROGRAMLISTHEADERITEM_USB_EXPORT, m_bnExport);
|
||||
connect(m_bnExport, SIGNAL(clicked()), this, SLOT(onUsbExportProgram()));
|
||||
QObject::connect(m_bnExport, &QPushButton::clicked, mTree, [this] {
|
||||
QDialog dlg(mTree);
|
||||
dlg.setWindowTitle(QObject::tr("Usb upgrade program"));
|
||||
#ifdef Q_OS_WIN
|
||||
dlg.setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
|
||||
#endif
|
||||
dlg.resize(300, 260);
|
||||
|
||||
auto vBox = new VBox(&dlg);
|
||||
auto hBox = new HBox(vBox);
|
||||
|
||||
hBox->addWidget(new QLabel(QObject::tr("Password")));
|
||||
|
||||
auto fdPassword = new QLineEdit;
|
||||
fdPassword->setEchoMode(QLineEdit::Password);
|
||||
fdPassword->setPlaceholderText(QObject::tr("Input password"));
|
||||
hBox->addWidget(fdPassword);
|
||||
|
||||
auto fdDrives = new ListWgt;
|
||||
fdDrives->setSelectionRectVisible(true);
|
||||
vBox->addWidget(fdDrives);
|
||||
|
||||
auto btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
QObject::connect(btnBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject);
|
||||
QObject::connect(btnBox, &QDialogButtonBox::accepted, &dlg, [=, &dlg] {
|
||||
auto selects = fdDrives->selectedItems();
|
||||
if(selects.count() > 0) {
|
||||
foreach(auto select, selects) {
|
||||
auto strPath = select->data(Qt::UserRole).toString();
|
||||
auto waitingDlg = new WaitingDlg(&dlg, QObject::tr("Convertering")+" ...");
|
||||
auto gen = new GenTmpThread(this, mName, strPath + (strPath.endsWith('/') ? "program.zip" : "/program.zip"), fdPassword->text());
|
||||
QObject::connect(gen, &GenTmpThread::onErr, &dlg, [=, &dlg](QString err) {
|
||||
QMessageBox::warning(&dlg, "GenTmpThread Error", err);
|
||||
});
|
||||
QObject::connect(gen, &QThread::finished, waitingDlg, &WaitingDlg::success);
|
||||
QObject::connect(gen, &GenTmpThread::sProgress, waitingDlg->mIndicator, &CustomProgressIndicator::onProgress);
|
||||
gen->start();
|
||||
waitingDlg->exec();
|
||||
}
|
||||
dlg.accept();
|
||||
return;
|
||||
}
|
||||
if(fdDrives->count() <= 0) QMessageBox::warning(&dlg, QObject::tr("Tip"), QObject::tr("No checked USB device"));
|
||||
else QMessageBox::warning(&dlg, QObject::tr("Tip"), QObject::tr("please select usb device in list"));
|
||||
});
|
||||
vBox->addWidget(btnBox);
|
||||
|
||||
fdDrives->clear();
|
||||
auto volumes = QStorageInfo::mountedVolumes();
|
||||
foreach(auto volume, volumes) fdDrives->addItem(volume.displayName(), volume.rootPath());
|
||||
|
||||
dlg.exec();
|
||||
});
|
||||
|
||||
m_bnSend = new QPushButton();
|
||||
m_bnSend->setCursor(QCursor(Qt::PointingHandCursor));
|
||||
m_bnSend->setToolTip(tr("SendButtonTip"));
|
||||
m_bnSend->setToolTip(QObject::tr("SendButtonTip"));
|
||||
m_bnSend->setStyleSheet(R"rrr(
|
||||
QPushButton{
|
||||
border-radius: 4px;
|
||||
|
@ -98,11 +147,23 @@ QPushButton:hover{background-color: #cccccc;}
|
|||
)rrr");
|
||||
|
||||
mTree->setItemWidget(this, ENUM_PROGRAMLISTHEADERITEM_SEND, m_bnSend);
|
||||
connect(m_bnSend, SIGNAL(clicked()), this, SLOT(onSendProgram()));
|
||||
QObject::connect(m_bnSend, &QPushButton::clicked, mTree, [this] {
|
||||
auto waitingDlg = new WaitingDlg(mTree, QObject::tr("Convertering")+" ...");
|
||||
auto gen = new GenTmpThread(this, mName, "", "");
|
||||
QObject::connect(gen, &GenTmpThread::onErr, mTree, [=](QString err) {
|
||||
QMessageBox::warning(mTree, "GenTmpThread Error", err);
|
||||
});
|
||||
QObject::connect(gen, &QThread::finished, waitingDlg, &WaitingDlg::close);
|
||||
QObject::connect(gen, &GenTmpThread::sProgress, waitingDlg->mIndicator, &CustomProgressIndicator::onProgress);
|
||||
gen->start();
|
||||
waitingDlg->exec();
|
||||
SendProgramDialog dlg(mName, mTree);
|
||||
dlg.exec();
|
||||
});
|
||||
}
|
||||
void ProgItem::refreshLable() {
|
||||
m_bnExport->setToolTip(tr("ExportButtonTip"));
|
||||
m_bnSend->setToolTip(tr("SendButtonTip"));
|
||||
m_bnExport->setToolTip(QObject::tr("ExportButtonTip"));
|
||||
m_bnSend->setToolTip(QObject::tr("SendButtonTip"));
|
||||
}
|
||||
|
||||
void ProgItem::save() {
|
||||
|
@ -148,63 +209,3 @@ void ProgItem::onSetProgram() {
|
|||
setData(ENUM_PROGRAMLISTHEADERITEM_LASTTIME, 0, m_last.toString("yyyy-MM-dd hh:mm:ss"));
|
||||
save();
|
||||
}
|
||||
|
||||
void ProgItem::onUsbExportProgram() {
|
||||
QDialog dlg(gMainWin);
|
||||
dlg.setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
|
||||
dlg.setWindowTitle(tr("Usb upgrade program"));
|
||||
dlg.resize(300, 260);
|
||||
|
||||
auto vBox = new VBox(&dlg);
|
||||
auto hBox = new HBox(vBox);
|
||||
|
||||
hBox->addWidget(new QLabel(tr("Password")));
|
||||
|
||||
auto fdPassword = new QLineEdit;
|
||||
fdPassword->setEchoMode(QLineEdit::Password);
|
||||
fdPassword->setPlaceholderText(tr("Input password"));
|
||||
hBox->addWidget(fdPassword);
|
||||
|
||||
auto fdDrives = new ListWgt;
|
||||
fdDrives->setSelectionRectVisible(true);
|
||||
vBox->addWidget(fdDrives);
|
||||
|
||||
auto btnBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(btnBox, &QDialogButtonBox::rejected, &dlg, &QDialog::reject);
|
||||
connect(btnBox, &QDialogButtonBox::accepted, &dlg, [=, &dlg] {
|
||||
auto selects = fdDrives->selectedItems();
|
||||
if(selects.count() > 0) {
|
||||
foreach(auto select, selects) {
|
||||
auto strPath = select->data(Qt::UserRole).toString();
|
||||
auto waitingDlg = new WaitingDlg(mProgPanel, tr("Convertering")+" ...");
|
||||
auto converter = new GenTmpThread(this, mName, strPath + (strPath.endsWith('/') ? "program.zip" : "/program.zip"), fdPassword->text(), this);
|
||||
connect(converter, &QThread::finished, waitingDlg, &WaitingDlg::success);
|
||||
connect(converter, &GenTmpThread::sProgress, waitingDlg->mIndicator, &CustomProgressIndicator::onProgress);
|
||||
converter->start();
|
||||
waitingDlg->exec();
|
||||
}
|
||||
dlg.accept();
|
||||
return;
|
||||
}
|
||||
if(fdDrives->count() <= 0) QMessageBox::warning(&dlg, tr("Tip"),tr("No checked USB device"));
|
||||
else QMessageBox::warning(&dlg, tr("Tip"),tr("please select usb device in list"));
|
||||
});
|
||||
vBox->addWidget(btnBox);
|
||||
|
||||
fdDrives->clear();
|
||||
auto volumes = QStorageInfo::mountedVolumes();
|
||||
foreach(auto volume, volumes) fdDrives->addItem(volume.displayName(), volume.rootPath());
|
||||
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void ProgItem::onSendProgram() {
|
||||
auto waitingDlg = new WaitingDlg(mProgPanel, tr("Convertering")+" ...");
|
||||
auto converter = new GenTmpThread(this, mName, "", "", this);
|
||||
connect(converter, &QThread::finished, waitingDlg, &WaitingDlg::close);
|
||||
connect(converter, &GenTmpThread::sProgress, waitingDlg->mIndicator, &CustomProgressIndicator::onProgress);
|
||||
converter->start();
|
||||
waitingDlg->exec();
|
||||
SendProgramDialog dlg(mName, mProgPanel);
|
||||
dlg.exec();
|
||||
}
|
||||
|
|
|
@ -9,12 +9,12 @@
|
|||
#include <QJsonDocument>
|
||||
#include <QPushButton>
|
||||
#include <base/loqtreewidget.h>
|
||||
|
||||
class ProgPanel;
|
||||
class ProgItem : public QObject, public QTreeWidgetItem {
|
||||
Q_OBJECT
|
||||
class ProgItem : public QTreeWidgetItem {
|
||||
public:
|
||||
explicit ProgItem(const QString &progsDir, const QString &name, int w, int h, const QString & remarks, QList<int> &splitWidths, int, LoQTreeWidget *parent = nullptr, ProgPanel *pWnd=nullptr);
|
||||
explicit ProgItem(const QString &progsDir, const QJsonObject &json, LoQTreeWidget *parent = nullptr, ProgPanel *pWnd=nullptr);
|
||||
explicit ProgItem(const QString &progsDir, const QString &name, int w, int h, const QString & remarks, QList<int> &splitWidths, int, LoQTreeWidget *parent);
|
||||
explicit ProgItem(const QString &progsDir, const QJsonObject &json, LoQTreeWidget *parent);
|
||||
|
||||
void save();
|
||||
void del();
|
||||
|
@ -31,22 +31,17 @@ public:
|
|||
qint64 m_fsize{0};
|
||||
QDateTime m_last;
|
||||
QPushButton *m_bnName;
|
||||
ProgPanel *mProgPanel{0};
|
||||
LoQTreeWidget *mTree;
|
||||
|
||||
public slots:
|
||||
void onSetProgram();
|
||||
void onSendProgram();
|
||||
void onUsbExportProgram();
|
||||
|
||||
private:
|
||||
void init();
|
||||
QPushButton *m_bnExport;
|
||||
QPushButton *m_bnSend;
|
||||
QString m_orgName;
|
||||
LoQTreeWidget *mTree;
|
||||
};
|
||||
enum ENUM_PROGRAMLISTHEADERITEM
|
||||
{
|
||||
enum ENUM_PROGRAMLISTHEADERITEM {
|
||||
ENUM_PROGRAMLISTHEADERITEM_CHECK=0,
|
||||
ENUM_PROGRAMLISTHEADERITEM_NAME,
|
||||
ENUM_PROGRAMLISTHEADERITEM_RESOLUTION,
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
#include "sendprogramdialog.h"
|
||||
#include "tools.h"
|
||||
#include "cfg.h"
|
||||
#include "wProgramPublishItem.h"
|
||||
#include "sendprogthread.h"
|
||||
#include "gutil/qgui.h"
|
||||
#include <QAction>
|
||||
#include <QLineEdit>
|
||||
|
@ -178,7 +180,7 @@ void SendProgramDialog::onAddLedCard(LedCard *p) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if(iExistFlg==0) new wProgramPublishItem(p, wDevicePublishList, this, mProgName, programsDir());
|
||||
if(iExistFlg==0) new wProgramPublishItem(p, wDevicePublishList, mProgName, programsDir());
|
||||
}
|
||||
void SendProgramDialog::FilterProgram(const QString &strtemp)
|
||||
{
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
#ifndef SENDPROGRAMDIALOG_H
|
||||
#define SENDPROGRAMDIALOG_H
|
||||
|
||||
#include "wprogrampublishitem.h"
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
#include "device/ledcard.h"
|
||||
#include "base/loqtreewidget.h"
|
||||
|
||||
class SendProgramDialog : public QDialog {
|
||||
Q_OBJECT
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
#include "wprogrampublishitem.h"
|
||||
#include "tools.h"
|
||||
#include "base/x_uimsgboxok.h"
|
||||
#include "passwordindlg.h"
|
||||
#include "gutil/qgui.h"
|
||||
#include "base/waitingdlg.h"
|
||||
#include <QMessageBox>
|
||||
#include <QJsonValue>
|
||||
#include <QJsonObject>
|
||||
#include <QJsonDocument>
|
||||
#include <QProgressBar>
|
||||
#include <globaldefine.h>
|
||||
#include <QSizePolicy>
|
||||
#include "globaldefine.h"
|
||||
#include <QInputDialog>
|
||||
#include <QMetaEnum>
|
||||
wProgramPublishItem::wProgramPublishItem(LedCard *pLedCard, LoQTreeWidget *parent, QWidget *pWnd, QString strProgramName, QString strProgramPath) : QObject(parent), QTreeWidgetItem(UserType), m_parent(parent) {
|
||||
|
||||
wProgramPublishItem::wProgramPublishItem(LedCard *pLedCard, LoQTreeWidget *parent, QString strProgramName, QString strProgramPath) : QObject(parent), QTreeWidgetItem(UserType), m_parent(parent) {
|
||||
m_strProgramName = strProgramName;
|
||||
m_strProgramPath = strProgramPath;
|
||||
m_pWnd = pWnd;
|
||||
mLedCard = pLedCard;
|
||||
|
||||
setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
|
||||
|
@ -24,83 +21,62 @@ wProgramPublishItem::wProgramPublishItem(LedCard *pLedCard, LoQTreeWidget *paren
|
|||
m_ImageOnline->setAlignment(Qt::AlignCenter);
|
||||
m_parent->setItemWidget(this, ENUM_DEVICE_PUBLISH_HEADE_ONLINE, m_ImageOnline);
|
||||
for(int i=1; i<ENUM_DEVICE_PUBLISH_HEADE_REMARKS; i++) setTextAlignment(i, Qt::AlignCenter);
|
||||
SetItemParam(mLedCard);
|
||||
fdProgress = new QProgressBar();
|
||||
fdProgress->setStyleSheet("margin-top: 8px; margin-bottom: 8px;");
|
||||
m_parent->setItemWidget(this, ENUM_DEVICE_PUBLISH_HEADE_PROGRESS, fdProgress);
|
||||
fdProgress->setAlignment(Qt::AlignCenter);
|
||||
}
|
||||
|
||||
void wProgramPublishItem::onVerifyLockPassword() {
|
||||
btnUnlock = new QPushButton;
|
||||
btnUnlock->setMaximumHeight(40);
|
||||
auto wgt = new QWidget;
|
||||
auto vBox = new VBox(wgt);
|
||||
vBox->setContentsMargins(0,0,0,0);
|
||||
vBox->addWidget(btnUnlock);
|
||||
m_parent->setItemWidget(this, ENUM_DEVICE_PUBLISH_HEADE_ENCRYPT, wgt);
|
||||
connect(btnUnlock, &QPushButton::clicked, this, [this] {
|
||||
if(! mLedCard->m_bLockStatus) return;
|
||||
bool ok;
|
||||
auto pwd = QInputDialog::getText(gMainWin, tr("Input password"), tr("Input password"), QLineEdit::Password, QString(), &ok);
|
||||
auto pwd = QInputDialog::getText(treeWidget(), tr("Input password"), tr("Input password"), QLineEdit::Password, QString(), &ok);
|
||||
if(! ok) return;
|
||||
QJsonObject json;
|
||||
json.insert("_type", "VerifyPassword");
|
||||
json.insert("_id", QString::number(QDateTime::currentMSecsSinceEpoch()));
|
||||
json.insert("_type", "VerifyPassword");
|
||||
json.insert("pwd", pwd);
|
||||
|
||||
QNetworkRequest request{"http://"+mLedCard->m_strCardIp+":2016/settings"};
|
||||
request.setAttribute(QNetworkRequest::RedirectPolicyAttribute, QNetworkRequest::NoLessSafeRedirectPolicy);
|
||||
request.setHeader(QNetworkRequest::ContentTypeHeader, "application/json");
|
||||
auto reply = Tools::netManager().post(request, QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||
reply->deleteLater();
|
||||
if(reply->error() != QNetworkReply::NoError) {
|
||||
QMessageBox::critical(gMainWin, tr("Error"), QString::number(reply->error())+" "+QMetaEnum::fromType<QNetworkReply::NetworkError>().valueToKey(reply->error())+" "+reply->errorString());
|
||||
auto waitingDlg = new WaitingDlg(treeWidget(), tr("VerifyPassword")+" ...");
|
||||
waitingDlg->show();
|
||||
auto reply = NetReq("http://"+mLedCard->m_strCardIp+":2016/settings").timeout(60000).post(json);
|
||||
waitingDlg->connAbort(reply);
|
||||
connect(reply, &QNetworkReply::finished, this, [=] {
|
||||
QJsonDocument json;
|
||||
QString err = checkReplyForJson(reply, &json);
|
||||
if(! err.isEmpty()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::critical(m_parent, QObject::tr("Error"), err);
|
||||
return;
|
||||
}
|
||||
auto status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
|
||||
if(status != 200) {
|
||||
QMessageBox::critical(gMainWin, tr("Error"), QString::number(status)+" "+reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString());
|
||||
if(! json["result"].toBool()) {
|
||||
waitingDlg->close();
|
||||
QMessageBox::warning(treeWidget(), tr("Tip Info"), tr("password is wrong"));
|
||||
return;
|
||||
}
|
||||
auto resp = reply->readAll();
|
||||
QJsonParseError jsonErr;
|
||||
QJsonDocument json = QJsonDocument::fromJson(resp, &jsonErr);
|
||||
if(jsonErr.error != QJsonParseError::NoError) {
|
||||
QMessageBox::critical(gMainWin, tr("Error"), "JsonParseError "+jsonErr.errorString());
|
||||
return;
|
||||
}
|
||||
if(! json["success"].toBool()) {
|
||||
QMessageBox::warning(gMainWin, tr("Tip Info"), tr("Fail"));
|
||||
return;
|
||||
}
|
||||
if(json["result"].toBool()) mLedCard->m_bLockStatus = false;
|
||||
else {
|
||||
mLedCard->m_bLockStatus = true;
|
||||
QMessageBox::warning(gMainWin, tr("Tip Info"),tr("password is wrong"));
|
||||
}
|
||||
SetPasswordItem(mLedCard);
|
||||
waitingDlg->success();
|
||||
mLedCard->m_bLockStatus = false;
|
||||
btnUnlock->setIcon(QIcon(":/res/device/UnLock.png"));
|
||||
});
|
||||
}
|
||||
void wProgramPublishItem::SetPasswordItem(LedCard *card) {
|
||||
if(! card->bPassword) return;
|
||||
if(m_bnLock==nullptr) {
|
||||
m_bnLock = new QPushButton(m_pWnd);
|
||||
m_bnLock->setStyleSheet("background-color:transparent;");
|
||||
m_bnLock->setStyleSheet("margin-left:12px; margin-right:12px;margin-top:12px; margin-bottom:12px;");
|
||||
m_parent->setItemWidget(this, ENUM_DEVICE_PUBLISH_HEADE_ENCRYPT, m_bnLock);
|
||||
connect(m_bnLock, SIGNAL(clicked()), this, SLOT(onVerifyLockPassword()));
|
||||
}
|
||||
m_bnLock->setIcon(QIcon(card->m_bLockStatus ? ":/res/device/Lock.png" : ":/res/device/UnLock.png")); //如果已经验证通过密码显示绿色图标 没有验证显示蓝色锁图标
|
||||
m_parent->setItemWidget(this, ENUM_DEVICE_PUBLISH_HEADE_ENCRYPT, m_bnLock);
|
||||
});
|
||||
|
||||
SetItemParam(mLedCard);
|
||||
}
|
||||
|
||||
void wProgramPublishItem::SetItemParam(LedCard *p) {
|
||||
setData(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_ID, 0, p->m_strCardId);
|
||||
setData(ENUM_DEVICE_PUBLISH_HEADE_REMARK_NAME, 0, p->m_strCardRemarkName);
|
||||
setData(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_IP, 0, p->m_strCardIp);
|
||||
setData(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_SIZE, 0, QString("%1 x %2").arg(p->m_iWidth).arg(p->m_iHeight));
|
||||
void wProgramPublishItem::SetItemParam(LedCard *card) {
|
||||
setData(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_ID, 0, card->m_strCardId);
|
||||
setData(ENUM_DEVICE_PUBLISH_HEADE_REMARK_NAME, 0, card->m_strCardRemarkName);
|
||||
setData(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_IP, 0, card->m_strCardIp);
|
||||
setData(ENUM_DEVICE_PUBLISH_HEADE_SCREEN_SIZE, 0, QString("%1 x %2").arg(card->m_iWidth).arg(card->m_iHeight));
|
||||
m_ImageOnline->setPixmap(QPixmap(mLedCard->m_bOnLine ? ":/res/device/O_Online.png" : ":/res/device/O_Offline.png"));
|
||||
SetPasswordItem(mLedCard);
|
||||
|
||||
// //progresss.append(progress);
|
||||
// QTableWidgetItem *topLevelItem = new QTableWidgetItem(); //创建一个 TreeItem 容器用于后来装载控件
|
||||
// topLevelItem->setData(0,listProgramName->at(i));
|
||||
// topLevelItem->setFlags(topLevelItem->flags() & ~Qt::ItemIsEnabled & ~Qt::ItemIsSelectable);
|
||||
// /*上面用到的两个枚举中:~Qt::ItemIsEnabled可以保证单击该Item时不会被选中,但是在启用Ctrl + A时,全选操作会导致Item被选中。
|
||||
// * ~Qt::ItemIsSelectable的使用可以保证全选状态下也不会被选中,但是在单独使用时出现了虚线框,没有真正实现“不存在”的效果。所以必须两个同用。*/
|
||||
// ctrlProgramList->setItem(i,0,topLevelItem);
|
||||
// ctrlProgramList->setCellWidget(i, 1, progress);
|
||||
if(! card->bPassword) btnUnlock->hide();
|
||||
else {
|
||||
if(! btnUnlock->isVisible()) btnUnlock->show();
|
||||
btnUnlock->setIcon(QIcon(card->m_bLockStatus ? ":/res/device/Lock.png" : ":/res/device/UnLock.png")); //如果已经验证通过密码显示绿色图标 没有验证显示蓝色锁图标
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#ifndef WPROGRAMPUBLISHITEM_H
|
||||
#define WPROGRAMPUBLISHITEM_H
|
||||
|
||||
#include "sendprogthread.h"
|
||||
#include <QDateTime>
|
||||
#include <QDir>
|
||||
#include <QJsonDocument>
|
||||
|
@ -18,25 +17,19 @@
|
|||
class wProgramPublishItem : public QObject, public QTreeWidgetItem {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit wProgramPublishItem(LedCard *pLedCard, LoQTreeWidget *parent = nullptr,QWidget *pWnd=nullptr,QString strProgramName="",QString strProgramPath="");
|
||||
explicit wProgramPublishItem(LedCard *pLedCard, LoQTreeWidget *parent = nullptr, QString strProgramName="",QString strProgramPath="");
|
||||
void SetItemParam(LedCard *p);
|
||||
|
||||
LedCard *mLedCard{nullptr};
|
||||
QProgressBar *fdProgress{nullptr};
|
||||
bool mIsSending{false};
|
||||
|
||||
public slots:
|
||||
void onVerifyLockPassword();
|
||||
|
||||
private:
|
||||
void SetPasswordItem(LedCard *p);
|
||||
|
||||
QString m_strProgramName="";
|
||||
QString m_strProgramPath="";
|
||||
QLabel *m_ImageOnline=nullptr;
|
||||
LoQTreeWidget *m_parent = nullptr;
|
||||
QWidget *m_pWnd=nullptr;
|
||||
QPushButton *m_bnLock = nullptr;//
|
||||
QPushButton *btnUnlock = nullptr;//
|
||||
|
||||
};
|
||||
enum ENUM_DEVICE_PUBLISH_HEADERITEM {
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
#include "program/progitem.h"
|
||||
#include "device/ledcard.h"
|
||||
#include <QApplication>
|
||||
#include <QObject>
|
||||
#include <QBrush>
|
||||
#include <QColor>
|
||||
#include <QTimer>
|
||||
|
@ -16,15 +15,18 @@
|
|||
#include <QNetworkAccessManager>
|
||||
|
||||
const QString str0_9[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
|
||||
extern QWidget *gMainWin;
|
||||
extern DevicePanel *gDevicePanel;
|
||||
extern QList<LedCard*> *gSelCards;
|
||||
extern QTextEdit *gFdResInfo;
|
||||
extern QString gFileHome;
|
||||
extern QWidget *gProgEditorWin;
|
||||
extern ProgItem *gProgItem;
|
||||
extern QString css;
|
||||
|
||||
inline QWidget *parentWgt(QObject *obj) {
|
||||
while(obj && ! obj->isWidgetType()) obj = obj->parent();
|
||||
return (QWidget*) obj;
|
||||
}
|
||||
|
||||
class Tools : public QObject {
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
|
Loading…
Reference in New Issue
Block a user