diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2020-04-17 09:06:41 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2020-04-17 09:06:41 -0400 |
| commit | 3b0fbebc6ad8979d9d4551fcd9db1b8f2ca4bf48 (patch) | |
| tree | fd3aab69e774168b85b4ffaefdab6a0fdd163b2b | |
| parent | d7ceadeae173e26d63db0b58b6ea5a3ed839999c (diff) | |
dump a bunch of counts for mods when selecting a profile
| -rw-r--r-- | src/main.cpp | 2 | ||||
| -rw-r--r-- | src/modinfoforeign.cpp | 3 | ||||
| -rw-r--r-- | src/modinfoforeign.h | 4 | ||||
| -rw-r--r-- | src/organizercore.cpp | 4 | ||||
| -rw-r--r-- | src/profile.cpp | 96 | ||||
| -rw-r--r-- | src/profile.h | 2 |
6 files changed, 107 insertions, 4 deletions
diff --git a/src/main.cpp b/src/main.cpp index ceaa59f2..b6b25dd7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -266,8 +266,6 @@ QString determineProfile(QStringList &arguments, const Settings &settings) if (!selectedProfileName) { log::debug("no configured profile"); selectedProfileName = "Default"; - } else { - log::debug("configured profile: {}", *selectedProfileName); } return *selectedProfileName; diff --git a/src/modinfoforeign.cpp b/src/modinfoforeign.cpp index 84199eae..e8f9548a 100644 --- a/src/modinfoforeign.cpp +++ b/src/modinfoforeign.cpp @@ -49,7 +49,8 @@ ModInfoForeign::ModInfoForeign(const QString &modName, DirectoryEntry **directoryStructure, PluginContainer *pluginContainer) : ModInfoWithConflictInfo(pluginContainer, directoryStructure), - m_ReferenceFile(referenceFile), m_Archives(archives) { + m_ReferenceFile(referenceFile), m_Archives(archives), m_ModType(modType) +{ m_CreationTime = QFileInfo(referenceFile).birthTime(); switch (modType) { case ModInfo::EModType::MOD_DLC: diff --git a/src/modinfoforeign.h b/src/modinfoforeign.h index 3308d42f..c5763d6b 100644 --- a/src/modinfoforeign.h +++ b/src/modinfoforeign.h @@ -65,6 +65,8 @@ public: virtual bool alwaysEnabled() const { return true; } virtual void addInstalledFile(int, int) {} + ModInfo::EModType modType() const { return m_ModType; } + protected: ModInfoForeign(const QString &modName, const QString &referenceFile, const QStringList &archives, ModInfo::EModType modType, @@ -77,7 +79,7 @@ private: QStringList m_Archives; QDateTime m_CreationTime; int m_Priority; - + ModInfo::EModType m_ModType; }; #endif // MODINFOFOREIGN_H diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 0b3a4bfe..dacf0175 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -508,6 +508,8 @@ void OrganizerCore::setCurrentProfile(const QString &profileName) return; } + log::debug("selecting profile '{}'", profileName); + QDir profileBaseDir(settings().paths().profiles()); QString profileDir = profileBaseDir.absoluteFilePath(profileName); @@ -537,6 +539,8 @@ void OrganizerCore::setCurrentProfile(const QString &profileName) connect(m_CurrentProfile, SIGNAL(modStatusChanged(uint)), this, SLOT(modStatusChanged(uint))); connect(m_CurrentProfile, SIGNAL(modStatusChanged(QList<uint>)), this, SLOT(modStatusChanged(QList<uint>))); refreshDirectoryStructure(); + + m_CurrentProfile->debugDump(); } MOBase::IModRepositoryBridge *OrganizerCore::createNexusBridge() const diff --git a/src/profile.cpp b/src/profile.cpp index 19c0d750..927e575c 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -31,6 +31,7 @@ along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>. #include <dataarchives.h> #include "util.h" #include "registry.h" +#include "modinfoforeign.h" #include <questionboxmemory.h> #include <QApplication> @@ -1065,3 +1066,98 @@ void Profile::removeForcedLibraries(const QString &executable) { m_Settings->remove("forced_libraries/" + executable); } + +void Profile::debugDump() const +{ + struct Pair + { + std::size_t enabled=0; + std::size_t total=0; + }; + + Pair total; + Pair real; + Pair backup; + Pair separators; + Pair dlc; + Pair cc; + Pair unmanaged; + + auto add = [](Pair& p, const ModStatus& status) { + ++p.total; + + if (status.m_Enabled) { + ++p.enabled; + } + }; + + + for (const auto& status : m_ModStatus) { + if (status.m_Overwrite) { + continue; + } + + auto index = m_ModIndexByPriority.find(status.m_Priority); + if (index == m_ModIndexByPriority.end()) { + log::error("mod with priority {} not in priority map", status.m_Priority); + continue; + } + + auto m = ModInfo::getByIndex(index->second); + if (!m) { + log::error("mod index {} with priority {} not found", index->second, status.m_Priority); + continue; + } + + add(total, status); + + if (m->hasFlag(ModInfo::FLAG_BACKUP)) { + add(backup, status); + } + + if (m->hasFlag(ModInfo::FLAG_SEPARATOR)) { + add(separators, status); + } + + if (m->hasFlag(ModInfo::FLAG_FOREIGN)) { + if (auto* f = dynamic_cast<ModInfoForeign*>(m.get())) { + switch (f->modType()) + { + case ModInfo::MOD_DLC: + add(dlc, status); + break; + + case ModInfo::MOD_CC: + add(cc, status); + break; + + default: + add(unmanaged, status); + break; + } + } + } + + if (!m->hasAnyOfTheseFlags({ + ModInfo::FLAG_BACKUP, ModInfo::FLAG_FOREIGN, + ModInfo::FLAG_SEPARATOR, ModInfo::FLAG_OVERWRITE })) + { + add(real, status); + } + } + + log::debug( + "profile '{}' in '{}': " + "mods={}/{} backup={}/{} separators={}/{} real={}/{} dlc={}/{} " + "cc={}/{} unmanaged={}/{} localsaves={}, localsettings={}", + name(), absolutePath(), + total.enabled, total.total, + backup.enabled, backup.total, + separators.enabled, separators.total, + real.enabled, real.total, + dlc.enabled, dlc.total, + cc.enabled, cc.total, + unmanaged.enabled, unmanaged.total, + localSavesEnabled() ? "yes" : "no", + localSettingsEnabled() ? "yes" : "no"); +} diff --git a/src/profile.h b/src/profile.h index d0bd4a84..c7cbc7b7 100644 --- a/src/profile.h +++ b/src/profile.h @@ -336,6 +336,8 @@ public: void storeForcedLibraries(const QString &executable, const QList<MOBase::ExecutableForcedLoadSetting> &values); void removeForcedLibraries(const QString &executable); + void debugDump() const; + signals: /** |
