aboutsummaryrefslogtreecommitdiff
path: root/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
diff options
context:
space:
mode:
authorSefa Eyeoglu <contact@scrumplex.net>2023-08-04 19:42:36 +0200
committerGitHub <noreply@github.com>2023-08-04 19:42:36 +0200
commitae793f6cf11658c9abc5111e82d5ba7b3e6af127 (patch)
treeed41f30e2c0f02e4be1d42324b3f05fbab75b2cd /launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
parent50c7d39e082f0a7dbd977401e16d5adf534d9770 (diff)
parent1d638e018ac40fbfb35dd117f9a948c0cf35eadd (diff)
downloadPrismLauncher-ae793f6cf11658c9abc5111e82d5ba7b3e6af127.tar.gz
PrismLauncher-ae793f6cf11658c9abc5111e82d5ba7b3e6af127.tar.bz2
PrismLauncher-ae793f6cf11658c9abc5111e82d5ba7b3e6af127.zip
Merge pull request #1459 from Scrumplex/format
Diffstat (limited to 'launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp')
-rw-r--r--launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
index bd0b828c..16e375cd 100644
--- a/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
+++ b/launcher/modplatform/modrinth/ModrinthInstanceCreationTask.cpp
@@ -133,10 +133,10 @@ bool ModrinthCreationTask::updateInstance()
}
} else {
// We don't have an old index file, so we may duplicate stuff!
- auto dialog = CustomMessageBox::selectable(m_parent,
- tr("No index file."),
- tr("We couldn't find a suitable index file for the older version. This may cause some of the files to be duplicated. Do you want to continue?"),
- QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Cancel);
+ auto dialog = CustomMessageBox::selectable(m_parent, tr("No index file."),
+ tr("We couldn't find a suitable index file for the older version. This may cause some "
+ "of the files to be duplicated. Do you want to continue?"),
+ QMessageBox::Warning, QMessageBox::Ok | QMessageBox::Cancel);
if (dialog->exec() == QDialog::DialogCode::Rejected) {
m_abort = true;
@@ -144,7 +144,6 @@ bool ModrinthCreationTask::updateInstance()
}
}
-
setOverride(true, inst->id());
qDebug() << "Will override instance!";
@@ -233,7 +232,8 @@ bool ModrinthCreationTask::createInstance()
auto file_path = FS::PathCombine(root_modpack_path, file.path);
if (!root_modpack_url.isParentOf(QUrl::fromLocalFile(file_path))) {
// This means we somehow got out of the root folder, so abort here to prevent exploits
- setError(tr("One of the files has a path that leads to an arbitrary location (%1). This is a security risk and isn't allowed.").arg(file.path));
+ setError(tr("One of the files has a path that leads to an arbitrary location (%1). This is a security risk and isn't allowed.")
+ .arg(file.path));
return false;
}
@@ -250,7 +250,8 @@ bool ModrinthCreationTask::createInstance()
auto ndl = Net::Download::makeFile(file.downloads.dequeue(), file_path);
ndl->addValidator(new Net::ChecksumValidator(file.hashAlgorithm, file.hash));
m_files_job->addNetAction(ndl);
- if (auto shared = param.lock()) shared->succeeded();
+ if (auto shared = param.lock())
+ shared->succeeded();
});
}
}
@@ -263,9 +264,9 @@ bool ModrinthCreationTask::createInstance()
setError(reason);
});
connect(m_files_job.get(), &NetJob::finished, &loop, &QEventLoop::quit);
- connect(m_files_job.get(), &NetJob::progress, [&](qint64 current, qint64 total) {
+ connect(m_files_job.get(), &NetJob::progress, [&](qint64 current, qint64 total) {
setDetails(tr("%1 out of %2 complete").arg(current).arg(total));
- setProgress(current, total);
+ setProgress(current, total);
});
connect(m_files_job.get(), &NetJob::stepProgress, this, &ModrinthCreationTask::propagateStepProgress);
@@ -293,7 +294,10 @@ bool ModrinthCreationTask::createInstance()
return ended_well;
}
-bool ModrinthCreationTask::parseManifest(const QString& index_path, std::vector<Modrinth::File>& files, bool set_internal_data, bool show_optional_dialog)
+bool ModrinthCreationTask::parseManifest(const QString& index_path,
+ std::vector<Modrinth::File>& files,
+ bool set_internal_data,
+ bool show_optional_dialog)
{
try {
auto doc = Json::requireDocument(index_path);