qt: Add service dialog
This commit is contained in:
		| @@ -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; | ||||
| } | ||||
|  | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -75,7 +75,8 @@ Q_DECLARE_METATYPE(QList<QWidget*>); | ||||
| void ConfigureDialog::PopulateSelectionList() { | ||||
|     const std::array<std::pair<QString, QList<QWidget*>>, 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); | ||||
|   | ||||
| @@ -20,7 +20,7 @@ QString FormatEventStatusString(const Service::BCAT::EventStatus& status) { | ||||
|     if (status.events.size() == 1) { | ||||
|         out += QStringLiteral("%1<br>").arg(QString::fromStdString(status.events.front())); | ||||
|     } else { | ||||
|         for (const auto event : status.events) { | ||||
|         for (const auto& event : status.events) { | ||||
|             out += QStringLiteral("- %1<br>").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<Ui::ConfigureService>()), watcher(this) { | ||||
|     : QWidget(parent), ui(std::make_unique<Ui::ConfigureService>()) { | ||||
|     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<QString, QString> 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<QString, QString> ConfigureService::BCATDownloadEvents() { | ||||
|  | ||||
|     for (const auto& [key, value] : map) { | ||||
|         out += QStringLiteral("%1<b>%2</b><br>%3") | ||||
|                    .arg(out.isEmpty() ? QStringLiteral("") : QStringLiteral("<br>")) | ||||
|                    .arg(out.isEmpty() ? QString{} : QStringLiteral("<br>")) | ||||
|                    .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) | ||||
|   | ||||
| @@ -30,5 +30,5 @@ private: | ||||
|     void OnUpdateBCATEmptyLabel(std::pair<QString, QString> string); | ||||
|  | ||||
|     std::unique_ptr<Ui::ConfigureService> ui; | ||||
|     QFutureWatcher<std::pair<QString, QString>> watcher; | ||||
|     QFutureWatcher<std::pair<QString, QString>> watcher{this}; | ||||
| }; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user