mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2024-11-25 19:05:42 +01:00
qt: Add service dialog
This commit is contained in:
parent
5d86c52a3a
commit
e55d086cc9
@ -364,18 +364,17 @@ void SynchronizeInternal(DirectoryGetter dir_getter, TitleIDVersion title,
|
|||||||
|
|
||||||
bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) {
|
bool Boxcat::Synchronize(TitleIDVersion title, ProgressServiceBackend& progress) {
|
||||||
is_syncing.exchange(true);
|
is_syncing.exchange(true);
|
||||||
std::thread([this, title, &progress] {
|
std::thread([this, title, &progress] { SynchronizeInternal(dir_getter, title, progress); })
|
||||||
SynchronizeInternal(dir_getter, title, progress);
|
.detach();
|
||||||
}).detach();
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name,
|
bool Boxcat::SynchronizeDirectory(TitleIDVersion title, std::string name,
|
||||||
ProgressServiceBackend& progress) {
|
ProgressServiceBackend& progress) {
|
||||||
is_syncing.exchange(true);
|
is_syncing.exchange(true);
|
||||||
std::thread([this, title, name, &progress] {
|
std::thread(
|
||||||
SynchronizeInternal(dir_getter, title, progress, name);
|
[this, title, name, &progress] { SynchronizeInternal(dir_getter, title, progress, name); })
|
||||||
}).detach();
|
.detach();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,6 +68,7 @@ add_executable(yuzu
|
|||||||
configuration/configure_profile_manager.ui
|
configuration/configure_profile_manager.ui
|
||||||
configuration/configure_service.cpp
|
configuration/configure_service.cpp
|
||||||
configuration/configure_service.h
|
configuration/configure_service.h
|
||||||
|
configuration/configure_service.ui
|
||||||
configuration/configure_system.cpp
|
configuration/configure_system.cpp
|
||||||
configuration/configure_system.h
|
configuration/configure_system.h
|
||||||
configuration/configure_system.ui
|
configuration/configure_system.ui
|
||||||
|
@ -75,7 +75,8 @@ Q_DECLARE_METATYPE(QList<QWidget*>);
|
|||||||
void ConfigureDialog::PopulateSelectionList() {
|
void ConfigureDialog::PopulateSelectionList() {
|
||||||
const std::array<std::pair<QString, QList<QWidget*>>, 4> items{
|
const std::array<std::pair<QString, QList<QWidget*>>, 4> items{
|
||||||
{{tr("General"), {ui->generalTab, ui->webTab, ui->debugTab, ui->gameListTab}},
|
{{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("Graphics"), {ui->graphicsTab}},
|
||||||
{tr("Controls"), {ui->inputTab, ui->hotkeysTab}}},
|
{tr("Controls"), {ui->inputTab, ui->hotkeysTab}}},
|
||||||
};
|
};
|
||||||
@ -109,6 +110,7 @@ void ConfigureDialog::UpdateVisibleTabs() {
|
|||||||
{ui->webTab, tr("Web")},
|
{ui->webTab, tr("Web")},
|
||||||
{ui->gameListTab, tr("Game List")},
|
{ui->gameListTab, tr("Game List")},
|
||||||
{ui->filesystemTab, tr("Filesystem")},
|
{ui->filesystemTab, tr("Filesystem")},
|
||||||
|
{ui->serviceTab, tr("Services")},
|
||||||
};
|
};
|
||||||
|
|
||||||
[[maybe_unused]] const QSignalBlocker blocker(ui->tabWidget);
|
[[maybe_unused]] const QSignalBlocker blocker(ui->tabWidget);
|
||||||
|
@ -20,7 +20,7 @@ QString FormatEventStatusString(const Service::BCAT::EventStatus& status) {
|
|||||||
if (status.events.size() == 1) {
|
if (status.events.size() == 1) {
|
||||||
out += QStringLiteral("%1<br>").arg(QString::fromStdString(status.events.front()));
|
out += QStringLiteral("%1<br>").arg(QString::fromStdString(status.events.front()));
|
||||||
} else {
|
} else {
|
||||||
for (const auto event : status.events) {
|
for (const auto& event : status.events) {
|
||||||
out += QStringLiteral("- %1<br>").arg(QString::fromStdString(event));
|
out += QStringLiteral("- %1<br>").arg(QString::fromStdString(event));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ QString FormatEventStatusString(const Service::BCAT::EventStatus& status) {
|
|||||||
} // Anonymous namespace
|
} // Anonymous namespace
|
||||||
|
|
||||||
ConfigureService::ConfigureService(QWidget* parent)
|
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->setupUi(this);
|
||||||
|
|
||||||
ui->bcat_source->addItem(QStringLiteral("None"));
|
ui->bcat_source->addItem(QStringLiteral("None"));
|
||||||
@ -62,7 +62,8 @@ void ConfigureService::RetranslateUi() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureService::SetConfiguration() {
|
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);
|
ui->bcat_source->setCurrentIndex(index == -1 ? 0 : index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,14 +74,14 @@ std::pair<QString, QString> ConfigureService::BCATDownloadEvents() {
|
|||||||
|
|
||||||
switch (res) {
|
switch (res) {
|
||||||
case Service::BCAT::Boxcat::StatusResult::Offline:
|
case Service::BCAT::Boxcat::StatusResult::Offline:
|
||||||
return {QStringLiteral(""),
|
return {QString{},
|
||||||
tr("The boxcat service is offline or you are not connected to the internet.")};
|
tr("The boxcat service is offline or you are not connected to the internet.")};
|
||||||
case Service::BCAT::Boxcat::StatusResult::ParseError:
|
case Service::BCAT::Boxcat::StatusResult::ParseError:
|
||||||
return {QStringLiteral(""),
|
return {QString{},
|
||||||
tr("There was an error while processing the boxcat event data. Contact the yuzu "
|
tr("There was an error while processing the boxcat event data. Contact the yuzu "
|
||||||
"developers.")};
|
"developers.")};
|
||||||
case Service::BCAT::Boxcat::StatusResult::BadClientVersion:
|
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. "
|
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.")};
|
"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) {
|
for (const auto& [key, value] : map) {
|
||||||
out += QStringLiteral("%1<b>%2</b><br>%3")
|
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(QString::fromStdString(key))
|
||||||
.arg(FormatEventStatusString(value));
|
.arg(FormatEventStatusString(value));
|
||||||
}
|
}
|
||||||
return {QStringLiteral("Current Boxcat Events"), out};
|
return {QStringLiteral("Current Boxcat Events"), std::move(out)};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConfigureService::OnBCATImplChanged() {
|
void ConfigureService::OnBCATImplChanged() {
|
||||||
@ -110,7 +111,7 @@ void ConfigureService::OnBCATImplChanged() {
|
|||||||
const auto boxcat = ui->bcat_source->currentText() == QStringLiteral("Boxcat");
|
const auto boxcat = ui->bcat_source->currentText() == QStringLiteral("Boxcat");
|
||||||
ui->bcat_empty_header->setHidden(!boxcat);
|
ui->bcat_empty_header->setHidden(!boxcat);
|
||||||
ui->bcat_empty_label->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..."));
|
ui->bcat_empty_label->setText(tr("Yuzu is retrieving the latest boxcat status..."));
|
||||||
|
|
||||||
if (!boxcat)
|
if (!boxcat)
|
||||||
|
@ -30,5 +30,5 @@ private:
|
|||||||
void OnUpdateBCATEmptyLabel(std::pair<QString, QString> string);
|
void OnUpdateBCATEmptyLabel(std::pair<QString, QString> string);
|
||||||
|
|
||||||
std::unique_ptr<Ui::ConfigureService> ui;
|
std::unique_ptr<Ui::ConfigureService> ui;
|
||||||
QFutureWatcher<std::pair<QString, QString>> watcher;
|
QFutureWatcher<std::pair<QString, QString>> watcher{this};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user