diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-05-25 17:57:07 +0200 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-05-25 17:57:07 +0200 |
| commit | 03fc2b0dc25ae00322c6681d99f48857ecf77935 (patch) | |
| tree | 55ee063981b6844234d0681d43148b62dd0ec9bb /src/modinfowithconflictinfo.cpp | |
| parent | 86f516953df9dc80c6726c30f47e15b660a89a4e (diff) | |
Update ModInfo classes following MemoizedLocked changes.
Diffstat (limited to 'src/modinfowithconflictinfo.cpp')
| -rw-r--r-- | src/modinfowithconflictinfo.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/src/modinfowithconflictinfo.cpp b/src/modinfowithconflictinfo.cpp index d2a0ca51..7181bef9 100644 --- a/src/modinfowithconflictinfo.cpp +++ b/src/modinfowithconflictinfo.cpp @@ -15,7 +15,9 @@ namespace fs = std::filesystem; ModInfoWithConflictInfo::ModInfoWithConflictInfo( PluginContainer *pluginContainer, const MOBase::IPluginGame* gamePlugin, DirectoryEntry **directoryStructure) : ModInfo(pluginContainer), m_GamePlugin(gamePlugin), - m_FileTree(&ModInfoWithConflictInfo::updateFileTree), m_Valid(&ModInfoWithConflictInfo::doTestValid), m_Contents(&ModInfoWithConflictInfo::doGetContents), + m_FileTree([this]() { return QDirFileTree::makeTree(absolutePath()); }), + m_Valid([this]() { return doIsValid(); }), + m_Contents([this]() { return doGetContents(); }), m_DirectoryStructure(directoryStructure), m_HasLooseOverwrite(false), m_HasHiddenFiles(false) {} void ModInfoWithConflictInfo::clearCaches() @@ -304,20 +306,12 @@ void ModInfoWithConflictInfo::diskContentModified() { m_Contents.invalidate(); } -std::shared_ptr<const IFileTree> ModInfoWithConflictInfo::updateFileTree() const { - return QDirFileTree::makeTree(absolutePath()); -} - -std::shared_ptr<const IFileTree> ModInfoWithConflictInfo::contentFileTree() const { - return m_FileTree.value(this); -} - void ModInfoWithConflictInfo::prefetch() { // Populating the tree to 1-depth: contentFileTree()->size(); } -bool ModInfoWithConflictInfo::doTestValid() const { +bool ModInfoWithConflictInfo::doIsValid() const { auto mdc = m_GamePlugin->feature<ModDataChecker>(); if (mdc) { @@ -328,10 +322,14 @@ bool ModInfoWithConflictInfo::doTestValid() const { return true; } +std::shared_ptr<const IFileTree> ModInfoWithConflictInfo::contentFileTree() const { + return m_FileTree.value(); +} + bool ModInfoWithConflictInfo::isValid() const { - return m_Valid.value(this); + return m_Valid.value(); } std::vector<ModInfo::EContent> ModInfoWithConflictInfo::getContents() const { - return m_Contents.value(this); + return m_Contents.value(); } |
