summaryrefslogtreecommitdiff
path: root/src/loot.cpp
diff options
context:
space:
mode:
authorisanae <14251494+isanae@users.noreply.github.com>2019-11-26 04:57:20 -0500
committerGitHub <noreply@github.com>2019-11-26 04:57:20 -0500
commite845126e09357f8713ca0c9f593970c7c634328e (patch)
treeb3e402809ded25a9d9d7b45e04935a85b96eb0a6 /src/loot.cpp
parent36c6dfd5b8c6c87410c7c18fb67fd00a72c29491 (diff)
parent5fb785aceecf32d6012bad044027572e02d22a9a (diff)
Merge pull request #904 from isanae/lock-job
Use a Job to capture all child processes
Diffstat (limited to 'src/loot.cpp')
-rw-r--r--src/loot.cpp48
1 files changed, 32 insertions, 16 deletions
diff --git a/src/loot.cpp b/src/loot.cpp
index 47a70596..a86cdcff 100644
--- a/src/loot.cpp
+++ b/src/loot.cpp
@@ -385,8 +385,8 @@ QString Loot::Message::toMarkdown() const
}
-Loot::Loot()
- : m_thread(nullptr), m_cancel(false), m_result(false)
+Loot::Loot(OrganizerCore& core)
+ : m_core(core), m_thread(nullptr), m_cancel(false), m_result(false)
{
}
@@ -408,7 +408,7 @@ Loot::~Loot()
}
}
-bool Loot::start(QWidget* parent, OrganizerCore& core, bool didUpdateMasterList)
+bool Loot::start(QWidget* parent, bool didUpdateMasterList)
{
log::debug("starting loot");
@@ -420,10 +420,10 @@ bool Loot::start(QWidget* parent, OrganizerCore& core, bool didUpdateMasterList)
}
// vfs
- core.prepareVFS();
+ m_core.prepareVFS();
// spawning
- if (!spawnLootcli(parent, core, didUpdateMasterList, std::move(stdoutHandle))) {
+ if (!spawnLootcli(parent, didUpdateMasterList, std::move(stdoutHandle))) {
return false;
}
@@ -436,19 +436,29 @@ bool Loot::start(QWidget* parent, OrganizerCore& core, bool didUpdateMasterList)
}
bool Loot::spawnLootcli(
- QWidget* parent, OrganizerCore& core, bool didUpdateMasterList,
- env::HandlePtr stdoutHandle)
+ QWidget* parent, bool didUpdateMasterList, env::HandlePtr stdoutHandle)
{
- const auto logLevel = core.settings().diagnostics().lootLogLevel();
+ const auto logLevel = m_core.settings().diagnostics().lootLogLevel();
QStringList parameters;
parameters
- << "--game" << core.managedGame()->gameShortName()
- << "--gamePath" << QString("\"%1\"").arg(core.managedGame()->gameDirectory().absolutePath())
- << "--pluginListPath" << QString("\"%1/loadorder.txt\"").arg(core.profilePath())
- << "--logLevel" << QString::fromStdString(lootcli::logLevelToString(logLevel))
- << "--out" << QString("\"%1\"").arg(LootReportPath)
- << "--language" << core.settings().interface().language();
+ << "--game"
+ << m_core.managedGame()->gameShortName()
+
+ << "--gamePath"
+ << QString("\"%1\"").arg(m_core.managedGame()->gameDirectory().absolutePath())
+
+ << "--pluginListPath"
+ << QString("\"%1/loadorder.txt\"").arg(m_core.profilePath())
+
+ << "--logLevel"
+ << QString::fromStdString(lootcli::logLevelToString(logLevel))
+
+ << "--out"
+ << QString("\"%1\"").arg(LootReportPath)
+
+ << "--language"
+ << m_core.settings().interface().language();
if (didUpdateMasterList) {
parameters << "--skipUpdateMasterlist";
@@ -696,6 +706,12 @@ Loot::Plugin Loot::reportPlugin(const QJsonObject& plugin) const
return {};
}
+ // ignore disabled plugins; lootcli doesn't know if a plugin is enabled or not
+ // and will report information on any plugin that's in the filesystem
+ if (!m_core.pluginList()->isEnabled(p.name)) {
+ return {};
+ }
+
if (plugin.contains("incompatibilities")) {
p.incompatibilities = reportFiles(getOpt<QJsonArray>(plugin, "incompatibilities"));
}
@@ -836,10 +852,10 @@ bool runLoot(QWidget* parent, OrganizerCore& core, bool didUpdateMasterList)
core.savePluginList();
try {
- Loot loot;
+ Loot loot(core);
LootDialog dialog(parent, core, loot);
- if (!loot.start(parent, core, didUpdateMasterList)) {
+ if (!loot.start(parent, didUpdateMasterList)) {
return false;
}