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