Merge pull request #5458 from spycrab/qt_analytics

Qt: Implement analytics (+ prompt)
This commit is contained in:
Anthony 2017-05-20 15:14:16 -07:00 committed by GitHub
commit 1c9d11c0e9
3 changed files with 48 additions and 0 deletions

View File

@ -4,7 +4,10 @@
#include <QAbstractEventDispatcher>
#include <QApplication>
#include <QMessageBox>
#include <QObject>
#include "Core/Analytics.h"
#include "Core/BootManager.h"
#include "Core/Core.h"
#include "DolphinQt2/Host.h"
@ -36,8 +39,41 @@ int main(int argc, char* argv[])
}
if (!retval)
{
DolphinAnalytics::Instance()->ReportDolphinStart("qt");
MainWindow win;
win.show();
#if defined(USE_ANALYTICS) && USE_ANALYTICS
if (!Settings().HasAskedForAnalyticsPermission())
{
QMessageBox analytics_prompt(&win);
analytics_prompt.setIcon(QMessageBox::Question);
analytics_prompt.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
analytics_prompt.setText(QObject::tr(
"Do you authorize Dolphin to report this information to Dolphin's developers?"));
analytics_prompt.setInformativeText(
QObject::tr("If authorized, Dolphin can collect data on its performance, "
"feature usage, and configuration, as well as data on your system's "
"hardware and operating system.\n\n"
"No private data is ever collected. This data helps us understand "
"how people and emulated games use Dolphin and prioritize our "
"efforts. It also helps us identify rare configurations that are "
"causing bugs, performance and stability issues.\n"
"This authorization can be revoked at any time through Dolphin's "
"settings.\n\n"));
const int answer = analytics_prompt.exec();
Settings().SetAskedForAnalyticsPermission(true);
Settings().SetAnalyticsEnabled(answer == QMessageBox::Yes);
Settings().Save();
DolphinAnalytics::Instance()->ReloadConfig();
}
#endif
retval = app.exec();
}

View File

@ -346,3 +346,13 @@ QVector<QString> Settings::GetProfiles(const InputConfig* config) const
return vec;
}
bool Settings::HasAskedForAnalyticsPermission() const
{
return SConfig::GetInstance().m_analytics_permission_asked;
}
void Settings::SetAskedForAnalyticsPermission(bool value)
{
SConfig::GetInstance().m_analytics_permission_asked = value;
}

View File

@ -62,6 +62,8 @@ public:
void SetForceNTSCJ(bool val);
// Analytics
bool HasAskedForAnalyticsPermission() const;
void SetAskedForAnalyticsPermission(bool value);
bool GetAnalyticsEnabled() const;
void SetAnalyticsEnabled(bool val);