ledok预览增加hdr视频适配

This commit is contained in:
gangphon 2022-09-26 18:10:47 +08:00
parent 00d62064f5
commit 757655024d
31 changed files with 2223 additions and 2380 deletions

4
.gitignore vendored
View File

@ -20,8 +20,10 @@ moc_*.cpp
qrc_*.cpp
ui_*.h
Makefile*
*-build-*
build-*
# QtCreator
*.autosave
*-old/*

View File

@ -19,7 +19,6 @@ CONFIG += embed_translations
TARGET = $$quote(LedOK Express)
VERSION = 1.2.9
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
DEFINES += QT_USE_FAST_OPERATOR_PLUS
msvc {
QMAKE_CXXFLAGS += -execution-charset:utf-8
QMAKE_CXXFLAGS += -source-charset:utf-8
@ -57,7 +56,6 @@ SOURCES += \
base/lodateselector.cpp \
base/loqtitlebar.cpp \
base/loqtreewidget.cpp \
base/networkmanager.cpp \
base/table.cpp \
base/waitingdlg.cpp \
basedlg.cpp \
@ -94,7 +92,6 @@ SOURCES += \
tipdialog.cpp \
tools.cpp \
wDevicesManager/controlencryptwidget.cpp \
wDevicesManager/controlhdmimanual.cpp \
wDevicesManager/controlhdmischedule.cpp \
wDevicesManager/controlhdmiwidget.cpp \
wDevicesManager/controlnetconfigwidget.cpp \
@ -161,7 +158,6 @@ HEADERS += \
base/lodateselector.h \
base/loqtitlebar.h \
base/loqtreewidget.h \
base/networkmanager.h \
base/table.h \
base/waitingdlg.h \
basedlg.h \
@ -197,7 +193,6 @@ HEADERS += \
tipdialog.h \
tools.h \
wDevicesManager/controlencryptwidget.h \
wDevicesManager/controlhdmimanual.h \
wDevicesManager/controlhdmischedule.h \
wDevicesManager/controlhdmiwidget.h \
wDevicesManager/controlnetconfigwidget.h \
@ -251,7 +246,6 @@ FORMS += \
mguangyingpinwidget.ui \
tipdialog.ui \
wDevicesManager/controlencryptwidget.ui \
wDevicesManager/controlhdmimanual.ui \
wDevicesManager/controlhdmischedule.ui \
wDevicesManager/controlhdmiwidget.ui \
wDevicesManager/controlpowermanual.ui \

View File

@ -1,8 +0,0 @@
#include "networkmanager.h"
NetworkManager::NetworkManager(QObject *parent) : QObject{parent} {
}
void NetworkManager::post(const QNetworkRequest &request, const QByteArray &data) {
QNetworkReply* reply = mManager.post(request, data);
}

View File

@ -1,18 +0,0 @@
#ifndef NETWORKMANAGER_H
#define NETWORKMANAGER_H
#include <QNetworkAccessManager>
class NetworkManager : public QObject {
Q_OBJECT
public:
explicit NetworkManager(QObject *parent = nullptr);
void post(const QNetworkRequest&, const QByteArray &data);
QNetworkAccessManager mManager;
signals:
};
#endif // NETWORKMANAGER_H

View File

@ -102,7 +102,7 @@ void HpptClient::onHttpGetRspFinished(QNetworkReply *reply) {
clearRp(reply);
}
void HpptClient::onHttpPostRspProgress(qint64 bytesReceived, qint64 bytesTotal){
void HpptClient::onHttpPostRspProgress(qint64, qint64 bytesTotal){
if(sender() == NULL) return;
QNetworkReply* rp = qobject_cast<QNetworkReply*>(sender());
if(rp == NULL) return;

View File

@ -131,6 +131,7 @@ QPushButton:hover {background-color: #08b;}
auto senderAddress = gram.senderAddress();
bool ok = true;
if(senderAddress.protocol()==QUdpSocket::IPv6Protocol) senderAddress.setAddress(senderAddress.toIPv4Address(&ok));
auto addr = ok ? senderAddress.toString() : "";
if(data.startsWith("{\"")) {
QJsonParseError error;
QJsonDocument document = QJsonDocument::fromJson(gram.data(), &error);
@ -138,10 +139,10 @@ QPushButton:hover {background-color: #08b;}
qDebug()<<"DeviceItem OnProHttpResponse 解析json文件错误";
continue;
}
pNetComm->JieXiQJsonObjectOfLedCardInfo(document.object(), ok ? senderAddress.toString() : "");
pNetComm->JieXiQJsonObjectOfLedCardInfo(document.object(), addr);
} else {
STREAM_PACKET *pStreamPacket = (STREAM_PACKET *)gram.data().data();
pNetComm->JieXiQJsonObjectOfLedCardInfoOld(pStreamPacket->ucSerialCode, ok ? senderAddress.toString() : "");
pNetComm->JieXiQJsonObjectOfLedCardInfoOld(pStreamPacket->ucSerialCode, addr);
}
}
});

View File

@ -42,7 +42,15 @@ AVFmt::AVFmt(QByteArray url) {
qInfo()<<"Couldn't open Video Codec Ctx";
} else {
sws_ctx = sws_getContext(vi.ctx->width, vi.ctx->height, vi.ctx->pix_fmt, vi.ctx->width, vi.ctx->height, AV_PIX_FMT_RGB24, SWS_FAST_BILINEAR, nullptr, nullptr, nullptr);
qInfo()<<vi.ctx->width<<"x"<<vi.ctx->height<<vi.ctx->framerate.num<<"/"<<vi.ctx->framerate.den;
qInfo()<<vi.ctx->width<<"x"<<vi.ctx->height<<vi.ctx->framerate.num<<"/"<<vi.ctx->framerate.den<<"color_primaries"<<vi.ctx->color_primaries<<"colorspace"<<vi.ctx->colorspace;
if(vi.ctx->color_primaries==AVCOL_PRI_BT2020) {
res = sws_setColorspaceDetails(sws_ctx, sws_getCoefficients(SWS_CS_BT2020), 0, sws_getCoefficients(SWS_CS_DEFAULT), 0, -0x2200, 0x1c000, 0x18000); //0x12800, 0x40000
qInfo()<<"sws_setColorspaceDetails"<<res;
if(res < 0) {
err = "Colorspace not support";
return;
}
}
vi.time_num = viStream->time_base.num * 1000000;
vi.time_den = viStream->time_base.den;
vi.start = viStream->start_time * vi.time_num / vi.time_den;

View File

@ -0,0 +1,61 @@
#include "elevideo.h"
#include "tools.h"
#include <QPainter>
#include <QMessageBox>
#include <QMutex>
static void *lock(void *opaque, void **planes) {
auto that = (EleVideo *) opaque;
that->imgRaw = QImage(that->mWidth, that->mHeight, QImage::Format_RGB32);
*planes = that->imgRaw.bits(); /*tell VLC to put decoded data to this buffer*/
return 0; /* picture identifier, not needed here */
}
static void unlock(void *opaque, void *picture, void *const *planes) {
}
static void display(void *opaque, void *picture) {
auto that = (EleVideo *) opaque;
that->emDisplay(that->imgRaw);
}
EleVideo::EleVideo(QString path, QWidget *parent) : QWidget{parent} {
vlc = libvlc_new(0, NULL);
auto pathChars = path.replace("/","\\").toUtf8();
auto media = libvlc_media_new_path(vlc, pathChars.data());
qDebug()<<"media"<<media;
libvlc_media_parse(media);
//libvlc_media_add_option(media, ":avcodec-hw=none");
player = libvlc_media_player_new_from_media(media);
libvlc_media_release(media);
libvlc_video_get_size(player, 0, &mWidth, &mHeight);
qDebug()<<" size"<<mWidth<<mHeight;
libvlc_video_set_callbacks(player, lock, unlock, display, this);
libvlc_video_set_format(player, "RV32", mWidth, mHeight, mWidth * 4);
libvlc_video_set_adjust_int(player, libvlc_adjust_Enable, 1);
libvlc_video_set_adjust_float(player, libvlc_adjust_Brightness, 1.1); //Value ranges from 0.0 to 2.0
libvlc_video_set_adjust_float(player, libvlc_adjust_Contrast, 1.5);
libvlc_video_set_adjust_float(player, libvlc_adjust_Saturation, 3);
connect(this, &EleVideo::emDisplay, this, [this](QImage aimg){
img = aimg;
update();
});
}
//void EleVideo::mouseDoubleClickEvent(QMouseEvent *) {
// qDebug()<<"img"<<img;
// qDebug()<<"img"<<player->img;
// qDebug()<<"viCurTime"<<player->viCurTime;
// qDebug()<<"viSize"<<player->viSize;
//}
void EleVideo::showEvent(QShowEvent *) {
if(player!=nullptr) libvlc_media_player_play(player);
}
void EleVideo::hideEvent(QHideEvent *) {
if(player!=nullptr) libvlc_media_player_stop(player);
}
void EleVideo::paintEvent(QPaintEvent *e) {
QWidget::paintEvent(e);
QPainter painter(this);
painter.drawImage(QRectF(0, 0, width(), height()), img);
}

View File

@ -0,0 +1,29 @@
#ifndef ELEVIDEO_H
#define ELEVIDEO_H
#include <QWidget>
#include <vlc/include/vlc/vlc.h>
class EleVideo : public QWidget {
Q_OBJECT
public:
explicit EleVideo(QString path, QWidget *parent = nullptr);
~EleVideo() {
if(vlc) libvlc_release(vlc);
if(player) libvlc_media_player_release(player);
}
unsigned mWidth{0}, mHeight{0};
QImage imgRaw;
QImage img;
libvlc_instance_t *vlc{0};
libvlc_media_player_t *player{0};
protected:
void paintEvent(QPaintEvent *) override;
void showEvent(QShowEvent *) override;
void hideEvent(QHideEvent *) override;
signals:
void emDisplay(QImage img);
};
#endif // ELEVIDEO_H

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

@ -1,212 +0,0 @@
#include "controlhdmimanual.h"
#include "ui_controlhdmimanual.h"
#include "LoUIClass/x_uimsgboxok.h"
#include <QMessageBox>
#include <QJsonObject>
#include <QJsonDocument>
#include <globaldefine.h>
#include "tools.h"
extern QWidget *gMainWin;
ControlHdmiManual::ControlHdmiManual(QWidget *parent,QList<LedCard *> *list) :
QWidget(parent),
ui(new Ui::ControlHdmiManual)
{
ui->setupUi(this);
refreshLable();
setStyleSheet(Tools::styleSheet());
onSelectedDeviceList(list);
ui->pushButtonReadback->setProperty("ssType", "progManageTool");
ui->widget->setSliderColor(QColor(0, 160, 230),QColor(0, 160, 230));
ui->widget->setBgColor(QColor(200,200,200),QColor(200,200,200));
connect(ui->widget, SIGNAL(checkedChanged(bool)), this, SLOT(onVideoSourceChecked(bool)));
connect(ui->pushButtonReadback,SIGNAL(clicked()),this,SLOT(OnReadback()));
MARCO_DEFINE_CONTROL_FUNC2(parent->parent()->parent(),parent->parent())
}
ControlHdmiManual::~ControlHdmiManual()
{
delete ui;
if(pHpptClient != nullptr)
{
qDebug() <<"delete pHpptClient in ~NetComm";
delete pHpptClient;
pHpptClient=nullptr;
}
if(pHpptClientAll != nullptr)
{
qDebug() <<"delete pHpptClientAll in ~NetComm";
delete pHpptClientAll;
pHpptClientAll=nullptr;
}
}
void ControlHdmiManual::refreshLable()
{
ui->labelHdmiIn->setText(tr("HDMI IN"));
ui->labelAsync->setText(tr("Async"));
ui->pushButtonReadback->setText(tr("Readback"));
}
void ControlHdmiManual::onVideoSourceChecked(bool b)
{
if(m_pLedlist==nullptr)
return;
if(m_pLedlist->count()<=1)
{
if(m_pLedCard==nullptr||m_pLedlist->count()==0)
{
X_UIMsgBoxOk *pDlg=new X_UIMsgBoxOk(tr("Tip"),tr("NoSelectedController"),this,1);
pDlg->exec();
return;
}
}
QJsonObject json;
json.insert("_id", getRandomString(10));
json.insert("_type", "SyncSwitch");
json.insert("switchOn", b);
if(m_pLedlist->count()==1)
{
HttpPostByTypeJsonObject(pHpptClient,m_strUrl,json);
if(m_PostingDlg==nullptr)
{
m_PostingDlg = new LoEmptyDialog(this);
connect(m_PostingDlg,SIGNAL(sigClose()),this,SLOT(DeletePostingDlg()));
connect(m_pGetAskTimer,SIGNAL(timeout()),m_PostingDlg,SLOT(TimerOutUnlock()));
if(b)
m_PostingDlg->lock(tr("SyncSwitch"),tr("Success"),tr("SyncSwitch")+tr("failed"));
else
m_PostingDlg->lock(tr("AnSyncSwitch"),tr("Success"),tr("AnSyncSwitch")+tr("failed"));
m_pGetAskTimer->start(3000);
m_PostingDlg->exec();
}
}
else {
if(b)
emit sigSend(json,tr("SyncSwitch"));
else
emit sigSend(json,tr("AnSyncSwitch"));
}
}
void ControlHdmiManual::OnReadback()
{
CHECK_CARD_SELECTED
QJsonObject json;
json.insert("_id", getRandomString(10));
json.insert("_type", "IsSync");
MACRO_DEFINE_TIPDLG_FUCN(tr("IsSync"),tr("Success"),tr("failed"))
}
void ControlHdmiManual::onSelectedDeviceList(QList<LedCard*> *list)
{
m_pLedlist=list;
if(m_pLedlist==nullptr)
return;
MACRO_DEFINE_CONTROL_FUNC3
}
//获取到httpPost的应答如果参数变化需要出发修改控件item的内容
void ControlHdmiManual::OnProHttpResponse(QString url, QString postMD5, QByteArray data)
{
Q_UNUSED(postMD5)
//qDebug()<< url + "\r\n"+m_strUrl;
if(url == m_strUrl)
{
QJsonParseError parseJsonErr;
QJsonDocument document = QJsonDocument::fromJson(data,&parseJsonErr);
if(!(parseJsonErr.error == QJsonParseError::NoError))
{
if(data.size()==0)
qDebug()<<"json is empty";
else
qDebug()<<tr("DeviceItem OnProHttpResponse 解析json文件错误");
return;
}
QJsonObject jsonObject = document.object();
QString strType=jsonObject["_type"].toString();
if(jsonObject["success"].toBool()==true)
{
qDebug()<<m_pLedCard->m_strCardId +"---------"+ strType;
if(strType == "SyncSwitch")
{
//emit sigOutputInfo(m_pLedCard->m_strCardId+":"+tr("receive")+"<-"+tr("SetBrightness")+":"+tr("success"));
}
else if(strType == "IsSync"){
ui->widget->setCheckedStatus(jsonObject["switchOn"].toBool());
}
MACRO_ASKTIME_STOP
MACRO_POSTING_DLG_UNLOCK
}
}
}
//获取到httpPost的应答如果参数变化需要出发修改控件item的内容
void ControlHdmiManual::OnProHttpResponseAll(QString url, QString postMD5, QByteArray data)
{
Q_UNUSED(postMD5)
//qDebug()<< url + "\r\n"+m_strUrl;
if(url == m_strUrl)
{
QJsonParseError parseJsonErr;
QJsonDocument document = QJsonDocument::fromJson(data,&parseJsonErr);
if(!(parseJsonErr.error == QJsonParseError::NoError))
{
if(data.size()==0)
qDebug()<<"json is empty";
else
qDebug()<<tr("DeviceItem OnProHttpResponse 解析json文件错误");
return;
}
QJsonObject jsonObject = document.object();
QString strType=jsonObject["_type"].toString();
if(jsonObject["success"].toBool()==true)
{
qDebug()<<m_pLedCard->m_strCardId +"---------"+ strType;
if(strType == "IsSync"){
ui->widget->setCheckedStatus(jsonObject["switchOn"].toBool());
}
MACRO_ASKTIME_STOP
MACRO_POSTING_DLG_UNLOCK
}
}
}
void ControlHdmiManual::OnControlTypeSwitchIndexChanged(int index)
{
if(index==Setting_HDMI)
{
m_bSelected=true;
if(m_pLedCard!=nullptr)
onReadbackAllThisPage();
}
else {
m_bSelected=false;
}
}
void ControlHdmiManual::onReadbackAllThisPage()
{
if(m_pLedlist==nullptr)
return;
if(m_pLedlist->count()!=1)
return;
QJsonObject json;
json.insert("_id", getRandomString(10));
json.insert("_type", "IsSync");
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json);
MACRO_DEFINE_TIPDLG_ALL_FUCN(tr("Readback"),tr("Success"),tr("failed"))
}
void ControlHdmiManual::DeletePostingDlg()
{
if(m_PostingDlg!=nullptr)
{
delete m_PostingDlg;
m_PostingDlg=nullptr;
}
}

View File

@ -1,47 +0,0 @@
#ifndef CONTROLHDMIMANUAL_H
#define CONTROLHDMIMANUAL_H
#include <QWidget>
#include <wDevicesManager/ledcard.h>
#include <communication/hpptclient.h>
#include <LoUIClass/loemptydialog.h>
namespace Ui {
class ControlHdmiManual;
}
class ControlHdmiManual : public QWidget
{
Q_OBJECT
public:
explicit ControlHdmiManual(QWidget *parent = nullptr,QList<LedCard *> *m_pLedlist=nullptr);
~ControlHdmiManual();
protected slots:
void onVideoSourceChecked(bool);
void OnReadback();
void refreshLable();
private:
Ui::ControlHdmiManual *ui;
//类似的控制操作信号和槽函数和变量定义
signals:
void sigSend(QJsonObject &,QString);
protected slots:
void DeletePostingDlg();
void OnProHttpResponse(QString url, QString postMD5, QByteArray data);
void OnProHttpResponseAll(QString url, QString postMD5, QByteArray data);
void onSelectedDeviceList(QList<LedCard*> *);
void onReadbackAllThisPage();
void OnControlTypeSwitchIndexChanged(int index);
private:
QList<LedCard *> *m_pLedlist=nullptr;
LedCard *m_pLedCard = nullptr;
LedCard *m_oldLedlist = nullptr;
HpptClient *pHpptClient = nullptr;
HpptClient *pHpptClientAll = nullptr;
QString m_strUrl="";
LoEmptyDialog * m_PostingDlg=nullptr;
QTimer *m_pGetAskTimer=nullptr;
bool m_bSelected=false;
};
#endif // CONTROLHDMIMANUAL_H

View File

@ -1,143 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ControlHdmiManual</class>
<widget class="QWidget" name="ControlHdmiManual">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>582</width>
<height>414</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Minimum</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="2">
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<widget class="QFrame" name="frame">
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="labelAsync">
<property name="text">
<string>Program In controller</string>
</property>
</widget>
</item>
<item>
<widget class="SwitchControl" name="widget" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>66</width>
<height>33</height>
</size>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="labelHdmiIn">
<property name="text">
<string>HDMI IN</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item row="1" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1" alignment="Qt::AlignHCenter">
<widget class="QPushButton" name="pushButtonReadback">
<property name="minimumSize">
<size>
<width>60</width>
<height>30</height>
</size>
</property>
<property name="text">
<string>Readback</string>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>SwitchControl</class>
<extends>QWidget</extends>
<header location="global">LoUIClass/switchcontrol.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>

View File

@ -73,7 +73,6 @@ setStyleSheet(Tools::styleSheet());
ui->tableView->setFocusPolicy(Qt::NoFocus);
// connect(parent->parent()->parent(),SIGNAL(sigSelectedDeviceList(QList<LedCard *> *)),this,SLOT(onSelectedDeviceList(QList<LedCard *> *)));
MARCO_DEFINE_CONTROL_FUNC2(parent->parent()->parent(),parent->parent())
connect(ui->pushButtonAdd,SIGNAL(clicked()),this,SLOT(OnClickAdd()));

View File

@ -1,48 +1,170 @@
#include "controlhdmiwidget.h"
#include "ui_controlhdmiwidget.h"
#include "gqt.h"
#include "tools.h"
#include "base/waitingdlg.h"
#include <QMessageBox>
ControlHdmiWidget::ControlHdmiWidget(QWidget *parent,QList<LedCard *> *list) : QWidget(parent) {
auto vBox = new QVBoxLayout(this);
labelHdmiConfiguration = new QLabel;
labelHdmiConfiguration->setAlignment(Qt::AlignCenter);
vBox->addWidget(labelHdmiConfiguration);
auto line = new QFrame;
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
vBox->addWidget(line);
auto hBox = new QHBoxLayout();
hBox->addStretch();
radioButtonManual = new QRadioButton;
hBox->addWidget(radioButtonManual);
hBox->addStretch();
radioButtonSchedule = new QRadioButton;
hBox->addWidget(radioButtonSchedule);
hBox->addStretch();
vBox->addLayout(hBox);
ControlHdmiWidget::ControlHdmiWidget(QWidget *parent,QList<LedCard *> *list) :
QWidget(parent),
ui(new Ui::ControlHdmiWidget)
{
m_pLedlist=list;
ui->setupUi(this);
refreshLable();
setStyleSheet(Tools::styleSheet());
m_pStackedW = new QStackedWidget;
m_pManual = new ControlHdmiManual(this,m_pLedlist);
m_pSchedule = new ControlHdmiSchedule(this,m_pLedlist);
m_pManual = new QWidget;
{
auto vBox = new VBox(m_pManual);
auto hBox = new HBox(vBox);
hBox->addStretch();
lbAsync = new QLabel;
hBox->addWidget(lbAsync);
swich = new SwitchControl;
swich->setMinimumSize(QSize(66, 33));
swich->setBgColor(QColor(200,200,200), QColor(200,200,200));
swich->setSliderColor(QColor(0, 160, 230), QColor(0, 160, 230));
connect(swich, &SwitchControl::checkedChanged, this, [this](bool checked) {
if(gSelCards->isEmpty()) {
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "SyncSwitch");
json.insert("_type", "SyncSwitch");
json.insert("switchOn", checked);
if(gSelCards->count() == 1) {
auto waitingDlg = new WaitingDlg(this, checked ? tr("SyncSwitch") : tr("AnSyncSwitch"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
Def_CtrlSetReqAfter
});
} else {
foreach(auto card, *gSelCards) {
if(checked){
Def_CtrlSetMulti(tr("SyncSwitch"))
} else {
Def_CtrlSetMulti(tr("AnSyncSwitch"))
}
}
}
});
hBox->addWidget(swich);
lbSync = new QLabel;
hBox->addWidget(lbSync);
hBox->addStretch();
vBox->addSpacing(20);
hBox = new HBox(vBox);
hBox->addStretch();
btnGetSync = new QPushButton;
btnGetSync->setMinimumSize(60, 30);
btnGetSync->setProperty("ssType", "progManageTool");
connect(btnGetSync, &QPushButton::clicked, this, [this] {
if(gSelCards->isEmpty()) {
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "IsSync");
json.insert("_type", "IsSync");
if(gSelCards->count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("IsSync"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg] {
Def_CtrlSingleGetReply
waitingDlg->success();
qDebug()<<"IsSync res"<<json;
swich->setCheckedStatus(json["result"].toBool());
});
} 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["result"].toBool() ? "true" : "false";
gFdResInfo->append(card->m_strCardId+" "+tr("IsSync")+" "+err);
});
}
}
});
hBox->addWidget(btnGetSync);
hBox->addStretch();
vBox->addStretch();
}
m_pSchedule = new ControlHdmiSchedule(this, list);
m_pStackedW->addWidget(m_pManual);
m_pStackedW->addWidget(m_pSchedule);
ui->horizontalLayout_2->addWidget(m_pStackedW);
init();
connect(parent->parent()->parent(),SIGNAL(sigSelectedDeviceList(QList<LedCard *> *)),this,SLOT(onSelectedDeviceList(QList<LedCard *> *)));
}
vBox->addWidget(m_pStackedW);
ControlHdmiWidget::~ControlHdmiWidget()
{
m_pStackedW->deleteLater() ;
m_pManual->deleteLater() ;
m_pSchedule->deleteLater() ;
delete ui;
}
void ControlHdmiWidget::refreshLable()
{
ui->labelHdmiConfiguration->setText(tr("HDMI Configuration"));
ui->radioButtonManual->setText(tr("Manual"));
ui->radioButtonSchedule->setText(tr("Schedule"));
}
void ControlHdmiWidget::init()
{
m_buttonGroup = new QButtonGroup;
//第二个参数id可以自行定义
m_buttonGroup->addButton(ui->radioButtonManual,0);
m_buttonGroup->addButton(ui->radioButtonSchedule,1);
auto m_buttonGroup = new QButtonGroup;
m_buttonGroup->addButton(radioButtonManual, 0);
m_buttonGroup->addButton(radioButtonSchedule, 1);
connect(m_buttonGroup,SIGNAL(buttonClicked(int)),m_pStackedW,SLOT(setCurrentIndex(int)));
ui->radioButtonManual->setChecked(true);
radioButtonManual->setChecked(true);
m_pStackedW->setCurrentIndex(0);
connect(gDevicePanel, &DevicePanel::sigSelectedDeviceList, this, [this] {
if(isVisible()) init();
});
transUi();
}
void ControlHdmiWidget::showEvent(QShowEvent *event) {
QWidget::showEvent(event);
init();
}
void ControlHdmiWidget::init() {
bool isSingle = gSelCards->count()==1;
if(! isSingle) return;
QJsonObject json;
json.insert("_id", "IsSync");
json.insert("_type", "IsSync");
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;
}
swich->setCheckedStatus(json["result"].toBool());
});
}
void ControlHdmiWidget::changeEvent(QEvent *event) {
QWidget::changeEvent(event);
if(event->type() == QEvent::LanguageChange) transUi();
}
void ControlHdmiWidget::transUi() {
labelHdmiConfiguration->setText(tr("HDMI Configuration"));
radioButtonManual->setText(tr("Manual"));
radioButtonSchedule->setText(tr("Schedule"));
lbSync->setText(tr("HDMI IN"));
lbAsync->setText(tr("Async"));
btnGetSync->setText(tr("Readback"));
}

View File

@ -1,35 +1,43 @@
#ifndef CONTROLHDMIWIDGET_H
#define CONTROLHDMIWIDGET_H
#include <QWidget>
#include <wDevicesManager/controlhdmimanual.h>
#include "LoUIClass/switchcontrol.h"
#include <wDevicesManager/controlhdmischedule.h>
#include "QStackedWidget"
#include <QButtonGroup>
namespace Ui {
class ControlHdmiWidget;
}
#include <QStackedWidget>
#include <QRadioButton>
class ControlHdmiWidget : public QWidget
{
class ControlHdmiWidget : public QWidget {
Q_OBJECT
public:
explicit ControlHdmiWidget(QWidget *parent = nullptr,QList<LedCard *> *m_pLedlist=nullptr);
~ControlHdmiWidget();
private:
protected:
void showEvent(QShowEvent *event) override;
void init();
protected slots:
void refreshLable();
void changeEvent(QEvent *) override;
void transUi();
private:
Ui::ControlHdmiWidget *ui;
ControlHdmiManual *m_pManual=nullptr;
QLabel *labelHdmiConfiguration;
QRadioButton *radioButtonManual;
QRadioButton *radioButtonSchedule;
QWidget *m_pManual=nullptr;
ControlHdmiSchedule *m_pSchedule=nullptr;
QStackedWidget *m_pStackedW;
QButtonGroup *m_buttonGroup;
QList<LedCard *> *m_pLedlist=nullptr;
QLabel *lbAsync;
SwitchControl *swich;
QLabel *lbSync;
QPushButton *btnGetSync;
LedCard *m_pLedCard = nullptr;
LedCard *m_oldLedlist = nullptr;
HpptClient *pHpptClient = nullptr;
HpptClient *pHpptClientAll = nullptr;
QString m_strUrl="";
LoEmptyDialog * m_PostingDlg=nullptr;
QTimer *m_pGetAskTimer=nullptr;
bool m_bSelected=false;
};
#endif // CONTROLHDMIWIDGET_H

View File

@ -73,7 +73,6 @@ setStyleSheet(Tools::styleSheet());
ui->tableView->setFocusPolicy(Qt::NoFocus);
// connect(parent->parent()->parent(),SIGNAL(sigSelectedDeviceList(QList<LedCard *> *)),this,SLOT(onSelectedDeviceList(QList<LedCard *> *)));
MARCO_DEFINE_CONTROL_FUNC2(parent->parent()->parent(),parent->parent())
connect(ui->pushButtonAdd,SIGNAL(clicked()),this,SLOT(OnClickAdd()));

View File

@ -16,7 +16,6 @@ setStyleSheet(Tools::styleSheet());
m_pStackedW->addWidget(m_pSchedule);
ui->horizontalLayout_2->addWidget(m_pStackedW);
init();
// connect(parent->parent(),SIGNAL(sigSelectedDeviceList(QList<LedCard *> *)),this,SLOT(onSelectedDeviceList(QList<LedCard *> *)));
connect(m_pSchedule,SIGNAL(sigHaveSchedule(bool)),this,SLOT(OnGetPowerModeType(bool)));
}

View File

@ -69,7 +69,6 @@ setStyleSheet(Tools::styleSheet());
ui->tableView->setFocusPolicy(Qt::NoFocus);
// connect(parent->parent()->parent(),SIGNAL(sigSelectedDeviceList(QList<LedCard *> *)),this,SLOT(onSelectedDeviceList(QList<LedCard *> *)));
MARCO_DEFINE_CONTROL_FUNC2(parent->parent()->parent(),parent->parent())
connect(ui->pushButtonAdd,SIGNAL(clicked()),this,SLOT(OnClickAdd()));

View File

@ -17,7 +17,7 @@ setStyleSheet(Tools::styleSheet());
m_pStackedW->addWidget(m_pSchedule);
ui->horizontalLayout_2->addWidget(m_pStackedW);
init();
connect(parent->parent()->parent(),SIGNAL(sigSelectedDeviceList(QList<LedCard *> *)),this,SLOT(onSelectedDeviceList(QList<LedCard *> *)));
connect(parent->parent(),SIGNAL(sigSelectedDeviceList(QList<LedCard *> *)),this,SLOT(onSelectedDeviceList(QList<LedCard *> *)));
connect(m_pSchedule,SIGNAL(sigHaveSchedule(bool)),this,SLOT(OnGetVolumeModeType(bool)));
}

View File

@ -1967,7 +1967,7 @@ void PlayerBackSendThread::run() {
}
auto file = new QFile(info.filePath());
if(! file->open(QFile::ReadOnly)) {
emit emErr(tr("open file failed")+" "+file->errorString());
emit emErr(tr("Open file failed")+" "+file->errorString());
tcp.close();
return;
}

View File

@ -5,6 +5,7 @@
#include "tools.h"
#include "LoUIClass/x_timeeditdelegate.h"
#include "xlsxdocument.h"
#include "xlsxworkbook.h"
#include <QBoxLayout>
#include <QMessageBox>
#include <QMetaEnum>
@ -234,11 +235,11 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
hBox = new QHBoxLayout;
hBox->addStretch();
radioButton_2 = new QRadioButton("R68/RL3");
hBox->addWidget(radioButton_2);
fdR68 = new QRadioButton("R68/RL3");
hBox->addWidget(fdR68);
radioButton = new QRadioButton("RL2");
hBox->addWidget(radioButton);
fdRL2 = new QRadioButton("RL2");
hBox->addWidget(fdRL2);
hBox->addSpacing(20);
@ -250,19 +251,48 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
return;
}
QString strSensorType;
if(radioButton->isChecked()) strSensorType = radioButton->text();
else if(radioButton_2->isChecked()) strSensorType = radioButton_2->text();
QString sensorName;
if(fdRL2->isChecked()) sensorName = fdRL2->text();
else if(fdR68->isChecked()) sensorName = fdR68->text();
else {
QMessageBox::information(gMainWin, tr("Tip"), tr("NeedSelectSensorTypeTip"));
return;
}
QString xlsxFile = QFileDialog::getOpenFileName(this, "open file dialog", "/", "brightness files(*.xlsx)");
QString xlsxFile = QFileDialog::getOpenFileName(this, tr("Open file dialog"), "/", "brightness files(*.xlsx)");
if(xlsxFile.isEmpty() || ! QFileInfo::exists(xlsxFile)) return;
QXlsx::Document xlsx(xlsxFile);
xlsx.selectSheet(strSensorType);
auto workbook = xlsx.workbook();
QXlsx::Worksheet *sheet = 0;
if(workbook->sheetCount() < 2) {
sheet = xlsx.currentWorksheet();
if(sheet==0) {
QMessageBox::information(gMainWin, tr("Tip"), tr("Not found current worksheet"));
return;
}
} else {
auto names = sensorName.split("/");
foreach(auto name, names) {
auto idx = xlsx.sheetNames().indexOf(name);
if(idx > -1) {
workbook->setActiveSheet(idx);
sheet = dynamic_cast<QXlsx::Worksheet *>(workbook->sheet(idx));
break;
}
}
if(sheet==0) {
QMessageBox::information(gMainWin, tr("Tip"), "Not found sheet "+sensorName);
return;
}
}
QJsonArray values;
for(int j=0; j<255; j++) values.append(xlsx.read(3,j+3).toString());
for(int j=0; j<255; j++) {
auto val = sheet->read(3, j+3).toString();
if(val.isEmpty()) {
QMessageBox::information(gMainWin, tr("Tip"), "Cell is empty at 3, "+QString::number(j+3));
return;
}
values.append(val);
}
QJsonObject json;
json.insert("_id", "SensorBrightnessTable");
json.insert("_type", "SensorBrightnessTable");
@ -290,8 +320,8 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
return;
}
QString strSensorType;
if(radioButton->isChecked()) strSensorType = radioButton->text();
else if(radioButton_2->isChecked()) strSensorType = radioButton_2->text();
if(fdRL2->isChecked()) strSensorType = fdRL2->text();
else if(fdR68->isChecked()) strSensorType = fdR68->text();
else {
QMessageBox::information(gMainWin, tr("Tip"), tr("NeedSelectSensorTypeTip"));
return;
@ -310,16 +340,16 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
QMessageBox::information(gMainWin, tr("Tip"), tr("no sensorBrightnessTable"));
return;
}
QString btbFile = QCoreApplication::applicationDirPath()+"/Btb";
QFile btbQFile(btbFile);
if(! btbQFile.exists()) {
QMessageBox::information(gMainWin, tr("Tip"), btbFile+" is not exist");
QString tempFile = QCoreApplication::applicationDirPath()+"/bright-template.xlsx";
QFile tempQFile(tempFile);
if(! tempQFile.exists()) {
QMessageBox::information(gMainWin, tr("Tip"), tempFile+" is not exist");
return;
}
QString selectFilter = "*.xlsx";
QString savingFile = QFileDialog::getSaveFileName(this, tr("Save file"), card->m_strCardId + "BrightnessTable.xlsx", "brightness(*.xlsx );", &selectFilter, QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
if(savingFile.isEmpty()) return;
btbQFile.copy(savingFile);
tempQFile.copy(savingFile);
QXlsx::Document xlsx(savingFile);
xlsx.selectSheet(strSensorType);
for(int m=0; m<values.count(); m++) xlsx.write(3, m+3, values.at(m).toInt());
@ -359,8 +389,8 @@ CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg, card] {
Def_CtrlSingleGetReply
waitingDlg->success();
if(json["is485"].toBool()) radioButton_2->setChecked(true);
else radioButton->setChecked(true);
if(json["is485"].toBool()) fdR68->setChecked(true);
else fdRL2->setChecked(true);
fdCurBright->setText(QString::number(qRound(json["value"].toInt() * 100.0 / card->BrightnessLevel))+"%");
});
} else {

View File

@ -39,8 +39,8 @@ private:
QPushButton *btnSensiGet;
QPushButton *btnMinBrightSet;
QPushButton *btnMinBrightGet;
QRadioButton *radioButton_2;
QRadioButton *radioButton;
QRadioButton *fdR68;
QRadioButton *fdRL2;
QPushButton *btnUpload;
QPushButton *btnTableGet;
QLabel *fdSensiTypeTip;

View File

@ -297,7 +297,7 @@ QString EVideo::transcoding(QString rawFile, QString rawName, QString dir, int w
} else err.append(txt);
}
});
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), "-profile:v", "main", "-b:v", QString::number(w*h/150)+"k", outFile});
msgBox.exec();
if(err.right(32).contains("Conversion failed!")) {
QMessageBox::critical(gMainWin, tr("Error"), err);

View File

@ -133,7 +133,7 @@ SendProgramDialog::SendProgramDialog(QWidget *parent, QString strProgramName, QS
connect(timer, &QTimer::timeout, this, &SendProgramDialog::onRefresh);
timer->start(60000);
}
void SendProgramDialog::closeEvent(QCloseEvent *event) {
void SendProgramDialog::closeEvent(QCloseEvent *) {
emit stopAllThd();
}
void SendProgramDialog::sendNext() {

View File

@ -21,7 +21,7 @@ win* {
LIBS += -lDbghelp
}
win32 {
QMAKE_LFLAGS += /LARGEADDRESSAWARE
QMAKE_LFLAGS += /LARGEADDRESSAWARE
}
SOURCES += \