fix(RD): set resource strings for ReviewMessageBox too

Signed-off-by: flow <flowlnlnln@gmail.com>
This commit is contained in:
flow 2023-01-08 12:28:55 -03:00
parent 3a168ba6dd
commit bd36f8e220
No known key found for this signature in database
GPG Key ID: 8D0F221F0A59F469
5 changed files with 21 additions and 14 deletions

View File

@ -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() });

View File

@ -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<BasePage*> getPages() override;

View File

@ -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));
}

View File

@ -20,6 +20,8 @@ class ReviewMessageBox : public QDialog {
void appendResource(ResourceInformation&& info);
auto deselectedResources() -> QStringList;
void retranslateUi(QString resources_name);
~ReviewMessageBox() override;
protected:

View File

@ -10,9 +10,6 @@
<height>350</height>
</rect>
</property>
<property name="windowTitle">
<string>Confirm mod selection</string>
</property>
<property name="sizeGripEnabled">
<bool>true</bool>
</property>
@ -39,22 +36,21 @@
<string/>
</property>
</column>
<column>
<property name="text">
<string/>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="explainLabel">
<property name="text">
<string>You're about to download the following mods:</string>
</property>
</widget>
</item>
<item row="5" column="0" rowspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="onlyCheckedLabel">
<property name="text">
<string>Only mods with a check will be downloaded!</string>
</property>
</widget>
</item>
<item>