This commit is contained in:
Gangphon 2024-08-19 16:10:49 +08:00
parent d2c673cd17
commit f5b5ad1f79
11 changed files with 124 additions and 33 deletions

View File

@ -2174,7 +2174,7 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
lbRotate = new QLabel; lbRotate = new QLabel;
hBox->addWidget(lbRotate); hBox->addWidget(lbRotate);
hBox->addSpacing(12); hBox->addSpacing(6);
auto fdDeg0 = new QRadioButton(""); auto fdDeg0 = new QRadioButton("");
hBox->addWidget(fdDeg0); hBox->addWidget(fdDeg0);
@ -2250,6 +2250,76 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
} }
}); });
hBox->addWidget(btn); hBox->addWidget(btn);
hBox->addSpacing(12);
lbOffset = new QLabel;
hBox->addWidget(lbOffset);
hBox->addLabel("X");
auto edOffX = new QSpinBox;
edOffX->setRange(-9999, 99999);
hBox->addWidget(edOffX);
hBox->addLabel("Y");
auto edOffY = new QSpinBox;
edOffY->setRange(-9999, 99999);
hBox->addWidget(edOffY);
btnSets.push_back(btn = new QPushButton);
connect(btn, &QPushButton::clicked, this, [=] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
JObj json;
json.insert("_id", "SetScreenOffset");
json.insert("_type", "SetScreenOffset");
json.insert("x", edOffX->value());
json.insert("y", edOffY->value());
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("SetScreenOffset"));
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSetReqAfter
});
} else {
for(auto &card : gSelCards) {
Def_CtrlSetMulti(tr("SetScreenOffset"))
}
}
});
hBox->addWidget(btn);
btnGets.push_back(btn = new QPushButton);
connect(btn, &QPushButton::clicked, this, [=] {
if(gSelCards.isEmpty()) {
QMessageBox::information(this, tr("Tip"), tr("NoSelectedController"));
return;
}
QJsonObject json;
json.insert("_id", "GetScreenOffset");
json.insert("_type", "GetScreenOffset");
if(gSelCards.count() == 1) {
auto waitingDlg = new WaitingDlg(this, tr("GetScreenOffset")+" ...");
Def_CtrlReqPre
connect(reply, &QNetworkReply::finished, this, [=] {
Def_CtrlSingleGetReply
waitingDlg->success();
edOffX->setValue(json["x"].toInt());
edOffY->setValue(json["y"].toInt());
});
} else {
for(auto &card : gSelCards) {
auto reply = NetReq("http://"+card.ip+":2016/settings").timeout(120000).post(json);
connect(reply, &QNetworkReply::finished, this, [=] {
QJsonDocument json;
auto err = checkReplyForJson(reply, &json);
if(err.isEmpty()) err = "x: "+ QString::number(json["x"].toInt())+" y: "+ QString::number(json["y"].toInt());
gFdResInfo->append(card.id+" "+tr("GetScreenOffset")+" "+err);
});
}
}
});
hBox->addWidget(btn);
hBox->addStretch(); hBox->addStretch();
@ -2881,6 +2951,7 @@ void CtrlAdvancedPanel::transUi() {
fdHighForBusy->setText(tr("Service:High Out of service:Low")); fdHighForBusy->setText(tr("Service:High Out of service:Low"));
fdTopLevelLH->setText(tr("Service:Low Out of service:High")); fdTopLevelLH->setText(tr("Service:Low Out of service:High"));
lbRotate->setText(tr("Rotate")); lbRotate->setText(tr("Rotate"));
lbOffset->setText(tr("Offset"));
grpBoxHiddenSettings->setTitle(tr("Hidden Settings")+" ("+tr("Click right button to hide")+")"); grpBoxHiddenSettings->setTitle(tr("Hidden Settings")+" ("+tr("Click right button to hide")+")");
btnSysUpd->setText(tr("System Update")); btnSysUpd->setText(tr("System Update"));

View File

@ -63,7 +63,7 @@ private:
QLabel *lbDisMode; QLabel *lbDisMode;
QLabel *lbScreenPos, *lbScreenOff; QLabel *lbScreenPos, *lbScreenOff;
QLabel *lbCameraDis; QLabel *lbOffset, *lbCameraDis;
QGroupBox *grpHighForBusy; QGroupBox *grpHighForBusy;
QRadioButton *fdHighForBusy; QRadioButton *fdHighForBusy;

View File

@ -59,6 +59,7 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
} }
} }
auto item = new ProgItem(mProgsDir, dlg.fdName->text(), dlg.fdWidth->value(), dlg.fdHeight->value(), dlg.fdRemark->toPlainText(), widths, max, dlg.fdVer->isChecked(), mProgTree); auto item = new ProgItem(mProgsDir, dlg.fdName->text(), dlg.fdWidth->value(), dlg.fdHeight->value(), dlg.fdRemark->toPlainText(), widths, max, dlg.fdVer->isChecked(), mProgTree);
item->isInsert = dlg.edIsInsert->isChecked();
item->save();//保存pro.json item->save();//保存pro.json
if(mProgTree->fdCheckAll->checkState()==Qt::Checked) { if(mProgTree->fdCheckAll->checkState()==Qt::Checked) {
mProgTree->fdCheckAll->blockSignals(true); mProgTree->fdCheckAll->blockSignals(true);
@ -99,7 +100,7 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
if(QFileInfo::exists(dir + "/pro.json")) progDirs.append(dir); if(QFileInfo::exists(dir + "/pro.json")) progDirs.append(dir);
else { else {
QStringList subdirNames = QDir(dir).entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks); QStringList subdirNames = QDir(dir).entryList(QDir::Dirs | QDir::NoDotAndDotDot | QDir::NoSymLinks);
foreach(QString subdirName, subdirNames) { for(QString &subdirName : subdirNames) {
auto subdir = dir + "/" + subdirName; auto subdir = dir + "/" + subdirName;
if(! QFileInfo::exists(subdir + "/pro.json")) continue; if(! QFileInfo::exists(subdir + "/pro.json")) continue;
if(QFileInfo::exists(progsDir + "/" + subdirName)) { if(QFileInfo::exists(progsDir + "/" + subdirName)) {
@ -246,8 +247,13 @@ ProgPanel::ProgPanel(QWidget *parent) : QWidget(parent) {
auto act = new QAction("Open folder"); auto act = new QAction("Open folder");
menu->addAction(act); menu->addAction(act);
connect(act, &QAction::triggered, this, [=] { connect(act, &QAction::triggered, this, [=] {
//QProcess::execute("explorer", {((ProgItem*)item)->mProgDir.replace('/', '\\')}); #ifdef Q_OS_WINDOWS
auto str = ((ProgItem*)item)->mProgDir;
QProcess::execute("explorer", {str.replace('/','\\')});
#endif
#ifdef Q_OS_MACOS
QProcess::execute("open", {"-R", ((ProgItem*)item)->mProgDir}); QProcess::execute("open", {"-R", ((ProgItem*)item)->mProgDir});
#endif
}); });
menu->exec(QCursor::pos()+QPoint{2,2}); menu->exec(QCursor::pos()+QPoint{2,2});
} }
@ -318,6 +324,7 @@ void ProgPanel::addProFiles() {
item->mWidth = json["resolution"]["w"].toInt(); item->mWidth = json["resolution"]["w"].toInt();
item->mHeight = json["resolution"]["h"].toInt(); item->mHeight = json["resolution"]["h"].toInt();
item->mRemark = json["remarks"].toString(); item->mRemark = json["remarks"].toString();
item->isInsert = json["isInsert"].toBool();
item->isVer = json["isVer"].toBool(); item->isVer = json["isVer"].toBool();
auto partLengths = json["splitWidths"].toArray(); auto partLengths = json["splitWidths"].toArray();
for(auto &partLength : partLengths) { for(auto &partLength : partLengths) {

View File

@ -42,11 +42,11 @@ EBase::EBase(EBase *multiWin) : mMultiWin(multiWin) {
} }
void EBase::setBaseAttr(const JObj &json) { void EBase::setBaseAttr(const JObj &json) {
mStartTime = json["startTime"].toInt(); _startTime = json["startTime"].toInt();
mDuration = json["duration"].toInt(); _duration = json["duration"].toInt();
if(mDuration==0) { if(_duration==0) {
mDuration = json["play"]["playDuration"].toInt(); _duration = json["play"]["playDuration"].toInt();
if(mDuration==0) mDuration = json["play"]["duration"].toInt(10); if(_duration==0) _duration = json["play"]["duration"].toInt(10);
} }
mEntryEffect = json["entryEffect"].toStr(); mEntryEffect = json["entryEffect"].toStr();
mExitEffect = json["exitEffect"].toStr(); mExitEffect = json["exitEffect"].toStr();
@ -82,8 +82,8 @@ void EBase::addBaseAttr(JObj &obj) const {
obj.insert("innerY", ((int)ele->y())+bdWidth); obj.insert("innerY", ((int)ele->y())+bdWidth);
obj.insert("innerW", ((int)ele->mWidth)-bdWidth-bdWidth); obj.insert("innerW", ((int)ele->mWidth)-bdWidth-bdWidth);
obj.insert("innerH", ((int)ele->mHeight)-bdWidth-bdWidth); obj.insert("innerH", ((int)ele->mHeight)-bdWidth-bdWidth);
obj.insert("startTime", mStartTime); obj.insert("startTime", _startTime);
obj.insert("duration", mDuration); obj.insert("duration", _duration);
obj.insert("entryEffect", mEntryEffect); obj.insert("entryEffect", mEntryEffect);
obj.insert("exitEffect", mExitEffect); obj.insert("exitEffect", mExitEffect);
obj.insert("entryDur", mEntryDur); obj.insert("entryDur", mEntryDur);
@ -784,7 +784,10 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
auto fdStart = new QSpinBox; auto fdStart = new QSpinBox;
fdStart->setRange(0, 9999); fdStart->setRange(0, 9999);
fdStart->setValue(mStartTime); fdStart->setValue(_startTime);
connect(fdStart, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [=](int value) {
_startTime = value;
});
hBox->addWidget(fdStart); hBox->addWidget(fdStart);
hBox->addLabel(tr("s")); hBox->addLabel(tr("s"));
hBox->addStretch(); hBox->addStretch();
@ -792,10 +795,10 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
hBox->addLabel(tr("Duration")); hBox->addLabel(tr("Duration"));
fdDuration = new QSpinBox; edDuration = new QSpinBox;
fdDuration->setRange(1, 9999); edDuration->setRange(1, 9999);
fdDuration->setValue(mDuration); edDuration->setValue(_duration);
hBox->addWidget(fdDuration); hBox->addWidget(edDuration);
hBox->addLabel(tr("s")); hBox->addLabel(tr("s"));
hBox->addStretch(); hBox->addStretch();
@ -851,9 +854,9 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
fdEntryDur->setValue(mEntryDur); fdEntryDur->setValue(mEntryDur);
connect(fdEntryDur, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [=](int value) { connect(fdEntryDur, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [=](int value) {
mEntryDur = value; mEntryDur = value;
if(mDuration < value) { if(_duration < value) {
mDuration = value; _duration = value;
fdDuration->setValue(value); edDuration->setValue(value);
} }
}); });
grid->addWidget(fdEntryDur, 0, ccc++); grid->addWidget(fdEntryDur, 0, ccc++);
@ -898,16 +901,16 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
fdExitDur->setValue(mExitDur); fdExitDur->setValue(mExitDur);
connect(fdExitDur, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [=](int value) { connect(fdExitDur, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [=](int value) {
mExitDur = value; mExitDur = value;
if(mDuration < value) { if(_duration < value) {
mDuration = value; _duration = value;
fdDuration->setValue(value); edDuration->setValue(value);
} }
}); });
grid->addWidget(fdExitDur, 1, ccc++); grid->addWidget(fdExitDur, 1, ccc++);
grid->addLabel(tr("s"), 1, ccc++); grid->addLabel(tr("s"), 1, ccc++);
connect(fdDuration, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [=](int value) { connect(edDuration, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [=](int value) {
mDuration = value; _duration = value;
if(mEntryDur > value) { if(mEntryDur > value) {
mEntryDur = value; mEntryDur = value;
fdEntryDur->setValue(value); fdEntryDur->setValue(value);

View File

@ -48,8 +48,8 @@ public:
EBase *mMultiWin = 0; EBase *mMultiWin = 0;
qreal mWidth = 0, mHeight = 0; qreal mWidth = 0, mHeight = 0;
int _rotate = 0; int _rotate = 0;
QSpinBox *fdDuration = 0; QSpinBox *edDuration;
int mStartTime = 0, mDuration = 10; int _startTime = 0, _duration = 10;
QString mEntryEffect, mExitEffect; QString mEntryEffect, mExitEffect;
int mEntryDur = 1, mExitDur = 1; int mEntryDur = 1, mExitDur = 1;
double _opacity = 1, _blink = 1; double _opacity = 1, _blink = 1;

View File

@ -26,7 +26,7 @@ EVideo *EVideo::create(const QString &file, PageListItem *pageItem, EBase *multi
QFileInfo outInfo(outFile); QFileInfo outInfo(outFile);
if(! outInfo.isFile() || outInfo.size()==0) return 0; if(! outInfo.isFile() || outInfo.size()==0) return 0;
auto ins = new EVideo(outInfo.absolutePath(), outInfo.fileName(), rawInfo.absolutePath(), rawName, img, pageItem, multiWin); auto ins = new EVideo(outInfo.absolutePath(), outInfo.fileName(), rawInfo.absolutePath(), rawName, img, pageItem, multiWin);
ins->mDuration = round(dur*0.000001); ins->_duration = round(dur*0.000001);
return ins; return ins;
} }
EVideo *EVideo::create(const JObj &ele, PageListItem *pageItem, EBase *multiWin) { EVideo *EVideo::create(const JObj &ele, PageListItem *pageItem, EBase *multiWin) {
@ -46,7 +46,7 @@ EVideo *EVideo::create(const JObj &ele, PageListItem *pageItem, EBase *multiWin)
dur = round(dur*0.000001); dur = round(dur*0.000001);
auto ins = new EVideo(dir, name, widget["pathRaw"].toString(), widget["fileRaw"].toString(), img, pageItem, multiWin); auto ins = new EVideo(dir, name, widget["pathRaw"].toString(), widget["fileRaw"].toString(), img, pageItem, multiWin);
ins->setBaseAttr(ele); ins->setBaseAttr(ele);
if(ins->mDuration < 4) ins->mDuration = dur; if(ins->_duration < 4) ins->_duration = dur;
auto play = ele["play"]; auto play = ele["play"];
ins->playTimes = (play.isNull() ? ele : play)["playTimes"].toInt(1); ins->playTimes = (play.isNull() ? ele : play)["playTimes"].toInt(1);
return ins; return ins;
@ -117,8 +117,8 @@ QWidget* EVideo::attrWgt() {
mRawName = rawInfo.fileName(); mRawName = rawInfo.fileName();
gFileHome = mRawDir; gFileHome = mRawDir;
fdFileName->setText(mRawName); fdFileName->setText(mRawName);
mDuration = round(dur*0.000001); _duration = round(dur*0.000001);
fdDuration->setValue(mDuration); edDuration->setValue(_duration);
auto outFile = transcoding(wgtAttr, rawFile, mRawName, mPageItem->mPageDir, mCoverImg.width(), mCoverImg.height(), codecId); auto outFile = transcoding(wgtAttr, rawFile, mRawName, mPageItem->mPageDir, mCoverImg.width(), mCoverImg.height(), codecId);
if(outFile.isEmpty()) return; if(outFile.isEmpty()) return;
QFileInfo outInfo(outFile); QFileInfo outInfo(outFile);

View File

@ -70,6 +70,7 @@ void GenTmpThread::run() {
{"name", prog_name}, {"name", prog_name},
{"width", proJson["resolution"]["w"]}, {"width", proJson["resolution"]["w"]},
{"height", proJson["resolution"]["h"]}, {"height", proJson["resolution"]["h"]},
{"insert", proJson["isInsert"]},
{"partLengths", proJson["splitWidths"]}, {"partLengths", proJson["splitWidths"]},
{"isVertical", proJson["isVer"]}, {"isVertical", proJson["isVer"]},
{"items", items} {"items", items}

View File

@ -109,10 +109,12 @@ ProgEditorWin::ProgEditorWin(ProgItem *progItem, QWidget *parent) : QWidget(pare
widthsStr.append(QString::number(width)); widthsStr.append(QString::number(width));
} }
ProgCreateDlg dlg(mProgItem->mName, mProgItem->mWidth, mProgItem->mHeight, mProgItem->mRemark, widthsStr, mProgItem->isVer, this); ProgCreateDlg dlg(mProgItem->mName, mProgItem->mWidth, mProgItem->mHeight, mProgItem->mRemark, widthsStr, mProgItem->isVer, this);
dlg.edIsInsert->setChecked(mProgItem->isInsert);
if(dlg.exec() != QDialog::Accepted) return; if(dlg.exec() != QDialog::Accepted) return;
mProgItem->mWidth = dlg.fdWidth->value(); mProgItem->mWidth = dlg.fdWidth->value();
mProgItem->mHeight = dlg.fdHeight->value(); mProgItem->mHeight = dlg.fdHeight->value();
mProgItem->mRemark = dlg.fdRemark->toPlainText(); mProgItem->mRemark = dlg.fdRemark->toPlainText();
mProgItem->isInsert = dlg.edIsInsert->isChecked();
mProgItem->partLens.clear(); mProgItem->partLens.clear();
mProgItem->maxLen = 0; mProgItem->maxLen = 0;
mProgItem->isVer = dlg.fdVer->isChecked(); mProgItem->isVer = dlg.fdVer->isChecked();
@ -716,6 +718,12 @@ ProgCreateDlg::ProgCreateDlg(QString name, int width, int height, QString remark
fdRemark->setFixedHeight(80); fdRemark->setFixedHeight(80);
hBox->addWidget(fdRemark); hBox->addWidget(fdRemark);
hBox = new HBox(vBox);
hBox->addSpacing(72);
edIsInsert = new QCheckBox(tr("Is Insert"));
hBox->addWidget(edIsInsert);
vBox->addSpacing(6); vBox->addSpacing(6);
hBox = new HBox(vBox); hBox = new HBox(vBox);

View File

@ -42,7 +42,7 @@ public:
QSpinBox *fdWidth; QSpinBox *fdWidth;
QSpinBox *fdHeight; QSpinBox *fdHeight;
QTextEdit *fdRemark; QTextEdit *fdRemark;
QCheckBox *fdIsUltraLong; QCheckBox *edIsInsert, *fdIsUltraLong;
QRadioButton *fdHor, *fdVer; QRadioButton *fdHor, *fdVer;
QLineEdit *fdSplitWidths; QLineEdit *fdSplitWidths;
}; };

View File

@ -162,6 +162,7 @@ void ProgItem::save() {
json["name"] = mName; json["name"] = mName;
json["resolution"] = JObj{{"w", mWidth}, {"h", mHeight}}; json["resolution"] = JObj{{"w", mWidth}, {"h", mHeight}};
json["remarks"] = mRemark; json["remarks"] = mRemark;
json["isInsert"] = isInsert;
json["isVer"] = isVer; json["isVer"] = isVer;
JArray partLens; JArray partLens;
for(auto partLen : this->partLens) partLens.append(partLen); for(auto partLen : this->partLens) partLens.append(partLen);
@ -169,7 +170,7 @@ void ProgItem::save() {
json["file_size"] = m_fsize; json["file_size"] = m_fsize;
QFile file(mProgDir + "/pro.json"); QFile file(mProgDir + "/pro.json");
if(file.open(QIODevice::WriteOnly)) { if(file.open(QIODevice::WriteOnly)) {
file.write(JToBytes(json, "\n")); file.write(JToBytes(json, "\t"));
file.close(); file.close();
} }
} }

View File

@ -21,7 +21,7 @@ public:
QString mRemark; QString mRemark;
std::vector<int> partLens; std::vector<int> partLens;
int maxLen = 0; int maxLen = 0;
bool isVer = false; bool isInsert = false, isVer = false;
QString mProgsDir; QString mProgsDir;
QString mProgDir; QString mProgDir;
qint64 m_fsize = 0; qint64 m_fsize = 0;