settings: Add enable_telemetry, citra_username, and citra_token.

This commit is contained in:
bunnei 2017-08-22 22:37:03 -04:00
parent d6a819c7cb
commit c781aea947
4 changed files with 20 additions and 0 deletions

View file

@ -156,8 +156,12 @@ void Config::ReadValues() {
static_cast<u16>(sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689)); static_cast<u16>(sdl2_config->GetInteger("Debugging", "gdbstub_port", 24689));
// Web Service // Web Service
Settings::values.enable_telemetry =
sdl2_config->GetBoolean("WebService", "enable_telemetry", true);
Settings::values.telemetry_endpoint_url = sdl2_config->Get( Settings::values.telemetry_endpoint_url = sdl2_config->Get(
"WebService", "telemetry_endpoint_url", "https://services.citra-emu.org/api/telemetry"); "WebService", "telemetry_endpoint_url", "https://services.citra-emu.org/api/telemetry");
Settings::values.citra_username = sdl2_config->Get("WebService", "citra_username", "");
Settings::values.citra_token = sdl2_config->Get("WebService", "citra_token", "");
} }
void Config::Reload() { void Config::Reload() {

View file

@ -176,7 +176,14 @@ use_gdbstub=false
gdbstub_port=24689 gdbstub_port=24689
[WebService] [WebService]
# Whether or not to enable telemetry
# 0: No, 1 (default): Yes
enable_telemetry =
# Endpoint URL for submitting telemetry data # Endpoint URL for submitting telemetry data
telemetry_endpoint_url = telemetry_endpoint_url =
# Username and token for Citra Web Service
# See https://services.citra-emu.org/ for more info
citra_username =
citra_token =
)"; )";
} }

View file

@ -139,10 +139,13 @@ void Config::ReadValues() {
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("WebService"); qt_config->beginGroup("WebService");
Settings::values.enable_telemetry = qt_config->value("enable_telemetry", true).toBool();
Settings::values.telemetry_endpoint_url = Settings::values.telemetry_endpoint_url =
qt_config->value("telemetry_endpoint_url", "https://services.citra-emu.org/api/telemetry") qt_config->value("telemetry_endpoint_url", "https://services.citra-emu.org/api/telemetry")
.toString() .toString()
.toStdString(); .toStdString();
Settings::values.citra_username = qt_config->value("citra_username").toString().toStdString();
Settings::values.citra_token = qt_config->value("citra_token").toString().toStdString();
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("UI"); qt_config->beginGroup("UI");
@ -284,8 +287,11 @@ void Config::SaveValues() {
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("WebService"); qt_config->beginGroup("WebService");
qt_config->setValue("enable_telemetry", Settings::values.enable_telemetry);
qt_config->setValue("telemetry_endpoint_url", qt_config->setValue("telemetry_endpoint_url",
QString::fromStdString(Settings::values.telemetry_endpoint_url)); QString::fromStdString(Settings::values.telemetry_endpoint_url));
qt_config->setValue("citra_username", QString::fromStdString(Settings::values.citra_username));
qt_config->setValue("citra_token", QString::fromStdString(Settings::values.citra_token));
qt_config->endGroup(); qt_config->endGroup();
qt_config->beginGroup("UI"); qt_config->beginGroup("UI");

View file

@ -130,7 +130,10 @@ struct Values {
u16 gdbstub_port; u16 gdbstub_port;
// WebService // WebService
bool enable_telemetry;
std::string telemetry_endpoint_url; std::string telemetry_endpoint_url;
std::string citra_username;
std::string citra_token;
} extern values; } extern values;
// a special value for Values::region_value indicating that citra will automatically select a region // a special value for Values::region_value indicating that citra will automatically select a region