1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-22 18:52:30 +01:00

Merge branch 'master' into local/tmp/71-create-a-shader-library-subproject

This commit is contained in:
Elias Steurer 2020-09-24 11:47:32 +02:00
commit 6d7389833d
19 changed files with 67 additions and 631 deletions

1
.gitignore vendored
View File

@ -88,3 +88,4 @@ compile_commands.json
CTestTestfile.cmake
_deps
.cmake/**
/Common/ffmpeg/*

View File

@ -26,7 +26,16 @@ build:windows:
paths:
- Common\vcpkg\
script:
- .\install_dependencies_windows.bat
- git submodule update --init
- git submodule update --recursive
- cd Common
- if (!(Test-Path "vcpkg")){git clone https://github.com/microsoft/vcpkg.git}
- cd vcpkg
- git pull | git checkout 18ab4b72a26284f0df28295ce7bf9b21c96f20f4
- call bootstrap-vcpkg.bat
- vcpkg.exe install openssl --triplet x64-windows --recurse
- cd ..
- cd ..
- mkdir BUILD_WINDOWS
- cd BUILD_WINDOWS
- cmake.exe ../ -DCMAKE_PREFIX_PATH=c:/Qt/5.15.1/msvc2019 -DCMAKE_IGNORE_PATH=C:/Strawberry/c/bin -DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_TOOLCHAIN_FILE="$(Get-Location)/../Common/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows "-GCodeBlocks - Ninja" -B.

View File

@ -4,7 +4,7 @@
``` bash
git clone --recursive https://gitlab.com/kelteseth/ScreenPlay.git
```
3. Download the latest [__Qt 5.14__](https://www.qt.io/download-qt-installer). Earlier versions are not supported!
3. Download the latest [__Qt 5.15__](https://www.qt.io/download-qt-installer). Earlier versions are not supported!
4. Start install-dependencies.bat to download dependencies into the Common/ folder
``` bash
//Windows
@ -16,15 +16,11 @@ chmod +x install-dependencies.sh
.\install-dependencies.sh
```
* This will install these dependencies via __vcpkg__
* libzippp
* nlohmann-json
* openSSL 1.1.1d
* zlib& libzip
* breakpad
* sentry-native
* Download these dependencies via __git submodules__
* stomt-qt-sdk
* qt-google-analytics
* qt-breakpad
* Download ffmpeg binaries
5. **Follow the steps below for your OS**.
6. Open the CMakeLists.txt via QtCreator. **This can take some time until QtCreator parses all files!**
@ -52,7 +48,7 @@ chmod +x install-dependencies.sh
2. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer)
- Install the Maintaince tool
- Select the following features to install:
- Qt 5.14.2
- Qt 5.15.2
- MSVC 2017 64-bit
- Qt WebEngine
- Developer and Designer Tools
@ -75,14 +71,14 @@ sudo zypper install -t pattern devel_basis
2. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer)
- Install the Maintaince tool
- Select the following features to install:
- Qt 5.14.2
- Qt 5.15.2
- GCC
- Qt WebEngine
### OSX
1. [Download and install Qt 5 binary installer from qt.io](https://www.qt.io/download-qt-installer)
- Install the Maintaince tool
- Select the following features to install:
- Qt 5.14.2
- Qt 5.15.2
- Qt WebEngine
- Developer and Designer Tools
- OpenSSL 1.1.1.c Toolkit

View File

@ -18,13 +18,9 @@ find_package(
LinguistTools
REQUIRED)
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(libzippp CONFIG REQUIRED)
find_package(sentry CONFIG REQUIRED)
set(src main.cpp
app.cpp
../Common/qt-google-analytics/ganalytics.cpp
@ -87,12 +83,13 @@ add_executable(${PROJECT_NAME} ${src} ${headers} ${resources} ${qml})
if(WIN32)
# Icon
target_sources(${PROJECT_NAME} PRIVATE ScreenPlay.rc)
endif()
# Disable console window on Windows
# https://stackoverflow.com/questions/8249028/how-do-i-keep-my-qt-c-program-from-opening-a-console-in-windows
set_property(TARGET ${PROJECT_NAME} PROPERTY WIN32_EXECUTABLE true)
endif()
target_compile_definitions(${PROJECT_NAME} PRIVATE "GIT_VERSION=${GIT_VERSION}")
@ -103,7 +100,6 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Widgets
Qt5::Core
Qt5::WebEngine
libzippp::libzippp
sentry::sentry
ScreenPlaySDK
)
@ -115,8 +111,12 @@ target_include_directories(${PROJECT_NAME}
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/assets/fonts)
configure_file(assets/fonts/NotoSansCJKkr-Regular.otf ${CMAKE_BINARY_DIR}/bin/assets/fonts COPYONLY)
# Copy ffmpeg. If the ffmpeg files are missing, start the
# install_dependencies_XXX for your system!
if(WIN32)
configure_file(${VCPKG_TOOLS_PATH}/sentry-native/crashpad_handler.exe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffmpeg.exe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffprobe.exe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
else()
configure_file(${VCPKG_TOOLS_PATH}/sentry-native/crashpad_handler ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffmpeg ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../Common/ffmpeg/ffprobe ${CMAKE_BINARY_DIR}/bin/ COPYONLY)
endif()

View File

@ -47,7 +47,7 @@ App::App()
QGuiApplication::setOrganizationName("ScreenPlay");
QGuiApplication::setOrganizationDomain("screen-play.app");
QGuiApplication::setApplicationName("ScreenPlay");
QGuiApplication::setApplicationVersion("0.12.0");
QGuiApplication::setApplicationVersion("0.12.1");
QGuiApplication::setQuitOnLastWindowClosed(false);
QFontDatabase::addApplicationFont(":/assets/fonts/LibreBaskerville-Italic.ttf");

View File

@ -28,7 +28,7 @@ ApplicationWindow {
visible: false
width: 1400
height: 788
title: "ScreenPlay Alpha - V0.12.0"
title: "ScreenPlay Alpha - V0.12.1"
minimumHeight: 450
minimumWidth: 1050
onVisibilityChanged: {
@ -96,7 +96,6 @@ ApplicationWindow {
pageLoaderCreate.visible = true
pageLoaderWorkshop.visible = false
pageLoaderCreate.setSource("qrc:/qml/Create/Create.qml")
pageLoaderCreate.item.checkFFMPEG()
} else if (name === "Workshop") {
if (ScreenPlay.settings.steamVersion) {

View File

@ -7,7 +7,6 @@
<file>qml/Create/CreateContentButton.qml</file>
<file>qml/Create/Wizards/CreateWallpaper/CreateWallpaperVideoImportConvert.qml</file>
<file>qml/Create/Wizards/CreateWallpaper/CreateWallpaperResult.qml</file>
<file>qml/Create/FFMPEGPopup.qml</file>
<file>qml/Create/Wizard.qml</file>
<file>qml/Create/Wizards/CreateEmptyWidget/CreateEmptyWidget.qml</file>
<file>qml/Create/Footer.qml</file>

View File

@ -57,7 +57,6 @@ Item {
icon.source: "qrc:/assets/icons/icon_supervisor_account.svg"
}
CommunityNavItem {
enabled: false
text: qsTr("Steam Workshop")
openLink: "steam://url/GameHub/672870"
icon.source: "qrc:/assets/icons/icon_steam.svg"

View File

@ -19,20 +19,6 @@ Item {
create.state = "in"
}
function checkFFMPEG() {
if (!ScreenPlay.util.ffmpegAvailable) {
ffmpegPopup.open()
}
}
FFMPEGPopup {
id: ffmpegPopup
anchors.centerIn: create
closePolicy: Popup.NoAutoClose
focus: true
modal: true
parent: create
}
BackgroundParticleSystem {
id: particleSystemWrapper

View File

@ -1,389 +0,0 @@
import QtQuick 2.12
import QtQuick.Layouts 1.12
import QtQuick.Controls 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Particles 2.0
import QtGraphicalEffects 1.0
import ScreenPlay 1.0
import ScreenPlay.Create 1.0
import ScreenPlay.QMLUtilities 1.0
import "Wizards/CreateWallpaper"
Popup {
id: ffmpegPopup
height: 600
padding: 30
width: 900
background: Rectangle {
anchors.fill: parent
color: Material.theme === Material.Light ? "white" : Material.background
}
Connections {
target: ScreenPlay.util
function onAquireFFMPEGStatusChanged(aquireFFMPEGStatus) {
switch (aquireFFMPEGStatus) {
case QMLUtilities.Init:
break
case QMLUtilities.Download:
btnNotNow.enabled = false
btnDownload.enabled = false
busyIndicator.running = true
txtStatus.text = qsTr("Begin downloading FFMPEG")
break
case QMLUtilities.DownloadFailed:
btnNotNow.enabled = true
txtStatus.text = qsTr("FFMPEG download failed")
busyIndicator.running = false
break
case QMLUtilities.DownloadSuccessful:
txtStatus.text = qsTr("FFMPEG download successful")
break
case QMLUtilities.Extracting:
txtStatus.text = qsTr("Extracting FFMPEG")
break
case QMLUtilities.ExtractingFailedReadFromBuffer:
btnNotNow.enabled = true
txtStatus.text = qsTr("ERROR extracting ffmpeg from RAM")
busyIndicator.running = false
break
case QMLUtilities.ExtractingFailedFFMPEG:
btnNotNow.enabled = true
txtStatus.text = qsTr("ERROR extracing ffmpeg")
busyIndicator.running = false
break
case QMLUtilities.ExtractingFailedFFMPEGSave:
btnNotNow.enabled = true
txtStatus.text = qsTr("ERROR saving FFMPEG to disk")
busyIndicator.running = false
break
case QMLUtilities.ExtractingFailedFFPROBE:
btnNotNow.enabled = true
txtStatus.text = qsTr("ERROR extracing FFPROBE")
busyIndicator.running = false
break
case QMLUtilities.ExtractingFailedFFPROBESave:
btnNotNow.enabled = true
txtStatus.text = qsTr("ERROR saving FFPROBE to disk")
busyIndicator.running = false
break
case QMLUtilities.ExtractingSuccessful:
txtStatus.text = qsTr("Extraction successful")
break
case QMLUtilities.FinishedSuccessful:
txtStatus.text = qsTr("All done and ready to go!")
busyIndicator.running = false
column.state = "finishedSuccessful"
ScreenPlay.util.setFfmpegAvailable(true)
break
}
}
}
Popup {
id: closeDialog
width: 400
height: 250
background: Rectangle {
anchors.fill: parent
color: Material.theme === Material.Light ? "white" : Material.background
}
Text {
text: qsTr("You cannot create Wallaper without FFMPEG installed!")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pointSize: 16
height: 50
font.family: ScreenPlay.settings.font
anchors.fill: parent
anchors.margins: 50
wrapMode: Text.WordWrap
color: Material.color(Material.Orange)
}
RowLayout {
height: 30
anchors {
right: parent.right
bottom: parent.bottom
left: parent.left
margins: 20
}
Button {
text: qsTr("Abort")
onClicked: {
ffmpegPopup.close()
closeDialog.close()
ScreenPlay.util.setNavigation("Installed")
}
Layout.alignment: Qt.AlignRight
}
Button {
text: qsTr("Download FFMPEG")
highlighted: true
onClicked: closeDialog.close()
Layout.alignment: Qt.AlignRight
}
}
anchors.centerIn: Overlay.overlay
closePolicy: Popup.NoAutoClose
focus: true
modal: true
}
ColumnLayout {
id: column
anchors.fill: parent
Text {
id: txtDownloadFFMPEG
text: qsTr("Before we can start creating content you need to download FFMPEG")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pointSize: 16
Layout.fillWidth: true
Layout.preferredHeight: 60
color: Material.foreground
font.family: ScreenPlay.settings.font
}
Item {
Layout.fillHeight: true
Layout.fillWidth: true
Item {
width: parent.width * .33
anchors {
top: parent.top
bottom: parent.bottom
left: parent.left
}
Image {
id: imgFFMPEGLogo
source: "qrc:/assets/images/FFmpeg_Logo_new.svg"
width: sourceSize.width
height: sourceSize.height
anchors {
horizontalCenter: parent.horizontalCenter
margins: 20
top: parent.top
}
}
BusyIndicator {
id: busyIndicator
anchors.centerIn: parent
running: false
}
Text {
id: txtStatus
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pointSize: 14
height: 50
Layout.fillWidth: true
color: Material.color(Material.Orange)
font.family: ScreenPlay.settings.font
wrapMode: Text.WordWrap
anchors {
top: busyIndicator.bottom
topMargin: 20
right: parent.right
left: parent.left
}
}
}
Page {
width: parent.width * .66
background: Rectangle {
anchors.fill: parent
color: Material.theme === Material.Light ? Material.background : Qt.darker(
Material.background)
radius: 3
}
padding: 10
anchors {
top: parent.top
bottom: parent.bottom
right: parent.right
}
Flickable {
anchors.fill: parent
clip: true
contentHeight: txtExpander.paintedHeight + 100
contentWidth: parent.width
ScrollBar.vertical: ScrollBar {
snapMode: ScrollBar.SnapOnRelease
policy: ScrollBar.AlwaysOn
}
MouseArea {
anchors.fill: parent
id: maHoverEffect
}
Text {
id: txtExpander
anchors {
fill: parent
margins: 30
leftMargin: 0
}
color: Material.foreground
height: txtExpander.paintedHeight
wrapMode: Text.WordWrap
font.pointSize: 12
font.family: ScreenPlay.settings.font
onLinkHovered: maHoverEffect.cursorShape = Qt.PointingHandCursor
onLinkActivated: Qt.openUrlExternally(link)
linkColor: Material.color(Material.LightBlue)
text: qsTr("<b>Why do we bother you with this?</b>
<br><br> Well its because of <b>copyright</b> and many many <b>patents</b>.
" + "Files like .mp4 or .webm are containers for video and audio. Every audio
" + "and video file is encoded with a certain codec. These can be open source
" + "and free to use like <a href='https://wikipedia.org/wiki/VP8'>VP8</a> and the newer <a href='https://wikipedia.org/wiki/VP9'>VP9</a> (the one YouTube uses for their webms)
" + "but there are also some proprietary ones like <a href='https://wikipedia.org/wiki/H.264/MPEG-4_AVC'>h264</a> and the successor <a href='https://wikipedia.org/wiki/High_Efficiency_Video_Coding'>h265</a>." + "
<br>
<br>
" + "\n\n We as software developer now need to deal with stuff like this in a field we
" + "do not have any expertise in. The desicion to enable only free codecs for content was
" + "an easy one but we still need to provide a way for our user to import wallpaper
" + "without a hassle. We do not provide <a href='https://ffmpeg.org/'>FFMPEG</a> for
" + "converting video and audio with ScreenPlay because we are not allowed to. We let the user download <a href='https://ffmpeg.org/'>FFMPEG</a> which
" + "is perfectly fine!
<br>
Sorry for this little inconvenience :)" + "
<br>
<br>
<center>
<b>
IF YOU DO NOT HAVE AN INTERNET CONNECT YOU CAN SIMPLY PUT FFMPEG AND FFPROBE
IN THE SAME FOLDER AS YOUR SCREENPLAY EXECUTABLE!
</b>
<br>
<br>
This is usually:
<br> C:\\Program Files (x86)\\Steam\\steamapps\\common\\ScreenPlay
<br>
if you installed ScreenPlay via Steam!
</center>
<br>
<br>
" + "<b>~ Kelteseth | Elias Steurer</b>")
}
}
}
}
RowLayout {
spacing: 20
Layout.fillWidth: true
Layout.alignment: Qt.AlignBottom
Button {
id: btnDownload
text: qsTr("Download FFMPEG")
onClicked: ScreenPlay.util.downloadFFMPEG()
highlighted: true
Layout.fillWidth: true
}
Button {
id: btnNotNow
text: qsTr("Not now!")
onClicked: closeDialog.open()
Layout.fillWidth: true
}
}
states: [
State {
name: "finishedSuccessful"
PropertyChanges {
target: column
opacity: 0
enabled: false
}
PropertyChanges {
target: successWrapper
opacity: 1
enabled: true
}
}
]
transitions: [
Transition {
from: "*"
to: "finishedSuccessful"
PropertyAnimation {
target: successWrapper
property: "opacity"
duration: 250
}
}
]
}
Item {
id: successWrapper
anchors.fill: parent
anchors.margins: 30
opacity: 0
enabled: false
Text {
id: txtDownloadFFMPEGComplete
text: qsTr("You can now start creating content!")
verticalAlignment: Text.AlignVCenter
horizontalAlignment: Text.AlignHCenter
font.pointSize: 16
height: 50
Layout.fillWidth: true
color: Material.foreground
font.family: ScreenPlay.settings.font
anchors {
horizontalCenter: parent.horizontalCenter
top: parent.top
topMargin: 30
}
}
Image {
id: imgOk
fillMode: Image.PreserveAspectFit
source: "qrc:/assets/icons/icon_done.svg"
width: 180
height: width
sourceSize: Qt.size(width, width)
anchors.centerIn: parent
smooth: true
}
ColorOverlay {
anchors.fill: imgOk
source: imgOk
color: Material.color(Material.LightGreen)
}
Button {
text: qsTr("Start!")
highlighted: true
onClicked: ffmpegPopup.close()
anchors {
horizontalCenter: parent.horizontalCenter
top: imgOk.bottom
margins: 30
}
}
}
}

View File

@ -72,7 +72,7 @@ Item {
}
Button {
text: ScreenPlay.util.ffmpegAvailable ? qsTr("Import video") : qsTr("FFMPEG Needed for import")
text: qsTr("Import video")
anchors {
horizontalCenter: parent.horizontalCenter
bottom: parent.bottom
@ -84,7 +84,6 @@ Item {
icon.color: "white"
icon.width: 16
font.family: ScreenPlay.settings.font
enabled: ScreenPlay.util.ffmpegAvailable
icon.height: 16
onClicked: fileDialogImportVideo.open()
}

View File

@ -82,6 +82,7 @@ Item {
cellHeight: 200
cacheBuffer: 160
interactive: pageInstalled.enabled
snapMode: GridView.SnapToRow
anchors {
topMargin: 0
rightMargin: 0
@ -209,7 +210,8 @@ Item {
text: qsTr("Open containing folder")
icon.source: "qrc:/assets/icons/icon_folder_open.svg"
onClicked: {
ScreenPlay.util.openFolderInExplorer(contextMenu.absoluteStoragePath)
ScreenPlay.util.openFolderInExplorer(
contextMenu.absoluteStoragePath)
}
}
MenuItem {

View File

@ -82,7 +82,7 @@ Item {
Button {
id: btnWorkshop
text: qsTr("Browse the Steam Workshop")
Material.background: Material.Blue
Material.background: Material.color(Material.Green)
Material.foreground: "white"
smooth: true
font.pointSize: 18

View File

@ -8,17 +8,6 @@ ScreenPlay::SDKConnection::SDKConnection(QLocalSocket* socket, QObject* parent)
connect(m_socket, &QLocalSocket::readyRead, this, &SDKConnection::readyRead);
}
ScreenPlay::SDKConnection::~SDKConnection()
{
// We need to call this manually because
// sometimes it wont close the connection in
// the descructor
m_socket->disconnect();
m_socket->disconnectFromServer();
m_socket->close();
}
void ScreenPlay::SDKConnection::readyRead()
{

View File

@ -69,7 +69,6 @@ public:
SDKConnection.
*/
explicit SDKConnection(QLocalSocket* socket, QObject* parent = nullptr);
~SDKConnection();
QString appID() const
{

View File

@ -16,7 +16,9 @@ Util::Util(QNetworkAccessManager* networkAccessManager, QObject* parent)
, m_networkAccessManager { networkAccessManager }
{
utilPointer = this;
qRegisterMetaType<Util::AquireFFMPEGStatus>();
// Fix log access vilation on quit
QObject::connect(QGuiApplication::instance(), &QGuiApplication::aboutToQuit, this, []() { utilPointer = nullptr; });
qmlRegisterUncreatableType<Util>("ScreenPlay.QMLUtilities", 1, 0, "QMLUtilities", "Error only for enums");
// In release mode redirect messages to logging otherwhise we break the nice clickable output :(
@ -27,21 +29,6 @@ Util::Util(QNetworkAccessManager* networkAccessManager, QObject* parent)
// This gives us nice clickable output in QtCreator
qSetMessagePattern("%{if-category}%{category}: %{endif}%{message}\n Loc: [%{file}:%{line}]");
QString path = QApplication::instance()->applicationDirPath() + "/";
QFile fileFFMPEG;
QFile fileFFPROBE;
#ifdef Q_OS_WIN
fileFFMPEG.setFileName(path + "ffmpeg.exe");
fileFFPROBE.setFileName(path + "ffprobe.exe");
#else
fileFFMPEG.setFileName(path + "ffmpeg");
fileFFPROBE.setFileName(path + "ffprobe");
#endif
if (fileFFMPEG.exists() && fileFFPROBE.exists())
setFfmpegAvailable(true);
}
/*!
@ -289,94 +276,6 @@ void Util::Util::requestDataProtection()
});
}
/*!
\brief Downloads and extracts ffmpeg static version from https://ffmpeg.zeranoe.com
The progress is tracked via setAquireFFMPEGStatus(AquireFFMPEGStatus);
*/
void Util::downloadFFMPEG()
{
QNetworkRequest req;
QString ffmpegVersion { "ffmpeg-4.3.1" };
#ifdef Q_OS_WIN
req.setUrl(QUrl("https://ffmpeg.zeranoe.com/builds/win64/static/" + ffmpegVersion + "-win64-static.zip"));
#elif defined(Q_OS_OSX)
req.setUrl(QUrl("https://ffmpeg.zeranoe.com/builds/macos64/static/" + ffmpegVersion + "-macos64-static.zip"));
#endif
setAquireFFMPEGStatus(AquireFFMPEGStatus::Download);
QNetworkReply* reply = m_networkAccessManager->get(req);
QObject::connect(reply, &QNetworkReply::finished, this, [this, reply, ffmpegVersion]() {
using namespace libzippp;
using namespace std;
setAquireFFMPEGStatus(AquireFFMPEGStatus::DownloadSuccessful);
QByteArray download = reply->readAll();
auto* archive = ZipArchive::fromBuffer(download.data(), download.size(), ZipArchive::OpenMode::READ_ONLY, true);
if (archive == nullptr) {
setAquireFFMPEGStatus(AquireFFMPEGStatus::ExtractingFailedReadFromBuffer);
return;
}
string path = QApplication::instance()->applicationDirPath().toStdString() + "/";
ZipEntry entryFFMPEG;
std::string entryFFMPEGPath;
#ifdef Q_OS_WIN
entryFFMPEG = archive->getEntry(ffmpegVersion.toStdString() + "-win64-static/bin/ffmpeg.exe");
entryFFMPEGPath = path + "ffmpeg.exe";
#elif defined(Q_OS_OSX)
entryFFMPEG = archive->getEntry(ffmpegVersion.toStdString() +"-macos64-static/bin/ffmpeg");
entryFFMPEGPath = path + "ffmpeg";
#endif
if (entryFFMPEG.isNull()) {
qDebug() << "entryFFMPEG is null. No more entry is available.";
qDebug() << "Download size was: " << download.size() << "bytes";
setAquireFFMPEGStatus(AquireFFMPEGStatus::ExtractingFailedFFMPEG);
return;
}
if (!saveExtractedByteArray(entryFFMPEG, entryFFMPEGPath)) {
qDebug() << "could not save ffmpeg";
setAquireFFMPEGStatus(AquireFFMPEGStatus::ExtractingFailedFFMPEGSave);
return;
}
ZipEntry entryFFPROBE;
std::string entryFFPROBEPath;
#ifdef Q_OS_WIN
entryFFPROBE = archive->getEntry(ffmpegVersion.toStdString() + "-win64-static/bin/ffprobe.exe");
entryFFPROBEPath = path + "ffprobe.exe";
#elif defined(Q_OS_OSX)
entryFFPROBE = archive->getEntry(ffmpegVersion.toStdString() +"-macos64-static/bin/ffprobe");
entryFFPROBEPath = path + "ffprobe";
#endif
if (entryFFPROBE.isNull()) {
qDebug() << "null";
setAquireFFMPEGStatus(AquireFFMPEGStatus::ExtractingFailedFFPROBE);
return;
}
if (!saveExtractedByteArray(entryFFPROBE, entryFFPROBEPath)) {
qDebug() << "could not save ffprobe";
setAquireFFMPEGStatus(AquireFFMPEGStatus::ExtractingFailedFFPROBESave);
return;
}
setAquireFFMPEGStatus(AquireFFMPEGStatus::FinishedSuccessful);
});
QObject::connect(reply, QOverload<QNetworkReply::NetworkError>::of(&QNetworkReply::error),
[this](QNetworkReply::NetworkError code) {
this->setAquireFFMPEGStatus(AquireFFMPEGStatus::DownloadFailed);
});
}
SearchType::SearchType Util::getSearchTypeFromInstalledType(const InstalledType::InstalledType type)
{
using InstalledType::InstalledType;
@ -464,26 +363,4 @@ void Util::logToGui(QtMsgType type, const QMessageLogContext& context, const QSt
utilPointer->appendDebugMessages(log);
}
/*!
\brief Convenient function for the ffmpeg download extraction via libzippp. Extracts a given bytearray
to a given absolute file path and file name. Returns false if extraction or saving wasn't successful.
*/
bool Util::saveExtractedByteArray(libzippp::ZipEntry& entry, std::string& absolutePathAndName)
{
std::ofstream ofUnzippedFile(absolutePathAndName, std::ofstream::binary);
if (ofUnzippedFile) {
if (entry.readContent(ofUnzippedFile) != 0) {
qDebug() << "Error cannot read ffmpeg zip content";
return false;
}
} else {
qDebug() << "Coud not open ofstream" << QString::fromStdString(absolutePathAndName);
return false;
}
ofUnzippedFile.close();
return true;
}
}

View File

@ -58,7 +58,7 @@
#include <optional>
#include "globalvariables.h"
#include "libzippp.h"
namespace ScreenPlay {
@ -80,39 +80,11 @@ T QStringToEnum(const QString& key, const T defaultValue)
class Util : public QObject {
Q_OBJECT
Q_PROPERTY(bool ffmpegAvailable READ ffmpegAvailable NOTIFY ffmpegAvailableChanged)
Q_PROPERTY(AquireFFMPEGStatus aquireFFMPEGStatus READ aquireFFMPEGStatus NOTIFY aquireFFMPEGStatusChanged)
Q_PROPERTY(QString debugMessages READ debugMessages NOTIFY debugMessagesChanged)
public:
explicit Util(QNetworkAccessManager* networkAccessManager, QObject* parent = nullptr);
enum class AquireFFMPEGStatus {
Init,
Download,
DownloadFailed,
DownloadSuccessful,
Extracting,
ExtractingFailedReadFromBuffer,
ExtractingFailedFFMPEG,
ExtractingFailedFFMPEGSave,
ExtractingFailedFFPROBE,
ExtractingFailedFFPROBESave,
ExtractingSuccessful,
FinishedSuccessful,
};
Q_ENUM(AquireFFMPEGStatus)
bool ffmpegAvailable() const
{
return m_ffmpegAvailable;
}
AquireFFMPEGStatus aquireFFMPEGStatus() const
{
return m_aquireFFMPEGStatus;
}
QString debugMessages() const
{
return m_debugMessages;
@ -125,8 +97,6 @@ signals:
void setSidebarItem(QString folderName, ScreenPlay::InstalledType::InstalledType type);
void allLicenseLoaded(QString licensesText);
void allDataProtectionLoaded(QString dataProtectionText);
void ffmpegAvailableChanged(bool ffmpegAvailable);
void aquireFFMPEGStatusChanged(ScreenPlay::Util::AquireFFMPEGStatus aquireFFMPEGStatus);
void debugMessagesChanged(QString debugMessages);
public slots:
@ -136,8 +106,6 @@ public slots:
void requestAllLicenses();
void requestDataProtection();
void downloadFFMPEG();
static SearchType::SearchType getSearchTypeFromInstalledType(const InstalledType::InstalledType type);
static std::optional<InstalledType::InstalledType> getInstalledTypeFromString(const QString& type);
static std::optional<QJsonObject> parseQByteArrayToQJsonObject(const QByteArray& byteArray);
@ -166,24 +134,6 @@ public slots:
emit requestToggleWallpaperConfiguration();
}
void setFfmpegAvailable(bool ffmpegAvailable)
{
if (m_ffmpegAvailable == ffmpegAvailable)
return;
m_ffmpegAvailable = ffmpegAvailable;
emit ffmpegAvailableChanged(m_ffmpegAvailable);
}
void setAquireFFMPEGStatus(ScreenPlay::Util::AquireFFMPEGStatus aquireFFMPEGStatus)
{
if (m_aquireFFMPEGStatus == aquireFFMPEGStatus)
return;
m_aquireFFMPEGStatus = aquireFFMPEGStatus;
emit aquireFFMPEGStatusChanged(m_aquireFFMPEGStatus);
}
void appendDebugMessages(QString debugMessages)
{
if (m_debugMessages.size() > 10000) {
@ -194,14 +144,10 @@ public slots:
emit debugMessagesChanged(m_debugMessages);
}
private:
bool saveExtractedByteArray(libzippp::ZipEntry& entry, std::string& absolutePathAndName);
private:
QNetworkAccessManager* m_networkAccessManager { nullptr };
bool m_ffmpegAvailable { false };
AquireFFMPEGStatus m_aquireFFMPEGStatus { AquireFFMPEGStatus::Init };
QString m_debugMessages {};
};

View File

@ -11,7 +11,7 @@ chmod +x bootstrap-vcpkg.sh
chmod +x vcpkg
if [[ "$OSTYPE" == "darwin"* ]]; then
./vcpkg install zlib libzip libzippp openssl-unix libzip sentry-native --triplet x64-osx --recurse
./vcpkg install openssl-unix sentry-native --triplet x64-osx --recurse
else
./vcpkg install zlib libzip libzippp openssl-unix libzip sentry-native --triplet x64-linux --recurse
./vcpkg install openssl-unix sentry-native --triplet x64-linux --recurse
fi

View File

@ -7,4 +7,28 @@ git pull
rem master 10.09.2020 - 18ab4b72a26284f0df28295ce7bf9b21c96f20f4
git checkout 18ab4b72a26284f0df28295ce7bf9b21c96f20f4
call bootstrap-vcpkg.bat
vcpkg.exe install zlib libzip libzippp openssl sentry-native --triplet x64-windows --recurse
rem Install vcpkg dependencies
vcpkg.exe install openssl sentry-native --triplet x64-windows --recurse
cd ..
cd ..
rem Donwload ffmpeg
curl.exe -L https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-4.3.1-full_build.zip --output ffmpeg.zip
rem Extract ffmpeg. Needs Windows 10 build 17063 or higher!
rem We only need the content of the bin folder
rem --strip-components 2 removes folder
tar -xvf ffmpeg.zip --strip-components 2 ffmpeg-4.3.1-full_build/bin
rem Remove not used ffplay
DEL ffplay.exe
rem Move ffmpeg into folder
move /Y ffmpeg.exe Common/ffmpeg
move /Y ffprobe.exe Common/ffmpeg
DEL ffmpeg.zip
pause