From e55d086cc93ea33829e77a2e92be52bcf900767b Mon Sep 17 00:00:00 2001 From: Zach Hilman Date: Wed, 2 Oct 2019 08:35:39 -0400 Subject: [PATCH] qt: Add service dialog --- src/core/hle/service/bcat/backend/boxcat.cpp | 11 +++++------ src/yuzu/CMakeLists.txt | 1 + src/yuzu/configuration/configure_dialog.cpp | 4 +++- src/yuzu/configuration/configure_service.cpp | 19 ++++++++++--------- src/yuzu/configuration/configure_service.h | 2 +- 5 files changed, 20 insertions(+), 17 deletions(-) diff --git a/src/core/hle/service/bcat/backend/boxcat.cpp b/src/core/hle/service/bcat/backend/boxcat.cpp index 36eb2c0945..e6ee0810b2 100644 --- a/src/core/hle/service/bcat/backend/boxcat.cpp +++ b/src/core/hle/service/bcat/backend/boxcat.cpp @@ -364,18 +364,17 @@ void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title, bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) { is_syncing.exchange(true); - std::thread([this, title, &progress] { - SynchronizeInternal(dir_getter, title, progress); - }).detach(); + std::thread([this, title, &progress] { SynchronizeInternal(dir_getter, title, progress); }) + .detach(); return true; } bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name, ProgressServiceBackend& progress) { is_syncing.exchange(true); - std::thread([this, title, name, &progress] { - SynchronizeInternal(dir_getter, title, progress, name); - }).detach(); + std::thread( + [this, title, name, &progress] { SynchronizeInternal(dir_getter, title, progress, name); }) + .detach(); return true; } diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt index fffb202204..ff1c1d9856 100644 --- a/src/yuzu/CMakeLists.txt +++ b/src/yuzu/CMakeLists.txt @@ -68,6 +68,7 @@ add_executable(yuzu configuration/configure_profile_manager.ui configuration/configure_service.cpp configuration/configure_service.h + configuration/configure_service.ui configuration/configure_system.cpp configuration/configure_system.h configuration/configure_system.ui diff --git a/src/yuzu/configuration/configure_dialog.cpp b/src/yuzu/configuration/configure_dialog.cpp index 520b7e1938..25b2e1b05b 100644 --- a/src/yuzu/configuration/configure_dialog.cpp +++ b/src/yuzu/configuration/configure_dialog.cpp @@ -75,7 +75,8 @@ Q_DECLARE_METATYPE(QList); void ConfigureDialog::PopulateSelectionList() { const std::array>, 4> items{ {{tr("General"), {ui->generalTab, ui->webTab, ui->debugTab, ui->gameListTab}}, - {tr("System"), {ui->systemTab, ui->profileManagerTab, ui->filesystemTab, ui->audioTab}}, + {tr("System"), + {ui->systemTab, ui->profileManagerTab, ui->serviceTab, ui->filesystemTab, ui->audioTab}}, {tr("Graphics"), {ui->graphicsTab}}, {tr("Controls"), {ui->inputTab, ui->hotkeysTab}}}, }; @@ -109,6 +110,7 @@ void ConfigureDialog::UpdateVisibleTabs() { {ui->webTab, tr("Web")}, {ui->gameListTab, tr("Game List")}, {ui->filesystemTab, tr("Filesystem")}, + {ui->serviceTab, tr("Services")}, }; [[maybe_unused]] const QSignalBlocker blocker(ui->tabWidget); diff --git a/src/yuzu/configuration/configure_service.cpp b/src/yuzu/configuration/configure_service.cpp index 86160b4791..81c9e933f3 100644 --- a/src/yuzu/configuration/configure_service.cpp +++ b/src/yuzu/configuration/configure_service.cpp @@ -20,7 +20,7 @@ QString FormatEventStatusString(const Service::BCAT::EventStatus& status) { if (status.events.size() == 1) { out += QStringLiteral("%1
").arg(QString::fromStdString(status.events.front())); } else { - for (const auto event : status.events) { + for (const auto& event : status.events) { out += QStringLiteral("- %1
").arg(QString::fromStdString(event)); } } @@ -34,7 +34,7 @@ QString FormatEventStatusString(const Service::BCAT::EventStatus& status) { } // Anonymous namespace ConfigureService::ConfigureService(QWidget* parent) - : QWidget(parent), ui(std::make_unique()), watcher(this) { + : QWidget(parent), ui(std::make_unique()) { ui->setupUi(this); ui->bcat_source->addItem(QStringLiteral("None")); @@ -62,7 +62,8 @@ void ConfigureService::RetranslateUi() { } void ConfigureService::SetConfiguration() { - int index = ui->bcat_source->findData(QString::fromStdString(Settings::values.bcat_backend)); + const int index = + ui->bcat_source->findData(QString::fromStdString(Settings::values.bcat_backend)); ui->bcat_source->setCurrentIndex(index == -1 ? 0 : index); } @@ -73,14 +74,14 @@ std::pair ConfigureService::BCATDownloadEvents() { switch (res) { case Service::BCAT::Boxcat::StatusResult::Offline: - return {QStringLiteral(""), + return {QString{}, tr("The boxcat service is offline or you are not connected to the internet.")}; case Service::BCAT::Boxcat::StatusResult::ParseError: - return {QStringLiteral(""), + return {QString{}, tr("There was an error while processing the boxcat event data. Contact the yuzu " "developers.")}; case Service::BCAT::Boxcat::StatusResult::BadClientVersion: - return {QStringLiteral(""), + return {QString{}, tr("The version of yuzu you are using is either too new or too old for the server. " "Try updating to the latest official release of yuzu.")}; } @@ -98,11 +99,11 @@ std::pair ConfigureService::BCATDownloadEvents() { for (const auto& [key, value] : map) { out += QStringLiteral("%1%2
%3") - .arg(out.isEmpty() ? QStringLiteral("") : QStringLiteral("
")) + .arg(out.isEmpty() ? QString{} : QStringLiteral("
")) .arg(QString::fromStdString(key)) .arg(FormatEventStatusString(value)); } - return {QStringLiteral("Current Boxcat Events"), out}; + return {QStringLiteral("Current Boxcat Events"), std::move(out)}; } void ConfigureService::OnBCATImplChanged() { @@ -110,7 +111,7 @@ void ConfigureService::OnBCATImplChanged() { const auto boxcat = ui->bcat_source->currentText() == QStringLiteral("Boxcat"); ui->bcat_empty_header->setHidden(!boxcat); ui->bcat_empty_label->setHidden(!boxcat); - ui->bcat_empty_header->setText(QStringLiteral("")); + ui->bcat_empty_header->setText(QString{}); ui->bcat_empty_label->setText(tr("Yuzu is retrieving the latest boxcat status...")); if (!boxcat) diff --git a/src/yuzu/configuration/configure_service.h b/src/yuzu/configuration/configure_service.h index efc8e21a83..f5c1b703a8 100644 --- a/src/yuzu/configuration/configure_service.h +++ b/src/yuzu/configuration/configure_service.h @@ -30,5 +30,5 @@ private: void OnUpdateBCATEmptyLabel(std::pair string); std::unique_ptr ui; - QFutureWatcher> watcher; + QFutureWatcher> watcher{this}; };