This commit is contained in:
Gangphon 2023-08-01 11:42:41 +08:00
parent f041b21f17
commit 13ad4ec75f
162 changed files with 4066 additions and 5016 deletions

View File

@ -8,7 +8,7 @@ QT += webenginewidgets
greaterThan(QT_MAJOR_VERSION, 5) {
QT += openglwidgets
}
CONFIG += c++14
CONFIG += c++17
CONFIG += lrelease
CONFIG += embed_translations
# CONFIG += console
@ -19,7 +19,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.4.0
VERSION = 1.4.1
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
msvc {
contains(QT_ARCH, i386) {
@ -49,6 +49,7 @@ RESOURCES += res.qrc
copydir.files += AClock
copydir.files += borders
copydir.files += $$quote(y50 param)
copydir.files += $$quote(files)
@ -94,9 +95,6 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
SOURCES += \
base/changepasswordform.cpp \
base/customprogressindicator.cpp \
base/loemptydialog.cpp \
base/softconfigdialog.cpp \
base/switchcontrol.cpp \
base/extendedgroupbox.cpp \
base/ffutil.cpp \
@ -114,7 +112,6 @@ SOURCES += \
device/ctrlpwdpanel.cpp \
device/ctrltestpanel.cpp \
device/ctrlvolumepanel.cpp \
devicectrlpanel.cpp \
deviceitem.cpp \
devicepanel.cpp \
ffplayer.cpp \
@ -171,9 +168,6 @@ SOURCES += \
HEADERS += \
base/changepasswordform.h \
base/customprogressindicator.h \
base/loemptydialog.h \
base/softconfigdialog.h \
base/switchcontrol.h \
base/extendedgroupbox.h \
base/locolorselector.h \
@ -190,7 +184,6 @@ HEADERS += \
device/ctrlpwdpanel.h \
device/ctrltestpanel.h \
device/ctrlvolumepanel.h \
devicectrlpanel.h \
deviceitem.h \
devicepanel.h \
ffplayer.h \

View File

@ -1,137 +0,0 @@
#include "customprogressindicator.h"
#include <QPainter>
#include <QPainterPath>
CustomProgressIndicator::CustomProgressIndicator(QWidget* parent)
: QWidget(parent),
angle_(0),
timerId_(-1),
delay_(20),
displayedWhenStopped_(false),
color_(Qt::green) {
setAttribute(Qt::WA_DeleteOnClose);
setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
setFocusPolicy(Qt::NoFocus);
setWindowFlags(Qt::FramelessWindowHint);//无窗体
setAttribute(Qt::WA_TranslucentBackground);//背景透明
}
bool CustomProgressIndicator::isAnimated () const {
return (timerId_ != -1);
}
void CustomProgressIndicator::setDisplayedWhenStopped(bool state) {
displayedWhenStopped_ = state;
update();
}
bool CustomProgressIndicator::isDisplayedWhenStopped() const {
return displayedWhenStopped_;
}
void CustomProgressIndicator::setDisplayModel(int iFlag)
{
m_iLoopBackFlag=iFlag;
}
void CustomProgressIndicator::startAnimation() {
angle_ = 0;
if (timerId_ == -1) {
timerId_ = startTimer(delay_);
}
}
void CustomProgressIndicator::setDisplayStringInfo(QString strTip,QString strTiping) {
m_strTip=strTip;
m_strTiping=strTiping;
update();
}
void CustomProgressIndicator::stopAnimation() {
if (timerId_ != -1) {
killTimer(timerId_);
}
timerId_ = -1;
update();
}
void CustomProgressIndicator::setAnimationDelay(int delay) {
if (timerId_ != -1){
killTimer(timerId_);
}
delay_ = delay;
if (timerId_ != -1){
timerId_ = startTimer(delay_);
}
}
void CustomProgressIndicator::setColor(const QColor & color) {
color_ = color;
update();
}
QSize CustomProgressIndicator::sizeHint() const {
return QSize(80,80);
}
void CustomProgressIndicator::timerEvent(QTimerEvent *) {
angle_ = (angle_+30)%360;
update();
}
void CustomProgressIndicator::paintEvent(QPaintEvent *) {
QPainter p(this);
drawJuHua(&p);
}
void CustomProgressIndicator::drawJuHua(QPainter *painter)
{
painter->setRenderHint(QPainter::Antialiasing);
if (displayedWhenStopped_ && !isAnimated()) //如果displayedWhenStopped_==flash并且动画已经停止则不绘制
{
painter->setPen(color_);
painter->drawPixmap(rect(),currentPix_);
painter->drawText(rect(), Qt::AlignCenter, m_strTip);
return;
}
int width = qMin(this->width(), this->height());
int outerRadius = (width-1) >> 1;
int innerRadius = int(((width-1) >> 1)*0.38);
int capsuleHeight = outerRadius - innerRadius;
int capsuleWidth = (width > 32 ) ? (int)(capsuleHeight *0.23) : (int)(capsuleHeight *0.35);
int capsuleRadius = capsuleWidth >> 1;
if(m_iLoopBackFlag==1)
{
painter->setPen(color_);
painter->drawText(rect(), Qt::AlignCenter, m_strTiping);
}
else {
/* 撰写进度 */
if (progress_ > 0 && progress_ < 100) {
painter->setPen(color_);
painter->drawText(rect(), Qt::AlignCenter, QString("%1%").arg(progress_));
}
else if (progress_ == 100) {
stopAnimation();
}
}
for (int i=0; i<12; ++i) {
QColor color = color_;
color.setAlphaF(1.0f - (i/12.0f));
painter->setPen(Qt::NoPen);
painter->setBrush(color);
painter->save();
painter->translate(rect().center());
painter->rotate(angle_ - i*30.0f);
painter->drawRoundedRect(((-capsuleWidth) >> 1), -(innerRadius+capsuleHeight), capsuleWidth, capsuleHeight, capsuleRadius, capsuleRadius);
painter->restore();
}
}

View File

@ -1,116 +0,0 @@
#ifndef CUSTOMPROGRESSINDICATOR_H
#define CUSTOMPROGRESSINDICATOR_H
#include <QWidget>
#include <QColor>
#include <QTimer>
/*
*
*
* 727057301@qq.com
* 201721016:26:48
* QT版本5.0.2
* CSDNhttp://blog.csdn.net/csnd_ayo
* **************************************
*
* 使QT.pro中加入 C++11
*
*
pIndicator = new CustomProgressIndicator(this);
pIndicator->setColor(Qt::red);
pIndicator->startAnimation();
*/
class CustomProgressIndicator : public QWidget
{
Q_OBJECT
Q_PROPERTY(int delay READ animationDelay WRITE setAnimationDelay)
Q_PROPERTY(bool displayedWhenStopped READ isDisplayedWhenStopped WRITE setDisplayedWhenStopped)
Q_PROPERTY(QColor color READ color WRITE setColor)
public:
CustomProgressIndicator(QWidget* parent = nullptr);
int animationDelay() const { return delay_; }
/* 动画是否正在进行中 */
bool isAnimated () const;
/* 动画完毕后,是否隐藏菊花转 */
bool isDisplayedWhenStopped() const;
/* 当前菊花转的颜色 */
const QColor & color() const { return color_; }
/* 虚函数:当前大小 */
virtual QSize sizeHint() const;
void setBackground(const QString& _icon) {
currentPix_ = QPixmap(_icon);
}
signals:
void Finished(void);
public slots:
/* 开始动画 */
void startAnimation();
/* 停止动画 */
void stopAnimation();
/* 设置停止菊花,显示圆圈加对号*/
void setDisplayStringInfo(QString strTip,QString strTiping);
void setDisplayModel(int iFlag);//iFlag 0:表示进度统计1表示strTiping提示结束后显示strTip
/* 设置菊花转的转速 */
void setAnimationDelay(int delay);
/* 动画完毕后,是否隐藏菊花转 */
void setDisplayedWhenStopped(bool state);
/* 设置菊花转颜色 */
void setColor(const QColor & color);
/*
*
* _progress 0 < _progress < 100
*/
void onProgress(QString msg, int _progress, bool done)
{
Q_UNUSED(msg)
progress_ = _progress;
if(done)
{
progress_=100;
}
}
protected:
/* 系统基类函数 */
virtual void timerEvent(QTimerEvent * event);
virtual void paintEvent(QPaintEvent * event);
void drawJuHua(QPainter *painter);
private:
/* 角度 */
unsigned int angle_;
/* 定时器ID */
int timerId_;
/* 转速 */
int delay_;
/* 是否隐藏 */
bool displayedWhenStopped_;
/* 菊花转颜色 */
QColor color_;
/* 进度 */
int progress_;
/* 背景图 */
QPixmap currentPix_;
/*显示圆圈中的字符串内容*/
QString m_strTip = "";
QString m_strTiping = "";
int m_iLoopBackFlag = 0;
};
#endif // CUSTOMPROGRESSINDICATOR_H

View File

@ -1,78 +0,0 @@
#include "loemptydialog.h"
#include <QVBoxLayout>
LoEmptyDialog::LoEmptyDialog(QWidget *parent) : BaseDlg(parent) {
setAttribute(Qt::WA_DeleteOnClose);
auto pal = palette();
pal.setBrush(QPalette::Window, QColor(0xdd, 0xdd, 0xdd, 0xdd));
setPalette(pal);
auto vBox = new QVBoxLayout(this);
vBox->addStretch();
mIndicator = new CustomProgressIndicator(this);
mIndicator->setDisplayModel(1);
mIndicator->setColor(QColor(0x0088dd));
mIndicator->setDisplayedWhenStopped(true);//动画停止后任就显示,直到关闭窗口
mIndicator->startAnimation();
vBox->addWidget(mIndicator, 0, Qt::AlignCenter);
vBox->addStretch();
label = new QLabel();
label->setAlignment(Qt::AlignCenter);
label->setStyleSheet("font-size: 24px; font-weight: bold; color: #08d;");
vBox->addWidget(label);
vBox->addStretch();
}
void LoEmptyDialog::SetTipTextContent(QString strTip) {
label->setText(strTip);
}
void LoEmptyDialog::SetFailedTipString(QString strTip) {
mTimeroutTip = strTip;
}
bool LoEmptyDialog::getLockStatus() {
return iLockFlag;
}
void LoEmptyDialog::lock(QString strTip, QString finishTip, QString timeroutTip) {
iLockFlag = true;
label->setText(strTip);
mFinishTip = finishTip;
mTimeroutTip = timeroutTip;
}
void LoEmptyDialog::unlock() {
if(iClosedFlag==1) return;
label->setText(mFinishTip);
if(mIndicator != nullptr) {
mIndicator->setBackground(":/res/success.png");
mIndicator->stopAnimation();
CloseWndByDelaySec(600);
}
iClosedFlag=1;
iLockFlag = false;
}
void LoEmptyDialog::TimerOutUnlock() {
if(iClosedFlag==1) return;
label->setText(mTimeroutTip);
if(mIndicator != nullptr) {
mIndicator->setBackground(":/res/tip.png");
mIndicator->stopAnimation();
CloseWndByDelaySec(600);
}
iClosedFlag = 1;
}
void LoEmptyDialog::CloseWndByDelaySec(int iCloseWndDelaySec) {
auto timer = new QTimer(this);
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, this, [this, timer] {
timer->stop();
close();
emit sigClose();
});
timer->start(iCloseWndDelaySec);
}

View File

@ -1,37 +0,0 @@
#ifndef LOEMPTYDIALOG_H
#define LOEMPTYDIALOG_H
#include <basedlg.h>
#include <base/customprogressindicator.h>
#include <QLabel>
class LoEmptyDialog : public BaseDlg {
Q_OBJECT
public:
explicit LoEmptyDialog(QWidget *parent = nullptr);
int exec() override {
emit startUp();
return BaseDlg::exec();
}
CustomProgressIndicator *mIndicator{0};
signals:
void startUp();
void sigClose();
public slots:
void lock(QString strTip,QString strUnLockTip,QString strTimerOutUnLockTip);
void unlock();
void TimerOutUnlock();
bool getLockStatus();
void SetFailedTipString(QString strTip);
void SetTipTextContent(QString strTip);
private:
QLabel *label;
int iClosedFlag=0;
bool iLockFlag = false;
QString mFinishTip;
QString mTimeroutTip;
LoEmptyDialog *m_pSelf=nullptr;
void CloseWndByDelaySec(int iCloseWndDelaySec);
};
#endif // LOEMPTYDIALOG_H

View File

@ -1,54 +0,0 @@
#include "softconfigdialog.h"
#include "cfg.h"
#include "globaldefine.h"
#include <QVBoxLayout>
#include <QLabel>
#include <QPushButton>
#include <QSettings>
SoftConfigDialog::SoftConfigDialog(QWidget *parent) : QDialog(parent) {
setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
resize(400, 300);
setWindowTitle(tr("Software Config"));
auto vbox = new QVBoxLayout(this);
press_fd = new QCheckBox(tr("Video compress to")+" 720p");
press_fd->setChecked(gVideoCompress);
vbox->addWidget(press_fd);
trans_fd = new QCheckBox(tr("Video transcoding to")+" h264");
trans_fd->setChecked(gVideoTranscoding);
vbox->addWidget(trans_fd);
auto hbox = new QHBoxLayout();
hbox->setContentsMargins(-1, 0, -1, -1);
anti_fd = new QCheckBox(tr("Text antialiasing"));
anti_fd->setChecked(gTextAntialiasing);
hbox->addWidget(anti_fd, 0, Qt::AlignTop);
auto anti_tip = new QLabel(tr("TextAntilaTip"));
anti_tip->setStyleSheet("QLabel{color: #f00;}");
anti_tip->setWordWrap(true);
hbox->addWidget(anti_tip);
vbox->addLayout(hbox);
vbox->addWidget(guangying_fd = new QCheckBox(tr("GuangYinPin")));
guangying_fd->setChecked(gShowLoraScreen);
vbox->addWidget(fdWidthSplit = new QCheckBox(tr("Width Split")));
fdWidthSplit->setChecked(gWidthSplit);
auto ok_btn = new QPushButton(tr("OK"));
vbox->addWidget(ok_btn, 0, Qt::AlignCenter);
connect(ok_btn, &QPushButton::clicked, this, [this]() {
QSettings settings;
settings.setValue("VideoCompress", gVideoCompress = press_fd->isChecked());
settings.setValue("VideoTranscoding", gVideoTranscoding = trans_fd->isChecked());
settings.setValue("TextAntialiasing", gTextAntialiasing = anti_fd->isChecked());
settings.setValue("GuangYingPin",gShowLoraScreen = guangying_fd->isChecked());
settings.setValue("WidthSplit", gWidthSplit = fdWidthSplit->isChecked());
accept();
});
}

View File

@ -1,15 +0,0 @@
#ifndef SOFTCONFIGDIALOG_H
#define SOFTCONFIGDIALOG_H
#include <QDialog>
#include <QCheckBox>
class SoftConfigDialog : public QDialog {
Q_OBJECT
public:
explicit SoftConfigDialog(QWidget *parent = 0);
QCheckBox *press_fd, *trans_fd, *anti_fd, *guangying_fd, *fdWidthSplit;
};
#endif // SOFTCONFIGDIALOG_H

View File

@ -1,61 +1,120 @@
#include "waitingdlg.h"
#include <QBoxLayout>
#include "gutil/qgui.h"
#include <QTimerEvent>
#include <QPushButton>
#include <QPainter>
#include <QPainterPath>
WaitingDlg::WaitingDlg(QWidget *parent, QString text, QString sucText) : BaseDlg{parent}, sucText(sucText) {
WaitingDlg::WaitingDlg(QWidget *parent, QString text, QString sucText) : QDialog{parent, Qt::Tool}, sucText(sucText) {
setAttribute(Qt::WA_DeleteOnClose);
setModal(true);
auto pal = palette();
pal.setBrush(QPalette::Window, QColor(0xdddddd));
setPalette(pal);
auto vBox = new VBox(this);
auto vBox = new QVBoxLayout(this);
vBox->setContentsMargins(6, 3, 6, 6);
vBox->addStretch();
btnAbort = new QPushButton("X");
btnAbort->setStyleSheet(R"rrr(
QPushButton {border-radius: 4px; padding: 2px 6px; background: transparent;}
QPushButton:hover {background: rgba(0,0,0,0.2);}
QPushButton:pressed {background: rgba(0,0,0,0.3);}
)rrr");
connect(btnAbort, &QPushButton::clicked, this, &QDialog::reject);
vBox->addWidget(btnAbort, 0, Qt::AlignRight);
mIndicator = new CustomProgressIndicator(this);
mIndicator->setDisplayModel(1);
mIndicator->setColor(QColor(0x0088dd));
mIndicator->startAnimation();
mIndicator = new WaitingIndicator(this);
mIndicator->setFixedSize(120, 120);
vBox->addWidget(mIndicator, 0, Qt::AlignCenter);
vBox->addStretch();
fdText = new QLabel(text);
fdText->setAlignment(Qt::AlignCenter);
auto font = fdText->font();
font.setPixelSize(18);
font.setBold(true);
fdText->setFont(font);
pal = fdText->palette();
pal.setBrush(QPalette::WindowText, QColor(0x0088dd));
fdText->setPalette(pal);
gFont(fdText, 18, true);
vBox->addWidget(fdText);
vBox->addStretch();
}
void WaitingDlg::closeEvent(QCloseEvent *event) {
if(showTimerId) {
killTimer(showTimerId);
showTimerId = 0;
}
if(closeTimerId) {
killTimer(closeTimerId);
closeTimerId = 0;
}
QDialog::closeEvent(event);
}
void WaitingDlg::timerEvent(QTimerEvent *event) {
if(closeTimerId==event->timerId()) {
if(showTimerId==event->timerId()) {
killTimer(showTimerId);
showTimerId = 0;
show();
} else if(closeTimerId==event->timerId()) {
killTimer(closeTimerId);
closeTimerId = 0;
close();
} else BaseDlg::timerEvent(event);
} else QDialog::timerEvent(event);
}
void WaitingDlg::show() {
QDialog::show();
raise();
activateWindow();
}
void WaitingDlg::showLater() {
if(isVisible()) return;
if(showTimerId) killTimer(showTimerId);
showTimerId = startTimer(200);
}
void WaitingDlg::success() {
fdText->setText(sucText.isEmpty() ? tr("Success") : sucText);
mIndicator->setBackground(":/res/success.png");
mIndicator->stopAnimation();
closeTimerId = startTimer(800);
mIndicator->success();
if(showTimerId) {
killTimer(showTimerId);
showTimerId = 0;
}
if(! isVisible()) show();
if(closeTimerId) killTimer(closeTimerId);
closeTimerId = startTimer(1000);
}
void WaitingIndicator::success() {
if(timerId > 0) killTimer(timerId);
timerId = -1;
angle = 0;
update();
}
void WaitingIndicator::timerEvent(QTimerEvent *event) {
if(timerId!=event->timerId()) QWidget::timerEvent(event);
else if(isVisible()) {
angle += 30;
if(angle>=360) angle -= 360;
update();
} else if(timerId > 0) {
killTimer(timerId);
timerId = 0;
angle = 0;
}
}
void WaitingIndicator::paintEvent(QPaintEvent *) {
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
if(timerId > 0) {
int radius = qMin(width(), height()) * 0.33;
int innerRadius = radius >> 1;
QPen pen(mColor, radius / 6, Qt::SolidLine, Qt::RoundCap);
painter.translate(width()>>1, height()>>1);
auto color = mColor;
for(int i=0; i<12; ++i) {
if(i) {
color.setAlphaF(1 - i/12.0);
pen.setColor(color);
painter.rotate(-30);
} else if(angle) painter.rotate(angle);
painter.setPen(pen);
painter.drawLine(0, innerRadius, 0, radius);
}
} else if(timerId==0) timerId = startTimer(33);
else {
int radius = qMin(width(), height()) >> 1;
int lineWidth = radius / 8;
radius -= lineWidth>>1;
QPen pen(QColor(0x00aa00), lineWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin);
painter.setPen(pen);
painter.translate(width()>>1, height()>>1);
painter.drawEllipse(QPoint(0, 0), radius, radius);
QPainterPath path({-0.8*radius, 0});
path.lineTo(-0.25*radius, 0.6*radius);
path.lineTo(0.6*radius, -0.5*radius);
painter.drawPath(path);
}
}

View File

@ -1,12 +1,26 @@
#ifndef WAITINGDLG_H
#define WAITINGDLG_H
#include "basedlg.h"
#include "base/customprogressindicator.h"
#include <QLabel>
#include <QNetworkReply>
#include <QDialog>
class WaitingDlg : public BaseDlg {
class WaitingIndicator : public QWidget {
Q_OBJECT
public:
using QWidget::QWidget;
QColor mColor{0x0088ff};
public slots:
void success();
protected:
void timerEvent(QTimerEvent * event) override;
void paintEvent(QPaintEvent * event) override;
int angle{0};
int timerId{0};
};
class WaitingDlg : public QDialog {
Q_OBJECT
public:
explicit WaitingDlg(QWidget *parent = nullptr, QString text = 0, QString sucText = 0);
@ -19,16 +33,18 @@ public:
reply->deleteLater();
});
}
QPushButton *btnAbort;
QLabel *fdText;
QString sucText;
CustomProgressIndicator *mIndicator;
WaitingIndicator *mIndicator;
public slots:
void show();
void showLater();
void success();
protected:
void timerEvent(QTimerEvent *) override;
void closeEvent(QCloseEvent *) override;
private:
int closeTimerId{0};
int closeTimerId{0}, showTimerId{0};
};
#endif // WAITINGDLG_H

View File

@ -7,8 +7,8 @@
class BaseWin : public QWidget {
Q_OBJECT
public:
explicit BaseWin(QWidget *parent = nullptr);
QWidget *center{nullptr};
explicit BaseWin(QWidget *parent = 0);
QWidget *center{0};
QPen borderPenAct{Qt::gray};
QPen borderPenUnact{Qt::lightGray};
qreal roundRadius{6.0};

View File

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 248 B

After

Width:  |  Height:  |  Size: 248 B

View File

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

View File

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

View File

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

View File

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

View File

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

View File

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

View File

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

View File

Before

Width:  |  Height:  |  Size: 440 B

After

Width:  |  Height:  |  Size: 440 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 632 B

After

Width:  |  Height:  |  Size: 632 B

View File

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 824 B

View File

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 824 B

View File

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 824 B

View File

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 824 B

View File

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 824 B

View File

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 824 B

View File

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 824 B

View File

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 824 B

View File

Before

Width:  |  Height:  |  Size: 824 B

After

Width:  |  Height:  |  Size: 824 B

View File

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1016 B

View File

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1016 B

View File

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1016 B

View File

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1016 B

View File

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1016 B

View File

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1016 B

View File

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1016 B

View File

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1016 B

View File

Before

Width:  |  Height:  |  Size: 1016 B

After

Width:  |  Height:  |  Size: 1016 B

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -86,6 +86,7 @@ LoColorSelector {
background-color: transparent;
padding: 3px 6px;
max-height: 30px;
font-size: 14px;
}
QTreeWidget[ssType="topList"]::item {
@ -147,13 +148,13 @@ QToolButton[ss="CtrlTab"] {
QToolButton[ss="MainTab"]:checked,
QToolButton[ss="MainTab"]:hover {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #ddd, stop: 1.0 #8cd);
font-size: 15px;
font-size: 13px;
color: #04d;
}
QToolButton[ss="CtrlTab"]:checked,
QToolButton[ss="CtrlTab"]:hover {
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #eee, stop: 1.0 #ade);
font-size: 15px;
font-size: 13px;
color: #04d;
}

View File

@ -5,8 +5,10 @@
#include "tools.h"
#include "gutil/qgui.h"
#include "gutil/qnetwork.h"
#include "gutil/qjson.h"
#include "program/ephoto.h"
#include "upgradeapkdialog.h"
#include "deviceitem.h"
#include <QComboBox>
#include <QFileDialog>
#include <QJsonArray>
@ -25,7 +27,7 @@
#include "devicepanel.h"
#include <QDialogButtonBox>
CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
CtrlAdvancedPanel::CtrlAdvancedPanel() {
setFocusPolicy(Qt::StrongFocus);
auto vBox = new QVBoxLayout(this);
@ -105,11 +107,6 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
return;
}
auto alias = fdAlias->text();
if(alias.isEmpty()) {
QMessageBox::information(this, tr("Tip"),tr("InputAliasTip"));
fdAlias->setFocus();
return;
}
QJsonObject json;
json.insert("_id", "SetCardAlias");
json.insert("_type", "SetCardAlias");
@ -119,10 +116,25 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSetReqAfter
auto item = findItem(card.id);
if(item) {
item->mCard.alias = alias;
item->setText(DeviceTable_Remark, alias);
}
});
} else {
foreach(auto card, gSelCards) {
Def_CtrlSetMulti(tr("SetCardAlias"))
auto reply = NetReq("http://"+card.ip+":2016/settings").timeout(120000).post(json);
connect(reply, &QNetworkReply::finished, gFdResInfo, [=] {
QString err = checkReplyForJson(reply);
gFdResInfo->append(card.id+" "+tr("SetCardAlias")+" "+(err.isEmpty() ? QCoreApplication::translate("Def","Success") : err));
if(! err.isEmpty()) return;
auto item = findItem(card.id);
if(item) {
item->mCard.alias = alias;
item->setText(DeviceTable_Remark, alias);
}
});
}
}
});
@ -521,9 +533,103 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
}
}
});
hBox->addWidget(btnClearProg);
btnGetPlayerState = new QPushButton;
btnGetPlayerState->setProperty("ssType", "progManageTool");
connect(btnGetPlayerState, &QPushButton::clicked, this, [this] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
JObj json{{"_type","getPlayerState"},{"_id","getPlayerState"},{"zVer","xixun1"}};
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("Clearing Program")+" ...");
waitingDlg->show();
auto card = gSelCards[0];
auto tcp = new QTcpSocket();
auto timer = new QTimer(tcp);
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, tcp, [=] {
waitingDlg->close();
tcp->abort();
tcp->deleteLater();
QMessageBox::critical(this, tr("Tip"), tr("Clear Program")+" "+tr("Timeout"));
});
connect(waitingDlg, &WaitingDlg::rejected, tcp, [=] {
timer->stop();
tcp->abort();
tcp->deleteLater();
});
connect(tcp, &QTcpSocket::connected, tcp, [=] {
timer->stop();
tcp->write(JToBytes(json));
timer->start(10000);
});
connect(tcp, &QTcpSocket::readyRead, tcp, [=] {
timer->stop();
QByteArray resp = tcp->readAll();
tcp->close();
tcp->deleteLater();
QJsonParseError parseErr;
QJsonDocument json = QJsonDocument::fromJson(resp, &parseErr);
if(parseErr.error != QJsonParseError::NoError) {
waitingDlg->close();
QMessageBox::critical(this, tr("Tip"), parseErr.errorString());
} else if(! json["success"].toBool()) {
waitingDlg->close();
QMessageBox::critical(this, tr("Tip"), tr("Clear Program")+" "+tr("Failed"));
} else waitingDlg->success();
});
connect(tcp, &QTcpSocket::errorOccurred, tcp, [=](QAbstractSocket::SocketError err) {
timer->stop();
tcp->close();
tcp->deleteLater();
waitingDlg->close();
QMessageBox::critical(this, tr("Tip"), QString(socketErrKey(err))+" ("+QString::number(err)+") "+tcp->errorString());
});
tcp->connectToHost(card.ip, 3333);
timer->start(10000);
} else {
foreach(auto card, gSelCards) {
auto tcp = new QTcpSocket();
auto timer = new QTimer(tcp);
timer->setSingleShot(true);
auto cardId = card.id;
connect(timer, &QTimer::timeout, tcp, [tcp, cardId] {
tcp->abort();
tcp->deleteLater();
gFdResInfo->append(cardId+" "+tr("Clear Program")+" "+tr("Timeout"));
});
connect(tcp, &QTcpSocket::connected, tcp, [tcp, json, timer] {
timer->stop();
tcp->write(JToBytes(json));
timer->start(10000);
});
connect(tcp, &QTcpSocket::readyRead, tcp, [tcp, timer, cardId] {
timer->stop();
QByteArray resp = tcp->readAll();
tcp->close();
tcp->deleteLater();
QJsonParseError parseErr;
QJsonDocument json = QJsonDocument::fromJson(resp, &parseErr);
if(parseErr.error != QJsonParseError::NoError) gFdResInfo->append(cardId+" "+tr("Clear Program")+" "+parseErr.errorString());
else if(! json["success"].toBool()) gFdResInfo->append(cardId+" "+tr("Clear Program")+" "+tr("Failed"));
else gFdResInfo->append(cardId+" "+tr("Clear Program")+" "+tr("Success"));
});
connect(tcp, &QTcpSocket::errorOccurred, tcp, [tcp, timer, cardId](QAbstractSocket::SocketError err) {
timer->stop();
tcp->close();
tcp->deleteLater();
gFdResInfo->append(cardId+" "+tr("Clear Program")+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(err)+" ("+QString::number(err)+") "+tcp->errorString());
});
tcp->connectToHost(card.ip, 3333);
timer->start(10000);
}
}
});
hBox->addWidget(btnGetPlayerState);
btnGetLog = new QPushButton;
btnGetLog->setProperty("ssType", "progManageTool");
connect(btnGetLog, &QPushButton::clicked, this, [this] {
@ -626,99 +732,72 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
hBox->addStretch();
grpM80 = new QGroupBox;
hBox = new HBox(grpM80);
grpY50 = new QGroupBox;
{
auto hBox = new HBox(grpY50);
fdM80Resolu = new QComboBox;
fdM80Resolu->setMinimumWidth(160);
hBox->addWidget(fdM80Resolu);
auto fdY50Resolu = new QComboBox;
auto dirs = QDir(QApplication::applicationDirPath()+"/y50 param").entryList(QDir::Dirs | QDir::NoDotAndDotDot);
foreach(auto dir, dirs) fdY50Resolu->addItem(dir);
fdY50Resolu->setMinimumWidth(160);
hBox->addWidget(fdY50Resolu);
btnM80Set = new QPushButton();
btnM80Set->setProperty("ssType", "progManageTool");
connect(btnM80Set, &QPushButton::clicked, this, [this] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "SetSpecialResolution");
json.insert("_type", "SetSpecialResolution");
json.insert("displayResolution", fdM80Resolu->currentText()); //显示分辨率
json.insert("totalResolution", fdM80Resolu->currentData().toString()); //显示分辨率
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("SetSpecialResolution"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSetReqAfter
});
} else {
foreach(auto card, gSelCards) {
Def_CtrlSetMulti(tr("SetSpecialResolution"))
btnY50Set = new QPushButton;
btnY50Set->setProperty("ssType", "progManageTool");
connect(btnY50Set, &QPushButton::clicked, this, [=] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
}
});
hBox->addWidget(btnM80Set);
auto filePath = QApplication::applicationDirPath()+"/y50 param/"+fdY50Resolu->currentText()+"/rk_lcd_parameters";
QFile qFile(filePath);
if(! qFile.exists()) {
QMessageBox::information(this, tr("Tip"), tr("File not exist"));
return;
}
if(! qFile.open(QIODevice::ReadOnly)) {
QMessageBox::information(this, tr("Tip"), tr("Cannot Open File")+": "+qFile.errorString()+"\n"+filePath);
return;
}
auto fileData = qFile.readAll();
qFile.close();
btnM80Refresh = new QPushButton();
btnM80Refresh->setProperty("ssType", "progManageTool");
connect(btnM80Refresh, &QPushButton::clicked, this, [this] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "GetSpecialResolution");
json.insert("_type", "GetSpecialResolution");
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("GetSpecialResolution"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg] {
Def_CtrlSingleGetReply
waitingDlg->success();
fdM80Resolu->setCurrentText(json["displayResolution"].toString());
});
} else {
foreach(auto card, gSelCards) {
auto reply = NetReq("http://"+card.ip+":2016/settings").timeout(120000).post(json);
auto cardId = card.id;
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
QJsonDocument json;
QString err = checkReplyForJson(reply, &json);
if(err.isEmpty()) err = tr("totalResolution")+"["+json["totalResolution"].toString()+"], "+tr("strCurDisplayResolution")+"["+json["displayResolution"].toString()+"]";
gFdResInfo->append(cardId+" "+tr("GetSpecialResolution")+" "+err);
auto Boundary = "----QtLedOK_.oOo._"+QUuid::createUuid().toByteArray(QUuid::WithoutBraces);
QByteArray data;
data.append("--").append(Boundary).append("\r\nContent-Disposition: form-data; name=\"rk_lcd_parameters\"; filename=\"rk_lcd_parameters\"\r\n\r\n").append(fileData).append("\r\n");
data.append("--").append(Boundary).append("--\r\n");
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("Uploading")+" ...");
waitingDlg->show();
NetReq req("http://"+gSelCards[0].ip+":2016/upload?type=update_display");
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
waitingDlg->connAbort(reply);
connect(reply, &QNetworkReply::finished, this, [=] {
QString err = checkReply(reply);
if(! err.isEmpty()) {
waitingDlg->close();
QMessageBox::critical(this, tr("Error"), err);
return;
}
waitingDlg->success();
});
} else {
foreach(auto card, gSelCards) {
NetReq req("http://"+card.ip+":2016/upload?type=update_display");
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
connect(reply, &QNetworkReply::finished, this, [=] {
QString err = checkReply(reply);
gFdResInfo->append(card.id+" "+tr("Update")+" "+(err.isEmpty()?tr("Success"):err));
});
}
}
}
});
hBox->addWidget(btnM80Refresh);
});
hBox->addWidget(btnY50Set);
hBox->addStretch();
}
vBox->addWidget(grpY50);
btnM80Restore = new QPushButton();
btnM80Restore->setProperty("ssType", "progManageTool");
connect(btnM80Restore, &QPushButton::clicked, this, [this] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "CleanDisplayScreenSize");
json.insert("_type", "CleanDisplayScreenSize");
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("CleanDisplayScreenSize"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSetReqAfter
});
} else {
foreach(auto card, gSelCards) {
Def_CtrlSetMulti(tr("CleanDisplayScreenSize"))
}
}
});
hBox->addWidget(btnM80Restore);
hBox->addStretch();
vBox->addWidget(grpM80);
hBox = new HBox(vBox);
@ -874,66 +953,18 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
hBox = new HBox(vBox);
btnLedSet3 = new QPushButton;
btnLedSet3->setMinimumHeight(34);
btnLedSet3->setProperty("ssType", "progManageTool");
connect(btnLedSet3, &QPushButton::clicked, this, [=] {
QString strLedSetFile = QApplication::applicationDirPath()+"/LedSet/LedSet3.0.exe";
QFileInfo cc22(strLedSetFile);
if(cc22.exists()) {
QProcess::startDetached(strLedSetFile,QStringList());
return;
}
QSettings reg("HKEY_LOCAL_MACHINE\\SOFTWARE\\WOW6432Node\\sysolution\\LedSet3.0", QSettings::NativeFormat);
QString strLedsetPath = reg.value("Program_path").toString();
if(!strLedsetPath.isEmpty()) {
QFileInfo cc(strLedsetPath);
if(cc.exists()) QProcess::startDetached(strLedsetPath,QStringList());
else QMessageBox::critical(this, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath);
return;
}
QSettings reg1("HKEY_LOCAL_MACHINE\\SOFTWARE\\sysolution\\LedSet3.0", QSettings::NativeFormat);
strLedsetPath = reg1.value("Program_path").toString();
QFileInfo cc(strLedsetPath);
if(!strLedsetPath.isEmpty()) {
if(cc.exists()) QProcess::startDetached(strLedsetPath,QStringList());
else {
QString str1="C:/Program Files/sysolution/LedSet3.0/LedSet3.0.exe";
QFileInfo cc1(str1);
if(cc1.exists()) QProcess::startDetached(str1,QStringList());
else {
QString str2="C:/Program Files (x86)/sysolution/LedSet3.0/LedSet3.0.exe";
QFileInfo cc2(str1);
if(cc2.exists()) QProcess::startDetached(str2,QStringList());
else QMessageBox::critical(this, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath);
}
}
} else {
QString str1="C:/Program Files/sysolution/LedSet3.0/LedSet3.0.exe";
QFileInfo cc1(str1);
if(cc1.exists()) QProcess::startDetached(str1,QStringList());
else {
QString str2="C:/Program Files (x86)/sysolution/LedSet3.0/LedSet3.0.exe";
QFileInfo cc2(str1);
if(cc2.exists())QProcess::startDetached(str2,QStringList());
else QMessageBox::critical(this, tr("Tip Info"), tr("Can not find LedSet3.0.exe")+strLedsetPath);
}
}
});
hBox->addWidget(btnLedSet3);
btnLedSet4 = new QPushButton;
btnLedSet4->setMinimumHeight(34);
btnLedSet4->setProperty("ssType", "progManageTool");
connect(btnLedSet4, &QPushButton::clicked, btnLedSet4, [] {
btnLedSet = new QPushButton;
btnLedSet->setMinimumHeight(30);
btnLedSet->setProperty("ssType", "progManageTool");
connect(btnLedSet, &QPushButton::clicked, btnLedSet, [] {
QFileInfo file("LedSet4.0/LedSet4.0.exe");
if(file.exists()) QProcess::startDetached(file.absoluteFilePath(), QStringList());
});
hBox->addWidget(btnLedSet4);
hBox->addWidget(btnLedSet);
hBox->addStretch();
#ifndef Q_OS_WIN
btnLedSet3->setVisible(false);
btnLedSet4->setVisible(false);
btnLedSet->setVisible(false);
#endif
auto line = new QFrame;
@ -1432,7 +1463,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
if(! info.isFile()) return;
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("Setting player background")+" ...");
waitingDlg->btnAbort->hide();
waitingDlg->setWindowFlag(Qt::WindowCloseButtonHint, 0);
waitingDlg->show();
auto thread = new PlayerBackSendThread(file, gSelCards[0].ip);
connect(thread, &PlayerBackSendThread::emErr, this, [=](QString err) {
@ -1556,71 +1587,101 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
line->setFrameStyle(QFrame::HLine | QFrame::Sunken);
vBox->addWidget(line);
grpY50 = new QGroupBox;
grpM80 = new QGroupBox;
{
hBox = new HBox(grpY50);
auto hBox = new HBox(grpM80);
auto fdY50Resolu = new QComboBox;
auto dirs = QDir(QApplication::applicationDirPath()+"/y50 param").entryList(QDir::Dirs | QDir::NoDotAndDotDot);
foreach(auto dir, dirs) fdY50Resolu->addItem(dir);
fdY50Resolu->setMinimumWidth(160);
hBox->addWidget(fdY50Resolu);
fdM80Resolu = new QComboBox;
fdM80Resolu->setMinimumWidth(160);
hBox->addWidget(fdM80Resolu);
btnY50Set = new QPushButton;
btnY50Set->setProperty("ssType", "progManageTool");
connect(btnY50Set, &QPushButton::clicked, this, [=] {
btnM80Set = new QPushButton();
btnM80Set->setProperty("ssType", "progManageTool");
connect(btnM80Set, &QPushButton::clicked, this, [this] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
auto filePath = QApplication::applicationDirPath()+"/y50 param/"+fdY50Resolu->currentText()+"/rk_lcd_parameters";
QFile qFile(filePath);
if(! qFile.exists()) {
QMessageBox::information(this, tr("Tip"), tr("File not exist"));
return;
}
if(! qFile.open(QIODevice::ReadOnly)) {
QMessageBox::information(this, tr("Tip"), tr("Cannot Open File")+": "+qFile.errorString()+"\n"+filePath);
return;
}
auto fileData = qFile.readAll();
qFile.close();
auto Boundary = "----QtLedOK_.oOo._"+QUuid::createUuid().toByteArray(QUuid::WithoutBraces);
QByteArray data;
data.append("--").append(Boundary).append("\r\nContent-Disposition: form-data; name=\"rk_lcd_parameters\"; filename=\"rk_lcd_parameters\"\r\n\r\n").append(fileData).append("\r\n");
data.append("--").append(Boundary).append("--\r\n");
QJsonObject json;
json.insert("_id", "SetSpecialResolution");
json.insert("_type", "SetSpecialResolution");
json.insert("displayResolution", fdM80Resolu->currentText()); //显示分辨率
json.insert("totalResolution", fdM80Resolu->currentData().toString()); //显示分辨率
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("Uploading")+" ...");
waitingDlg->show();
NetReq req("http://"+gSelCards[0].ip+":2016/upload?type=update_display");
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
waitingDlg->connAbort(reply);
auto waitingDlg = new WaitingDlg(this, tr("SetSpecialResolution"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
QString err = checkReply(reply);
if(! err.isEmpty()) {
waitingDlg->close();
QMessageBox::critical(this, tr("Error"), err);
return;
}
waitingDlg->success();
Def_CtrlSetReqAfter
});
} else {
foreach(auto card, gSelCards) {
NetReq req("http://"+card.ip+":2016/upload?type=update_display");
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
connect(reply, &QNetworkReply::finished, this, [=] {
QString err = checkReply(reply);
gFdResInfo->append(card.id+" "+tr("Update")+" "+(err.isEmpty()?tr("Success"):err));
Def_CtrlSetMulti(tr("SetSpecialResolution"))
}
}
});
hBox->addWidget(btnM80Set);
btnM80Refresh = new QPushButton();
btnM80Refresh->setProperty("ssType", "progManageTool");
connect(btnM80Refresh, &QPushButton::clicked, this, [this] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "GetSpecialResolution");
json.insert("_type", "GetSpecialResolution");
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("GetSpecialResolution"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [this, reply, waitingDlg] {
Def_CtrlSingleGetReply
waitingDlg->success();
fdM80Resolu->setCurrentText(json["displayResolution"].toString());
});
} else {
foreach(auto card, gSelCards) {
auto reply = NetReq("http://"+card.ip+":2016/settings").timeout(120000).post(json);
auto cardId = card.id;
connect(reply, &QNetworkReply::finished, this, [reply, cardId] {
QJsonDocument json;
QString err = checkReplyForJson(reply, &json);
if(err.isEmpty()) err = tr("totalResolution")+"["+json["totalResolution"].toString()+"], "+tr("strCurDisplayResolution")+"["+json["displayResolution"].toString()+"]";
gFdResInfo->append(cardId+" "+tr("GetSpecialResolution")+" "+err);
});
}
}
});
hBox->addWidget(btnY50Set);
hBox->addWidget(btnM80Refresh);
btnM80Restore = new QPushButton();
btnM80Restore->setProperty("ssType", "progManageTool");
connect(btnM80Restore, &QPushButton::clicked, this, [this] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "CleanDisplayScreenSize");
json.insert("_type", "CleanDisplayScreenSize");
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("CleanDisplayScreenSize"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSetReqAfter
});
} else {
foreach(auto card, gSelCards) {
Def_CtrlSetMulti(tr("CleanDisplayScreenSize"))
}
}
});
hBox->addWidget(btnM80Restore);
hBox->addStretch();
}
vBox->addWidget(grpY50);
vBox->addWidget(grpM80);
hBox = new HBox(vBox);
@ -1636,24 +1697,24 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
hBox->addWidget(fdDeg180);
auto fdDeg270 = new QRadioButton("270°");
hBox->addWidget(fdDeg270);
hBox->addStretch();
auto btnGrp = new QButtonGroup;
auto btnGrp = new QButtonGroup(hBox);
btnGrp->addButton(fdDeg0, 0);
btnGrp->addButton(fdDeg90, 1);
btnGrp->addButton(fdDeg180, 2);
btnGrp->addButton(fdDeg270, 3);
connect(btnGrp, &QButtonGroup::idToggled, this, [this](int value, bool checked) {
if(! checked) return;
btnRotateSet = new QPushButton;
btnRotateSet->setProperty("ssType", "progManageTool");
connect(btnRotateSet, &QPushButton::clicked, this, [=] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
auto id = btnGrp->checkedId();
QJsonObject json;
json.insert("_id", "SetScreenRotation");
json.insert("_type", "SetScreenRotation");
json.insert("rotation", value);
json.insert("rotation", id);
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("SetScreenRotation"));
Def_CtrlReqPre
@ -1666,6 +1727,47 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
}
}
});
hBox->addWidget(btnRotateSet);
btnRotateGet = new QPushButton;
btnRotateGet->setProperty("ssType", "progManageTool");
connect(btnRotateGet, &QPushButton::clicked, this, [=] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "GetScreenRotation");
json.insert("_type", "GetScreenRotation");
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("GetScreenRotation")+" ...");
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSingleGetReply
waitingDlg->success();
auto btn = btnGrp->button(json["rotation"].toInt());
if(btn) btn->setChecked(true);
});
} else {
foreach(auto card, gSelCards) {
auto reply = NetReq("http://"+card.ip+":2016/settings").timeout(120000).post(json);
connect(reply, &QNetworkReply::finished, this, [=] {
QJsonDocument json;
QString err = checkReplyForJson(reply, &json);
if(err.isEmpty()) {
auto rotation = json["rotation"].toInt();
auto btn = btnGrp->button(rotation);
err = btn ? btn->text() : QString::number(rotation);
}
gFdResInfo->append(card.id+" "+tr("GetScreenRotation")+" "+err);
});
}
}
});
hBox->addWidget(btnRotateGet);
hBox->addStretch();
hBox = new HBox(vBox);
@ -2163,15 +2265,14 @@ void CtrlAdvancedPanel::changeEvent(QEvent *event) {
void CtrlAdvancedPanel::transUi() {
btnBindTaxiIc->setText(tr("Binding *.ic account indentity voucher"));
btnGetTopLevel->setText(tr("Readback"));
btnLedSet3->setText(tr("Start LedSet3.0 configure LED module"));
btnLedSet4->setText(tr("Start LedSet4"));
btnLedSet->setText(tr("Start LedSet4"));
grpM80->setTitle("M80 "+tr("Config"));
btnM80Refresh->setText(tr("Refresh"));
btnM80Restore->setText(tr("Restore to default"));
btnM80Set->setText(tr("Set"));
grpY50->setTitle("ST50 / M50S / M60S / M70S / Y5A "+tr("Resolution Config"));
grpY50->setTitle("M50S / M60S / M70S / M5H / ST50 / Y1G / Y1C / Y4A / Y5A "+tr("Resolution Config"));
fdDisMode->setItemText(0, tr("Full screen"));
fdDisMode->setItemText(1, tr("Part"));
btnY50Set->setText(tr("Set"));
@ -2193,6 +2294,8 @@ void CtrlAdvancedPanel::transUi() {
fdHighForBusy->setText(tr("Service:High Out of service:Low"));
fdTopLevelLH->setText(tr("Service:Low Out of service:High"));
lbRotate->setText(tr("Rotate"));
btnRotateSet->setText(tr("Set"));
btnRotateGet->setText(tr("Get"));
grpBoxHiddenSettings->setTitle(tr("Hidden Settings")+" ("+tr("Click right button to hide")+")");
btnSysUpd->setText(tr("System Update"));

View File

@ -16,7 +16,7 @@
class CtrlAdvancedPanel : public QWidget {
Q_OBJECT
public:
explicit CtrlAdvancedPanel(QWidget *parent = nullptr);
explicit CtrlAdvancedPanel();
protected:
void showEvent(QShowEvent *event) override;
void init();
@ -54,7 +54,7 @@ private:
QPushButton *fdUninstall;
QPushButton *btnIsRunning;
QPushButton *btnRestart;
QPushButton *btnClearProg;
QPushButton *btnGetPlayerState, *btnClearProg;
QPushButton *btnGetLog;
QPushButton *btnSetBack, *btnPlayerBackSet, *btnPlayerBackClear;
@ -77,8 +77,7 @@ private:
QRadioButton *fdTopLevelLH;
QPushButton *btnHighForBusySet;
QPushButton *btnGetTopLevel;
QPushButton *btnLedSet3;
QPushButton *btnLedSet4;
QPushButton *btnLedSet;
QPushButton *btnBindTaxiIc;
QGroupBox *grpMinMaxBrightness;
@ -93,6 +92,7 @@ private:
QGroupBox *grpBoxHiddenSettings;
QPushButton *btnSysUpd, *btnMcuUpd, *btnMcuGet;
QPushButton *btnRotateSet, *btnRotateGet;
QLabel *lbRotate, *lbBaudCfg, *lbBaudModel, *lbUart, *lbBaud;
QPushButton *btnBaudSet, *btnBaudGet;
QCheckBox *fdIsOpenADB;

View File

@ -15,7 +15,7 @@
#include <QTimeEdit>
#include "devicepanel.h"
CtrlBrightPanel::CtrlBrightPanel(QWidget *parent) : QWidget(parent) {
CtrlBrightPanel::CtrlBrightPanel() {
auto vBox = new VBox(this);
vBox->setContentsMargins(0,0,0,0);
vBox->addSpacing(8);

View File

@ -10,7 +10,7 @@
class CtrlBrightPanel : public QWidget {
Q_OBJECT
public:
explicit CtrlBrightPanel(QWidget *parent = nullptr);
CtrlBrightPanel();
protected:
void showEvent(QShowEvent *event) override;
void init();

View File

@ -10,7 +10,7 @@
#include <QStackedLayout>
#include <QGridLayout>
CtrlNetworkPanel::CtrlNetworkPanel(QWidget *parent) : QWidget(parent) {
CtrlNetworkPanel::CtrlNetworkPanel() {
auto vBox = new VBox(this);
lbLanCfg = new QLabel;

View File

@ -30,7 +30,7 @@ struct ApnInfo {
class CtrlNetworkPanel : public QWidget {
Q_OBJECT
public:
explicit CtrlNetworkPanel(QWidget *parent = nullptr);
explicit CtrlNetworkPanel();
void getCurrentAPN(QString &);
protected:
void showEvent(QShowEvent *event) override;

View File

@ -10,7 +10,7 @@
#include "deviceitem.h"
#include "devicepanel.h"
CtrlPwdPanel::CtrlPwdPanel(QWidget *parent) : QWidget(parent) {
CtrlPwdPanel::CtrlPwdPanel() {
auto vBox = new VBox(this);
lbPwdConfig = new QLabel;
lbPwdConfig->setAlignment(Qt::AlignCenter);

View File

@ -8,7 +8,7 @@
class CtrlPwdPanel : public QWidget {
Q_OBJECT
public:
explicit CtrlPwdPanel(QWidget *parent = nullptr);
explicit CtrlPwdPanel();
protected:
void showEvent(QShowEvent *event) override;
void init();

View File

@ -12,7 +12,7 @@
#include <QMessageBox>
#include <QHostAddress>
CtrlTestPanel::CtrlTestPanel(QWidget *parent) : QWidget(parent) {
CtrlTestPanel::CtrlTestPanel() {
auto vBox = new VBox(this);
labelTestScreen = new QLabel;

View File

@ -13,7 +13,7 @@
class CtrlTestPanel : public QWidget {
Q_OBJECT
public:
explicit CtrlTestPanel(QWidget *parent = nullptr);
explicit CtrlTestPanel();
protected:
void changeEvent(QEvent *) override;
void transUi();

View File

@ -9,7 +9,7 @@
#include <QButtonGroup>
#include "devicepanel.h"
CtrlVerifyClockPanel::CtrlVerifyClockPanel(QWidget *parent) : QWidget(parent) {
CtrlVerifyClockPanel::CtrlVerifyClockPanel() {
auto vBox = new VBox(this);
auto hBox = new HBox(vBox);

View File

@ -12,7 +12,7 @@
class CtrlVerifyClockPanel : public QWidget {
Q_OBJECT
public:
explicit CtrlVerifyClockPanel(QWidget *parent = nullptr);
explicit CtrlVerifyClockPanel();
protected:
void showEvent(QShowEvent *event) override;
void init();

View File

@ -168,6 +168,7 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) {
QEventLoop loop;
connect(reply, &QNetworkReply::finished, &loop, &QEventLoop::quit);
connect(reply, &QNetworkReply::downloadProgress, waitingDlg, [=](qint64 bytesReceived, qint64 bytesTotal) {
if(bytesTotal==0) return;
waitingDlg->fdText->setText(tr("Downloading Online File")+" "+QString::number(bytesReceived*100/bytesTotal)+" %");
});
loop.exec(QEventLoop::ExcludeUserInputEvents);
@ -198,7 +199,7 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) {
NetReq req("http://"+item->mCard.ip+":2016/upload?type="+(isApk ? "software":"hardware"));
auto reply = req.timeout(120000).type("multipart/form-data; boundary="+Boundary).post(data);
connect(reply, &QNetworkReply::uploadProgress, item->mProgress, [item](qint64 bytesSent, qint64 bytesTotal) {
if(bytesTotal<=0) return;
if(bytesTotal==0) return;
item->mProgress->setValue(bytesSent*100/bytesTotal);
});
connect(reply, &QNetworkReply::finished, item->mProgress, [=] {
@ -209,7 +210,7 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) {
return;
}
item->mProgress->setValue(100);
item->setResult(tr("Installing")+" ...");
auto info = tr("Installing")+" ...";
QJsonObject json;
if(isApk) {
json.insert("_id", "UpgradeSoftware");
@ -217,9 +218,11 @@ UpgradeApkDialog::UpgradeApkDialog(QWidget *parent) : QDialog(parent) {
json.insert("fileName", fileName);
json.insert("isCustom", true);
} else {
info += tr("Don't power off during this process");
json.insert("_id", "SynchronousHardwareVersion");
json.insert("_type", "SynchronousHardwareVersion");
}
item->setResult(info);
auto reply = NetReq("http://"+item->mCard.ip+":2016/settings").timeout(120000).post(json);
connect(reply, &QNetworkReply::finished, item->mProgress, [=] {
item->isUpdating = false;

View File

@ -59,11 +59,11 @@ wUpgradeApkItem::wUpgradeApkItem(LedCard pLedCard, LoQTreeWidget *parent) : QTre
}
waitingDlg->success();
mCard.isLocked = false;
btnUnlock->setIcon(QIcon(":/res/device/UnLock.png"));
btnUnlock->setIcon(QIcon(":/res/UnLock.png"));
auto item = findItem(mCard.id);
if(item) {
item->mCard.isLocked = false;
item->btnUnlock->setIcon(QIcon(":/res/device/UnLock.png"));
item->btnUnlock->setIcon(QIcon(":/res/UnLock.png"));
}
});
});
@ -132,12 +132,12 @@ void wUpgradeApkItem::SetItemParam(LedCard card) {
setData(Upgrade_SCREEN_ID, 0, card.id);
setData(Upgrade_SCREEN_IP, 0, card.ip);
setData(Upgrade_REMARK_NAME, 0, card.alias);
m_ImageOnline->setPixmap(QPixmap(mCard.isOnline ? ":/res/device/O_Online.png" : ":/res/device/O_Offline.png"));
m_ImageOnline->setPixmap(QPixmap(mCard.isOnline ? ":/res/O_Online.png" : ":/res/O_Offline.png"));
OnCheckSoftVersions();
OnCheckFpgaVersions();
if(! card.hasPassword) btnUnlock->hide();
else {
if(! btnUnlock->isVisible()) btnUnlock->show();
btnUnlock->setIcon(QIcon(card.isLocked ? ":/res/device/Lock.png" : ":/res/device/UnLock.png")); //如果已经验证通过密码显示绿色图标 没有验证显示蓝色锁图标
btnUnlock->setIcon(QIcon(card.isLocked ? ":/res/Lock.png" : ":/res/UnLock.png")); //如果已经验证通过密码显示绿色图标 没有验证显示蓝色锁图标
}
}

View File

@ -1,144 +0,0 @@
#include "devicectrlpanel.h"
#include "devicepanel.h"
#include "tools.h"
#include "device/ctrlbrightpanel.h"
#include "device/ctrlpowerpanel.h"
#include "device/ctrlnetworkpanel.h"
#include "device/ctrlverifyclockpanel.h"
#include "device/ctrlhdmipanel.h"
#include "device/ctrlvolumepanel.h"
#include "device/ctrlpwdpanel.h"
#include "device/ctrladvancedpanel.h"
#include "device/ctrltestpanel.h"
QTextEdit *gFdResInfo;
DeviceCtrlPanel::DeviceCtrlPanel(DevicePanel *parent) : QWidget(parent), mDevWgt(parent) {
auto vBox = new QVBoxLayout(this);
vBox->setContentsMargins(0,0,0,0);
vBox->setSpacing(0);
auto hBox = new QHBoxLayout;
hBox->setSpacing(2);
mBtnGrp = new QButtonGroup(this);
for(int i=0; i<Setting_End; i++) {
auto btn = new QToolButton();
auto policy = btn->sizePolicy();
policy.setHorizontalPolicy(QSizePolicy::Preferred);
btn->setSizePolicy(policy);
btn->setIconSize(QSize(48, 48));
btn->setCheckable(true);
btn->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
btn->setProperty("ss", "CtrlTab");
hBox->addWidget(btn);
mBtnGrp->addButton(btn, i);
}
mBtnGrp->button(Setting_Bright)->setIcon(QIcon(":/res/bnBrightnessAdjustMent_s.png"));
mBtnGrp->button(Setting_PowerControl)->setIcon(QIcon(":/res/bnPowerControl_s.png"));
mBtnGrp->button(Setting_NetCfg)->setIcon(QIcon(":/res/bnNetConfig_s.png"));
mBtnGrp->button(Setting_VerifyClock)->setIcon(QIcon(":/res/bnVerifyClock_s.png"));
mBtnGrp->button(Setting_Encrypt)->setIcon(QIcon(":/res/encrypt.png"));
mBtnGrp->button(Setting_HDMI)->setIcon(QIcon(":/res/Hdmi.png"));
mBtnGrp->button(Setting_Volume)->setIcon(QIcon(":/res/volume.png"));
mBtnGrp->button(Setting_Advanced)->setIcon(QIcon(":/res/AdvParam.png"));
mBtnGrp->button(Setting_Test)->setIcon(QIcon(":/res/test.png"));
connect(mBtnGrp, &QButtonGroup::idToggled, this, [this](int index, bool checked) {
if(!checked || index==curIndex) return;
curIndex = index;
if(wgts[index]==0) {
if(index==Setting_Bright) wgts[index] = new CtrlBrightPanel(this);
else if(index==Setting_PowerControl) wgts[index] = new CtrlPowerPanel;
else if(index==Setting_NetCfg) wgts[index] = new CtrlNetworkPanel(this);
else if(index==Setting_VerifyClock) wgts[index] = new CtrlVerifyClockPanel(this);
else if(index==Setting_Encrypt) wgts[index] = new CtrlPwdPanel(this);
else if(index==Setting_HDMI) wgts[index] = new CtrlHdmiPanel;
else if(index==Setting_Volume) wgts[index] = new CtrlVolumePanel;
else if(index==Setting_Advanced) wgts[index] = new CtrlAdvancedPanel(this);
else if(index==Setting_Test) wgts[index] = new CtrlTestPanel(this);
}
scrollArea->takeWidget();
scrollArea->setWidget(wgts[index]);
});
vBox->addLayout(hBox);
auto line = new QFrame;
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
vBox->addWidget(line);
hBox = new QHBoxLayout();
scrollArea = new QScrollArea();
scrollArea->setWidgetResizable(true);
hBox->addWidget(scrollArea);
auto vBox2 = new QVBoxLayout();
fdInfo = new QTextEdit();
gFdResInfo = fdInfo;
fdInfo->setReadOnly(true);
fdInfo->setMaximumWidth(360);
vBox2->addWidget(fdInfo);
btnClear = new QPushButton(tr("Clear"));
btnClear->setMinimumHeight(30);
btnClear->setProperty("ssType", "progManageTool");
connect(btnClear, &QPushButton::clicked, fdInfo, &QTextEdit::clear);
vBox2->addWidget(btnClear);
hBox->addLayout(vBox2);
vBox->addLayout(hBox);
fdInfo->hide();
btnClear->hide();
connect(mDevWgt, &DevicePanel::sigSelectedDeviceList, this, [this] {
if(gSelCards.count() < 2) {
if(gSelCards.count()==1) mDevWgt->fdCardNumInfo->setText(tr("Current Screen")+": "+gSelCards[0].id);
else mDevWgt->fdCardNumInfo->setText(tr("Current Screen")+": "+tr("none"));
fdInfo->hide();
btnClear->hide();
} else {
mDevWgt->fdCardNumInfo->setText(tr("Multi screen operation")+". "+tr("selected num")+": "+QString::number(gSelCards.count()));
fdInfo->clear();
fdInfo->show();
btnClear->show();
}
});
transUi();
mBtnGrp->button(0)->setChecked(true);
}
void DeviceCtrlPanel::changeEvent(QEvent *event) {
QWidget::changeEvent(event);
if(event->type() == QEvent::LanguageChange) transUi();
}
void DeviceCtrlPanel::showEvent(QShowEvent *event) {
QWidget::showEvent(event);
mDevWgt->mDeviceTable->setSelectionMode(QAbstractItemView::SingleSelection);
}
void DeviceCtrlPanel::hideEvent(QHideEvent *event) {
QWidget::hideEvent(event);
mDevWgt->mDeviceTable->setSelectionMode(QAbstractItemView::NoSelection);
}
void DeviceCtrlPanel::transUi() {
mBtnGrp->button(Setting_Bright)->setText(tr("Brightness Adj."));
mBtnGrp->button(Setting_PowerControl)->setText(tr("Power Control"));
mBtnGrp->button(Setting_NetCfg)->setText(tr("Net Config"));
mBtnGrp->button(Setting_VerifyClock)->setText(tr("Time Sync"));
mBtnGrp->button(Setting_HDMI)->setText(tr("Video source"));
mBtnGrp->button(Setting_Encrypt)->setText(tr("Password"));
mBtnGrp->button(Setting_Advanced)->setText(tr("Advanced"));
mBtnGrp->button(Setting_Volume)->setText(tr("Volume Adj."));
mBtnGrp->button(Setting_Test)->setText(tr("Test"));
if(gSelCards.count() < 1) mDevWgt->fdCardNumInfo->setText(tr("Current Screen")+": "+tr("none"));
else if(gSelCards.count()==1) mDevWgt->fdCardNumInfo->setText(tr("Current Screen")+": "+gSelCards[0].id);
else mDevWgt->fdCardNumInfo->setText(tr("Multi screen operation")+". "+tr("selected num")+": "+QString::number(gSelCards.count()));
btnClear->setText(tr("Clear"));
}

View File

@ -1,34 +0,0 @@
#ifndef DEVICECTRLPANEL_H
#define DEVICECTRLPANEL_H
#include "globaldefine.h"
#include <QScrollArea>
#include <QPushButton>
#include <QToolButton>
#include <QTextEdit>
#include <QLabel>
class DevicePanel;
class DeviceCtrlPanel : public QWidget {
Q_OBJECT
public:
explicit DeviceCtrlPanel(DevicePanel *parent = nullptr);
QTextEdit *fdInfo;
protected:
void showEvent(QShowEvent *event) override;
void hideEvent(QHideEvent *event) override;
void changeEvent(QEvent *) override;
void transUi();
private:
DevicePanel *mDevWgt;
QButtonGroup *mBtnGrp;
QScrollArea *scrollArea;
QPushButton *btnClear;
QWidget *wgts[Setting_End]{};
int curIndex{-1};
};
#endif // DEVICECTRLPANEL_H

Some files were not shown because too many files have changed in this diff Show More