From 20138f19e21bb21bcfadcd05ebb8d1e49dccc088 Mon Sep 17 00:00:00 2001 From: Elias Steurer Date: Fri, 7 May 2021 09:11:40 +0200 Subject: [PATCH] Remove never really used benchmark and ganalytics --- .gitmodules | 3 --- Common/qt-google-analytics | 1 - ScreenPlay/CMakeLists.txt | 2 -- ScreenPlay/app.cpp | 24 +++---------------- ScreenPlay/app.h | 8 ------- ScreenPlay/main.cpp | 12 ---------- ScreenPlay/main.qml | 3 --- .../CreateWallpaperResult.qml | 1 - .../CreateWallpaperVideoImportConvert.qml | 1 - .../Wizards/ImportWebm/ImportWebmConvert.qml | 1 - ScreenPlay/qml/Navigation/Navigation.qml | 2 -- .../NavigationWallpaperConfiguration.qml | 2 -- ScreenPlay/src/screenplaymanager.cpp | 6 ----- ScreenPlay/src/screenplaymanager.h | 3 --- ScreenPlay/src/util.cpp | 20 ---------------- ScreenPlay/src/util.h | 1 - 16 files changed, 3 insertions(+), 87 deletions(-) delete mode 100644 .gitmodules delete mode 160000 Common/qt-google-analytics diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index fb12120e..00000000 --- a/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "Common/qt-google-analytics"] - path = Common/qt-google-analytics - url = https://github.com/HSAnet/qt-google-analytics.git diff --git a/Common/qt-google-analytics b/Common/qt-google-analytics deleted file mode 160000 index c1eda356..00000000 --- a/Common/qt-google-analytics +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c1eda35682b4b4c21a313eb8b4670527bf4a6f09 diff --git a/ScreenPlay/CMakeLists.txt b/ScreenPlay/CMakeLists.txt index 91a164f5..851079c0 100644 --- a/ScreenPlay/CMakeLists.txt +++ b/ScreenPlay/CMakeLists.txt @@ -26,7 +26,6 @@ endif() set(src main.cpp app.cpp - ../Common/qt-google-analytics/ganalytics.cpp src/globalvariables.cpp src/createimportvideo.cpp src/installedlistmodel.cpp @@ -45,7 +44,6 @@ set(src set(headers app.h - ../Common/qt-google-analytics/ganalytics.h src/globalvariables.h src/createimportvideo.h src/installedlistmodel.h diff --git a/ScreenPlay/app.cpp b/ScreenPlay/app.cpp index b648c9ea..6b87d2d3 100644 --- a/ScreenPlay/app.cpp +++ b/ScreenPlay/app.cpp @@ -128,7 +128,6 @@ App::App() // ScreenPlayManager first to check if another ScreenPlay Instace is running m_screenPlayManager = std::make_unique(); m_isAnotherScreenPlayInstanceRunning = m_screenPlayManager->isAnotherScreenPlayInstanceRunning(); - Util::appendToMetricsFile("screenplay_app_constructor", m_continuousIntegrationMetricsTimer.msecsSinceReference()); } /*! @@ -140,8 +139,6 @@ App::App() void App::init() { - Util::appendToMetricsFile("screenplay_app_init", m_continuousIntegrationMetricsTimer.msecsSinceReference()); - using std::make_shared, std::make_unique; // Util should be created as first so we redirect qDebugs etc. into the log @@ -154,13 +151,8 @@ void App::init() m_settings = make_shared(m_globalVariables); m_mainWindowEngine = make_unique(); - // Only create tracker if user did not disallow! + // Only create anonymousTelemetry if user did not disallow! if (m_settings->anonymousTelemetry()) { - m_telemetry = make_shared("UA-152830367-3"); - m_telemetry->setNetworkAccessManager(&m_networkAccessManager); - m_telemetry->setSendInterval(1000); - m_telemetry->startSession(); - m_telemetry->sendEvent("version", QApplication::applicationVersion()); #ifdef Q_OS_WIN sentry_options_t* options = sentry_options_new(); @@ -199,12 +191,10 @@ void App::init() } qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this); - Util::appendToMetricsFile("Screenplay_app_qqmlapplicationengine_load_begin", m_continuousIntegrationMetricsTimer.msecsSinceReference()); m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/main.qml"))); - Util::appendToMetricsFile("Screenplay_app_qqmlapplicationengine_load_end", m_continuousIntegrationMetricsTimer.msecsSinceReference()); // Must be called last to display a error message on startup by the qml engine - m_screenPlayManager->init(m_globalVariables, m_monitorListModel, m_telemetry, m_settings); + m_screenPlayManager->init(m_globalVariables, m_monitorListModel, m_settings); QObject::connect(m_monitorListModel.get(), &MonitorListModel::monitorConfigurationChanged, m_screenPlayManager.get(), &ScreenPlayManager::removeAllWallpapers); } @@ -218,15 +208,7 @@ QString App::version() const */ void App::exit() { - if (!m_telemetry) { - QApplication::instance()->quit(); - return; - } else { - // Workaround because we cannot force to send exit event - m_telemetry->setSendInterval(5); - m_telemetry->endSession(); - QTimer::singleShot(150, this, []() { QApplication::instance()->quit(); }); - } + QApplication::instance()->quit(); } /*! diff --git a/ScreenPlay/app.h b/ScreenPlay/app.h index 33ce1e40..c5ae44a7 100644 --- a/ScreenPlay/app.h +++ b/ScreenPlay/app.h @@ -48,7 +48,6 @@ #include #include -#include "ganalytics.h" #include "src/create.h" #include "src/globalvariables.h" #include "src/installedlistfilter.h" @@ -122,12 +121,6 @@ public slots: void exit(); bool loadSteamPlugin(); bool unloadSteamPlugin(); - void setTrackerSendEvent(const QString& category, const QString& page) - { - if (m_telemetry) { - m_telemetry->sendEvent(category, page); - } - } void setGlobalVariables(GlobalVariables* globalVariables) { @@ -237,7 +230,6 @@ private: std::unique_ptr m_screenPlayManager; std::unique_ptr m_util; - std::shared_ptr m_telemetry; std::shared_ptr m_globalVariables; std::shared_ptr m_settings; diff --git a/ScreenPlay/main.cpp b/ScreenPlay/main.cpp index ba4163b2..2808d062 100644 --- a/ScreenPlay/main.cpp +++ b/ScreenPlay/main.cpp @@ -51,18 +51,6 @@ int main(int argc, char* argv[]) QApplication qtGuiApp(argc, argv); - // Benchmarks - if (QGuiApplication::arguments().contains("--benchmark")) { - QFile metricsFile { QGuiApplication::applicationDirPath() + "/metrics.txt" }; - if (metricsFile.exists()) - qInfo() << "Removing old Continuous Integration Metrics Timer: " << metricsFile.remove(); - - QTimer::singleShot(10000, []() { - qInfo() << "Exit ScreenPlay benchmark mode!"; - QGuiApplication::quit(); - }); - } - // Unit tests doctest::Context context; context.setOption("abort-after", 5); // stop test execution after 5 failed assertions diff --git a/ScreenPlay/main.qml b/ScreenPlay/main.qml index 39a41a11..c2e3cdf4 100644 --- a/ScreenPlay/main.qml +++ b/ScreenPlay/main.qml @@ -43,9 +43,6 @@ ApplicationWindow { if (!ScreenPlay.settings.silentStart) { window.show() - ScreenPlay.setTrackerSendEvent("navigation", "Installed") - } else { - ScreenPlay.setTrackerSendEvent("navigation", "Silent") } } diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml index 06621006..9f1e2a37 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperResult.qml @@ -95,7 +95,6 @@ Item { margins: 10 } onClicked: { - ScreenPlay.setTrackerSendEvent("createWallpaperError",txtFFMPEGDebug.text); ScreenPlay.util.setNavigationActive(true) ScreenPlay.util.setNavigation("Create") } diff --git a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml index bd568e25..41d4b017 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportVideoAndConvert/CreateWallpaperVideoImportConvert.qml @@ -89,7 +89,6 @@ Item { busyIndicator.running = false root.checkCanSave() - ScreenPlay.setTrackerSendEvent("createWallpaperSuccessful", "") break } } diff --git a/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmConvert.qml b/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmConvert.qml index 06c8ebb3..89560d2a 100644 --- a/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmConvert.qml +++ b/ScreenPlay/qml/Create/Wizards/ImportWebm/ImportWebmConvert.qml @@ -88,7 +88,6 @@ Item { busyIndicator.running = false root.checkCanSave() - ScreenPlay.setTrackerSendEvent("createWallpaperSuccessful", "") break } } diff --git a/ScreenPlay/qml/Navigation/Navigation.qml b/ScreenPlay/qml/Navigation/Navigation.qml index 2ba3f686..c6db95dc 100644 --- a/ScreenPlay/qml/Navigation/Navigation.qml +++ b/ScreenPlay/qml/Navigation/Navigation.qml @@ -61,8 +61,6 @@ Rectangle { function onPageChanged(name) { - ScreenPlay.setTrackerSendEvent("navigation", name) - if (!navActive) return diff --git a/ScreenPlay/qml/Navigation/NavigationWallpaperConfiguration.qml b/ScreenPlay/qml/Navigation/NavigationWallpaperConfiguration.qml index ba7ad385..832f2912 100644 --- a/ScreenPlay/qml/Navigation/NavigationWallpaperConfiguration.qml +++ b/ScreenPlay/qml/Navigation/NavigationWallpaperConfiguration.qml @@ -27,8 +27,6 @@ Item { target: ScreenPlay.screenPlayManager function onActiveWallpaperCounterChanged() { rippleEffect.trigger() - ScreenPlay.setTrackerSendEvent("navigation", - "wallpaperConfiguration") } } diff --git a/ScreenPlay/src/screenplaymanager.cpp b/ScreenPlay/src/screenplaymanager.cpp index aa810a92..841b4a44 100644 --- a/ScreenPlay/src/screenplaymanager.cpp +++ b/ScreenPlay/src/screenplaymanager.cpp @@ -75,12 +75,10 @@ bool ScreenPlayManager::checkIsAnotherScreenPlayInstanceRunning() void ScreenPlayManager::init( const std::shared_ptr& globalVariables, const std::shared_ptr& mlm, - const std::shared_ptr& telemetry, const std::shared_ptr& settings) { m_globalVariables = globalVariables; m_monitorListModel = mlm; - m_telemetry = telemetry; m_settings = settings; if (m_settings->desktopEnvironment() == Settings::DesktopEnvironment::KDE) { @@ -120,10 +118,6 @@ bool ScreenPlayManager::createWallpaper( } }); - if (m_telemetry) { - m_telemetry->sendEvent("wallpaper", "start"); - } - QJsonArray monitors; for (const int index : monitorIndex) { monitors.append(index); diff --git a/ScreenPlay/src/screenplaymanager.h b/ScreenPlay/src/screenplaymanager.h index 4550d10b..6e76e86b 100644 --- a/ScreenPlay/src/screenplaymanager.h +++ b/ScreenPlay/src/screenplaymanager.h @@ -41,7 +41,6 @@ #include #include "ScreenPlayUtil/projectfile.h" -#include "ganalytics.h" #include "globalvariables.h" #include "installedlistmodel.h" #include "monitorlistmodel.h" @@ -69,7 +68,6 @@ public: void init( const std::shared_ptr& globalVariables, const std::shared_ptr& mlm, - const std::shared_ptr& telemetry, const std::shared_ptr& settings); int activeWallpaperCounter() const { return m_activeWallpaperCounter; } @@ -181,7 +179,6 @@ private: private: std::shared_ptr m_globalVariables; std::shared_ptr m_monitorListModel; - std::shared_ptr m_telemetry; std::shared_ptr m_settings; std::unique_ptr m_server; std::unique_ptr m_websocketServer; diff --git a/ScreenPlay/src/util.cpp b/ScreenPlay/src/util.cpp index fb0598bb..c8f23dfc 100644 --- a/ScreenPlay/src/util.cpp +++ b/ScreenPlay/src/util.cpp @@ -70,26 +70,6 @@ bool Util::writeJsonObjectToFile(const QString& absoluteFilePath, const QJsonObj return true; } -void Util::appendToMetricsFile(const QString& key, const QVariant& value) -{ - if (!QGuiApplication::arguments().contains("--benchmark")) - return; - - const QString appDir = QGuiApplication::applicationDirPath(); - QFile metricsFile { appDir + "/metrics.txt" }; - - if (!metricsFile.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Append)) { - qWarning() << "Cannot open metrix file:" << appDir << metricsFile.fileName(); - return; - } - - QString text = key + "\t" + value.toString() + "\n"; - QTextStream out(&metricsFile); - out << text; - - metricsFile.flush(); - metricsFile.close(); -} /*! \brief Opens a native folder window on the given path. Windows and Mac only for now! diff --git a/ScreenPlay/src/util.h b/ScreenPlay/src/util.h index 3fd4380d..a53b2d97 100644 --- a/ScreenPlay/src/util.h +++ b/ScreenPlay/src/util.h @@ -105,7 +105,6 @@ public slots: void requestAllLicenses(); void requestDataProtection(); - static void appendToMetricsFile(const QString& key, const QVariant& value); static void logToGui(QtMsgType type, const QMessageLogContext& context, const QString& msg); static bool writeJsonObjectToFile(const QString& absoluteFilePath, const QJsonObject& object, bool truncate = true); static bool writeSettings(const QJsonObject& obj, const QString& absolutePath);