修改 ledok, ledset

This commit is contained in:
gangphon 2022-09-06 23:40:02 +08:00
parent d5199b1d91
commit dd833d40f1
25 changed files with 3793 additions and 3633 deletions

View File

@ -17,7 +17,7 @@ CONFIG += embed_translations
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0 #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
TARGET = $$quote(LedOK Express) TARGET = $$quote(LedOK Express)
VERSION = 1.2.8 VERSION = 1.2.9
DEFINES += APP_VERSION=\\\"$$VERSION\\\" DEFINES += APP_VERSION=\\\"$$VERSION\\\"
msvc { msvc {
@ -304,6 +304,7 @@ LIBS += -L$$PWD/ffmpeg/lib/\
-lswscale -lswscale
copy.files += $$files(ffmpeg/lib/*.dll) copy.files += $$files(ffmpeg/lib/*.dll)
copy.files += ffmpeg/lib/ffmpeg.exe
include(./xlsx/qtxlsx.pri) include(./xlsx/qtxlsx.pri)
include(./QSimpleUpdater/QSimpleUpdater.pri) include(./QSimpleUpdater/QSimpleUpdater.pri)

View File

@ -373,21 +373,6 @@ void DeviceItem::OnProHttpResponse(QString url, QString postMD5, QByteArray data
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetScreenStatus")+tr("success")+","+tr("Status")+":"+tr("off")); emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("GetScreenStatus")+tr("success")+","+tr("Status")+":"+tr("off"));
} }
} }
}
else if(strType == "GetEthernet")
{
QString strDhcp="";
if(jsonObject["dhcp"].toBool())
{
strDhcp=tr("DHCP IP");
}
else {
strDhcp=tr("STATIC IP");
}
emit sigOutputInfo(m_pLedCard->m_strCardId+":"+strDhcp+","+"IP:"+jsonObject["ipAddr"].toString()+" GateWay:"+jsonObject["gateWay"].toString()+" Mask:"+jsonObject["netMask"].toString()+" Dns:"+jsonObject["dnsAddr"].toString());
} }
else if(strType == "VerifyPassword") else if(strType == "VerifyPassword")
{ {

View File

@ -20,7 +20,7 @@ LONG WINAPI handleException(_EXCEPTION_POINTERS *excep) {
MINIDUMP_EXCEPTION_INFORMATION dumpInfo{GetCurrentThreadId(), excep, TRUE}; MINIDUMP_EXCEPTION_INFORMATION dumpInfo{GetCurrentThreadId(), excep, TRUE};
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpNormal, &dumpInfo, NULL, NULL);//写入Dump文件内容 MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpNormal, &dumpInfo, NULL, NULL);//写入Dump文件内容
CloseHandle(hDumpFile); CloseHandle(hDumpFile);
QMessageBox::critical(nullptr, "程序出错", "<b>程序出错!</b> (code: "+errCode+". addr: "+errAddr+")<br/>请将C盘下的 ledok-crash.dmp 文件发送到 gangphon@qq.com 邮箱, 研发人员会尽快处理."); QMessageBox::critical(nullptr, "程序出错 (ver: " APP_VERSION")", "<b>程序出错!</b> (code: "+errCode+". addr: "+errAddr+")<br/>请将C盘下的 ledok-crash.dmp 文件发送到 gangphon@qq.com 邮箱, 研发人员会尽快处理.");
return EXCEPTION_EXECUTE_HANDLER; return EXCEPTION_EXECUTE_HANDLER;
// EXCEPTION_EXECUTE_HANDLER 已处理异常, 让 windows 正常结束 // EXCEPTION_EXECUTE_HANDLER 已处理异常, 让 windows 正常结束
// EXCEPTION_CONTINUE_SEARCH 未处理异常, 让 windows 弹出错误框并结束 (Qt会卡死一段时间) // EXCEPTION_CONTINUE_SEARCH 未处理异常, 让 windows 弹出错误框并结束 (Qt会卡死一段时间)

View File

@ -14,6 +14,7 @@
#include <QSettings> #include <QSettings>
QWidget *gMainWin; QWidget *gMainWin;
extern QPoint gPlayPos;
class ImgBtn : public QToolButton { class ImgBtn : public QToolButton {
public: public:
@ -106,6 +107,8 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
else resize(1280, 720); else resize(1280, 720);
if(settings.value("MainIsMax", false).toBool()) setWindowState(Qt::WindowMaximized); if(settings.value("MainIsMax", false).toBool()) setWindowState(Qt::WindowMaximized);
gPlayPos = settings.value("PlayPos").toPoint();
setWindowTitle("LedOK Express"); setWindowTitle("LedOK Express");
icon.load(":/res/Logo.png"); icon.load(":/res/Logo.png");
titlePos = QPointF(26, 80); titlePos = QPointF(26, 80);
@ -392,6 +395,7 @@ MainWindow::~MainWindow() {
if(act) settings.setValue("Language", act->objectName()); if(act) settings.setValue("Language", act->objectName());
settings.setValue("MainGeo", normalGeometry()); settings.setValue("MainGeo", normalGeometry());
settings.setValue("MainIsMax", isMaximized()); settings.setValue("MainIsMax", isMaximized());
settings.setValue("PlayPos", gPlayPos);
if(m_pTimerSendResoreIpOneKey!=nullptr) { if(m_pTimerSendResoreIpOneKey!=nullptr) {
if(m_pTimerSendResoreIpOneKey->isActive()) m_pTimerSendResoreIpOneKey->stop(); if(m_pTimerSendResoreIpOneKey->isActive()) m_pTimerSendResoreIpOneKey->stop();

View File

@ -18,14 +18,21 @@
#include <QMovie> #include <QMovie>
#include <QThread> #include <QThread>
#include <QWebEngineView> #include <QWebEngineView>
#include <QGuiApplication>
PlayWin* PlayWin::self = nullptr; PlayWin* PlayWin::self = nullptr;
QPoint gPlayPos{0, 0};
Page::Page(QWidget *parent) : QWidget{parent} { Page::Page(QWidget *parent) : QWidget{parent} {
} }
PlayWin::PlayWin(QString dir, int x, int y, int width, int height, const QJsonObject &aprog, QWidget *parent) : QWidget(parent) { PlayWin *PlayWin::newIns(int width, int height, QString dir, const QJsonObject &aprog, QWidget *parent) {
if(! gPlayPos.isNull() && QGuiApplication::screenAt(QPoint(gPlayPos.x()+width/2, gPlayPos.y()+height/2))==0) gPlayPos = QPoint();
return new PlayWin(gPlayPos.x(), gPlayPos.y(), width, height, dir, aprog, parent);
}
PlayWin::PlayWin(int x, int y, int width, int height, QString dir, const QJsonObject &aprog, QWidget *parent) : QWidget(parent) {
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
setAttribute(Qt::WA_QuitOnClose, false); setAttribute(Qt::WA_QuitOnClose, false);
setWindowFlag(Qt::FramelessWindowHint); setWindowFlag(Qt::FramelessWindowHint);
@ -127,11 +134,13 @@ PlayWin::PlayWin(QString dir, int x, int y, int width, int height, const QJsonOb
if(page->timeSpan>0) pages.append(page); if(page->timeSpan>0) pages.append(page);
} }
setVisible(true); setVisible(true);
Page* page0 = pages[0]; if(! pages.isEmpty()) {
EleBase* eleptr; Page* page0 = pages[0];
for(int ee=0; ee<page0->eles.size(); ee++) if((eleptr = &page0->eles[ee])->startTime > 0 || eleptr->endTime < page0->timeSpan) { EleBase* eleptr;
if(eleptr->startTime > 0) timerMap.insert(startTimer(eleptr->startTime), TimerValue(eleptr->wgt, true)); for(int ee=0; ee<page0->eles.size(); ee++) if((eleptr = &page0->eles[ee])->startTime > 0 || eleptr->endTime < page0->timeSpan) {
timerMap.insert(startTimer(eleptr->endTime), TimerValue(eleptr->wgt, false)); if(eleptr->startTime > 0) timerMap.insert(startTimer(eleptr->startTime), TimerValue(eleptr->wgt, true));
timerMap.insert(startTimer(eleptr->endTime), TimerValue(eleptr->wgt, false));
}
} }
menu = new QMenu(this); menu = new QMenu(this);
@ -179,7 +188,7 @@ void PlayWin::timerEvent(QTimerEvent *e){
} }
} }
void PlayWin::paintEvent(QPaintEvent *e){ void PlayWin::paintEvent(QPaintEvent *e){
if(timer==nullptr && isVisible()) { if(timer==nullptr && isVisible() && ! pages.isEmpty()) {
if(cur!=0) { if(cur!=0) {
pages[cur]->setVisible(false); pages[cur]->setVisible(false);
cur = 0; cur = 0;
@ -215,4 +224,5 @@ void PlayWin::contextMenuEvent(QContextMenuEvent *event){
} }
void PlayWin::closeEvent(QCloseEvent *) { void PlayWin::closeEvent(QCloseEvent *) {
if(self==this) self = nullptr; if(self==this) self = nullptr;
gPlayPos = pos();
} }

View File

@ -20,10 +20,14 @@ public:
QWidget* ele; QWidget* ele;
bool visible; bool visible;
}; };
class PlayWin : public QWidget{
class PlayWin : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
static PlayWin* self; static PlayWin *self;
static PlayWin *newIns(int width, int height, QString dir, const QJsonObject &prog, QWidget *parent = nullptr);
PlayWin(int x, int y, int width, int height, QString dir, const QJsonObject &prog, QWidget *parent = nullptr);
SyncTimer* timer = nullptr; SyncTimer* timer = nullptr;
int cur = 0; int cur = 0;
QVector<Page*> pages; QVector<Page*> pages;
@ -31,7 +35,6 @@ public:
QPoint mPressRel; QPoint mPressRel;
QMenu *menu; QMenu *menu;
PlayWin(QString dir, int x, int y, int width, int height, const QJsonObject &prog, QWidget *parent = nullptr);
public slots: public slots:
void sltNext(); void sltNext();
void sltSetVisible(QWidget *wgt, bool visible){ void sltSetVisible(QWidget *wgt, bool visible){

View File

@ -81,7 +81,7 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
QJsonObject prog = QJsonDocument::fromJson(value.toUtf8(), &jsErr).object(); QJsonObject prog = QJsonDocument::fromJson(value.toUtf8(), &jsErr).object();
if(jsErr.error) return; if(jsErr.error) return;
if(PlayWin::self!=nullptr) PlayWin::self->close(); if(PlayWin::self!=nullptr) PlayWin::self->close();
PlayWin::self = new PlayWin(dir, 0, 0, item->width(), item->height(), prog); PlayWin::self = PlayWin::newIns(item->width(), item->height(), dir, prog);
break; break;
} }
} }

View File

@ -46,7 +46,7 @@ public:
static int color2Int(const QColor& color); static int color2Int(const QColor& color);
static QBrush getBrush(const QColor& color); static QBrush getBrush(const QColor& color);
static QString selectStr(bool f, const QString &s0, const QString &s1 = ""); static QString selectStr(bool f, const QString &s0, const QString &s1 = "");
static QString convertFileSize(const qlonglong & bytes) ; static QString convertFileSize(const qlonglong & bytes);
static QString styleSheet(); static QString styleSheet();
~Tools() { ~Tools() {
killTimer(timer_id); killTimer(timer_id);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -39,7 +39,7 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
labelIpAddress = new QLabel; labelIpAddress = new QLabel;
hhh->addWidget(labelIpAddress); hhh->addWidget(labelIpAddress);
fdIP = new QIPLineEdit(gBoxSpecifyIp); fdIP = new QIPLineEdit;
fdIP->setFixedWidth(160); fdIP->setFixedWidth(160);
fdIP->setStyleSheet("background-color: #fff;"); fdIP->setStyleSheet("background-color: #fff;");
hhh->addWidget(fdIP); hhh->addWidget(fdIP);
@ -47,21 +47,10 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
vvv->addLayout(hhh); vvv->addLayout(hhh);
hhh = new QHBoxLayout(); hhh = new QHBoxLayout();
labelMaskAddress = new QLabel(gBoxSpecifyIp); labelMaskAddress = new QLabel;
hhh->addWidget(labelMaskAddress); hhh->addWidget(labelMaskAddress);
fdGateWay = new QIPLineEdit(gBoxSpecifyIp); fdMask = new QIPLineEdit;
fdGateWay->setFixedWidth(160);
fdGateWay->setStyleSheet("background-color: #fff;");
hhh->addWidget(fdGateWay);
vvv->addLayout(hhh);
hhh = new QHBoxLayout();
labelGateway = new QLabel(gBoxSpecifyIp);
hhh->addWidget(labelGateway);
fdMask = new QIPLineEdit(gBoxSpecifyIp);
fdMask->setFixedWidth(160); fdMask->setFixedWidth(160);
fdMask->setStyleSheet("background-color: #FFF;"); fdMask->setStyleSheet("background-color: #FFF;");
hhh->addWidget(fdMask); hhh->addWidget(fdMask);
@ -69,10 +58,21 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
vvv->addLayout(hhh); vvv->addLayout(hhh);
hhh = new QHBoxLayout(); hhh = new QHBoxLayout();
labelDnsAddress = new QLabel(gBoxSpecifyIp); labelGateway = new QLabel;
hhh->addWidget(labelGateway);
fdGateWay = new QIPLineEdit;
fdGateWay->setFixedWidth(160);
fdGateWay->setStyleSheet("background-color: #fff;");
hhh->addWidget(fdGateWay);
vvv->addLayout(hhh);
hhh = new QHBoxLayout();
labelDnsAddress = new QLabel;
hhh->addWidget(labelDnsAddress); hhh->addWidget(labelDnsAddress);
fdDns = new QIPLineEdit(gBoxSpecifyIp); fdDns = new QIPLineEdit;
fdDns->setFixedWidth(160); fdDns->setFixedWidth(160);
fdDns->setStyleSheet("background-color: #FFF;"); fdDns->setStyleSheet("background-color: #FFF;");
hhh->addWidget(fdDns); hhh->addWidget(fdDns);
@ -173,6 +173,48 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
btnLanGet = new QPushButton; btnLanGet = new QPushButton;
btnLanGet->setMinimumSize(QSize(60, 30)); btnLanGet->setMinimumSize(QSize(60, 30));
connect(btnLanGet, &QPushButton::clicked, this, [this] {
if(gSelCards->isEmpty()) {
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "GetEthernet");
json.insert("_type", "GetEthernet");
if(gSelCards->count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("GetEthernet"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg] {
Def_CtrlSingleGetReply
waitingDlg->success();
if(json["dhcp"].toBool()) {
fdDhcp->setChecked(true);
emit sigGetDhcpOrSpecifyIp(0);
} else {
fdSpecifyIp->setChecked(true);
emit sigGetDhcpOrSpecifyIp(1);
}
fdIP->setText(json["ipAddr"].toString());
fdMask->setText(json["netMask"].toString());
fdGateWay->setText(json["gateWay"].toString());
fdDns->setText(json["dnsAddr"].toString());
});
} else {
foreach(auto card, *gSelCards) {
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
connect(reply, &QNetworkReply::finished, this, [reply, card] {
QJsonDocument json;
QString err = checkReplyForJson(reply, &json);
if(err.isEmpty()) err = json["dhcp"].toBool() ? tr("DHCP IP") : tr("STATIC IP");
gFdResInfo->append(card->m_strCardId+" "+tr("GetEthernet")+" "+err);
gFdResInfo->append(" IP: "+json["ipAddr"].toString());
gFdResInfo->append(" Mask: "+json["netMask"].toString());
gFdResInfo->append(" GateWay: "+json["gateWay"].toString());
gFdResInfo->append(" Dns: "+json["dnsAddr"].toString());
});
}
}
});
hBox->addWidget(btnLanGet); hBox->addWidget(btnLanGet);
hBox->addStretch(); hBox->addStretch();
@ -562,7 +604,6 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
labelMaskAddress->setText(QCoreApplication::translate("ControlNetConfigWidget", "Mask Address", nullptr)); labelMaskAddress->setText(QCoreApplication::translate("ControlNetConfigWidget", "Mask Address", nullptr));
labelGateway->setText(QCoreApplication::translate("ControlNetConfigWidget", "Gateway", nullptr)); labelGateway->setText(QCoreApplication::translate("ControlNetConfigWidget", "Gateway", nullptr));
labelDnsAddress->setText(QCoreApplication::translate("ControlNetConfigWidget", "DNS Address", nullptr)); labelDnsAddress->setText(QCoreApplication::translate("ControlNetConfigWidget", "DNS Address", nullptr));
btnLanGet->setText(QCoreApplication::translate("ControlNetConfigWidget", "Readback", nullptr));
label_5->setText(QCoreApplication::translate("ControlNetConfigWidget", "WIFI Configuration", nullptr)); label_5->setText(QCoreApplication::translate("ControlNetConfigWidget", "WIFI Configuration", nullptr));
groupBox_3->setTitle(QCoreApplication::translate("ControlNetConfigWidget", "WiFi On/Off", nullptr)); groupBox_3->setTitle(QCoreApplication::translate("ControlNetConfigWidget", "WiFi On/Off", nullptr));
labelWifiName->setText(QCoreApplication::translate("ControlNetConfigWidget", "WiFi name", nullptr)); labelWifiName->setText(QCoreApplication::translate("ControlNetConfigWidget", "WiFi name", nullptr));
@ -637,7 +678,6 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
connect(this,SIGNAL(sigGetDhcpOrSpecifyIp(int)),this,SLOT(OnDhcpOrSpecifyIp(int))); connect(this,SIGNAL(sigGetDhcpOrSpecifyIp(int)),this,SLOT(OnDhcpOrSpecifyIp(int)));
connect(m_buttonGroup,SIGNAL(buttonClicked(int)),this,SLOT(OnDhcpOrSpecifyIp(int))); connect(m_buttonGroup,SIGNAL(buttonClicked(int)),this,SLOT(OnDhcpOrSpecifyIp(int)));
connect(btnLanGet, SIGNAL(clicked()), this, SLOT(onReadbackWireNetwork()));
connect(pushButtonWiFiModel, SIGNAL(clicked()), this, SLOT(onSetWiFiModel())); connect(pushButtonWiFiModel, SIGNAL(clicked()), this, SLOT(onSetWiFiModel()));
connect(pushButtonReadbackWiFiModel, SIGNAL(clicked()), this, SLOT(onReadbackWiFiModel())); connect(pushButtonReadbackWiFiModel, SIGNAL(clicked()), this, SLOT(onReadbackWiFiModel()));
connect(pushButtonApSet, SIGNAL(clicked()), this, SLOT(onSetAp())); connect(pushButtonApSet, SIGNAL(clicked()), this, SLOT(onSetAp()));
@ -790,14 +830,34 @@ void ControlNetConfigWidget::onReadbackAllThisPage()
return; return;
if(m_pLedlist->count()!=1) if(m_pLedlist->count()!=1)
return; return;
QJsonObject json; QJsonObject json;
json.insert("_id", getRandomString(10)); json.insert("_id", "GetEthernet");
json.insert("_type", "GetEthernet"); json.insert("_type", "GetEthernet");
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json); if(gSelCards->count() == 1) {
fdIP->MyClear(); auto card = gSelCards->at(0);
fdMask->MyClear(); auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
fdGateWay->MyClear(); connect(reply, &QNetworkReply::finished, this, [this, reply] {
fdDns->MyClear(); QJsonDocument json;
QString err = checkReplyForJson(reply, &json);
if(! err.isEmpty()) {
QMessageBox::critical(gMainWin, tr("Error"), err);
return;
}
if(json["dhcp"].toBool()) {
fdDhcp->setChecked(true);
emit sigGetDhcpOrSpecifyIp(0);
} else {
fdSpecifyIp->setChecked(true);
emit sigGetDhcpOrSpecifyIp(1);
}
fdIP->setText(json["ipAddr"].toString());
fdGateWay->setText(json["gateWay"].toString());
fdMask->setText(json["netMask"].toString());
fdDns->setText(json["dnsAddr"].toString());
});
}
QJsonObject json1; QJsonObject json1;
json1.insert("_id", getRandomString(10)); json1.insert("_id", getRandomString(10));
json1.insert("_type", "GetWifiList"); json1.insert("_type", "GetWifiList");
@ -834,31 +894,7 @@ void ControlNetConfigWidget::onReadbackAllThisPage()
json6.insert("_id", getRandomString(10)); json6.insert("_id", getRandomString(10));
json6.insert("_type", "GetFlightModeState"); json6.insert("_type", "GetFlightModeState");
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json6); HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json6);
MACRO_DEFINE_TIPDLG_ALL_FUCN(tr("Readback"),tr("Success"),tr("failed")) MACRO_DEFINE_TIPDLG_ALL_FUCN(tr("Readback"),tr("Success"),tr("failed"))
}
void ControlNetConfigWidget::onReadbackWireNetwork()
{
if(m_pLedlist==nullptr)
return;
if(m_pLedlist->count()<=1)
{
if(m_pLedCard==nullptr||m_pLedlist->count()==0)
{
QMessageBox::information(gMainWin, tr("Tip"),tr("NoSelectedController"));
return;
}
}
QJsonObject json;
json.insert("_id", getRandomString(10));
json.insert("_type", "GetEthernet");
fdIP->MyClear();
fdMask->MyClear();
fdGateWay->MyClear();
fdDns->MyClear();
MACRO_DEFINE_TIPDLG_FUCN(tr("GetEthernet"),tr("Success"),tr("failed"))
} }
void ControlNetConfigWidget::OnWiFiOpenChanged(bool b) void ControlNetConfigWidget::OnWiFiOpenChanged(bool b)
@ -1060,43 +1096,9 @@ void ControlNetConfigWidget::OnProHttpResponse(QString url, QString postMD5, QBy
} }
QJsonObject jsonObject = document.object(); QJsonObject jsonObject = document.object();
QString strType=jsonObject["_type"].toString(); QString strType=jsonObject["_type"].toString();
if(jsonObject["success"].toBool()==true) if(jsonObject["success"].toBool())
{ {
//qDebug()<<m_pLedCard->m_strCardId +"---------"+ strType; if(strType == "GetSwitchWiFi")
if(strType == "GetEthernet")
{
if(jsonObject["dhcp"].toBool())
{
fdDhcp->setChecked(true);
emit sigGetDhcpOrSpecifyIp(0);
}
else
{
fdSpecifyIp->setChecked(true);
emit sigGetDhcpOrSpecifyIp(1);
}
if(jsonObject["ipAddr"].toString()!="")
fdIP->setText(jsonObject["ipAddr"].toString());
if(jsonObject["gateWay"].toString()!="")
fdMask->setText(jsonObject["gateWay"].toString());
if(jsonObject["netMask"].toString()!="")
fdGateWay->setText(jsonObject["netMask"].toString());
if(jsonObject["dnsAddr"].toString()!="")
fdDns->setText(jsonObject["dnsAddr"].toString());
}
else if(strType == "ConfigurationWiFi"||strType == "ConfigurationHotSpot")
{
}
else if(strType == "SetSwitchWiFi")
{
}
else if(strType == "GetSwitchWiFi")
{ {
groupBox_3->setChecked(jsonObject["enable"].toBool()); groupBox_3->setChecked(jsonObject["enable"].toBool());
} }
@ -1314,37 +1316,9 @@ void ControlNetConfigWidget::OnProHttpResponseAll(QString url, QString postMD5,
} }
QJsonObject jsonObject = document.object(); QJsonObject jsonObject = document.object();
QString strType=jsonObject["_type"].toString(); QString strType=jsonObject["_type"].toString();
if(jsonObject["success"].toBool()==true) if(jsonObject["success"].toBool()) {
{ if(strType == "GetSwitchWiFi") groupBox_3->setChecked(jsonObject["enable"].toBool());
qDebug()<<m_pLedCard->m_strCardId +"---------"+ strType; else if(strType == "GetWifiList") {
if(strType == "GetEthernet")
{
if(jsonObject["dhcp"].toBool())
{
fdDhcp->setChecked(true);
emit sigGetDhcpOrSpecifyIp(0);
}
else {
fdSpecifyIp->setChecked(true);
emit sigGetDhcpOrSpecifyIp(1);
}
if(jsonObject["ipAddr"].toString()!="")
fdIP->setText(jsonObject["ipAddr"].toString());
if(jsonObject["gateWay"].toString()!="")
fdMask->setText(jsonObject["gateWay"].toString());
if(jsonObject["netMask"].toString()!="")
fdGateWay->setText(jsonObject["netMask"].toString());
if(jsonObject["dnsAddr"].toString()!="")
fdDns->setText(jsonObject["dnsAddr"].toString());
}
else if(strType == "GetSwitchWiFi")
{
groupBox_3->setChecked(jsonObject["enable"].toBool());
}
else if(strType == "GetWifiList")
{
//QVariant iTemp=jsonObject["wifiList"].toVariant();
QJsonValue value = jsonObject.take("wifiList"); QJsonValue value = jsonObject.take("wifiList");
QJsonArray array= value.toArray(); QJsonArray array= value.toArray();
int iSize=array.size(); int iSize=array.size();

View File

@ -42,7 +42,6 @@ protected slots:
void changeEvent(QEvent *) override; void changeEvent(QEvent *) override;
void transUi(); void transUi();
void onReadbackWireNetwork();
void onSetWiFiModel(); void onSetWiFiModel();
void onReadbackWiFiModel(); void onReadbackWiFiModel();
void onSetAp(); void onSetAp();

View File

@ -236,7 +236,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg] { connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg] {
Def_CtrlSingleGetReply Def_CtrlSingleGetReply
waitingDlg->close(); waitingDlg->close();
comboBox->clear(); fdPkg->clear();
auto apps = json["apps"].toArray(); auto apps = json["apps"].toArray();
auto infoDlg = new QDialog(this); auto infoDlg = new QDialog(this);
infoDlg->setWindowFlag(Qt::WindowContextHelpButtonHint, false); infoDlg->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
@ -256,10 +256,10 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
for(int i=0; i<apps.size(); i++) { for(int i=0; i<apps.size(); i++) {
auto app = apps.at(i); auto app = apps.at(i);
QString packageName = app["packageName"].toString(); QString packageName = app["packageName"].toString();
comboBox->addItem(packageName);
table->setItem(i, "apk", new QTableWidgetItem{app["appName"].toString()}); table->setItem(i, "apk", new QTableWidgetItem{app["appName"].toString()});
table->setItem(i, "ver", new QTableWidgetItem{app["versionName"].toString()}); table->setItem(i, "ver", new QTableWidgetItem{app["versionName"].toString()});
table->setItem(i, "pkg", new QTableWidgetItem{packageName}); table->setItem(i, "pkg", new QTableWidgetItem{packageName});
if(! (packageName.endsWith(".cardsystem") || packageName.endsWith(".systemcore") || packageName.endsWith(".update"))) fdPkg->addItem(packageName);
} }
infoDlg->show(); infoDlg->show();
}); });
@ -289,15 +289,75 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
}); });
hBox->addWidget(btnApkUpgrade); hBox->addWidget(btnApkUpgrade);
comboBox = new QComboBox; fdPkg = new QComboBox;
comboBox->setMinimumWidth(200); fdPkg->setEditable(true);
hBox->addWidget(comboBox); fdPkg->setMinimumWidth(200);
hBox->addWidget(fdPkg);
pushButton_unistall = new QPushButton; fdUnload = new QPushButton;
hBox->addWidget(pushButton_unistall); connect(fdUnload, &QPushButton::clicked, this, [this] {
if(gSelCards->isEmpty()) {
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
return;
}
auto pkg = fdPkg->currentText();
if(pkg.isEmpty()) {
QMessageBox::information(gMainWin, tr("Tip"), tr("Package name is null"));
return;
}
QJsonObject json;
json.insert("_id", "UninstallSoftware");
json.insert("_type", "UninstallSoftware");
json.insert("packageName", pkg);
if(gSelCards->count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("UninstallSoftware"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
Def_CtrlSetReqAfter
});
} else {
foreach(auto card, *gSelCards) {
Def_CtrlSetMulti(tr("UninstallSoftware"))
}
}
});
hBox->addWidget(fdUnload);
pushButtonRunningCheck = new QPushButton; btnRunningCheck = new QPushButton;
hBox->addWidget(pushButtonRunningCheck); connect(btnRunningCheck, &QPushButton::clicked, this, [this] {
if(gSelCards->isEmpty()) {
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
return;
}
auto pkg = fdPkg->currentText();
if(pkg.isEmpty()) {
QMessageBox::information(gMainWin, tr("Tip"), tr("Package name is null"));
return;
}
QJsonObject json;
json.insert("_id", "IsSoftwareRunning");
json.insert("_type", "IsSoftwareRunning");
json.insert("packageName", pkg);
if(gSelCards->count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("IsSoftwareRunning"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
Def_CtrlSingleGetReply
waitingDlg->close();
QMessageBox::information(gMainWin, tr("Tip"), json["running"].toBool() ? tr("running") : tr("no running"));
});
} else {
foreach(auto card, *gSelCards) {
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
connect(reply, &QNetworkReply::finished, this, [reply, card] {
QJsonDocument json;
QString err = checkReplyForJson(reply, &json);
gFdResInfo->append(card->m_strCardId+" "+tr("IsSoftwareRunning")+" "+(err.isEmpty() ? (json["running"].toBool() ? tr("running") : tr("no running")) : err));
});
}
}
});
hBox->addWidget(btnRunningCheck);
hBox->addStretch(); hBox->addStretch();
@ -885,8 +945,8 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
pushButtonSetREaltimeServer->setProperty("ssType", "progManageTool"); pushButtonSetREaltimeServer->setProperty("ssType", "progManageTool");
pushButtonClearRealtimerAddress->setProperty("ssType", "progManageTool"); pushButtonClearRealtimerAddress->setProperty("ssType", "progManageTool");
pushButtonRestart->setProperty("ssType", "progManageTool"); pushButtonRestart->setProperty("ssType", "progManageTool");
pushButton_unistall->setProperty("ssType", "progManageTool"); fdUnload->setProperty("ssType", "progManageTool");
pushButtonRunningCheck->setProperty("ssType", "progManageTool"); btnRunningCheck->setProperty("ssType", "progManageTool");
pushButtonFpgaUpgrade->setProperty("ssType", "progManageTool"); pushButtonFpgaUpgrade->setProperty("ssType", "progManageTool");
pushButtonFpgaVerCheck->setProperty("ssType", "progManageTool"); pushButtonFpgaVerCheck->setProperty("ssType", "progManageTool");
pushButtonSyncFpgaVer->setProperty("ssType", "progManageTool"); pushButtonSyncFpgaVer->setProperty("ssType", "progManageTool");
@ -911,9 +971,6 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
connect(pushButtonRestart, SIGNAL(clicked()),this,SLOT(OnRestart())); connect(pushButtonRestart, SIGNAL(clicked()),this,SLOT(OnRestart()));
connect(pushButton_unistall,SIGNAL(clicked()),this,SLOT(OnUnistall()));
connect(pushButtonRunningCheck,SIGNAL(clicked()),this,SLOT(OnRunningCheck()));
connect(pushButtonFpgaUpgrade,SIGNAL(clicked()),this,SLOT(OnFpgaUpgrade())); connect(pushButtonFpgaUpgrade,SIGNAL(clicked()),this,SLOT(OnFpgaUpgrade()));
connect(pushButtonFpgaVerCheck,SIGNAL(clicked()),this,SLOT(OnFpgaVerCheck())); connect(pushButtonFpgaVerCheck,SIGNAL(clicked()),this,SLOT(OnFpgaVerCheck()));
connect(pushButtonSyncFpgaVer,SIGNAL(clicked()),this,SLOT(OnSyncFpgaVer())); connect(pushButtonSyncFpgaVer,SIGNAL(clicked()),this,SLOT(OnSyncFpgaVer()));
@ -937,7 +994,6 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
m_pGetAskTimer = new QTimer(this); m_pGetAskTimer = new QTimer(this);
connect(this, SIGNAL(sigSend(QJsonObject &,QString)), parent->parent(), SLOT(OnControlSendJson(QJsonObject &,QString))); connect(this, SIGNAL(sigSend(QJsonObject &,QString)), parent->parent(), SLOT(OnControlSendJson(QJsonObject &,QString)));
connect(pHpptClient,SIGNAL(httpGetRspReady(QString , QByteArray )),this,SLOT(OnProHttpGetResponse(QString , QByteArray))); connect(pHpptClient,SIGNAL(httpGetRspReady(QString , QByteArray )),this,SLOT(OnProHttpGetResponse(QString , QByteArray)));
connect(btnM80Set,SIGNAL(clicked()),this,SLOT(OnM80Set())); connect(btnM80Set,SIGNAL(clicked()),this,SLOT(OnM80Set()));
@ -988,8 +1044,6 @@ void CtrlAdvancedPanel::init() {
bool isSingle = gSelCards->count()==1; bool isSingle = gSelCards->count()==1;
btnApkUpgrade->setEnabled(isSingle); btnApkUpgrade->setEnabled(isSingle);
btnApkCheck->setEnabled(isSingle); btnApkCheck->setEnabled(isSingle);
pushButton_unistall->setEnabled(isSingle);
pushButtonRunningCheck->setEnabled(isSingle);
pushButtonFpgaUpgrade->setEnabled(isSingle); pushButtonFpgaUpgrade->setEnabled(isSingle);
pushButtonFpgaVerCheck->setEnabled(isSingle); pushButtonFpgaVerCheck->setEnabled(isSingle);
pushButtonSyncFpgaVer->setEnabled(isSingle); pushButtonSyncFpgaVer->setEnabled(isSingle);
@ -1087,13 +1141,13 @@ void CtrlAdvancedPanel::transUi() {
btnMinBrightGet->setText(tr("Readback")); btnMinBrightGet->setText(tr("Readback"));
pushButtonReadbackMaxBrightess->setText(tr("Readback")); pushButtonReadbackMaxBrightess->setText(tr("Readback"));
pushButtonRestart->setText(tr("Restart led controller system")); pushButtonRestart->setText(tr("Restart led controller system"));
pushButtonRunningCheck->setText(tr("Running check")); btnRunningCheck->setText(tr("Running check"));
pushButtonSendMaxBrightness->setText(tr("Send")); pushButtonSendMaxBrightness->setText(tr("Send"));
btnMinBrightSet->setText(tr("Send")); btnMinBrightSet->setText(tr("Send"));
pushButtonSetREaltimeServer->setText(tr("Set")); pushButtonSetREaltimeServer->setText(tr("Set"));
btnWebServerSet->setText(tr("Set")); btnWebServerSet->setText(tr("Set"));
pushButtonSyncFpgaVer->setText(tr("Sync FPGA version")); pushButtonSyncFpgaVer->setText(tr("Sync FPGA version"));
pushButton_unistall->setText(tr("Uninstall")); fdUnload->setText(tr("Uninstall"));
radioButton0degrees->setText(tr("0 degrees")); radioButton0degrees->setText(tr("0 degrees"));
radioButton180degrees->setText(tr("180 degrees")); radioButton180degrees->setText(tr("180 degrees"));
radioButton270degrees->setText(tr("270 degrees")); radioButton270degrees->setText(tr("270 degrees"));
@ -1245,12 +1299,6 @@ void CtrlAdvancedPanel::OnProHttpResponse(QString url, QString, QByteArray data)
MACRO_POSTING_DLG_UNLOCK MACRO_POSTING_DLG_UNLOCK
QMessageBox::information(gMainWin, tr("Tip"),tr("UpgradeSoftware")+tr("Success")); QMessageBox::information(gMainWin, tr("Tip"),tr("UpgradeSoftware")+tr("Success"));
} }
else if(strType == "UninstallSoftware"){
MACRO_ASKTIME_STOP
MACRO_POSTING_DLG_UNLOCK
}
else if(strType == "SynchronousHardwareVersion"){ else if(strType == "SynchronousHardwareVersion"){
MACRO_ASKTIME_STOP MACRO_ASKTIME_STOP
@ -1314,17 +1362,6 @@ void CtrlAdvancedPanel::OnProHttpResponse(QString url, QString, QByteArray data)
} }
QMessageBox::information(gMainWin, tr("FPGA Version"),strtempVer); QMessageBox::information(gMainWin, tr("FPGA Version"),strtempVer);
} }
else if(strType == "IsSoftwareRunning"){
MACRO_ASKTIME_STOP
MACRO_POSTING_DLG_UNLOCK
if(jsonObject["running"].toBool())
{
QMessageBox::information(gMainWin, tr("Tip"),tr("running"));
}
else {
QMessageBox::information(gMainWin, tr("Tip"),tr("no running"));
}
}
else if (strType == "SetHighForBusy") { else if (strType == "SetHighForBusy") {
MACRO_ASKTIME_STOP MACRO_ASKTIME_STOP
MACRO_POSTING_DLG_UNLOCK MACRO_POSTING_DLG_UNLOCK
@ -1441,29 +1478,6 @@ void CtrlAdvancedPanel::OnProHttpResponseAll(QString url, QString postMD5, QByte
} }
} }
void CtrlAdvancedPanel::OnUnistall()
{
if(comboBox->currentText().isEmpty())
return;
CHECK_CARD_SELECTED
QJsonObject json;
json.insert("_id", getRandomString(10));
json.insert("_type", "UninstallSoftware");
json.insert("packageName", comboBox->currentText());
MACRO_DEFINE_TIPDLG_FUCN(tr("UninstallSoftware"),tr("Success"),tr("failed"))
}
void CtrlAdvancedPanel::OnRunningCheck()
{
if(comboBox->currentText().isEmpty())
return;
CHECK_CARD_SELECTED
QJsonObject json;
json.insert("_id", getRandomString(10));
json.insert("_type", "IsSoftwareRunning");
json.insert("packageName", comboBox->currentText());//包名需要填写?
MACRO_DEFINE_TIPDLG_FUCN(tr("IsSoftwareRunning"),tr("Success"),tr("failed"))
}
void CtrlAdvancedPanel::OnFpgaUpgrade() void CtrlAdvancedPanel::OnFpgaUpgrade()
{ {
QString url="http://"+m_pLedCard->m_strCardIp+":2016/upload?type=hardware"; QString url="http://"+m_pLedCard->m_strCardIp+":2016/upload?type=hardware";

View File

@ -53,8 +53,6 @@ protected slots:
void OnClearRealtimeServer(); void OnClearRealtimeServer();
void OnStartConfigLedScreenSoft(); void OnStartConfigLedScreenSoft();
void OnRestart(); void OnRestart();
void OnUnistall();
void OnRunningCheck();
void OnFpgaUpgrade(); void OnFpgaUpgrade();
void OnFpgaVerCheck(); void OnFpgaVerCheck();
void OnSyncFpgaVer(); void OnSyncFpgaVer();
@ -104,9 +102,9 @@ private:
QPushButton *pushButtonClearRealtimerAddress; QPushButton *pushButtonClearRealtimerAddress;
QPushButton *btnApkCheck; QPushButton *btnApkCheck;
QPushButton *btnApkUpgrade; QPushButton *btnApkUpgrade;
QComboBox *comboBox; QComboBox *fdPkg;
QPushButton *pushButton_unistall; QPushButton *fdUnload;
QPushButton *pushButtonRunningCheck; QPushButton *btnRunningCheck;
QPushButton *pushButtonFpgaUpgrade; QPushButton *pushButtonFpgaUpgrade;
QPushButton *pushButtonFpgaVerCheck; QPushButton *pushButtonFpgaVerCheck;
QPushButton *pushButtonSyncFpgaVer; QPushButton *pushButtonSyncFpgaVer;

View File

@ -126,7 +126,8 @@ 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);
gFdResInfo->append(card->m_strCardId+" "+tr("GetBrightnessSensitivity")+" "+(err.isEmpty()?QString::number(json["sensitivity"].toInt()):err)); if(err.isEmpty()) err = QString::number(json["sensitivity"].toInt());
gFdResInfo->append(card->m_strCardId+" "+tr("GetBrightnessSensitivity")+" "+err);
}); });
} }
} }

View File

@ -15,12 +15,14 @@ EVideo *EVideo::create(const QString &file, PageListItem *pageItem, EBase *multi
QString err = Tools::videoInfo(file.toUtf8(), img, &dur, &codecId); QString err = Tools::videoInfo(file.toUtf8(), img, &dur, &codecId);
if(! err.isEmpty()) { if(! err.isEmpty()) {
QMessageBox::critical(gMainWin, "Video Error", err+"\n"+file); QMessageBox::critical(gMainWin, "Video Error", err+"\n"+file);
return nullptr; return 0;
} }
QFileInfo rawInfo(file); QFileInfo rawInfo(file);
QString rawName = rawInfo.fileName(); QString rawName = rawInfo.fileName();
QString outFile = transcoding(file, rawName, pageItem->mPageDir, img.width(), img.height(), codecId); QString outFile = transcoding(file, rawName, pageItem->mPageDir, img.width(), img.height(), codecId);
if(outFile.isEmpty()) return 0;
QFileInfo outInfo(outFile); QFileInfo outInfo(outFile);
if(! outInfo.isFile() || outInfo.size()==0) return 0;
return new EVideo(outInfo.absolutePath(), outInfo.fileName(), rawInfo.absolutePath(), rawName, img, dur/1000000, pageItem, multiWin); return new EVideo(outInfo.absolutePath(), outInfo.fileName(), rawInfo.absolutePath(), rawName, img, dur/1000000, pageItem, multiWin);
} }
EVideo *EVideo::create(const QJsonObject &json, PageListItem *pageItem, EBase *multiWin) { EVideo *EVideo::create(const QJsonObject &json, PageListItem *pageItem, EBase *multiWin) {
@ -182,9 +184,9 @@ QWidget* EVideo::attrWgt() {
playDuration = dur/1000000; playDuration = dur/1000000;
fdDuration->setValue(playDuration); fdDuration->setValue(playDuration);
QString outFile = transcoding(rawFile, mRawName, mPageItem->mPageDir, mCoverImg.width(), mCoverImg.height(), codecId); QString outFile = transcoding(rawFile, mRawName, mPageItem->mPageDir, mCoverImg.width(), mCoverImg.height(), codecId);
if(outFile.isEmpty()) return;
QFile oldfile(mDir+"/"+mName); QFile oldfile(mDir+"/"+mName);
if(oldfile.exists()) oldfile.remove(); if(oldfile.exists()) oldfile.remove();
QFileInfo outInfo(outFile); QFileInfo outInfo(outFile);
mDir = outInfo.absolutePath(); mDir = outInfo.absolutePath();
mName = outInfo.fileName(); mName = outInfo.fileName();
@ -270,16 +272,20 @@ 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::number(error)+" "+QMetaEnum::fromType<QProcess::ProcessError>().valueToKey(error)); QMessageBox::critical(gMainWin, 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 txt = QString::fromUtf8(process.readAllStandardOutput()); auto data = process.readAllStandardOutput();
qInfo()<<"StandardOutput"; qInfo()<<"EVideo::transcoding StandardOutput";
qInfo()<<txt; qInfo()<<data.data();
}); });
int dur = 0; int dur = 0;
connect(&process, &QProcess::readyReadStandardError, &msgBox, [&process, &msgBox, &dur] { QString err;
auto txt = QString::fromUtf8(process.readAllStandardError()); connect(&process, &QProcess::readyReadStandardError, &msgBox, [&process, &msgBox, &dur, &err] {
auto data = process.readAllStandardError();
qInfo()<<"EVideo::transcoding ffmpeg Output";
qInfo()<<data.data();
auto txt = QString::fromUtf8(data);
if(dur==0) { if(dur==0) {
int idx = txt.indexOf("Duration: "); int idx = txt.indexOf("Duration: ");
if(idx > -1) dur = QTime::fromString(txt.mid(idx+10, 11)+"0", "HH:mm:ss.zzz").msecsSinceStartOfDay(); if(idx > -1) dur = QTime::fromString(txt.mid(idx+10, 11)+"0", "HH:mm:ss.zzz").msecsSinceStartOfDay();
@ -288,10 +294,14 @@ QString EVideo::transcoding(QString rawFile, QString rawName, QString dir, int w
if(idx > -1) { if(idx > -1) {
auto cur = QTime::fromString(txt.mid(idx+5, 11)+"0", "HH:mm:ss.zzz").msecsSinceStartOfDay(); auto cur = QTime::fromString(txt.mid(idx+5, 11)+"0", "HH:mm:ss.zzz").msecsSinceStartOfDay();
if(dur > 0) msgBox.setText(tr("Video Transcoding Progress")+": "+QString::number(cur*100/dur)+"% "); if(dur > 0) msgBox.setText(tr("Video Transcoding Progress")+": "+QString::number(cur*100/dur)+"% ");
} } else err.append(txt).append("\n");
} }
}); });
process.start("ffmpeg", {"-y", "-i", rawFile, "-vcodec", "h264", "-s", QString::number(w)+"x"+QString::number(h), outFile}); process.start("ffmpeg", {"-y", "-i", rawFile, "-vcodec", "h264", "-s", QString::number(w)+"x"+QString::number(h), outFile});
msgBox.exec(); msgBox.exec();
if(err.right(32).contains("Conversion failed!")) {
QMessageBox::critical(gMainWin, tr("Error"), err);
return "";
}
return outFile; return outFile;
} }

View File

@ -198,7 +198,7 @@ ProgEditorWin::ProgEditorWin(QString &name, int &w, int &h, QString &remarks, co
QJsonParseError jsErr; QJsonParseError jsErr;
QJsonObject prog = QJsonDocument::fromJson(value.toUtf8(), &jsErr).object(); QJsonObject prog = QJsonDocument::fromJson(value.toUtf8(), &jsErr).object();
if(jsErr.error) return; if(jsErr.error) return;
PlayWin::self = new PlayWin(gProgDir+"_tmp", 0, 0, gProgWidth, gProgHeight, prog); PlayWin::self = PlayWin::newIns(gProgWidth, gProgHeight, gProgDir+"_tmp", prog);
} }
}); });
toolBar->addAction(action); toolBar->addAction(action);

View File

@ -2,13 +2,13 @@
#include "gqt.h" #include "gqt.h"
#include <QGroupBox> #include <QGroupBox>
#include <QLabel> #include <QLabel>
#include <QSpinBox>
#include <QToolButton> #include <QToolButton>
#include <QPushButton> #include <QPushButton>
#include <QButtonGroup>
#include <QPainter> #include <QPainter>
#include <QTableWidget> #include <QTableWidget>
#include <QHeaderView> #include <QHeaderView>
#include <QMouseEvent>
#include <QDebug>
QColor cardColors[] {QColor(0xff2222), QColor(0xffaa00), QColor(0x00bb00), QColor(0x00bbcc), QColor(0x0044ff), QColor(0xffffff), QColor(0xffff00)}; QColor cardColors[] {QColor(0xff2222), QColor(0xffaa00), QColor(0x00bb00), QColor(0x00bbcc), QColor(0x0044ff), QColor(0xffffff), QColor(0xffff00)};
@ -56,8 +56,6 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
auto fdCardColNum = new QSpinBox; auto fdCardColNum = new QSpinBox;
auto fdCardRowNum = new QSpinBox; auto fdCardRowNum = new QSpinBox;
auto fdCardWidth = new QSpinBox;
auto fdCardHeight = new QSpinBox;
{ {
auto vBox = new QVBoxLayout(gBox); auto vBox = new QVBoxLayout(gBox);
auto hhh = new QHBoxLayout; auto hhh = new QHBoxLayout;
@ -86,6 +84,7 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
lb = new QLabel("卡宽度: "); lb = new QLabel("卡宽度: ");
hhh->addWidget(lb); hhh->addWidget(lb);
fdCardWidth = new QSpinBox;
fdCardWidth->setRange(0, 9999); fdCardWidth->setRange(0, 9999);
fdCardWidth->setValue(128); fdCardWidth->setValue(128);
hhh->addWidget(fdCardWidth); hhh->addWidget(fdCardWidth);
@ -93,6 +92,7 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
lb = new QLabel("卡高度: "); lb = new QLabel("卡高度: ");
hhh->addWidget(lb); hhh->addWidget(lb);
fdCardHeight = new QSpinBox;
fdCardHeight->setRange(0, 9999); fdCardHeight->setRange(0, 9999);
fdCardHeight->setValue(128); fdCardHeight->setValue(128);
hhh->addWidget(fdCardHeight); hhh->addWidget(fdCardHeight);
@ -103,7 +103,7 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
auto hhh = new QHBoxLayout(gBox); auto hhh = new QHBoxLayout(gBox);
auto pal = palette(); auto pal = palette();
auto fdNet = new QButtonGroup(gBox); fdNet = new QButtonGroup(gBox);
for(int i=0; i<netss.size(); i++) { for(int i=0; i<netss.size(); i++) {
auto bn = new QPushButton(QString::number(i+1)); auto bn = new QPushButton(QString::number(i+1));
bn->setCheckable(true); bn->setCheckable(true);
@ -177,15 +177,7 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
hhh->addWidget(bnRefresh); hhh->addWidget(bnRefresh);
auto bnBack = new QPushButton("后退"); auto bnBack = new QPushButton("后退");
connect(bnBack, &QPushButton::clicked, this, [this, fdNet] { connect(bnBack, &QPushButton::clicked, this, &ExpertScreenConnWin::connBack);
auto netIdx = fdNet->checkedId();
if(netss[netIdx].isEmpty()) return;
auto sels = table->selectedItems();
if(! sels.isEmpty()) sels[0]->setSelected(false);
auto point = netss[netIdx].takeLast();
table->setItem(point.y(), point.x(), 0);
table->update();
});
hhh->addWidget(bnBack); hhh->addWidget(bnBack);
hhh->addStretch(); hhh->addStretch();
@ -200,30 +192,35 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
table->verticalHeader()->setDefaultAlignment(Qt::AlignCenter); table->verticalHeader()->setDefaultAlignment(Qt::AlignCenter);
table->verticalHeader()->setDefaultSectionSize(90); table->verticalHeader()->setDefaultSectionSize(90);
table->verticalHeader()->setMinimumWidth(30); table->verticalHeader()->setMinimumWidth(30);
table->setSelectionMode(QTableWidget::SingleSelection); table->setSelectionMode(QTableWidget::NoSelection);
connect(table, &QTableWidget::currentCellChanged, this, [this, fdNet, fdCardWidth, fdCardHeight](int row, int column) { connect(table, &QTableWidget::currentCellChanged, this, &ExpertScreenConnWin::conn);
auto item = table->item(row, column);
if(item) {
auto netIdx = item->data(Qt::UserRole).toInt();
table->setStyleSheet("QTableView{selection-color:"+cardColors[netIdx % (sizeof(cardColors)/sizeof(cardColors[0]))].name()+";}");
//fdNet->button(netIdx)->setChecked(true);
return;
}
auto netIdx = fdNet->checkedId();
netss[netIdx].append(QPoint(column, row));
item = new QTableWidgetItem("网口: "+QString::number(netIdx+1)+"\n接收卡: "+QString::number(netss[netIdx].size())+"\n宽度: "+QString::number(fdCardWidth->value())+"\n高度: "+QString::number(fdCardHeight->value()));
auto color = cardColors[netIdx % (sizeof(cardColors)/sizeof(cardColors[0]))];
item->setForeground(color);
table->setStyleSheet("QTableView{selection-color:"+color.name()+";}");
item->setData(Qt::UserRole, netIdx);
table->setItem(row, column, item);
table->update();
});
connect(fdCardColNum, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, table, &QTableWidget::setColumnCount); connect(fdCardColNum, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, table, &QTableWidget::setColumnCount);
connect(fdCardRowNum, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, table, &QTableWidget::setRowCount); connect(fdCardRowNum, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, table, &QTableWidget::setRowCount);
hh->addWidget(table); hh->addWidget(table);
} }
void ExpertScreenConnWin::conn(int row, int column) {
if(row < 0) return;
auto item = table->item(row, column);
if(item) return;
auto netIdx = fdNet->checkedId();
netss[netIdx].append(QPoint(column, row));
item = new QTableWidgetItem("网口: "+QString::number(netIdx+1)+"\n接收卡: "+QString::number(netss[netIdx].size())+"\n宽度: "+QString::number(fdCardWidth->value())+"\n高度: "+QString::number(fdCardHeight->value()));
auto color = cardColors[netIdx % (sizeof(cardColors)/sizeof(cardColors[0]))];
item->setForeground(color);
item->setData(Qt::UserRole, netIdx);
table->setItem(row, column, item);
table->update();
}
void ExpertScreenConnWin::connBack() {
auto netIdx = fdNet->checkedId();
if(netss[netIdx].isEmpty()) return;
table->selectionModel()->clearCurrentIndex();
auto point = netss[netIdx].takeLast();
table->setItem(point.y(), point.x(), 0);
table->update();
}
void CardTable::paintEvent(QPaintEvent *event) { void CardTable::paintEvent(QPaintEvent *event) {
QTableWidget::paintEvent(event); QTableWidget::paintEvent(event);
QPainter painter(viewport()); QPainter painter(viewport());
@ -239,3 +236,10 @@ void CardTable::paintEvent(QPaintEvent *event) {
} }
} }
} }
void CardTable::mousePressEvent(QMouseEvent *event) {
if(event->button() != Qt::RightButton) QTableWidget::mousePressEvent(event);
}
void CardTable::mouseReleaseEvent(QMouseEvent *event) {
QTableWidget::mouseReleaseEvent(event);
if(event->button() == Qt::RightButton) win->connBack();
}

View File

@ -2,12 +2,19 @@
#define EXPERTSCREENCONNWIN_H #define EXPERTSCREENCONNWIN_H
#include <QTableWidget> #include <QTableWidget>
#include <QSpinBox>
#include <QButtonGroup>
class CardTable; class CardTable;
class ExpertScreenConnWin : public QWidget { class ExpertScreenConnWin : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
explicit ExpertScreenConnWin(QWidget *parent = nullptr); explicit ExpertScreenConnWin(QWidget *parent = nullptr);
void conn(int row, int column);
void connBack();
QButtonGroup *fdNet;
QSpinBox *fdCardWidth;
QSpinBox *fdCardHeight;
CardTable *table; CardTable *table;
QList<QList<QPoint>> netss{QList<QPoint>{}, QList<QPoint>{}, QList<QPoint>{}, QList<QPoint>{}}; QList<QList<QPoint>> netss{QList<QPoint>{}, QList<QPoint>{}, QList<QPoint>{}, QList<QPoint>{}};
}; };
@ -18,7 +25,9 @@ public:
CardTable(int rows, int columns, QWidget *parent = nullptr) : QTableWidget{rows, columns, parent} {} CardTable(int rows, int columns, QWidget *parent = nullptr) : QTableWidget{rows, columns, parent} {}
ExpertScreenConnWin *win; ExpertScreenConnWin *win;
protected: protected:
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event) override;
void mousePressEvent(QMouseEvent *event) override;
void mouseReleaseEvent(QMouseEvent *event) override;
}; };
#endif // EXPERTSCREENCONNWIN_H #endif // EXPERTSCREENCONNWIN_H

View File

@ -312,14 +312,27 @@ ExpertSmartPointSetWin::ExpertSmartPointSetWin(QWidget *parent) : BaseWin{parent
auto hhh = new QHBoxLayout; auto hhh = new QHBoxLayout;
auto bnReset = new QPushButton("重新走点"); auto btnReset = new QPushButton("重新走点");
bnReset->setMinimumSize(90, 30); btnReset->setMinimumSize(90, 30);
connect(bnReset, &QPushButton::clicked, this, [this] { connect(btnReset, &QPushButton::clicked, this, [this] {
table->clearContents(); table->clearContents();
curPoint = 0; points.clear();
}); });
hhh->addWidget(btnReset);
hhh->addWidget(bnReset); auto btnUndo = new QPushButton("回撤");
btnUndo->setMinimumSize(90, 30);
connect(btnUndo, &QPushButton::clicked, this, [this] {
if(points.isEmpty()) return;
auto last = points.takeLast();
table->setItem(last.y(), last.x(), 0);
if(points.isEmpty()) table->selectionModel()->clearCurrentIndex();
else {
last = points.last();
table->setCurrentCell(last.y(), last.x());
}
});
hhh->addWidget(btnUndo);
hhh->addStretch(); hhh->addStretch();
vBox->addLayout(hhh); vBox->addLayout(hhh);
@ -331,9 +344,12 @@ ExpertSmartPointSetWin::ExpertSmartPointSetWin(QWidget *parent) : BaseWin{parent
table->verticalHeader()->setMinimumWidth(40); table->verticalHeader()->setMinimumWidth(40);
table->verticalHeader()->setDefaultAlignment(Qt::AlignCenter); table->verticalHeader()->setDefaultAlignment(Qt::AlignCenter);
table->setSelectionMode(QTableWidget::SingleSelection); table->setSelectionMode(QTableWidget::SingleSelection);
connect(table, &QTableWidget::currentCellChanged, this, [this](int currentRow, int currentColumn) { connect(table, &QTableWidget::currentCellChanged, this, [this](int row, int col) {
auto item = table->item(currentRow, currentColumn); if(row < 0) return;
if(! item) table->setItem(currentRow, currentColumn, new QTableWidgetItem(QString::number(++curPoint))); auto item = table->item(row, col);
if(item) return;
points.append({col, row});
table->setItem(row, col, new QTableWidgetItem(QString::number(points.size())));
}); });
vBox->addWidget(table); vBox->addWidget(table);
} }

View File

@ -21,8 +21,8 @@ public:
QSpinBox *fdModuleWidth, *fdModuleHeight; QSpinBox *fdModuleWidth, *fdModuleHeight;
PointTable *table; PointTable *table;
QList<QPoint> points;
int moduleWidth{0}, moduleHeight{0}; int moduleWidth{0}, moduleHeight{0};
int curPoint{0};
}; };
#endif // EXPERTSMARTPOINTSETWIN_H #endif // EXPERTSMARTPOINTSETWIN_H

View File

@ -79,7 +79,7 @@ QRadioButton::indicator:checked {border-image: url(:/imgs/radio-check.png);}
QAbstractScrollArea QScrollBar {background: #555;} QAbstractScrollArea QScrollBar {background: #555;}
QTableView {gridline-color:#888; selection-background-color: #226; selection-color: #fff;} QTableView {gridline-color:#888;}
QHeaderView::section, QTableCornerButton:section {background: #555;} QHeaderView::section, QTableCornerButton:section {background: #555;}
QSlider::horizontal {height: 16px;} QSlider::horizontal {height: 16px;}

View File

@ -15,16 +15,23 @@
class ImgBtn : public QToolButton { class ImgBtn : public QToolButton {
public: public:
ImgBtn(QIcon icon) { ImgBtn() {
setIcon(icon); setStyleSheet("QToolButton{border: none; padding-top: 4px;}");
setStyleSheet("QToolButton{border: none;}");
} }
bool isEnter{false};
protected: protected:
void enterEvent(QEvent *) override { void resizeEvent(QResizeEvent *event) override {
QToolButton::resizeEvent(event);
if(isEnter) setIconSize(QSize(width(), width()));
else setIconSize(QSize(width()-8, width()-8));
}
void enterEvent(QEvent *event) override {
QToolButton::enterEvent(event);
setStyleSheet("QToolButton{border: none;}"); setStyleSheet("QToolButton{border: none;}");
setIconSize(QSize(width(), width())); setIconSize(QSize(width(), width()));
} }
void leaveEvent(QEvent *) override { void leaveEvent(QEvent *event) override {
QToolButton::leaveEvent(event);
setIconSize(QSize(width()-8, width()-8)); setIconSize(QSize(width()-8, width()-8));
setStyleSheet("QToolButton{border: none; padding-top: 4px;}"); setStyleSheet("QToolButton{border: none; padding-top: 4px;}");
} }
@ -40,12 +47,14 @@ inline QLabel *newSubLabel(QString txt){
lb->setAlignment(Qt::AlignCenter); lb->setAlignment(Qt::AlignCenter);
return lb; return lb;
} }
void addImg(QHBoxLayout *parent, ImgBtn* imgBtn, QString txt) { ImgBtn *addImg(QHBoxLayout *parent, const QIcon &icon, const QString &text) {
imgBtn->setText(txt); auto imgBtn = new ImgBtn();
imgBtn->setIcon(icon);
imgBtn->setText(text);
imgBtn->setFixedSize(76, 100); imgBtn->setFixedSize(76, 100);
imgBtn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon); imgBtn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
imgBtn->setIconSize(QSize(76, 76));
parent->addWidget(imgBtn); parent->addWidget(imgBtn);
return imgBtn;
} }
MainWin::MainWin() { MainWin::MainWin() {
@ -58,8 +67,7 @@ MainWin::MainWin() {
vBox->addLayout(addBtns(new QHBoxLayout())); vBox->addLayout(addBtns(new QHBoxLayout()));
QHBoxLayout *imgsBar = new QHBoxLayout(); QHBoxLayout *imgsBar = new QHBoxLayout();
ImgBtn *btnImg; auto btnImg = addImg(imgsBar, QPixmap(":/imgs/fast.png").scaledToWidth(128, Qt::SmoothTransformation), "快速调屏");
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/fast.png").scaledToWidth(128, Qt::SmoothTransformation)), "快速调屏");
connect(btnImg, &ImgBtn::clicked, this, [=](){ connect(btnImg, &ImgBtn::clicked, this, [=](){
(new Fast(this))->show(); (new Fast(this))->show();
// if(win==0) { // if(win==0) {
@ -71,32 +79,32 @@ MainWin::MainWin() {
// win->move(win->x()-100, win->y()); // win->move(win->x()-100, win->y());
// } // }
}); });
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/expert.png").scaledToWidth(128, Qt::SmoothTransformation)), "专家调屏"); btnImg = addImg(imgsBar, QPixmap(":/imgs/expert.png").scaledToWidth(128, Qt::SmoothTransformation), "专家调屏");
connect(btnImg, &ImgBtn::clicked, this, [=](){ connect(btnImg, &ImgBtn::clicked, this, [=](){
(new ExpertWin(this))->show(); (new ExpertWin(this))->show();
}); });
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/bright.png").scaledToWidth(128, Qt::SmoothTransformation)), "亮度控制"); btnImg = addImg(imgsBar, QPixmap(":/imgs/bright.png").scaledToWidth(128, Qt::SmoothTransformation), "亮度控制");
connect(btnImg, &ImgBtn::clicked, this, [=](){ connect(btnImg, &ImgBtn::clicked, this, [=](){
(new BrightWin(this))->show(); (new BrightWin(this))->show();
}); });
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/correct.png").scaledToWidth(128, Qt::SmoothTransformation)), "相机矫正"); btnImg = addImg(imgsBar, QPixmap(":/imgs/correct.png").scaledToWidth(128, Qt::SmoothTransformation), "相机矫正");
connect(btnImg, &ImgBtn::clicked, this, [=](){ connect(btnImg, &ImgBtn::clicked, this, [=](){
}); });
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/monitor.png").scaledToWidth(128, Qt::SmoothTransformation)), "屏体监控"); btnImg = addImg(imgsBar, QPixmap(":/imgs/monitor.png").scaledToWidth(128, Qt::SmoothTransformation), "屏体监控");
connect(btnImg, &ImgBtn::clicked, this, [=](){ connect(btnImg, &ImgBtn::clicked, this, [=](){
}); });
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/multi.png").scaledToWidth(128, Qt::SmoothTransformation)), "多功能卡"); btnImg = addImg(imgsBar, QPixmap(":/imgs/multi.png").scaledToWidth(128, Qt::SmoothTransformation), "多功能卡");
connect(btnImg, &ImgBtn::clicked, this, [=](){ connect(btnImg, &ImgBtn::clicked, this, [=](){
//win->move(win->x()-1, win->y()); //win->move(win->x()-1, win->y());
}); });
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/video.png").scaledToWidth(128, Qt::SmoothTransformation)), "网口通信"); btnImg = addImg(imgsBar, QPixmap(":/imgs/video.png").scaledToWidth(128, Qt::SmoothTransformation), "网口通信");
connect(btnImg, &ImgBtn::clicked, this, [=](){ connect(btnImg, &ImgBtn::clicked, this, [=](){
auto ins = PcapWin::newIns(this); auto ins = PcapWin::newIns(this);
if(ins) ins->show(); if(ins) ins->show();
}); });
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/idea.png").scaledToWidth(128, Qt::SmoothTransformation)), "创意显示"); btnImg = addImg(imgsBar, QPixmap(":/imgs/idea.png").scaledToWidth(128, Qt::SmoothTransformation), "创意显示");
connect(btnImg, &ImgBtn::clicked, this, [=](){ connect(btnImg, &ImgBtn::clicked, this, [=](){
//qDebug()<<"geometry"<<win->geometry()<<"screen"<<win->screen(); //qDebug()<<"geometry"<<win->geometry()<<"screen"<<win->screen();
}); });