Compare commits

..

No commits in common. "80ebceeeac02ced480c5d89ae49101bfb764754d" and "f4cc005daab0a269956bd94ccab13b07ad1edc93" have entirely different histories.

19 changed files with 2559 additions and 2742 deletions

View File

@ -27,7 +27,7 @@ CONFIG += embed_translations
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
VERSION = 2.0.0
VERSION = 1.5.2
DEFINES += APP_VERSION=\\\"$$VERSION\\\"
msvc {
contains(QT_ARCH, i386) {

View File

@ -661,24 +661,24 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
fd->append(card.id+" Prog JSON");
TcpSocket tcp;
tcp.connectToHost(card.ip, 3333);
if(! tcp.waitForConnected(10000)) {
tcp.close();
if(! tcp.waitForConnected()) {
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitConnected\n");
tcp.close();
continue;
}
auto resNum = tcp.write(JToBytes(json));
tcp.flush();
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
tcp.close();
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at write\n");
tcp.close();
continue;
}
if(! tcp.waitForReadyRead()) {
tcp.close();
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitRead\n");
tcp.close();
continue;
}
fd->insertPlainText(tcp.readAll());
@ -686,9 +686,9 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
if(lll.cnt==0) return;
fd->insertPlainText(tcp.readAll());
}
tcp.close();
if(lll.cnt==0) return;
if(tcp.error()!=QAbstractSocket::SocketTimeoutError) fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitRead2\n");
tcp.close();
fd->append("");
}
});
@ -716,24 +716,24 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
fd->append(card.id+" Prog Files");
TcpSocket tcp;
tcp.connectToHost(card.ip, 3333);
if(! tcp.waitForConnected(10000)) {
tcp.close();
if(! tcp.waitForConnected()) {
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitConnected\n");
tcp.close();
continue;
}
auto resNum = tcp.write(JToBytes(json));
tcp.flush();
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
tcp.close();
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at write\n");
tcp.close();
continue;
}
if(! tcp.waitForReadyRead()) {
tcp.close();
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitRead\n");
tcp.close();
continue;
}
fd->insertPlainText(tcp.readAll());
@ -741,9 +741,9 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
if(lll.cnt==0) return;
fd->insertPlainText(tcp.readAll());
}
tcp.close();
if(lll.cnt==0) return;
if(tcp.error()!=QAbstractSocket::SocketTimeoutError) fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitRead2\n");
tcp.close();
fd->append("");
}
});
@ -771,24 +771,24 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
fd->append(card.id+" Player Info");
TcpSocket tcp;
tcp.connectToHost(card.ip, 3333);
if(! tcp.waitForConnected(10000)) {
tcp.close();
if(! tcp.waitForConnected()) {
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitConnected\n");
tcp.close();
continue;
}
auto resNum = tcp.write(JToBytes(json));
tcp.flush();
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
tcp.close();
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at write\n");
tcp.close();
continue;
}
if(! tcp.waitForReadyRead()) {
tcp.close();
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitRead\n");
tcp.close();
continue;
}
fd->insertPlainText(tcp.readAll());
@ -796,9 +796,9 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
if(lll.cnt==0) return;
fd->insertPlainText(tcp.readAll());
}
tcp.close();
if(lll.cnt==0) return;
if(tcp.error()!=QAbstractSocket::SocketTimeoutError) fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitRead2\n");
tcp.close();
fd->append("");
}
});
@ -826,24 +826,24 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
fd->append(card.id+" Player Log");
TcpSocket tcp;
tcp.connectToHost(card.ip, 3333);
if(! tcp.waitForConnected(10000)) {
tcp.close();
if(! tcp.waitForConnected()) {
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitConnected\n");
tcp.close();
continue;
}
auto resNum = tcp.write(JToBytes(json));
tcp.flush();
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
tcp.close();
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at write\n");
tcp.close();
continue;
}
if(! tcp.waitForReadyRead()) {
tcp.close();
if(lll.cnt==0) return;
fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitRead\n");
tcp.close();
continue;
}
fd->insertPlainText(tcp.readAll());
@ -851,9 +851,9 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
if(lll.cnt==0) return;
fd->insertPlainText(tcp.readAll());
}
tcp.close();
if(lll.cnt==0) return;
if(tcp.error()!=QAbstractSocket::SocketTimeoutError) fd->append(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitRead2\n");
tcp.close();
fd->append("");
}
});
@ -882,10 +882,10 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
fdProgress.setValue(0);
TcpSocket tcp;
tcp.connectToHost(card.ip, 3333);
if(! tcp.waitForConnected(10000)) {
tcp.close();
if(! tcp.waitForConnected()) {
if(! fdProgress.isVisible()) return;
QMessageBox::information(this, tr("Error"), QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at WaitConnected");
tcp.close();
continue;
}
QFile file(tar+" "+card.id);
@ -893,9 +893,9 @@ CtrlAdvancedPanel::CtrlAdvancedPanel() {
auto resNum = tcp.write(JToBytes(json));
tcp.flush();
if(resNum == -1 || ! tcp.waitForBytesWritten()) {
tcp.close();
if(! fdProgress.isVisible()) return;
QMessageBox::information(this, tr("Error"), QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at write");
tcp.close();
continue;
}
resNum = 0;

View File

@ -237,16 +237,19 @@ QPushButton:hover {background-color: #08b;}
auto card = item->mCard;
auto reply = NetReq("http://"+card.ip+":2016/settings").timeout(120000).post(json);
ConnReply(reply, &msgBox) [=, &msgBox] {
JValue json;
auto err = errStrWithJson(reply, &json);
QJsonDocument json;
QString err = checkReplyForJson(reply, &json);
if(! err.isEmpty()) {
msgBox.setText(msgpre + tr("Player Version")+": "+err);
return;
}
auto apps = json["apps"];
for(auto &app : apps) if(app["packageName"].toString().contains("xixunplayer")) {
msgBox.setText(msgpre + tr("Player Version")+": "+app["versionName"].toString());
return;
auto apps = json["apps"].toArray();
foreach(QJsonValue value, apps) {
QJsonObject app = value.toObject();
if(app["packageName"].toString().contains("xixunplayer")) {
msgBox.setText(msgpre + tr("Player Version")+": "+app["versionName"].toString());
return;
}
}
msgBox.setText(msgpre + tr("Player Version")+":");
});
@ -300,7 +303,7 @@ QPushButton:hover {background-color: #08b;}
return;
}
QByteArray data = QJsonDocument(QJsonObject{{"action", "getInfo"}}).toJson(QJsonDocument::Compact);
for(auto &ip : ips) if(mUdpSocket.writeDatagram(data, QHostAddress(ip), 22222) != data.length()) qDebug() << "Specify IP write Failed." << ip;
foreach(auto ip, ips) if(mUdpSocket.writeDatagram(data, QHostAddress(ip), 22222) != data.length()) qDebug() << "Specify IP write Failed." << ip;
specifyIPDlg->accept();
});
hBox->addWidget(bnSearch);
@ -328,12 +331,12 @@ void DevicePanel::sendGetInfo() {
if(mUdpSocket.writeDatagram(data, QHostAddress("255.255.255.255"), 22222) != data.length()) qDebug() << "getInfo write to 255.255.255.255 failed";
if(mUdpSocket.writeDatagram((char *)ccc, sizeof(ccc), QHostAddress("255.255.255.255"), 31296) != sizeof(ccc)) qDebug() << "getInfo write to 255.255.255.255 failed";
auto networkinterfaces = QNetworkInterface::allInterfaces();
for(auto &face : networkinterfaces) {
foreach(auto face, networkinterfaces) {
auto flags = face.flags();
bool can = (flags & QNetworkInterface::IsRunning) && (flags & QNetworkInterface::CanBroadcast) && ! (flags & QNetworkInterface::IsLoopBack);
if(! can) continue;
auto addrEntries = face.addressEntries();
for(QNetworkAddressEntry &addrEntry : addrEntries) {
foreach(QNetworkAddressEntry addrEntry, addrEntries) {
auto ip = addrEntry.ip();
if(ip.protocol()!=QAbstractSocket::IPv4Protocol) continue;
auto broadcast = addrEntry.broadcast();
@ -343,7 +346,7 @@ void DevicePanel::sendGetInfo() {
auto ipstr = fdIP->toPlainText();
if(! ipstr.isEmpty()) {
auto ips = ipstr.split("\n", Qt::SkipEmptyParts);
for(auto &ip : ips) if(mUdpSocket.writeDatagram(data, QHostAddress(ip), 22222) != data.length()) qDebug() << "getInfo specify IP write failed." << ip;
foreach(auto ip, ips) if(mUdpSocket.writeDatagram(data, QHostAddress(ip), 22222) != data.length()) qDebug() << "getInfo specify IP write failed." << ip;
}
}
@ -601,14 +604,11 @@ ImgDlg::ImgDlg(const QByteArray &data, QWidget *parent) : QDialog(parent) {
setWindowFlag(Qt::WindowContextHelpButtonHint, 0);
setWindowTitle(tr("Screenshot"));
mImg.loadFromData(data);
auto width = mImg.width();
auto height = mImg.height();
if(width > 1600 || height > 900) {
auto rate = qMin(1600.0 / width, 900.0 / height);
width *= rate;
height *= rate;
}
resize(width, height);
auto www = mImg.width();
auto hhh = mImg.height();
if(www <= 1600 && hhh <= 900) resize(www, hhh);
else if(www > hhh) resize(900 * www / hhh, 900);
else resize(1600, 1600 * hhh / www);
}
void ImgDlg::paintEvent(QPaintEvent *) {
QPainter painter(this);

View File

@ -138,8 +138,9 @@ bool copyDir(const QString &source, const QString &destination, bool override) {
}
return !error;
}
unsigned char GetCheckCodeIn8(unsigned char *str, unsigned int size) {
unsigned char checkCode = 0;
for(int i=0; i<size; i++) checkCode += str[i];
return (~checkCode) & 0xff;
unsigned char GetCheckCodeIn8(unsigned char * pBuffer,unsigned int uiSize) {
unsigned int i=0;
unsigned char ucCheckCode=0;
for (i=0;i<uiSize;i++) ucCheckCode+=pBuffer[i];
return (~ucCheckCode)&0x0ff;
}

View File

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

View File

@ -66,7 +66,17 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
});
QSettings settings;
auto langName = settings.value("Language").toString();
auto MainGeo = settings.value("MainGeo");
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;
#ifdef leyide
auto actTW = new QAction("中文繁体");
@ -170,7 +180,7 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
emit menuLang->triggered(actLan);
QCoreApplication::installTranslator(&translator);
auto geo = settings.value("MainGeo").toRect();
auto geo = MainGeo.toRect();
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);
if(settings.value("MainIsMax", false).toBool()) setWindowState(Qt::WindowMaximized);
@ -414,7 +424,7 @@ MainWindow::MainWindow(QWidget *parent) : BaseWin(parent) {
#if(QT_VERSION_MAJOR > 5)
updates = json["win-64"].toObject();
#else
updates = json["win-32"].toObject();
updates = json["win"].toObject();
#endif
#endif
#ifdef Q_OS_MAC

View File

@ -21,7 +21,7 @@ int borderImgMaxHeight = 0;
struct Initer {
Initer() {
auto names = QDir("borders").entryList(QDir::Files);
for(auto &name : names) {
foreach(auto name, names) {
BorderImg bdImg;
bdImg.name = name;
bdImg.img = QPixmap("borders/"+bdImg.name);
@ -52,9 +52,6 @@ void EBase::setBaseAttr(const JObj &json) {
mExitEffect = json["exitEffect"].toStr();
mEntryDur = json["entryDur"].toInt();
mExitDur = json["exitDur"].toInt();
_rotate = json["rotate"].toInt();
_blink = json["blink"].toDouble(1.0);
_hasBlink = json["hasBlink"].toBool();
auto geometry = json["geometry"];
setPos(geometry["x"].toInt(), geometry["y"].toInt());
setSize(geometry["w"].toInt(), geometry["h"].toInt());
@ -86,9 +83,6 @@ void EBase::addBaseAttr(JObj &obj) const {
obj.insert("exitEffect", mExitEffect);
obj.insert("entryDur", mEntryDur);
obj.insert("exitDur", mExitDur);
obj["rotate"] = _rotate;
obj["blink"] = _blink;
obj["hasBlink"] = _hasBlink;
if(bdImgIdx>-1) {
obj["border"] = borderImgs[bdImgIdx].name;
obj["borderSize"] = JArray{borderImgs[bdImgIdx].img.width(), borderImgs[bdImgIdx].img.height()};
@ -233,11 +227,11 @@ void EBase::mousePressEvent(QGraphicsSceneMouseEvent *e) {
auto scene = this->scene();
if(0 == scene) return;
auto items = scene->items();
for(auto item : items) {
foreach(auto item, items) {
if(item==this) continue;
auto ele = (EBase*) item;
auto ele = static_cast<EBase*>(item);
if(ele->mMultiWin) continue;
mOtherEles.emplace_back(ele);
mOtherEles.append(ele);
}
}
}
@ -247,7 +241,7 @@ void EBase::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) {
if(Qt::LeftButton == event->button()) {
mPressRel.setX(FLT_MAX);
clearSnap();
for(auto ele : mOtherEles) ele->clearSnap();
foreach(auto ele, mOtherEles) ele->clearSnap();
}
}
#define SnapSpace 6
@ -259,26 +253,15 @@ void EBase::mouseMoveEvent(QGraphicsSceneMouseEvent *e){
auto dstHor = mPressRel.x() + mousePos.x();
auto dstVer = mPressRel.y() + mousePos.y();
mLRSnap = mTBSnap = 0;
for(auto ele : mOtherEles) ele->clearSnap();
foreach(auto ele, mOtherEles) ele->clearSnap();
if(mFrmSec==Qt::TitleBarArea) {
if(type()!=Web) {
dstHor = qBound(0.0, dstHor, gProgItem->mWidth - mWidth);
dstVer = qBound(0.0, dstVer, gProgItem->mHeight - mHeight);
}
if(fabs(dstHor) < SnapSpace) {
dstHor = 0;
mLRSnap = 1;
} else if(fabs(dstHor - (gProgItem->mWidth - mWidth)) < SnapSpace) {
dstHor = gProgItem->mWidth - mWidth;
mLRSnap = 2;
}if(fabs(dstVer) < SnapSpace) {
dstVer = 0;
mTBSnap = 1;
} else if(fabs(dstVer - (gProgItem->mHeight - mHeight)) < SnapSpace) {
dstVer = gProgItem->mHeight - mHeight;
mTBSnap = 2;
}
if(mLRSnap==0) for(EBase *ele : mOtherEles) {//左右
dstHor = qBound(0.0, dstHor, gProgItem->mWidth - mWidth);
dstVer = qBound(0.0, dstVer, gProgItem->mHeight - mHeight);
if(dstHor==0) mLRSnap = 1;
else if(dstHor==gProgItem->mWidth - mWidth) mLRSnap = 2;
if(dstVer==0) mTBSnap = 1;
else if(dstVer==gProgItem->mHeight - mHeight) mTBSnap = 2;
if(mLRSnap==0) foreach(EBase *ele, mOtherEles) {//左右
if(fabs(dstHor - ele->x()) < SnapSpace && ele->x() <= gProgItem->mWidth - mWidth) {
dstHor = ele->x();
mLRSnap = 1;
@ -310,7 +293,7 @@ void EBase::mouseMoveEvent(QGraphicsSceneMouseEvent *e){
break;
}
}
if(mTBSnap==0) for(EBase *ele : mOtherEles) {//上下
if(mTBSnap==0) foreach(EBase *ele, mOtherEles) {//上下
if(fabs(dstVer-ele->y()) < SnapSpace && ele->y() <= gProgItem->mHeight - mHeight) {
dstVer = ele->y();
mTBSnap = 1;
@ -346,16 +329,16 @@ void EBase::mouseMoveEvent(QGraphicsSceneMouseEvent *e){
} else if(mFrmSec==Qt::BottomRightSection) {
if(dstHor < m_handleLen) dstHor = m_handleLen;
if(dstVer < m_handleLen) dstVer = m_handleLen;
if(mType!=Web && gProgItem->mWidth>0 && gProgItem->mHeight>0) {
if(mType!=Audio && gProgItem->mWidth>0 && gProgItem->mHeight>0) {
dstHor = qMin(dstHor, gProgItem->mWidth - x());
dstVer = qMin(dstVer, gProgItem->mHeight - y());
}
setSize(dstHor, dstVer);
} else if(mFrmSec==Qt::RightSection) {
if(dstHor < m_handleLen) dstHor = m_handleLen;
if(mType!=Web && gProgItem->mWidth>0 && gProgItem->mHeight>0) dstHor = qMin(dstHor, gProgItem->mWidth - x());
if(mType!=Audio && gProgItem->mWidth>0 && gProgItem->mHeight>0) dstHor = qMin(dstHor, gProgItem->mWidth - x());
auto right = x() + dstHor;
if(right < gProgItem->mWidth-8) for(EBase *ele : mOtherEles) {//左右
if(right < gProgItem->mWidth-8) foreach(EBase *ele, mOtherEles) {//左右
if(fabs(right - ele->x()) < SnapSpace) {
dstHor = ele->x() - x();
mLRSnap = 2;
@ -375,9 +358,9 @@ void EBase::mouseMoveEvent(QGraphicsSceneMouseEvent *e){
setSize(dstHor, mPressRel.y());
} else if(mFrmSec==Qt::BottomSection) {
if(dstVer < m_handleLen) dstVer = m_handleLen;
if(mType!=Web && gProgItem->mWidth>0 && gProgItem->mHeight>0) dstVer = qMin(dstVer, gProgItem->mHeight - y());
if(mType!=Audio && gProgItem->mWidth>0 && gProgItem->mHeight>0) dstVer = qMin(dstVer, gProgItem->mHeight - y());
auto btm = y() + dstVer;
if(btm < gProgItem->mHeight-8) for(EBase *ele : mOtherEles) {//上下
if(btm < gProgItem->mHeight-8) foreach(EBase *ele, mOtherEles) {//上下
auto eleBtm = ele->y() + ele->mHeight;
if(fabs(btm - ele->y()) < SnapSpace) {
dstVer = ele->y() - y();
@ -399,8 +382,8 @@ void EBase::mouseMoveEvent(QGraphicsSceneMouseEvent *e){
QRectF geo(x(), y(), mWidth, mHeight);
if(mFrmSec==Qt::LeftSection) {
dstHor = qMin(dstHor, geo.right() - m_handleLen);
if(mType!=Web && dstHor < 0) dstHor = 0;
if(dstHor > 8) for(EBase *ele : mOtherEles) {//左右
if(mType!=Audio && dstHor < 0) dstHor = 0;
if(dstHor > 8) foreach(EBase *ele, mOtherEles) {//左右
if(fabs(dstHor - ele->x()) < SnapSpace) {
dstHor = ele->x();
mLRSnap = 1;
@ -421,8 +404,8 @@ void EBase::mouseMoveEvent(QGraphicsSceneMouseEvent *e){
setX(dstHor);
} else if(mFrmSec==Qt::TopSection) {
dstVer = qMin(dstVer, geo.bottom() - m_handleLen);
if(mType!=Web && dstVer < 0) dstVer = 0;
if(dstVer > 8) for(EBase *ele : mOtherEles) {//上下
if(mType!=Audio && dstVer < 0) dstVer = 0;
if(dstVer > 8) foreach(EBase *ele, mOtherEles) {//上下
if(fabs(dstVer - ele->y()) < SnapSpace) {
dstVer = ele->y();
mTBSnap = 1;
@ -444,7 +427,7 @@ void EBase::mouseMoveEvent(QGraphicsSceneMouseEvent *e){
} else if(mFrmSec==Qt::TopLeftSection) {
dstHor = qMin(dstHor, geo.right() - m_handleLen);
dstVer = qMin(dstVer, geo.bottom() - m_handleLen);
if(mType!=Web) {
if(mType!=Audio) {
if(dstHor < 0) dstHor = 0;
if(dstVer < 0) dstVer = 0;
}
@ -454,7 +437,7 @@ void EBase::mouseMoveEvent(QGraphicsSceneMouseEvent *e){
} else if(mFrmSec==Qt::TopRightSection) {
dstHor = qMax(dstHor, geo.x() + m_handleLen);
dstVer = qMin(dstVer, geo.bottom() - m_handleLen);
if(mType!=Web) {
if(mType!=Audio) {
if(dstHor > gProgItem->mWidth) dstHor = gProgItem->mWidth;
if(dstVer < 0) dstVer = 0;
}
@ -464,7 +447,7 @@ void EBase::mouseMoveEvent(QGraphicsSceneMouseEvent *e){
} else if(mFrmSec==Qt::BottomLeftSection) {
dstHor = qMin(dstHor, geo.right() - m_handleLen);
dstVer = qMax(dstVer, geo.y() + m_handleLen);
if(mType!=Web) {
if(mType!=Audio) {
if(dstHor < 0) dstHor = 0;
if(dstVer > gProgItem->mHeight) dstVer = gProgItem->mHeight;
}
@ -558,17 +541,15 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
hBox->addLabel(tr("X")+": ");
auto fdX = new QSpinBox;
fdX->setRange(-99999, 999999);
fdX->setRange(0, 999999);
fdX->setValue(x());
connect(fdX, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this, fdX](int value) {
if(type()!=Web) {
int max = gProgItem->mWidth - mWidth;
if(value < 0 || value > max) {
value = max;
fdX->blockSignals(true);
fdX->setValue(value);
fdX->blockSignals(false);
}
int max = gProgItem->mWidth - mWidth;
if(value > max) {
value = max;
fdX->blockSignals(true);
fdX->setValue(value);
fdX->blockSignals(false);
}
setX(value);
});
@ -578,17 +559,15 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
hBox->addLabel(tr("Y")+": ");
auto fdY = new QSpinBox;
fdY->setRange(-99999, 999999);
fdY->setRange(0, 999999);
fdY->setValue(y());
connect(fdY, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this, fdY](int value) {
if(type()!=Web) {
int max = gProgItem->mHeight - mHeight;
if(value < 0 || value > max) {
value = max;
fdY->blockSignals(true);
fdY->setValue(value);
fdY->blockSignals(false);
}
int max = gProgItem->mHeight - mHeight;
if(value > max) {
value = max;
fdY->blockSignals(true);
fdY->setValue(value);
fdY->blockSignals(false);
}
setY(value);
});
@ -603,14 +582,12 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
fdW->setRange(6, 999999);
fdW->setValue(mWidth);
connect(fdW, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this, fdW](int value) {
if(type()!=Web) {
int max = gProgItem->mWidth - x();
if(value > max) {
value = max;
fdW->blockSignals(true);
fdW->setValue(value);
fdW->blockSignals(false);
}
int max = gProgItem->mWidth - x();
if(value > max) {
value = max;
fdW->blockSignals(true);
fdW->setValue(value);
fdW->blockSignals(false);
}
setSize(value, mHeight);
});
@ -622,20 +599,20 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
fdH->setRange(6, 999999);
fdH->setValue(mHeight);
connect(fdH, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this, fdH](int value) {
if(type()!=Web) {
int max = gProgItem->mHeight - y();
if(value > max) {
value = max;
fdH->blockSignals(true);
fdH->setValue(value);
fdH->blockSignals(false);
}
int max = gProgItem->mHeight - y();
if(value > max) {
value = max;
fdH->blockSignals(true);
fdH->setValue(value);
fdH->blockSignals(false);
}
setSize(mWidth, value);
});
hBox->addWidget(fdH);
hBox->addStretch();
vBox->addSpacing(-spacing);
connect(this, &EBase::xChanged, fdX, [this, fdX] {
fdX->blockSignals(true);
fdX->setValue(x());
@ -655,24 +632,6 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
fdH->blockSignals(false);
});
hBox = new HBox(vBox);
hBox->addStretch();
hBox->addLabel(tr("Rotate")+": ");
auto fdRotate = new QSpinBox;
fdRotate->setRange(0, 359);
fdRotate->setValue(_rotate);
fdRotate->setToolTip("Need Player 2.1.4");
connect(fdRotate, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [this](int value) {
_rotate = value;
});
hBox->addWidget(fdRotate);
hBox->addSpacing(-spacing+2);
hBox->addLabel("°");
hBox->addStretch();
vBox->addSpacing(-spacing);
hBox = new HBox(vBox);
hBox->addLabel(tr("Border"));
@ -897,28 +856,5 @@ void EBase::addBaseAttrWgt(QBoxLayout *vBox) {
fdExitDur->setValue(value);
}
});
ccc = 2;
auto fdBlink = new QCheckBox(tr("Blink"));
fdBlink->setChecked(_hasBlink);
fdBlink->setToolTip("Need Player 2.1.4");
connect(fdBlink, &QCheckBox::stateChanged, this, [=](int state) {
_hasBlink = state==Qt::Checked;
});
grid->addWidget(fdBlink, 2, ccc++);
ccc++;
grid->addLabel(tr("Freq"), 2, ccc++, Qt::AlignRight|Qt::AlignVCenter);
auto fdBlinkFreq = new QDoubleSpinBox;
fdBlinkFreq->setDecimals(1);
fdBlinkFreq->setSingleStep(0.1);
fdBlinkFreq->setValue(_blink);
connect(fdBlinkFreq, (void(QDoubleSpinBox::*)(double))&QDoubleSpinBox::valueChanged, this, [=](double value) {
_blink = value;
});
grid->addWidget(fdBlinkFreq, 2, ccc++);
grid->addLabel("Hz", 2, ccc++);
}
}

View File

@ -47,13 +47,10 @@ public:
int mType = -1;
EBase *mMultiWin = 0;
qreal mWidth = 0, mHeight = 0;
int _rotate = 0;
QSpinBox *fdDuration = 0;
int mStartTime = 0, mDuration = 10;
QString mEntryEffect, mExitEffect;
int mEntryDur = 1, mExitDur = 1;
double _blink = 1.0;
bool _hasBlink = 0;
signals:
void sizeChanged();
@ -76,7 +73,7 @@ protected:
QPointF mPressRel{FLT_MAX, FLT_MAX};
Qt::WindowFrameSection mFrmSec{Qt::NoSection};
char mLRSnap{0}, mTBSnap{0};
std::vector<EBase *> mOtherEles;
QList<EBase *> mOtherEles;
int bdImgIdx{-1};
QString bdEff{"rotate"};

View File

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

View File

@ -14,8 +14,6 @@ EWeb::EWeb(const JObj &json, EBase *multiWin) : EBase(multiWin) {
zoom = json["zoom"].toInt(100);
_x = json["offX"].toInt(0);
_y = json["offY"].toInt(0);
scaleX = json["scaleX"].toInt(100);
scaleY = json["scaleY"].toInt(100);
}
void EWeb::paint(QPainter *painter, const QStyleOptionGraphicsItem *a, QWidget *b) {
@ -86,8 +84,7 @@ QWidget* EWeb::attrWgt() {
_x = value;
});
hBox->addWidget(fdX);
hBox->addSpacing(-3);
hBox->addLabel()->setMinimumWidth(30);
hBox->addSpacing(9);
hBox->addLabel("Y:");
auto fdY = new QSpinBox;
@ -99,34 +96,6 @@ QWidget* EWeb::attrWgt() {
hBox->addWidget(fdY);
hBox->addStretch();
hBox = new HBox(vBox);
lb = hBox->addLabel(tr("Scale")+" X:");
lb->setMinimumWidth(70);
lb->setAlignment(Qt::AlignVCenter|Qt::AlignRight);
auto fdScaleX = new QSpinBox;
fdScaleX->setRange(-9999, 99999);
fdScaleX->setValue(scaleX);
connect(fdScaleX, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [=](int value) {
scaleX = value;
});
hBox->addWidget(fdScaleX);
hBox->addSpacing(-3);
hBox->addLabel("%")->setMinimumWidth(30);
hBox->addLabel("Y:");
auto fdScaleY = new QSpinBox;
fdScaleY->setRange(-9999, 99999);
fdScaleY->setValue(scaleY);
connect(fdScaleY, (void(QSpinBox::*)(int))&QSpinBox::valueChanged, this, [=](int value) {
scaleY = value;
});
hBox->addWidget(fdScaleY);
hBox->addSpacing(-3);
hBox->addLabel("%");
hBox->addStretch();
vBox->addStretch();
return wgtAttr;
}
@ -139,7 +108,5 @@ JObj EWeb::attrJson() const {
obj["zoom"] = zoom;
obj["offX"] = _x;
obj["offY"] = _y;
obj["scaleX"] = scaleX;
obj["scaleY"] = scaleY;
return obj;
}

View File

@ -21,7 +21,7 @@ public:
JObj attrJson() const override;
QString url;
int zoom = 100, _x = 0, _y = 0, scaleX = 100, scaleY = 100;
int zoom = 100, _x = 0, _y = 0;
};
#endif // EWEB_H

View File

@ -137,19 +137,7 @@ JObj GenTmpThread::cvtPage(const JObj &pageJson) {
for(const auto &ele : elements) {
auto type = ele["elementType"].toString();
auto geometry = 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();
}
sources = type=="Window" ? genSources(QString(), ele["elements"].toArray(), geometry) : genSources(type, JArray{ele}, geometry);
if(! sources.empty()) {
JObj layer{{"repeat", sourceRepeat}, {"sources", sources}};
auto border = ele["border"].toString();
@ -215,7 +203,7 @@ JObj GenTmpThread::cvtPage(const JObj &pageJson) {
};
}
JArray GenTmpThread::genSources(QString type, const JArray &eles) {
JArray GenTmpThread::genSources(QString type, const JArray &eles, const JValue &geometry) {
JArray sources;
auto needType = type.isEmpty();
for(const auto &ele : eles) {
@ -234,12 +222,23 @@ JArray GenTmpThread::genSources(QString type, const JArray &eles) {
if(source["timeSpan"].isNull()) source["timeSpan"] = ele["duration"];
source["entryEffect"] = ele["entryEffect"];
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["exitEffectTimeSpan"] = ele["exitDur"];
if(ele["hasBlink"].toBool()) source["blink"] = ele["blink"];
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;
}
@ -510,8 +509,6 @@ JObj GenTmpThread::convertWeb(const JValue &res) {
dst["zoom"] = res["zoom"];
dst["offX"] = res["offX"];
dst["offY"] = res["offY"];
dst["scaleX"] = res["scaleX"].toDouble(100)/100;
dst["scaleY"] = res["scaleY"].toDouble(100)/100;
return dst;
}
JObj GenTmpThread::convertTimer(const JValue &json) {

View File

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

View File

@ -51,14 +51,13 @@ void SendProgThread::run() {
auto resp = tcp.readAll();
QString error;
auto res = JFrom(resp, &error);
while(error.contains("end-of-input")) {
while(error.endsWith("end-of-input")) {
if(! tcp.waitForReadyRead()) {
emit emErr(QString(socketErrKey(tcp.error()))+" ("+QString::number(tcp.error())+") "+tcp.errorString()+" at waitForRead2 'checkExist'");
tcp.close();
return;
}
resp += tcp.readAll();
error = "";
res = JFrom(resp, &error);
}
if(! error.isEmpty()) {

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