QmlDesigner: Change splash screen for Insight

Fixes: QDS-13225
Change-Id: Ia636b03c96c9d295990f9f9e2c4e0aca852835c4
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Shrief Gabr
2024-07-18 14:30:59 +03:00
parent e1154a5eaf
commit 231cbdb254
2 changed files with 25 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import QtQuick.Layouts 1.15
import StudioFonts 1.0 import StudioFonts 1.0
import projectmodel 1.0 import projectmodel 1.0
import usagestatistics 1.0 import usagestatistics 1.0
import studiousagestatistics 1.0
import QtQuick.Shapes 1.0 import QtQuick.Shapes 1.0
Rectangle { Rectangle {
@@ -159,6 +160,10 @@ Rectangle {
UsageStatisticModel { UsageStatisticModel {
id: usageStatisticModel id: usageStatisticModel
} }
StudioUsageStatisticModel {
id: studioUsageStatisticModel
}
} }
//DOF seems to do nothing, we should probably just remove it. //DOF seems to do nothing, we should probably just remove it.
@@ -202,6 +207,7 @@ Rectangle {
text: qsTr("Turn Off") text: qsTr("Turn Off")
fontpixelSize: 14 fontpixelSize: 14
onClicked: { onClicked: {
studioUsageStatisticModel.setInsightEnabled(false)
usageStatisticModel.setTelemetryEnabled(false) usageStatisticModel.setTelemetryEnabled(false)
usageStatisticModel.setCrashReporterEnabled(false) usageStatisticModel.setCrashReporterEnabled(false)
welcome_splash.closeClicked() welcome_splash.closeClicked()
@@ -213,6 +219,7 @@ Rectangle {
forceHover: false forceHover: false
fontpixelSize: 14 fontpixelSize: 14
onClicked: { onClicked: {
studioUsageStatisticModel.setInsightEnabled(true)
usageStatisticModel.setTelemetryEnabled(true) usageStatisticModel.setTelemetryEnabled(true)
usageStatisticModel.setCrashReporterEnabled(true) usageStatisticModel.setCrashReporterEnabled(true)
welcome_splash.closeClicked() welcome_splash.closeClicked()

View File

@@ -70,6 +70,7 @@
using namespace ProjectExplorer; using namespace ProjectExplorer;
using namespace Utils; using namespace Utils;
using namespace Core;
namespace StudioWelcome { namespace StudioWelcome {
namespace Internal { namespace Internal {
@@ -202,6 +203,22 @@ private:
QString m_versionString; 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 class ProjectModel : public QAbstractListModel
{ {
Q_OBJECT Q_OBJECT
@@ -577,6 +594,7 @@ void StudioWelcomePlugin::initialize()
{ {
qmlRegisterType<ProjectModel>("projectmodel", 1, 0, "ProjectModel"); qmlRegisterType<ProjectModel>("projectmodel", 1, 0, "ProjectModel");
qmlRegisterType<UsageStatisticPluginModel>("usagestatistics", 1, 0, "UsageStatisticModel"); qmlRegisterType<UsageStatisticPluginModel>("usagestatistics", 1, 0, "UsageStatisticModel");
qmlRegisterType<StudioUsageStatisticPluginModel>("studiousagestatistics", 1, 0, "StudioUsageStatisticModel");
m_welcomeMode = new WelcomeMode; m_welcomeMode = new WelcomeMode;
} }