mirror of
https://gitlab.com/kelteseth/ScreenPlay.git
synced 2024-09-18 16:32:33 +02:00
Merge remote-tracking branch 'origin/es/feature/convertVideo' into dev
# Conflicts: # ScreenPlay/Resources.qrc # ScreenPlay/main.cpp # ScreenPlay/qml/Create/CreateWallpaper.qml # ScreenPlay/qml/Create/Wizards/CreateWallpaper/CreateWallpaperWizard.qml # ScreenPlay/qml/Navigation.qml # ScreenPlay/src/create.cpp # ScreenPlayWidget/ScreenPlayWidget.pro # ScreenPlayWorkshop/workshopsdk/ScreenPlayWorkshop.pro
This commit is contained in:
commit
55a11b471a
BIN
Common/ProtocolBuffer/google/protobuf/bin/libprotobuf.lib
Normal file
BIN
Common/ProtocolBuffer/google/protobuf/bin/libprotobuf.lib
Normal file
Binary file not shown.
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:6c96cd9bfc6ccbee21eaf465f3936a3610baf32a8f6fd9b1f148f529efbebd64
|
||||
size 9250304
|
BIN
Common/ProtocolBuffer/google/protobuf/bin/libprotobufd.lib
Normal file
BIN
Common/ProtocolBuffer/google/protobuf/bin/libprotobufd.lib
Normal file
Binary file not shown.
@ -1,4 +1,3 @@
|
||||
#include <QThread>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
#include <QFontDatabase>
|
||||
@ -10,6 +9,7 @@
|
||||
#include <QQmlApplicationEngine>
|
||||
#include <QQmlContext>
|
||||
#include <QQmlEngine>
|
||||
#include <QThread>
|
||||
|
||||
#include <QQuickView>
|
||||
#include <QScreen>
|
||||
@ -26,6 +26,7 @@
|
||||
#endif
|
||||
|
||||
//#include "ThirdParty/qt-google-analytics/ganalytics.h"
|
||||
#include "ThirdParty/steam/steam_api.h"
|
||||
#include "src/create.h"
|
||||
#include "src/installedlistfilter.h"
|
||||
#include "src/installedlistmodel.h"
|
||||
@ -36,11 +37,9 @@
|
||||
#include "src/sdkconnector.h"
|
||||
#include "src/settings.h"
|
||||
#include "src/startuperror.h"
|
||||
#include "ThirdParty/steam/steam_api.h"
|
||||
#include "src/steamworkshop.h"
|
||||
#include "src/steamworkshoplistmodel.h"
|
||||
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
|
||||
@ -50,7 +49,6 @@ int main(int argc, char* argv[])
|
||||
app.setQuitOnLastWindowClosed(false);
|
||||
qSetMessagePattern("%{if-category}%{category}: %{endif}%{message}\n Loc: [%{file}:%{line}]");
|
||||
|
||||
|
||||
QTranslator trsl;
|
||||
trsl.load(":/translations/ScreenPlay_de.qm");
|
||||
app.installTranslator(&trsl);
|
||||
|
@ -85,6 +85,7 @@ Item {
|
||||
|
||||
FileDialog {
|
||||
id: fileDialogOpenFile
|
||||
// nameFilters: ["Video files (*.mp4)"]
|
||||
onAccepted: {
|
||||
videoFileSelected(fileDialogOpenFile.currentFile)
|
||||
}
|
||||
|
@ -19,7 +19,6 @@ Item {
|
||||
utility.setNavigationActive(false)
|
||||
}
|
||||
|
||||
|
||||
//Blocks some MouseArea from create page
|
||||
MouseArea {
|
||||
anchors.fill: parent
|
||||
@ -137,6 +136,18 @@ Item {
|
||||
running: true
|
||||
}
|
||||
|
||||
Text {
|
||||
id: txtConvertNumber
|
||||
color: "white"
|
||||
text: qsTr("")
|
||||
font.pixelSize: 21
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 40
|
||||
}
|
||||
}
|
||||
|
||||
Text {
|
||||
id: txtConvert
|
||||
color: "white"
|
||||
@ -145,7 +156,7 @@ Item {
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
bottom: parent.bottom
|
||||
bottomMargin: 30
|
||||
bottomMargin: 20
|
||||
}
|
||||
}
|
||||
|
||||
@ -162,21 +173,22 @@ Item {
|
||||
imgPreview.source = "file:///"
|
||||
+ screenPlayCreate.workingDir + "/preview.png"
|
||||
imgPreview.visible = true
|
||||
|
||||
}
|
||||
|
||||
if (state === Create.State.ConvertingPreviewGifFinished) {
|
||||
imgPreview.source = "file:///"
|
||||
+ screenPlayCreate.workingDir + "/preview.gif"
|
||||
imgPreview.visible = true
|
||||
|
||||
txtConvert.text = qsTr("Converting Video")
|
||||
}
|
||||
}
|
||||
onProgressChanged: {
|
||||
var percentage = Math.floor(progress * 100)
|
||||
if (percentage > 100)
|
||||
percentage = 100
|
||||
txtConvertNumber.text = percentage + "%"
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Item {
|
||||
@ -202,9 +214,8 @@ Item {
|
||||
anchors.right: parent.right
|
||||
anchors.left: parent.left
|
||||
onTextChanged: {
|
||||
if (textField.text.length >= 3 ) {
|
||||
if (textField.text.length >= 3) {
|
||||
canNext = true
|
||||
|
||||
} else {
|
||||
canNext = false
|
||||
}
|
||||
@ -233,11 +244,10 @@ Item {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Row {
|
||||
id: column1
|
||||
height: 100
|
||||
width:childrenRect.width
|
||||
width: childrenRect.width
|
||||
spacing: 10
|
||||
anchors {
|
||||
horizontalCenter: parent.horizontalCenter
|
||||
@ -265,7 +275,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Connections {
|
||||
@ -276,7 +285,6 @@ Item {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -430,7 +438,7 @@ Item {
|
||||
Timer {
|
||||
id: timerBack
|
||||
interval: 800
|
||||
onTriggered:{
|
||||
onTriggered: {
|
||||
screenPlayCreate.abort()
|
||||
utility.setNavigationActive(true)
|
||||
utility.setNavigation("Create")
|
||||
@ -628,5 +636,5 @@ Item {
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,6 @@ Item {
|
||||
|
||||
//Pull to refresh
|
||||
if (contentY <= -180 && !refresh && !isDragging) {
|
||||
tracker.sendEvent("ui_event", "pulltorefresh", "refresh")
|
||||
installedListModel.reset()
|
||||
installedListModel.loadScreens()
|
||||
}
|
||||
|
@ -225,8 +225,8 @@ Item {
|
||||
height: 100
|
||||
width: 400
|
||||
anchors {
|
||||
top: monitorSelectionWrapper.bottom
|
||||
topMargin: 30
|
||||
bottom: btnSetWallpaper.top
|
||||
bottomMargin: 20
|
||||
right: parent.right
|
||||
rightMargin: 30
|
||||
leftMargin: 30
|
||||
|
@ -93,10 +93,8 @@ Rectangle {
|
||||
rp.itemAt(i).x = rp.itemAt(i).x * monitorWidthRationDelta
|
||||
rp.itemAt(i).y = rp.itemAt(i).y * monitorHeightRationDelta
|
||||
}
|
||||
for(var i = 0; i < rp.count; i++){
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
id: rp
|
||||
|
@ -67,6 +67,7 @@ Item {
|
||||
text: settingsHeader.text
|
||||
font.pixelSize: 18
|
||||
color: "white"
|
||||
verticalAlignment: Text.AlignTop
|
||||
renderType: Text.NativeRendering
|
||||
font.family: "Roboto"
|
||||
anchors{
|
||||
|
@ -324,9 +324,67 @@ bool Create::createWallpaperVideoPreview()
|
||||
|
||||
bool Create::createWallpaperVideo()
|
||||
{
|
||||
emit createWallpaperStateChanged(Create::State::ConvertingVideo);
|
||||
|
||||
/*
|
||||
*
|
||||
* Extract audio
|
||||
*
|
||||
*/
|
||||
|
||||
emit createWallpaperStateChanged(Create::State::ConvertingAudio);
|
||||
|
||||
QStringList args;
|
||||
args.clear();
|
||||
args.append("-y");
|
||||
args.append("-stats");
|
||||
args.append("-i");
|
||||
args.append(m_createWallpaperData.videoPath);
|
||||
args.append("-f");
|
||||
args.append("mp3");
|
||||
args.append("-ab");
|
||||
args.append("192000");
|
||||
args.append("-vn");
|
||||
args.append(m_createWallpaperData.exportPath + "/audio.mp3");
|
||||
|
||||
QScopedPointer<QProcess> proConvertImage(new QProcess());
|
||||
proConvertImage.data()->setArguments(args);
|
||||
qDebug() << "Start extracting video to audio";
|
||||
#ifdef Q_OS_WIN
|
||||
proConvertImage.data()->setProgram(QApplication::applicationDirPath() + "/ffmpeg.exe");
|
||||
#endif
|
||||
#ifdef Q_OS_MACOS
|
||||
pro.data()->setProgram(QApplication::applicationDirPath() + "/ffmpeg");
|
||||
#endif
|
||||
|
||||
connect(this, &Create::abortCreateWallpaper, proConvertImage.data(), &QProcess::kill);
|
||||
proConvertImage.data()->start(QIODevice::ReadOnly);
|
||||
while (!proConvertImage.data()->waitForFinished(100)) //Wake up every 100ms and check if we must exit
|
||||
{
|
||||
QCoreApplication::processEvents();
|
||||
}
|
||||
|
||||
QString tmpErrImg = proConvertImage.data()->readAllStandardError();
|
||||
if (!tmpErrImg.isEmpty()) {
|
||||
QFile previewImg(m_createWallpaperData.exportPath + "/preview.png");
|
||||
if (!previewImg.exists() && !(previewImg.size() > 0)) {
|
||||
emit createWallpaperStateChanged(Create::State::ConvertingAudioError);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
this->processOutput(proConvertImage.data()->readAll());
|
||||
proConvertImage.data()->close();
|
||||
emit createWallpaperStateChanged(Create::State::ConvertingAudioFinished);
|
||||
|
||||
/*
|
||||
*
|
||||
* Create video
|
||||
*
|
||||
*/
|
||||
|
||||
emit createWallpaperStateChanged(Create::State::ConvertingVideo);
|
||||
|
||||
args.clear();
|
||||
args.append("-hide_banner");
|
||||
args.append("-y");
|
||||
args.append("-stats");
|
||||
@ -359,8 +417,25 @@ bool Create::createWallpaperVideo()
|
||||
#endif
|
||||
qDebug() << "Start converting video";
|
||||
|
||||
connect(proConvertVideo.data(), &QProcess::readyReadStandardOutput, this, [&]() {
|
||||
QString tmpOut = proConvertVideo.data()->readAllStandardOutput();
|
||||
connect(proConvertVideo.data(), &QProcess::readyRead, this, [&]() {
|
||||
// Somehow readyRead gets seldom called in the end with an
|
||||
// not valid QProcess pointer....
|
||||
if (proConvertVideo.isNull()) {
|
||||
qDebug() << "EROR NULL";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!proConvertVideo.data()->isOpen()) {
|
||||
qDebug() << "ERROR NOT OPEN";
|
||||
return;
|
||||
}
|
||||
|
||||
if (!proConvertVideo.data()->isReadable()) {
|
||||
qDebug() << "ERROR CANNOT READ LINE";
|
||||
return;
|
||||
}
|
||||
|
||||
QString tmpOut = proConvertVideo.data()->readAll();
|
||||
qDebug() << tmpOut << m_createWallpaperData.length;
|
||||
auto tmpList = tmpOut.split(QRegExp("\\s+"), QString::SkipEmptyParts);
|
||||
if (tmpList.length() > 2) {
|
||||
@ -369,13 +444,15 @@ bool Create::createWallpaperVideo()
|
||||
|
||||
if (!ok)
|
||||
return;
|
||||
qDebug() << currentFrame << m_createWallpaperData.length << m_createWallpaperData.framerate;
|
||||
|
||||
float progress = currentFrame / m_createWallpaperData.length;
|
||||
|
||||
float progress = currentFrame / (m_createWallpaperData.length * m_createWallpaperData.framerate);
|
||||
qDebug() << progress;
|
||||
this->setProgress(progress);
|
||||
}
|
||||
this->processOutput(tmpOut);
|
||||
});
|
||||
},
|
||||
Qt::QueuedConnection);
|
||||
|
||||
connect(this, &Create::abortCreateWallpaper, proConvertVideo.data(), &QProcess::kill);
|
||||
proConvertVideo.data()->start(QIODevice::ReadOnly);
|
||||
|
@ -55,10 +55,13 @@ public:
|
||||
ConvertingPreviewImageError,
|
||||
ConvertingPreviewVideo,
|
||||
ConvertingPreviewVideoFinished,
|
||||
ConvertingPreviewVideoError,
|
||||
ConvertingPreviewVideoError, //10
|
||||
ConvertingPreviewGif,
|
||||
ConvertingPreviewGifFinished,
|
||||
ConvertingPreviewGifError,
|
||||
ConvertingAudio,
|
||||
ConvertingAudioFinished,
|
||||
ConvertingAudioError,
|
||||
ConvertingVideo,
|
||||
ConvertingVideoFinished,
|
||||
ConvertingVideoError,
|
||||
|
@ -129,7 +129,7 @@ void InstalledListModel::loadScreens()
|
||||
if (fileEnding.endsWith(".webm") || (obj.value("type").toString() == "qmlScene") || fileEnding.endsWith(".html"))
|
||||
emit addInstalledItem(obj, item.baseName());
|
||||
|
||||
if(obj.value("type") == "qmlWidget")
|
||||
if(obj.value("type") == "qmlWidget" || obj.value("type") == "standalonewidget")
|
||||
emit addInstalledItem(obj, item.baseName());
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ int main(int argc, char* argv[])
|
||||
|
||||
// Args: which monitor, (2) path to project, (3)wallpaper secret to identify the connected socket, (4) decoder, (5) volume, (6) fillmode
|
||||
// See screenplay.h @ScreenPlayWallpaper constructor how the args get created
|
||||
// MainWindow w(0,"D:/672870/827148653","","","","");
|
||||
//MainWindow w(0,"D:/672870/_tmp_135011","","","","");
|
||||
sdk.setAppID(argumentList.at(3));
|
||||
qDebug() << "Starting MainWindow: " << argumentList.at(2) << argumentList.at(3) << argumentList.at(4) << argumentList.at(5) << argumentList.at(6);
|
||||
MainWindow w(monitor, argumentList.at(2), argumentList.at(3), argumentList.at(4), argumentList.at(5), argumentList.at(6));
|
||||
|
Loading…
Reference in New Issue
Block a user