修改 ledok, ledset
This commit is contained in:
parent
d5199b1d91
commit
dd833d40f1
|
@ -17,7 +17,7 @@ CONFIG += embed_translations
|
|||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
TARGET = $$quote(LedOK Express)
|
||||
VERSION = 1.2.8
|
||||
VERSION = 1.2.9
|
||||
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
|
||||
|
||||
msvc {
|
||||
|
@ -304,6 +304,7 @@ LIBS += -L$$PWD/ffmpeg/lib/\
|
|||
-lswscale
|
||||
|
||||
copy.files += $$files(ffmpeg/lib/*.dll)
|
||||
copy.files += ffmpeg/lib/ffmpeg.exe
|
||||
|
||||
include(./xlsx/qtxlsx.pri)
|
||||
include(./QSimpleUpdater/QSimpleUpdater.pri)
|
||||
|
|
|
@ -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"));
|
||||
}
|
||||
}
|
||||
}
|
||||
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")
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@ LONG WINAPI handleException(_EXCEPTION_POINTERS *excep) {
|
|||
MINIDUMP_EXCEPTION_INFORMATION dumpInfo{GetCurrentThreadId(), excep, TRUE};
|
||||
MiniDumpWriteDump(GetCurrentProcess(), GetCurrentProcessId(), hDumpFile, MiniDumpNormal, &dumpInfo, NULL, NULL);//写入Dump文件内容
|
||||
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;
|
||||
// EXCEPTION_EXECUTE_HANDLER 已处理异常, 让 windows 正常结束
|
||||
// EXCEPTION_CONTINUE_SEARCH 未处理异常, 让 windows 弹出错误框并结束 (Qt会卡死一段时间)
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include <QSettings>
|
||||
|
||||
QWidget *gMainWin;
|
||||
extern QPoint gPlayPos;
|
||||
|
||||
class ImgBtn : public QToolButton {
|
||||
public:
|
||||
|
@ -106,6 +107,8 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
|
|||
else resize(1280, 720);
|
||||
if(settings.value("MainIsMax", false).toBool()) setWindowState(Qt::WindowMaximized);
|
||||
|
||||
gPlayPos = settings.value("PlayPos").toPoint();
|
||||
|
||||
setWindowTitle("LedOK Express");
|
||||
icon.load(":/res/Logo.png");
|
||||
titlePos = QPointF(26, 80);
|
||||
|
@ -392,6 +395,7 @@ MainWindow::~MainWindow() {
|
|||
if(act) settings.setValue("Language", act->objectName());
|
||||
settings.setValue("MainGeo", normalGeometry());
|
||||
settings.setValue("MainIsMax", isMaximized());
|
||||
settings.setValue("PlayPos", gPlayPos);
|
||||
|
||||
if(m_pTimerSendResoreIpOneKey!=nullptr) {
|
||||
if(m_pTimerSendResoreIpOneKey->isActive()) m_pTimerSendResoreIpOneKey->stop();
|
||||
|
|
|
@ -18,14 +18,21 @@
|
|||
#include <QMovie>
|
||||
#include <QThread>
|
||||
#include <QWebEngineView>
|
||||
#include <QGuiApplication>
|
||||
|
||||
PlayWin* PlayWin::self = nullptr;
|
||||
QPoint gPlayPos{0, 0};
|
||||
|
||||
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_QuitOnClose, false);
|
||||
setWindowFlag(Qt::FramelessWindowHint);
|
||||
|
@ -127,12 +134,14 @@ PlayWin::PlayWin(QString dir, int x, int y, int width, int height, const QJsonOb
|
|||
if(page->timeSpan>0) pages.append(page);
|
||||
}
|
||||
setVisible(true);
|
||||
if(! pages.isEmpty()) {
|
||||
Page* page0 = pages[0];
|
||||
EleBase* eleptr;
|
||||
for(int ee=0; ee<page0->eles.size(); ee++) if((eleptr = &page0->eles[ee])->startTime > 0 || eleptr->endTime < page0->timeSpan) {
|
||||
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);
|
||||
auto act = menu->addAction(tr("Move to Top Left"));
|
||||
|
@ -179,7 +188,7 @@ void PlayWin::timerEvent(QTimerEvent *e){
|
|||
}
|
||||
}
|
||||
void PlayWin::paintEvent(QPaintEvent *e){
|
||||
if(timer==nullptr && isVisible()) {
|
||||
if(timer==nullptr && isVisible() && ! pages.isEmpty()) {
|
||||
if(cur!=0) {
|
||||
pages[cur]->setVisible(false);
|
||||
cur = 0;
|
||||
|
@ -215,4 +224,5 @@ void PlayWin::contextMenuEvent(QContextMenuEvent *event){
|
|||
}
|
||||
void PlayWin::closeEvent(QCloseEvent *) {
|
||||
if(self==this) self = nullptr;
|
||||
gPlayPos = pos();
|
||||
}
|
||||
|
|
|
@ -20,10 +20,14 @@ public:
|
|||
QWidget* ele;
|
||||
bool visible;
|
||||
};
|
||||
|
||||
class PlayWin : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
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;
|
||||
int cur = 0;
|
||||
QVector<Page*> pages;
|
||||
|
@ -31,7 +35,6 @@ public:
|
|||
QPoint mPressRel;
|
||||
QMenu *menu;
|
||||
|
||||
PlayWin(QString dir, int x, int y, int width, int height, const QJsonObject &prog, QWidget *parent = nullptr);
|
||||
public slots:
|
||||
void sltNext();
|
||||
void sltSetVisible(QWidget *wgt, bool visible){
|
||||
|
|
|
@ -81,7 +81,7 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
|
|||
QJsonObject prog = QJsonDocument::fromJson(value.toUtf8(), &jsErr).object();
|
||||
if(jsErr.error) return;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
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
|
@ -39,7 +39,7 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
|
|||
labelIpAddress = new QLabel;
|
||||
hhh->addWidget(labelIpAddress);
|
||||
|
||||
fdIP = new QIPLineEdit(gBoxSpecifyIp);
|
||||
fdIP = new QIPLineEdit;
|
||||
fdIP->setFixedWidth(160);
|
||||
fdIP->setStyleSheet("background-color: #fff;");
|
||||
hhh->addWidget(fdIP);
|
||||
|
@ -47,21 +47,10 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
|
|||
vvv->addLayout(hhh);
|
||||
hhh = new QHBoxLayout();
|
||||
|
||||
labelMaskAddress = new QLabel(gBoxSpecifyIp);
|
||||
labelMaskAddress = new QLabel;
|
||||
hhh->addWidget(labelMaskAddress);
|
||||
|
||||
fdGateWay = new QIPLineEdit(gBoxSpecifyIp);
|
||||
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 = new QIPLineEdit;
|
||||
fdMask->setFixedWidth(160);
|
||||
fdMask->setStyleSheet("background-color: #FFF;");
|
||||
hhh->addWidget(fdMask);
|
||||
|
@ -69,10 +58,21 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
|
|||
vvv->addLayout(hhh);
|
||||
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);
|
||||
|
||||
fdDns = new QIPLineEdit(gBoxSpecifyIp);
|
||||
fdDns = new QIPLineEdit;
|
||||
fdDns->setFixedWidth(160);
|
||||
fdDns->setStyleSheet("background-color: #FFF;");
|
||||
hhh->addWidget(fdDns);
|
||||
|
@ -173,6 +173,48 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
|
|||
|
||||
btnLanGet = new QPushButton;
|
||||
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->addStretch();
|
||||
|
@ -562,7 +604,6 @@ ControlNetConfigWidget::ControlNetConfigWidget(QWidget *parent,QList<LedCard *>
|
|||
labelMaskAddress->setText(QCoreApplication::translate("ControlNetConfigWidget", "Mask Address", nullptr));
|
||||
labelGateway->setText(QCoreApplication::translate("ControlNetConfigWidget", "Gateway", 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));
|
||||
groupBox_3->setTitle(QCoreApplication::translate("ControlNetConfigWidget", "WiFi On/Off", 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(m_buttonGroup,SIGNAL(buttonClicked(int)),this,SLOT(OnDhcpOrSpecifyIp(int)));
|
||||
|
||||
connect(btnLanGet, SIGNAL(clicked()), this, SLOT(onReadbackWireNetwork()));
|
||||
connect(pushButtonWiFiModel, SIGNAL(clicked()), this, SLOT(onSetWiFiModel()));
|
||||
connect(pushButtonReadbackWiFiModel, SIGNAL(clicked()), this, SLOT(onReadbackWiFiModel()));
|
||||
connect(pushButtonApSet, SIGNAL(clicked()), this, SLOT(onSetAp()));
|
||||
|
@ -790,14 +830,34 @@ void ControlNetConfigWidget::onReadbackAllThisPage()
|
|||
return;
|
||||
if(m_pLedlist->count()!=1)
|
||||
return;
|
||||
|
||||
QJsonObject json;
|
||||
json.insert("_id", getRandomString(10));
|
||||
json.insert("_id", "GetEthernet");
|
||||
json.insert("_type", "GetEthernet");
|
||||
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json);
|
||||
fdIP->MyClear();
|
||||
fdMask->MyClear();
|
||||
fdGateWay->MyClear();
|
||||
fdDns->MyClear();
|
||||
if(gSelCards->count() == 1) {
|
||||
auto card = gSelCards->at(0);
|
||||
auto reply = Tools::netManager().post(reqForJson("http://"+card->m_strCardIp+":2016/settings"), QJsonDocument{json}.toJson(QJsonDocument::Compact));
|
||||
connect(reply, &QNetworkReply::finished, this, [this, reply] {
|
||||
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;
|
||||
json1.insert("_id", getRandomString(10));
|
||||
json1.insert("_type", "GetWifiList");
|
||||
|
@ -834,31 +894,7 @@ void ControlNetConfigWidget::onReadbackAllThisPage()
|
|||
json6.insert("_id", getRandomString(10));
|
||||
json6.insert("_type", "GetFlightModeState");
|
||||
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json6);
|
||||
|
||||
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)
|
||||
|
@ -1060,43 +1096,9 @@ void ControlNetConfigWidget::OnProHttpResponse(QString url, QString postMD5, QBy
|
|||
}
|
||||
QJsonObject jsonObject = document.object();
|
||||
QString strType=jsonObject["_type"].toString();
|
||||
if(jsonObject["success"].toBool()==true)
|
||||
if(jsonObject["success"].toBool())
|
||||
{
|
||||
//qDebug()<<m_pLedCard->m_strCardId +"---------"+ strType;
|
||||
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")
|
||||
if(strType == "GetSwitchWiFi")
|
||||
{
|
||||
groupBox_3->setChecked(jsonObject["enable"].toBool());
|
||||
}
|
||||
|
@ -1314,37 +1316,9 @@ void ControlNetConfigWidget::OnProHttpResponseAll(QString url, QString postMD5,
|
|||
}
|
||||
QJsonObject jsonObject = document.object();
|
||||
QString strType=jsonObject["_type"].toString();
|
||||
if(jsonObject["success"].toBool()==true)
|
||||
{
|
||||
qDebug()<<m_pLedCard->m_strCardId +"---------"+ strType;
|
||||
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();
|
||||
if(jsonObject["success"].toBool()) {
|
||||
if(strType == "GetSwitchWiFi") groupBox_3->setChecked(jsonObject["enable"].toBool());
|
||||
else if(strType == "GetWifiList") {
|
||||
QJsonValue value = jsonObject.take("wifiList");
|
||||
QJsonArray array= value.toArray();
|
||||
int iSize=array.size();
|
||||
|
|
|
@ -42,7 +42,6 @@ protected slots:
|
|||
void changeEvent(QEvent *) override;
|
||||
void transUi();
|
||||
|
||||
void onReadbackWireNetwork();
|
||||
void onSetWiFiModel();
|
||||
void onReadbackWiFiModel();
|
||||
void onSetAp();
|
||||
|
|
|
@ -236,7 +236,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
|
|||
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg] {
|
||||
Def_CtrlSingleGetReply
|
||||
waitingDlg->close();
|
||||
comboBox->clear();
|
||||
fdPkg->clear();
|
||||
auto apps = json["apps"].toArray();
|
||||
auto infoDlg = new QDialog(this);
|
||||
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++) {
|
||||
auto app = apps.at(i);
|
||||
QString packageName = app["packageName"].toString();
|
||||
comboBox->addItem(packageName);
|
||||
table->setItem(i, "apk", new QTableWidgetItem{app["appName"].toString()});
|
||||
table->setItem(i, "ver", new QTableWidgetItem{app["versionName"].toString()});
|
||||
table->setItem(i, "pkg", new QTableWidgetItem{packageName});
|
||||
if(! (packageName.endsWith(".cardsystem") || packageName.endsWith(".systemcore") || packageName.endsWith(".update"))) fdPkg->addItem(packageName);
|
||||
}
|
||||
infoDlg->show();
|
||||
});
|
||||
|
@ -289,15 +289,75 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
|
|||
});
|
||||
hBox->addWidget(btnApkUpgrade);
|
||||
|
||||
comboBox = new QComboBox;
|
||||
comboBox->setMinimumWidth(200);
|
||||
hBox->addWidget(comboBox);
|
||||
fdPkg = new QComboBox;
|
||||
fdPkg->setEditable(true);
|
||||
fdPkg->setMinimumWidth(200);
|
||||
hBox->addWidget(fdPkg);
|
||||
|
||||
pushButton_unistall = new QPushButton;
|
||||
hBox->addWidget(pushButton_unistall);
|
||||
fdUnload = new QPushButton;
|
||||
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;
|
||||
hBox->addWidget(pushButtonRunningCheck);
|
||||
btnRunningCheck = new QPushButton;
|
||||
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();
|
||||
|
||||
|
@ -885,8 +945,8 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
|
|||
pushButtonSetREaltimeServer->setProperty("ssType", "progManageTool");
|
||||
pushButtonClearRealtimerAddress->setProperty("ssType", "progManageTool");
|
||||
pushButtonRestart->setProperty("ssType", "progManageTool");
|
||||
pushButton_unistall->setProperty("ssType", "progManageTool");
|
||||
pushButtonRunningCheck->setProperty("ssType", "progManageTool");
|
||||
fdUnload->setProperty("ssType", "progManageTool");
|
||||
btnRunningCheck->setProperty("ssType", "progManageTool");
|
||||
pushButtonFpgaUpgrade->setProperty("ssType", "progManageTool");
|
||||
pushButtonFpgaVerCheck->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(pushButton_unistall,SIGNAL(clicked()),this,SLOT(OnUnistall()));
|
||||
connect(pushButtonRunningCheck,SIGNAL(clicked()),this,SLOT(OnRunningCheck()));
|
||||
connect(pushButtonFpgaUpgrade,SIGNAL(clicked()),this,SLOT(OnFpgaUpgrade()));
|
||||
connect(pushButtonFpgaVerCheck,SIGNAL(clicked()),this,SLOT(OnFpgaVerCheck()));
|
||||
connect(pushButtonSyncFpgaVer,SIGNAL(clicked()),this,SLOT(OnSyncFpgaVer()));
|
||||
|
@ -937,7 +994,6 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
|
|||
m_pGetAskTimer = new QTimer(this);
|
||||
connect(this, SIGNAL(sigSend(QJsonObject &,QString)), parent->parent(), SLOT(OnControlSendJson(QJsonObject &,QString)));
|
||||
|
||||
|
||||
connect(pHpptClient,SIGNAL(httpGetRspReady(QString , QByteArray )),this,SLOT(OnProHttpGetResponse(QString , QByteArray)));
|
||||
|
||||
connect(btnM80Set,SIGNAL(clicked()),this,SLOT(OnM80Set()));
|
||||
|
@ -988,8 +1044,6 @@ void CtrlAdvancedPanel::init() {
|
|||
bool isSingle = gSelCards->count()==1;
|
||||
btnApkUpgrade->setEnabled(isSingle);
|
||||
btnApkCheck->setEnabled(isSingle);
|
||||
pushButton_unistall->setEnabled(isSingle);
|
||||
pushButtonRunningCheck->setEnabled(isSingle);
|
||||
pushButtonFpgaUpgrade->setEnabled(isSingle);
|
||||
pushButtonFpgaVerCheck->setEnabled(isSingle);
|
||||
pushButtonSyncFpgaVer->setEnabled(isSingle);
|
||||
|
@ -1087,13 +1141,13 @@ void CtrlAdvancedPanel::transUi() {
|
|||
btnMinBrightGet->setText(tr("Readback"));
|
||||
pushButtonReadbackMaxBrightess->setText(tr("Readback"));
|
||||
pushButtonRestart->setText(tr("Restart led controller system"));
|
||||
pushButtonRunningCheck->setText(tr("Running check"));
|
||||
btnRunningCheck->setText(tr("Running check"));
|
||||
pushButtonSendMaxBrightness->setText(tr("Send"));
|
||||
btnMinBrightSet->setText(tr("Send"));
|
||||
pushButtonSetREaltimeServer->setText(tr("Set"));
|
||||
btnWebServerSet->setText(tr("Set"));
|
||||
pushButtonSyncFpgaVer->setText(tr("Sync FPGA version"));
|
||||
pushButton_unistall->setText(tr("Uninstall"));
|
||||
fdUnload->setText(tr("Uninstall"));
|
||||
radioButton0degrees->setText(tr("0 degrees"));
|
||||
radioButton180degrees->setText(tr("180 degrees"));
|
||||
radioButton270degrees->setText(tr("270 degrees"));
|
||||
|
@ -1245,12 +1299,6 @@ void CtrlAdvancedPanel::OnProHttpResponse(QString url, QString, QByteArray data)
|
|||
MACRO_POSTING_DLG_UNLOCK
|
||||
QMessageBox::information(gMainWin, tr("Tip"),tr("UpgradeSoftware")+tr("Success"));
|
||||
}
|
||||
else if(strType == "UninstallSoftware"){
|
||||
|
||||
MACRO_ASKTIME_STOP
|
||||
MACRO_POSTING_DLG_UNLOCK
|
||||
|
||||
}
|
||||
else if(strType == "SynchronousHardwareVersion"){
|
||||
|
||||
MACRO_ASKTIME_STOP
|
||||
|
@ -1314,17 +1362,6 @@ void CtrlAdvancedPanel::OnProHttpResponse(QString url, QString, QByteArray data)
|
|||
}
|
||||
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") {
|
||||
MACRO_ASKTIME_STOP
|
||||
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()
|
||||
{
|
||||
QString url="http://"+m_pLedCard->m_strCardIp+":2016/upload?type=hardware";
|
||||
|
|
|
@ -53,8 +53,6 @@ protected slots:
|
|||
void OnClearRealtimeServer();
|
||||
void OnStartConfigLedScreenSoft();
|
||||
void OnRestart();
|
||||
void OnUnistall();
|
||||
void OnRunningCheck();
|
||||
void OnFpgaUpgrade();
|
||||
void OnFpgaVerCheck();
|
||||
void OnSyncFpgaVer();
|
||||
|
@ -104,9 +102,9 @@ private:
|
|||
QPushButton *pushButtonClearRealtimerAddress;
|
||||
QPushButton *btnApkCheck;
|
||||
QPushButton *btnApkUpgrade;
|
||||
QComboBox *comboBox;
|
||||
QPushButton *pushButton_unistall;
|
||||
QPushButton *pushButtonRunningCheck;
|
||||
QComboBox *fdPkg;
|
||||
QPushButton *fdUnload;
|
||||
QPushButton *btnRunningCheck;
|
||||
QPushButton *pushButtonFpgaUpgrade;
|
||||
QPushButton *pushButtonFpgaVerCheck;
|
||||
QPushButton *pushButtonSyncFpgaVer;
|
||||
|
|
|
@ -126,7 +126,8 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
|
|||
connect(reply, &QNetworkReply::finished, this, [reply, card] {
|
||||
QJsonDocument 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);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,12 +15,14 @@ EVideo *EVideo::create(const QString &file, PageListItem *pageItem, EBase *multi
|
|||
QString err = Tools::videoInfo(file.toUtf8(), img, &dur, &codecId);
|
||||
if(! err.isEmpty()) {
|
||||
QMessageBox::critical(gMainWin, "Video Error", err+"\n"+file);
|
||||
return nullptr;
|
||||
return 0;
|
||||
}
|
||||
QFileInfo rawInfo(file);
|
||||
QString rawName = rawInfo.fileName();
|
||||
QString outFile = transcoding(file, rawName, pageItem->mPageDir, img.width(), img.height(), codecId);
|
||||
if(outFile.isEmpty()) return 0;
|
||||
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);
|
||||
}
|
||||
EVideo *EVideo::create(const QJsonObject &json, PageListItem *pageItem, EBase *multiWin) {
|
||||
|
@ -182,9 +184,9 @@ QWidget* EVideo::attrWgt() {
|
|||
playDuration = dur/1000000;
|
||||
fdDuration->setValue(playDuration);
|
||||
QString outFile = transcoding(rawFile, mRawName, mPageItem->mPageDir, mCoverImg.width(), mCoverImg.height(), codecId);
|
||||
if(outFile.isEmpty()) return;
|
||||
QFile oldfile(mDir+"/"+mName);
|
||||
if(oldfile.exists()) oldfile.remove();
|
||||
|
||||
QFileInfo outInfo(outFile);
|
||||
mDir = outInfo.absolutePath();
|
||||
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) {
|
||||
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] {
|
||||
auto txt = QString::fromUtf8(process.readAllStandardOutput());
|
||||
qInfo()<<"StandardOutput";
|
||||
qInfo()<<txt;
|
||||
auto data = process.readAllStandardOutput();
|
||||
qInfo()<<"EVideo::transcoding StandardOutput";
|
||||
qInfo()<<data.data();
|
||||
});
|
||||
int dur = 0;
|
||||
connect(&process, &QProcess::readyReadStandardError, &msgBox, [&process, &msgBox, &dur] {
|
||||
auto txt = QString::fromUtf8(process.readAllStandardError());
|
||||
QString err;
|
||||
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) {
|
||||
int idx = txt.indexOf("Duration: ");
|
||||
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) {
|
||||
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)+"% ");
|
||||
}
|
||||
} else err.append(txt).append("\n");
|
||||
}
|
||||
});
|
||||
process.start("ffmpeg", {"-y", "-i", rawFile, "-vcodec", "h264", "-s", QString::number(w)+"x"+QString::number(h), outFile});
|
||||
msgBox.exec();
|
||||
if(err.right(32).contains("Conversion failed!")) {
|
||||
QMessageBox::critical(gMainWin, tr("Error"), err);
|
||||
return "";
|
||||
}
|
||||
return outFile;
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ ProgEditorWin::ProgEditorWin(QString &name, int &w, int &h, QString &remarks, co
|
|||
QJsonParseError jsErr;
|
||||
QJsonObject prog = QJsonDocument::fromJson(value.toUtf8(), &jsErr).object();
|
||||
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);
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
#include "gqt.h"
|
||||
#include <QGroupBox>
|
||||
#include <QLabel>
|
||||
#include <QSpinBox>
|
||||
#include <QToolButton>
|
||||
#include <QPushButton>
|
||||
#include <QButtonGroup>
|
||||
#include <QPainter>
|
||||
#include <QTableWidget>
|
||||
#include <QHeaderView>
|
||||
#include <QMouseEvent>
|
||||
#include <QDebug>
|
||||
|
||||
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 fdCardRowNum = new QSpinBox;
|
||||
auto fdCardWidth = new QSpinBox;
|
||||
auto fdCardHeight = new QSpinBox;
|
||||
{
|
||||
auto vBox = new QVBoxLayout(gBox);
|
||||
auto hhh = new QHBoxLayout;
|
||||
|
@ -86,6 +84,7 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
|
|||
lb = new QLabel("卡宽度: ");
|
||||
hhh->addWidget(lb);
|
||||
|
||||
fdCardWidth = new QSpinBox;
|
||||
fdCardWidth->setRange(0, 9999);
|
||||
fdCardWidth->setValue(128);
|
||||
hhh->addWidget(fdCardWidth);
|
||||
|
@ -93,6 +92,7 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
|
|||
lb = new QLabel("卡高度: ");
|
||||
hhh->addWidget(lb);
|
||||
|
||||
fdCardHeight = new QSpinBox;
|
||||
fdCardHeight->setRange(0, 9999);
|
||||
fdCardHeight->setValue(128);
|
||||
hhh->addWidget(fdCardHeight);
|
||||
|
@ -103,7 +103,7 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
|
|||
auto hhh = new QHBoxLayout(gBox);
|
||||
|
||||
auto pal = palette();
|
||||
auto fdNet = new QButtonGroup(gBox);
|
||||
fdNet = new QButtonGroup(gBox);
|
||||
for(int i=0; i<netss.size(); i++) {
|
||||
auto bn = new QPushButton(QString::number(i+1));
|
||||
bn->setCheckable(true);
|
||||
|
@ -177,15 +177,7 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
|
|||
hhh->addWidget(bnRefresh);
|
||||
|
||||
auto bnBack = new QPushButton("后退");
|
||||
connect(bnBack, &QPushButton::clicked, this, [this, fdNet] {
|
||||
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();
|
||||
});
|
||||
connect(bnBack, &QPushButton::clicked, this, &ExpertScreenConnWin::connBack);
|
||||
hhh->addWidget(bnBack);
|
||||
|
||||
hhh->addStretch();
|
||||
|
@ -200,28 +192,33 @@ ExpertScreenConnWin::ExpertScreenConnWin(QWidget *parent) : QWidget{parent} {
|
|||
table->verticalHeader()->setDefaultAlignment(Qt::AlignCenter);
|
||||
table->verticalHeader()->setDefaultSectionSize(90);
|
||||
table->verticalHeader()->setMinimumWidth(30);
|
||||
table->setSelectionMode(QTableWidget::SingleSelection);
|
||||
connect(table, &QTableWidget::currentCellChanged, this, [this, fdNet, fdCardWidth, fdCardHeight](int row, int column) {
|
||||
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;
|
||||
table->setSelectionMode(QTableWidget::NoSelection);
|
||||
connect(table, &QTableWidget::currentCellChanged, this, &ExpertScreenConnWin::conn);
|
||||
connect(fdCardColNum, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, table, &QTableWidget::setColumnCount);
|
||||
connect(fdCardRowNum, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, table, &QTableWidget::setRowCount);
|
||||
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);
|
||||
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(fdCardRowNum, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, table, &QTableWidget::setRowCount);
|
||||
hh->addWidget(table);
|
||||
}
|
||||
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) {
|
||||
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -2,12 +2,19 @@
|
|||
#define EXPERTSCREENCONNWIN_H
|
||||
|
||||
#include <QTableWidget>
|
||||
#include <QSpinBox>
|
||||
#include <QButtonGroup>
|
||||
|
||||
class CardTable;
|
||||
class ExpertScreenConnWin : public QWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ExpertScreenConnWin(QWidget *parent = nullptr);
|
||||
void conn(int row, int column);
|
||||
void connBack();
|
||||
QButtonGroup *fdNet;
|
||||
QSpinBox *fdCardWidth;
|
||||
QSpinBox *fdCardHeight;
|
||||
CardTable *table;
|
||||
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} {}
|
||||
ExpertScreenConnWin *win;
|
||||
protected:
|
||||
void paintEvent(QPaintEvent *event);
|
||||
void paintEvent(QPaintEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
};
|
||||
|
||||
#endif // EXPERTSCREENCONNWIN_H
|
||||
|
|
|
@ -312,14 +312,27 @@ ExpertSmartPointSetWin::ExpertSmartPointSetWin(QWidget *parent) : BaseWin{parent
|
|||
|
||||
auto hhh = new QHBoxLayout;
|
||||
|
||||
auto bnReset = new QPushButton("重新走点");
|
||||
bnReset->setMinimumSize(90, 30);
|
||||
connect(bnReset, &QPushButton::clicked, this, [this] {
|
||||
auto btnReset = new QPushButton("重新走点");
|
||||
btnReset->setMinimumSize(90, 30);
|
||||
connect(btnReset, &QPushButton::clicked, this, [this] {
|
||||
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();
|
||||
vBox->addLayout(hhh);
|
||||
|
@ -331,9 +344,12 @@ ExpertSmartPointSetWin::ExpertSmartPointSetWin(QWidget *parent) : BaseWin{parent
|
|||
table->verticalHeader()->setMinimumWidth(40);
|
||||
table->verticalHeader()->setDefaultAlignment(Qt::AlignCenter);
|
||||
table->setSelectionMode(QTableWidget::SingleSelection);
|
||||
connect(table, &QTableWidget::currentCellChanged, this, [this](int currentRow, int currentColumn) {
|
||||
auto item = table->item(currentRow, currentColumn);
|
||||
if(! item) table->setItem(currentRow, currentColumn, new QTableWidgetItem(QString::number(++curPoint)));
|
||||
connect(table, &QTableWidget::currentCellChanged, this, [this](int row, int col) {
|
||||
if(row < 0) return;
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -21,8 +21,8 @@ public:
|
|||
|
||||
QSpinBox *fdModuleWidth, *fdModuleHeight;
|
||||
PointTable *table;
|
||||
QList<QPoint> points;
|
||||
int moduleWidth{0}, moduleHeight{0};
|
||||
int curPoint{0};
|
||||
};
|
||||
|
||||
#endif // EXPERTSMARTPOINTSETWIN_H
|
||||
|
|
|
@ -79,7 +79,7 @@ QRadioButton::indicator:checked {border-image: url(:/imgs/radio-check.png);}
|
|||
|
||||
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;}
|
||||
|
||||
QSlider::horizontal {height: 16px;}
|
||||
|
|
|
@ -15,16 +15,23 @@
|
|||
|
||||
class ImgBtn : public QToolButton {
|
||||
public:
|
||||
ImgBtn(QIcon icon) {
|
||||
setIcon(icon);
|
||||
setStyleSheet("QToolButton{border: none;}");
|
||||
ImgBtn() {
|
||||
setStyleSheet("QToolButton{border: none; padding-top: 4px;}");
|
||||
}
|
||||
bool isEnter{false};
|
||||
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;}");
|
||||
setIconSize(QSize(width(), width()));
|
||||
}
|
||||
void leaveEvent(QEvent *) override {
|
||||
void leaveEvent(QEvent *event) override {
|
||||
QToolButton::leaveEvent(event);
|
||||
setIconSize(QSize(width()-8, width()-8));
|
||||
setStyleSheet("QToolButton{border: none; padding-top: 4px;}");
|
||||
}
|
||||
|
@ -40,12 +47,14 @@ inline QLabel *newSubLabel(QString txt){
|
|||
lb->setAlignment(Qt::AlignCenter);
|
||||
return lb;
|
||||
}
|
||||
void addImg(QHBoxLayout *parent, ImgBtn* imgBtn, QString txt) {
|
||||
imgBtn->setText(txt);
|
||||
ImgBtn *addImg(QHBoxLayout *parent, const QIcon &icon, const QString &text) {
|
||||
auto imgBtn = new ImgBtn();
|
||||
imgBtn->setIcon(icon);
|
||||
imgBtn->setText(text);
|
||||
imgBtn->setFixedSize(76, 100);
|
||||
imgBtn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
|
||||
imgBtn->setIconSize(QSize(76, 76));
|
||||
parent->addWidget(imgBtn);
|
||||
return imgBtn;
|
||||
}
|
||||
|
||||
MainWin::MainWin() {
|
||||
|
@ -58,8 +67,7 @@ MainWin::MainWin() {
|
|||
vBox->addLayout(addBtns(new QHBoxLayout()));
|
||||
|
||||
QHBoxLayout *imgsBar = new QHBoxLayout();
|
||||
ImgBtn *btnImg;
|
||||
addImg(imgsBar, btnImg = new ImgBtn(QPixmap(":/imgs/fast.png").scaledToWidth(128, Qt::SmoothTransformation)), "快速调屏");
|
||||
auto btnImg = addImg(imgsBar, QPixmap(":/imgs/fast.png").scaledToWidth(128, Qt::SmoothTransformation), "快速调屏");
|
||||
connect(btnImg, &ImgBtn::clicked, this, [=](){
|
||||
(new Fast(this))->show();
|
||||
// if(win==0) {
|
||||
|
@ -71,32 +79,32 @@ MainWin::MainWin() {
|
|||
// 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, [=](){
|
||||
(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, [=](){
|
||||
(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, [=](){
|
||||
|
||||
});
|
||||
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, [=](){
|
||||
|
||||
});
|
||||
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, [=](){
|
||||
//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, [=](){
|
||||
auto ins = PcapWin::newIns(this);
|
||||
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, [=](){
|
||||
//qDebug()<<"geometry"<<win->geometry()<<"screen"<<win->screen();
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user