diff --git a/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml b/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml index 9cbf1e542ff..005c367cd9e 100644 --- a/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml +++ b/src/plugins/studiowelcome/qml/splashscreen/Welcome_splash.qml @@ -6,6 +6,7 @@ import QtQuick.Layouts 1.15 import StudioFonts 1.0 import projectmodel 1.0 import usagestatistics 1.0 +import studiousagestatistics 1.0 import QtQuick.Shapes 1.0 Rectangle { @@ -159,6 +160,10 @@ Rectangle { UsageStatisticModel { id: usageStatisticModel } + + StudioUsageStatisticModel { + id: studioUsageStatisticModel + } } //DOF seems to do nothing, we should probably just remove it. @@ -202,6 +207,7 @@ Rectangle { text: qsTr("Turn Off") fontpixelSize: 14 onClicked: { + studioUsageStatisticModel.setInsightEnabled(false) usageStatisticModel.setTelemetryEnabled(false) usageStatisticModel.setCrashReporterEnabled(false) welcome_splash.closeClicked() @@ -213,6 +219,7 @@ Rectangle { forceHover: false fontpixelSize: 14 onClicked: { + studioUsageStatisticModel.setInsightEnabled(true) usageStatisticModel.setTelemetryEnabled(true) usageStatisticModel.setCrashReporterEnabled(true) welcome_splash.closeClicked() diff --git a/src/plugins/studiowelcome/studiowelcomeplugin.cpp b/src/plugins/studiowelcome/studiowelcomeplugin.cpp index 9b87d44c937..0094dace5d2 100644 --- a/src/plugins/studiowelcome/studiowelcomeplugin.cpp +++ b/src/plugins/studiowelcome/studiowelcomeplugin.cpp @@ -70,6 +70,7 @@ using namespace ProjectExplorer; using namespace Utils; +using namespace Core; namespace StudioWelcome { namespace Internal { @@ -202,6 +203,22 @@ private: QString m_versionString; }; +class StudioUsageStatisticPluginModel : public QObject +{ + Q_OBJECT +public: + explicit StudioUsageStatisticPluginModel(QObject *parent = nullptr) + : QObject(parent) + { + } + + Q_INVOKABLE void setInsightEnabled(bool b) + { + Core::ICore::settings()->setValue("InsightTracking", b); + Core::ICore::askForRestart(tr("The change will take effect after restart.")); + } +}; + class ProjectModel : public QAbstractListModel { Q_OBJECT @@ -577,6 +594,7 @@ void StudioWelcomePlugin::initialize() { qmlRegisterType("projectmodel", 1, 0, "ProjectModel"); qmlRegisterType("usagestatistics", 1, 0, "UsageStatisticModel"); + qmlRegisterType("studiousagestatistics", 1, 0, "StudioUsageStatisticModel"); m_welcomeMode = new WelcomeMode; }