diff options
| author | 2018-01-11 19:21:20 -0700 | |
|---|---|---|
| committer | 2018-01-12 19:11:03 -0700 | |
| commit | ebf9a784a9f7f4148a669dbb39e7cd50df779a14 (patch) | |
| tree | d585685a1c0a34b903af1d086d62560bf56bb29f /src/citra_qt/configuration/configure_web.cpp | |
| parent | config: Default CPU core to Unicorn. (diff) | |
| download | yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.tar.gz yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.tar.xz yuzu-ebf9a784a9f7f4148a669dbb39e7cd50df779a14.zip | |
Massive removal of unused modules
Diffstat (limited to 'src/citra_qt/configuration/configure_web.cpp')
| -rw-r--r-- | src/citra_qt/configuration/configure_web.cpp | 102 |
1 files changed, 0 insertions, 102 deletions
diff --git a/src/citra_qt/configuration/configure_web.cpp b/src/citra_qt/configuration/configure_web.cpp deleted file mode 100644 index bf8c21ac7..000000000 --- a/src/citra_qt/configuration/configure_web.cpp +++ /dev/null | |||
| @@ -1,102 +0,0 @@ | |||
| 1 | // Copyright 2017 Citra Emulator Project | ||
| 2 | // Licensed under GPLv2 or any later version | ||
| 3 | // Refer to the license.txt file included. | ||
| 4 | |||
| 5 | #include <QMessageBox> | ||
| 6 | #include "citra_qt/configuration/configure_web.h" | ||
| 7 | #include "core/settings.h" | ||
| 8 | #include "core/telemetry_session.h" | ||
| 9 | #include "ui_configure_web.h" | ||
| 10 | |||
| 11 | ConfigureWeb::ConfigureWeb(QWidget* parent) | ||
| 12 | : QWidget(parent), ui(std::make_unique<Ui::ConfigureWeb>()) { | ||
| 13 | ui->setupUi(this); | ||
| 14 | connect(ui->button_regenerate_telemetry_id, &QPushButton::clicked, this, | ||
| 15 | &ConfigureWeb::RefreshTelemetryID); | ||
| 16 | connect(ui->button_verify_login, &QPushButton::clicked, this, &ConfigureWeb::VerifyLogin); | ||
| 17 | connect(this, &ConfigureWeb::LoginVerified, this, &ConfigureWeb::OnLoginVerified); | ||
| 18 | |||
| 19 | this->setConfiguration(); | ||
| 20 | } | ||
| 21 | |||
| 22 | ConfigureWeb::~ConfigureWeb() {} | ||
| 23 | |||
| 24 | void ConfigureWeb::setConfiguration() { | ||
| 25 | ui->web_credentials_disclaimer->setWordWrap(true); | ||
| 26 | ui->telemetry_learn_more->setOpenExternalLinks(true); | ||
| 27 | ui->telemetry_learn_more->setText(tr("<a " | ||
| 28 | "href='https://citra-emu.org/entry/" | ||
| 29 | "telemetry-and-why-thats-a-good-thing/'>Learn more</a>")); | ||
| 30 | |||
| 31 | ui->web_signup_link->setOpenExternalLinks(true); | ||
| 32 | ui->web_signup_link->setText(tr("<a href='https://services.citra-emu.org/'>Sign up</a>")); | ||
| 33 | ui->web_token_info_link->setOpenExternalLinks(true); | ||
| 34 | ui->web_token_info_link->setText( | ||
| 35 | tr("<a href='https://citra-emu.org/wiki/citra-web-service/'>What is my token?</a>")); | ||
| 36 | |||
| 37 | ui->toggle_telemetry->setChecked(Settings::values.enable_telemetry); | ||
| 38 | ui->edit_username->setText(QString::fromStdString(Settings::values.citra_username)); | ||
| 39 | ui->edit_token->setText(QString::fromStdString(Settings::values.citra_token)); | ||
| 40 | // Connect after setting the values, to avoid calling OnLoginChanged now | ||
| 41 | connect(ui->edit_token, &QLineEdit::textChanged, this, &ConfigureWeb::OnLoginChanged); | ||
| 42 | connect(ui->edit_username, &QLineEdit::textChanged, this, &ConfigureWeb::OnLoginChanged); | ||
| 43 | ui->label_telemetry_id->setText( | ||
| 44 | tr("Telemetry ID: 0x%1").arg(QString::number(Core::GetTelemetryId(), 16).toUpper())); | ||
| 45 | user_verified = true; | ||
| 46 | } | ||
| 47 | |||
| 48 | void ConfigureWeb::applyConfiguration() { | ||
| 49 | Settings::values.enable_telemetry = ui->toggle_telemetry->isChecked(); | ||
| 50 | if (user_verified) { | ||
| 51 | Settings::values.citra_username = ui->edit_username->text().toStdString(); | ||
| 52 | Settings::values.citra_token = ui->edit_token->text().toStdString(); | ||
| 53 | } else { | ||
| 54 | QMessageBox::warning(this, tr("Username and token not verfied"), | ||
| 55 | tr("Username and token were not verified. The changes to your " | ||
| 56 | "username and/or token have not been saved.")); | ||
| 57 | } | ||
| 58 | Settings::Apply(); | ||
| 59 | } | ||
| 60 | |||
| 61 | void ConfigureWeb::RefreshTelemetryID() { | ||
| 62 | const u64 new_telemetry_id{Core::RegenerateTelemetryId()}; | ||
| 63 | ui->label_telemetry_id->setText( | ||
| 64 | tr("Telemetry ID: 0x%1").arg(QString::number(new_telemetry_id, 16).toUpper())); | ||
| 65 | } | ||
| 66 | |||
| 67 | void ConfigureWeb::OnLoginChanged() { | ||
| 68 | if (ui->edit_username->text().isEmpty() && ui->edit_token->text().isEmpty()) { | ||
| 69 | user_verified = true; | ||
| 70 | ui->label_username_verified->setPixmap(QPixmap(":/icons/checked.png")); | ||
| 71 | ui->label_token_verified->setPixmap(QPixmap(":/icons/checked.png")); | ||
| 72 | } else { | ||
| 73 | user_verified = false; | ||
| 74 | ui->label_username_verified->setPixmap(QPixmap(":/icons/failed.png")); | ||
| 75 | ui->label_token_verified->setPixmap(QPixmap(":/icons/failed.png")); | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| 79 | void ConfigureWeb::VerifyLogin() { | ||
| 80 | verified = | ||
| 81 | Core::VerifyLogin(ui->edit_username->text().toStdString(), | ||
| 82 | ui->edit_token->text().toStdString(), [&]() { emit LoginVerified(); }); | ||
| 83 | ui->button_verify_login->setDisabled(true); | ||
| 84 | ui->button_verify_login->setText(tr("Verifying")); | ||
| 85 | } | ||
| 86 | |||
| 87 | void ConfigureWeb::OnLoginVerified() { | ||
| 88 | ui->button_verify_login->setEnabled(true); | ||
| 89 | ui->button_verify_login->setText(tr("Verify")); | ||
| 90 | if (verified.get()) { | ||
| 91 | user_verified = true; | ||
| 92 | ui->label_username_verified->setPixmap(QPixmap(":/icons/checked.png")); | ||
| 93 | ui->label_token_verified->setPixmap(QPixmap(":/icons/checked.png")); | ||
| 94 | } else { | ||
| 95 | ui->label_username_verified->setPixmap(QPixmap(":/icons/failed.png")); | ||
| 96 | ui->label_token_verified->setPixmap(QPixmap(":/icons/failed.png")); | ||
| 97 | QMessageBox::critical( | ||
| 98 | this, tr("Verification failed"), | ||
| 99 | tr("Verification failed. Check that you have entered your username and token " | ||
| 100 | "correctly, and that your internet connection is working.")); | ||
| 101 | } | ||
| 102 | } | ||