From 7d79e3ad1e8a710e836e1cd44106a610e6d2a049 Mon Sep 17 00:00:00 2001 From: Tannin Date: Thu, 15 Aug 2013 22:13:18 +0200 Subject: - bugfix: nameprefix-flag incorrectly interpreted on oblivion-style bsas - bugfix: optimization for missing inis fixed - bugfix: fixmods didn't search for esps in overwrite - bugfix: configurator didn't work for fallout new vegas because of a missing cast - bugfix: configurator attempted parameter formatting on ini files instead of using the raw data - bugfix: searching for a path in the directory structure could cause a crash when not using the directory output - optimization to findfirstfile for cases where a single file is searched - display of bsas changed. hopefully it is more understandable now - cache for the test whether a mod is in conflict. Should speed ab scrolling in mod list - mod list has now an additional column for the installation time - nmm importer no longer cancels in cases where a data file references an undeclared mod. - integrated improved settings.json for the configurator contributed by "delta534" --- src/modinfo.cpp | 93 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 53 insertions(+), 40 deletions(-) (limited to 'src/modinfo.cpp') diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 1bb2daad..f6043d97 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -298,7 +298,7 @@ ModInfoRegular::ModInfoRegular(const QDir &path, DirectoryEntry **directoryStruc m_EndorsedState(ENDORSED_UNKNOWN), m_DirectoryStructure(directoryStructure) { testValid(); - + m_CreationTime = QFileInfo(path.absolutePath()).created(); // read out the meta-file for information QString metaFileName = path.absoluteFilePath("meta.ini"); QSettings metaFile(metaFileName, QSettings::IniFormat); @@ -645,6 +645,11 @@ QString ModInfoRegular::notes() const return m_Notes; } +QDateTime ModInfoRegular::creationTime() const +{ + return m_CreationTime; +} + QString ModInfoRegular::getNexusDescription() const { return m_NexusDescription; @@ -659,55 +664,63 @@ ModInfoRegular::EEndorsedState ModInfoRegular::endorsedState() const ModInfoRegular::EConflictType ModInfoRegular::isConflicted() const { - bool overwrite = false; - bool overwritten = false; - bool regular = false; + // this is costy so cache the result + QTime now = QTime::currentTime(); + if (abs(m_LastConflictCheck.secsTo(now)) > 10) { + bool overwrite = false; + bool overwritten = false; + bool regular = false; - int dataID = 0; - if ((*m_DirectoryStructure)->originExists(L"data")) { - dataID = (*m_DirectoryStructure)->getOriginByName(L"data").getID(); - } + int dataID = 0; + if ((*m_DirectoryStructure)->originExists(L"data")) { + dataID = (*m_DirectoryStructure)->getOriginByName(L"data").getID(); + } - std::wstring name = ToWString(m_Name); - if ((*m_DirectoryStructure)->originExists(name)) { - FilesOrigin &origin = (*m_DirectoryStructure)->getOriginByName(name); - std::vector files = origin.getFiles(); - for (auto iter = files.begin(); iter != files.end() && (!overwrite || !overwritten || !regular); ++iter) { - const std::vector &alternatives = (*iter)->getAlternatives(); - if (alternatives.size() == 0) { - // no alternatives -> no conflict - regular = true; - } else { - for (auto altIter = alternatives.begin(); altIter != alternatives.end(); ++altIter) { - // don't treat files overwritten in data as "conflict" - if (*altIter != dataID) { - bool ignore = false; - if ((*iter)->getOrigin(ignore) == origin.getID()) { - overwrite = true; - break; - } else { - overwritten = true; - break; + std::wstring name = ToWString(m_Name); + if ((*m_DirectoryStructure)->originExists(name)) { + FilesOrigin &origin = (*m_DirectoryStructure)->getOriginByName(name); + std::vector files = origin.getFiles(); + for (auto iter = files.begin(); iter != files.end() && (!overwrite || !overwritten || !regular); ++iter) { + const std::vector &alternatives = (*iter)->getAlternatives(); + if (alternatives.size() == 0) { + // no alternatives -> no conflict + regular = true; + } else { + for (auto altIter = alternatives.begin(); altIter != alternatives.end(); ++altIter) { + // don't treat files overwritten in data as "conflict" + if (*altIter != dataID) { + bool ignore = false; + if ((*iter)->getOrigin(ignore) == origin.getID()) { + overwrite = true; + break; + } else { + overwritten = true; + break; + } + } else if (alternatives.size() == 1) { + // only alternative is data -> no conflict + regular = true; } - } else if (alternatives.size() == 1) { - // only alternative is data -> no conflict - regular = true; } } } } - } - if (overwrite && overwritten) return CONFLICT_MIXED; - else if (overwrite) return CONFLICT_OVERWRITE; - else if (overwritten) { - if (!regular) { - return CONFLICT_REDUNDANT; - } else { - return CONFLICT_OVERWRITTEN; + m_LastConflictCheck = QTime::currentTime(); + + if (overwrite && overwritten) m_CurrentConflictState = CONFLICT_MIXED; + else if (overwrite) m_CurrentConflictState = CONFLICT_OVERWRITE; + else if (overwritten) { + if (!regular) { + m_CurrentConflictState = CONFLICT_REDUNDANT; + } else { + m_CurrentConflictState = CONFLICT_OVERWRITTEN; + } } + else m_CurrentConflictState = CONFLICT_NONE; } - else return CONFLICT_NONE; + + return m_CurrentConflictState; } -- cgit v1.3.1