This commit is contained in:
Gangphon 2023-05-16 11:13:55 +08:00
parent 86f509d7a2
commit 8d8c61695c
9 changed files with 16 additions and 11 deletions

View File

@ -260,9 +260,10 @@ LIBS += -L$$PWD/ffmpeg-mac/lib/\
-lswresample \
-lswscale
copy.files += $$files(ffmpeg-mac/lib/*.dylib)
//copy.files += $$files(ffmpeg-mac/lib/*.dylib)
copy.files += ffmpeg-mac/bin/ffmpeg
copy.path = Contents/MacOS
copydir.path = Contents/MacOS
#QMAKE_BUNDLE_DATA += copy
QMAKE_BUNDLE_DATA += copy
QMAKE_BUNDLE_DATA += copydir
}

View File

@ -297,7 +297,10 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
fdPkg->clear();
auto apps = json["apps"].toArray();
auto infoDlg = new QDialog(this);
infoDlg->setAttribute(Qt::WA_DeleteOnClose);
#ifdef Q_OS_WIN
infoDlg->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
#endif
infoDlg->resize(500, 500);
infoDlg->setWindowTitle(tr("Software Version Info"));
auto vBox = new QVBoxLayout(infoDlg);
@ -320,6 +323,8 @@ CtrlAdvancedPanel::CtrlAdvancedPanel(QWidget *parent) : QWidget(parent) {
if(! (packageName.endsWith(".cardsystem") || packageName.endsWith(".systemcore") || packageName.endsWith(".update"))) fdPkg->addItem(packageName);
}
infoDlg->show();
infoDlg->raise();
infoDlg->activateWindow();
});
});
hBox->addWidget(btnApkCheck);

View File

@ -1,5 +1,4 @@
#include "elevideo.h"
#include "tools.h"
#include <QPainter>
#include <QMessageBox>
#include <QOpenGLWidget>

View File

@ -23,7 +23,7 @@ EVideo *EVideo::create(const QString &file, PageListItem *pageItem, EBase *multi
}
QFileInfo rawInfo(file);
QString rawName = rawInfo.fileName();
QString outFile = transcoding(file, rawName, pageItem->mPageDir, img.width(), img.height(), codecId);
QString outFile = transcoding(pageItem->listWidget(), file, rawName, pageItem->mPageDir, img.width(), img.height(), codecId);
if(outFile.isEmpty()) return 0;
QFileInfo outInfo(outFile);
if(! outInfo.isFile() || outInfo.size()==0) return 0;
@ -188,7 +188,7 @@ QWidget* EVideo::attrWgt() {
fdFileName->setText(mRawName);
playDuration = dur/1000000;
fdDuration->setValue(playDuration);
QString outFile = transcoding(rawFile, mRawName, mPageItem->mPageDir, mCoverImg.width(), mCoverImg.height(), codecId);
QString outFile = transcoding(wgtAttr, rawFile, mRawName, mPageItem->mPageDir, mCoverImg.width(), mCoverImg.height(), codecId);
if(outFile.isEmpty()) return;
QFile oldfile(mDir+"/"+mName);
if(oldfile.exists()) oldfile.remove();
@ -263,7 +263,7 @@ QJsonObject EVideo::attrJson() const {
return oRoot;
}
QString EVideo::transcoding(QString rawFile, QString rawName, QString dir, int w, int h, AVCodecID codec_id) {
QString EVideo::transcoding(QWidget *parent, QString rawFile, QString rawName, QString dir, int w, int h, AVCodecID codec_id) {
QSettings settings;
int rawMax = qMax(w, h);
if(settings.value("VideoCompress", true).toBool() && rawMax > 1360 && (w > gProgItem->mWidth || h > gProgItem->mHeight)) {
@ -280,7 +280,7 @@ QString EVideo::transcoding(QString rawFile, QString rawName, QString dir, int w
QProcess process;
process.setWorkingDirectory(QApplication::applicationDirPath());
QMessageBox msgBox;
QMessageBox msgBox(parent);
msgBox.setWindowFlag(Qt::WindowCloseButtonHint, false);
msgBox.setStandardButtons(QMessageBox::NoButton);
msgBox.setWindowTitle(tr("Video Transcoding"));
@ -288,9 +288,9 @@ QString EVideo::transcoding(QString rawFile, QString rawName, QString dir, int w
connect(&process, (void(QProcess::*)(int, QProcess::ExitStatus))&QProcess::finished, &msgBox, [&msgBox] {
msgBox.accept();
});
connect(&process, &QProcess::errorOccurred, &msgBox, [&msgBox](QProcess::ProcessError error) {
connect(&process, &QProcess::errorOccurred, &msgBox, [=, &msgBox](QProcess::ProcessError error) {
msgBox.accept();
QMessageBox::critical(0, tr("Error"), QString(QMetaEnum::fromType<QProcess::ProcessError>().valueToKey(error))+" ("+QString::number(error)+")");
QMessageBox::critical(parent, tr("Error"), QString(QMetaEnum::fromType<QProcess::ProcessError>().valueToKey(error))+" ("+QString::number(error)+")");
});
connect(&process, &QProcess::readyReadStandardOutput, &msgBox, [&process] {
auto data = process.readAllStandardOutput();
@ -318,7 +318,7 @@ QString EVideo::transcoding(QString rawFile, QString rawName, QString dir, int w
process.start("ffmpeg", {"-y", "-i", rawFile, "-vcodec", "h264", "-s", QString::number(w)+"x"+QString::number(h), "-profile:v", "main", "-b:v", QString::number(w*h/150)+"k", outFile});
msgBox.exec();
if(err.rightRef(32).contains("Conversion failed!")) {
QMessageBox::critical(0, tr("Error"), err);
QMessageBox::critical(parent, tr("Error"), err);
return "";
}
return outFile;

View File

@ -18,7 +18,7 @@ public:
static const QImage mask = QImage(":/res/video-pre.png");
return mask;
}
static QString transcoding(QString rawFile, QString rawName, QString dir, int rawW, int rawH, AVCodecID codec_id);
static QString transcoding(QWidget *parent, QString rawFile, QString rawName, QString dir, int rawW, int rawH, AVCodecID codec_id);
static EVideo *create(const QString &file, PageListItem *pageItem, EBase *multiWin = nullptr);
static EVideo *create(const QJsonObject &, PageListItem *pageItem, EBase *multiWin = nullptr);
static QJsonObject genProg(const QJsonObject &, const QString &, ProgItem *mProgItem);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.