aboutsummaryrefslogtreecommitdiff
path: root/launcher/ui
diff options
context:
space:
mode:
Diffstat (limited to 'launcher/ui')
-rw-r--r--launcher/ui/dialogs/ResourceDownloadDialog.cpp23
-rw-r--r--launcher/ui/dialogs/ResourceDownloadDialog.h2
-rw-r--r--launcher/ui/dialogs/ReviewMessageBox.cpp12
-rw-r--r--launcher/ui/dialogs/ReviewMessageBox.h1
4 files changed, 35 insertions, 3 deletions
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.cpp b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
index 9c28acd9..ca2d409c 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.cpp
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.cpp
@@ -126,6 +126,22 @@ void ResourceDownloadDialog::connectButtons()
static ModPlatform::ProviderCapabilities ProviderCaps;
+QStringList ResourceDownloadDialog::getReqiredBy(QList<QVariant> req_by)
+{
+ auto req = QStringList();
+ auto keys = m_selected.keys();
+ for (auto r : req_by) {
+ for (auto& task : keys) {
+ auto selected = m_selected.constFind(task).value()->getPack();
+ if (selected.addonId == r) {
+ req.append(selected.name);
+ break;
+ }
+ }
+ }
+ return req;
+}
+
void ResourceDownloadDialog::confirm()
{
auto confirm_dialog = ReviewMessageBox::create(this, tr("Confirm %1 to download").arg(resourcesString()));
@@ -162,8 +178,9 @@ void ResourceDownloadDialog::confirm()
keys.sort(Qt::CaseInsensitive);
for (auto& task : keys) {
auto selected = m_selected.constFind(task).value();
+ auto required_by = getReqiredBy(selected->getVersion().required_by);
confirm_dialog->appendResource(
- { task, selected->getFilename(), selected->getCustomPath(), ProviderCaps.name(selected->getProvider()) });
+ { task, selected->getFilename(), selected->getCustomPath(), ProviderCaps.name(selected->getProvider()), required_by });
}
if (confirm_dialog->exec()) {
@@ -261,10 +278,10 @@ GetModDependenciesTask::Ptr ModDownloadDialog::getModDependenciesTask()
{
if (auto model = dynamic_cast<ModFolderModel*>(getBaseModel().get()); model) {
auto keys = m_selected.keys();
- QList<std::shared_ptr<GetModDependenciesTask::PackDependecny>> selectedVers;
+ QList<std::shared_ptr<GetModDependenciesTask::PackDependency>> selectedVers;
for (auto& task : keys) {
auto selected = m_selected.constFind(task).value();
- selectedVers.append(std::make_shared<GetModDependenciesTask::PackDependecny>(selected->getPack(), selected->getVersion()));
+ selectedVers.append(std::make_shared<GetModDependenciesTask::PackDependency>(selected->getPack(), selected->getVersion()));
}
return makeShared<GetModDependenciesTask>(this, m_instance, model, selectedVers);
diff --git a/launcher/ui/dialogs/ResourceDownloadDialog.h b/launcher/ui/dialogs/ResourceDownloadDialog.h
index 9610c8b3..1145f63a 100644
--- a/launcher/ui/dialogs/ResourceDownloadDialog.h
+++ b/launcher/ui/dialogs/ResourceDownloadDialog.h
@@ -83,6 +83,8 @@ class ResourceDownloadDialog : public QDialog, public BasePageProvider {
[[nodiscard]] virtual GetModDependenciesTask::Ptr getModDependenciesTask() { return nullptr; }
+ QStringList getReqiredBy(QList<QVariant> req_by);
+
protected:
const std::shared_ptr<ResourceFolderModel> m_base_model;
diff --git a/launcher/ui/dialogs/ReviewMessageBox.cpp b/launcher/ui/dialogs/ReviewMessageBox.cpp
index 86e68aae..e18519c3 100644
--- a/launcher/ui/dialogs/ReviewMessageBox.cpp
+++ b/launcher/ui/dialogs/ReviewMessageBox.cpp
@@ -60,6 +60,18 @@ void ReviewMessageBox::appendResource(ResourceInformation&& info)
itemTop->insertChildren(childIndx++, { providerItem });
+ if (!info.required_by.isEmpty()) {
+ auto requiredByItem = new QTreeWidgetItem(itemTop);
+ QString req;
+ if (info.required_by.length() == 1)
+ req = info.required_by.back();
+ else
+ req = QString("[%1]").arg(info.required_by.join(", "));
+ requiredByItem->setText(0, tr("Required by: %1").arg(req));
+
+ itemTop->insertChildren(childIndx++, { requiredByItem });
+ }
+
ui->modTreeWidget->addTopLevelItem(itemTop);
}
diff --git a/launcher/ui/dialogs/ReviewMessageBox.h b/launcher/ui/dialogs/ReviewMessageBox.h
index 9579da33..a520cc2a 100644
--- a/launcher/ui/dialogs/ReviewMessageBox.h
+++ b/launcher/ui/dialogs/ReviewMessageBox.h
@@ -17,6 +17,7 @@ class ReviewMessageBox : public QDialog {
QString filename;
QString custom_file_path{};
QString provider;
+ QStringList required_by;
};
void appendResource(ResourceInformation&& info);