From bd36f8e220fb3019b0a9588b21ed1cbce5afbf93 Mon Sep 17 00:00:00 2001 From: flow Date: Sun, 8 Jan 2023 12:28:55 -0300 Subject: [PATCH] fix(RD): set resource strings for ReviewMessageBox too Signed-off-by: flow --- launcher/ui/dialogs/ResourceDownloadDialog.cpp | 5 +++-- launcher/ui/dialogs/ResourceDownloadDialog.h | 6 +++--- launcher/ui/dialogs/ReviewMessageBox.cpp | 8 ++++++++ launcher/ui/dialogs/ReviewMessageBox.h | 2 ++ launcher/ui/dialogs/ReviewMessageBox.ui | 14 +++++--------- 5 files changed, 21 insertions(+), 14 deletions(-) diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp index fa3352b3..147373c9 100644 --- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp +++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp @@ -99,7 +99,7 @@ void ResourceDownloadDialog::initializeContainer() void ResourceDownloadDialog::connectButtons() { auto OkButton = m_buttons.button(QDialogButtonBox::Ok); - OkButton->setToolTip(tr("Opens a new popup to review your selected %1 and confirm your selection. Shortcut: Ctrl+Return").arg(resourceString())); + OkButton->setToolTip(tr("Opens a new popup to review your selected %1 and confirm your selection. Shortcut: Ctrl+Return").arg(resourcesString())); connect(OkButton, &QPushButton::clicked, this, &ResourceDownloadDialog::confirm); auto CancelButton = m_buttons.button(QDialogButtonBox::Cancel); @@ -114,7 +114,8 @@ void ResourceDownloadDialog::confirm() auto keys = m_selected.keys(); keys.sort(Qt::CaseInsensitive); - auto confirm_dialog = ReviewMessageBox::create(this, tr("Confirm %1 to download").arg(resourceString())); + auto confirm_dialog = ReviewMessageBox::create(this, tr("Confirm %1 to download").arg(resourcesString())); + confirm_dialog->retranslateUi(resourcesString()); for (auto& task : keys) { confirm_dialog->appendResource({ task, m_selected.find(task).value()->getFilename() }); diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.h b/launcher/ui/dialogs/ResourceDownloadDialog.h index 34120350..19843532 100644 --- a/launcher/ui/dialogs/ResourceDownloadDialog.h +++ b/launcher/ui/dialogs/ResourceDownloadDialog.h @@ -52,9 +52,9 @@ class ResourceDownloadDialog : public QDialog, public BasePageProvider { void connectButtons(); //: String that gets appended to the download dialog title ("Download " + resourcesString()) - [[nodiscard]] virtual QString resourceString() const { return tr("resources"); } + [[nodiscard]] virtual QString resourcesString() const { return tr("resources"); } - QString dialogTitle() override { return tr("Download %1").arg(resourceString()); }; + QString dialogTitle() override { return tr("Download %1").arg(resourcesString()); }; bool selectPage(QString pageId); ResourcePage* getSelectedPage(); @@ -99,7 +99,7 @@ class ModDownloadDialog final : public ResourceDownloadDialog { ~ModDownloadDialog() override = default; //: String that gets appended to the mod download dialog title ("Download " + resourcesString()) - [[nodiscard]] QString resourceString() const override { return tr("mods"); } + [[nodiscard]] QString resourcesString() const override { return tr("mods"); } [[nodiscard]] QString geometrySaveKey() const override { return "ModDownloadGeometry"; } QList getPages() override; diff --git a/launcher/ui/dialogs/ReviewMessageBox.cpp b/launcher/ui/dialogs/ReviewMessageBox.cpp index f45a9c4a..9c638d1f 100644 --- a/launcher/ui/dialogs/ReviewMessageBox.cpp +++ b/launcher/ui/dialogs/ReviewMessageBox.cpp @@ -55,3 +55,11 @@ auto ReviewMessageBox::deselectedResources() -> QStringList return list; } + +void ReviewMessageBox::retranslateUi(QString resources_name) +{ + setWindowTitle(tr("Confirm %1 selection").arg(resources_name)); + + ui->explainLabel->setText(tr("You're about to download the following %1:").arg(resources_name)); + ui->onlyCheckedLabel->setText(tr("Only %1 with a check will be downloaded!").arg(resources_name)); +} diff --git a/launcher/ui/dialogs/ReviewMessageBox.h b/launcher/ui/dialogs/ReviewMessageBox.h index e2d0ce37..7ee0d65d 100644 --- a/launcher/ui/dialogs/ReviewMessageBox.h +++ b/launcher/ui/dialogs/ReviewMessageBox.h @@ -20,6 +20,8 @@ class ReviewMessageBox : public QDialog { void appendResource(ResourceInformation&& info); auto deselectedResources() -> QStringList; + void retranslateUi(QString resources_name); + ~ReviewMessageBox() override; protected: diff --git a/launcher/ui/dialogs/ReviewMessageBox.ui b/launcher/ui/dialogs/ReviewMessageBox.ui index ab3bcc2f..bf53ae80 100644 --- a/launcher/ui/dialogs/ReviewMessageBox.ui +++ b/launcher/ui/dialogs/ReviewMessageBox.ui @@ -10,9 +10,6 @@ 350 - - Confirm mod selection - true @@ -39,22 +36,21 @@ + + + + + - - You're about to download the following mods: - - - Only mods with a check will be downloaded! -