ledok 2.0

This commit is contained in:
Gangphon 2024-06-20 10:44:08 +08:00
parent bf47b035f9
commit 80ebceeeac
12 changed files with 2539 additions and 2458 deletions

View File

@ -39,7 +39,7 @@ int main(int argc, char *argv[]) {
QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough); QApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::PassThrough);
#endif #endif
QApplication::setOrganizationName("Sysolution"); QApplication::setOrganizationName("Sysolution");
QApplication::setOrganizationDomain("www.ledok.cn"); QApplication::setOrganizationDomain("ledok.cn");
QApplication::setApplicationName("LedOK Express"); QApplication::setApplicationName("LedOK Express");
QApplication::setStyle("Fusion"); QApplication::setStyle("Fusion");
QApplication a(argc, argv); QApplication a(argc, argv);

View File

@ -66,17 +66,7 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
}); });
QSettings settings; QSettings settings;
auto MainGeo = settings.value("MainGeo"); auto langName = settings.value("Language").toString();
if(! MainGeo.isValid()) {
QSettings old("Shanghai Xixun Electronic Technology Co., Ltd.", "LedOK Express");
MainGeo = old.value("MainGeo");
if(MainGeo.isValid()) {
auto keys = old.allKeys();
for(auto &key : keys) settings.setValue(key, old.value(key));
old.remove("");
}
}
QString langName = settings.value("Language").toString();
QAction *actLan = 0; QAction *actLan = 0;
#ifdef leyide #ifdef leyide
auto actTW = new QAction("中文繁体"); auto actTW = new QAction("中文繁体");
@ -180,7 +170,7 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
emit menuLang->triggered(actLan); emit menuLang->triggered(actLan);
QCoreApplication::installTranslator(&translator); QCoreApplication::installTranslator(&translator);
auto geo = MainGeo.toRect(); auto geo = settings.value("MainGeo").toRect();
if(geo.width()>=800 && geo.height()>=500 && geo.x()>=-600 && geo.x()<=1280 && geo.y()>=-200 && geo.y()<=800) setGeometry(geo); if(geo.width()>=800 && geo.height()>=500 && geo.x()>=-600 && geo.x()<=1280 && geo.y()>=-200 && geo.y()<=800) setGeometry(geo);
else resize(1280, 800); else resize(1280, 800);
if(settings.value("MainIsMax", false).toBool()) setWindowState(Qt::WindowMaximized); if(settings.value("MainIsMax", false).toBool()) setWindowState(Qt::WindowMaximized);

View File

@ -53,7 +53,7 @@ void EBase::setBaseAttr(const JObj &json) {
mEntryDur = json["entryDur"].toInt(); mEntryDur = json["entryDur"].toInt();
mExitDur = json["exitDur"].toInt(); mExitDur = json["exitDur"].toInt();
_rotate = json["rotate"].toInt(); _rotate = json["rotate"].toInt();
_blinkFreq = json["blinkFreq"].toDouble(1.0); _blink = json["blink"].toDouble(1.0);
_hasBlink = json["hasBlink"].toBool(); _hasBlink = json["hasBlink"].toBool();
auto geometry = json["geometry"]; auto geometry = json["geometry"];
setPos(geometry["x"].toInt(), geometry["y"].toInt()); setPos(geometry["x"].toInt(), geometry["y"].toInt());
@ -87,7 +87,7 @@ void EBase::addBaseAttr(JObj &obj) const {
obj.insert("entryDur", mEntryDur); obj.insert("entryDur", mEntryDur);
obj.insert("exitDur", mExitDur); obj.insert("exitDur", mExitDur);
obj["rotate"] = _rotate; obj["rotate"] = _rotate;
obj["blinkFreq"] = _blinkFreq; obj["blink"] = _blink;
obj["hasBlink"] = _hasBlink; obj["hasBlink"] = _hasBlink;
if(bdImgIdx>-1) { if(bdImgIdx>-1) {
obj["border"] = borderImgs[bdImgIdx].name; obj["border"] = borderImgs[bdImgIdx].name;
@ -914,9 +914,9 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
auto fdBlinkFreq = new QDoubleSpinBox; auto fdBlinkFreq = new QDoubleSpinBox;
fdBlinkFreq->setDecimals(1); fdBlinkFreq->setDecimals(1);
fdBlinkFreq->setSingleStep(0.1); fdBlinkFreq->setSingleStep(0.1);
fdBlinkFreq->setValue(_blinkFreq); fdBlinkFreq->setValue(_blink);
connect(fdBlinkFreq, (void(QDoubleSpinBox::*)(double))&QDoubleSpinBox::valueChanged, this, [=](double value) { connect(fdBlinkFreq, (void(QDoubleSpinBox::*)(double))&QDoubleSpinBox::valueChanged, this, [=](double value) {
_blinkFreq = value; _blink = value;
}); });
grid->addWidget(fdBlinkFreq, 2, ccc++); grid->addWidget(fdBlinkFreq, 2, ccc++);
grid->addLabel("Hz", 2, ccc++); grid->addLabel("Hz", 2, ccc++);

View File

@ -52,7 +52,7 @@ public:
int mStartTime = 0, mDuration = 10; int mStartTime = 0, mDuration = 10;
QString mEntryEffect, mExitEffect; QString mEntryEffect, mExitEffect;
int mEntryDur = 1, mExitDur = 1; int mEntryDur = 1, mExitDur = 1;
double _blinkFreq = 1.0; double _blink = 1.0;
bool _hasBlink = 0; bool _hasBlink = 0;
signals: signals:
void sizeChanged(); void sizeChanged();

View File

@ -242,12 +242,12 @@ QString EVideo::transcoding(QWidget *parent, QString rawFile, QString rawName, Q
// } // }
QSettings settings; QSettings settings;
int rawMax = qMax(w, h); int rawMax = qMax(w, h);
if(settings.value("VideoCompress", true).toBool() && rawMax > 1360 && (w > gProgItem->mWidth || h > gProgItem->mHeight)) { if(settings.value("VideoCompress").toBool() && rawMax > 1360 && (w > gProgItem->mWidth || h > gProgItem->mHeight)) {
auto rate = 1280.0 / rawMax; auto rate = 1280.0 / rawMax;
w *= rate; w *= rate;
h *= rate; h *= rate;
qDebug()<<"Compressed Size"<<w<<h; qDebug()<<"Compressed Size"<<w<<h;
} else if(! settings.value("VideoTranscoding", true).toBool() || codec_id == AV_CODEC_ID_H264) { } else if(! settings.value("VideoTranscoding").toBool() || codec_id == AV_CODEC_ID_H264) {
auto outFile = dir+"/"+rawName; auto outFile = dir+"/"+rawName;
QFile::copy(rawFile, outFile); QFile::copy(rawFile, outFile);
return outFile; return outFile;

View File

@ -137,7 +137,19 @@ JObj GenTmpThread::cvtPage(const JObj &pageJson) {
for(const auto &ele : elements) { for(const auto &ele : elements) {
auto type = ele["elementType"].toString(); auto type = ele["elementType"].toString();
auto geometry = ele["geometry"]; auto geometry = ele["geometry"];
sources = type=="Window" ? genSources(QString(), ele["elements"].toArray(), geometry) : genSources(type, JArray{ele}, geometry); bool isWin = type=="Window";
sources = isWin ? genSources(QString(), ele["elements"].toArray()) : genSources(type, JArray{ele});
auto startTime = isWin ? 0 : ele["startTime"].toInt();
for(auto &ss : sources) {
auto source = ss.toObj();
source["left"] = geometry["x"];
source["top"] = geometry["y"];
source["width"] = geometry["w"];
source["height"] = geometry["h"];
source["rotate"] = ele["rotate"];
source["playTime"] = startTime;
startTime += source["timeSpan"].toInt();
}
if(! sources.empty()) { if(! sources.empty()) {
JObj layer{{"repeat", sourceRepeat}, {"sources", sources}}; JObj layer{{"repeat", sourceRepeat}, {"sources", sources}};
auto border = ele["border"].toString(); auto border = ele["border"].toString();
@ -203,7 +215,7 @@ JObj GenTmpThread::cvtPage(const JObj &pageJson) {
}; };
} }
JArray GenTmpThread::genSources(QString type, const JArray &eles, const JValue &geometry) { JArray GenTmpThread::genSources(QString type, const JArray &eles) {
JArray sources; JArray sources;
auto needType = type.isEmpty(); auto needType = type.isEmpty();
for(const auto &ele : eles) { for(const auto &ele : eles) {
@ -222,23 +234,12 @@ JArray GenTmpThread::genSources(QString type, const JArray &eles, const JValue &
if(source["timeSpan"].isNull()) source["timeSpan"] = ele["duration"]; if(source["timeSpan"].isNull()) source["timeSpan"] = ele["duration"];
source["entryEffect"] = ele["entryEffect"]; source["entryEffect"] = ele["entryEffect"];
source["exitEffect"] = ele["exitEffect"]; source["exitEffect"] = ele["exitEffect"];
if(source["entryEffect"].toStr().isEmpty()) source["entryEffect"] = "None"; //兼容旧播放器
if(source["exitEffect"].toStr().isEmpty()) source["exitEffect"] = "None"; //兼容旧播放器
source["entryEffectTimeSpan"] = ele["entryDur"]; source["entryEffectTimeSpan"] = ele["entryDur"];
source["exitEffectTimeSpan"] = ele["exitDur"]; source["exitEffectTimeSpan"] = ele["exitDur"];
if(ele["hasBlink"].toBool()) source["blink"] = ele["blink"];
sources.append(source); sources.append(source);
} }
} }
auto startTime = needType ? 0 : eles[0]["startTime"].toInt();
for(auto &ss : sources) {
auto source = ss.toObj();
source["left"] = geometry["x"];
source["top"] = geometry["y"];
source["width"] = geometry["w"];
source["height"] = geometry["h"];
source["playTime"] = startTime;
startTime += source["timeSpan"].toInt();
}
return sources; return sources;
} }

View File

@ -15,7 +15,7 @@ protected:
virtual void run() override; virtual void run() override;
JObj cvtPage(const JObj &); JObj cvtPage(const JObj &);
JArray genSources(QString type, const JArray &eles, const JValue &); JArray genSources(QString type, const JArray &eles);
JObj genText(const JValue &json, JArray &); JObj genText(const JValue &json, JArray &);
JObj genImage(const JValue &json); JObj genImage(const JValue &json);
JObj convertGif(const JValue &json); JObj convertGif(const JValue &json);

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

File diff suppressed because it is too large Load Diff