summaryrefslogtreecommitdiffstats
path: root/application/setupwizard/AnalyticsWizardPage.cpp
blob: ee834db910246b4f1f8ce71a2c81677b5309ec2d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "AnalyticsWizardPage.h"
#include <MultiMC.h>

#include <QVBoxLayout>
#include <QTextBrowser>
#include <QCheckBox>

#include <ganalytics.h>
#include <BuildConfig.h>

AnalyticsWizardPage::AnalyticsWizardPage(QWidget *parent)
	: BaseWizardPage(parent)
{
	setObjectName(QStringLiteral("analyticsPage"));
	verticalLayout_3 = new QVBoxLayout(this);
	verticalLayout_3->setObjectName(QStringLiteral("verticalLayout_3"));
	textBrowser = new QTextBrowser(this);
	textBrowser->setObjectName(QStringLiteral("textBrowser"));
	textBrowser->setAcceptRichText(false);
	textBrowser->setOpenExternalLinks(true);
	verticalLayout_3->addWidget(textBrowser);

	checkBox = new QCheckBox(this);
	checkBox->setObjectName(QStringLiteral("checkBox"));
	checkBox->setChecked(true);
	verticalLayout_3->addWidget(checkBox);
	retranslate();
}

AnalyticsWizardPage::~AnalyticsWizardPage()
{
}

bool AnalyticsWizardPage::validatePage()
{
	auto settings = MMC->settings();
	auto analytics = MMC->analytics();
	auto status = checkBox->isChecked();
	settings->set("AnalyticsSeen", analytics->version());
	settings->set("Analytics", status);
	return true;
}

bool AnalyticsWizardPage::isRequired()
{
	if(BuildConfig.ANALYTICS_ID.isEmpty())
	{
		return false;
	}
	auto settings = MMC->settings();
	auto analytics = MMC->analytics();
	if (!settings->get("Analytics").toBool())
	{
		return false;
	}
	if (settings->get("AnalyticsSeen").toInt() < analytics->version())
	{
		return true;
	}
	return false;
}

void AnalyticsWizardPage::retranslate()
{
	setTitle(tr("Analytics"));
	setSubTitle(tr("We track some anonymous statistics about users."));
	textBrowser->setHtml(tr(
		"<html><body>"
		"<p>MultiMC sends anonymous usage statistics on every start of the application. This helps us decide what platforms and issues to focus on.</p>"
		"<p>The data is processed by Google Analytics, see their <a href=\"https://support.google.com/analytics/answer/6004245?hl=en\">article on the "
		"matter</a>.</p>"
		"<p>The following data is collected:</p>"
		"<ul><li>A random unique ID of the MultiMC installation.<br />It is stored in the application settings (multimc.cfg).</li>"
		"<li>Anonymized (partial) IP address.</li>"
		"<li>MultiMC version.</li>"
		"<li>Operating system name, version and architecture.</li>"
		"<li>CPU architecture (kernel architecture on linux).</li>"
		"<li>Size of system memory.</li>"
		"<li>Java version, architecture and memory settings.</li></ul>"
		"<p>If we change the tracked information, you will see this page again.</p></body></html>"));
	checkBox->setText(tr("Enable Analytics"));
}