From c8a87e1ef98a411a6f2a17bbf52cac628b64cdc0 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Thu, 10 Sep 2020 17:07:01 +0200 Subject: [PATCH 1/3] Fix sysinfo sdk not building shared bin --- ScreenPlaySysInfo/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 1b8e708836c1532be8dc559d10ffa15817ffea4a Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Fri, 11 Sep 2020 16:33:27 +0200 Subject: [PATCH 2/3] Replace qt-breakpad with sentry.io --- .gitmodules | 3 --- CMakeLists.txt | 6 +----- Common/qt-breakpad | 1 - ScreenPlay/CMakeLists.txt | 14 +++++++++++--- ScreenPlay/app.cpp | 25 ++++++++++++++++++------- ScreenPlay/app.h | 8 ++++---- ScreenPlay/main.cpp | 23 ++++++++++++++--------- ScreenPlayWallpaper/main.cpp | 1 - install_dependencies_linux_mac.sh | 4 ++-- install_dependencies_windows.bat | 2 +- 10 files changed, 51 insertions(+), 36 deletions(-) delete mode 160000 Common/qt-breakpad 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 c72ca814..cde78505 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,19 @@ 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) + +if(WIN32) + configure_file(${VCPKG_TOOLS_PATH}/sentry-native/crashpad_handler.exe ${CMAKE_BINARY_DIR}/bin/ COPYONLY) +else() + configure_file(${VCPKG_TOOLS_PATH}/sentry-native/crashpad_handler ${CMAKE_BINARY_DIR}/bin/ COPYONLY) +endif() 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/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 0b785c53..92314755 100644 --- a/install_dependencies_linux_mac.sh +++ b/install_dependencies_linux_mac.sh @@ -10,7 +10,7 @@ chmod +x bootstrap-vcpkg.sh chmod +x vcpkg if [[ "$OSTYPE" == "darwin"* ]]; then -./vcpkg install zlib libzip libzippp openssl-unix libzip breakpad --triplet x64-osx --recurse +./vcpkg install zlib libzip libzippp openssl-unix libzip sentry-native --triplet x64-osx --recurse else -./vcpkg install zlib libzip libzippp openssl-unix libzip breakpad --triplet x64-linux --recurse +./vcpkg install zlib libzip libzippp openssl-unix libzip 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 995c5f53..ef787580 100644 --- a/install_dependencies_windows.bat +++ b/install_dependencies_windows.bat @@ -6,4 +6,4 @@ cd vcpkg git pull git checkout 2bc6cd714 call bootstrap-vcpkg.bat -vcpkg.exe install zlib libzip libzippp openssl breakpad --triplet x64-windows --recurse +vcpkg.exe install zlib libzip libzippp openssl sentry-native --triplet x64-windows --recurse From d009540d8e29b014a6c26b1893a9d8aef1b447bb Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Fri, 11 Sep 2020 16:41:45 +0200 Subject: [PATCH 3/3] Fix vcpkg using old commit --- install_dependencies_linux_mac.sh | 3 ++- install_dependencies_windows.bat | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/install_dependencies_linux_mac.sh b/install_dependencies_linux_mac.sh index 92314755..ae88c038 100644 --- a/install_dependencies_linux_mac.sh +++ b/install_dependencies_linux_mac.sh @@ -4,7 +4,8 @@ cd Common git clone https://github.com/microsoft/vcpkg.git cd vcpkg git pull -git checkout 2bc6cd714 +# master 10.09.2020 - 18ab4b72a26284f0df28295ce7bf9b21c96f20f4 +git checkout 18ab4b72a26284f0df28295ce7bf9b21c96f20f4 chmod +x bootstrap-vcpkg.sh ./bootstrap-vcpkg.sh chmod +x vcpkg diff --git a/install_dependencies_windows.bat b/install_dependencies_windows.bat index ef787580..597844e3 100644 --- a/install_dependencies_windows.bat +++ b/install_dependencies_windows.bat @@ -4,6 +4,7 @@ cd Common git clone https://github.com/microsoft/vcpkg.git cd vcpkg git pull -git checkout 2bc6cd714 +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