1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00

Remove never really used benchmark and ganalytics

This commit is contained in:
Elias Steurer 2021-05-07 09:11:40 +02:00
parent 0beba991ed
commit 20138f19e2
16 changed files with 3 additions and 87 deletions

3
.gitmodules vendored
View File

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

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

View File

@ -26,7 +26,6 @@ endif()
set(src set(src
main.cpp main.cpp
app.cpp app.cpp
../Common/qt-google-analytics/ganalytics.cpp
src/globalvariables.cpp src/globalvariables.cpp
src/createimportvideo.cpp src/createimportvideo.cpp
src/installedlistmodel.cpp src/installedlistmodel.cpp
@ -45,7 +44,6 @@ set(src
set(headers set(headers
app.h app.h
../Common/qt-google-analytics/ganalytics.h
src/globalvariables.h src/globalvariables.h
src/createimportvideo.h src/createimportvideo.h
src/installedlistmodel.h src/installedlistmodel.h

View File

@ -128,7 +128,6 @@ App::App()
// ScreenPlayManager first to check if another ScreenPlay Instace is running // ScreenPlayManager first to check if another ScreenPlay Instace is running
m_screenPlayManager = std::make_unique<ScreenPlayManager>(); m_screenPlayManager = std::make_unique<ScreenPlayManager>();
m_isAnotherScreenPlayInstanceRunning = m_screenPlayManager->isAnotherScreenPlayInstanceRunning(); m_isAnotherScreenPlayInstanceRunning = m_screenPlayManager->isAnotherScreenPlayInstanceRunning();
Util::appendToMetricsFile("screenplay_app_constructor", m_continuousIntegrationMetricsTimer.msecsSinceReference());
} }
/*! /*!
@ -140,8 +139,6 @@ App::App()
void App::init() void App::init()
{ {
Util::appendToMetricsFile("screenplay_app_init", m_continuousIntegrationMetricsTimer.msecsSinceReference());
using std::make_shared, std::make_unique; using std::make_shared, std::make_unique;
// Util should be created as first so we redirect qDebugs etc. into the log // 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<Settings>(m_globalVariables); m_settings = make_shared<Settings>(m_globalVariables);
m_mainWindowEngine = make_unique<QQmlApplicationEngine>(); m_mainWindowEngine = make_unique<QQmlApplicationEngine>();
// Only create tracker if user did not disallow! // Only create anonymousTelemetry if user did not disallow!
if (m_settings->anonymousTelemetry()) { if (m_settings->anonymousTelemetry()) {
m_telemetry = make_shared<GAnalytics>("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 #ifdef Q_OS_WIN
sentry_options_t* options = sentry_options_new(); sentry_options_t* options = sentry_options_new();
@ -199,12 +191,10 @@ void App::init()
} }
qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this); qmlRegisterSingletonInstance("ScreenPlay", 1, 0, "ScreenPlay", this);
Util::appendToMetricsFile("Screenplay_app_qqmlapplicationengine_load_begin", m_continuousIntegrationMetricsTimer.msecsSinceReference());
m_mainWindowEngine->load(QUrl(QStringLiteral("qrc:/main.qml"))); 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 // 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); QObject::connect(m_monitorListModel.get(), &MonitorListModel::monitorConfigurationChanged, m_screenPlayManager.get(), &ScreenPlayManager::removeAllWallpapers);
} }
@ -218,15 +208,7 @@ QString App::version() const
*/ */
void App::exit() void App::exit()
{ {
if (!m_telemetry) { QApplication::instance()->quit();
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(); });
}
} }
/*! /*!

View File

@ -48,7 +48,6 @@
#include <QtQml> #include <QtQml>
#include <QtWebEngine> #include <QtWebEngine>
#include "ganalytics.h"
#include "src/create.h" #include "src/create.h"
#include "src/globalvariables.h" #include "src/globalvariables.h"
#include "src/installedlistfilter.h" #include "src/installedlistfilter.h"
@ -122,12 +121,6 @@ public slots:
void exit(); void exit();
bool loadSteamPlugin(); bool loadSteamPlugin();
bool unloadSteamPlugin(); bool unloadSteamPlugin();
void setTrackerSendEvent(const QString& category, const QString& page)
{
if (m_telemetry) {
m_telemetry->sendEvent(category, page);
}
}
void setGlobalVariables(GlobalVariables* globalVariables) void setGlobalVariables(GlobalVariables* globalVariables)
{ {
@ -237,7 +230,6 @@ private:
std::unique_ptr<ScreenPlayManager> m_screenPlayManager; std::unique_ptr<ScreenPlayManager> m_screenPlayManager;
std::unique_ptr<Util> m_util; std::unique_ptr<Util> m_util;
std::shared_ptr<GAnalytics> m_telemetry;
std::shared_ptr<GlobalVariables> m_globalVariables; std::shared_ptr<GlobalVariables> m_globalVariables;
std::shared_ptr<Settings> m_settings; std::shared_ptr<Settings> m_settings;

View File

@ -51,18 +51,6 @@ int main(int argc, char* argv[])
QApplication qtGuiApp(argc, 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 // Unit tests
doctest::Context context; doctest::Context context;
context.setOption("abort-after", 5); // stop test execution after 5 failed assertions context.setOption("abort-after", 5); // stop test execution after 5 failed assertions

View File

@ -43,9 +43,6 @@ ApplicationWindow {
if (!ScreenPlay.settings.silentStart) { if (!ScreenPlay.settings.silentStart) {
window.show() window.show()
ScreenPlay.setTrackerSendEvent("navigation", "Installed")
} else {
ScreenPlay.setTrackerSendEvent("navigation", "Silent")
} }
} }

View File

@ -95,7 +95,6 @@ Item {
margins: 10 margins: 10
} }
onClicked: { onClicked: {
ScreenPlay.setTrackerSendEvent("createWallpaperError",txtFFMPEGDebug.text);
ScreenPlay.util.setNavigationActive(true) ScreenPlay.util.setNavigationActive(true)
ScreenPlay.util.setNavigation("Create") ScreenPlay.util.setNavigation("Create")
} }

View File

@ -89,7 +89,6 @@ Item {
busyIndicator.running = false busyIndicator.running = false
root.checkCanSave() root.checkCanSave()
ScreenPlay.setTrackerSendEvent("createWallpaperSuccessful", "")
break break
} }
} }

View File

@ -88,7 +88,6 @@ Item {
busyIndicator.running = false busyIndicator.running = false
root.checkCanSave() root.checkCanSave()
ScreenPlay.setTrackerSendEvent("createWallpaperSuccessful", "")
break break
} }
} }

View File

@ -61,8 +61,6 @@ Rectangle {
function onPageChanged(name) { function onPageChanged(name) {
ScreenPlay.setTrackerSendEvent("navigation", name)
if (!navActive) if (!navActive)
return return

View File

@ -27,8 +27,6 @@ Item {
target: ScreenPlay.screenPlayManager target: ScreenPlay.screenPlayManager
function onActiveWallpaperCounterChanged() { function onActiveWallpaperCounterChanged() {
rippleEffect.trigger() rippleEffect.trigger()
ScreenPlay.setTrackerSendEvent("navigation",
"wallpaperConfiguration")
} }
} }

View File

@ -75,12 +75,10 @@ bool ScreenPlayManager::checkIsAnotherScreenPlayInstanceRunning()
void ScreenPlayManager::init( void ScreenPlayManager::init(
const std::shared_ptr<GlobalVariables>& globalVariables, const std::shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<MonitorListModel>& mlm, const std::shared_ptr<MonitorListModel>& mlm,
const std::shared_ptr<GAnalytics>& telemetry,
const std::shared_ptr<Settings>& settings) const std::shared_ptr<Settings>& settings)
{ {
m_globalVariables = globalVariables; m_globalVariables = globalVariables;
m_monitorListModel = mlm; m_monitorListModel = mlm;
m_telemetry = telemetry;
m_settings = settings; m_settings = settings;
if (m_settings->desktopEnvironment() == Settings::DesktopEnvironment::KDE) { if (m_settings->desktopEnvironment() == Settings::DesktopEnvironment::KDE) {
@ -120,10 +118,6 @@ bool ScreenPlayManager::createWallpaper(
} }
}); });
if (m_telemetry) {
m_telemetry->sendEvent("wallpaper", "start");
}
QJsonArray monitors; QJsonArray monitors;
for (const int index : monitorIndex) { for (const int index : monitorIndex) {
monitors.append(index); monitors.append(index);

View File

@ -41,7 +41,6 @@
#include <QtWebSockets/QWebSocket> #include <QtWebSockets/QWebSocket>
#include "ScreenPlayUtil/projectfile.h" #include "ScreenPlayUtil/projectfile.h"
#include "ganalytics.h"
#include "globalvariables.h" #include "globalvariables.h"
#include "installedlistmodel.h" #include "installedlistmodel.h"
#include "monitorlistmodel.h" #include "monitorlistmodel.h"
@ -69,7 +68,6 @@ public:
void init( void init(
const std::shared_ptr<GlobalVariables>& globalVariables, const std::shared_ptr<GlobalVariables>& globalVariables,
const std::shared_ptr<MonitorListModel>& mlm, const std::shared_ptr<MonitorListModel>& mlm,
const std::shared_ptr<GAnalytics>& telemetry,
const std::shared_ptr<Settings>& settings); const std::shared_ptr<Settings>& settings);
int activeWallpaperCounter() const { return m_activeWallpaperCounter; } int activeWallpaperCounter() const { return m_activeWallpaperCounter; }
@ -181,7 +179,6 @@ private:
private: private:
std::shared_ptr<GlobalVariables> m_globalVariables; std::shared_ptr<GlobalVariables> m_globalVariables;
std::shared_ptr<MonitorListModel> m_monitorListModel; std::shared_ptr<MonitorListModel> m_monitorListModel;
std::shared_ptr<GAnalytics> m_telemetry;
std::shared_ptr<Settings> m_settings; std::shared_ptr<Settings> m_settings;
std::unique_ptr<QLocalServer> m_server; std::unique_ptr<QLocalServer> m_server;
std::unique_ptr<QWebSocketServer> m_websocketServer; std::unique_ptr<QWebSocketServer> m_websocketServer;

View File

@ -70,26 +70,6 @@ bool Util::writeJsonObjectToFile(const QString& absoluteFilePath, const QJsonObj
return true; 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! \brief Opens a native folder window on the given path. Windows and Mac only for now!

View File

@ -105,7 +105,6 @@ public slots:
void requestAllLicenses(); void requestAllLicenses();
void requestDataProtection(); void requestDataProtection();
static void appendToMetricsFile(const QString& key, const QVariant& value);
static void logToGui(QtMsgType type, const QMessageLogContext& context, const QString& msg); 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 writeJsonObjectToFile(const QString& absoluteFilePath, const QJsonObject& object, bool truncate = true);
static bool writeSettings(const QJsonObject& obj, const QString& absolutePath); static bool writeSettings(const QJsonObject& obj, const QString& absolutePath);