summaryrefslogtreecommitdiff
path: root/src/modinfo.h
diff options
context:
space:
mode:
authorTannin <devnull@localhost>2014-05-31 13:43:48 +0200
committerTannin <devnull@localhost>2014-05-31 13:43:48 +0200
commit1eb783aae348f906056cee17cb65dfd507429901 (patch)
treed9e5b93c1d528a2182416d971b27e49cb524532b /src/modinfo.h
parent93a19799b86dd6e12a186e84eb43699b318b214d (diff)
- added a new mod type that represents files handled externally (i.e. DLCs) as mods in MO
- hashes of file names in bsa files are no longer checked all the time - author and description is now read from esp files - rewrote the code that fixes modlists after a rename, should be a bit more robust - fixes to qt 5 and msvc 2013 compatibility - started to update the tutorial (not done yet!) - bugfix: counter for the problems badge wasn't calculated correctly
Diffstat (limited to 'src/modinfo.h')
-rw-r--r--src/modinfo.h165
1 files changed, 132 insertions, 33 deletions
diff --git a/src/modinfo.h b/src/modinfo.h
index 8b37b915..21267068 100644
--- a/src/modinfo.h
+++ b/src/modinfo.h
@@ -59,6 +59,7 @@ public:
FLAG_INVALID,
FLAG_BACKUP,
FLAG_OVERWRITE,
+ FLAG_FOREIGN,
FLAG_NOTENDORSED,
FLAG_NOTES,
FLAG_CONFLICT_OVERWRITE,
@@ -160,6 +161,14 @@ public:
*/
static ModInfo::Ptr createFrom(const QDir &dir, MOShared::DirectoryEntry **directoryStructure);
+ /**
+ * @brief create a new "foreign-managed" mod from a tuple of plugin and archives
+ * @param espName name of the plugin
+ * @param bsaNames names of archives
+ * @return a new mod
+ */
+ static ModInfo::Ptr createFromPlugin(const QString &espName, const QStringList &bsaNames, MOShared::DirectoryEntry **directoryStructure);
+
virtual bool isRegular() const { return false; }
virtual bool isEmpty() const { return false; }
@@ -340,6 +349,11 @@ public:
virtual int getFixedPriority() const = 0;
/**
+ * @return true if the mod is always enabled
+ */
+ virtual bool alwaysEnabled() const { return false; }
+
+ /**
* @return true if the mod can be updated
*/
virtual bool canBeUpdated() const { return false; }
@@ -390,6 +404,16 @@ public:
virtual QDateTime getLastNexusQuery() const = 0;
/**
+ * @return a list of files that, if they exist in the data directory are treated as files in THIS mod
+ */
+ virtual QStringList stealFiles() const { return QStringList(); }
+
+ /**
+ * @return a list of archives belonging to this mod (as absolute file paths)
+ */
+ virtual QStringList archives() const = 0;
+
+ /**
* @brief test if the mod belongs to the specified category
*
* @param categoryID the category to test for.
@@ -481,6 +505,50 @@ private:
};
+class ModInfoWithConflictInfo : public ModInfo
+{
+
+public:
+
+ ModInfoWithConflictInfo(MOShared::DirectoryEntry **directoryStructure);
+
+ std::vector<ModInfo::EFlag> getFlags() const;
+
+ /**
+ * @brief clear all caches held for this mod
+ */
+ virtual void clearCaches();
+private:
+
+ enum EConflictType {
+ CONFLICT_NONE,
+ CONFLICT_OVERWRITE,
+ CONFLICT_OVERWRITTEN,
+ CONFLICT_MIXED,
+ CONFLICT_REDUNDANT
+ };
+
+private:
+
+ /**
+ * @return true if there is a conflict for files in this mod
+ */
+ EConflictType isConflicted() const;
+
+ /**
+ * @return true if this mod is completely replaced by others
+ */
+ bool isRedundant() const;
+
+private:
+
+ MOShared::DirectoryEntry **m_DirectoryStructure;
+
+ mutable EConflictType m_CurrentConflictState;
+ mutable QTime m_LastConflictCheck;
+
+};
+
/**
* @brief Represents meta information about a single mod.
@@ -489,7 +557,7 @@ private:
* to manage the mod collection
*
**/
-class ModInfoRegular : public ModInfo
+class ModInfoRegular : public ModInfoWithConflictInfo
{
Q_OBJECT
@@ -644,11 +712,6 @@ public:
virtual void endorse(bool doEndorse);
/**
- * @brief clear all caches held for this mod
- */
- virtual void clearCaches();
-
- /**
* @brief getter for the mod name
*
* @return the mod name
@@ -746,7 +809,9 @@ public:
/**
* @return last time nexus was queried for infos on this mod
*/
- QDateTime getLastNexusQuery() const;
+ virtual QDateTime getLastNexusQuery() const;
+
+ virtual QStringList archives() const;
/**
* @brief stores meta information back to disk
@@ -754,15 +819,6 @@ public:
virtual void saveMeta();
void readMeta();
-private:
-
- enum EConflictType {
- CONFLICT_NONE,
- CONFLICT_OVERWRITE,
- CONFLICT_OVERWRITTEN,
- CONFLICT_MIXED,
- CONFLICT_REDUNDANT
- };
private slots:
@@ -770,18 +826,6 @@ private slots:
void nxmEndorsementToggled(int, QVariant userData, QVariant resultData);
void nxmRequestFailed(int modID, int fileID, QVariant userData, const QString &errorMessage);
-private:
-
- /**
- * @return true if there is a conflict for files in this mod
- */
- EConflictType isConflicted() const;
-
- /**
- * @return true if this mod is completely replaced by others
- */
- bool isRedundant() const;
-
protected:
ModInfoRegular(const QDir &path, MOShared::DirectoryEntry **directoryStructure);
@@ -807,11 +851,6 @@ private:
NexusBridge m_NexusBridge;
- MOShared::DirectoryEntry **m_DirectoryStructure;
-
- mutable EConflictType m_CurrentConflictState;
- mutable QTime m_LastConflictCheck;
-
};
@@ -887,6 +926,7 @@ public:
virtual QString getDescription() const;
virtual QDateTime getLastNexusQuery() const { return QDateTime(); }
virtual QString getNexusDescription() const { return QString(); }
+ virtual QStringList archives() const;
private:
@@ -898,4 +938,63 @@ private:
};
+
+class ModInfoForeign : public ModInfoWithConflictInfo
+{
+
+ Q_OBJECT
+
+ friend class ModInfo;
+
+public:
+
+ virtual bool updateAvailable() const { return false; }
+ virtual bool updateIgnored() const { return false; }
+ virtual bool downgradeAvailable() const { return false; }
+ virtual bool updateNXMInfo() { return false; }
+ virtual void setCategory(int, bool) {}
+ virtual bool setName(const QString&) { return false; }
+ virtual void setNotes(const QString&) {}
+ virtual void setNexusID(int) {}
+ virtual void setNewestVersion(const MOBase::VersionInfo&) {}
+ virtual void ignoreUpdate(bool) {}
+ virtual void setNexusDescription(const QString&) {}
+ virtual void addNexusCategory(int) {}
+ virtual void setIsEndorsed(bool) {}
+ virtual void setNeverEndorse() {}
+ virtual bool remove() { return false; }
+ virtual void endorse(bool) {}
+ virtual bool isEmpty() const { return false; }
+ virtual QString name() const;
+ virtual QString notes() const { return ""; }
+ virtual QDateTime creationTime() const;
+ virtual QString absolutePath() const;
+ virtual MOBase::VersionInfo getNewestVersion() const { return ""; }
+ virtual QString getInstallationFile() const { return ""; }
+ virtual int getNexusID() const { return -1; }
+ virtual std::vector<QString> getIniTweaks() const { return std::vector<QString>(); }
+ virtual std::vector<ModInfo::EFlag> getFlags() const;
+ virtual int getHighlight() const;
+ virtual QString getDescription() const;
+ virtual QDateTime getLastNexusQuery() const { return QDateTime(); }
+ virtual QString getNexusDescription() const { return QString(); }
+ virtual int getFixedPriority() const { return INT_MIN; }
+ virtual QStringList archives() const { return m_Archives; }
+ virtual QStringList stealFiles() const { return m_Archives + QStringList(m_ReferenceFile); }
+ virtual bool alwaysEnabled() const { return true; }
+
+protected:
+
+ ModInfoForeign(const QString &referenceFile, const QStringList &archives, MOShared::DirectoryEntry **directoryStructure);
+
+private:
+
+ QString m_Name;
+ QString m_ReferenceFile;
+ QStringList m_Archives;
+ QDateTime m_CreationTime;
+ int m_Priority;
+
+};
+
#endif // MODINFO_H