diff --git a/.gitmodules b/.gitmodules index 433fa4bd..fb12120e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 diff --git a/CMakeLists.txt b/CMakeLists.txt index c9112c1f..3a80605c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) - - - diff --git a/Common/qt-breakpad b/Common/qt-breakpad deleted file mode 160000 index f5bf92fc..00000000 --- a/Common/qt-breakpad +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f5bf92fc2b349ca1c3c76a18a58fadfab5bb9f33 diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 0d04eab9..3e2691cc 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -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) diff --git a/ScreenPlay/app.cpp b/ScreenPlay/app.cpp index ababcf4f..0153e492 100644 --- a/ScreenPlay/app.cpp +++ b/ScreenPlay/app.cpp @@ -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(&m_networkAccessManager); m_globalVariables = make_shared(); - auto* nam = new QNetworkAccessManager(this); - m_util = make_unique(nam); m_installedListModel = make_shared(m_globalVariables); m_installedListFilter = make_shared(m_installedListModel); m_monitorListModel = make_shared(); @@ -151,10 +146,25 @@ void App::init() // Only create tracker if user did not disallow! if (m_settings->anonymousTelemetry()) { m_telemetry = make_shared("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(m_globalVariables); @@ -180,6 +190,7 @@ void App::init() qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this); loadSteamPlugin(); + m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/main.qml"))); } diff --git a/ScreenPlay/app.h b/ScreenPlay/app.h index 69642240..f84f9cea 100644 --- a/ScreenPlay/app.h +++ b/ScreenPlay/app.h @@ -49,10 +49,6 @@ #include -#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 + class ScreenPlayWorkshopPlugin; namespace ScreenPlay { @@ -253,6 +252,7 @@ private: private: QPluginLoader m_workshopPlugin; + QNetworkAccessManager m_networkAccessManager; std::unique_ptr m_mainWindowEngine; std::unique_ptr m_create; diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index 1c902073..b063124f 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -32,19 +32,21 @@ ** ****************************************************************************/ -#include - #include "app.h" +#include +#include +#include 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; } } diff --git a/ScreenPlay/src/sdkconnection.cpp b/ScreenPlay/src/sdkconnection.cpp index d320475f..21fd4f41 100644 --- a/ScreenPlay/src/sdkconnection.cpp +++ b/ScreenPlay/src/sdkconnection.cpp @@ -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() { diff --git a/ScreenPlay/src/sdkconnection.h b/ScreenPlay/src/sdkconnection.h index d966d9e7..804777b4 100644 --- a/ScreenPlay/src/sdkconnection.h +++ b/ScreenPlay/src/sdkconnection.h @@ -69,7 +69,6 @@ public: SDKConnection. */ explicit SDKConnection(QLocalSocket* socket, QObject* parent = nullptr); - ~SDKConnection(); QString appID() const { diff --git a/ScreenPlay/src/util.cpp b/ScreenPlay/src/util.cpp index 4fc1d602..d1858f55 100644 --- a/ScreenPlay/src/util.cpp +++ b/ScreenPlay/src/util.cpp @@ -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(); qmlRegisterUncreatableType("ScreenPlay.QMLUtilities", 1, 0, "QMLUtilities", "Error only for enums"); // In release mode redirect messages to logging otherwhise we break the nice clickable output :( diff --git a/ScreenPlaySysInfo/CMakeLists.txt b/ScreenPlaySysInfo/CMakeLists.txt index 6cf2c974..2b0b9194 100644 --- a/ScreenPlaySysInfo/CMakeLists.txt +++ b/ScreenPlaySysInfo/CMakeLists.txt @@ -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 diff --git a/ScreenPlayWallpaper/main.cpp b/ScreenPlayWallpaper/main.cpp index 3f279ea8..e92936c7 100644 --- a/ScreenPlayWallpaper/main.cpp +++ b/ScreenPlayWallpaper/main.cpp @@ -6,7 +6,6 @@ #include #if defined(Q_OS_WIN) - #include "src/winwindow.h" #endif diff --git a/install_dependencies_linux_mac.sh b/install_dependencies_linux_mac.sh index c893aa39..47f19c28 100644 --- a/install_dependencies_linux_mac.sh +++ b/install_dependencies_linux_mac.sh @@ -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 \ No newline at end of file diff --git a/install_dependencies_windows.bat b/install_dependencies_windows.bat index 4ebe9156..8d7c8b55 100644 --- a/install_dependencies_windows.bat +++ b/install_dependencies_windows.bat @@ -24,4 +24,4 @@ rm ffplay.exe rem Move ffmpeg into folder mv ffmpeg.exe Common/ffmpeg -mv ffprobe.exe Common/ffmpeg \ No newline at end of file +mv ffprobe.exe Common/ffmpeg