diff options
Diffstat (limited to 'launcher')
-rw-r--r-- | launcher/Application.cpp | 142 | ||||
-rw-r--r-- | launcher/Application.h | 8 | ||||
-rw-r--r-- | launcher/CMakeLists.txt | 3 | ||||
-rw-r--r-- | launcher/ui/pages/global/LauncherPage.cpp | 17 | ||||
-rw-r--r-- | launcher/ui/pages/global/LauncherPage.ui | 63 | ||||
-rw-r--r-- | launcher/ui/setupwizard/AnalyticsWizardPage.cpp | 63 | ||||
-rw-r--r-- | launcher/ui/setupwizard/AnalyticsWizardPage.h | 25 | ||||
-rw-r--r-- | launcher/ui/setupwizard/SetupWizard.cpp | 2 |
8 files changed, 2 insertions, 321 deletions
diff --git a/launcher/Application.cpp b/launcher/Application.cpp index 264bfff8..8e0d6c33 100644 --- a/launcher/Application.cpp +++ b/launcher/Application.cpp @@ -26,7 +26,6 @@ #include "ui/setupwizard/SetupWizard.h" #include "ui/setupwizard/LanguageWizardPage.h" #include "ui/setupwizard/JavaWizardPage.h" -#include "ui/setupwizard/AnalyticsWizardPage.h" #include "ui/dialogs/CustomMessageBox.h" @@ -73,7 +72,6 @@ #include <DesktopServices.h> #include <LocalPeer.h> -#include <ganalytics.h> #include <sys.h> @@ -719,14 +717,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) // paste.ee API key m_settings->registerSetting("PasteEEAPIKey", "multimc"); - if(!BuildConfig.ANALYTICS_ID.isEmpty()) - { - // Analytics - m_settings->registerSetting("Analytics", true); - m_settings->registerSetting("AnalyticsSeen", 0); - m_settings->registerSetting("AnalyticsClientID", QString()); - } - // Init page provider { m_globalSettingsProvider = std::make_shared<GenericPageProvider>(tr("Settings")); @@ -908,46 +898,6 @@ Application::Application(int &argc, char **argv) : QApplication(argc, argv) qDebug() << "<> Application theme set."; } - // Initialize analytics - [this]() - { - const int analyticsVersion = 2; - if(BuildConfig.ANALYTICS_ID.isEmpty()) - { - return; - } - - auto analyticsSetting = m_settings->getSetting("Analytics"); - connect(analyticsSetting.get(), &Setting::SettingChanged, this, &Application::analyticsSettingChanged); - QString clientID = m_settings->get("AnalyticsClientID").toString(); - if(clientID.isEmpty()) - { - clientID = QUuid::createUuid().toString(); - clientID.remove(QLatin1Char('{')); - clientID.remove(QLatin1Char('}')); - m_settings->set("AnalyticsClientID", clientID); - } - m_analytics = new GAnalytics(BuildConfig.ANALYTICS_ID, clientID, analyticsVersion, this); - m_analytics->setLogLevel(GAnalytics::Debug); - m_analytics->setAnonymizeIPs(true); - // FIXME: the ganalytics library has no idea about our fancy shared pointers... - m_analytics->setNetworkAccessManager(network().get()); - - if(m_settings->get("AnalyticsSeen").toInt() < m_analytics->version()) - { - qDebug() << "Analytics info not seen by user yet (or old version)."; - return; - } - if(!m_settings->get("Analytics").toBool()) - { - qDebug() << "Analytics disabled by user."; - return; - } - - m_analytics->enable(); - qDebug() << "<> Initialized analytics with tid" << BuildConfig.ANALYTICS_ID; - }(); - if(createSetupWizard()) { return; @@ -974,29 +924,13 @@ bool Application::createSetupWizard() } return false; }(); - bool analyticsRequired = [&]() - { - if(BuildConfig.ANALYTICS_ID.isEmpty()) - { - return false; - } - if (!settings()->get("Analytics").toBool()) - { - return false; - } - if (settings()->get("AnalyticsSeen").toInt() < analytics()->version()) - { - return true; - } - return false; - }(); bool languageRequired = [&]() { if (settings()->get("Language").toString().isEmpty()) return true; return false; }(); - bool wizardRequired = javaRequired || analyticsRequired || languageRequired; + bool wizardRequired = javaRequired || languageRequired; if(wizardRequired) { @@ -1009,10 +943,6 @@ bool Application::createSetupWizard() { m_setupWizard->addPage(new JavaWizardPage(m_setupWizard)); } - if(analyticsRequired) - { - m_setupWizard->addPage(new AnalyticsWizardPage(m_setupWizard)); - } connect(m_setupWizard, &QDialog::finished, this, &Application::setupWizardFinished); m_setupWizard->show(); return true; @@ -1169,22 +1099,6 @@ void Application::messageReceived(const QByteArray& message) } } -void Application::analyticsSettingChanged(const Setting&, QVariant value) -{ - if(!m_analytics) - return; - bool enabled = value.toBool(); - if(enabled) - { - qDebug() << "Analytics enabled by user."; - } - else - { - qDebug() << "Analytics disabled by user."; - } - m_analytics->enable(enabled); -} - std::shared_ptr<TranslationsModel> Application::translations() { return m_translations; @@ -1454,60 +1368,6 @@ MainWindow* Application::showMainWindow(bool minimized) connect(m_mainWindow, &MainWindow::isClosing, this, &Application::on_windowClose); m_openWindows++; } - // FIXME: move this somewhere else... - if(m_analytics) - { - auto windowSize = m_mainWindow->size(); - auto sizeString = QString("%1x%2").arg(windowSize.width()).arg(windowSize.height()); - qDebug() << "Viewport size" << sizeString; - m_analytics->setViewportSize(sizeString); - /* - * cm1 = java min heap [MB] - * cm2 = java max heap [MB] - * cm3 = system RAM [MB] - * - * cd1 = java version - * cd2 = java architecture - * cd3 = system architecture - * cd4 = CPU architecture - */ - QVariantMap customValues; - int min = m_settings->get("MinMemAlloc").toInt(); - int max = m_settings->get("MaxMemAlloc").toInt(); - if(min < max) - { - customValues["cm1"] = min; - customValues["cm2"] = max; - } - else - { - customValues["cm1"] = max; - customValues["cm2"] = min; - } - - constexpr uint64_t Mega = 1024ull * 1024ull; - int ramSize = int(Sys::getSystemRam() / Mega); - qDebug() << "RAM size is" << ramSize << "MB"; - customValues["cm3"] = ramSize; - - customValues["cd1"] = m_settings->get("JavaVersion"); - customValues["cd2"] = m_settings->get("JavaArchitecture"); - customValues["cd3"] = Sys::isSystem64bit() ? "64":"32"; - customValues["cd4"] = Sys::isCPU64bit() ? "64":"32"; - auto kernelInfo = Sys::getKernelInfo(); - customValues["cd5"] = kernelInfo.kernelName; - customValues["cd6"] = kernelInfo.kernelVersion; - auto distInfo = Sys::getDistributionInfo(); - if(!distInfo.distributionName.isEmpty()) - { - customValues["cd7"] = distInfo.distributionName; - } - if(!distInfo.distributionVersion.isEmpty()) - { - customValues["cd8"] = distInfo.distributionVersion; - } - m_analytics->sendScreenView("Main Window", customValues); - } return m_mainWindow; } diff --git a/launcher/Application.h b/launcher/Application.h index 982e22e3..c1cd8224 100644 --- a/launcher/Application.h +++ b/launcher/Application.h @@ -33,7 +33,6 @@ class BaseDetachedToolFactory; class TranslationsModel; class ITheme; class MCEditTool; -class GAnalytics; namespace Meta { class Index; @@ -60,10 +59,6 @@ public: Application(int &argc, char **argv); virtual ~Application(); - GAnalytics *analytics() const { - return m_analytics; - } - std::shared_ptr<SettingsObject> settings() const { return m_settings; } @@ -161,7 +156,6 @@ private slots: void messageReceived(const QByteArray & message); void controllerSucceeded(); void controllerFailed(const QString & error); - void analyticsSettingChanged(const Setting &setting, QVariant value); void setupWizardFinished(int status); private: @@ -226,7 +220,6 @@ private: // peer launcher instance connector - used to implement single instance launcher and signalling LocalPeer * m_peerInstance = nullptr; - GAnalytics * m_analytics = nullptr; SetupWizard * m_setupWizard = nullptr; public: QString m_instanceIdToLaunch; @@ -236,3 +229,4 @@ public: QUrl m_zipToImport; std::unique_ptr<QFile> logFile; }; + diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index fceca8e2..b5c52afa 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -627,8 +627,6 @@ SET(LAUNCHER_SOURCES # GUI - setup wizard ui/setupwizard/SetupWizard.h ui/setupwizard/SetupWizard.cpp - ui/setupwizard/AnalyticsWizardPage.cpp - ui/setupwizard/AnalyticsWizardPage.h ui/setupwizard/BaseWizardPage.h ui/setupwizard/JavaWizardPage.cpp ui/setupwizard/JavaWizardPage.h @@ -932,7 +930,6 @@ target_link_libraries(Launcher_logic hoedown Launcher_rainbow LocalPeer - ganalytics ) target_link_libraries(Launcher_logic) diff --git a/launcher/ui/pages/global/LauncherPage.cpp b/launcher/ui/pages/global/LauncherPage.cpp index 2eb73e44..4d4d4e89 100644 --- a/launcher/ui/pages/global/LauncherPage.cpp +++ b/launcher/ui/pages/global/LauncherPage.cpp @@ -73,11 +73,6 @@ LauncherPage::LauncherPage(QWidget *parent) : QWidget(parent), ui(new Ui::Launch { ui->updateSettingsBox->setHidden(true); } - // Analytics - if(BuildConfig.ANALYTICS_ID.isEmpty()) - { - ui->tabWidget->removeTab(ui->tabWidget->indexOf(ui->analyticsTab)); - } connect(ui->fontSizeBox, SIGNAL(valueChanged(int)), SLOT(refreshFontPreview())); connect(ui->consoleFont, SIGNAL(currentFontChanged(QFont)), SLOT(refreshFontPreview())); @@ -321,12 +316,6 @@ void LauncherPage::applySettings() s->set("InstSortMode", "Name"); break; } - - // Analytics - if(!BuildConfig.ANALYTICS_ID.isEmpty()) - { - s->set("Analytics", ui->analyticsCheck->isChecked()); - } } void LauncherPage::loadSettings() { @@ -422,12 +411,6 @@ void LauncherPage::loadSettings() { ui->sortByNameBtn->setChecked(true); } - - // Analytics - if(!BuildConfig.ANALYTICS_ID.isEmpty()) - { - ui->analyticsCheck->setChecked(s->get("Analytics").toBool()); - } } void LauncherPage::refreshFontPreview() diff --git a/launcher/ui/pages/global/LauncherPage.ui b/launcher/ui/pages/global/LauncherPage.ui index 62a66d73..2b3729bc 100644 --- a/launcher/ui/pages/global/LauncherPage.ui +++ b/launcher/ui/pages/global/LauncherPage.ui @@ -485,69 +485,6 @@ </item> </layout> </widget> - <widget class="QWidget" name="analyticsTab"> - <attribute name="title"> - <string>Analytics</string> - </attribute> - <layout class="QVBoxLayout" name="verticalLayout_8"> - <item> - <widget class="QGroupBox" name="consoleSettingsBox_2"> - <property name="title"> - <string>Analytics Settings</string> - </property> - <layout class="QVBoxLayout" name="verticalLayout_4"> - <item> - <widget class="QCheckBox" name="analyticsCheck"> - <property name="text"> - <string>Send anonymous usage statistics?</string> - </property> - </widget> - </item> - <item> - <widget class="Line" name="line"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - </widget> - </item> - <item> - <widget class="QLabel" name="label_5"> - <property name="text"> - <string><html><head/> -<body> -<p>The launcher sends anonymous usage statistics on every start of the application.</p><p>The following data is collected:</p> -<ul> -<li>Launcher 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> -</body></html></string> - </property> - <property name="wordWrap"> - <bool>true</bool> - </property> - </widget> - </item> - </layout> - </widget> - </item> - <item> - <spacer name="verticalSpacer"> - <property name="orientation"> - <enum>Qt::Vertical</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>20</width> - <height>40</height> - </size> - </property> - </spacer> - </item> - </layout> - </widget> </widget> </item> </layout> diff --git a/launcher/ui/setupwizard/AnalyticsWizardPage.cpp b/launcher/ui/setupwizard/AnalyticsWizardPage.cpp deleted file mode 100644 index 3db2f6dc..00000000 --- a/launcher/ui/setupwizard/AnalyticsWizardPage.cpp +++ /dev/null @@ -1,63 +0,0 @@ -#include "AnalyticsWizardPage.h" -#include <Application.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 = APPLICATION->settings(); - auto analytics = APPLICATION->analytics(); - auto status = checkBox->isChecked(); - settings->set("AnalyticsSeen", analytics->version()); - settings->set("Analytics", status); - return true; -} - -void AnalyticsWizardPage::retranslate() -{ - setTitle(tr("Analytics")); - setSubTitle(tr("We track some anonymous statistics about users.")); - textBrowser->setHtml(tr( - "<html><body>" - "<p>The launcher 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 installation.<br />It is stored in the application settings file.</li>" - "<li>Anonymized (partial) IP address.</li>" - "<li>Launcher 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")); -} diff --git a/launcher/ui/setupwizard/AnalyticsWizardPage.h b/launcher/ui/setupwizard/AnalyticsWizardPage.h deleted file mode 100644 index c451db2c..00000000 --- a/launcher/ui/setupwizard/AnalyticsWizardPage.h +++ /dev/null @@ -1,25 +0,0 @@ -#pragma once - -#include "BaseWizardPage.h" - -class QVBoxLayout; -class QTextBrowser; -class QCheckBox; - -class AnalyticsWizardPage : public BaseWizardPage -{ - Q_OBJECT -public: - explicit AnalyticsWizardPage(QWidget *parent = Q_NULLPTR); - virtual ~AnalyticsWizardPage(); - - bool validatePage() override; - -protected: - void retranslate() override; - -private: - QVBoxLayout *verticalLayout_3 = nullptr; - QTextBrowser *textBrowser = nullptr; - QCheckBox *checkBox = nullptr; -};
\ No newline at end of file diff --git a/launcher/ui/setupwizard/SetupWizard.cpp b/launcher/ui/setupwizard/SetupWizard.cpp index 5af5ba91..22eab60e 100644 --- a/launcher/ui/setupwizard/SetupWizard.cpp +++ b/launcher/ui/setupwizard/SetupWizard.cpp @@ -2,12 +2,10 @@ #include "LanguageWizardPage.h" #include "JavaWizardPage.h" -#include "AnalyticsWizardPage.h" #include "translations/TranslationsModel.h" #include <Application.h> #include <FileSystem.h> -#include <ganalytics.h> #include <QAbstractButton> #include <BuildConfig.h> |