From 59ad93302226f3e65aed1a62ea3c7b58315d0eb6 Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 8 Aug 2017 20:06:25 -0400 Subject: [PATCH] citra_qt: Show one-time callout messages to user. --- src/citra_qt/configuration/config.cpp | 2 ++ src/citra_qt/main.cpp | 44 +++++++++++++++++++++++++++ src/citra_qt/main.h | 2 ++ src/citra_qt/ui_settings.h | 2 ++ 4 files changed, 50 insertions(+) diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index 6e42db0072..7386814b3c 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -194,6 +194,7 @@ void Config::ReadValues() { UISettings::values.show_status_bar = qt_config->value("showStatusBar", true).toBool(); UISettings::values.confirm_before_closing = qt_config->value("confirmClose", true).toBool(); UISettings::values.first_start = qt_config->value("firstStart", true).toBool(); + UISettings::values.callout_flags = qt_config->value("calloutFlags", 0).toUInt(); qt_config->endGroup(); } @@ -320,6 +321,7 @@ void Config::SaveValues() { qt_config->setValue("showStatusBar", UISettings::values.show_status_bar); qt_config->setValue("confirmClose", UISettings::values.confirm_before_closing); qt_config->setValue("firstStart", UISettings::values.first_start); + qt_config->setValue("calloutFlags", UISettings::values.callout_flags); qt_config->endGroup(); } diff --git a/src/citra_qt/main.cpp b/src/citra_qt/main.cpp index c1ae0ccc89..a8bf6201aa 100644 --- a/src/citra_qt/main.cpp +++ b/src/citra_qt/main.cpp @@ -48,6 +48,47 @@ Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin); #endif +/** + * "Callouts" are one-time instructional messages shown to the user. In the config settings, there + * is a bitfield "callout_flags" options, used to track if a message has already been shown to the + * user. This is 32-bits - if we have more than 32 callouts, we should retire and recyle old ones. + */ +enum class CalloutFlag : uint32_t { + Telemetry = 0x1, +}; + +static void ShowCalloutMessage(const QString& message, CalloutFlag flag) { + if (UISettings::values.callout_flags & static_cast(flag)) { + return; + } + + UISettings::values.callout_flags |= static_cast(flag); + + QMessageBox msg; + msg.setText(message); + msg.setStandardButtons(QMessageBox::Ok); + msg.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); + msg.setStyleSheet("QLabel{min-width: 900px;}"); + msg.exec(); +} + +void GMainWindow::ShowCallouts() { + static const QString telemetry_message = + tr("To help improve Citra, the Citra Team collects anonymous usage data. No private or " + "personally identifying information is collected. This data helps us to understand how " + "people use Citra and prioritize our efforts. Furthermore, it helps us to more easily " + "identify emulation bugs and performance issues. This data includes:
  • Information" + " about the version of Citra you are using
  • Performance data about the games you " + "play
  • Your configuration settings
  • Information about your computer " + "hardware
  • Emulation errors and crash information
By default, this " + "feature is enabled. To disable this feature, click 'Emulation' from the menu and then " + "select 'Configure...'. Then, on the 'Web' tab, uncheck 'Share anonymous usage data with" + " the Citra team'.

By using this software, you agree to the above terms.
" + "
Learn " + "more"); + ShowCalloutMessage(telemetry_message, CalloutFlag::Telemetry); +} + GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { Pica::g_debug_context = Pica::DebugContext::Construct(); setAcceptDrops(true); @@ -73,6 +114,9 @@ GMainWindow::GMainWindow() : config(new Config()), emu_thread(nullptr) { UpdateUITheme(); + // Show one-time "callout" messages to the user + ShowCallouts(); + QStringList args = QApplication::arguments(); if (args.length() >= 2) { BootGame(args[1]); diff --git a/src/citra_qt/main.h b/src/citra_qt/main.h index 360de2ced2..d59a6d67d3 100644 --- a/src/citra_qt/main.h +++ b/src/citra_qt/main.h @@ -80,6 +80,8 @@ private: void BootGame(const QString& filename); void ShutdownGame(); + void ShowCallouts(); + /** * Stores the filename in the recently loaded files list. * The new filename is stored at the beginning of the recently loaded files list. diff --git a/src/citra_qt/ui_settings.h b/src/citra_qt/ui_settings.h index 025c73f84b..d85c92765f 100644 --- a/src/citra_qt/ui_settings.h +++ b/src/citra_qt/ui_settings.h @@ -48,6 +48,8 @@ struct Values { // Shortcut name std::vector shortcuts; + + uint32_t callout_flags; }; extern Values values;