summaryrefslogtreecommitdiff
path: root/src/modinfowithconflictinfo.h
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2020-05-24 13:27:40 +0200
committerMikaël Capelle <capelle.mikael@gmail.com>2020-05-24 13:27:40 +0200
commit9fb639a00e1a809a9ea9b5e68777ec46f534761c (patch)
tree9f72cebe6ba9825a0330fefe60a0b55de2392a2e /src/modinfowithconflictinfo.h
parent08ae9db2fd2a07acb2433275fc84c2ca47267a92 (diff)
Update ModInfo to use a single file tree for all content-related operations.
Diffstat (limited to 'src/modinfowithconflictinfo.h')
-rw-r--r--src/modinfowithconflictinfo.h38
1 files changed, 36 insertions, 2 deletions
diff --git a/src/modinfowithconflictinfo.h b/src/modinfowithconflictinfo.h
index 94a61c62..5bc1d585 100644
--- a/src/modinfowithconflictinfo.h
+++ b/src/modinfowithconflictinfo.h
@@ -1,6 +1,8 @@
#ifndef MODINFOWITHCONFLICTINFO_H
#define MODINFOWITHCONFLICTINFO_H
+#include <ifiletree.h>
+
#include "modinfo.h"
#include <QTime>
@@ -14,6 +16,11 @@ public:
virtual std::vector<ModInfo::EFlag> getFlags() const override;
/**
+ * @return true if this mod is considered "valid", that is: it contains data used by the game
+ **/
+ virtual bool isValid() const override;
+
+ /**
* @brief clear all caches held for this mod
*/
virtual void clearCaches() override;
@@ -32,6 +39,13 @@ public:
virtual void doConflictCheck() const override;
+public slots:
+
+ /**
+ * @brief Notify this mod that the content of the disk may have changed.
+ */
+ virtual void diskContentModified();
+
protected:
/**
@@ -41,6 +55,17 @@ protected:
**/
virtual bool doTestValid() const;
+ /**
+ * @brief Retrieve a file tree corresponding to the underlying disk content
+ * of this mod.
+ *
+ * The file tree should not be cached since it is already cached and updated when
+ * required.
+ *
+ * @return a file tree representing the content of this mod.
+ */
+ std::shared_ptr<const MOBase::IFileTree> contentFileTree() const;
+
ModInfoWithConflictInfo(
PluginContainer* pluginContainer,
const MOBase::IPluginGame* gamePlugin,
@@ -81,10 +106,19 @@ private:
bool hasHiddenFiles() const;
-private:
+protected:
// Current game plugin running in MO2:
- MOBase::IPluginGame const* m_GamePlugin;
+ MOBase::IPluginGame const * const m_GamePlugin;
+
+private:
+
+ // Mutex:
+ mutable std::mutex m_Mutex;
+
+ // File tree representing the content of the disk. A null pointer indicates
+ // that the content needs to be loaded from the disk:
+ mutable std::shared_ptr<const MOBase::IFileTree> m_FileTree = nullptr;
MOShared::DirectoryEntry **m_DirectoryStructure;