diff options
Diffstat (limited to 'src/citra_qt/configuration')
-rw-r--r-- | src/citra_qt/configuration/config.cpp | 23 | ||||
-rw-r--r-- | src/citra_qt/configuration/configure.ui | 15 | ||||
-rw-r--r-- | src/citra_qt/configuration/configure_dialog.cpp | 1 | ||||
-rw-r--r-- | src/citra_qt/configuration/configure_graphics.ui | 33 | ||||
-rw-r--r-- | src/citra_qt/configuration/configure_system.cpp | 3 | ||||
-rw-r--r-- | src/citra_qt/configuration/configure_web.cpp | 102 | ||||
-rw-r--r-- | src/citra_qt/configuration/configure_web.h | 40 | ||||
-rw-r--r-- | src/citra_qt/configuration/configure_web.ui | 190 |
8 files changed, 390 insertions, 17 deletions
diff --git a/src/citra_qt/configuration/config.cpp b/src/citra_qt/configuration/config.cpp index 75abb4ce6..5261f4c4c 100644 --- a/src/citra_qt/configuration/config.cpp +++ b/src/citra_qt/configuration/config.cpp @@ -57,6 +57,13 @@ void Config::ReadValues() { Settings::values.analogs[i] = default_param; } + Settings::values.motion_device = + qt_config->value("motion_device", "engine:motion_emu,update_period:100,sensitivity:0.01") + .toString() + .toStdString(); + Settings::values.touch_device = + qt_config->value("touch_device", "engine:emu_window").toString().toStdString(); + qt_config->endGroup(); qt_config->beginGroup("Core"); @@ -134,10 +141,17 @@ void Config::ReadValues() { qt_config->endGroup(); qt_config->beginGroup("WebService"); + Settings::values.enable_telemetry = qt_config->value("enable_telemetry", true).toBool(); Settings::values.telemetry_endpoint_url = qt_config->value("telemetry_endpoint_url", "https://services.citra-emu.org/api/telemetry") .toString() .toStdString(); + Settings::values.verify_endpoint_url = + qt_config->value("verify_endpoint_url", "https://services.citra-emu.org/api/profile") + .toString() + .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->beginGroup("UI"); @@ -189,6 +203,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(); } @@ -203,6 +218,8 @@ void Config::SaveValues() { qt_config->setValue(QString::fromStdString(Settings::NativeAnalog::mapping[i]), QString::fromStdString(Settings::values.analogs[i])); } + qt_config->setValue("motion_device", QString::fromStdString(Settings::values.motion_device)); + qt_config->setValue("touch_device", QString::fromStdString(Settings::values.touch_device)); qt_config->endGroup(); qt_config->beginGroup("Core"); @@ -277,8 +294,13 @@ void Config::SaveValues() { qt_config->endGroup(); qt_config->beginGroup("WebService"); + qt_config->setValue("enable_telemetry", Settings::values.enable_telemetry); qt_config->setValue("telemetry_endpoint_url", QString::fromStdString(Settings::values.telemetry_endpoint_url)); + qt_config->setValue("verify_endpoint_url", + QString::fromStdString(Settings::values.verify_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->beginGroup("UI"); @@ -314,6 +336,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/configuration/configure.ui b/src/citra_qt/configuration/configure.ui index 85e206e42..6abd1917e 100644 --- a/src/citra_qt/configuration/configure.ui +++ b/src/citra_qt/configuration/configure.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>441</width> - <height>501</height> + <width>740</width> + <height>500</height> </rect> </property> <property name="windowTitle"> @@ -49,6 +49,11 @@ <string>Debug</string> </attribute> </widget> + <widget class="ConfigureWeb" name="webTab"> + <attribute name="title"> + <string>Web</string> + </attribute> + </widget> </widget> </item> <item> @@ -97,6 +102,12 @@ <header>configuration/configure_graphics.h</header> <container>1</container> </customwidget> + <customwidget> + <class>ConfigureWeb</class> + <extends>QWidget</extends> + <header>configuration/configure_web.h</header> + <container>1</container> + </customwidget> </customwidgets> <resources/> <connections> diff --git a/src/citra_qt/configuration/configure_dialog.cpp b/src/citra_qt/configuration/configure_dialog.cpp index dfc8c03a7..b87dc0e6c 100644 --- a/src/citra_qt/configuration/configure_dialog.cpp +++ b/src/citra_qt/configuration/configure_dialog.cpp @@ -23,5 +23,6 @@ void ConfigureDialog::applyConfiguration() { ui->graphicsTab->applyConfiguration(); ui->audioTab->applyConfiguration(); ui->debugTab->applyConfiguration(); + ui->webTab->applyConfiguration(); Settings::Apply(); } diff --git a/src/citra_qt/configuration/configure_graphics.ui b/src/citra_qt/configuration/configure_graphics.ui index 228f2a869..5667b14b6 100644 --- a/src/citra_qt/configuration/configure_graphics.ui +++ b/src/citra_qt/configuration/configure_graphics.ui @@ -63,57 +63,57 @@ <widget class="QComboBox" name="resolution_factor_combobox"> <item> <property name="text"> - <string notr="true">Auto (Window Size)</string> + <string>Auto (Window Size)</string> </property> </item> <item> <property name="text"> - <string notr="true">Native (400x240)</string> + <string>Native (400x240)</string> </property> </item> <item> <property name="text"> - <string notr="true">2x Native (800x480)</string> + <string>2x Native (800x480)</string> </property> </item> <item> <property name="text"> - <string notr="true">3x Native (1200x720)</string> + <string>3x Native (1200x720)</string> </property> </item> <item> <property name="text"> - <string notr="true">4x Native (1600x960)</string> + <string>4x Native (1600x960)</string> </property> </item> <item> <property name="text"> - <string notr="true">5x Native (2000x1200)</string> + <string>5x Native (2000x1200)</string> </property> </item> <item> <property name="text"> - <string notr="true">6x Native (2400x1440)</string> + <string>6x Native (2400x1440)</string> </property> </item> <item> <property name="text"> - <string notr="true">7x Native (2800x1680)</string> + <string>7x Native (2800x1680)</string> </property> </item> <item> <property name="text"> - <string notr="true">8x Native (3200x1920)</string> + <string>8x Native (3200x1920)</string> </property> </item> <item> <property name="text"> - <string notr="true">9x Native (3600x2160)</string> + <string>9x Native (3600x2160)</string> </property> </item> <item> <property name="text"> - <string notr="true">10x Native (4000x2400)</string> + <string>10x Native (4000x2400)</string> </property> </item> </widget> @@ -146,17 +146,22 @@ <widget class="QComboBox" name="layout_combobox"> <item> <property name="text"> - <string notr="true">Default</string> + <string>Default</string> </property> </item> <item> <property name="text"> - <string notr="true">Single Screen</string> + <string>Single Screen</string> </property> </item> <item> <property name="text"> - <string notr="true">Large Screen</string> + <string>Large Screen</string> + </property> + </item> + <item> + <property name="text"> + <string>Side by Side</string> </property> </item> </widget> diff --git a/src/citra_qt/configuration/configure_system.cpp b/src/citra_qt/configuration/configure_system.cpp index 9b1e6711d..88a067c12 100644 --- a/src/citra_qt/configuration/configure_system.cpp +++ b/src/citra_qt/configuration/configure_system.cpp @@ -78,7 +78,8 @@ void ConfigureSystem::ReadSystemSettings() { // set the console id u64 console_id = Service::CFG::GetConsoleUniqueId(); - ui->label_console_id->setText("Console ID: 0x" + QString::number(console_id, 16).toUpper()); + ui->label_console_id->setText( + tr("Console ID: 0x%1").arg(QString::number(console_id, 16).toUpper())); } void ConfigureSystem::applyConfiguration() { diff --git a/src/citra_qt/configuration/configure_web.cpp b/src/citra_qt/configuration/configure_web.cpp new file mode 100644 index 000000000..bf8c21ac7 --- /dev/null +++ b/src/citra_qt/configuration/configure_web.cpp @@ -0,0 +1,102 @@ +// Copyright 2017 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include <QMessageBox> +#include "citra_qt/configuration/configure_web.h" +#include "core/settings.h" +#include "core/telemetry_session.h" +#include "ui_configure_web.h" + +ConfigureWeb::ConfigureWeb(QWidget* parent) + : QWidget(parent), ui(std::make_unique<Ui::ConfigureWeb>()) { + ui->setupUi(this); + connect(ui->button_regenerate_telemetry_id, &QPushButton::clicked, this, + &ConfigureWeb::RefreshTelemetryID); + connect(ui->button_verify_login, &QPushButton::clicked, this, &ConfigureWeb::VerifyLogin); + connect(this, &ConfigureWeb::LoginVerified, this, &ConfigureWeb::OnLoginVerified); + + this->setConfiguration(); +} + +ConfigureWeb::~ConfigureWeb() {} + +void ConfigureWeb::setConfiguration() { + ui->web_credentials_disclaimer->setWordWrap(true); + ui->telemetry_learn_more->setOpenExternalLinks(true); + ui->telemetry_learn_more->setText(tr("<a " + "href='https://citra-emu.org/entry/" + "telemetry-and-why-thats-a-good-thing/'>Learn more</a>")); + + ui->web_signup_link->setOpenExternalLinks(true); + ui->web_signup_link->setText(tr("<a href='https://services.citra-emu.org/'>Sign up</a>")); + ui->web_token_info_link->setOpenExternalLinks(true); + ui->web_token_info_link->setText( + tr("<a href='https://citra-emu.org/wiki/citra-web-service/'>What is my token?</a>")); + + ui->toggle_telemetry->setChecked(Settings::values.enable_telemetry); + ui->edit_username->setText(QString::fromStdString(Settings::values.citra_username)); + ui->edit_token->setText(QString::fromStdString(Settings::values.citra_token)); + // Connect after setting the values, to avoid calling OnLoginChanged now + connect(ui->edit_token, &QLineEdit::textChanged, this, &ConfigureWeb::OnLoginChanged); + connect(ui->edit_username, &QLineEdit::textChanged, this, &ConfigureWeb::OnLoginChanged); + ui->label_telemetry_id->setText( + tr("Telemetry ID: 0x%1").arg(QString::number(Core::GetTelemetryId(), 16).toUpper())); + user_verified = true; +} + +void ConfigureWeb::applyConfiguration() { + Settings::values.enable_telemetry = ui->toggle_telemetry->isChecked(); + if (user_verified) { + Settings::values.citra_username = ui->edit_username->text().toStdString(); + Settings::values.citra_token = ui->edit_token->text().toStdString(); + } else { + QMessageBox::warning(this, tr("Username and token not verfied"), + tr("Username and token were not verified. The changes to your " + "username and/or token have not been saved.")); + } + Settings::Apply(); +} + +void ConfigureWeb::RefreshTelemetryID() { + const u64 new_telemetry_id{Core::RegenerateTelemetryId()}; + ui->label_telemetry_id->setText( + tr("Telemetry ID: 0x%1").arg(QString::number(new_telemetry_id, 16).toUpper())); +} + +void ConfigureWeb::OnLoginChanged() { + if (ui->edit_username->text().isEmpty() && ui->edit_token->text().isEmpty()) { + user_verified = true; + ui->label_username_verified->setPixmap(QPixmap(":/icons/checked.png")); + ui->label_token_verified->setPixmap(QPixmap(":/icons/checked.png")); + } else { + user_verified = false; + ui->label_username_verified->setPixmap(QPixmap(":/icons/failed.png")); + ui->label_token_verified->setPixmap(QPixmap(":/icons/failed.png")); + } +} + +void ConfigureWeb::VerifyLogin() { + verified = + Core::VerifyLogin(ui->edit_username->text().toStdString(), + ui->edit_token->text().toStdString(), [&]() { emit LoginVerified(); }); + ui->button_verify_login->setDisabled(true); + ui->button_verify_login->setText(tr("Verifying")); +} + +void ConfigureWeb::OnLoginVerified() { + ui->button_verify_login->setEnabled(true); + ui->button_verify_login->setText(tr("Verify")); + if (verified.get()) { + user_verified = true; + ui->label_username_verified->setPixmap(QPixmap(":/icons/checked.png")); + ui->label_token_verified->setPixmap(QPixmap(":/icons/checked.png")); + } else { + ui->label_username_verified->setPixmap(QPixmap(":/icons/failed.png")); + ui->label_token_verified->setPixmap(QPixmap(":/icons/failed.png")); + QMessageBox::critical( + this, tr("Verification failed"), + tr("Verification failed. Check that you have entered your username and token " + "correctly, and that your internet connection is working.")); + } +} diff --git a/src/citra_qt/configuration/configure_web.h b/src/citra_qt/configuration/configure_web.h new file mode 100644 index 000000000..ad2d58f6e --- /dev/null +++ b/src/citra_qt/configuration/configure_web.h @@ -0,0 +1,40 @@ +// Copyright 2017 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include <future> +#include <memory> +#include <QWidget> + +namespace Ui { +class ConfigureWeb; +} + +class ConfigureWeb : public QWidget { + Q_OBJECT + +public: + explicit ConfigureWeb(QWidget* parent = nullptr); + ~ConfigureWeb(); + + void applyConfiguration(); + +public slots: + void RefreshTelemetryID(); + void OnLoginChanged(); + void VerifyLogin(); + void OnLoginVerified(); + +signals: + void LoginVerified(); + +private: + void setConfiguration(); + + bool user_verified = true; + std::future<bool> verified; + + std::unique_ptr<Ui::ConfigureWeb> ui; +}; diff --git a/src/citra_qt/configuration/configure_web.ui b/src/citra_qt/configuration/configure_web.ui new file mode 100644 index 000000000..dd996ab62 --- /dev/null +++ b/src/citra_qt/configuration/configure_web.ui @@ -0,0 +1,190 @@ +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> + <class>ConfigureWeb</class> + <widget class="QWidget" name="ConfigureWeb"> + <property name="geometry"> + <rect> + <x>0</x> + <y>0</y> + <width>926</width> + <height>561</height> + </rect> + </property> + <property name="windowTitle"> + <string>Form</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout"> + <item> + <layout class="QVBoxLayout" name="verticalLayout_3"> + <item> + <widget class="QGroupBox" name="groupBoxWebConfig"> + <property name="title"> + <string>Citra Web Service</string> + </property> + <layout class="QVBoxLayout" name="verticalLayoutCitraWebService"> + <item> + <widget class="QLabel" name="web_credentials_disclaimer"> + <property name="text"> + <string>By providing your username and token, you agree to allow Citra to collect additional usage data, which may include user identifying information.</string> + </property> + </widget> + </item> + <item> + <layout class="QGridLayout" name="gridLayoutCitraUsername"> + <item row="2" column="3"> + <widget class="QPushButton" name="button_verify_login"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="layoutDirection"> + <enum>Qt::RightToLeft</enum> + </property> + <property name="text"> + <string>Verify</string> + </property> + </widget> + </item> + <item row="2" column="0"> + <widget class="QLabel" name="web_signup_link"> + <property name="text"> + <string>Sign up</string> + </property> + </widget> + </item> + <item row="0" column="1" colspan="3"> + <widget class="QLineEdit" name="edit_username"> + <property name="maxLength"> + <number>36</number> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_token"> + <property name="text"> + <string>Token: </string> + </property> + </widget> + </item> + <item row="1" column="4"> + <widget class="QLabel" name="label_token_verified"> + </widget> + </item> + <item row="0" column="0"> + <widget class="QLabel" name="label_username"> + <property name="text"> + <string>Username: </string> + </property> + </widget> + </item> + <item row="0" column="4"> + <widget class="QLabel" name="label_username_verified"> + </widget> + </item> + <item row="1" column="1" colspan="3"> + <widget class="QLineEdit" name="edit_token"> + <property name="maxLength"> + <number>36</number> + </property> + <property name="echoMode"> + <enum>QLineEdit::Password</enum> + </property> + </widget> + </item> + <item row="2" column="1"> + <widget class="QLabel" name="web_token_info_link"> + <property name="text"> + <string>What is my token?</string> + </property> + </widget> + </item> + <item row="2" column="2"> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + </layout> + </item> + </layout> + </widget> + </item> + <item> + <widget class="QGroupBox" name="groupBox"> + <property name="title"> + <string>Telemetry</string> + </property> + <layout class="QVBoxLayout" name="verticalLayout_2"> + <item> + <widget class="QCheckBox" name="toggle_telemetry"> + <property name="text"> + <string>Share anonymous usage data with the Citra team</string> + </property> + </widget> + </item> + <item> + <widget class="QLabel" name="telemetry_learn_more"> + <property name="text"> + <string>Learn more</string> + </property> + </widget> + </item> + <item> + <layout class="QGridLayout" name="gridLayoutTelemetryId"> + <item row="0" column="0"> + <widget class="QLabel" name="label_telemetry_id"> + <property name="text"> + <string>Telemetry ID:</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="QPushButton" name="button_regenerate_telemetry_id"> + <property name="sizePolicy"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="layoutDirection"> + <enum>Qt::RightToLeft</enum> + </property> + <property name="text"> + <string>Regenerate</string> + </property> + </widget> + </item> + </layout> + </item> + </layout> + </widget> + </item> + </layout> + </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> + <resources/> + <connections/> +</ui> |