| 1 | // Copyright 2025 Dolphin Emulator Project |
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later |
| 3 | |
| 4 | #include "DolphinQt/QtUtils/AnalyticsPrompt.h" |
| 5 | |
| 6 | #include <QMessageBox> |
| 7 | #include <QObject> |
| 8 | #include <QWidget> |
| 9 | |
| 10 | #include "Core/Config/MainSettings.h" |
| 11 | #include "Core/DolphinAnalytics.h" |
| 12 | #include "DolphinQt/QtUtils/ModalMessageBox.h" |
| 13 | #include "DolphinQt/Settings.h" |
| 14 | |
| 15 | void ShowAnalyticsPrompt(QWidget* parent) |
| 16 | { |
| 17 | ModalMessageBox analytics_prompt(parent); |
| 18 | |
| 19 | analytics_prompt.setIcon(QMessageBox::Question); |
| 20 | analytics_prompt.setStandardButtons(QMessageBox::Yes | QMessageBox::No); |
| 21 | analytics_prompt.setWindowTitle(QObject::tr("Allow Usage Statistics Reporting")); |
| 22 | analytics_prompt.setText( |
| 23 | QObject::tr("Do you authorize Dolphin to report information to Dolphin's developers?")); |
| 24 | analytics_prompt.setInformativeText( |
| 25 | QObject::tr("If authorized, Dolphin can collect data on its performance, " |
| 26 | "feature usage, and configuration, as well as data on your system's " |
| 27 | "hardware and operating system.\n\n" |
| 28 | "No private data is ever collected. This data helps us understand " |
| 29 | "how people and emulated games use Dolphin and prioritize our " |
| 30 | "efforts. It also helps us identify rare configurations that are " |
| 31 | "causing bugs, performance and stability issues.\n" |
| 32 | "This authorization can be revoked at any time through Dolphin's " |
| 33 | "settings.")); |
| 34 | |
| 35 | const int answer = analytics_prompt.exec(); |
| 36 | |
| 37 | Config::SetBase(Config::MAIN_ANALYTICS_PERMISSION_ASKED, true); |
| 38 | Settings::Instance().SetAnalyticsEnabled(answer == QMessageBox::Yes); |
| 39 | |
| 40 | DolphinAnalytics::Instance().ReloadConfig(); |
| 41 | } |