From fb17e866aa58db05d4d16ba861b1150e6187592e Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 22 Aug 2017 23:36:57 -0400 Subject: [PATCH] qt: Add web configuration tab. --- src/citra_qt/CMakeLists.txt | 3 + src/citra_qt/configuration/configure.ui | 15 ++- .../configuration/configure_dialog.cpp | 1 + src/citra_qt/configuration/configure_web.cpp | 44 ++++++ src/citra_qt/configuration/configure_web.h | 30 +++++ src/citra_qt/configuration/configure_web.ui | 126 ++++++++++++++++++ 6 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 src/citra_qt/configuration/configure_web.cpp create mode 100644 src/citra_qt/configuration/configure_web.h create mode 100644 src/citra_qt/configuration/configure_web.ui diff --git a/src/citra_qt/CMakeLists.txt b/src/citra_qt/CMakeLists.txt index f364b22843..e0a19fd9e7 100644 --- a/src/citra_qt/CMakeLists.txt +++ b/src/citra_qt/CMakeLists.txt @@ -12,6 +12,7 @@ set(SRCS configuration/configure_graphics.cpp configuration/configure_input.cpp configuration/configure_system.cpp + configuration/configure_web.cpp debugger/graphics/graphics.cpp debugger/graphics/graphics_breakpoint_observer.cpp debugger/graphics/graphics_breakpoints.cpp @@ -42,6 +43,7 @@ set(HEADERS configuration/configure_graphics.h configuration/configure_input.h configuration/configure_system.h + configuration/configure_web.h debugger/graphics/graphics.h debugger/graphics/graphics_breakpoint_observer.h debugger/graphics/graphics_breakpoints.h @@ -71,6 +73,7 @@ set(UIS configuration/configure_graphics.ui configuration/configure_input.ui configuration/configure_system.ui + configuration/configure_web.ui debugger/registers.ui hotkeys.ui main.ui diff --git a/src/citra_qt/configuration/configure.ui b/src/citra_qt/configuration/configure.ui index 85e206e427..6abd1917ea 100644 --- a/src/citra_qt/configuration/configure.ui +++ b/src/citra_qt/configuration/configure.ui @@ -6,8 +6,8 @@ 0 0 - 441 - 501 + 740 + 500 @@ -49,6 +49,11 @@ Debug + + + Web + + @@ -97,6 +102,12 @@
configuration/configure_graphics.h
1 + + ConfigureWeb + QWidget +
configuration/configure_web.h
+ 1 +
diff --git a/src/citra_qt/configuration/configure_dialog.cpp b/src/citra_qt/configuration/configure_dialog.cpp index dfc8c03a7a..b87dc0e6c0 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_web.cpp b/src/citra_qt/configuration/configure_web.cpp new file mode 100644 index 0000000000..fff466aaac --- /dev/null +++ b/src/citra_qt/configuration/configure_web.cpp @@ -0,0 +1,44 @@ +// Copyright 2017 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#include "citra_qt/configuration/configure_web.h" +#include "core/settings.h" +#include "ui_configure_web.h" + +ConfigureWeb::ConfigureWeb(QWidget* parent) + : QWidget(parent), ui(std::make_unique()) { + ui->setupUi(this); + this->setConfiguration(); +} + +ConfigureWeb::~ConfigureWeb() {} + +void ConfigureWeb::setConfiguration() { + ui->web_credentials_disclaimer->setWordWrap(true); + ui->telemetry_learn_more->setOpenExternalLinks(true); + ui->telemetry_learn_more->setText("Learn more"); + + ui->web_signup_link->setOpenExternalLinks(true); + ui->web_signup_link->setText("Sign up"); + ui->web_token_info_link->setOpenExternalLinks(true); + ui->web_token_info_link->setText( + "What is my token?"); + + 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)); + + updateWeb(); +} + +void ConfigureWeb::applyConfiguration() { + Settings::values.enable_telemetry = ui->toggle_telemetry->isChecked(); + Settings::values.citra_username = ui->edit_username->text().toStdString(); + Settings::values.citra_token = ui->edit_token->text().toStdString(); + Settings::Apply(); +} + +void ConfigureWeb::updateWeb() {} diff --git a/src/citra_qt/configuration/configure_web.h b/src/citra_qt/configuration/configure_web.h new file mode 100644 index 0000000000..2c37b8f90c --- /dev/null +++ b/src/citra_qt/configuration/configure_web.h @@ -0,0 +1,30 @@ +// Copyright 2017 Citra Emulator Project +// Licensed under GPLv2 or any later version +// Refer to the license.txt file included. + +#pragma once + +#include +#include + +namespace Ui { +class ConfigureWeb; +} + +class ConfigureWeb : public QWidget { + Q_OBJECT + +public: + explicit ConfigureWeb(QWidget* parent = nullptr); + ~ConfigureWeb(); + + void applyConfiguration(); + +public slots: + void updateWeb(); + +private: + void setConfiguration(); + + std::unique_ptr ui; +}; diff --git a/src/citra_qt/configuration/configure_web.ui b/src/citra_qt/configuration/configure_web.ui new file mode 100644 index 0000000000..3bb8276fa2 --- /dev/null +++ b/src/citra_qt/configuration/configure_web.ui @@ -0,0 +1,126 @@ + + + ConfigureWeb + + + + 0 + 0 + 400 + 300 + + + + Form + + + + + + + + Citra Web Service + + + + + + By providing your username and token, you agree to allow Citra to collect additional usage data, which may include user identifying information. + + + + + + + + + Username: + + + + + + + 36 + + + + + + + Token: + + + + + + + 36 + + + QLineEdit::Password + + + + + + + Sign up + + + + + + + What is my token? + + + + + + + + + + + + Telemetry + + + + + + Share anonymous usage data with the Citra team + + + + + + + Learn more + + + + + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + +