summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/logic/FolderInstanceProvider.cpp4
-rw-r--r--api/logic/InstanceImportTask.cpp40
-rw-r--r--api/logic/minecraft/flame/FileResolvingTask.cpp6
-rw-r--r--api/logic/tasks/Task.cpp10
-rw-r--r--api/logic/tasks/Task.h6
-rw-r--r--application/MainWindow.cpp6
6 files changed, 57 insertions, 15 deletions
diff --git a/api/logic/FolderInstanceProvider.cpp b/api/logic/FolderInstanceProvider.cpp
index 74ac456a..cd988f00 100644
--- a/api/logic/FolderInstanceProvider.cpp
+++ b/api/logic/FolderInstanceProvider.cpp
@@ -373,6 +373,10 @@ protected:
{
m_child->start();
}
+ QStringList warnings() const override
+ {
+ return m_child->warnings();
+ }
private slots:
void childSucceded()
diff --git a/api/logic/InstanceImportTask.cpp b/api/logic/InstanceImportTask.cpp
index 80f68458..046f885d 100644
--- a/api/logic/InstanceImportTask.cpp
+++ b/api/logic/InstanceImportTask.cpp
@@ -150,7 +150,7 @@ void InstanceImportTask::extractFinished()
{
if(!QFile::setPermissions(filepath, permissions))
{
- qWarning() << "Could not fix" << filepath;
+ logWarning(tr("Could not fix permissions for %1").arg(filepath));
}
else
{
@@ -213,7 +213,7 @@ void InstanceImportTask::processFlame()
}
else
{
- qWarning() << "The specified overrides folder is missing. Maybe the modpack was already used before?";
+ logWarning(tr("The specified overrides folder (%1) is missing. Maybe the modpack was already used before?").arg(pack.overrides));
}
}
@@ -227,7 +227,7 @@ void InstanceImportTask::processFlame()
forgeVersion = id;
continue;
}
- qWarning() << "Unknown mod loader in manifest:" << id;
+ logWarning(tr("Unknown mod loader in manifest: %1").arg(id));
}
QString configPath = FS::PathCombine(m_stagingPath, "instance.cfg");
@@ -240,7 +240,7 @@ void InstanceImportTask::processFlame()
if(mcVersion.endsWith('.'))
{
mcVersion.remove(QRegExp("[.]+$"));
- qWarning() << "Mysterious trailing dots removed from Minecraft version while importing pack.";
+ logWarning(tr("Mysterious trailing dots removed from Minecraft version while importing pack."));
}
auto components = instance.getComponentList();
components->buildingFromScratch();
@@ -256,7 +256,7 @@ void InstanceImportTask::processFlame()
}
else
{
- qWarning() << "Could not map recommended forge version for" << mcVersion;
+ logWarning(tr("Could not map recommended forge version for Minecraft %1").arg(mcVersion));
}
}
components->setComponentVersion("net.minecraftforge", forgeVersion);
@@ -313,9 +313,33 @@ void InstanceImportTask::processFlame()
{
filename += ".disabled";
}
- auto path = FS::PathCombine(m_stagingPath ,"minecraft", result.targetFolder, filename);
- auto dl = Net::Download::makeFile(result.url, path);
- m_filesNetJob->addNetAction(dl);
+
+ auto relpath = FS::PathCombine("minecraft", result.targetFolder, filename);
+ auto path = FS::PathCombine(m_stagingPath , relpath);
+
+ switch(result.type)
+ {
+ case Flame::File::Type::Folder:
+ {
+ logWarning(tr("This 'Folder' may need extracting: %1").arg(relpath));
+ // fall-through intentional, we treat these as plain old mods and dump them wherever.
+ }
+ case Flame::File::Type::SingleFile:
+ case Flame::File::Type::Mod:
+ {
+ auto dl = Net::Download::makeFile(result.url, path);
+ m_filesNetJob->addNetAction(dl);
+ break;
+ }
+ case Flame::File::Type::Modpack:
+ logWarning(tr("Nesting modpacks in modpacks is not implemented, nothing was downloaded: %1").arg(relpath));
+ break;
+ case Flame::File::Type::Cmod2:
+ case Flame::File::Type::Ctoc:
+ case Flame::File::Type::Unknown:
+ logWarning(tr("Unrecognized/unhandled PackageType for: %1").arg(relpath));
+ break;
+ }
}
m_modIdResolver.reset();
connect(m_filesNetJob.get(), &NetJob::succeeded, this, [&]()
diff --git a/api/logic/minecraft/flame/FileResolvingTask.cpp b/api/logic/minecraft/flame/FileResolvingTask.cpp
index 2194983a..af8ef7aa 100644
--- a/api/logic/minecraft/flame/FileResolvingTask.cpp
+++ b/api/logic/minecraft/flame/FileResolvingTask.cpp
@@ -59,8 +59,6 @@ void Flame::FileResolvingTask::netJobFinished()
{
out.type = File::Type::SingleFile;
}
- // FIXME: what are these?
- /*
else if(strType == "ctoc")
{
out.type = File::Type::Ctoc;
@@ -69,13 +67,10 @@ void Flame::FileResolvingTask::netJobFinished()
{
out.type = File::Type::Cmod2;
}
- */
else if(strType == "mod")
{
out.type = File::Type::Mod;
}
- // FIXME: how to handle nested packs and folders?
- /*
else if(strType == "folder")
{
out.type = File::Type::Folder;
@@ -84,7 +79,6 @@ void Flame::FileResolvingTask::netJobFinished()
{
out.type = File::Type::Modpack;
}
- */
else
{
qCritical() << "Resolving of" << out.projectId << out.fileId << "failed because of unknown file type:" << strType;
diff --git a/api/logic/tasks/Task.cpp b/api/logic/tasks/Task.cpp
index bc48e902..9cd67e46 100644
--- a/api/logic/tasks/Task.cpp
+++ b/api/logic/tasks/Task.cpp
@@ -134,3 +134,13 @@ QString Task::failReason() const
return m_failReason;
}
+void Task::logWarning(const QString& line)
+{
+ qWarning() << line;
+ m_Warnings.append(line);
+}
+
+QStringList Task::warnings() const
+{
+ return m_Warnings;
+}
diff --git a/api/logic/tasks/Task.h b/api/logic/tasks/Task.h
index f54996c1..f7a508e9 100644
--- a/api/logic/tasks/Task.h
+++ b/api/logic/tasks/Task.h
@@ -37,6 +37,8 @@ public:
*/
QString failReason() const;
+ virtual QStringList warnings() const;
+
virtual bool canAbort() const { return false; }
QString getStatus()
@@ -54,6 +56,9 @@ public:
return m_progressTotal;
}
+protected:
+ void logWarning(const QString & line);
+
private:
QString describe();
@@ -85,6 +90,7 @@ private:
bool m_running = false;
bool m_finished = false;
bool m_succeeded = false;
+ QStringList m_Warnings;
QString m_failReason = "";
QString m_status;
int m_progress = 0;
diff --git a/application/MainWindow.cpp b/application/MainWindow.cpp
index 7ab83b1f..ba7c0dae 100644
--- a/application/MainWindow.cpp
+++ b/application/MainWindow.cpp
@@ -1239,7 +1239,11 @@ void MainWindow::runModalTask(Task *task)
{
connect(task, &Task::failed, [this](QString reason)
{
- CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Warning)->show();
+ CustomMessageBox::selectable(this, tr("Error"), reason, QMessageBox::Critical)->show();
+ });
+ connect(task, &Task::succeeded, [this, task]()
+ {
+ CustomMessageBox::selectable(this, tr("Warnings"), task->warnings().join('\n'), QMessageBox::Warning)->show();
});
ProgressDialog loadDialog(this);
loadDialog.setSkipButton(true, tr("Abort"));