summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/loot.cpp48
-rw-r--r--src/loot.h8
2 files changed, 36 insertions, 20 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;
}
diff --git a/src/loot.h b/src/loot.h
index 7e5e01bd..4ec06d6f 100644
--- a/src/loot.h
+++ b/src/loot.h
@@ -79,10 +79,10 @@ public:
};
- Loot();
+ Loot(OrganizerCore& core);
~Loot();
- bool start(QWidget* parent, OrganizerCore& core, bool didUpdateMasterList);
+ bool start(QWidget* parent, bool didUpdateMasterList);
void cancel();
bool result() const;
const QString& outPath() const;
@@ -95,6 +95,7 @@ signals:
void finished();
private:
+ OrganizerCore& m_core;
std::unique_ptr<QThread> m_thread;
std::atomic<bool> m_cancel;
std::atomic<bool> m_result;
@@ -104,8 +105,7 @@ private:
Report m_report;
bool spawnLootcli(
- QWidget* parent, OrganizerCore& core, bool didUpdateMasterList,
- env::HandlePtr stdoutHandle);
+ QWidget* parent, bool didUpdateMasterList, env::HandlePtr stdoutHandle);
void lootThread();
bool waitForCompletion();