mirror of
https://github.com/ModOrganizer2/modorganizer-diagnose_basic.git
synced 2026-07-27 14:03:10 -07:00
Compare commits
13
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d983c908ee | ||
|
|
0cc077b8c4 | ||
|
|
b245bc2ce3 | ||
|
|
0a1707fa9c | ||
|
|
b10b1f28ff | ||
|
|
59c10d78cd | ||
|
|
7dd29a68e2 | ||
|
|
ce0dc685ca | ||
|
|
e426d8efb4 | ||
|
|
bf00944706 | ||
|
|
97c8769334 | ||
|
|
05d1782cf1 | ||
|
|
f114b3ee60 |
@@ -0,0 +1,20 @@
|
||||
Import('qt_env')
|
||||
|
||||
env = qt_env.Clone()
|
||||
|
||||
env.AppendUnique(CPPDEFINES = [
|
||||
'DIAGNOSEBASIC_LIBRARY',
|
||||
'NOMINMAX',
|
||||
# suppress a few warnings caused by boost vs vc++ paranoia
|
||||
'_SCL_SECURE_NO_WARNINGS'
|
||||
])
|
||||
|
||||
env.AppendUnique(CPPPATH = [
|
||||
'${BOOSTPATH}'
|
||||
])
|
||||
|
||||
lib = env.SharedLibrary('diagnoseBasic', env.Glob('*.cpp'))
|
||||
env.InstallModule(lib)
|
||||
|
||||
res = env['QT_USED_MODULES']
|
||||
Return('res')
|
||||
@@ -31,4 +31,5 @@ INCLUDEPATH += "$${BOOSTPATH}"
|
||||
#DEFINES += INIEDITOR_LIBRARY
|
||||
|
||||
OTHER_FILES += \
|
||||
diagnosebasic.json
|
||||
diagnosebasic.json\
|
||||
SConscript
|
||||
|
||||
+24
-15
@@ -20,6 +20,9 @@
|
||||
#include "diagnosebasic.h"
|
||||
#include <report.h>
|
||||
#include <utility.h>
|
||||
#include <imodlist.h>
|
||||
#include <ipluginlist.h>
|
||||
#include <igameinfo.h>
|
||||
#include <QtPlugin>
|
||||
#include <QFile>
|
||||
#include <QDir>
|
||||
@@ -64,7 +67,10 @@ bool DiagnoseBasic::init(IOrganizer *moInfo)
|
||||
m_MOInfo->pluginList()->onPluginMoved([&] (const QString&, int, int) {
|
||||
invalidate();
|
||||
});
|
||||
m_MOInfo->pluginList()->onRefreshed([&] () { this->invalidate(); });
|
||||
m_MOInfo->pluginList()->onRefreshed([&] () { invalidate(); });
|
||||
m_MOInfo->pluginList()->onPluginStateChanged([&] (const QString &, IPluginList::PluginStates) {
|
||||
invalidate();
|
||||
});
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -336,14 +342,15 @@ bool DiagnoseBasic::assetOrder() const
|
||||
// list of mods containing conflicted scripts. We care only for those
|
||||
std::map<QString, QSet<QString>> scriptMods;
|
||||
auto filter = [] (const IOrganizer::FileInfo &file) -> bool {
|
||||
return file.filePath.endsWith(".pex", Qt::CaseInsensitive); };
|
||||
foreach (const IOrganizer::FileInfo & pex,
|
||||
m_MOInfo->findFileInfos("scripts", filter)
|
||||
) {
|
||||
return file.filePath.endsWith(".pex", Qt::CaseInsensitive); };
|
||||
|
||||
for (const IOrganizer::FileInfo &pex : m_MOInfo->findFileInfos("scripts", filter)) {
|
||||
QStringList origins = pex.origins;
|
||||
origins.removeAll("data"); // ignore files in base directory
|
||||
// ignore files in base directories
|
||||
origins.removeAll("data");
|
||||
origins.removeAll("Overwrite");
|
||||
if (origins.size() > 1) {
|
||||
foreach(const QString &origin, origins) {
|
||||
for(const QString &origin : origins) {
|
||||
scriptMods[origin].insert(pex.filePath);
|
||||
}
|
||||
}
|
||||
@@ -351,10 +358,12 @@ bool DiagnoseBasic::assetOrder() const
|
||||
|
||||
// produce a list with the information we need: plugin, mod and the priority for each
|
||||
QStringList esps = m_MOInfo->findFiles("",
|
||||
[] (const QString &fileName) -> bool { return fileName.endsWith(".esp", Qt::CaseInsensitive)
|
||||
|| fileName.endsWith(".esm", Qt::CaseInsensitive); });
|
||||
foreach (const QString &esp, esps) {
|
||||
foreach (const QString origin, m_MOInfo->getFileOrigins(esp)) {
|
||||
[] (const QString &fileName) -> bool {
|
||||
return fileName.endsWith(".esp", Qt::CaseInsensitive)
|
||||
|| fileName.endsWith(".esm", Qt::CaseInsensitive);
|
||||
});
|
||||
for (const QString &esp : esps) {
|
||||
for (const QString origin : m_MOInfo->getFileOrigins(esp)) {
|
||||
ListElement ele;
|
||||
|
||||
ele.espName = QFileInfo(esp).fileName();
|
||||
@@ -371,7 +380,6 @@ bool DiagnoseBasic::assetOrder() const
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// generate a copy of list that contains each mod only once, otherwise
|
||||
// strange things happen if a mod contains multiple esps that are mixed
|
||||
// with esps from other mods
|
||||
@@ -379,17 +387,18 @@ bool DiagnoseBasic::assetOrder() const
|
||||
{
|
||||
// sort the input list so we get predictable results
|
||||
std::sort(modList.begin(), modList.end(),
|
||||
[] (const ListElement &lhs, const ListElement &rhs) -> bool { return lhs.pluginPriority < rhs.pluginPriority; });
|
||||
[] (const ListElement &lhs, const ListElement &rhs) -> bool {
|
||||
return lhs.pluginPriority < rhs.pluginPriority;
|
||||
});
|
||||
|
||||
std::set<QString> includedMods;
|
||||
foreach(const ListElement &ele, modList) {
|
||||
for (const ListElement &ele : modList) {
|
||||
if (includedMods.find(ele.modName) == includedMods.end()) {
|
||||
distinctModList.push_back(ele);
|
||||
includedMods.insert(ele.modName);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (distinctModList.size() == 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ along with this plugin. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <QSet>
|
||||
|
||||
|
||||
class DiagnoseBasic : public QObject, MOBase::IPlugin, MOBase::IPluginDiagnose
|
||||
class DiagnoseBasic : public QObject, public MOBase::IPlugin, public MOBase::IPluginDiagnose
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginDiagnose)
|
||||
|
||||
Reference in New Issue
Block a user