ledok增加播放器背景

This commit is contained in:
gangphon 2022-09-13 23:16:36 +08:00
parent 1c61ae8216
commit 3cf0eee7ab
21 changed files with 1519 additions and 1208 deletions

View File

@ -7,7 +7,6 @@
#define RECTF_INVALID QRectF(-9999, -9999, 0, 0)
extern const QString UpdVerUrl;
extern QString fileHome;
QString programsDir();

View File

@ -5,6 +5,7 @@
#include <QCoreApplication>
#include <QMessageBox>
#include <QMetaEnum>
bool gTextAntialiasing = false;
bool gShowLoraScreen = false;
@ -25,16 +26,16 @@ QString parseReplyJson(QNetworkReply *reply, QJsonDocument *outJson) {
error = QNetworkReply::TimeoutError;
errStr = QCoreApplication::translate("Def","Connection Timeout");
}
return QString(QMetaEnum::fromType<QNetworkReply::NetworkError>().valueToKey(error))+" ("+QString::number(error)+")\n"+errStr+"\n"+reply->readAll();
return QString(QMetaEnum::fromType<QNetworkReply::NetworkError>().valueToKey(error))+" ("+QString::number(error)+") "+errStr+"\n"+QCoreApplication::translate("Def","Device replied")+":\n"+reply->readAll();
}
}
auto status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if(status != 200) return QString::number(status)+" "+reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString()+"\n"+reply->readAll();
if(status != 200) return QString::number(status)+" "+reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString()+"\n"+QCoreApplication::translate("Def","Device replied")+":\n"+reply->readAll();
if(outJson) {
auto data = reply->readAll();
QJsonParseError jsonErr;
*outJson = QJsonDocument::fromJson(data, &jsonErr);
if(jsonErr.error != QJsonParseError::NoError) return "JsonError "+jsonErr.errorString()+"\n"+data;
if(jsonErr.error != QJsonParseError::NoError) return "Json error: "+jsonErr.errorString()+"\n"+QCoreApplication::translate("Def","Device replied")+":\n"+data;
}
return "";
}
@ -49,18 +50,19 @@ QString checkReplyForJson(QNetworkReply *reply, QJsonDocument *doc) {
error = QNetworkReply::TimeoutError;
errStr = QCoreApplication::translate("Def","Connection Timeout");
}
return QString(QMetaEnum::fromType<QNetworkReply::NetworkError>().valueToKey(error))+" ("+QString::number(error)+")\n"+errStr+"\n"+data;
return QString(QMetaEnum::fromType<QNetworkReply::NetworkError>().valueToKey(error))+" ("+QString::number(error)+") "+errStr+"\n"+QCoreApplication::translate("Def","Device replied")+":\n"+data;
}
}
auto status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt();
if(status != 200) return QString::number(status)+" - "+reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString()+"\n"+data;
if(status != 200) return QString::number(status)+" - "+reply->attribute(QNetworkRequest::HttpReasonPhraseAttribute).toString()+"\n"+QCoreApplication::translate("Def","Device replied")+":\n"+data;
QJsonParseError jsonErr;
QJsonDocument json = QJsonDocument::fromJson(data, &jsonErr);
if(jsonErr.error != QJsonParseError::NoError) return "JsonError "+jsonErr.errorString()+"\n"+data;
if(! json["success"].toBool()) return QCoreApplication::translate("Def","Fail")+"\n"+data;
if(jsonErr.error != QJsonParseError::NoError) return "Json error: "+jsonErr.errorString()+"\n"+QCoreApplication::translate("Def","Device replied")+":\n"+data;
if(! json["success"].toBool()) return QCoreApplication::translate("Def","Fail")+". "+QCoreApplication::translate("Def","Device replied")+":\n"+data;
if(doc) doc->swap(json);
return "";
}
bool isTextValid(const QString &strIP){
if(! strIP.isEmpty()) {
QRegExp rx2("\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b");

View File

@ -28,7 +28,7 @@ LONG WINAPI handleException(_EXCEPTION_POINTERS *excep) {
}
#endif
QString fileHome;
QString gFileHome;
int main(int argc, char *argv[]) {
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
@ -38,7 +38,7 @@ int main(int argc, char *argv[]) {
QApplication::setOrganizationDomain("www.ledok.cn");
QApplication::setApplicationName("LedOK Express");
QApplication a(argc, argv);
fileHome = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
gFileHome = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
QFont font;
font.setFamilies(QStringList{"Arial","Microsoft YaHei UI"});
font.setPixelSize(14);

View File

@ -21,6 +21,7 @@ extern QWidget *gMainWin;
extern DevicePanel *gDevicePanel;
extern QList<LedCard*> *gSelCards;
extern QTextEdit *gFdResInfo;
extern QString gFileHome;
extern QString gProgDir;
extern int gProgWidth;
extern int gProgHeight;

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

@ -896,16 +896,6 @@ void ControlNetConfigWidget::onReadbackAllThisPage()
HttpPostByTypeJsonObject(pHpptClientAll,m_strUrl,json6);
MACRO_DEFINE_TIPDLG_ALL_FUCN(tr("Readback"),tr("Success"),tr("failed"))
}
void ControlNetConfigWidget::OnWiFiOpenChanged(bool b)
{
CHECK_CARD_SELECTED
QJsonObject json;
json.insert("_id", getRandomString(10));
json.insert("_type", "SetSwitchWiFi");
json.insert("enable", b);
MACRO_DEFINE_TIPDLG_FUCN(tr("SetSwitchWiFi"),tr("Success"),tr("failed"))
}
void ControlNetConfigWidget::onSetWiFiModel()
{
CHECK_CARD_SELECTED
@ -933,8 +923,6 @@ void ControlNetConfigWidget::onSetWiFiModel()
json1.insert("_type", "SetSwitchWiFi");
json1.insert("enable", true);
HttpPostByTypeJsonObject(pHpptClient,m_strUrl,json1);
// MACRO_DEFINE_TIPDLG_FUCN(tr("SetSwitchWiFi"),tr("Success"),tr("failed"))
QJsonObject json;
json.insert("_id", getRandomString(10));
json.insert("_type", "ConfigurationWiFi");

View File

@ -46,7 +46,6 @@ protected slots:
void onReadbackWiFiModel();
void onSetAp();
void OnDhcpOrSpecifyIp(int iIndex);
void OnWiFiOpenChanged(bool b);
void OnScanWifi();
void onSet4GInfo();
void onReadback4G();

View File

@ -6,6 +6,7 @@
#include "LoUIClass/updateledset3dialog.h"
#include "passwordindlg.h"
#include "tools.h"
#include "wProgramManager/ephoto.h"
#include "upgradeapkdialog.h"
#include "base/table.h"
#include <QBoxLayout>
@ -23,6 +24,7 @@
#include <QUuid>
#include <QHeaderView>
#include <QColorDialog>
#include "tcpsocket.h"
CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : QWidget(parent), m_pLedlist(list) {
m_pLedlist = gSelCards;
@ -398,7 +400,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, tcp, [tcp] {
tcp->close();
QMessageBox::critical(gMainWin, tr("Tip"), tr("Timeout"));
QMessageBox::critical(gMainWin, tr("Tip"), tr("Clear Program")+" "+tr("Timeout"));
});
connect(tcp, &QTcpSocket::disconnected, timer, &QTimer::stop);
connect(tcp, &QTcpSocket::disconnected, tcp, &QTcpSocket::deleteLater);
@ -424,7 +426,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
connect(tcp, &QTcpSocket::errorOccurred, tcp, [tcp, waitingDlg](QAbstractSocket::SocketError err) {
tcp->close();
waitingDlg->close();
QMessageBox::critical(gMainWin, tr("Tip"), QString::number(err)+" - "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(err)+": "+tcp->errorString());
QMessageBox::critical(gMainWin, tr("Tip"), QString("1 (2) 3").arg(QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(err)).arg(err).arg(tcp->errorString()));
});
tcp->connectToHost(card->m_strCardIp, 3333);
timer->start(10000);
@ -455,7 +457,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
});
connect(tcp, &QTcpSocket::errorOccurred, tcp, [tcp, card](QAbstractSocket::SocketError err) {
tcp->close();
gFdResInfo->append(card->m_strCardId+" "+tr("Clear Program")+" "+QString::number(err)+" - "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(err)+": "+tcp->errorString());
gFdResInfo->append(card->m_strCardId+" "+tr("Clear Program")+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(err)+" ("+QString::number(err)+") "+tcp->errorString());
});
tcp->connectToHost(card->m_strCardIp, 3333);
timer->start(10000);
@ -792,6 +794,225 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent,QList<LedCard *> *list) : Q
});
hBox->addWidget(btnSysUpd);
btnPlayerBackSet = new QPushButton;
btnPlayerBackSet->setProperty("ssType", "progManageTool");
connect(btnPlayerBackSet, &QPushButton::clicked, this, [this] {
if(gSelCards->isEmpty()) {
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
return;
}
QString file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, EPhoto::filters());
if(file.isEmpty()) return;
QFileInfo info(file);
if(! info.isFile()) return;
auto waitingDlg = new WaitingDlg(this, tr("Clearing player background")+" ...");
waitingDlg->show();
auto card = gSelCards->at(0);
auto err = new QString;
auto thread = QThread::create([card, file, err] {
TcpSocket tcp;
tcp.connectToHost(card->m_strCardIp, 3333);
if(! tcp.waitForConnected()) {
err->append(QString::number(tcp.error())+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(tcp.error())+" when waitForConnected");
tcp.close();
return;
}
//4.发送协商列表应答里的文件
long long sentBytes = 0;
QFileInfo info(file);
auto baseName = info.baseName();
auto remain = info.size();
auto req = QJsonObject();
req.insert("_type", "imgFileStart");
req.insert("id", baseName);
req.insert("size", remain);
auto resNum = tcp.write(QJsonDocument(req).toJson(QJsonDocument::Compact));
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
err->append(QString::number(tcp.error())+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(tcp.error())+" when write 'fileStart'");
tcp.close();
return;
}
auto file = new QFile(info.filePath());
if(! file->open(QFile::ReadOnly)) {
err->append(tr("open file failed")+" "+file->errorString());
tcp.close();
return;
}
while(remain > 0) {
auto readed = file->read(qMin(4096LL, remain));
if(readed.isEmpty()) {
err->append(tr("Read file failed")+" "+file->errorString());
tcp.close();
file->close();
return;
}
resNum = tcp.write(readed);
if(resNum == -1) {
err->append(QString::number(tcp.error())+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(tcp.error())+" when write file: "+file->fileName());
tcp.close();
file->close();
return;
}
if(! tcp.waitForBytesWritten()) {
err->append(QString::number(tcp.error())+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(tcp.error())+" when waitForWritten file: "+file->fileName());
tcp.close();
file->close();
return;
}
remain -= resNum;
sentBytes += resNum;
}
file->close();
req = QJsonObject();
req.insert("_type", "fileEnd");
req.insert("id", baseName);
req.insert("zVer", "xixun1");
resNum = tcp.write(QJsonDocument(req).toJson(QJsonDocument::Compact));
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
emit emErr(QString::number(tcp.error())+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(tcp.error())+" when write 'fileEnd'");
tcp.close();
return;
}
//5.发送结束
req = QJsonObject();
req.insert("_type", "proEnd");
req.insert("proName", "program");
req.insert("zVer","xixun1");
resNum = tcp.write(QJsonDocument(req).toJson(QJsonDocument::Compact));
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
emit emErr(QString::number(tcp.error())+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(tcp.error())+" when write 'proEnd'");
tcp.close();
return;
};
if(! tcp.waitForReadyRead()) {
emit emErr(QString::number(tcp.error())+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(tcp.error())+" when waitForRead 'proEnd'");
tcp.close();
return;
}
auto resp = tcp.readAll();
if(resp.isEmpty()) {
emit emErr(QString::number(tcp.error())+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(tcp.error())+" when read 'proEnd'");
tcp.close();
return;
}
tcp.close();
emit emErr("OK");
});
connect(thread, &QThread::finished, this, [thread] {
thread->deleteLater();
});
QColorDialog colorDlg(this);
colorDlg.setOption(QColorDialog::DontUseNativeDialog);
if(colorDlg.exec() != QColorDialog::Accepted) return;
QColor color = colorDlg.selectedColor();
if(! color.isValid()) return;
QJsonObject json;
json.insert("_id", "SetWallpaper");
json.insert("_type", "SetWallpaper");
json.insert("rgb", color.name());
if(gSelCards->count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("Setting Wallpaper")+" ...");
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [reply, waitingDlg] {
Def_CtrlSetReqAfter
});
} else {
foreach(auto card, *gSelCards) {
Def_CtrlSetMulti(tr("Set Wallpaper"))
}
}
});
hBox->addWidget(btnPlayerBackSet);
hBox->addSpacing(20);
btnPlayerBackClear = new QPushButton;
btnPlayerBackClear->setProperty("ssType", "progManageTool");
connect(btnPlayerBackClear, &QPushButton::clicked, this, [this] {
if(gSelCards->isEmpty()) {
QMessageBox::information(gMainWin, tr("Tip"), tr("NoSelectedController"));
return;
}
if(gSelCards->count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("Clearing player background")+" ...");
waitingDlg->show();
auto card = gSelCards->at(0);
auto tcp = new QTcpSocket();
auto timer = new QTimer(tcp);
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, tcp, [tcp] {
tcp->close();
QMessageBox::critical(gMainWin, tr("Tip"), tr("Clear player background")+" "+tr("Timeout"));
});
connect(tcp, &QTcpSocket::disconnected, timer, &QTimer::stop);
connect(tcp, &QTcpSocket::disconnected, tcp, &QTcpSocket::deleteLater);
connect(tcp, &QTcpSocket::connected, tcp, [tcp, timer] {
timer->stop();
tcp->write("{\"_type\":\"DelBackImg\",\"_id\":\"DelBackImg\"}");
timer->start(10000);
});
connect(tcp, &QTcpSocket::readyRead, tcp, [tcp, waitingDlg] {
QByteArray resp = tcp->readAll();
tcp->close();
QJsonParseError parseErr;
QJsonDocument json = QJsonDocument::fromJson(resp, &parseErr);
if(parseErr.error != QJsonParseError::NoError) {
waitingDlg->close();
QMessageBox::critical(gMainWin, tr("Tip"), parseErr.errorString());
}
else if(! json["success"].toBool()) {
waitingDlg->close();
QMessageBox::critical(gMainWin, tr("Tip"), tr("Clear player background")+" "+tr("Failed"));
} else waitingDlg->success();
});
connect(tcp, &QTcpSocket::errorOccurred, tcp, [tcp, waitingDlg](QAbstractSocket::SocketError err) {
tcp->close();
waitingDlg->close();
QMessageBox::critical(gMainWin, tr("Tip"), QString("1 (2) 3").arg(QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(err)).arg(err).arg(tcp->errorString()));
});
tcp->connectToHost(card->m_strCardIp, 3333);
timer->start(10000);
} else {
foreach(auto card, *gSelCards) {
auto tcp = new QTcpSocket();
auto timer = new QTimer(tcp);
timer->setSingleShot(true);
connect(timer, &QTimer::timeout, tcp, [tcp, card] {
tcp->close();
gFdResInfo->append(card->m_strCardId+" "+tr("Clear player background")+" "+tr("Timeout"));
});
connect(tcp, &QTcpSocket::disconnected, timer, &QTimer::stop);
connect(tcp, &QTcpSocket::disconnected, tcp, &QTcpSocket::deleteLater);
connect(tcp, &QTcpSocket::connected, tcp, [tcp, timer] {
timer->stop();
tcp->write("{\"_type\":\"DelBackImg\",\"_id\":\"DelBackImg\"}");
timer->start(10000);
});
connect(tcp, &QTcpSocket::readyRead, tcp, [tcp, card] {
QByteArray resp = tcp->readAll();
tcp->close();
QJsonParseError parseErr;
QJsonDocument json = QJsonDocument::fromJson(resp, &parseErr);
if(parseErr.error != QJsonParseError::NoError) gFdResInfo->append(card->m_strCardId+" "+tr("Clear player background")+" "+parseErr.errorString());
else if(! json["success"].toBool()) gFdResInfo->append(card->m_strCardId+" "+tr("Clear player background")+" "+tr("Failed"));
else gFdResInfo->append(card->m_strCardId+" "+tr("Clear player background")+" "+tr("Success"));
});
connect(tcp, &QTcpSocket::errorOccurred, tcp, [tcp, card](QAbstractSocket::SocketError err) {
tcp->close();
gFdResInfo->append(card->m_strCardId+" "+tr("Clear player background")+" "+QMetaEnum::fromType<QAbstractSocket::SocketError>().valueToKey(err)+" ("+QString::number(err)+") "+tcp->errorString());
});
tcp->connectToHost(card->m_strCardIp, 3333);
timer->start(10000);
}
}
});
hBox->addWidget(btnPlayerBackClear);
hBox->addStretch();
vBox->addLayout(hBox);

View File

@ -12,12 +12,6 @@
#include <QCheckBox>
#include <QFile>
class cApkInfo{
public:
QString strApkPageName;
QString strVersion;
};
class CtrlAdvancedPanel : public QWidget {
Q_OBJECT
public:
@ -75,7 +69,6 @@ private:
LoEmptyDialog * m_PostingDlg=nullptr;
QTimer *m_pGetAskTimer=nullptr;
bool m_passwordOk=false;
QList<cApkInfo> m_listApk;
QString m_strUpgradeApkFile="";
QString m_strUpgradeFpgaFile="";
QJsonObject mM80Map;
@ -111,7 +104,7 @@ private:
QPushButton *pushButtonRestart;
QPushButton *btnClearProg;
QPushButton *btnGetLog;
QPushButton *btnSetBack;
QPushButton *btnSetBack, *btnPlayerBackSet, *btnPlayerBackClear;
QGroupBox *groupM80;
QComboBox *fdM80;
@ -143,7 +136,6 @@ private:
QLabel *label_5;
QPushButton *pushButtonReadbackMaxBrightess;
QPushButton *pushButtonSendMaxBrightness;
QFrame *line_2;
QGroupBox *grpBoxHiddenSettings;
QPushButton *btnSysUpd;

View File

@ -141,7 +141,7 @@ QWidget* EAudio::attrWgt() {
mDuration = value;
});
connect(bnSelectFile, &QPushButton::clicked, this, [this, fdFileName, fdDuration] {
auto file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), fileHome, EAudio::filters());
auto file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, EAudio::filters());
if(file.isEmpty()) return;
int64_t dur;
QString err = Tools::audioInfo(file.toUtf8(), &dur);
@ -151,7 +151,7 @@ QWidget* EAudio::attrWgt() {
}
QFileInfo info(file);
mDir = info.absolutePath();
fileHome = mDir;
gFileHome = mDir;
mName = info.fileName();
fdFileName->setText(mName);
fdDuration->setValue(dur/1000000);

View File

@ -117,7 +117,7 @@ QWidget* EGif::attrWgt() {
bnSelectFile->setFixedWidth(30);
bnSelectFile->setObjectName("bnSelectFile");
connect(bnSelectFile, &QPushButton::clicked, this, [this, wFile] {
auto file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), fileHome, EGif::filters());
auto file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, EGif::filters());
if(file.isEmpty()) return;
auto movie = new QMovie(file);
if(! movie->isValid()) {
@ -130,7 +130,7 @@ QWidget* EGif::attrWgt() {
mName = fileInfo.fileName();
wFile->setText(mName);
mDir = fileInfo.absolutePath();
fileHome = mDir;
gFileHome = mDir;
if(mMovie!=nullptr) delete mMovie;
mMovie = movie;
});

View File

@ -140,7 +140,7 @@ QWidget* EMultiWin::attrWgt() {
EBase *ele = nullptr;
QListWidgetItem *item = nullptr;
if(type==EBase::Photo) {
auto files = QFileDialog::getOpenFileNames(gMainWin, tr("Select File"), fileHome, EPhoto::filters());
auto files = QFileDialog::getOpenFileNames(gMainWin, tr("Select File"), gFileHome, EPhoto::filters());
for(int i=0; i<files.count(); i++) {
auto ePhoto = EPhoto::create(files[i], mPageItem, this);
if(ePhoto==nullptr) continue;
@ -153,11 +153,11 @@ QWidget* EMultiWin::attrWgt() {
listWgt->addItem(item);
if(i==files.count()-1) {
listWgt->setCurrentItem(item);
fileHome = ePhoto->mDir;
gFileHome = ePhoto->mDir;
}
}
} else if(type==EBase::Gif) {
auto files = QFileDialog::getOpenFileNames(gMainWin, tr("Select File"), fileHome, EGif::filters());
auto files = QFileDialog::getOpenFileNames(gMainWin, tr("Select File"), gFileHome, EGif::filters());
for(int i=0; i<files.count(); i++) {
auto eGif = EGif::create(files[i], mPageItem, this);
if(eGif==nullptr) continue;
@ -170,16 +170,16 @@ QWidget* EMultiWin::attrWgt() {
listWgt->addItem(item);
if(i == files.count()-1) {
listWgt->setCurrentItem(item);
fileHome = eGif->mDir;
gFileHome = eGif->mDir;
}
}
} else if(type==EBase::Video) {
auto file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), fileHome, EVideo::filters());
auto file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, EVideo::filters());
if(! file.isEmpty()) {
auto eVideo = EVideo::create(file, mPageItem, this);
if(eVideo==nullptr) return;
item = new QListWidgetItem(QIcon(":/res/ProgramManager/EditProgram/Movie.png"), tr("Video")+" "+eVideo->mRawName);
fileHome = eVideo->mRawDir;
gFileHome = eVideo->mRawDir;
ele = eVideo;
}
} else if(type==EBase::Text) {

View File

@ -122,9 +122,9 @@ QWidget* EPhoto::attrWgt() {
bnSelectFile->setFixedWidth(30);
bnSelectFile->setObjectName("bnSelectFile");
connect(bnSelectFile, &QPushButton::clicked, this, [this, fdFile] {
QString home = mDir.startsWith(gProgDir) ? fileHome : mDir;
QString home = mDir.startsWith(gProgDir) ? gFileHome : mDir;
QString file = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), home, EPhoto::filters());
if(file.isNull()) return;
if(file.isEmpty()) return;
QImageReader reader(file);
QImage aimg = reader.read();
if(aimg.isNull()) {
@ -134,7 +134,7 @@ QWidget* EPhoto::attrWgt() {
img = aimg;
QFileInfo info(file);
mDir = info.absolutePath();
fileHome = mDir;
gFileHome = mDir;
mName = info.fileName();
scaleImgIfNeed();
fdFile->setText(mName);

View File

@ -370,7 +370,7 @@ QWidget* EText::attrWgt() {
auto btnImport = new QPushButton(tr("Import txt File"));
btnImport->setProperty("ssType", "progManageTool");
connect(btnImport, &QPushButton::clicked, fdText, [fdText] {
auto filePath = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), fileHome, "Txt(*.txt)");
auto filePath = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, "Txt(*.txt)");
if(filePath.isEmpty()) return;
QFile file(filePath);
if(! file.open(QFile::ReadOnly)) {

View File

@ -167,7 +167,7 @@ QWidget* EVideo::attrWgt() {
playDuration = value;
});
connect(bnSelectFile, &QPushButton::clicked, this, [this, fdFileName, fdDuration] {
auto rawFile = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), fileHome, EVideo::filters());
auto rawFile = QFileDialog::getOpenFileName(gMainWin, tr("Select File"), gFileHome, EVideo::filters());
if(rawFile.isEmpty()) return;
QFileInfo rawInfo(rawFile);
int64_t dur;
@ -179,7 +179,7 @@ QWidget* EVideo::attrWgt() {
};
mRawDir = rawInfo.absolutePath();
mRawName = rawInfo.fileName();
fileHome = mRawDir;
gFileHome = mRawDir;
fdFileName->setText(mRawName);
playDuration = dur/1000000;
fdDuration->setValue(playDuration);

View File

@ -266,7 +266,7 @@ QPushButton[ssName="weeklySelector"]:checked {
mAudiosList = new QListWidget();
connect(btnAdd, &QPushButton::clicked, this, [this, fdTtlDur] {
auto files = QFileDialog::getOpenFileNames(gMainWin, tr("Select File"), fileHome, EAudio::filters());
auto files = QFileDialog::getOpenFileNames(gMainWin, tr("Select File"), gFileHome, EAudio::filters());
int durs = fdTtlDur->text().toInt();
for(int i=0; i<files.count(); i++) {
int64_t dur;
@ -282,7 +282,7 @@ QPushButton[ssName="weeklySelector"]:checked {
mAudiosList->addItem(item);
if(i == files.count()-1) {
mAudiosList->setCurrentItem(item);
fileHome = fInfo.absolutePath();
gFileHome = fInfo.absolutePath();
}
durs += info.dur;
mAudiosList->addItem(item);

View File

@ -238,7 +238,7 @@ ProgEditorWin::ProgEditorWin(QString &name, int &w, int &h, QString &remarks, co
if(mNewEleY+iNewHeight>gProgHeight) mNewEleY=0;
auto type = data.toInt();
if(type==EBase::Photo) {
auto files = QFileDialog::getOpenFileNames(this, tr("Select File"), fileHome, EPhoto::filters());
auto files = QFileDialog::getOpenFileNames(this, tr("Select File"), gFileHome, EPhoto::filters());
for(int i=0; i<files.count(); i++) {
auto ePhoto = EPhoto::create(files[i], mPageItem);
if(ePhoto==nullptr) continue;
@ -254,11 +254,11 @@ ProgEditorWin::ProgEditorWin(QString &name, int &w, int &h, QString &remarks, co
if(list.count() == 1) static_cast<EBase*>(list.at(0))->setSelected(false);
}
ePhoto->setSelected(true);
fileHome = ePhoto->mDir;
gFileHome = ePhoto->mDir;
}
}
} else if(type==EBase::Gif) {
auto files = QFileDialog::getOpenFileNames(this, tr("Select File"), fileHome, EGif::filters());
auto files = QFileDialog::getOpenFileNames(this, tr("Select File"), gFileHome, EGif::filters());
for(int i=0; i<files.count(); i++) {
auto eGif = EGif::create(files[i], mPageItem);
if(eGif==nullptr) continue;
@ -275,21 +275,21 @@ ProgEditorWin::ProgEditorWin(QString &name, int &w, int &h, QString &remarks, co
if(list.count() == 1) static_cast<EBase*>(list.at(0))->setSelected(false);
}
eGif->setSelected(true);
fileHome = eGif->mDir;
gFileHome = eGif->mDir;
}
}
} else if(type==EBase::Video) {
auto file = QFileDialog::getOpenFileName(this, tr("Select File"), fileHome, EVideo::filters());
auto file = QFileDialog::getOpenFileName(this, tr("Select File"), gFileHome, EVideo::filters());
if(file.isEmpty()) return;
auto eVideo = EVideo::create(file, mPageItem);
if(eVideo==nullptr) return;
auto rect = Tools::centerRect(eVideo->mCoverImg.width(), eVideo->mCoverImg.height(), gProgWidth, gProgHeight);
eVideo->setPos(rect.topLeft());
eVideo->setSize(rect.width(), rect.height());
fileHome = eVideo->mRawDir;
gFileHome = eVideo->mRawDir;
element = eVideo;
} else if(type== EBase::Audio) {
auto file = QFileDialog::getOpenFileName(this, tr("Select File"), fileHome, EAudio::filters());
auto file = QFileDialog::getOpenFileName(this, tr("Select File"), gFileHome, EAudio::filters());
if(file.isEmpty()) return;
auto eAudio = EAudio::create(file, mPageItem);
if(eAudio==nullptr) return;
@ -297,7 +297,7 @@ ProgEditorWin::ProgEditorWin(QString &name, int &w, int &h, QString &remarks, co
for(; i<gProgWidth; i+=50) if(nullptr==scene->itemAt(i+20, gProgHeight+20, QTransform())) break;
eAudio->setPos(i, gProgHeight);
eAudio->setSize(50, 50);
fileHome = eAudio->mDir;
gFileHome = eAudio->mDir;
element = eAudio;
}
else if(type==EBase::Text) {

View File

@ -9,7 +9,9 @@
#include <QLineEdit>
#include <QPushButton>
#include <QGroupBox>
#include <QStackedWidget>
#include <QStackedLayout>
#include <QRadioButton>
QColor colors[] {QColor(0xdd0000), QColor(0xdd6600), QColor(0x008800), QColor(0x008888), QColor(0x0000ff), QColor(0x777777), QColor(0xaaaaaa)};
@ -131,12 +133,12 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
auto receivePanel = new QWidget;
tab->addTab(receivePanel, "接收卡");
{
auto vBox = new QVBoxLayout(receivePanel);
auto vBox = new VBox(receivePanel);
auto gBox = new QGroupBox("模组信息");
vBox->addWidget(gBox);
auto hhh = new QHBoxLayout(gBox);
auto vvv = new VBox(hhh);
auto hh = new HBox(gBox);
auto vvv = new VBox(hh);
auto lb = new QLabel("驱动芯片: ");
vvv->addWidget(lb);
@ -144,7 +146,7 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
lb = new QLabel("译码方式: ");
vvv->addWidget(lb);
vvv = new VBox(hhh);
vvv = new VBox(hh);
lb = new QLabel("驱动芯片");
vvv->addWidget(lb);
@ -152,8 +154,8 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
lb = new QLabel("译码方式");
vvv->addWidget(lb);
hhh->addSpacing(20);
vvv = new VBox(hhh);
hh->addSpacing(20);
vvv = new VBox(hh);
lb = new QLabel("模组宽度: ");
vvv->addWidget(lb);
@ -161,7 +163,7 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
lb = new QLabel("模组高度: ");
vvv->addWidget(lb);
vvv = new VBox(hhh);
vvv = new VBox(hh);
lb = new QLabel("模组宽度");
vvv->addWidget(lb);
@ -169,8 +171,8 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
lb = new QLabel("模组高度");
vvv->addWidget(lb);
hhh->addSpacing(20);
vvv = new VBox(hhh);
hh->addSpacing(20);
vvv = new VBox(hh);
lb = new QLabel("扫描数: ");
vvv->addWidget(lb);
@ -178,7 +180,7 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
lb = new QLabel("数据数组: ");
vvv->addWidget(lb);
vvv = new VBox(hhh);
vvv = new VBox(hh);
lb = new QLabel("扫描数");
vvv->addWidget(lb);
@ -186,8 +188,8 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
lb = new QLabel("数据数组");
vvv->addWidget(lb);
hhh->addSpacing(20);
vvv = new VBox(hhh);
hh->addSpacing(20);
vvv = new VBox(hh);
lb = new QLabel("数据线颜色: ");
vvv->addWidget(lb);
@ -195,13 +197,13 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
lb = new QLabel("模组抽行设置");
vvv->addWidget(lb);
vvv = new VBox(hhh);
vvv = new VBox(hh);
lb = new QLabel("数据线颜色");
vvv->addWidget(lb);
hhh->addStretch();
vvv = new VBox(hhh);
hh->addStretch();
vvv = new VBox(hh);
auto btn = new QPushButton("模组选择");
vvv->addWidget(btn);
@ -217,15 +219,90 @@ QTabBar::tab:selected {margin-top: 0; border-bottom: none; color: #acf; backgrou
gBox = new QGroupBox("单卡带载");
vBox->addWidget(gBox);
auto tab = new QTabWidget;
tab->setTabPosition(QTabWidget::West);
vBox->addWidget(tab);
hh = new HBox(gBox);
vvv = new VBox(hh);
vvv->addWidget(new QRadioButton("常规设计"));
vvv->addWidget(new QRadioButton("高级设计"));
hh->addSpacing(20);
auto line = new QFrame;
line->setFrameShadow(QFrame::Sunken);
line->setFrameShape(QFrame::VLine);
hh->addWidget(line);
auto stack = new QStackedWidget;
auto poli = stack->sizePolicy();
poli.setVerticalPolicy(QSizePolicy::Maximum);
stack->setSizePolicy(poli);
hh->addWidget(stack);
auto normalPanel = new QWidget;
tab->addTab(normalPanel, "常规设计");
stack->addWidget(normalPanel);
{
auto hh = new HBox(normalPanel);
auto vvv = new VBox(hh);
auto advancedPanel = new QWidget;
tab->addTab(advancedPanel, "高级设计");
lb = new QLabel("宽度");
vvv->addWidget(lb);
lb = new QLabel("高度");
vvv->addWidget(lb);
vvv = new VBox(hh);
auto fdCardWidth = new QSpinBox;
fdCardWidth->setRange(0, 99999);
vvv->addWidget(fdCardWidth);
auto fdCardHeight = new QSpinBox;
fdCardHeight->setRange(0, 99999);
vvv->addWidget(fdCardHeight);
vvv = new VBox(hh);
lb = new QLabel("多开宽度");
vvv->addWidget(lb);
lb = new QLabel("级联方向");
vvv->addWidget(lb);
vvv = new VBox(hh);
auto fdMulti = new QComboBox();
fdMulti->addItem("");
fdMulti->addItem("双开");
fdMulti->addItem("三开");
fdMulti->addItem("四开");
vvv->addWidget(fdMulti);
auto fdDirection = new QComboBox();
fdDirection->addItem("从左到右");
fdDirection->addItem("从右到左");
fdDirection->addItem("从上到下");
fdDirection->addItem("从下到上");
vvv->addWidget(fdDirection);
vvv = new VBox(hh);
lb = new QLabel("插头顺序");
vvv->addWidget(lb);
vvv->addStretch();
vvv = new VBox(hh);
auto fdSord = new QComboBox();
fdSord->addItem("正序");
fdSord->addItem("逆序");
vvv->addWidget(fdSord);
vvv->addStretch();
hh->addStretch();
}
auto advacnedPanel = new QWidget;
stack->addWidget(advacnedPanel);
vBox->addStretch();
}