diff options
| -rw-r--r-- | src/installationmanager.cpp | 13 | ||||
| -rw-r--r-- | src/installationmanager.h | 2 | ||||
| -rw-r--r-- | src/modinfo.cpp | 8 | ||||
| -rw-r--r-- | src/modinfo.h | 22 |
4 files changed, 42 insertions, 3 deletions
diff --git a/src/installationmanager.cpp b/src/installationmanager.cpp index 26329729..880587b7 100644 --- a/src/installationmanager.cpp +++ b/src/installationmanager.cpp @@ -513,7 +513,8 @@ bool InstallationManager::ensureValidModName(GuessedValue<QString> &name) const }
bool InstallationManager::doInstall(GuessedValue<QString> &modName, int modID,
- const QString &version, const QString &newestVersion, int categoryID)
+ const QString &version, const QString &newestVersion,
+ int categoryID, const QString &repository)
{
if (!ensureValidModName(modName)) {
return false;
@@ -568,6 +569,7 @@ bool InstallationManager::doInstall(GuessedValue<QString> &modName, int modID, settingsFile.setValue("category", QString::number(categoryID));
}
settingsFile.setValue("installationFile", m_CurrentFile);
+ settingsFile.setValue("repository", repository);
if (!merge) {
// this does not clear the list we have in memory but the mod is going to have to be re-read anyway
@@ -631,6 +633,7 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString> QString version = "";
QString newestVersion = "";
int categoryID = 0;
+ QString repository = "Nexus";
QString metaName = fileName.mid(0).append(".meta");
if (QFile(metaName).exists()) {
@@ -643,6 +646,7 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString> newestVersion = metaFile.value("newestVersion", "").toString();
unsigned int categoryIndex = CategoryFactory::instance().resolveNexusID(metaFile.value("category", 0).toInt());
categoryID = CategoryFactory::instance().getCategoryID(categoryIndex);
+ repository = metaFile.value("repository", "").toString();
}
if (version.isEmpty()) {
@@ -707,7 +711,7 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString> if (installResult == IPluginInstaller::RESULT_SUCCESS) {
mapToArchive(filesTree.data());
// the simple installer only prepares the installation, the rest works the same for all installers
- if (!doInstall(modName, modID, version, newestVersion, categoryID)) {
+ if (!doInstall(modName, modID, version, newestVersion, categoryID, repository)) {
installResult = IPluginInstaller::RESULT_FAILED;
}
}
@@ -722,6 +726,11 @@ bool InstallationManager::install(const QString &fileName, GuessedValue<QString> std::set<QString> installerExtensions = installerCustom->supportedExtensions();
if (installerExtensions.find(fileInfo.suffix()) != installerExtensions.end()) {
installResult = installerCustom->install(modName, fileName, version, modID);
+ unsigned int idx = ModInfo::getIndex(modName);
+ if (idx != UINT_MAX) {
+ ModInfo::Ptr info = ModInfo::getByIndex(idx);
+ info->setRepository(repository);
+ }
}
}
}
diff --git a/src/installationmanager.h b/src/installationmanager.h index 336c1ce3..40cffad4 100644 --- a/src/installationmanager.h +++ b/src/installationmanager.h @@ -169,7 +169,7 @@ private: //bool testOverwrite(const QString &modsDirectory, MOBase::GuessedValue<QString> &modName, bool *merge = NULL);
bool doInstall(MOBase::GuessedValue<QString> &modName,
- int modID, const QString &version, const QString &newestVersion, int categoryID);
+ int modID, const QString &version, const QString &newestVersion, int categoryID, const QString &repository);
QString generateBackupName(const QString &directoryName) const;
diff --git a/src/modinfo.cpp b/src/modinfo.cpp index 9acadd97..c06a50d6 100644 --- a/src/modinfo.cpp +++ b/src/modinfo.cpp @@ -445,6 +445,7 @@ ModInfoRegular::ModInfoRegular(const QDir &path, DirectoryEntry **directoryStruc : ModInfoWithConflictInfo(directoryStructure) , m_Name(path.dirName()) , m_Path(path.absolutePath()) + , m_Repository() , m_MetaInfoChanged(false) , m_EndorsedState(ENDORSED_UNKNOWN) { @@ -492,6 +493,7 @@ void ModInfoRegular::readMeta() m_IgnoredVersion = metaFile.value("ignoredVersion", "").toString(); m_InstallationFile = metaFile.value("installationFile", "").toString(); m_NexusDescription = metaFile.value("nexusDescription", "").toString(); + m_Repository = metaFile.value("repository", "Nexus").toString(); m_LastNexusQuery = QDateTime::fromString(metaFile.value("lastNexusQuery", "").toString(), Qt::ISODate); if (metaFile.contains("endorsed")) { if (metaFile.value("endorsed").canConvert<int>()) { @@ -547,6 +549,7 @@ void ModInfoRegular::saveMeta() metaFile.setValue("ignoredVersion", m_IgnoredVersion.canonicalString()); metaFile.setValue("version", m_Version.canonicalString()); metaFile.setValue("installationFile", m_InstallationFile); + metaFile.setValue("repository", m_Repository); metaFile.setValue("modid", m_NexusID); metaFile.setValue("notes", m_Notes); metaFile.setValue("nexusDescription", m_NexusDescription); @@ -886,6 +889,11 @@ QString ModInfoRegular::getNexusDescription() const return m_NexusDescription; } +QString ModInfoRegular::repository() const +{ + return m_Repository; +} + ModInfoRegular::EEndorsedState ModInfoRegular::endorsedState() const { return m_EndorsedState; diff --git a/src/modinfo.h b/src/modinfo.h index 70bc88c6..6fbab1a0 100644 --- a/src/modinfo.h +++ b/src/modinfo.h @@ -267,6 +267,11 @@ public: virtual void setNewestVersion(const MOBase::VersionInfo &version) = 0;
/**
+ * @brief sets the repository that was used to download the mod
+ */
+ virtual void setRepository(const QString &) {}
+
+ /**
* @brief changes/updates the nexus description text
* @param description the current description text
*/
@@ -349,6 +354,11 @@ public: virtual MOBase::VersionInfo getNewestVersion() const = 0;
/**
+ * @return the repository from which the file was downloaded. Only relevant regular mods
+ */
+ virtual QString repository() const { return ""; }
+
+ /**
* @brief ignore the newest version for updates
*/
virtual void ignoreUpdate(bool ignore) = 0;
@@ -727,6 +737,12 @@ public: virtual void setPrimaryCategory(int categoryID) { m_PrimaryCategory = categoryID; m_MetaInfoChanged = true; }
/**
+ * @brief sets the download repository
+ * @param repository
+ */
+ virtual void setRepository(const QString &repository) { m_Repository = repository; }
+
+ /**
* update the endorsement state for the mod. This only changes the
* buffered state, it does not sync with Nexus
* @param endorsed the new endorsement state
@@ -844,6 +860,11 @@ public: QString getNexusDescription() const;
/**
+ * @return repository from which the file was downloaded
+ */
+ virtual QString repository() const;
+
+ /**
* @return true if the file has been endorsed on nexus
*/
virtual EEndorsedState endorsedState() const;
@@ -881,6 +902,7 @@ private: QString m_InstallationFile;
QString m_Notes;
QString m_NexusDescription;
+ QString m_Repository;
QDateTime m_CreationTime;
QDateTime m_LastNexusQuery;
|
