1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-09-15 06:52:34 +02:00

Merge branch 'master' into 106-remove-ffmpeg-download

# Conflicts:
#	ScreenPlay/CMakeLists.txt
#	ScreenPlay/src/util.cpp
#	install_dependencies_linux_mac.sh
#	install_dependencies_windows.bat
This commit is contained in:
Elias Steurer 2020-09-18 16:17:59 +02:00
commit c6ac701875
14 changed files with 50 additions and 49 deletions

3
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "Common/qt-google-analytics"]
path = Common/qt-google-analytics
url = https://github.com/HSAnet/qt-google-analytics.git
[submodule "Common/qt-breakpad"]
path = Common/qt-breakpad
url = https://github.com/kelteseth/qt-breakpad

View File

@ -16,8 +16,8 @@ elseif(APPLE)
endif()
set(VCPKG_INCLUDE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Common/vcpkg/installed/${VCPKG_ARCH}/include/)
set(VCPKG_TOOLS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/Common/vcpkg/installed/${VCPKG_ARCH}/tools/)
set(QT_TELEMTRY_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Common/qt-google-analytics/)
set(QT_BREAKPAD_INCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/Common/qt-breakpad/)
find_package(Git REQUIRED)
@ -54,7 +54,3 @@ add_subdirectory(ScreenPlaySDK)
add_subdirectory(ScreenPlayWallpaper)
add_subdirectory(ScreenPlayWidget)
add_subdirectory(ScreenPlaySysInfo)
add_subdirectory(Common/qt-breakpad)

@ -1 +0,0 @@
Subproject commit f5bf92fc2b349ca1c3c76a18a58fadfab5bb9f33

View File

@ -21,6 +21,8 @@ find_package(
find_package(ZLIB REQUIRED)
find_package(OpenSSL REQUIRED)
find_package(libzippp CONFIG REQUIRED)
find_package(sentry CONFIG REQUIRED)
set(src main.cpp
@ -102,13 +104,13 @@ target_link_libraries(${PROJECT_NAME}
Qt5::Core
Qt5::WebEngine
libzippp::libzippp
sentry::sentry
ScreenPlaySDK
QTBreakpadplugin)
)
target_include_directories(${PROJECT_NAME}
PRIVATE
${QT_TELEMTRY_INCLUDE}
${QT_BREAKPAD_INCLUDE})
${QT_TELEMTRY_INCLUDE})
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin/assets/fonts)
configure_file(assets/fonts/NotoSansCJKkr-Regular.otf ${CMAKE_BINARY_DIR}/bin/assets/fonts COPYONLY)

View File

@ -50,10 +50,6 @@ App::App()
QGuiApplication::setApplicationVersion("0.12.0");
QGuiApplication::setQuitOnLastWindowClosed(false);
#ifdef Q_OS_WINDOWS
QtBreakpad::init(QDir::current().absolutePath());
#endif
QFontDatabase::addApplicationFont(":/assets/fonts/LibreBaskerville-Italic.ttf");
QFontDatabase::addApplicationFont(":/assets/fonts/Roboto-Light.ttf");
@ -137,9 +133,8 @@ void App::init()
using std::make_shared, std::make_unique;
// Util should be created as first so we redirect qDebugs etc. into the log
m_util = std::make_unique<Util>(&m_networkAccessManager);
m_globalVariables = make_shared<GlobalVariables>();
auto* nam = new QNetworkAccessManager(this);
m_util = make_unique<Util>(nam);
m_installedListModel = make_shared<InstalledListModel>(m_globalVariables);
m_installedListFilter = make_shared<InstalledListFilter>(m_installedListModel);
m_monitorListModel = make_shared<MonitorListModel>();
@ -151,10 +146,25 @@ void App::init()
// Only create tracker if user did not disallow!
if (m_settings->anonymousTelemetry()) {
m_telemetry = make_shared<GAnalytics>("UA-152830367-3");
m_telemetry->setNetworkAccessManager(nam);
m_telemetry->setNetworkAccessManager(&m_networkAccessManager);
m_telemetry->setSendInterval(1000);
m_telemetry->startSession();
m_telemetry->sendEvent("version", QApplication::applicationVersion());
sentry_options_t* options = sentry_options_new();
sentry_options_set_dsn(options, "https://425ea0b77def4f91a5a9decc01b36ff4@o428218.ingest.sentry.io/5373419");
QString executableSuffix;
#ifdef Q_OS_WIN
executableSuffix = ".exe";
#endif
const QString appPath = QGuiApplication::applicationDirPath();
sentry_options_set_handler_path(options, QString(appPath + "/crashpad_handler" + executableSuffix).toStdString().c_str());
sentry_options_set_database_path(options, appPath.toStdString().c_str());
const int sentryInitStatus = sentry_init(options);
if (sentryInitStatus != 0) {
qWarning() << "Unable to inti sentry crashhandler with statuscode: " << sentryInitStatus;
}
}
m_create = make_unique<Create>(m_globalVariables);
@ -180,6 +190,7 @@ void App::init()
qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this);
loadSteamPlugin();
m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/main.qml")));
}

View File

@ -49,10 +49,6 @@
#include <memory>
#include "ganalytics.h"
#ifdef Q_OS_WINDOWS
#include "qt_breakpad.h"
#endif
#include "src/create.h"
#include "src/globalvariables.h"
#include "src/installedlistfilter.h"
@ -63,6 +59,9 @@
#include "src/settings.h"
#include "src/util.h"
#include "ganalytics.h"
#include <sentry.h>
class ScreenPlayWorkshopPlugin;
namespace ScreenPlay {
@ -253,6 +252,7 @@ private:
private:
QPluginLoader m_workshopPlugin;
QNetworkAccessManager m_networkAccessManager;
std::unique_ptr<QQmlApplicationEngine> m_mainWindowEngine;
std::unique_ptr<Create> m_create;

View File

@ -32,19 +32,21 @@
**
****************************************************************************/
#include <QApplication>
#include "app.h"
#include <QApplication>
#include <QDebug>
#include <sentry.h>
int main(int argc, char* argv[])
{
// Buggy with every Qt version except 5.14.0!
// Displays wrong DPI scaled monitor resolution
// 4k with 150% scaling to FULL HD on Windows
// https://bugreports.qt.io/browse/QTBUG-81694
#if defined(Q_OS_LINUX) || defined(Q_OS_OSX)
// Buggy with every Qt version except 5.14.0!
// Displays wrong DPI scaled monitor resolution
// 4k with 150% scaling to FULL HD on Windows
// https://bugreports.qt.io/browse/QTBUG-81694
#if defined(Q_OS_LINUX) || defined(Q_OS_OSX)
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
#endif
QApplication::setAttribute(Qt::AA_ShareOpenGLContexts);
QApplication qtGuiApp(argc, argv);
@ -54,7 +56,10 @@ int main(int argc, char* argv[])
if (app.m_isAnotherScreenPlayInstanceRunning) {
return 0;
} else {
app.init();
return qtGuiApp.exec();
const int status = qtGuiApp.exec();
sentry_shutdown();
return status;
}
}

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,6 +16,10 @@ Util::Util(QNetworkAccessManager* networkAccessManager, QObject* parent)
, m_networkAccessManager { networkAccessManager }
{
utilPointer = this;
// Fix log access vilation on quit
QObject::connect(QGuiApplication::instance(), &QGuiApplication::aboutToQuit, this, []() { utilPointer = nullptr; });
qRegisterMetaType<Util::AquireFFMPEGStatus>();
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 :(

View File

@ -24,7 +24,7 @@ set(headers screenplaysysinfo_plugin.h
mathhelper.h
storage.h)
add_library(${PROJECT_NAME} ${src} ${headers})
add_library(${PROJECT_NAME} SHARED ${src} ${headers})
target_link_libraries(${PROJECT_NAME}
PRIVATE

View File

@ -6,7 +6,6 @@
#include <QtWebEngine>
#if defined(Q_OS_WIN)
#include "src/winwindow.h"
#endif

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 breakpad ffmpeg[x264,vpx,mp3lame,opus] --triplet x64-osx --recurse
./vcpkg install openssl-unix sentry-native --triplet x64-osx --recurse
else
./vcpkg install zlib libzip libzippp openssl-unix libzip breakpad ffmpeg[x264,vpx,mp3lame,opus] --triplet x64-linux --recurse
./vcpkg install openssl-unix sentry-native --triplet x64-linux --recurse
fi

View File

@ -24,4 +24,4 @@ rm ffplay.exe
rem Move ffmpeg into folder
mv ffmpeg.exe Common/ffmpeg
mv ffprobe.exe Common/ffmpeg
mv ffprobe.exe Common/ffmpeg